Skip to content

Commit

Permalink
fixup! Add option to clone containers
Browse files Browse the repository at this point in the history
  • Loading branch information
KKoukiou committed Apr 28, 2023
1 parent 8f32c87 commit 01fd85d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 26 deletions.
43 changes: 18 additions & 25 deletions src/ImageRunModal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -1166,29 +1166,22 @@ export class ImageRunModal extends React.Component {
</Form>
);

const cardFooter = () => {
let createRunText = _("Create and run");
let createText = _("Create");

if (this.props.prefill) {
createRunText = _("Clone and run");
createText = _("Clone");
}

return (
<>
<Button variant='primary' id="create-image-create-run-btn" onClick={() => this.onCreateClicked(true)} isDisabled={(!image && selectedImage === "")}>
{createRunText}
</Button>
<Button variant='secondary' id="create-image-create-btn" onClick={() => this.onCreateClicked(false)} isDisabled={(!image && selectedImage === "")}>
{createText}
</Button>
<Button variant='link' className='btn-cancel' onClick={Dialogs.close}>
{_("Cancel")}
</Button>
</>
);
};
const createRunText = this.props.prefill ? _("Clone and run") : _("Create and run");
const createText = this.props.prefill ? _("Clone") : _("Create");

const runModalFooter = (
<>
<Button variant='primary' id="create-image-create-run-btn" onClick={() => this.onCreateClicked(true)} isDisabled={(!image && selectedImage === "")}>
{createRunText}
</Button>
<Button variant='secondary' id="create-image-create-btn" onClick={() => this.onCreateClicked(false)} isDisabled={(!image && selectedImage === "")}>
{createText}
</Button>
<Button variant='link' className='btn-cancel' onClick={Dialogs.close}>
{_("Cancel")}
</Button>
</>
);

return (
<Modal isOpen
Expand All @@ -1202,8 +1195,8 @@ export class ImageRunModal extends React.Component {
Dialogs.close();
}
}}
title={this.props.pod ? cockpit.format(_("Create container in $0"), this.props.pod.Name) : _("Create container")}
footer={cardFooter()}
title={this.props.pod ? cockpit.format(_("Create container in $0"), this.props.pod.Name) : (this.props.prefill ? _("Clone container") : _("Create container"))}
footer={runModalFooter}
>
{defaultBody}
</Modal>
Expand Down
2 changes: 1 addition & 1 deletion src/Notification.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export const ErrorNotification = ({ errorMessage, errorDetail, onDismiss }) => {
export const WarningNotification = ({ warningMessage, warningDetail }) => {
return (
<Alert isInline variant='warning' title={warningMessage}>
{ warningDetail && <p> {_("Warning message")}: <samp>{warningDetail}</samp> </p> }
{ warningDetail && <p>{warningDetail}</p> }
</Alert>
);
};

0 comments on commit 01fd85d

Please sign in to comment.