Skip to content
Snippets Groups Projects
Commit e8cd543d authored by Lukasz Lopatowski's avatar Lukasz Lopatowski
Browse files

Merge branch 'template-paging' into 'develop'

Template paging

See merge request !220
parents 700815b7 3468c38f
Branches
No related tags found
1 merge request!220Template paging
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
</div> </div>
<button type="button" class="btn btn-primary pull-right" (click)="uploadKubernetesFile()" <button type="button" class="btn btn-primary pull-right" (click)="uploadKubernetesFile()"
pTooltip="{{'APPS_WIZARD.ACCEPT_RULES_TOOLTIP' | translate}}" tooltipPosition="bottom" pTooltip="{{'CLUSTERS.WIZARD.TOOLTIP_1' | translate}}" tooltipPosition="bottom"
[showDelay]="50">{{'APPS_WIZARD.NEXT_BUTTON' | translate}}</button> [showDelay]="50">{{'APPS_WIZARD.NEXT_BUTTON' | translate}}</button>
</div> </div>
...@@ -60,7 +60,7 @@ ...@@ -60,7 +60,7 @@
[ngModelOptions]="{standalone: true}"> [ngModelOptions]="{standalone: true}">
</div> </div>
<div *roles="['ROLE_OPERATOR', 'ROLE_SYSTEM_ADMIN']" class="mt-4"> <!-- <div *roles="['ROLE_OPERATOR', 'ROLE_SYSTEM_ADMIN']" class="mt-4">
<div> <div>
<label for="assignDomain">Assign to domain? </label> <label for="assignDomain">Assign to domain? </label>
<input type="checkbox" [(ngModel)]="assignedDomain" (change)="onDomainChange($event)" <input type="checkbox" [(ngModel)]="assignedDomain" (change)="onDomainChange($event)"
...@@ -75,9 +75,9 @@ ...@@ -75,9 +75,9 @@
</select> </select>
</div> </div>
</div> </div> -->
<div *roles="[ 'ROLE_DOMAIN_ADMIN']" class="mt-4"> <div class="mt-4">
<div class="mt-4" > <div class="mt-4" >
<label for="name">{{'CLUSTERS.DOMAIN' | translate}}*</label> <label for="name">{{'CLUSTERS.DOMAIN' | translate}}*</label>
<select id="domain" #domainSelect class="form-control" (change)="onDomainSelection(domainSelect.value)" <select id="domain" #domainSelect class="form-control" (change)="onDomainSelection(domainSelect.value)"
...@@ -91,7 +91,7 @@ ...@@ -91,7 +91,7 @@
</div> </div>
<button type="button" class="btn btn-primary pull-right" (click)="nextStep()" [disabled]="!step2valid()" <button type="button" class="btn btn-primary pull-right" (click)="nextStep()" [disabled]="!step2valid()"
pTooltip="{{'APPS_WIZARD.ACCEPT_RULES_TOOLTIP' | translate}}" tooltipPosition="bottom" pTooltip="{{'CLUSTERS.WIZARD.TOOLTIP_2' | translate}}" tooltipPosition="bottom"
[showDelay]="50">{{'APPS_WIZARD.NEXT_BUTTON' | translate}}</button> [showDelay]="50">{{'APPS_WIZARD.NEXT_BUTTON' | translate}}</button>
</div> </div>
...@@ -100,6 +100,10 @@ ...@@ -100,6 +100,10 @@
<div *ngIf="activeStepIndex === 2"> <div *ngIf="activeStepIndex === 2">
<div class="bs-callout bs-callout-primary">
<h4>{{'CLUSTERS.WIZARD.STEP_3' | translate }}</h4>
{{'CLUSTERS.WIZARD.STEP_3_INFO' | translate }}
</div>
<div class="background-section"> <div class="background-section">
<h4 style="font-size:15px; font-weight: bold">{{ 'CLUSTERS.TITLE' | translate }}</h4> <h4 style="font-size:15px; font-weight: bold">{{ 'CLUSTERS.TITLE' | translate }}</h4>
<div class="panel-body"> <div class="panel-body">
...@@ -107,7 +111,7 @@ ...@@ -107,7 +111,7 @@
<div class="panel-default panel-heading">{{ 'CLUSTERS.INGRESS' | translate }} </div> <div class="panel-default panel-heading">{{ 'CLUSTERS.INGRESS' | translate }} </div>
<div class="panel-body"> <div class="panel-body">
<div class="form-group"> <!-- <div class="form-group">
<label for="ingresscontrollerconfigoption" class="col-sm-2 control-label">{{ <label for="ingresscontrollerconfigoption" class="col-sm-2 control-label">{{
'CLUSTERS.CONTROLLER_CONFIG_OPTION' | translate }}</label> 'CLUSTERS.CONTROLLER_CONFIG_OPTION' | translate }}</label>
<div class="col-sm-10" *ngIf="controllerConfigOption"> <div class="col-sm-10" *ngIf="controllerConfigOption">
...@@ -118,7 +122,7 @@ ...@@ -118,7 +122,7 @@
[value]="controllerConfigOption.get(configOption)">{{configOption}}</option> [value]="controllerConfigOption.get(configOption)">{{configOption}}</option>
</select> </select>
</div> </div>
</div> </div> -->
<div class="form-group"> <div class="form-group">
<label for="suportedingressclass" class="col-sm-2 control-label">{{ <label for="suportedingressclass" class="col-sm-2 control-label">{{
'CLUSTERS.SUPPORTED_INGRESS_CLASS' | translate }}</label> 'CLUSTERS.SUPPORTED_INGRESS_CLASS' | translate }}</label>
...@@ -136,7 +140,7 @@ ...@@ -136,7 +140,7 @@
[(ngModel)]="cluster.ingress.publicIngressClass" [disabled]=""> [(ngModel)]="cluster.ingress.publicIngressClass" [disabled]="">
</div> </div>
</div> </div>
<div class="form-group"> <!-- <div class="form-group">
<label for="ingresscontrollerchartname" class="col-sm-2 control-label">{{ <label for="ingresscontrollerchartname" class="col-sm-2 control-label">{{
'CLUSTERS.CONTROLLER_CHART_NAME' | translate }}</label> 'CLUSTERS.CONTROLLER_CHART_NAME' | translate }}</label>
<div class="col-sm-10"> <div class="col-sm-10">
...@@ -153,8 +157,8 @@ ...@@ -153,8 +157,8 @@
name="ingresscontrollerchartarchive" name="ingresscontrollerchartarchive"
[(ngModel)]="cluster.ingress.controllerChartArchive" [disabled]=""> [(ngModel)]="cluster.ingress.controllerChartArchive" [disabled]="">
</div> </div>
</div> </div> -->
<div class="form-group"> <!-- <div class="form-group">
<label for="ingressresourceconfigoption" class="col-sm-2 control-label">{{ <label for="ingressresourceconfigoption" class="col-sm-2 control-label">{{
'CLUSTERS.RESOURCE_CONFIG_OPTION' | translate }}</label> 'CLUSTERS.RESOURCE_CONFIG_OPTION' | translate }}</label>
<div class="col-sm-10"> <div class="col-sm-10">
...@@ -165,7 +169,7 @@ ...@@ -165,7 +169,7 @@
[value]="resourceConfigOption.get(configOption)">{{configOption}}</option> [value]="resourceConfigOption.get(configOption)">{{configOption}}</option>
</select> </select>
</div> </div>
</div> </div> -->
<div class="form-group"> <div class="form-group">
<label for="ingressexternalservicedomain" class="col-sm-2 control-label">{{ <label for="ingressexternalservicedomain" class="col-sm-2 control-label">{{
'CLUSTERS.EXTERNAL_SERVICE_DOMAIN' | translate }}</label> 'CLUSTERS.EXTERNAL_SERVICE_DOMAIN' | translate }}</label>
......
...@@ -126,6 +126,7 @@ export class AddClusterComponent implements OnInit { ...@@ -126,6 +126,7 @@ export class AddClusterComponent implements OnInit {
public submit(): void { public submit(): void {
console.log(this.cluster); console.log(this.cluster);
this.deteleDates(); this.deteleDates();
this.setInitialValues();
this.cluserService.sendCluster(new File([this.kubernetesFile], 'kubernetes.yaml'), this.cluster).subscribe(result => { this.cluserService.sendCluster(new File([this.kubernetesFile], 'kubernetes.yaml'), this.cluster).subscribe(result => {
console.log(result); console.log(result);
this.cluster = result; this.cluster = result;
...@@ -160,4 +161,15 @@ export class AddClusterComponent implements OnInit { ...@@ -160,4 +161,15 @@ export class AddClusterComponent implements OnInit {
public step2valid(): boolean { public step2valid(): boolean {
return this.cluster.domainNames.length > 0 && this.cluster.contactEmail !== '' && this.cluster.description !== '' return this.cluster.domainNames.length > 0 && this.cluster.contactEmail !== '' && this.cluster.description !== ''
} }
public setInitialValues() {
if (this.cluster.ingress !== undefined) {
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 @@ ...@@ -7,7 +7,6 @@
<label style="margin-right:10px" for="domainId" >{{'USER_PRIVILEGES.DOMAIN' | translate}}:</label> <label style="margin-right:10px" for="domainId" >{{'USER_PRIVILEGES.DOMAIN' | translate}}:</label>
<select class="form-control" [formGroup]="newPrivilegeForm" <select class="form-control" [formGroup]="newPrivilegeForm"
id="domainId" name="domainId" formControlName="domainId" style="min-width: 170px" id="domainId" name="domainId" formControlName="domainId" style="min-width: 170px"
[attr.disabled]="domainId!==domainService.getGlobalDomainId()? '' : null"
(ngModelChange)="clearSelectedRole()"> (ngModelChange)="clearSelectedRole()">
<option *ngFor="let domain of domains" [value]="domain.id">{{domain.name}}</option> <option *ngFor="let domain of domains" [value]="domain.id">{{domain.name}}</option>
</select> </select>
......
...@@ -18,9 +18,9 @@ describe('UserPrivilegesComponent', () => { ...@@ -18,9 +18,9 @@ describe('UserPrivilegesComponent', () => {
const authServiceSpy = createSpyObj('AuthService', ['hasRole']); const authServiceSpy = createSpyObj('AuthService', ['hasRole']);
authServiceSpy.hasRole.and.returnValue(true) authServiceSpy.hasRole.and.returnValue(true)
const domainServiceSpy = createSpyObj('DomainService', ['getGlobalDomainId', 'getAll', 'getMyDomains']) const domainServiceSpy = createSpyObj('DomainService', ['getGlobalDomainId', 'getAllBase', 'getMyDomains'])
domainServiceSpy.getGlobalDomainId.and.returnValue(1) domainServiceSpy.getGlobalDomainId.and.returnValue(1)
domainServiceSpy.getAll.and.returnValue(of([])) domainServiceSpy.getAllBase.and.returnValue(of([]))
domainServiceSpy.getMyDomains.and.returnValue(of([])) domainServiceSpy.getMyDomains.and.returnValue(of([]))
TestBed.configureTestingModule({ TestBed.configureTestingModule({
......
...@@ -15,6 +15,7 @@ import {UserDataService} from '../../../service/userdata.service'; ...@@ -15,6 +15,7 @@ import {UserDataService} from '../../../service/userdata.service';
styleUrls: ['./userprivileges.component.css'] styleUrls: ['./userprivileges.component.css']
}) })
@RoleAware @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 { export class UserPrivilegesComponent extends BaseComponent implements OnInit {
public Role = Role; public Role = Role;
...@@ -43,9 +44,13 @@ export class UserPrivilegesComponent extends BaseComponent implements OnInit { ...@@ -43,9 +44,13 @@ export class UserPrivilegesComponent extends BaseComponent implements OnInit {
this.roles = this.getAllowedRoles(); this.roles = this.getAllowedRoles();
userData.selectedDomainId.subscribe(value => { 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 // 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 { ...@@ -90,7 +95,7 @@ export class UserPrivilegesComponent extends BaseComponent implements OnInit {
ngOnInit() { ngOnInit() {
if (this.authService.hasRole(Role[Role.ROLE_SYSTEM_ADMIN])) { if (this.authService.hasRole(Role[Role.ROLE_SYSTEM_ADMIN])) {
this.domainService.getAll().subscribe((domains) => { this.domainService.getAllBase().subscribe((domains) => {
this.domains = domains this.domains = domains
}); });
} else if (this.authService.hasRole(Role[Role.ROLE_DOMAIN_ADMIN])) { } 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