Skip to content
Snippets Groups Projects
Commit a03f4100 authored by wtaisner@man.poznan.pl's avatar wtaisner@man.poznan.pl
Browse files

NMAAS-980 removed edit mode from clusters details component

parent e2a47da6
No related branches found
No related tags found
No related merge requests found
<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>
......@@ -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>
......@@ -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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment