Skip to content

Commit 3b98ff3

Browse files
authored
Merge pull request #742 from WeBankPartners/dev
Dev
2 parents bd7a9ff + ff05824 commit 3b98ff3

File tree

3 files changed

+95
-6
lines changed

3 files changed

+95
-6
lines changed

monitor-ui/src/views/custom-view/view-config-alarm.vue

+93-4
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,17 @@
88
<div class="alarm-list">
99
<template v-for="(alarmItem, alarmIndex) in resultData">
1010
<section :key="alarmIndex" class="alarm-item c-dark-exclude-color" :class="'alarm-item-border-'+ alarmItem.s_priority">
11-
<i class="fa fa-bar-chart fa-operate" v-if="!alarmItem.is_custom" @click="goToEndpointView(alarmItem)" aria-hidden="true"></i>
11+
<div style="float:right">
12+
<Tooltip :content="$t('menu.endpointView')">
13+
<Icon type="ios-stats" size="18" class="fa-operate" v-if="!alarmItem.is_custom" @click="goToEndpointView(alarmItem)"/>
14+
</Tooltip>
15+
<Tooltip :content="$t('close')">
16+
<Icon type="ios-eye-off" size="18" class="fa-operate" @click="deleteConfirmModal(alarmItem)"/>
17+
</Tooltip>
18+
<Tooltip :content="$t('m_remark')">
19+
<Icon type="ios-pricetags-outline" size="18" class="fa-operate" @click="remarkModal(alarmItem)" />
20+
</Tooltip>
21+
</div>
1222
<ul>
1323
<li>
1424
<label class="alarm-item-label">{{$t('field.endpoint')}}:</label>
@@ -26,6 +36,12 @@
2636
<label class="alarm-item-label">{{$t('tableKey.tags')}}:</label>
2737
<Tag type="border" v-for="(t,tIndex) in alarmItem.tags.split('^')" :key="tIndex" color="cyan">{{t}}</Tag>
2838
</li>
39+
<li v-if="alarmItem.custom_message">
40+
<label class="alarm-item-label">{{$t('m_remark')}}:</label>
41+
<div class="col-md-9" style="display: inline-block;padding:0">
42+
<Tag type="border" color="primary">{{alarmItem.custom_message}}</Tag>
43+
</div>
44+
</li>
2945
<li>
3046
<label class="alarm-item-label">{{$t('tableKey.start')}}:</label><span>{{alarmItem.start_string}}</span>
3147
</li>
@@ -47,6 +63,18 @@
4763
</section>
4864
</template>
4965
</div>
66+
<Modal
67+
v-model="isShowWarning"
68+
:title="$t('closeConfirm.title')"
69+
@on-ok="ok"
70+
@on-cancel="cancel">
71+
<div class="modal-body" style="padding:30px">
72+
<div style="text-align:center">
73+
<p style="color: red">{{$t('closeConfirm.tip')}}</p>
74+
</div>
75+
</div>
76+
</Modal>
77+
<ModalComponent :modelConfig="modelConfig"></ModalComponent>
5078
</div>
5179
</template>
5280

@@ -59,9 +87,29 @@ export default {
5987
interval: '',
6088
6189
resultData: [],
90+
selectedData: '', // 存放选中数据
91+
isShowWarning: false,
6292
low: 0,
6393
mid: 0,
64-
high: 0
94+
high: 0,
95+
modelConfig: {
96+
modalId: 'remark_Modal',
97+
modalTitle: 'm_remark',
98+
saveFunc: 'remarkAlarm',
99+
isAdd: true,
100+
config: [
101+
{label: 'm_remark', value: 'message', placeholder: '', v_validate: '', disabled: false, type: 'text'}
102+
],
103+
addRow: { // [通用]-保存用户新增、编辑时数据
104+
id: '',
105+
message: '',
106+
is_custom: false
107+
}
108+
},
109+
cacheParams: {
110+
id: '',
111+
viewCondition: ''
112+
}
65113
}
66114
},
67115
mounted () {},
@@ -73,6 +121,8 @@ export default {
73121
clearInterval(this.interval)
74122
},
75123
getAlarm (id, viewCondition) {
124+
this.cacheParams.id = id
125+
this.cacheParams.viewCondition = viewCondition
76126
this.getAlarmdata(id)
77127
this.interval = setInterval(()=>{
78128
this.getAlarmdata(id)
@@ -94,8 +144,47 @@ export default {
94144
type: alarmItem.endpoint.split('_').slice(-1)[0]
95145
}
96146
localStorage.setItem('jumpCallData', JSON.stringify(endpointObject))
97-
const news = this.$router.resolve({name: 'endpointView'})
98-
window.open(news.href, '_blank')
147+
this.$router.push({path: '/endpointView'})
148+
// const news = this.$router.resolve({name: 'endpointView'})
149+
// window.open(news.href, '_blank')
150+
},
151+
deleteConfirmModal (rowData) {
152+
this.selectedData = rowData
153+
this.isShowWarning = true
154+
},
155+
ok () {
156+
this.removeAlarm(this.selectedData)
157+
},
158+
cancel () {
159+
this.isShowWarning = false
160+
},
161+
removeAlarm(alarmItem) {
162+
let params = {
163+
id: alarmItem.id,
164+
custom: true
165+
}
166+
if (!alarmItem.is_custom) {
167+
params.custom = false
168+
}
169+
this.$root.$httpRequestEntrance.httpRequestEntrance('GET', this.$root.apiCenter.alarmManagement.close.api, params, () => {
170+
// this.$root.$eventBus.$emit('hideConfirmModal')
171+
this.getAlarm(this.cacheParams.id, this.cacheParams.viewCondition)
172+
})
173+
},
174+
remarkModal (item) {
175+
this.modelConfig.addRow = {
176+
id: item.id,
177+
message: item.custom_message,
178+
is_custom: false
179+
}
180+
this.$root.JQ('#remark_Modal').modal('show')
181+
},
182+
remarkAlarm () {
183+
this.$root.$httpRequestEntrance.httpRequestEntrance('POST', this.apiCenter.remarkAlarm, this.modelConfig.addRow, () => {
184+
this.$Message.success(this.$t('tips.success'))
185+
this.getAlarm(this.cacheParams.id, this.cacheParams.viewCondition)
186+
this.$root.JQ('#remark_Modal').modal('hide')
187+
})
99188
}
100189
},
101190
components: {},

monitor-ui/src/views/dashboard.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ export default {
7676
this.viewData.forEach((item) => {
7777
let params = {
7878
aggregate: 'none',
79-
time_second: -1800,
79+
time_second: this.viewCondition.timeTnterval,
8080
start: 0,
8181
end: 0,
8282
title: '',

monitor-ui/src/views/single-dashboard.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ export default {
175175
this.viewData.forEach((item) => {
176176
let params = {
177177
aggregate: 'none',
178-
time_second: -1800,
178+
time_second: this.viewCondition.timeTnterval,
179179
start: this.dateToTimestamp(this.viewCondition.dateRange[0]),
180180
end: this.dateToTimestamp(this.viewCondition.dateRange[1]),
181181
title: '',

0 commit comments

Comments
 (0)