diff --git a/src/app/appmarket/admin/clusters/details/clusterdetails.component.html b/src/app/appmarket/admin/clusters/details/clusterdetails.component.html index b980479ced4c1e9be8467b892f7715a58d0d5ef8..b5730cb4b9e56571b219092a7e57e10fe0a5bc8e 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 83c7ef3546785c56d927cf4c557f1f9809245772..7344c928d16d1ee366712a1ca3c522403fe2a13c 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 67107de22fc105921b70df173039f056b458e9cc..fe423e4f5ffef54a3879ceb64603d627312ca43e 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);