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: Display volume template info in statefulsets setting modal #3522

Merged
merged 1 commit into from
Aug 3, 2022
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { List } from 'components/Base'

import styles from './index.scss'

const Card = ({ volume, onDelete, onEdit }) => {
const Card = ({ volume, onDelete, onEdit, banEdit = false }) => {
const handleDelete = () => onDelete(volume.metadata.name)
const handleEdit = () => onEdit(volume)

Expand Down Expand Up @@ -70,6 +70,22 @@ const Card = ({ volume, onDelete, onEdit }) => {
</div>
)

if (banEdit) {
return (
<List.Item
icon="storage"
title={get(volume, 'metadata.name', '-')}
description={`${t('Storage Classs')}: ${get(
volume,
'spec.storageClassName',
'-'
)}`}
extras={mount}
details={details}
/>
)
}

return (
<List.Item
icon="storage"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export default class VolumeList extends React.Component {
onChange: PropTypes.func,
onShowAddVolume: PropTypes.func,
onShowEdit: PropTypes.func,
hideVolumeSetting: PropTypes.bool,
}

static defaultProps = {
Expand All @@ -45,6 +46,7 @@ export default class VolumeList extends React.Component {
onChange() {},
onShowAddVolume() {},
onShowEdit() {},
hideVolumeSetting: false,
}

static contextTypes = {
Expand Down Expand Up @@ -144,7 +146,7 @@ export default class VolumeList extends React.Component {
}

render() {
const { className } = this.props
const { className, hideVolumeSetting } = this.props
const formatVolumes = this.getFormattedVolumes()

return (
Expand All @@ -158,11 +160,12 @@ export default class VolumeList extends React.Component {
key={get(volume, 'metadata.name')}
onEdit={this.handleEdit}
onDelete={this.handleDelete}
banEdit={hideVolumeSetting}
/>
))}
</ul>
)}
{this.renderAddVolume()}
{!hideVolumeSetting && this.renderAddVolume()}
</div>
</div>
)
Expand Down
3 changes: 2 additions & 1 deletion src/components/Forms/Workload/VolumeSettings/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,7 @@ class VolumeSettings extends React.Component {
/>
)}
<div className={styles.volumes}>
{isSTS && !hideVolumeSetting && (
{isSTS && (
<Form.Item>
<VolumeTemplateList
prefix={this.prefix}
Expand All @@ -676,6 +676,7 @@ class VolumeSettings extends React.Component {
onShowEdit={this.showEditVolumeTemplate}
collectSavedLog={collectSavedLog}
logPath={logPath}
hideVolumeSetting={hideVolumeSetting}
/>
</Form.Item>
)}
Expand Down