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

Merge branch '294-add-domain-to-cluster' into 'develop'

add domains to cluster's details

See merge request !177
parents e43a5111 d5164306
Branches
No related tags found
2 merge requests!184Develop,!177add domains to cluster's details
Showing
with 117 additions and 4 deletions
......@@ -159,6 +159,7 @@ describe('Component: AppInstance', () => {
domainDcnDetails: null,
domainTechDetails: null,
groups: [],
clusters: [],
applicationStatePerDomain: [
{
applicationBaseId: 2,
......
......@@ -258,6 +258,49 @@
</tbody>
</table>
</div>
</div>
<!-- CLUSTER CONFIGURATION READ ONLY PRESENTATION -->
<div class="background-section" *ngIf="isInMode(ComponentMode.VIEW) && !authService.hasRole('ROLE_OPERATOR')">
<h4 style="font-size:15px; font-weight: bold">{{ 'CLUSTERS.CONFIGURATION' | translate }}</h4>
<div class="form-group" *ngIf="domain.clusters.length >0">
<label for="clusterId" class="col-sm-2 control-label">{{ 'CLUSTERS.ID' | translate }}</label>
<div class="col-sm-10">
<input type="text" class="form-control" [disabled]="true" id="clusterId "
name="clusterId " [(ngModel)]="cluster.id">
</div>
</div>
<div class="form-group" *ngIf="domain.clusters.length >0">
<label for="clusterName" class="col-sm-2 control-label">{{ 'CLUSTERS.NAME' | translate }}</label>
<div class="col-sm-10">
<input type="text" class="form-control" [disabled]="true" id="clusterName "
name="clusterName " [(ngModel)]="cluster.name">
</div>
</div>
<div class="form-group" *ngIf="domain.clusters.length >0">
<label for="clusterCodeName" class="col-sm-2 control-label">{{ 'CLUSTERS.CODENAME' | translate }}</label>
<div class="col-sm-10">
<input type="text" class="form-control" [disabled]="true" id="clusterCodeName "
name="clusterCodeName " [(ngModel)]="cluster.codename">
</div>
</div>
<div class="form-group" *ngIf="domain.clusters.length >0">
<label for="clusterDescription" class="col-sm-2 control-label">{{ 'CLUSTERS.DESCRIPTION' | translate }}</label>
<div class="col-sm-10">
<input type="text" class="form-control" [disabled]="true" id="clusterDescription "
name="clusterDescription " [(ngModel)]="cluster.description">
</div>
</div>
</div>
<div class="flex justify-content-end">
......
......@@ -16,6 +16,7 @@ import {CustomerNetwork} from '../../../model/customernetwork';
import {MinLengthDirective} from '../../../directive/min-length.directive';
import {MaxLengthDirective} from '../../../directive/max-length.directive';
import {DomainAnnotation} from '../../../model/domain-annotation';
import { ClusterManager } from '../../../model/cluster-manager';
@Component({
......@@ -50,6 +51,8 @@ export class DomainComponent extends BaseComponent implements OnInit {
public errorMessage = "";
public cluster: ClusterManager = new ClusterManager();
constructor(public domainService: DomainService,
protected userService: UserService,
private router: Router,
......@@ -72,6 +75,9 @@ export class DomainComponent extends BaseComponent implements OnInit {
this.domainService.getOne(this.domainId).subscribe(
(domain: Domain) => {
this.domain = domain;
if(domain.clusters.length >0) {
this.cluster = domain.clusters[0];
}
this.domain.applicationStatePerDomain
.sort((a, b) => a.applicationBaseName.localeCompare(b.applicationBaseName))
},
......
......@@ -13,4 +13,5 @@ export class ClusterManager {
public ingress: ClusterIngress;
public deployment: ClusterDeployment;
public externalNetworks: ClusterExtNetwork[]
public domainNames: string[];
}
\ No newline at end of file
......@@ -4,6 +4,7 @@ import {DomainApplicationStatePerDomain} from './domainapplicationstateperdomain
import {DomainGroup} from './domaingroup';
import {KeyValue} from './key-value';
import { DomainAnnotation } from './domain-annotation';
import { ClusterManager } from './cluster-manager';
export class Domain {
public id: number = undefined;
......@@ -16,4 +17,5 @@ export class Domain {
public groups: DomainGroup[] = [];
public deleted: boolean;
public annotations: DomainAnnotation[] = [];
public clusters: ClusterManager[] = [];
}
......@@ -52,7 +52,8 @@ describe('DomainService', () => {
applicationStatePerDomain: [],
groups: [],
deleted: false,
annotations: []
annotations: [],
clusters: [],
};
beforeEach(() => {
......
......@@ -78,6 +78,15 @@
<input id="name" type="text" class="form-control" [(ngModel)]="addedCluster.description" [ngModelOptions]="{standalone: true}">
</div>
<div class="mt-4">
<label for="name">{{'CLUSTERS.DOMAIN' | translate}}</label>
<select id="domain" #domainSelect class="form-control" (change)="onDomainSelection(domainSelect.value)">
<option *ngFor="let domain of domains" [value]="domain.name"
>{{domain.name}}
</option>
</select>
</div>
<div class="card flex justify-content-center mt-4" >
<p-fileUpload name="json" (onUpload)="saveFile($event)" customUpload="true" [draggable]="true" pTooltip="Upload file is required before save"
......
......@@ -2,6 +2,7 @@ import { Component, ViewChild } from '@angular/core';
import { ClusterManagerService } from '../../../../service/cluster-manager.service';
import { ClusterManager } from '../../../../model/cluster-manager';
import { ModalComponent } from '../../../modal';
import { DomainService } from '../../../../service';
@Component({
selector: 'app-manager',
......@@ -16,11 +17,16 @@ export class ClusterManagerComponent {
public updatedFile : File = null;
public maxItemsOnPage = 15;
public domains = [];
@ViewChild(ModalComponent, { static: true })
public modal: ModalComponent;
constructor(private clusterService: ClusterManagerService) {
constructor(private clusterService: ClusterManagerService,
private domainService: DomainService
) {
this.getAllClusters();
this.domainService.getAllBase().subscribe(result => this.domains = result);
}
public saveFile(event: any) {
......@@ -50,5 +56,14 @@ public closeModalAndSaveCluster() {
}
public onDomainSelection(event: any) {
console.log(event);
this.addedCluster.domainNames = [event]
}
}
......@@ -47,6 +47,20 @@
</div>
</div>
<div class="form-group">
<label for="clusterCreationDate" class="col-sm-2 control-label">{{ 'CLUSTERS.DOMAIN' | translate }}</label>
<div class="col-sm-10">
<div class="col-sm-10">
<select id="domain" #domainSelect class="form-control" (change)="onDomainSelection(domainSelect.value)">
<option *ngFor="let domain of domains" [selected]="cluster.domainNames[0] === domain.name" [value]="domain.name"
>{{domain.name}}
</option>
</select>
</div>
</div>
</div>
<div class="form-group">
<label for="clusterCreationDate" class="col-sm-2 control-label">{{ 'CLUSTERS.CREATION_DATE' | translate }}</label>
<div class="col-sm-10">
......
......@@ -9,6 +9,7 @@ import { CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA } from '@angular/core';
import { TranslateFakeLoader, TranslateLoader, TranslateModule } from '@ngx-translate/core';
import { FormsModule } from '@angular/forms';
import { IngressCertificateConfigOption, IngressControllerConfigOption, IngressResourceConfigOption, NamespaceConfigOption } from '../../../../model/cluster';
import { HttpClientTestingModule } from '@angular/common/http/testing';
describe('ClusterManagerDetailsComponent', () => {
let component: ClusterManagerDetailsComponent;
......@@ -27,6 +28,7 @@ describe('ClusterManagerDetailsComponent', () => {
codename: 'test-cluster',
pathConfigFile: '/path/to/config.yaml',
clusterConfigFile: 'Config',
domainNames: ["test"],
ingress: {
id: 1,
controllerConfigOption: IngressControllerConfigOption.USE_EXISTING,
......@@ -68,6 +70,7 @@ describe('ClusterManagerDetailsComponent', () => {
declarations: [ClusterManagerDetailsComponent],
imports: [FormsModule,
CommonModule,
HttpClientTestingModule,
TranslateModule.forRoot({
loader: {
provide: TranslateLoader,
......@@ -174,7 +177,8 @@ describe('ClusterManagerDetailsComponent', () => {
pathConfigFile: '/path/to/config.yaml',
clusterConfigFile: 'Config',
ingress: null,
deployment: null
deployment: null,
domainNames: ["test"]
};
clusterService.sendCluster.and.returnValue(of(mockResponse));
......
......@@ -5,7 +5,7 @@ import { ActivatedRoute, Router } from '@angular/router';
import { BaseComponent } from '../../../common/basecomponent/base.component';
import { ClusterExtNetwork, IngressCertificateConfigOption, IngressControllerConfigOption, IngressResourceConfigOption, NamespaceConfigOption } from '../../../../model/cluster';
import { DatePipe } from '@angular/common';
import { ComponentMode } from '../../../common/componentmode';
import { DomainService } from '../../../../service';
@Component({
selector: 'app-manager-details',
......@@ -18,6 +18,9 @@ export class ClusterManagerDetailsComponent extends BaseComponent implements OnI
public cluterId;
public error = "";
public domains = [];
controllerConfigOption: Map<string, IngressControllerConfigOption> = new Map<string, IngressControllerConfigOption>();
resourceConfigOption: Map<string, IngressResourceConfigOption> = new Map<string, IngressResourceConfigOption>();
......@@ -31,6 +34,7 @@ export class ClusterManagerDetailsComponent extends BaseComponent implements OnI
public router: Router,
private route: ActivatedRoute,
private datePipe: DatePipe,
private domainService: DomainService
) {
super();
......@@ -38,6 +42,8 @@ export class ClusterManagerDetailsComponent extends BaseComponent implements OnI
}
public ngOnInit() {
this.domainService.getAllBase().subscribe(result => this.domains = result);
this.route.params.subscribe(params => {
this.cluterId = +params['id'];
......@@ -102,4 +108,11 @@ export class ClusterManagerDetailsComponent extends BaseComponent implements OnI
});
}
public onDomainSelection(event: any) {
console.log(event);
this.cluster.domainNames = [event]
}
}
......@@ -28,6 +28,7 @@ describe('DomainFilterComponent', () => {
applicationStatePerDomain: [],
groups: [],
annotations: [],
clusters: [],
}
const domain1: Domain = {
......@@ -41,6 +42,7 @@ describe('DomainFilterComponent', () => {
applicationStatePerDomain: [],
groups: [],
annotations: [],
clusters: [],
};
const domain2: Domain = {
......@@ -54,6 +56,7 @@ describe('DomainFilterComponent', () => {
applicationStatePerDomain: [],
groups: [],
annotations: [],
clusters: [],
};
beforeEach(waitForAsync(() => {
......
......@@ -47,6 +47,7 @@ describe('AppInstallmodalComponent', () => {
applicationStatePerDomain: [],
groups: [],
annotations: [],
clusters: [],
}
beforeEach(waitForAsync(() => {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment