Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Set disabled when cluster is not ready or not install devops #4216

Merged
merged 1 commit into from
Oct 23, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading