feat:添加endpoint 批量修改功能
This commit is contained in:
@@ -126,6 +126,7 @@ export default {
|
|||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
padding-top: 20px;
|
padding-top: 20px;
|
||||||
|
padding-bottom: 0;
|
||||||
}
|
}
|
||||||
.search-title{
|
.search-title{
|
||||||
ont-family: Roboto-Medium;
|
ont-family: Roboto-Medium;
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import MessageBox from 'element-ui/packages/message-box/src/main'
|
|||||||
import i18n from '../i18n'
|
import i18n from '../i18n'
|
||||||
import bus from '@/libs/bus'
|
import bus from '@/libs/bus'
|
||||||
/* 弹窗点击外部后关闭 */
|
/* 弹窗点击外部后关闭 */
|
||||||
const exceptClassName = ['config-dropdown', 'nz-pop', 'el-picker', 'chart-box-dropdown', 'metric-dropdown', 'el-cascader__dropdown', 'asset-dropdown', 'no-style-class', 'el-message-box', 'nz-dashboard-dropdown', 'el-autocomplete-suggestion', 'nz-temp-box', 'el-time-panel'] // clickoutside排除的class(白名单) no-style-class:没有任何样式的class
|
const exceptClassName = ['config-dropdown', 'nz-pop', 'el-picker', 'chart-box-dropdown', 'metric-dropdown', 'el-cascader__dropdown', 'asset-dropdown', 'no-style-class', 'el-message-box', 'nz-dashboard-dropdown', 'el-autocomplete-suggestion', 'nz-temp-box', 'el-time-panel','endpointConfigsTips'] // clickoutside排除的class(白名单) no-style-class:没有任何样式的class
|
||||||
export const clickoutside = {
|
export const clickoutside = {
|
||||||
// 初始化指令
|
// 初始化指令
|
||||||
bind (el, binding, vnode) {
|
bind (el, binding, vnode) {
|
||||||
|
|||||||
@@ -1177,7 +1177,11 @@ const cn = {
|
|||||||
contextName: '内容名称',
|
contextName: '内容名称',
|
||||||
alerts: 'Alerts',
|
alerts: 'Alerts',
|
||||||
privPassword: '隐私密码',
|
privPassword: '隐私密码',
|
||||||
asset: 'Asset'
|
asset: 'Asset',
|
||||||
|
editEndpoint: '编辑 endpoint',
|
||||||
|
createEndpoint: '新增Endpoint',
|
||||||
|
batchEndpoint: '批量 Endpoint',
|
||||||
|
endpointName: 'Endpoint name'
|
||||||
},
|
},
|
||||||
endpoint: {
|
endpoint: {
|
||||||
createEndpoint: '新增Endpoint',
|
createEndpoint: '新增Endpoint',
|
||||||
@@ -1217,7 +1221,8 @@ const cn = {
|
|||||||
authTypeToken: 'bearer token',
|
authTypeToken: 'bearer token',
|
||||||
name: '名称',
|
name: '名称',
|
||||||
configs: 'Configs',
|
configs: 'Configs',
|
||||||
state: '状态'
|
state: '状态',
|
||||||
|
allselect: '当前页已全部选择'
|
||||||
},
|
},
|
||||||
metrics: {
|
metrics: {
|
||||||
metrics: '指标',
|
metrics: '指标',
|
||||||
|
|||||||
@@ -1194,6 +1194,10 @@ const en = {
|
|||||||
privPassword: 'Priv password',
|
privPassword: 'Priv password',
|
||||||
alerts: 'Alerts',
|
alerts: 'Alerts',
|
||||||
asset: 'Asset',
|
asset: 'Asset',
|
||||||
|
editEndpoint: 'edit endpoint',
|
||||||
|
createEndpoint: 'Created endpoint',
|
||||||
|
batchEndpoint: 'Batch Endpoint',
|
||||||
|
endpointName: 'Endpoint name',
|
||||||
tip: {
|
tip: {
|
||||||
defaultEndpointSet: 'Default endpoint settings', // "默认的Endpoint设置"
|
defaultEndpointSet: 'Default endpoint settings', // "默认的Endpoint设置"
|
||||||
relation: 'Module associated Endpoint will configure the following ports/paths/parameters by default'// "组件关联的Endpoint将默认配置以下端口/路径/参数"
|
relation: 'Module associated Endpoint will configure the following ports/paths/parameters by default'// "组件关联的Endpoint将默认配置以下端口/路径/参数"
|
||||||
@@ -1237,7 +1241,8 @@ const en = {
|
|||||||
authTypeToken: 'bearer token',
|
authTypeToken: 'bearer token',
|
||||||
name: 'Name',
|
name: 'Name',
|
||||||
configs: 'Configs',
|
configs: 'Configs',
|
||||||
state: 'State'
|
state: 'State',
|
||||||
|
allselect: 'The current page has all been selected'
|
||||||
},
|
},
|
||||||
metrics: {
|
metrics: {
|
||||||
metrics: 'Metrics', // "指标"
|
metrics: 'Metrics', // "指标"
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -112,7 +112,7 @@
|
|||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="selectAssetAll" class="asset-allselect">
|
<div v-if="selectAssetAll" class="asset-allselect">
|
||||||
'当前页已全部选择'
|
{{$t('project.endpoint.allselect')}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!--endpoint-->
|
<!--endpoint-->
|
||||||
@@ -143,7 +143,7 @@
|
|||||||
v-for="(title, index) in endpointTableTitle"
|
v-for="(title, index) in endpointTableTitle"
|
||||||
v-if="title.show"
|
v-if="title.show"
|
||||||
:width="title.width"
|
:width="title.width"
|
||||||
:key="`col-${index}`"
|
:key="index"
|
||||||
:label="title.label"
|
:label="title.label"
|
||||||
>
|
>
|
||||||
<template slot-scope="scope" :column="title">
|
<template slot-scope="scope" :column="title">
|
||||||
@@ -225,7 +225,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<!-- edit endpoint-->
|
<!-- edit endpoint-->
|
||||||
<transition name="right-box">
|
<transition name="right-box">
|
||||||
<edit-endpoint-box-new v-if="rightBox.show" :module="object" @close="closeRightBox" :disabled="true" :type="'add'"></edit-endpoint-box-new>
|
<edit-endpoint-box-new v-if="rightBox.show" :module="object" @close="closeRightBox" :disabled="true" :type="'add'" :optionType="optionType"></edit-endpoint-box-new>
|
||||||
</transition>
|
</transition>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -274,10 +274,10 @@ export default {
|
|||||||
tempEndpoint2: {},
|
tempEndpoint2: {},
|
||||||
assetLoading: true,
|
assetLoading: true,
|
||||||
rightBox: { show: false, title: this.$t('project.endpoint.createEndpoint'), isEdit: false },
|
rightBox: { show: false, title: this.$t('project.endpoint.createEndpoint'), isEdit: false },
|
||||||
|
optionType: 'batch',
|
||||||
blankEndpoint: {
|
blankEndpoint: {
|
||||||
id: '',
|
id: '',
|
||||||
projectId: '',
|
projectId: '',
|
||||||
name: '',
|
|
||||||
endpointNameTmpl: '{{module.name}}-{{asset.name}}',
|
endpointNameTmpl: '{{module.name}}-{{asset.name}}',
|
||||||
type: 'http',
|
type: 'http',
|
||||||
port: 9100,
|
port: 9100,
|
||||||
@@ -285,7 +285,7 @@ export default {
|
|||||||
walk: [],
|
walk: [],
|
||||||
snmpCredentialsId: '',
|
snmpCredentialsId: '',
|
||||||
metrics_path: '',
|
metrics_path: '',
|
||||||
port: '',
|
port: 9100,
|
||||||
host: '{{asset.manageIp}}',
|
host: '{{asset.manageIp}}',
|
||||||
scrape_interval: '',
|
scrape_interval: '',
|
||||||
scrape_timeout: '',
|
scrape_timeout: '',
|
||||||
@@ -698,12 +698,14 @@ export default {
|
|||||||
return ''
|
return ''
|
||||||
},
|
},
|
||||||
editEndpointRow (u) {
|
editEndpointRow (u) {
|
||||||
|
this.optionType = 'add'
|
||||||
this.object = JSON.parse(JSON.stringify(u))
|
this.object = JSON.parse(JSON.stringify(u))
|
||||||
this.object.walk = this.object.configs.walk ? JSON.parse(JSON.stringify(this.object.configs.walk)) : []
|
this.object.walk = this.object.configs.walk ? JSON.parse(JSON.stringify(this.object.configs.walk)) : []
|
||||||
this.object.port = this.object.configs.port ? JSON.parse(JSON.stringify(this.object.configs.port)) : 9100
|
this.object.port = this.object.configs.port ? JSON.parse(JSON.stringify(this.object.configs.port)) : 9100
|
||||||
this.rightBox.show = true
|
this.rightBox.show = true
|
||||||
},
|
},
|
||||||
showRightBox () {
|
showRightBox () {
|
||||||
|
this.optionType = 'batch'
|
||||||
this.object = { ...JSON.parse(JSON.stringify(this.blankEndpoint)), projectId: this.currentModuleCopy.projectId, moduleId: this.currentModuleCopy.id, assetName: '', type: this.currentModuleCopy.type }
|
this.object = { ...JSON.parse(JSON.stringify(this.blankEndpoint)), projectId: this.currentModuleCopy.projectId, moduleId: this.currentModuleCopy.id, assetName: '', type: this.currentModuleCopy.type }
|
||||||
this.object.walk = this.object.configs.walk ? JSON.parse(JSON.stringify(this.object.configs.walk)) : []
|
this.object.walk = this.object.configs.walk ? JSON.parse(JSON.stringify(this.object.configs.walk)) : []
|
||||||
this.object.port = this.object.configs.port ? JSON.parse(JSON.stringify(this.object.configs.port)) : 9100
|
this.object.port = this.object.configs.port ? JSON.parse(JSON.stringify(this.object.configs.port)) : 9100
|
||||||
@@ -711,7 +713,9 @@ export default {
|
|||||||
},
|
},
|
||||||
editAllEndpoint () {
|
editAllEndpoint () {
|
||||||
this.endpointTableData.forEach((item, index) => {
|
this.endpointTableData.forEach((item, index) => {
|
||||||
this.endpointTableData[index] = { ...this.endpointTableData[index], ...this.blankEndpoint }
|
if (this.endpointSelection.find(item1 => item1.assetId === item.assetId)) {
|
||||||
|
this.endpointTableData[index] = { ...this.endpointTableData[index], ...this.blankEndpoint }
|
||||||
|
}
|
||||||
})
|
})
|
||||||
this.endpointTableData = [...this.endpointTableData]
|
this.endpointTableData = [...this.endpointTableData]
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="right-box right-box-add-endpoint" :class="{'right-box-add-endpoint-snmp': currentModuleCopy.type && currentModuleCopy.type.toLowerCase() == 'snmp'}" v-clickoutside="{obj:endpoint,func:clickOutside}">
|
<div class="right-box right-box-add-endpoint" v-clickoutside="{obj:endpoint,func:clickOutside}">
|
||||||
<!-- begin--顶部按钮-->
|
<!-- begin--顶部按钮-->
|
||||||
<div class="right-box-top-btns"></div>
|
<div class="right-box-top-btns"></div>
|
||||||
<!-- end--顶部按钮-->
|
<!-- end--顶部按钮-->
|
||||||
@@ -15,13 +15,16 @@
|
|||||||
<div class="asset-and-endpoint">
|
<div class="asset-and-endpoint">
|
||||||
<!--endpoint-->
|
<!--endpoint-->
|
||||||
<div class="right-box-endpoint-table">
|
<div class="right-box-endpoint-table">
|
||||||
<div class="search-box" style="display: flex;justify-content: flex-end">
|
<div class="search-box" style="display: flex;justify-content: space-between">
|
||||||
<el-button @click="showRightBox" class="top-tool-btn" type="button">
|
<span>Config</span>
|
||||||
|
<span>
|
||||||
|
<el-button @click="showRightBox" class="top-tool-btn" type="button">
|
||||||
<i class="nz-icon-gear nz-icon"></i>
|
<i class="nz-icon-gear nz-icon"></i>
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button @click="editAllEndpoint" class="top-tool-btn" type="button">
|
<el-button @click="editAllEndpoint" class="top-tool-btn" type="button">
|
||||||
<i class="nz-icon-batch-edit nz-icon"></i>
|
<i class="nz-icon-batch-edit nz-icon"></i>
|
||||||
</el-button>
|
</el-button>
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<el-table
|
<el-table
|
||||||
:data="endpointTableData"
|
:data="endpointTableData"
|
||||||
@@ -37,61 +40,47 @@
|
|||||||
style="padding: 0 1px;">
|
style="padding: 0 1px;">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column
|
<el-table-column
|
||||||
label-class-name="endpoints-box-endpoints-title"
|
v-for="(item, index) in endpointTableTitle"
|
||||||
v-for="(title, index) in endpointTableTitle"
|
v-if="item.show"
|
||||||
v-if="title.show"
|
|
||||||
:width="title.width"
|
|
||||||
:key="`col-${index}`"
|
:key="`col-${index}`"
|
||||||
:label="title.label"
|
:fixed="item.fixed"
|
||||||
|
:label="item.label"
|
||||||
|
:min-width="`${item.minWidth}`"
|
||||||
|
:prop="item.prop"
|
||||||
|
:resizable="true"
|
||||||
|
:sort-orders="['ascending', 'descending']"
|
||||||
|
:width="`${item.width}`"
|
||||||
|
class="data-column"
|
||||||
>
|
>
|
||||||
<template slot-scope="scope" :column="title">
|
<template slot="header">
|
||||||
<span v-if="title.prop == 'asset'">{{scope.row.assetName}}</span>
|
<span>{{item.label}}</span>
|
||||||
<span v-else-if="title.prop == 'params'">
|
<div class="col-resize-area"></div>
|
||||||
<el-popover
|
</template>
|
||||||
placement="bottom"
|
<template slot-scope="scope" :column="item">
|
||||||
width="200"
|
<template v-if="item.prop === 'name'">
|
||||||
trigger="hover"
|
{{scope.row[item.prop]}}
|
||||||
>
|
</template>
|
||||||
<div class="endpoint-param-pop">
|
<template v-else-if="item.prop === 'asset'">
|
||||||
<div v-for="p in scope.row.paramObj" :key="p">{{p.key}}={{p.value}}</div>
|
<span >
|
||||||
</div>
|
<i class="nz-icon nz-icon-asset" :class="scope.row[item.prop]>0?'colorEF7458':'colorEF7458'"/>
|
||||||
<span slot="reference">
|
{{scope.row.assetName}}
|
||||||
<span @mousedown.stop>{{scope.row.configs.params.length > 8 ? scope.row.configs.params.substring(0, 8) + '...' : scope.row.configs.params}}</span>
|
|
||||||
</span>
|
|
||||||
</el-popover>
|
|
||||||
</span>
|
</span>
|
||||||
<span v-else-if="title.prop == 'labels'">
|
</template>
|
||||||
<el-popover
|
<template v-else-if="item.prop === 'host'">
|
||||||
placement="bottom"
|
{{scope.row.configs?scope.row.configs.host : '' }}
|
||||||
width="200"
|
</template>
|
||||||
trigger="hover"
|
<template v-else-if="item.prop === 'port'">
|
||||||
>
|
{{scope.row.configs?scope.row.configs.port : '' }}
|
||||||
<div class="endpoint-param-pop">
|
</template>
|
||||||
<div v-for="p in scope.row.labelModule" :key="p">{{p.key}}={{p.value}}</div>
|
<template v-else-if="item.prop == 'configs'">
|
||||||
</div>
|
<el-tooltip placement="left" effect="light" :popper-class="'endpointConfigsTips'">
|
||||||
<span slot="reference">
|
<span class="configs-endpoint">{ ... }</span>
|
||||||
<span @mousedown.stop>{{scope.row.configs.labels.length > 8 ? scope.row.configs.labels.substring(0, 8) + '...' : scope.row.configs.labels}}</span>
|
<div class="endpointConfigsTips" slot="content">
|
||||||
</span>
|
<pre >{{JSON.stringify(scope.row[item.prop],null,2)}}</pre>
|
||||||
</el-popover>
|
</div>
|
||||||
</span>
|
</el-tooltip>
|
||||||
<span v-else-if="title.prop == 'path'">
|
</template>
|
||||||
<el-popover
|
<template v-else>1</template>
|
||||||
placement="bottom"
|
|
||||||
width="100"
|
|
||||||
trigger="hover"
|
|
||||||
:content="scope.row.configs[title.prop]"
|
|
||||||
>
|
|
||||||
<span slot="reference" >
|
|
||||||
<span>{{scope.row.configs.metrics_path.length > 5 ? scope.row.configs.metrics_path.substring(0, 5) + '...' : scope.row.configs.metrics_path}}</span>
|
|
||||||
</span>
|
|
||||||
</el-popover>
|
|
||||||
</span>
|
|
||||||
<span v-else-if="title.prop == 'port'">
|
|
||||||
<span >{{scope.row.configs.port}}</span>
|
|
||||||
</span>
|
|
||||||
<span v-else-if="title.prop == 'host'">
|
|
||||||
<span>{{scope.row.configs.host}}</span>
|
|
||||||
</span>
|
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="" width="56" fixed="right">
|
<el-table-column label="" width="56" fixed="right">
|
||||||
@@ -118,7 +107,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<!-- edit endpoint-->
|
<!-- edit endpoint-->
|
||||||
<transition name="right-box">
|
<transition name="right-box">
|
||||||
<edit-endpoint-box-new v-if="rightBox.show" :module="object" @close="closeRightBox" :disabled="true" :type="'add'"></edit-endpoint-box-new>
|
<edit-endpoint-box-new v-if="rightBox.show" :module="object" @close="closeRightBox" :disabled="true" :type="'add'" :optionType="optionType"></edit-endpoint-box-new>
|
||||||
</transition>
|
</transition>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -171,7 +160,6 @@ export default {
|
|||||||
blankEndpoint: {
|
blankEndpoint: {
|
||||||
id: '',
|
id: '',
|
||||||
projectId: '',
|
projectId: '',
|
||||||
name: '',
|
|
||||||
endpointNameTmpl: '{{module.name}}-{{asset.name}}',
|
endpointNameTmpl: '{{module.name}}-{{asset.name}}',
|
||||||
type: 'http',
|
type: 'http',
|
||||||
port: 9100,
|
port: 9100,
|
||||||
@@ -179,7 +167,7 @@ export default {
|
|||||||
walk: [],
|
walk: [],
|
||||||
snmpCredentialsId: '',
|
snmpCredentialsId: '',
|
||||||
metrics_path: '',
|
metrics_path: '',
|
||||||
port: '',
|
port: 9100,
|
||||||
host: '{{asset.manageIp}}',
|
host: '{{asset.manageIp}}',
|
||||||
scrape_interval: '',
|
scrape_interval: '',
|
||||||
scrape_timeout: '',
|
scrape_timeout: '',
|
||||||
@@ -212,37 +200,31 @@ export default {
|
|||||||
moduleList: [],
|
moduleList: [],
|
||||||
assetList: [],
|
assetList: [],
|
||||||
endpointList: [],
|
endpointList: [],
|
||||||
endpointTableTitle: [
|
endpointTableTitle: [ // 原始table列
|
||||||
|
{
|
||||||
|
label: this.$t('project.endpoint.name'),
|
||||||
|
prop: 'name',
|
||||||
|
show: true
|
||||||
|
},
|
||||||
{
|
{
|
||||||
label: this.$t('project.endpoint.asset'),
|
label: this.$t('project.endpoint.asset'),
|
||||||
prop: 'asset',
|
prop: 'asset',
|
||||||
width: 150,
|
|
||||||
show: true
|
show: true
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
label: this.$t('project.endpoint.host'),
|
label: this.$t('project.endpoint.host'),
|
||||||
prop: 'host',
|
prop: 'host',
|
||||||
width: 80,
|
|
||||||
show: true
|
show: true
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
label: this.$t('project.endpoint.port'),
|
label: this.$t('project.endpoint.port'),
|
||||||
prop: 'port',
|
prop: 'port',
|
||||||
width: 54,
|
|
||||||
show: true
|
|
||||||
}, {
|
|
||||||
label: this.$t('project.endpoint.labels'),
|
|
||||||
prop: 'labels',
|
|
||||||
width: 90,
|
|
||||||
show: true
|
|
||||||
}, {
|
|
||||||
label: this.$t('project.endpoint.param'),
|
|
||||||
prop: 'params',
|
|
||||||
width: 100,
|
|
||||||
show: true
|
|
||||||
}, {
|
|
||||||
label: this.$t('project.endpoint.path'),
|
|
||||||
prop: 'path',
|
|
||||||
width: 66,
|
|
||||||
show: true
|
show: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: this.$t('project.endpoint.configs'),
|
||||||
|
prop: 'configs',
|
||||||
|
show: true,
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
typeList: [],
|
typeList: [],
|
||||||
@@ -252,6 +234,7 @@ export default {
|
|||||||
assetSelection: [],
|
assetSelection: [],
|
||||||
endpointSelection: [],
|
endpointSelection: [],
|
||||||
endpointTableData: [],
|
endpointTableData: [],
|
||||||
|
optionType: 'batch'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@@ -467,20 +450,41 @@ export default {
|
|||||||
return ''
|
return ''
|
||||||
},
|
},
|
||||||
editEndpointRow (u) {
|
editEndpointRow (u) {
|
||||||
|
this.optionType = 'edit'
|
||||||
this.object = JSON.parse(JSON.stringify(u))
|
this.object = JSON.parse(JSON.stringify(u))
|
||||||
|
// this.object.configs = JSON.parse(this.object.configs)
|
||||||
this.object.walk = this.object.configs.walk ? JSON.parse(JSON.stringify(this.object.configs.walk)) : []
|
this.object.walk = this.object.configs.walk ? JSON.parse(JSON.stringify(this.object.configs.walk)) : []
|
||||||
this.object.port = this.object.configs.port ? JSON.parse(JSON.stringify(this.object.configs.port)) : 9100
|
this.object.port = this.object.configs.port ? JSON.parse(JSON.stringify(this.object.configs.port)) : 9100
|
||||||
|
this.object.paramObj = []
|
||||||
|
this.object.labelModule = []
|
||||||
|
if (JSON.stringify(this.object.configs.labels) !== '{}' && this.object.configs.labels) {
|
||||||
|
Object.keys(this.object.configs.labels).forEach(key => {
|
||||||
|
this.object.labelModule.push({ key, value: this.object.configs.labels[key] })
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.object.labelModule.push({ key: '', value: '' })
|
||||||
|
}
|
||||||
|
if (JSON.stringify(this.object.configs.params) !== '{}' && this.object.configs.params) {
|
||||||
|
Object.keys(this.object.configs.params).forEach(key => {
|
||||||
|
this.object.paramObj.push({ key, value: this.object.configs.params[key] })
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.object.paramObj.push({ key: '', value: [] })
|
||||||
|
}
|
||||||
this.rightBox.show = true
|
this.rightBox.show = true
|
||||||
},
|
},
|
||||||
showRightBox () {
|
showRightBox () {
|
||||||
this.object = { ...JSON.parse(JSON.stringify(this.blankEndpoint)), projectId: this.currentModuleCopy.projectId, moduleId: this.currentModuleCopy.id, assetName: '', type: this.currentModuleCopy.type }
|
this.optionType = 'batch'
|
||||||
|
this.object = { ...JSON.parse(JSON.stringify(this.blankEndpoint)), projectId: '', moduleId: '', assetName: '', type: '' }
|
||||||
this.object.walk = this.object.configs.walk ? JSON.parse(JSON.stringify(this.object.configs.walk)) : []
|
this.object.walk = this.object.configs.walk ? JSON.parse(JSON.stringify(this.object.configs.walk)) : []
|
||||||
this.object.port = this.object.configs.port ? JSON.parse(JSON.stringify(this.object.configs.port)) : 9100
|
this.object.port = this.object.configs.port ? JSON.parse(JSON.stringify(this.object.configs.port)) : 9100
|
||||||
this.rightBox.show = true
|
this.rightBox.show = true
|
||||||
},
|
},
|
||||||
editAllEndpoint () {
|
editAllEndpoint () {
|
||||||
this.endpointTableData.forEach((item, index) => {
|
this.endpointTableData.forEach((item, index) => {
|
||||||
this.endpointTableData[index] = { ...this.endpointTableData[index], ...this.blankEndpoint }
|
if (this.endpointSelection.find(item1 => item1.assetId === item.assetId)) {
|
||||||
|
this.endpointTableData[index] = { ...this.endpointTableData[index], configs: this.blankEndpoint.configs }
|
||||||
|
}
|
||||||
})
|
})
|
||||||
this.endpointTableData = [...this.endpointTableData]
|
this.endpointTableData = [...this.endpointTableData]
|
||||||
},
|
},
|
||||||
@@ -493,7 +497,7 @@ export default {
|
|||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
this.endpointTableData.forEach((item, index) => {
|
this.endpointTableData.forEach((item, index) => {
|
||||||
if (item.assetId === endpoint.assetId) {
|
if (item.id === endpoint.id) {
|
||||||
this.endpointTableData[index] = { ...endpoint }
|
this.endpointTableData[index] = { ...endpoint }
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -533,24 +537,20 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
currentModuleCopy: {
|
|
||||||
immediate: true,
|
|
||||||
handler (n, o) {
|
|
||||||
if (n.type && n.type.toLowerCase() == 'snmp') {
|
|
||||||
this.endpointTableTitle[4].show = false
|
|
||||||
this.endpointTableTitle[5].show = false
|
|
||||||
} else {
|
|
||||||
this.endpointTableTitle[4].show = true
|
|
||||||
this.endpointTableTitle[5].show = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
selectEndpointList: {
|
selectEndpointList: {
|
||||||
immediate: true,
|
immediate: true,
|
||||||
handler (n) {
|
handler (n) {
|
||||||
console.log(n)
|
console.log(n);
|
||||||
n.configs = JSON.parse(n.configs)
|
this.endpointTableData = JSON.parse(JSON.stringify(n))
|
||||||
this.endpointTableData = [...n]
|
this.endpointTableData.forEach(item => {
|
||||||
|
item.configs = JSON.parse(item.configs)
|
||||||
|
item.projectId = item.project.id
|
||||||
|
item.moduleId = item.module.id
|
||||||
|
item.assetId = item.asset.id
|
||||||
|
item.assetName = item.asset.name
|
||||||
|
item.type = item.module.type
|
||||||
|
})
|
||||||
|
console.log(this.endpointTableData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1032,4 +1032,14 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.endpointConfigsTips{
|
||||||
|
height: 200px;
|
||||||
|
overflow-y: auto;
|
||||||
|
overflow-x: hidden;
|
||||||
|
}
|
||||||
|
.copy-value-content{
|
||||||
|
position: absolute;
|
||||||
|
right: 1px;
|
||||||
|
top: 4px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -2,22 +2,32 @@
|
|||||||
<div class="right-box right-box-module" v-clickoutside="{obj:editEndpoint,func:clickOutside}">
|
<div class="right-box right-box-module" v-clickoutside="{obj:editEndpoint,func:clickOutside}">
|
||||||
<!-- begin--顶部按钮-->
|
<!-- begin--顶部按钮-->
|
||||||
<div class="right-box-top-btns right-box-form-delete">
|
<div class="right-box-top-btns right-box-form-delete">
|
||||||
<button v-if="editEndpoint.id" id="module-del" v-has="'module_delete'" class="nz-btn nz-btn-size-normal nz-btn-size-alien" type="button" @click="del">
|
<!-- <button v-if="editEndpoint.id" id="module-del" v-has="'module_delete'" class="nz-btn nz-btn-size-normal nz-btn-size-alien" type="button" @click="del">-->
|
||||||
<span class="right-box-top-btn-icon"><i class="nz-icon nz-icon-delete"></i></span>
|
<!-- <span class="right-box-top-btn-icon"><i class="nz-icon nz-icon-delete"></i></span>-->
|
||||||
<span class="right-box-top-btn-txt">{{$t('overall.delete')}}</span>
|
<!-- <span class="right-box-top-btn-txt">{{$t('overall.delete')}}</span>-->
|
||||||
</button>
|
<!-- </button>-->
|
||||||
</div>
|
</div>
|
||||||
<!-- end--顶部按钮-->
|
<!-- end--顶部按钮-->
|
||||||
|
|
||||||
<!-- begin--标题-->
|
<!-- begin--标题-->
|
||||||
<div class="right-box-title">{{editEndpoint.id ? $t("project.module.editEndpoint") + " ID:" + editEndpoint.id : $t("project.module.createModule")}}</div>
|
<div class="right-box-title">
|
||||||
|
<span v-if="optionType === 'edit'">
|
||||||
|
{{ $t("project.module.editEndpoint")}}
|
||||||
|
</span>
|
||||||
|
<span v-if="optionType === 'batch'">
|
||||||
|
{{ $t("project.module.batchEndpoint")}}
|
||||||
|
</span>
|
||||||
|
<span v-if="optionType === 'add'">
|
||||||
|
{{ $t("project.module.creatEndpoint")}}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
<!-- end--标题-->
|
<!-- end--标题-->
|
||||||
|
|
||||||
<!-- begin--表单-->
|
<!-- begin--表单-->
|
||||||
<div class="right-box-form-box" ref="scrollbar">
|
<div class="right-box-form-box" ref="scrollbar">
|
||||||
<el-form class="right-box-form right-box-form-left" :model="editEndpoint" label-position = "top" label-width="120px" :rules="rules" ref="moduleForm">
|
<el-form class="right-box-form right-box-form-left" :model="editEndpoint" label-position = "top" label-width="120px" :rules="rules" ref="moduleForm">
|
||||||
<!--name-->
|
<!--name-->
|
||||||
<el-form-item :label='$t("project.module.moduleName")' prop="name" label-width="125px">
|
<el-form-item :label='$t("project.module.endpointName")' prop="name" label-width="125px" v-if="optionType!=='batch'">
|
||||||
<el-input placeholder="" maxlength="64" show-word-limit v-model="editEndpoint.name" size="small" id="module-box-input-name"></el-input>
|
<el-input placeholder="" maxlength="64" show-word-limit v-model="editEndpoint.name" size="small" id="module-box-input-name"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<!--project-->
|
<!--project-->
|
||||||
@@ -252,6 +262,10 @@ export default {
|
|||||||
type: {
|
type: {
|
||||||
type: String,
|
type: String,
|
||||||
default: 'add'
|
default: 'add'
|
||||||
|
},
|
||||||
|
optionType: {
|
||||||
|
type: String,
|
||||||
|
default: 'batch'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
@@ -271,16 +285,16 @@ export default {
|
|||||||
showAllBasicOption: false,
|
showAllBasicOption: false,
|
||||||
rules: {
|
rules: {
|
||||||
name: [
|
name: [
|
||||||
{ validator: noSpecialChar, trigger: 'change' }
|
{ validator: this.optionType === 'batch' ? '' : noSpecialChar, trigger: 'change' }
|
||||||
],
|
],
|
||||||
projectId: [
|
projectId: [
|
||||||
{ required: true, message: this.$t('validate.required'), trigger: 'change' }
|
{ required: !(this.optionType === 'batch'), message: this.$t('validate.required'), trigger: 'change' }
|
||||||
],
|
],
|
||||||
moduleId: [
|
moduleId: [
|
||||||
{ required: true, message: this.$t('validate.required'), trigger: 'change' }
|
{ required: !(this.optionType === 'batch'), message: this.$t('validate.required'), trigger: 'change' }
|
||||||
],
|
],
|
||||||
walk: [
|
walk: [
|
||||||
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
|
{ required: !(this.optionType === 'batch'), message: this.$t('validate.required'), trigger: 'blur' }
|
||||||
],
|
],
|
||||||
port: [
|
port: [
|
||||||
{ validator: port, trigger: 'blur' }
|
{ validator: port, trigger: 'blur' }
|
||||||
@@ -668,6 +682,7 @@ export default {
|
|||||||
deep: true,
|
deep: true,
|
||||||
immediate: true,
|
immediate: true,
|
||||||
handler (n) {
|
handler (n) {
|
||||||
|
console.log(n);
|
||||||
if (n && n.configs) {
|
if (n && n.configs) {
|
||||||
const params = Object.assign({}, n.configs)
|
const params = Object.assign({}, n.configs)
|
||||||
params.params = this.paramToJson(this.editEndpoint.paramObj)
|
params.params = this.paramToJson(this.editEndpoint.paramObj)
|
||||||
@@ -688,10 +703,10 @@ export default {
|
|||||||
if (params.basic_auth && !params.basic_auth.password) {
|
if (params.basic_auth && !params.basic_auth.password) {
|
||||||
delete params.basic_auth
|
delete params.basic_auth
|
||||||
}
|
}
|
||||||
if (!Object.keys(params.param).length) {
|
if (params.param && !Object.keys(params.param).length) {
|
||||||
delete params.param
|
delete params.param
|
||||||
}
|
}
|
||||||
if (!Object.keys(params.labels).length) {
|
if (params.labels && !Object.keys(params.labels).length) {
|
||||||
delete params.labels
|
delete params.labels
|
||||||
}
|
}
|
||||||
this.configsCopyValue = JSON.stringify(params, null, 2)
|
this.configsCopyValue = JSON.stringify(params, null, 2)
|
||||||
|
|||||||
@@ -680,10 +680,10 @@ export default {
|
|||||||
if (params.basic_auth && !params.basic_auth.password) {
|
if (params.basic_auth && !params.basic_auth.password) {
|
||||||
delete params.basic_auth
|
delete params.basic_auth
|
||||||
}
|
}
|
||||||
if (!Object.keys(params.params).length) {
|
if (params.param && !Object.keys(params.param).length) {
|
||||||
delete params.params
|
delete params.param
|
||||||
}
|
}
|
||||||
if (!Object.keys(params.labels).length) {
|
if (params.labels && !Object.keys(params.labels).length) {
|
||||||
delete params.labels
|
delete params.labels
|
||||||
}
|
}
|
||||||
this.configsCopyValue = JSON.stringify(params, null, 2)
|
this.configsCopyValue = JSON.stringify(params, null, 2)
|
||||||
|
|||||||
@@ -196,6 +196,7 @@ export default {
|
|||||||
.endpointConfigsTips{
|
.endpointConfigsTips{
|
||||||
height: 200px;
|
height: 200px;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
|
overflow-x: hidden;
|
||||||
}
|
}
|
||||||
.copy-value-content{
|
.copy-value-content{
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
|||||||
Reference in New Issue
Block a user