1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Do not show context switcher if no contexts left

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
Alex Andreev 2021-09-06 10:18:29 +03:00
parent 3c8c45cbaa
commit fe1921bfbe

View File

@ -197,6 +197,8 @@ export class DeleteClusterDialog extends React.Component {
if (!cluster || !config) return null;
const contexts = config.contexts.filter(context => context.name !== cluster.contextName);
return (
<Dialog
className={styles.dialog}
@ -210,21 +212,25 @@ export class DeleteClusterDialog extends React.Component {
</div>
{this.renderWarning()}
<hr className={styles.hr}/>
<div className="mt-4">
<Checkbox
data-testid="context-switch"
theme="light"
label={(
<>
<span className="font-semibold">Select current-context</span>{" "}
{!this.isCurrentContext() && "(optional)"}
</>
)}
value={this.showContextSwitch}
onChange={value => this.showContextSwitch = value}
/>
</div>
{this.renderCurrentContextSwitch()}
{contexts.length > 0 && (
<>
<div className="mt-4">
<Checkbox
data-testid="context-switch"
theme="light"
label={(
<>
<span className="font-semibold">Select current-context</span>{" "}
{!this.isCurrentContext() && "(optional)"}
</>
)}
value={this.showContextSwitch}
onChange={value => this.showContextSwitch = value}
/>
</div>
{this.renderCurrentContextSwitch()}
</>
)}
</div>
<div className={styles.dialogButtons}>
<Button