Skip to content

Commit df202da

Browse files
committed
解决业务模板日志列&打平关键字指标阈值和业务配置交互
1 parent 1e0fe6e commit df202da

8 files changed

+142
-71
lines changed

monitor-ui/src/views/monitor-config/business-monitor-endpoint.vue

+2-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
/>
6161
</div>
6262
</section>
63-
<div v-else class='no-data-class'>{{$t('m_table_noDataTip')}}</div>
63+
<!-- <div v-else class='no-data-class'>{{$t('m_table_noDataTip')}}</div> -->
6464
<Modal
6565
v-model="ruleModelConfig.isShow"
6666
:title="$t('m_json_regular')"
@@ -616,6 +616,7 @@ export default {
616616
}
617617
this.logAndDataBaseAllDetail.push(tempInfo)
618618
})
619+
this.$emit('feedbackInfo', this.logAndDataBaseAllDetail)
619620
},
620621
getDbDetail() {
621622
return new Promise(resolve => {

monitor-ui/src/views/monitor-config/business-monitor-group.vue

+13-8
Original file line numberDiff line numberDiff line change
@@ -1365,16 +1365,20 @@ export default {
13651365
})
13661366
},
13671367
async getDetail(targetId, metricKey) {
1368-
if ((metricKey || metricKey === '') && this.metricKey !== metricKey) {
1369-
this.metricKey = metricKey
1370-
this.logFileCollapseValue = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10']
1368+
if (targetId) {
1369+
if ((metricKey || metricKey === '') && this.metricKey !== metricKey) {
1370+
this.metricKey = metricKey
1371+
this.logFileCollapseValue = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10']
1372+
} else {
1373+
this.logFileCollapseValue = ['0']
1374+
}
1375+
this.targetId = targetId
1376+
await this.getLogKeyWordDetail()
1377+
await this.getDbDetail()
1378+
this.processAllInfo()
13711379
} else {
1372-
this.logFileCollapseValue = ['0']
1380+
this.logAndDataBaseAllDetail = []
13731381
}
1374-
this.targetId = targetId
1375-
await this.getLogKeyWordDetail()
1376-
await this.getDbDetail()
1377-
this.processAllInfo()
13781382
},
13791383
processAllInfo() {
13801384
this.logAndDataBaseAllDetail = []
@@ -1388,6 +1392,7 @@ export default {
13881392
}
13891393
this.logAndDataBaseAllDetail.push(tempInfo)
13901394
})
1395+
this.$emit('feedbackInfo', this.logAndDataBaseAllDetail)
13911396
},
13921397
getDbDetail() {
13931398
return new Promise(resolve => {

monitor-ui/src/views/monitor-config/business-monitor.vue

+26-3
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
search()
2525
}"
2626
@on-clear="typeChange(false)"
27+
@on-open-change="onSelectOpenChange"
2728
>
2829
<Option v-for="(option, index) in targetOptions"
2930
:value="option.guid"
@@ -50,12 +51,25 @@
5051
{{$t('m_operationDoc')}}
5152
</span>
5253
</div>
54+
<div v-if="!targrtId" style="margin: 10px 0">
55+
<Alert type="error">
56+
<span>{{ $t('m_empty_tip_1') }}</span>
57+
<span v-if="type === 'group'">{{ $t('m_field_resourceLevel') }}</span>
58+
<span v-if="type === 'endpoint'">{{ $t('m_field_endpoint') }}</span>
59+
</Alert>
60+
</div>
61+
<div v-if="targrtId && isDataEmpty" style="margin: 10px 0">
62+
<Alert type="error">
63+
<span>{{ $t('m_noData') }}</span>
64+
</Alert>
65+
</div>
66+
5367
<section v-show="showTargetManagement" class='business-monitor-content' style="margin-top: 16px;">
5468
<template v-if="type === 'group'">
55-
<groupManagement ref="group"></groupManagement>
69+
<groupManagement ref="group" @feedbackInfo="onFeedbackInfo"></groupManagement>
5670
</template>
5771
<template v-if="type === 'endpoint'">
58-
<endpointManagement ref="endpoint"></endpointManagement>
72+
<endpointManagement @feedbackInfo="onFeedbackInfo" ref="endpoint"></endpointManagement>
5973
</template>
6074
</section>
6175
</div>
@@ -74,7 +88,8 @@ export default {
7488
targrtId: '',
7589
targetOptions: [],
7690
showTargetManagement: false,
77-
metricKey: ''
91+
metricKey: '',
92+
isDataEmpty: false
7893
}
7994
},
8095

@@ -114,6 +129,14 @@ export default {
114129
}, 300),
115130
openDoc() {
116131
window.open('https://webankpartners.github.io/wecube-docs/manual-open-monitor-config-metrics/')
132+
},
133+
onFeedbackInfo(allData) {
134+
this.isDataEmpty = allData.length === 0
135+
},
136+
onSelectOpenChange(open) {
137+
if (open) {
138+
this.getTargrtList(false)
139+
}
117140
}
118141
},
119142
components: {

monitor-ui/src/views/monitor-config/config-detail.vue

+36-32
Original file line numberDiff line numberDiff line change
@@ -1176,39 +1176,43 @@ export default {
11761176
return resData
11771177
},
11781178
getDetail(targetId) {
1179-
this.targetId = targetId
1180-
const api = '/monitor/api/v2/alarm/strategy/query'
1181-
const params = {
1182-
queryType: this.type,
1183-
guid: this.targetId,
1184-
show: this.onlyShowCreated,
1185-
alarmName: this.alarmName
1186-
}
1187-
this.totalPageConfig = []
1188-
this.request('post', api, params, responseData => {
1189-
this.$emit('feedbackInfo', responseData.length === 0)
1190-
const allConfigDetail = responseData
1191-
allConfigDetail.forEach((item, alarmIndex) => {
1192-
const strategy = item.strategy || []
1193-
const tempTableData = strategy.map(s => {
1194-
s.monitor_type = item.monitor_type
1195-
return s
1196-
})
1197-
const tableData = this.handleTableData(tempTableData, alarmIndex)
1198-
this.totalPageConfig.push({
1199-
tableData,
1200-
endpoint_group: item.endpoint_group,
1201-
display_name: item.display_name,
1202-
service_group: item.service_group,
1203-
monitor_type: item.monitor_type,
1204-
notify: item.notify,
1205-
mergeSpanMap: this.mergeSpanMap
1179+
if (targetId) {
1180+
this.targetId = targetId
1181+
const api = '/monitor/api/v2/alarm/strategy/query'
1182+
const params = {
1183+
queryType: this.type,
1184+
guid: this.targetId,
1185+
show: this.onlyShowCreated,
1186+
alarmName: this.alarmName
1187+
}
1188+
this.totalPageConfig = []
1189+
this.request('post', api, params, responseData => {
1190+
this.$emit('feedbackInfo', responseData.length === 0)
1191+
const allConfigDetail = responseData
1192+
allConfigDetail.forEach((item, alarmIndex) => {
1193+
const strategy = item.strategy || []
1194+
const tempTableData = strategy.map(s => {
1195+
s.monitor_type = item.monitor_type
1196+
return s
1197+
})
1198+
const tableData = this.handleTableData(tempTableData, alarmIndex)
1199+
this.totalPageConfig.push({
1200+
tableData,
1201+
endpoint_group: item.endpoint_group,
1202+
display_name: item.display_name,
1203+
service_group: item.service_group,
1204+
monitor_type: item.monitor_type,
1205+
notify: item.notify,
1206+
mergeSpanMap: this.mergeSpanMap
1207+
})
1208+
this.originTotalPageConfig = cloneDeep(this.totalPageConfig)
12061209
})
1207-
this.originTotalPageConfig = cloneDeep(this.totalPageConfig)
1208-
})
1209-
}, {isNeedloading: true})
1210-
this.getAllRole()
1211-
this.getWorkFlow()
1210+
}, {isNeedloading: true})
1211+
this.getAllRole()
1212+
this.getWorkFlow()
1213+
} else {
1214+
this.totalPageConfig = []
1215+
}
12121216
},
12131217
onAddIconClick() {
12141218
const metricItem = Object.assign({}, cloneDeep(initFormData.conditions[0]), {

monitor-ui/src/views/monitor-config/keyword-content.vue

+13-8
Original file line numberDiff line numberDiff line change
@@ -1207,16 +1207,20 @@ export default {
12071207
})
12081208
},
12091209
async getDetail(targetId, alarmName = this.alarmName) {
1210-
if (this.alarmName !== alarmName) {
1211-
this.keywordCollapseValue = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10']
1212-
this.alarmName = alarmName
1210+
if (targetId) {
1211+
if (this.alarmName !== alarmName) {
1212+
this.keywordCollapseValue = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10']
1213+
this.alarmName = alarmName
1214+
} else {
1215+
this.keywordCollapseValue = ['0']
1216+
}
1217+
this.targetId = targetId
1218+
await this.getLogKeyWordDetail()
1219+
await this.getDataBaseDetail()
1220+
this.processAllInfo()
12131221
} else {
1214-
this.keywordCollapseValue = ['0']
1222+
this.logAndDataBaseAllDetail = []
12151223
}
1216-
this.targetId = targetId
1217-
await this.getLogKeyWordDetail()
1218-
await this.getDataBaseDetail()
1219-
this.processAllInfo()
12201224
},
12211225
processAllInfo() {
12221226
this.logAndDataBaseAllDetail = []
@@ -1230,6 +1234,7 @@ export default {
12301234
}
12311235
this.logAndDataBaseAllDetail.push(tempInfo)
12321236
})
1237+
this.$emit('feedbackInfo', this.logAndDataBaseAllDetail)
12331238
},
12341239
getLogKeyWordDetail() {
12351240
return new Promise(resolve => {

monitor-ui/src/views/monitor-config/log-management.vue

+38-12
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@
1818
clearable
1919
remote
2020
ref="select"
21+
@on-clear="onTargetIdClear"
2122
@on-change="onFilterChange"
23+
@on-open-change="onSelectOpenChange"
2224
>
2325
<Option v-for="(option, index) in targetOptions" :value="option.guid" :label="option.display_name" :key="index">
2426
<TagShow :list="targetOptions" name="type" :tagName="option.type" :index="index"></TagShow>
@@ -59,8 +61,25 @@
5961
</Upload>
6062
</div>
6163
</div>
64+
<div v-if="!targetId" style="margin: 10px 0">
65+
<Alert type="error">
66+
<span>{{ $t('m_empty_tip_1') }}</span>
67+
<span v-if="type === 'group'">{{ $t('m_field_resourceLevel') }}</span>
68+
<span v-if="type === 'endpoint'">{{ $t('m_field_endpoint') }}</span>
69+
</Alert>
70+
</div>
71+
<div v-if="targetId && isDataEmpty" style="margin: 10px 0">
72+
<Alert type="error">
73+
<span>{{ $t('m_noData') }}</span>
74+
</Alert>
75+
</div>
6276
<section v-show="showTargetManagement" class='key-word-content'>
63-
<keywordContent ref='keywordContent' :keywordType="typeMap[type]"></keywordContent>
77+
<keywordContent
78+
ref='keywordContent'
79+
:keywordType="typeMap[type]"
80+
@feedbackInfo="onFeedbackInfo"
81+
>
82+
</keywordContent>
6483
</section>
6584
</div>
6685
</template>
@@ -85,7 +104,8 @@ export default {
85104
endpoint: 'endpoint'
86105
},
87106
alarmName: '',
88-
token: ''
107+
token: '',
108+
isDataEmpty: false
89109
}
90110
},
91111
async mounted() {
@@ -102,29 +122,27 @@ export default {
102122
},
103123
methods: {
104124
typeChange() {
105-
this.clearTargrt()
106125
this.getTargrtList()
107126
},
108-
getTargrtList() {
127+
getTargrtList(type = 'init') {
109128
const api = this.$root.apiCenter.getTargetByEndpoint + '/' + this.type
110129
this.$root.$httpRequestEntrance.httpRequestEntrance('GET', api, '', responseData => {
111130
this.targetOptions = responseData
112-
this.targetId = this.targetOptions[0].guid
113-
this.search()
131+
if (type === 'init') {
132+
this.targetId = this.targetOptions[0].guid
133+
this.search()
134+
}
114135
}, {isNeedloading: false})
115136
},
116-
clearTargrt() {
117-
this.targetOptions = []
118-
this.targetId = ''
119-
this.showTargetManagement = false
120-
this.$refs.select.query = ''
121-
},
122137
search() {
123138
if (this.targetId) {
124139
this.showTargetManagement = true
125140
this.$refs.keywordContent.getDetail(this.targetId, this.alarmName)
126141
}
127142
},
143+
onTargetIdClear() {
144+
this.$refs.keywordContent.getDetail('', this.alarmName)
145+
},
128146
onFilterChange: debounce(function () {
129147
this.search()
130148
}, 300),
@@ -174,6 +192,14 @@ export default {
174192
},
175193
uploadFailed(file) {
176194
this.$Message.warning(file.message)
195+
},
196+
onSelectOpenChange(open) {
197+
if (open) {
198+
this.getTargrtList('')
199+
}
200+
},
201+
onFeedbackInfo(allData) {
202+
this.isDataEmpty = allData.length === 0
177203
}
178204
},
179205
components: {

monitor-ui/src/views/monitor-config/log-template-config/custom-regex.vue

+9-3
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@
8080
<div>
8181
<Divider orientation="left" size="small">{{ $t('m_compute_metrics') }}</Divider>
8282
<Table
83+
:key="tableKey"
8384
class='compute-metrics-style'
8485
size="small"
8586
:columns="columnsForComputeMetrics"
@@ -107,7 +108,7 @@
107108

108109
<script>
109110
import {
110-
isEmpty, hasIn, cloneDeep
111+
isEmpty, hasIn, cloneDeep, remove
111112
} from 'lodash'
112113
import Vue from 'vue'
113114
import TagMapConfig from './tag-map-config.vue'
@@ -315,7 +316,7 @@ export default {
315316
},
316317
{
317318
title: this.$t('m_metric_key'),
318-
key: 'index',
319+
key: 'resultMetricKey',
319320
width: 120,
320321
renderHeader: () => (
321322
<span>
@@ -560,7 +561,8 @@ export default {
560561
isEmpty,
561562
auto_create_warn: true,
562563
auto_create_dashboard: true,
563-
metricPrefixCode: ''
564+
metricPrefixCode: '',
565+
tableKey: ''
564566
}
565567
},
566568
computed: {
@@ -619,6 +621,10 @@ export default {
619621
}
620622
this.configInfo.log_metric_monitor = parentGuid
621623
}
624+
if (this.isInTemplatePage) {
625+
remove(this.columnsForComputeMetrics, item => item.key === 'resultMetricKey')
626+
this.tableKey = +new Date() + ''
627+
}
622628
this.showModal = true
623629
},
624630
regularCheckValue(arr = [], key) {

monitor-ui/src/views/monitor-config/threshold-management.vue

+5-4
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
filterable
1818
clearable
1919
ref="select"
20+
@on-clear="onTargetIdClear"
2021
@on-query-change="e => {
2122
getTargetOptionsSearch = e;
2223
debounceGetTargetOptions()
@@ -266,12 +267,12 @@ export default {
266267
}
267268
await this.getTargetOptions()
268269
}, 400),
269-
// filterDataByAlarmName() {
270-
// this.$refs.thresholdDetail.filterData(this.alarmName)
271-
// },
272270
fetchDetailData: debounce(function () {
273271
this.$refs.thresholdDetail.getDetail(this.targetId)
274-
}, 300)
272+
}, 300),
273+
onTargetIdClear() {
274+
this.$refs.thresholdDetail.getDetail('')
275+
}
275276
},
276277
components: {
277278
TagShow,

0 commit comments

Comments
 (0)