feat:更新字体图标库 以及 批量新增endpoint 关不不提示的问题

This commit is contained in:
zhangyu
2021-08-06 10:12:09 +08:00
parent cea63d4743
commit 6eda2c2e41
10 changed files with 45 additions and 36 deletions

View File

@@ -1,8 +1,8 @@
@font-face { @font-face {
font-family: "nz-icon"; /* Project id 2030432 */ font-family: "nz-icon"; /* Project id 2030432 */
src: url('iconfont.woff2?t=1625712906789') format('woff2'), src: url('iconfont.woff2?t=1628214250274') format('woff2'),
url('iconfont.woff?t=1625712906789') format('woff'), url('iconfont.woff?t=1628214250274') format('woff'),
url('iconfont.ttf?t=1625712906789') format('truetype'); url('iconfont.ttf?t=1628214250274') format('truetype');
} }
.nz-icon { .nz-icon {
@@ -13,6 +13,10 @@
-moz-osx-font-smoothing: grayscale; -moz-osx-font-smoothing: grayscale;
} }
.nz-icon-batchadd:before {
content: "\e734";
}
.nz-icon-rectangle1:before { .nz-icon-rectangle1:before {
content: "\e730"; content: "\e730";
} }

View File

@@ -1,8 +1,8 @@
@font-face { @font-face {
font-family: "nz-icon"; /* Project id 2030432 */ font-family: "nz-icon"; /* Project id 2030432 */
src: url('./font/iconfont.woff2?t=1625712906789') format('woff2'), src: url('./font/iconfont.woff2?t=1628214250274') format('woff2'),
url('./font/iconfont.woff?t=1625712906789') format('woff'), url('./font/iconfont.woff?t=1628214250274') format('woff'),
url('./font/iconfont.ttf?t=1625712906789') format('truetype'); url('./font/iconfont.ttf?t=1628214250274') format('truetype');
} }
.nz-icon { .nz-icon {
@@ -13,6 +13,10 @@
-moz-osx-font-smoothing: grayscale; -moz-osx-font-smoothing: grayscale;
} }
.nz-icon-batchadd:before {
content: "\e734";
}
.nz-icon-rectangle1:before { .nz-icon-rectangle1:before {
content: "\e730"; content: "\e730";
} }

View File

@@ -1,5 +1,5 @@
<template> <template>
<div class="right-box right-box-modify-endpoint" v-clickoutside="{obj:endpoint,func:clickOutside}"> <div class="right-box right-box-modify-endpoint" v-clickoutside="{obj:batchEndpoint,func:clickOutside}">
<div class="right-box__header"> <div class="right-box__header">
<!-- begin--标题--> <!-- begin--标题-->
<div class="header__title">{{$t("overall.batchAddEndpoint")}}</div> <div class="header__title">{{$t("overall.batchAddEndpoint")}}</div>
@@ -26,7 +26,7 @@
title="ChartSearch" title="ChartSearch"
key-field="id" key-field="id"
show-field="name" show-field="name"
v-model="moduleIds" v-model="batchEndpoint.moduleIds"
class="form-control" class="form-control"
:result-format="resultFormat" :result-format="resultFormat"
></v-selectpage> ></v-selectpage>
@@ -44,7 +44,7 @@
title="ChartSearch" title="ChartSearch"
key-field="id" key-field="id"
show-field="name" show-field="name"
v-model="assetIds" v-model="batchEndpoint.assetIds"
class="form-control" class="form-control"
:result-format="resultFormat" :result-format="resultFormat"
></v-selectpage> ></v-selectpage>
@@ -55,7 +55,7 @@
<div class="right-box-line"></div> <div class="right-box-line"></div>
<el-table <el-table
:data="tableData" :data="batchEndpoint.tableData"
:height="'calc(100% - 400px)'" :height="'calc(100% - 400px)'"
:class="showError?'error' : ''" :class="showError?'error' : ''"
style="width:calc(100% - 70px);margin-left: 15px;min-height:400px" style="width:calc(100% - 70px);margin-left: 15px;min-height:400px"
@@ -130,7 +130,7 @@
<button @click="generate" id="ep-generate" class="footer__btn"> <button @click="generate" id="ep-generate" class="footer__btn">
<span>{{$t('overall.generate')}}</span> <span>{{$t('overall.generate')}}</span>
</button> </button>
<button @click="save" class="footer__btn" id="ep-add" :class="!tableData.length?'nz-btn-disabled':''" :disabled="!tableData.length"> <button @click="save" class="footer__btn" id="ep-add" :class="!batchEndpoint.tableData.length?'nz-btn-disabled':''" :disabled="!batchEndpoint.tableData.length">
<span>{{$t('overall.save')}}</span> <span>{{$t('overall.save')}}</span>
</button> </button>
</div> </div>
@@ -166,8 +166,11 @@ export default {
{ required: true, message: this.$t('validate.required'), trigger: 'change' } { required: true, message: this.$t('validate.required'), trigger: 'change' }
] ]
}, },
moduleIds: '', batchEndpoint:{
assetIds: '', moduleIds: '',
assetIds: '',
tableData: []
},
assetDataList: [], assetDataList: [],
moduleList: [], moduleList: [],
language: localStorage.getItem('nz-language'), language: localStorage.getItem('nz-language'),
@@ -247,7 +250,6 @@ export default {
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: 'batchAdd', optionType: 'batchAdd',
tableData: [],
endpointTableTitle: [ // 原始table列 endpointTableTitle: [ // 原始table列
{ {
label: this.$t('project.endpoint.name'), label: this.$t('project.endpoint.name'),
@@ -312,17 +314,16 @@ export default {
}) })
}, },
generate () { generate () {
if (!this.assetIds || !this.moduleIds) { if (!this.batchEndpoint.assetIds || !this.batchEndpoint.moduleIds) {
this.$message.error('Please select module or asset') this.$message.error('Please select module or asset')
} }
this.$post('/monitor/endpoint/render', { moduleIds: this.moduleIds, assetIds: this.assetIds }).then(res => { this.$post('/monitor/endpoint/render', { moduleIds: this.batchEndpoint.moduleIds, assetIds: this.batchEndpoint.assetIds }).then(res => {
console.log(res)
res.data.list.forEach(item => { res.data.list.forEach(item => {
item.configs = JSON.parse(item.configs) item.configs = JSON.parse(item.configs)
item.moduleId = item.module.id item.moduleId = item.module.id
item.assetId = item.asset.id item.assetId = item.asset.id
}) })
this.tableData = res.data.list this.batchEndpoint.tableData = res.data.list
}) })
}, },
// 保存endpoint // 保存endpoint
@@ -330,7 +331,7 @@ export default {
if (this.prevent_opt.save) { return } ; if (this.prevent_opt.save) { return } ;
this.prevent_opt.save = true this.prevent_opt.save = true
this.showError = false this.showError = false
if (!this.tableData.length) { if (!this.batchEndpoint.tableData.length) {
this.prevent_opt.save = false this.prevent_opt.save = false
this.showError = true this.showError = true
return return
@@ -338,7 +339,7 @@ export default {
// 对endpointList进行处理避免携带过多无用数据 // 对endpointList进行处理避免携带过多无用数据
this.$refs.addEndpoint.validate((valid) => { this.$refs.addEndpoint.validate((valid) => {
if (valid) { if (valid) {
const paramsArr = this.tableData.map(item => { const paramsArr = this.batchEndpoint.tableData.map(item => {
const obj = JSON.parse(JSON.stringify(item)) const obj = JSON.parse(JSON.stringify(item))
obj.configs = JSON.stringify(obj.configs) obj.configs = JSON.stringify(obj.configs)
return { return {
@@ -371,19 +372,18 @@ export default {
closeRightBox (isEdit, endpoint, isAll) { closeRightBox (isEdit, endpoint, isAll) {
this.rightBox.show = false this.rightBox.show = false
if (!isEdit) { return } if (!isEdit) { return }
this.tableData.forEach((item, index) => { this.batchEndpoint.tableData.forEach((item, index) => {
if (item.id === endpoint.id) { if (item.id === endpoint.id) {
this.tableData[index] = { ...endpoint } this.batchEndpoint.tableData[index] = { ...endpoint }
} }
}) })
this.tableData = [...this.tableData] this.batchEndpoint.tableData = [...this.batchEndpoint.tableData]
}, },
del (index) { del (index) {
this.tableData.splice(index, 1) this.batchEndpoint.tableData.splice(index, 1)
}, },
edit (row) { edit (row) {
this.object = row this.object = row
console.log(this.object)
// this.object.configs = JSON.parse(this.object.configs) // this.object.configs = JSON.parse(this.object.configs)
this.object.projectId = this.object.project.id this.object.projectId = this.object.project.id
this.object.moduleId = this.object.module.id this.object.moduleId = this.object.module.id
@@ -447,7 +447,7 @@ export default {
this.getAssetList() this.getAssetList()
}, },
watch: { watch: {
tableData: { 'batchEndpoint.tableData': {
deep: true, deep: true,
handler (n) { handler (n) {
this.showError = false this.showError = false

View File

@@ -767,14 +767,17 @@ export default {
setTimeout(() => { setTimeout(() => {
this.editEndpoint.configs[0].config.params = this.paramToJson(this.editEndpoint.paramObj) this.editEndpoint.configs[0].config.params = this.paramToJson(this.editEndpoint.paramObj)
this.editEndpoint.configs[0].config.labels = this.labelsToJson(this.editEndpoint.labelModule) this.editEndpoint.configs[0].config.labels = this.labelsToJson(this.editEndpoint.labelModule)
this.editEndpoint.configs[1].config.forEach(item => { const params = JSON.parse(JSON.stringify(this.editEndpoint))
params.configs[1].config.forEach(item => {
if (item.labelModule) { if (item.labelModule) {
item.labels = this.labelsToJson(item.labelModule) item.labels = this.labelsToJson(item.labelModule)
} else { } else {
item.labels = '' item.labels = ''
} }
delete item.labelModule
}) })
const params = JSON.parse(JSON.stringify(this.editEndpoint)) delete params.labelModule
delete params.paramObj
params.configs[1].config.forEach(item => { params.configs[1].config.forEach(item => {
item.pipeline && item.pipeline.forEach((pipeline) => { item.pipeline && item.pipeline.forEach((pipeline) => {
if (pipeline.type === 'labels') { if (pipeline.type === 'labels') {
@@ -790,7 +793,6 @@ export default {
key = key[0] key = key[0]
if (key.indexOf('configs.0') !== -1) { if (key.indexOf('configs.0') !== -1) {
const keyArr = key.split('.') const keyArr = key.split('.')
console.log(keyArr)
if (keyArr[3] === 'basic_auth' || keyArr[3] === 'bearer_token') { if (keyArr[3] === 'basic_auth' || keyArr[3] === 'bearer_token') {
this.activeName = 'Auth' this.activeName = 'Auth'
} else if (keyArr[3] === 'basic' || keyArr[3] === 'port') { } else if (keyArr[3] === 'basic' || keyArr[3] === 'port') {
@@ -1152,7 +1154,6 @@ export default {
} }
if (this.editEndpoint.moduleId && this.editEndpoint.assetId) { if (this.editEndpoint.moduleId && this.editEndpoint.assetId) {
this.$post('/monitor/endpoint/render', { moduleIds: this.editEndpoint.moduleId, assetIds: this.editEndpoint.assetId }).then(res => { this.$post('/monitor/endpoint/render', { moduleIds: this.editEndpoint.moduleId, assetIds: this.editEndpoint.assetId }).then(res => {
console.log(res)
if (JSON.stringify(this.editEndpoint.configs) === JSON.stringify(this.blankObject.configs)) { if (JSON.stringify(this.editEndpoint.configs) === JSON.stringify(this.blankObject.configs)) {
this.editEndpoint.configs = JSON.parse(res.data.list[0].configs) this.editEndpoint.configs = JSON.parse(res.data.list[0].configs)
} }

View File

@@ -745,14 +745,17 @@ export default {
setTimeout(() => { setTimeout(() => {
this.editModule.configs[0].config.params = this.paramToJson(this.editModule.paramObj) this.editModule.configs[0].config.params = this.paramToJson(this.editModule.paramObj)
this.editModule.configs[0].config.labels = this.labelsToJson(this.editModule.labelModule) this.editModule.configs[0].config.labels = this.labelsToJson(this.editModule.labelModule)
this.editModule.configs[1].config.forEach(item => { const params = JSON.parse(JSON.stringify(this.editModule))
params.configs[1].config.forEach(item => {
if (item.labelModule) { if (item.labelModule) {
item.labels = this.labelsToJson(item.labelModule) item.labels = this.labelsToJson(item.labelModule)
} else { } else {
item.labels = '' item.labels = ''
} }
delete item.labelModule
}) })
const params = JSON.parse(JSON.stringify(this.editModule)) delete params.labelModule
delete params.paramObj
params.configs[1].config.forEach(item => { params.configs[1].config.forEach(item => {
item.pipeline && item.pipeline.forEach((pipeline) => { item.pipeline && item.pipeline.forEach((pipeline) => {
if (pipeline.type === 'labels') { if (pipeline.type === 'labels') {

View File

@@ -120,7 +120,6 @@ export default {
}, },
methods: { methods: {
addPipeline (val) { addPipeline (val) {
console.log(val)
let obj = '' let obj = ''
this.pipelineOptionValue = '' this.pipelineOptionValue = ''
if (val === 'regex') { if (val === 'regex') {

View File

@@ -36,7 +36,7 @@
<delete-button :type="'link'" :title="$t('overall.batchDel')" id="account-list-batch-delete" v-has="'monitor_endpoint_delete'" :api="url" :delete-objs="batchDeleteObjs" @after="getTableData" @before="delFlag=true"></delete-button> <delete-button :type="'link'" :title="$t('overall.batchDel')" id="account-list-batch-delete" v-has="'monitor_endpoint_delete'" :api="url" :delete-objs="batchDeleteObjs" @after="getTableData" @before="delFlag=true"></delete-button>
</el-dropdown-item> </el-dropdown-item>
<el-dropdown-item> <el-dropdown-item>
<div id="batch-add" @click="batchAdd"><i class="nz-icon nz-icon-table-edit"></i>{{$t('overall.batchAdd')}}</div> <div id="batch-add" @click="batchAdd"><i class="nz-icon nz-icon-batchadd"></i>{{$t('overall.batchAdd')}}</div>
</el-dropdown-item> </el-dropdown-item>
</div> </div>
</template> </template>
@@ -332,7 +332,6 @@ export default {
enable: this.object.configs[1].enable, enable: this.object.configs[1].enable,
config: configs config: configs
} }
console.log(this.object)
this.object.paramObj = [] this.object.paramObj = []
this.object.labelModule = [] this.object.labelModule = []
this.object.configs[1].config.forEach(item => { this.object.configs[1].config.forEach(item => {
@@ -396,7 +395,6 @@ export default {
} }
}, },
closeRightBatchAdd (refresh, importResult) { closeRightBatchAdd (refresh, importResult) {
console.log(refresh, importResult)
this.rightBox.batchAdd = false this.rightBox.batchAdd = false
this.importResult = importResult this.importResult = importResult
if (refresh && importResult) { if (refresh && importResult) {