dashboard
dashboard copied to clipboard
function getClustersList in get-Kar-List.js has Error
resolve({ total, rows: listResult }) should in callBack function
Error code
const getClustersList = () => {
const listResult = []
let total = 0
return new Promise(function(resolve) {
getClusters().then(res => {
const { items } = res
items.forEach((n) => {
listResult.push({
name: n.metadata.name,
tag: '',
desc: '',
node: n.status.nodeSummary?.readyNum + '/' + n.status.nodeSummary?.totalNum,
method: n.spec.syncMode,
tactics: '',
status: n.status.conditions.map(r => r.type).join('、'),
version: n.status.kubernetesVersion,
time: n.metadata.creationTimestamp
})
})
total = items.length
})
resolve({ total, rows: listResult })
})
}
Should be
const getClustersList = () => {
const listResult = []
let total = 0
return new Promise(function(resolve) {
getClusters().then(res => {
const { items } = res
items.forEach((n) => {
listResult.push({
name: n.metadata.name,
tag: '',
desc: '',
node: n.status.nodeSummary?.readyNum + '/' + n.status.nodeSummary?.totalNum,
method: n.spec.syncMode,
tactics: '',
status: n.status.conditions.map(r => r.type).join('、'),
version: n.status.kubernetesVersion,
time: n.metadata.creationTimestamp
})
})
total = items.length
resolve({ total, rows: listResult })
})
})
}