Commit 3661f649 authored by Alicja Reniewicz's avatar Alicja Reniewicz
Browse files

id for all ByonDefinition elements

parent 9d77a1c2
......@@ -7,6 +7,7 @@ export enum IpVersion {
}
export class IpAddress {
id: number;
ipAddressType: IpAddressType;
ipVersion: string;
value: string;
......
export class LoginCredential {
id: number;
username: string;
password: string;
privateKey: string;
......
......@@ -2,6 +2,7 @@ import {OperatingSystem} from '../../process/process-details/offer/model/operati
import {GeoLocation} from '../../process/process-details/offer/model/geo-location';
export class NodeProperties {
id: number;
providerId: string;
numberOfCores: number;
memory: number;
......
......@@ -66,6 +66,7 @@ export class ByonDefinitionFormComponent implements OnInit {
}
);
this.loginCredentialForm = this.formBuilder.group({
id: this.byonData ? this.byonData.loginCredential.id : null,
username: this.byonData ? new FormControl({value: this.byonData.loginCredential.username, disabled: this.isReadMode})
: ['', Validators.required],
password: this.byonData ? new FormControl({value: this.byonData.loginCredential.password, disabled: this.isReadMode})
......@@ -77,6 +78,7 @@ export class ByonDefinitionFormComponent implements OnInit {
validators: oneOfTwoFieldsRequiredValidator('password', 'privateKey')
});
this.geoLocationForm = this.formBuilder.group({
id: this.byonData ? this.byonData.nodeProperties.geoLocation.id : null,
city: this.byonData ? new FormControl({value: this.byonData.nodeProperties.geoLocation.city, disabled: this.isReadMode})
: ['', Validators.required],
country: this.byonData ? new FormControl({value: this.byonData.nodeProperties.geoLocation.country, disabled: this.isReadMode})
......@@ -90,6 +92,7 @@ export class ByonDefinitionFormComponent implements OnInit {
});
this.operatingSystemForm = this.formBuilder.group({
id: this.byonData ? this.byonData.nodeProperties.operatingSystem.id : null,
operatingSystemFamily: this.byonData ? new FormControl({
value: this.byonData.nodeProperties.operatingSystem.operatingSystemFamily,
disabled: this.isReadMode
......@@ -105,6 +108,7 @@ export class ByonDefinitionFormComponent implements OnInit {
});
this.nodePropertiesForm = this.formBuilder.group({
id: this.byonData ? this.byonData.nodeProperties.id : null,
providerId: this.byonData ? new FormControl({value: this.byonData.nodeProperties.providerId, disabled: this.isReadMode})
: ['', Validators.required],
numberOfCores: this.byonData ? new FormControl({value: this.byonData.nodeProperties.numberOfCores, disabled: this.isReadMode})
......
import {Component, OnInit, ViewChild} from '@angular/core';
import {MatPaginator, MatSnackBar, MatSort, MatTableDataSource} from '@angular/material';
import {Byon} from '../model/byon';
import {IpAddressType} from '../../application/model/ip-address';
import {IpAddressType, IpVersion} from '../../application/model/ip-address';
import {Cloud} from '../../process/process-details/offer/model/cloud';
import {ByonService} from '../service/byon.service';
import {AppInjector} from '../../injector/app-injector';
......@@ -41,9 +41,10 @@ export class ByonListCommonComponent implements OnInit {
}
}
getPublicIp(byon: Byon): string {
getPublicIpV4(byon: Byon): string {
const publicIP = byon.ipAddresses
.find(value => value.ipAddressType.toString() === IpAddressType[IpAddressType.PUBLIC_IP]);
.find(value => (value.ipAddressType.toString() === IpAddressType[IpAddressType.PUBLIC_IP]
&& value.ipVersion.toString() === IpVersion[IpVersion.V4]));
return publicIP ? publicIP.value : 'UNKNOWN';
}
......@@ -71,7 +72,7 @@ export class ByonListCommonComponent implements OnInit {
this.data.sortingDataAccessor = (item, property) => {
switch (property) {
case 'publicIpAddress':
return this.getPublicIp(item);
return this.getPublicIpV4(item);
case 'cores':
return item.nodeProperties.numberOfCores;
case 'memory':
......@@ -93,7 +94,7 @@ export class ByonListCommonComponent implements OnInit {
}
private getByonDefinitionAsString(byon: Byon) {
return `${byon.name} ${this.getPublicIp(byon)} ${byon.nodeProperties.numberOfCores} ${byon.nodeProperties.memory}
return `${byon.name} ${this.getPublicIpV4(byon)} ${byon.nodeProperties.numberOfCores} ${byon.nodeProperties.memory}
${byon.nodeProperties.disk} ${this.getSystemWithVersion(byon)} ${this.getLocation(byon)} ${this.getProviderName(byon)}`;
}
}
......@@ -35,9 +35,9 @@
</ng-container>
<ng-container matColumnDef="publicIpAddress">
<th mat-header-cell *matHeaderCellDef mat-sort-header>Public IP address</th>
<th mat-header-cell *matHeaderCellDef mat-sort-header>Public IP v4 address</th>
<td mat-cell *matCellDef="let row" (click)="onReadByonDefinitionClick(row)">
{{getPublicIp(row)}}
{{getPublicIpV4(row)}}
</td>
</ng-container>
......
......@@ -48,6 +48,7 @@ export class ByonListComponent extends ByonListCommonComponent implements OnInit
});
},
error1 => {
this.byonLoadingInProgress = false;
this.cloudsList = [];
this.snackBar.open(`Problem by getting data about clouds: ${error1.error.message}`, 'Close');
});
......@@ -58,7 +59,7 @@ export class ByonListComponent extends ByonListCommonComponent implements OnInit
}
onSshConnectionClick(byon: Byon) {
this.webSshService.createSshConnection(byon.loginCredential, this.getPublicIp(byon), byon.name);
this.webSshService.createSshConnection(byon.loginCredential, this.getPublicIpV4(byon), byon.name);
}
onEditByonDefinitionClick(byon: Byon) {
......
......@@ -25,6 +25,7 @@
<a mat-list-item routerLink="/process/details/deployment">Deployed artifacts</a>
<a mat-list-item routerLink=".">Melodic components</a>
<a mat-list-item routerLink="/provider/cloud-definition">Providers settings</a>
<a mat-list-item routerLink="/byon">Byons settings</a>
<a mat-list-item routerLink="/process/details/offer">Offers</a>
<a *ngIf="isAdmin()" mat-list-item routerLink="/user">Manage users</a>
<a mat-list-item routerLink="/user/password">Change password</a>
......
......@@ -34,8 +34,8 @@
</ng-container>
<ng-container matColumnDef="publicIpAddress">
<th mat-header-cell *matHeaderCellDef mat-sort-header>public IP address</th>
<td mat-cell *matCellDef="let row">{{getPublicIp(row)}}</td>
<th mat-header-cell *matHeaderCellDef mat-sort-header>public IP v4 address</th>
<td mat-cell *matCellDef="let row">{{getPublicIpV4(row)}}</td>
</ng-container>
<ng-container matColumnDef="cores">
......
......@@ -62,7 +62,8 @@ export class ByonDefinitionsComponent extends ByonListCommonComponent implements
isByonFromCloudiator(byon: Byon) {
return this.byonInCloudiatorList
.find(valueFromList => this.getPublicIp(valueFromList) === this.getPublicIp(byon));
.find(valueFromList => (this.getPublicIpV4(valueFromList) === this.getPublicIpV4(byon)
&& valueFromList.name === byon.name));
}
getByonDefinitionList() {
......@@ -96,7 +97,8 @@ export class ByonDefinitionsComponent extends ByonListCommonComponent implements
byonDefValue.forEach(value => {
if (this.isByonFromCloudiator(value)) {
value.id = this.byonInCloudiatorList
.find(valueFromList => this.getPublicIp(valueFromList) === this.getPublicIp(value)).id;
.find(valueFromList => (this.getPublicIpV4(valueFromList) === this.getPublicIpV4(value)
&& valueFromList.name === value.name)).id;
}
});
}
......
export class GeoLocation {
id: number;
city: string;
country: string;
latitude: number;
......
export class OperatingSystem {
id: number;
operatingSystemFamily: string;
operatingSystemArchitecture: string;
operatingSystemVersion: number;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment