Skip to content

Commit

Permalink
fix: Fix the build image still exists in the build image list when de…
Browse files Browse the repository at this point in the history
…leting service

Signed-off-by: harrisonliu5 <harrisonliu_5@163.com>
  • Loading branch information
harrisonliu5 committed Jul 15, 2020
1 parent 95f2881 commit 6be9d79
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/pages/projects/components/Modals/ServiceDelete/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,12 @@ export default class ServiceDeleteModal extends React.Component {
})

const results = await Promise.all(requests)
const relatedResources = uniqBy(flatten(results), 'uid').filter(
item => !isEmpty(item.name)
)

this.setState({
relatedResources: uniqBy(flatten(results), 'uid'),
relatedResources,
isLoading: false,
})
}
Expand All @@ -176,7 +180,6 @@ export default class ServiceDeleteModal extends React.Component {
handleOk = async () => {
const { onOk, store, resource } = this.props
const { selectedRelatedResourceIds, relatedResources } = this.state

const requests = []
relatedResources.forEach(item => {
if (selectedRelatedResourceIds.includes(item.uid)) {
Expand All @@ -185,7 +188,7 @@ export default class ServiceDeleteModal extends React.Component {
} else if (modules.includes(item.module)) {
this.workloadStore.setModule(item.module)
requests.push(this.workloadStore.delete(item))
} else if (item.module === 's2ibuilders') {
} else if (item.module === 's2ibuilders' || item.type === 's2i') {
requests.push(this.builderStore.delete(item))
}
}
Expand Down
3 changes: 3 additions & 0 deletions src/utils/object.mapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,9 @@ const S2IBuildersMapper = item => {
? replaceToLocalOrigin(sourceUrl)
: sourceUrl,
type: get(item, 'metadata.labels["s2i-type.kubesphere.io"]', 's2i'),
module: get(item, 'kind')
? `${get(item, 'kind').toLowerCase()}s`
: 's2ibuilders',
_originData: getOriginData(item),
}
}
Expand Down

0 comments on commit 6be9d79

Please sign in to comment.