fix:调整module的导入导出
This commit is contained in:
@@ -157,6 +157,8 @@ export default {
|
|||||||
url = '/asset/asset/cancelImport'
|
url = '/asset/asset/cancelImport'
|
||||||
} else if (this.importUrl.indexOf('endpoint') > -1) {
|
} else if (this.importUrl.indexOf('endpoint') > -1) {
|
||||||
url = '/monitor/endpoint/cancelImport'
|
url = '/monitor/endpoint/cancelImport'
|
||||||
|
} else if (this.importUrl.indexOf('module') > -1) {
|
||||||
|
url = '/monitor/module/cancelImport'
|
||||||
} else if (this.importUrl.indexOf('rule') > -1) {
|
} else if (this.importUrl.indexOf('rule') > -1) {
|
||||||
url = '/alert/rule/cancelImport'
|
url = '/alert/rule/cancelImport'
|
||||||
} else if (this.importUrl.indexOf('panel') > -1) {
|
} else if (this.importUrl.indexOf('panel') > -1) {
|
||||||
@@ -243,6 +245,9 @@ export default {
|
|||||||
} else if (this.importUrl.indexOf('endpoint') > -1) {
|
} else if (this.importUrl.indexOf('endpoint') > -1) {
|
||||||
url = '/monitor/endpoint/template'
|
url = '/monitor/endpoint/template'
|
||||||
param.type = 'endpoint'
|
param.type = 'endpoint'
|
||||||
|
} else if (this.importUrl.indexOf('module') > -1) {
|
||||||
|
url = '/monitor/module/template'
|
||||||
|
param.type = 'module'
|
||||||
} else if (this.importUrl.indexOf('tmpl') > -1) {
|
} else if (this.importUrl.indexOf('tmpl') > -1) {
|
||||||
url = '/expression/tmpl/template'
|
url = '/expression/tmpl/template'
|
||||||
} else if (this.importUrl.indexOf('alert') > -1) {
|
} else if (this.importUrl.indexOf('alert') > -1) {
|
||||||
|
|||||||
@@ -31,16 +31,19 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
<!--module-->
|
<!--module-->
|
||||||
<el-form-item :label='$t("project.module.module")' prop="remark">
|
<el-form-item :label='$t("project.module.module")' prop="remark">
|
||||||
<el-select id="module-box-input-module" v-model="editEndpoint.moduleId" :disabled="!editEndpoint.projectId || disabled " class="right-box__select" placeholder="" popper-class="right-box-select-dropdown prevent-clickoutside" size="small" value-key="id">
|
<el-select @change="renderEndpoint" id="module-box-input-module" v-model="editEndpoint.moduleId" :disabled="!editEndpoint.projectId || disabled " class="right-box__select" placeholder="" popper-class="right-box-select-dropdown prevent-clickoutside" size="small" value-key="id">
|
||||||
<el-option v-for="item in moduleList" :id="'module-'+item.id" :key="item.id" :label="item.name" :value="item.id"></el-option>
|
<el-option v-for="item in moduleList" :id="'module-'+item.id" :key="item.id" :label="item.name" :value="item.id"></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<!--asset-->
|
<!--asset-->
|
||||||
<el-form-item :label='$t("project.module.asset")' label-width="125px" prop="asset">
|
<el-form-item :label='$t("project.module.asset")' label-width="125px" prop="assetId" v-if="!disabled">
|
||||||
<el-select id="module-box-input-module" v-model="editEndpoint.moduleId" :disabled="!editEndpoint.projectId || disabled " class="right-box__select" placeholder="" popper-class="right-box-select-dropdown prevent-clickoutside" size="small" value-key="id">
|
<el-select id="module-box-input-asset" @change="renderEndpoint" v-model="editEndpoint.assetId" :disabled="disabled" class="right-box__select" placeholder="" popper-class="right-box-select-dropdown prevent-clickoutside" size="small" value-key="id">
|
||||||
<el-option v-for="item in moduleList" :id="'module-'+item.id" :key="item.id" :label="item.name" :value="item.id"></el-option>
|
<el-option v-for="item in assetList" :id="'asset-'+item.id" :key="item.id" :label="item.name" :value="item.id"></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item :label='$t("project.module.asset")' label-width="125px" prop="assetName" v-if="disabled">
|
||||||
|
<el-input id="module-box-input-assetName" v-model="editEndpoint.assetName" :disabled="disabled" placeholder="" show-word-limit size="small"></el-input>
|
||||||
|
</el-form-item>
|
||||||
<!--name-->
|
<!--name-->
|
||||||
<el-form-item v-if="optionType!=='batch'" :label='$t("project.module.name")' label-width="125px" prop="name">
|
<el-form-item v-if="optionType!=='batch'" :label='$t("project.module.name")' label-width="125px" prop="name">
|
||||||
<el-input id="module-box-input-name" v-model="editEndpoint.name" maxlength="64" placeholder="" show-word-limit size="small"></el-input>
|
<el-input id="module-box-input-name" v-model="editEndpoint.name" maxlength="64" placeholder="" show-word-limit size="small"></el-input>
|
||||||
@@ -538,7 +541,8 @@ export default {
|
|||||||
optionType: {
|
optionType: {
|
||||||
type: String,
|
type: String,
|
||||||
default: 'batch'
|
default: 'batch'
|
||||||
}
|
},
|
||||||
|
blankObject: {}
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
'select-walk': selectWalk,
|
'select-walk': selectWalk,
|
||||||
@@ -570,7 +574,10 @@ export default {
|
|||||||
name: [
|
name: [
|
||||||
{ validator: this.optionType === 'batch' ? '' : noSpecialChar, trigger: 'change' }
|
{ validator: this.optionType === 'batch' ? '' : noSpecialChar, trigger: 'change' }
|
||||||
],
|
],
|
||||||
asset: [
|
assetId: [
|
||||||
|
{ required: !(this.optionType === 'batch'), message: this.$t('validate.required'), trigger: 'change' }
|
||||||
|
],
|
||||||
|
assetName: [
|
||||||
{ required: !(this.optionType === 'batch'), message: this.$t('validate.required'), trigger: 'change' }
|
{ required: !(this.optionType === 'batch'), message: this.$t('validate.required'), trigger: 'change' }
|
||||||
],
|
],
|
||||||
projectId: [
|
projectId: [
|
||||||
@@ -585,6 +592,7 @@ export default {
|
|||||||
},
|
},
|
||||||
projectList: [],
|
projectList: [],
|
||||||
moduleList: [],
|
moduleList: [],
|
||||||
|
assetList: [],
|
||||||
credentialList: [],
|
credentialList: [],
|
||||||
typeList: [
|
typeList: [
|
||||||
{
|
{
|
||||||
@@ -729,7 +737,9 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
getAsset () {
|
getAsset () {
|
||||||
|
this.$get('asset/asset', { pageSize: -1 }).then(res => {
|
||||||
|
this.assetList = res.data.list
|
||||||
|
})
|
||||||
},
|
},
|
||||||
getWalkData () {
|
getWalkData () {
|
||||||
this.$get('mib/tree', { pageSize: -1, pageNo: 1 }).then(response => {
|
this.$get('mib/tree', { pageSize: -1, pageNo: 1 }).then(response => {
|
||||||
@@ -1127,15 +1137,28 @@ export default {
|
|||||||
return assetData
|
return assetData
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
renderEndpoint () {
|
||||||
|
console.log(123123, (JSON.stringify(this.editEndpoint.configs) === JSON.stringify(this.blankObject.configs)))
|
||||||
|
if (this.disabled) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (this.editEndpoint.moduleId && this.editEndpoint.assetId && (JSON.stringify(this.editEndpoint.configs) === JSON.stringify(this.blankObject.configs))) {
|
||||||
|
this.$post('/monitor/endpoint/render', { moduleIds: this.editEndpoint.moduleId, assetIds: this.editEndpoint.assetId }).then(res => {
|
||||||
|
console.log(res)
|
||||||
|
this.editEndpoint.configs = res.data.list[0].configs
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
mounted () {
|
mounted () {
|
||||||
this.getWalkData()
|
|
||||||
this.getAsset()
|
|
||||||
this.ChartTemplateList()
|
|
||||||
},
|
},
|
||||||
created () {
|
created () {
|
||||||
this.getProjectList()
|
this.getProjectList()
|
||||||
this.getCredential()
|
this.getCredential()
|
||||||
|
this.getWalkData()
|
||||||
|
this.getAsset()
|
||||||
|
this.ChartTemplateList()
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
mibName () {
|
mibName () {
|
||||||
|
|||||||
@@ -71,10 +71,10 @@
|
|||||||
</nz-data-list>
|
</nz-data-list>
|
||||||
<transition name="right-box">
|
<transition name="right-box">
|
||||||
<!-- <addEndpointBox v-if="rightBox.show" :endpoint="object" @close="closeRightBox"></addEndpointBox>-->
|
<!-- <addEndpointBox v-if="rightBox.show" :endpoint="object" @close="closeRightBox"></addEndpointBox>-->
|
||||||
<edit-endpoint-box-new v-if="rightBox.show" :module="object" @close="closeRightEditBox" :disabled="false" :optionType="'add'"></edit-endpoint-box-new>
|
<edit-endpoint-box-new :blankObject="blankObject" v-if="rightBox.show" :module="object" @close="closeRightEditBox" :disabled="false" :optionType="'add'"></edit-endpoint-box-new>
|
||||||
</transition>
|
</transition>
|
||||||
<transition name="right-box">
|
<transition name="right-box">
|
||||||
<edit-endpoint-box-new v-if="rightBox.editShow" :module="object" @close="closeRightEditBox" :disabled="true" :optionType="'edit'"></edit-endpoint-box-new>
|
<edit-endpoint-box-new :blankObject="blankObject" v-if="rightBox.editShow" :module="object" @close="closeRightEditBox" :disabled="true" :optionType="'edit'"></edit-endpoint-box-new>
|
||||||
</transition>
|
</transition>
|
||||||
<transition name="right-box">
|
<transition name="right-box">
|
||||||
<batchModifyEndpoint v-if="rightBox.batchModify" :module="object" @close="closeRightBatchModify" :selectEndpointList="batchDeleteObjs" :disabled="true" :type="'edit'"></batchModifyEndpoint>
|
<batchModifyEndpoint v-if="rightBox.batchModify" :module="object" @close="closeRightBatchModify" :selectEndpointList="batchDeleteObjs" :disabled="true" :type="'edit'"></batchModifyEndpoint>
|
||||||
@@ -115,6 +115,7 @@ export default {
|
|||||||
blankObject: {
|
blankObject: {
|
||||||
id: '',
|
id: '',
|
||||||
projectId: '',
|
projectId: '',
|
||||||
|
assetId: '',
|
||||||
name: '',
|
name: '',
|
||||||
port: '',
|
port: '',
|
||||||
chartIds: '',
|
chartIds: '',
|
||||||
@@ -128,7 +129,7 @@ export default {
|
|||||||
snmpCredentialsId: '',
|
snmpCredentialsId: '',
|
||||||
metrics_path: '',
|
metrics_path: '',
|
||||||
port: '',
|
port: '',
|
||||||
host: '{{asset.manageIp}}',
|
host: '',
|
||||||
scrape_interval: '',
|
scrape_interval: '',
|
||||||
scrape_timeout: '',
|
scrape_timeout: '',
|
||||||
params: '',
|
params: '',
|
||||||
|
|||||||
@@ -11,25 +11,30 @@
|
|||||||
@search="search"
|
@search="search"
|
||||||
>
|
>
|
||||||
<template v-slot:top-tool-right>
|
<template v-slot:top-tool-right>
|
||||||
<export-excel
|
|
||||||
id="expression-template-list"
|
|
||||||
v-has="''"
|
|
||||||
export-url="monitor/module/export"
|
|
||||||
import-url="monitor/module/import"
|
|
||||||
export-file-name="module"
|
|
||||||
:params="searchLabel"
|
|
||||||
:permissions="{import: 'asset.add', export: 'asset.add'}"
|
|
||||||
@afterImport="getTableData"
|
|
||||||
class="top-tool-export margin-r-10"
|
|
||||||
>
|
|
||||||
<template slot="optionZone">
|
|
||||||
<button id="account-add" v-has="'monitor_module_add'" :title="$t('overall.createModule')" class="top-tool-btn"
|
<button id="account-add" v-has="'monitor_module_add'" :title="$t('overall.createModule')" class="top-tool-btn"
|
||||||
type="button" @click="add">
|
type="button" @click="add">
|
||||||
<i class="nz-icon-create-square nz-icon"></i>
|
<i class="nz-icon-create-square nz-icon"></i>
|
||||||
</button>
|
</button>
|
||||||
|
<top-tool-more-options
|
||||||
|
ref="export"
|
||||||
|
id="endpoint-template-list"
|
||||||
|
:params="searchLabel"
|
||||||
|
:params2="searchCheckBox"
|
||||||
|
:permissions="{import: 'monitor_endpoint_add', export: 'monitor_module_view'}"
|
||||||
|
class="top-tool-export margin-l-10 margin-r-10"
|
||||||
|
export-file-name="module"
|
||||||
|
export-url="monitor/module/export"
|
||||||
|
import-url="monitor/module/import"
|
||||||
|
@afterImport="getTableData"
|
||||||
|
>
|
||||||
|
<template v-slot:before>
|
||||||
|
<div>
|
||||||
|
<el-dropdown-item>
|
||||||
|
<delete-button :type="'link'" :title="$t('overall.batchDel')" id="account-list-batch-delete" v-has="'monitor_module_delete'" :api="url" :delete-objs="batchDeleteObjs" @after="getTableData" @before="delFlag=true"></delete-button>
|
||||||
|
</el-dropdown-item>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</export-excel>
|
</top-tool-more-options>
|
||||||
<delete-button id="account-list-batch-delete" v-has="'monitor_module_delete'" :api="url" :delete-objs="batchDeleteObjs" @after="getTableData" @before="delFlag=true"></delete-button>
|
|
||||||
</template>
|
</template>
|
||||||
<template v-slot="slotProps">
|
<template v-slot="slotProps">
|
||||||
<module-table
|
<module-table
|
||||||
@@ -70,6 +75,7 @@ import dataListMixin from '@/components/common/mixin/dataList'
|
|||||||
import moduleTable from '@/components/common/table/settings/moduleTable'
|
import moduleTable from '@/components/common/table/settings/moduleTable'
|
||||||
import exportXLSX from '@/components/common/exportXLSX'
|
import exportXLSX from '@/components/common/exportXLSX'
|
||||||
import alertSilenceBox from '@/components/common/rightBox/alertSilenceBox'
|
import alertSilenceBox from '@/components/common/rightBox/alertSilenceBox'
|
||||||
|
import topToolMoreOptions from '@/components/common/popBox/topToolMoreOptions'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'moduleList',
|
name: 'moduleList',
|
||||||
@@ -79,7 +85,8 @@ export default {
|
|||||||
deleteButton,
|
deleteButton,
|
||||||
moduleTable,
|
moduleTable,
|
||||||
'export-excel': exportXLSX,
|
'export-excel': exportXLSX,
|
||||||
alertSilenceBox
|
alertSilenceBox,
|
||||||
|
topToolMoreOptions
|
||||||
},
|
},
|
||||||
mixins: [dataListMixin],
|
mixins: [dataListMixin],
|
||||||
data () {
|
data () {
|
||||||
|
|||||||
Reference in New Issue
Block a user