Skip to content

Commit

Permalink
fix: Set disabled when cluster is not ready or not install devops
Browse files Browse the repository at this point in the history
Signed-off-by: yazhou <[email protected]>
  • Loading branch information
yazhouio committed Oct 20, 2023
1 parent a7f948d commit 27d7455
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions src/pages/workspaces/containers/DevOps/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import { Avatar, Status } from 'components/Base'
import Banner from 'components/Cards/Banner'
import withList, { ListPage } from 'components/HOCs/withList'
import { computed } from 'mobx'
import { computed, toJS } from 'mobx'
import React from 'react'

import DevOpsStore from 'stores/devops'
Expand Down Expand Up @@ -84,12 +84,18 @@ export default class DevOps extends React.Component {

@computed
get clusters() {
return this.workspaceStore.clusters.data.map(item => ({
label: item.name,
value: item.name,
disabled: !item.isReady,
cluster: item,
}))
const list = this.workspaceStore.clusters.data
.map(item => ({
label: item.name,
value: item.name,
disabled: !item.isReady || !item.configz?.devops,
cluster: toJS(item),
}))
.sort((a, b) => a.disabled - b.disabled)
if (list[0]) {
this.workspaceStore.cluster = list[0]?.value
}
return list
}

get clusterProps() {
Expand Down

0 comments on commit 27d7455

Please sign in to comment.