dashboard icon indicating copy to clipboard operation
dashboard copied to clipboard

function getClustersList in get-Kar-List.js has Error

Open masterjyq opened this issue 3 years ago • 0 comments

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 })
    })
  })
}

masterjyq avatar Sep 22 '22 01:09 masterjyq