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; if (!cluster || !config) return null;
const contexts = config.contexts.filter(context => context.name !== cluster.contextName);
return ( return (
<Dialog <Dialog
className={styles.dialog} className={styles.dialog}
@ -210,6 +212,8 @@ export class DeleteClusterDialog extends React.Component {
</div> </div>
{this.renderWarning()} {this.renderWarning()}
<hr className={styles.hr}/> <hr className={styles.hr}/>
{contexts.length > 0 && (
<>
<div className="mt-4"> <div className="mt-4">
<Checkbox <Checkbox
data-testid="context-switch" data-testid="context-switch"
@ -225,6 +229,8 @@ export class DeleteClusterDialog extends React.Component {
/> />
</div> </div>
{this.renderCurrentContextSwitch()} {this.renderCurrentContextSwitch()}
</>
)}
</div> </div>
<div className={styles.dialogButtons}> <div className={styles.dialogButtons}>
<Button <Button