From a03f41009121f006ce2ef9b404c669214ef3bf84 Mon Sep 17 00:00:00 2001 From: "wtaisner@man.poznan.pl" <Mzk5MTY0NTg1OTU0Ovu3YSgVZ+zprEjbjLbqnXY/ABt4> Date: Mon, 8 Mar 2021 14:28:42 +0100 Subject: [PATCH] NMAAS-980 removed edit mode from clusters details component --- .../details/clusterdetails.component.html | 2 +- .../details/clusterdetails.component.html | 4 --- .../details/clusterdetails.component.ts | 35 +++++++------------ 3 files changed, 13 insertions(+), 28 deletions(-) diff --git a/src/app/appmarket/admin/clusters/details/clusterdetails.component.html b/src/app/appmarket/admin/clusters/details/clusterdetails.component.html index b980479c..b5730cb4 100644 --- a/src/app/appmarket/admin/clusters/details/clusterdetails.component.html +++ b/src/app/appmarket/admin/clusters/details/clusterdetails.component.html @@ -1 +1 @@ -<nmaas-clusterdetails class="col-sm-12 col-sm-12 col-md-12" [cluster]="cluster" [error]="error" [mode]="getCurrentMode()" [allowedModes]="[ComponentMode.VIEW, ComponentMode.EDIT, ComponentMode.CREATE]" (onSave)="onSave($event)" (onDelete)="onDelete($event)"></nmaas-clusterdetails> +<nmaas-clusterdetails class="col-sm-12 col-sm-12 col-md-12" [cluster]="cluster" [error]="error" [mode]="getCurrentMode()" [allowedModes]="[ComponentMode.VIEW, ComponentMode.CREATE]" (onSave)="onSave($event)" (onDelete)="onDelete($event)"></nmaas-clusterdetails> diff --git a/src/app/shared/admin/clusters/details/clusterdetails.component.html b/src/app/shared/admin/clusters/details/clusterdetails.component.html index 83c7ef35..7344c928 100644 --- a/src/app/shared/admin/clusters/details/clusterdetails.component.html +++ b/src/app/shared/admin/clusters/details/clusterdetails.component.html @@ -243,12 +243,8 @@ <p>{{this.error}}</p> </div> - <button *ngIf="isInMode(ComponentMode.EDIT)" type="button" - class="btn btn-default" (click)="onModeChange()">{{ 'CLUSTERS.VIEW_BUTTON' | translate }}</button> <button *ngIf="!isInMode(ComponentMode.VIEW)" [disabled]="!clusterForm.form.valid" type="submit" class="btn btn-primary">{{ 'CLUSTERS.SUBMIT_BUTTON' | translate }}</button> - <button *ngIf="isInMode(ComponentMode.VIEW) && isModeAllowed(ComponentMode.EDIT)" - type="button" class="btn btn-default" (click)="onModeChange()">{{ 'CLUSTERS.EDIT_BUTTON' | translate }}</button> </form> </div> </div> diff --git a/src/app/shared/admin/clusters/details/clusterdetails.component.ts b/src/app/shared/admin/clusters/details/clusterdetails.component.ts index 67107de2..fe423e4f 100644 --- a/src/app/shared/admin/clusters/details/clusterdetails.component.ts +++ b/src/app/shared/admin/clusters/details/clusterdetails.component.ts @@ -7,7 +7,6 @@ import { NamespaceConfigOption } from '../../../../model/cluster'; import {BaseComponent} from '../../../common/basecomponent/base.component'; -import {ComponentMode} from '../../../common/componentmode'; import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core'; import {Router} from '@angular/router'; @@ -30,7 +29,7 @@ export class ClusterDetailsComponent extends BaseComponent implements OnInit { public cluster: Cluster = new Cluster(); @Input() - public error:string; + public error: string; @Output() public onSave: EventEmitter<Cluster> = new EventEmitter<Cluster>(); @@ -38,10 +37,10 @@ export class ClusterDetailsComponent extends BaseComponent implements OnInit { @Output() public onDelete: EventEmitter<string> = new EventEmitter<string>(); - constructor(private router: Router) { - super(); - this.initializeMaps(); - } + constructor(private router: Router) { + super(); + this.initializeMaps(); + } ngOnInit() { @@ -55,26 +54,16 @@ export class ClusterDetailsComponent extends BaseComponent implements OnInit { this.onDelete.emit(clusterName); } - public onModeChange(): void { - const newMode: ComponentMode = (this.mode === ComponentMode.VIEW ? ComponentMode.EDIT : ComponentMode.VIEW); - if (this.isModeAllowed(newMode)) { - this.mode = newMode; - if(this.mode === ComponentMode.VIEW){ - this.router.navigate(['admin/clusters']) - } - } - } - public removeNetwork(id) { this.cluster.externalNetworks.splice( this.cluster.externalNetworks.findIndex( - function(i){ + function (i) { return i.id = id; }), 1); } public addNetwork() { - let newobj: ClusterExtNetwork= new ClusterExtNetwork(); + const newobj: ClusterExtNetwork = new ClusterExtNetwork(); this.cluster.externalNetworks.push(newobj); } @@ -82,16 +71,16 @@ export class ClusterDetailsComponent extends BaseComponent implements OnInit { return index; } - public getKeys(map){ + public getKeys(map) { return Array.from(map.keys()); } - private initializeMaps(){ - this.resourceConfigOption.set('Do nothing',IngressResourceConfigOption.NOT_USED); + private initializeMaps() { + this.resourceConfigOption.set('Do nothing', IngressResourceConfigOption.NOT_USED); this.resourceConfigOption.set('Deploy new resource from the definition in the application chart', IngressResourceConfigOption.DEPLOY_FROM_CHART); - this.controllerConfigOption.set('Use existing',IngressControllerConfigOption.USE_EXISTING); + this.controllerConfigOption.set('Use existing', IngressControllerConfigOption.USE_EXISTING); this.controllerConfigOption.set('Deploy new controller from chart repository', IngressControllerConfigOption.DEPLOY_NEW_FROM_REPO); - this.controllerConfigOption.set('Deploy new controller from local chart archive',IngressControllerConfigOption.DEPLOY_NEW_FROM_ARCHIVE); + this.controllerConfigOption.set('Deploy new controller from local chart archive', IngressControllerConfigOption.DEPLOY_NEW_FROM_ARCHIVE); this.namespaceConfigOption.set('Use default namespace', NamespaceConfigOption.USE_DEFAULT_NAMESPACE); this.namespaceConfigOption.set('Use domain namespace', NamespaceConfigOption.USE_DOMAIN_NAMESPACE); this.namespaceConfigOption.set('Create namespace', NamespaceConfigOption.CREATE_NAMESPACE); -- GitLab