CN-667 feat: Dashboard - npm - 下钻 - 流量折线图开发

This commit is contained in:
@changcode
2022-08-12 15:25:54 +08:00
parent d55cdcb709
commit b5a980ed3f
13 changed files with 668 additions and 59 deletions

View File

@@ -19,11 +19,13 @@ export default {
name: 'NpmEventsHeader',
props: {
chart: Object,
timeFilter: Object
timeFilter: Object,
// type: String
},
data () {
return {
chartData: []
chartData: [],
type: 'severity'
}
},
methods: {
@@ -31,11 +33,24 @@ export default {
const params = {
startTime: getSecond(this.timeFilter.startTime),
endTime: getSecond(this.timeFilter.endTime),
type: 'severity'
type: this.type
}
get(api.npm.events.list, params).then(res => {
if (res.code === 200) {
this.chartData = res.data.result
res.data.result.forEach(t => {
if (t.eventSeverity === 'critical') {
t.index = 0
} else if (t.eventSeverity === 'high') {
t.index = 1
} else if (t.eventSeverity === 'info') {
t.index = 4
} else if (t.eventSeverity === 'low') {
t.index = 3
} else if (t.eventSeverity === 'medium') {
t.index = 2
}
})
this.chartData = res.data.result.sort((a, b) => { return a.index - b.index })
}
})
}