Skip to content
Snippets Groups Projects
Commit 5ebce399 authored by kbeyro's avatar kbeyro
Browse files

add cluster & change priviliges

parent 4b8810e1
No related branches found
No related tags found
1 merge request!220Template paging
......@@ -60,7 +60,7 @@
[ngModelOptions]="{standalone: true}">
</div>
<div *roles="['ROLE_OPERATOR', 'ROLE_SYSTEM_ADMIN']" class="mt-4">
<!-- <div *roles="['ROLE_OPERATOR', 'ROLE_SYSTEM_ADMIN']" class="mt-4">
<div>
<label for="assignDomain">Assign to domain? </label>
<input type="checkbox" [(ngModel)]="assignedDomain" (change)="onDomainChange($event)"
......@@ -75,9 +75,9 @@
</select>
</div>
</div>
</div> -->
<div *roles="[ 'ROLE_DOMAIN_ADMIN']" class="mt-4">
<div class="mt-4">
<div class="mt-4" >
<label for="name">{{'CLUSTERS.DOMAIN' | translate}}*</label>
<select id="domain" #domainSelect class="form-control" (change)="onDomainSelection(domainSelect.value)"
......@@ -107,7 +107,7 @@
<div class="panel-default panel-heading">{{ 'CLUSTERS.INGRESS' | translate }} </div>
<div class="panel-body">
<div class="form-group">
<!-- <div class="form-group">
<label for="ingresscontrollerconfigoption" class="col-sm-2 control-label">{{
'CLUSTERS.CONTROLLER_CONFIG_OPTION' | translate }}</label>
<div class="col-sm-10" *ngIf="controllerConfigOption">
......@@ -118,7 +118,7 @@
[value]="controllerConfigOption.get(configOption)">{{configOption}}</option>
</select>
</div>
</div>
</div> -->
<div class="form-group">
<label for="suportedingressclass" class="col-sm-2 control-label">{{
'CLUSTERS.SUPPORTED_INGRESS_CLASS' | translate }}</label>
......@@ -136,7 +136,7 @@
[(ngModel)]="cluster.ingress.publicIngressClass" [disabled]="">
</div>
</div>
<div class="form-group">
<!-- <div class="form-group">
<label for="ingresscontrollerchartname" class="col-sm-2 control-label">{{
'CLUSTERS.CONTROLLER_CHART_NAME' | translate }}</label>
<div class="col-sm-10">
......@@ -153,8 +153,8 @@
name="ingresscontrollerchartarchive"
[(ngModel)]="cluster.ingress.controllerChartArchive" [disabled]="">
</div>
</div>
<div class="form-group">
</div> -->
<!-- <div class="form-group">
<label for="ingressresourceconfigoption" class="col-sm-2 control-label">{{
'CLUSTERS.RESOURCE_CONFIG_OPTION' | translate }}</label>
<div class="col-sm-10">
......@@ -165,7 +165,7 @@
[value]="resourceConfigOption.get(configOption)">{{configOption}}</option>
</select>
</div>
</div>
</div> -->
<div class="form-group">
<label for="ingressexternalservicedomain" class="col-sm-2 control-label">{{
'CLUSTERS.EXTERNAL_SERVICE_DOMAIN' | translate }}</label>
......
......@@ -126,6 +126,7 @@ export class AddClusterComponent implements OnInit {
public submit(): void {
console.log(this.cluster);
this.deteleDates();
this.setInitialValues();
this.cluserService.sendCluster(new File([this.kubernetesFile], 'kubernetes.yaml'), this.cluster).subscribe(result => {
console.log(result);
this.cluster = result;
......@@ -160,4 +161,13 @@ export class AddClusterComponent implements OnInit {
public step2valid(): boolean {
return this.cluster.domainNames.length > 0 && this.cluster.contactEmail !== '' && this.cluster.description !== ''
}
public setInitialValues() {
this.cluster.ingress.controllerConfigOption = IngressControllerConfigOption.USE_EXISTING;
this.cluster.ingress.controllerChartName = "";
this.cluster.ingress.controllerChartArchive = "";
this.cluster.ingress.resourceConfigOption = IngressResourceConfigOption.DEPLOY_FROM_CHART;
}
}
......@@ -7,7 +7,6 @@
<label style="margin-right:10px" for="domainId" >{{'USER_PRIVILEGES.DOMAIN' | translate}}:</label>
<select class="form-control" [formGroup]="newPrivilegeForm"
id="domainId" name="domainId" formControlName="domainId" style="min-width: 170px"
[attr.disabled]="domainId!==domainService.getGlobalDomainId()? '' : null"
(ngModelChange)="clearSelectedRole()">
<option *ngFor="let domain of domains" [value]="domain.id">{{domain.name}}</option>
</select>
......
......@@ -15,6 +15,7 @@ import {UserDataService} from '../../../service/userdata.service';
styleUrls: ['./userprivileges.component.css']
})
@RoleAware
//TODO: remove domainId dependencies on selector -> allways set to globaldomain at init, only SYSTEM_ADMIN can access this view
export class UserPrivilegesComponent extends BaseComponent implements OnInit {
public Role = Role;
......@@ -43,9 +44,13 @@ export class UserPrivilegesComponent extends BaseComponent implements OnInit {
this.roles = this.getAllowedRoles();
userData.selectedDomainId.subscribe(value => {
this.domainId = value;
// this.domainId = value;
this.domainId = this.domainService.getGlobalDomainId();
if(this.authService.hasRole(Role[Role.ROLE_SYSTEM_ADMIN])) {
this.newPrivilegeForm.get('domainId').setValue(this.domainService.getGlobalDomainId());
}
// after the domain is retrieved, set selected domain as current
this.newPrivilegeForm.get('domainId').setValue(this.domainId);
});
}
......@@ -90,7 +95,7 @@ export class UserPrivilegesComponent extends BaseComponent implements OnInit {
ngOnInit() {
if (this.authService.hasRole(Role[Role.ROLE_SYSTEM_ADMIN])) {
this.domainService.getAll().subscribe((domains) => {
this.domainService.getAllBase().subscribe((domains) => {
this.domains = domains
});
} else if (this.authService.hasRole(Role[Role.ROLE_DOMAIN_ADMIN])) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment