@@ -80,7 +80,8 @@ export default {
this.loading = true
try {
const res = await listE2eRuns(this.query)
- this.list = res.data || res || []
+ const d = res.data !== undefined ? res.data : res
+ this.list = Array.isArray(d) ? d : (d && d.list) || []
this.stats = this.list.reduce((acc, x) => {
if (x.status === 'SUCCESS') acc.success++
else if (x.status === 'FAILED') acc.failed++
@@ -199,9 +199,8 @@ export default {
getList() {
listInstances(this.queryParams).then(res => {
- let data = res.data || {}
- this.list = data.list || res.rows || []
- // 计算统计
+ const data = res.data
+ this.list = Array.isArray(data) ? data : (data && data.list) || res.rows || []
this.stats = { running: 0, paused: 0, pending_human: 0, completed: 0, terminated: 0 }
this.list.forEach(item => {
if (this.stats[item.status] !== undefined) this.stats[item.status]++