diff --git a/nezha-fronted/src/components/common/rightBox/editEndpointBoxNew.vue b/nezha-fronted/src/components/common/rightBox/editEndpointBoxNew.vue index 768632ed8..07f28e610 100644 --- a/nezha-fronted/src/components/common/rightBox/editEndpointBoxNew.vue +++ b/nezha-fronted/src/components/common/rightBox/editEndpointBoxNew.vue @@ -34,7 +34,7 @@ - + @@ -50,7 +50,7 @@ varType: 2, dashboardId: 0, returnChildren:0,groupId:0, }" - @values="renderEndpoint" + @values="renderEndpoint(true)" :multiple="false" :language="language" title="ChartSearch" @@ -66,6 +66,34 @@ + + + + + + + + + + + @@ -835,6 +863,7 @@ export default { projectList: [], moduleList: [], assetList: [], + softwareAssetList: [], credentialList: [], typeList: [ { @@ -955,6 +984,39 @@ export default { } } ], + softwareAssetColumns: [ + { title: 'ID', data: 'id' }, + { + title: this.$t('overall.name'), + data: function (row) { + if (row.name.length > 15) { + return row.name.substring(0, 12) + '...' + } + return row.name + } + }, + { + title: this.$t('softwareType.category'), + data: (row) => { + return row.type ? row.type.category : '' + } + }, + { + title: this.$t('overall.type'), + data: (row) => { + return row.type ? row.type.name : '' + } + }, + { + title: this.$t('overall.remark'), + data: function (row) { + if (row.remark.length > 15) { + return row.remark.substring(0, 12) + '...' + } + return row.remark + } + } + ], timestampList: ['ANSIC', 'UnixDate', 'RubyDate', 'RFC822', 'RFC822Z', 'RFC850', 'RFC1123', 'RFC1123Z', 'RFC3339', 'RFC3339Nano', 'Unix', 'UnixMs', 'UnixUs', 'UnixNs'], actionList: [{ value: 'replace', @@ -1075,6 +1137,11 @@ export default { this.assetList = res.data.list }) }, + getSoftwareAsset () { + this.$get('/asset/software', { pageSize: -1, projectIds: this.editEndpoint.projectId, assetIds: this.editEndpoint.assetId }).then(res => { + this.softwareAssetList = res.data.list + }) + }, getWalkData () { this.$get('mib/tree', { pageSize: -1, pageNo: 1 }).then(response => { if (response.code === 200) { @@ -1331,6 +1398,10 @@ export default { this.$refs.sp.remove() this.$refs.moduleForm.clearValidate('moduleId') } + if (this.editEndpoint.assetId) { + this.editEndpoint.softwareAssetId = '' + this.getSoftwareAsset() + } }, /* 获取module列表 */ getModuleList () { @@ -1582,7 +1653,7 @@ export default { return assetData } }, - renderEndpoint () { + renderEndpoint (flag) { if (this.disabled) { return } @@ -1674,6 +1745,10 @@ export default { // } }) } + if (this.editEndpoint.projectId && flag) { + this.editEndpoint.softwareAssetId = '' + this.getSoftwareAsset() + } }, actionChange (index) { @@ -1768,7 +1843,11 @@ export default { mounted () { setTimeout(() => { this.editEndpoint.assetId = this.module.assetId + '' + this.editEndpoint.softwareAssetId = this.module.softwareAssetId + '' }, 500) + if (this.disabled && !this.module.softwareAssetId) { + this.getSoftwareAsset() + } }, created () { this.getProjectList() @@ -1783,6 +1862,19 @@ export default { return this.getMibName(this.walkData, value) } }, + showSoftwareAsset () { + let show = false + if (this.editEndpoint.projectId && this.editEndpoint.assetId) { + show = true + } + if (this.disabled && !this.module.softwareAssetId) { + show = true + } + if (this.disabled && this.module.softwareAssetId) { + show = false + } + return show + }, language () { return this.$store.getters.getLanguage } }, watch: { @@ -1797,7 +1889,11 @@ export default { deep: true, handler (n, o) { this.isEdit = true - this.editEndpoint = JSON.parse(JSON.stringify(n)) + const editEndpoint = JSON.parse(JSON.stringify(n)) + if (!editEndpoint.softwareAssetId) { + editEndpoint.softwareAssetId = '' + } + this.editEndpoint = editEndpoint this.getModuleList() this.activeName = 'Basic' this.activeNameLogs = this.editEndpoint.configs[1].config.map(() => 'Basic') diff --git a/nezha-fronted/src/components/common/table/settings/softwareAssetTable.vue b/nezha-fronted/src/components/common/table/settings/softwareAssetTable.vue index c138b8ae7..337adc304 100644 --- a/nezha-fronted/src/components/common/table/settings/softwareAssetTable.vue +++ b/nezha-fronted/src/components/common/table/settings/softwareAssetTable.vue @@ -145,7 +145,7 @@ export default { width: 120, sortable: 'custom' }, { - label: this.$t('config.model.name'), + label: this.$t('overall.name'), prop: 'name', show: true, width: 350, diff --git a/nezha-fronted/src/components/page/monitor/endpoint/endpointList.vue b/nezha-fronted/src/components/page/monitor/endpoint/endpointList.vue index c3c2da71d..f0c9f26fd 100644 --- a/nezha-fronted/src/components/page/monitor/endpoint/endpointList.vue +++ b/nezha-fronted/src/components/page/monitor/endpoint/endpointList.vue @@ -613,7 +613,9 @@ export default { this.object.paramObj.push({ key: '', value: [] }) } this.object.assetName = this.object.asset ? this.object.asset.name : '' + this.object.softwareAssetName = this.object.softwareAsset ? this.object.softwareAsset.name : '' this.object.assetId = this.object.asset ? this.object.asset.id + '' : '' + this.object.softwareAssetId = this.object.softwareAsset ? this.object.softwareAsset.id + '' : '' this.object.projectId = this.object.project.id this.object.moduleId = this.object.module.id this.object.type = this.object.module.type