Skip to content

Commit

Permalink
cherrypick hide external cluster from project overview (#5729)
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmadhamzh authored Feb 14, 2023
1 parent 9122dab commit 4c39540
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
9 changes: 8 additions & 1 deletion src/app/project-overview/create-resource-panel/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import {
AddAutomaticBackupDialogConfig,
} from '@app/backup/list/automatic-backup/add-dialog/component';
import {AddSnapshotDialogComponent, AddSnapshotDialogConfig} from '@app/backup/list/snapshot/add-dialog/component';
import {SettingsService} from '@app/core/services/settings';

@Component({
selector: 'km-create-resource-panel',
Expand All @@ -47,6 +48,7 @@ export class CreateResourcePanelComponent implements OnInit, OnDestroy {
@Output() refreshClusterTemplates = new EventEmitter<void>();
@Output() refreshBackups = new EventEmitter<void>();

areExternalClustersEnabled = false;
projectViewOnlyToolTip =
'You do not have permission to perform this action. Contact the project owner to change your membership role';

Expand All @@ -59,7 +61,8 @@ export class CreateResourcePanelComponent implements OnInit, OnDestroy {
private readonly _elementRef: ElementRef,
private readonly _router: Router,
private readonly _matDialog: MatDialog,
private readonly _userService: UserService
private readonly _userService: UserService,
private readonly _settingsService: SettingsService
) {}

ngOnInit(): void {
Expand All @@ -69,6 +72,10 @@ export class CreateResourcePanelComponent implements OnInit, OnDestroy {
.getCurrentUserGroup(this.project.id)
.pipe(takeUntil(this._unsubscribe))
.subscribe(userGroup => (this._currentGroupConfig = this._userService.getCurrentUserGroupConfig(userGroup)));

this._settingsService.adminSettings.pipe(takeUntil(this._unsubscribe)).subscribe(settings => {
this.areExternalClustersEnabled = settings.enableExternalClusterImport;
});
}

ngOnDestroy(): void {
Expand Down
6 changes: 4 additions & 2 deletions src/app/project-overview/create-resource-panel/template.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
[ngClass]="{'km-muted-bg': !canCreateCluster}"></i>
<span>Create Cluster</span>
</div>
<div class="entry"
<div *ngIf="areExternalClustersEnabled"
class="entry"
[ngClass]="{'km-text-muted': !canCreateCluster, 'km-hover-bg km-pointer': canCreateCluster}"
fxLayoutAlign=" center"
fxLayoutGap="14px"
Expand All @@ -48,7 +49,8 @@
[ngClass]="{'km-muted-bg': !canCreateCluster}"></i>
<span>Import External Cluster</span>
</div>
<div class="entry"
<div *ngIf="areExternalClustersEnabled"
class="entry"
[ngClass]="{'km-text-muted': !canCreateCluster, 'km-hover-bg km-pointer': canCreateCluster}"
fxLayoutAlign=" center"
fxLayoutGap="14px"
Expand Down

0 comments on commit 4c39540

Please sign in to comment.