perf: update automations

This commit is contained in:
ibuler
2025-03-04 15:45:45 +08:00
parent 598b053841
commit 6a9d51c859
8 changed files with 39 additions and 30 deletions

View File

@@ -2,6 +2,7 @@
<transition name="dialog-fade">
<el-dialog
:append-to-body="true"
:class="{ shadow: shadow }"
:modal-append-to-body="true"
:title="title"
:top="top"
@@ -79,6 +80,10 @@ export default {
maxWidth: {
type: String,
default: '1200px'
},
shadow: {
type: Boolean,
default: true
}
},
data() {
@@ -101,14 +106,14 @@ export default {
</script>
<style lang="scss" scoped>
.dialog.shadow ::v-deep .el-dialog {
box-shadow: 1px 2px 12px 0 rgba(0, 0, 0, 0.6);
}
.dialog ::v-deep .el-dialog {
border-radius: 0.3em;
max-width: min(100vw, 1500px);
//.el-form, .form-buttons {
// margin-left: 20px;
//}
.form-group-header {
margin-left: 20px;
}
@@ -132,7 +137,7 @@ export default {
&__body {
padding: 20px 30px;
font-size: 13px;
font-size: 13px;
&:has(.el-table) {
background: #f3f3f4;

View File

@@ -3,6 +3,7 @@
v-if="$attrs.visible"
:close-on-click-modal="false"
:destroy-on-close="true"
:modal="false"
:show-cancel="false"
:show-confirm="false"
:title="$tc('PlatformProtocolConfig') + '' + protocol.name"

View File

@@ -1,10 +1,12 @@
<template>
<div ref="formGroup" class="form-group-header">
<div v-if="line" class="hr-line-dashed" />
<h3 @click="toggle">{{ group['title'] }} </h3>
<span class="compass" @click="toggle">
<i :class="iconClass" />
</span>
<div v-if="group['title']">
<h3 @click="toggle">{{ group['title'] }} </h3>
<span class="compass" @click="toggle">
<i :class="iconClass" />
</span>
</div>
<div v-if="!isVisible" class="ellipsis" @click="toggle">
<i class="fa fa-angle-double-down" />
</div>

View File

@@ -182,7 +182,7 @@ export default {
width: 100%;;
.el-form-item__content {
width: calc(100% - 50px);
width: calc(75% - 50px);
}
.el-select {
@@ -196,7 +196,7 @@ export default {
display: inline-block;
position: absolute;
right: 18px;
margin-top: 22px;
//margin-top: 22px;
}
}

View File

@@ -1,6 +1,6 @@
<template>
<IBox>
<GenericCreateUpdateForm class="form" v-bind="$data" />
<GenericCreateUpdateForm :object="object" class="form" v-bind="$data" />
</IBox>
</template>
@@ -18,8 +18,7 @@ export default {
props: {
object: {
type: Object,
default: () => {
}
default: () => ({})
}
},
data() {
@@ -31,7 +30,7 @@ export default {
ansible_enabled: true
}
},
url: `/api/v1/assets/platforms/`,
url: `/api/v1/assets/platforms/${this.object.id}/`,
disabled: !canEdit,
hasReset: false,
hasDetailInMsg: false,
@@ -52,15 +51,18 @@ export default {
},
async mounted() {
try {
const { category, type } = this.object
const url = `/api/v1/assets/categories/constraints/?category=${category.value}&type=${type.value}`
this.defaultOptions = await this.$axios.get(url)
await setAutomations(this)
await this.setDefaultAutomations()
} finally {
this.loading = false
}
},
methods: {
async setDefaultAutomations() {
const { category, type } = this.object
const url = `/api/v1/assets/categories/constraints/?category=${category.value}&type=${type.value}`
this.defaultOptions = await this.$axios.get(url)
await setAutomations(this)
},
submit(validValues) {
if (!this.canSubmit || !this.isSystemAdmin) {
return this.$message.error(this.$tc('NoPermission'))
@@ -88,7 +90,7 @@ export default {
width: 100%;;
.el-form-item__content {
width: calc(100% - 50px) !important;
width: calc(75% - 50px) !important;
}
.el-select {
@@ -102,7 +104,6 @@ export default {
display: inline-block;
position: absolute;
right: 18px;
margin-top: 22px;
}
}

View File

@@ -61,7 +61,7 @@ export default {
visible: false,
fields: ['domain_enabled'],
quickActions: [],
url: `/api/v1/assets/platforms/${this.object.id}`,
url: `/api/v1/assets/platforms/${this.object.id}/`,
detailFields: [
'id', 'name', 'charset', 'internal',
{

View File

@@ -1,7 +1,7 @@
<template>
<GenericDetailPage :active-menu.sync="config.activeMenu" :object.sync="TaskDetail" v-bind="config" v-on="$listeners">
<GenericDetailPage :active-menu.sync="config.activeMenu" :object.sync="instance" v-bind="config" v-on="$listeners">
<keep-alive>
<component :is="config.activeMenu" :object="TaskDetail" />
<component :is="config.activeMenu" :object="instance" />
</keep-alive>
</GenericDetailPage>
</template>
@@ -22,10 +22,10 @@ export default {
},
data() {
return {
TaskDetail: {},
instance: {},
actions: {},
config: {
url: '/api/v1/assets/platforms',
url: '/api/v1/assets/platforms/',
title: this.$t('PlatformDetail'),
activeMenu: 'Detail',
submenu: [
@@ -44,13 +44,13 @@ export default {
],
actions: {
canUpdate: () => {
return !this.TaskDetail.internal && this.$hasPerm('assets.change_platform')
return !this.instance.internal && this.$hasPerm('assets.change_platform')
},
canDelete: () => {
return !this.TaskDetail.internal && this.$hasPerm('assets.delete_platform')
return !this.instance.internal && this.$hasPerm('assets.delete_platform')
},
updateCallback: () => {
const { id, type, category } = this.TaskDetail
const { id, type, category } = this.instance
this.$router.push({
name: 'PlatformUpdate',
params: { id },

View File

@@ -157,7 +157,7 @@ export default {
activated() {
setTimeout(() => {
this.tab.activeMenu = window.localStorage.getItem('lastTab') || 'host'
this.$refs.genericListTable.reloadTable()
this.$refs.genericListTable?.reloadTable()
}, 300)
},
async mounted() {