Commit a6fe74d0 authored by Marta Różańska's avatar Marta Różańska
Browse files

Merge branch 'feature-byon-proactive-support' into 'morphemic-rc1.5'

Adding applicationId as param send to backend + some GUI improvements

See merge request !12
parents 7f852130 026d985c
Pipeline #14893 passed with stages
in 6 minutes and 33 seconds
......@@ -12,9 +12,9 @@ build-angular-ui:
- npm install -g --save-dev @angular/cli@latest
- npm install --save-dev --unsafe-perm node-sass@4.14.1
- npm install
script:
script:
- ng build --prod
build-ui-docker:
stage: build-ui-docker
only:
......@@ -22,12 +22,13 @@ build-ui-docker:
- rc3.0
- rc3.1
- morphemic-rc1.5
- feature-byon-proactive-support
image: docker:19.03.1
services:
- docker:19.03.1-dind
variables:
DOCKER_TLS_CERTDIR: "/certs"
dependencies:
dependencies:
- build-angular-ui
script:
- docker login gitlab.ow2.org:4567 -u $K8S_SECRET_DOCKER_USER -p $K8S_SECRET_DOCKER_PASSWORD
......
......@@ -113,7 +113,7 @@ export class VmListComponent implements OnInit {
} else { // find location by locationId
const locationId = vm.originId.split('/')[0];
const location = this.locationList
.find(value => value.id === locationId);
.find(value => value.providerId === locationId);
return (location && location.geoLocation) ? location.geoLocation.city : 'UNKNOWN';
}
}
......
import {Injectable} from '@angular/core';
import {HttpClient, HttpHeaders} from '@angular/common/http';
import {HttpClient, HttpHeaders, HttpParams} from '@angular/common/http';
import {AppConfigService} from '../../app-config/service/app-config.service';
import {Observable} from 'rxjs';
import {Byon} from '../model/byon';
......@@ -7,7 +7,8 @@ import {tap} from 'rxjs/operators';
import {ByonEnums} from '../model/byon-enums';
const httpOptions = {
headers: new HttpHeaders({'Content-Type': 'application/json'})
headers: new HttpHeaders({'Content-Type': 'application/json'}),
params: new HttpParams()
};
@Injectable({
......@@ -67,14 +68,18 @@ export class ByonService {
);
}
addByonDefinitionToCloudiator(byonDefinitionId: string): Observable<Byon> {
const requestUrl = `${this.apiUrl}/cloudiator/${byonDefinitionId}`;
return this.http.post(requestUrl, httpOptions).pipe(
addByonDefinitionToProactive(byonDefinitionId: string): Observable<Byon> {
const requestUrl = `${this.apiUrl}/proactive/${byonDefinitionId}`;
console.log(`addByonDefinitionToProactive-> localStorage appId: ${localStorage.getItem('appId')}`);
//let params = new HttpParams().set('applicationId', localStorage.getItem('appId'));
httpOptions.params = httpOptions.params.set('applicationId', localStorage.getItem('appId'));
console.log(`addByonDefinitionToProactive-> post request with httpOptions.params: ${httpOptions.params.toString()}`);
return this.http.post(requestUrl,null, httpOptions).pipe(
tap((response: Byon) => {
console.log(`Byon as byon with id ${response.id} from byon definition with id ${byonDefinitionId}
successfully added to Cloudiator`);
successfully added to Proactive`);
},
e => console.log(`Error by adding Byon definition with id ${byonDefinitionId} to Cloudiator:`, e))
e => console.log(`Error by adding Byon definition with id ${byonDefinitionId} to Proactive:`, e))
);
}
......
......@@ -37,13 +37,13 @@ export class ByonDefinitionsComponent extends ByonListCommonComponent implements
onAddByonToCloudiatorClick(byon: Byon) {
console.log(`Add byon node with name: ${byon.name} and id: ${byon.id} click`);
this.byonLoadingInProgress = true;
this.byonService.addByonDefinitionToCloudiator(byon.id).subscribe(value => {
this.snackBar.open(`New byon ${value.name} successfully added to Cloudiator`, 'Close');
this.byonService.addByonDefinitionToProactive(byon.id).subscribe(value => {
this.snackBar.open(`New byon ${value.name} successfully added to Proactive`, 'Close');
this.getByonDefinitionList();
},
error1 => {
this.byonLoadingInProgress = false;
this.snackBar.open(`Error by adding new byon to Cloudiator: ${error1.error.message}`, 'Close');
this.snackBar.open(`Error by adding new byon to Proactive: ${error1.error.message}`, 'Close');
});
}
......
......@@ -14,7 +14,7 @@
<div class="card-div">
<mat-form-field class="wide-field">
<mat-select formControlName="applicationId" placeholder="application id" name="applicationId" required>
<mat-option *ngFor="let appId of applicationIds" [value]="appId">
<mat-option *ngFor="let appId of applicationIds" [value]="appId" (onSelectionChange)="handleApplicationIdChange(appId,$event);">
{{appId}}
</mat-option>
</mat-select>
......@@ -30,6 +30,11 @@
Simulation mode
</mat-slide-toggle>
<mat-card-subtitle>
<mat-icon color="warn">warning</mat-icon>
Only AMIs matching: state = available; image-type = machine; hypervisor = xen; virtualization-type = hvm; tag: proactive-list-label = listed-in-proactive will be included in deployment.
</mat-card-subtitle>
<mat-divider></mat-divider>
<div class="card-div">
......
......@@ -79,4 +79,10 @@ export class DeployingFormComponent implements OnInit {
getErrorRequiredMessage() {
return 'You must enter a value';
}
handleApplicationIdChange(appId: string, event: any) {
console.log('Chosen application id for deployment: ' + appId);
localStorage.setItem('appId', appId);
this.snackBar.open(`Chosen application id for deployment: ${appId}`, 'Close', {duration: 10000});
}
}
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