Skip to content

Commit

Permalink
Merge pull request #309 from deNBI/feature/simple_vm_flavors
Browse files Browse the repository at this point in the history
feat(Flavors):added flavor to simple vm
  • Loading branch information
dweinholz authored Jan 9, 2019
2 parents e56b114 + 23cc4e2 commit 29dbc46
Show file tree
Hide file tree
Showing 3 changed files with 117 additions and 17 deletions.
15 changes: 11 additions & 4 deletions src/app/applications/addsinglevm.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -220,12 +220,19 @@ <h5 class="col-md-12 form-control-label">Resources</h5>
machines of the
type:</label>
<div class="col-md-8">
<ul>
<li>de.NBI Large (CPUs:32, RAM:64 GB)</li>
<li>de.NBI Medium (CPUs:16, RAM:32 GB)</li>
<li>de.NBI Small (CPUs:8, RAM:16 GB)</li>
<ul *ngFor="let f of flavorList">

<li *ngIf="f.simple_vm">
{{f.name}}
(CPUs:{{f.vcpus}}, RAM:{{f.ram}} GB)

</li>

</ul>
<span class="help-block">More flavors can be enabled on demand.</span>

</div>

</div>

<br>
Expand Down
28 changes: 23 additions & 5 deletions src/app/applications/addsinglevm.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,30 @@ import {SpecialHardware} from './special_hardware.model'
import {ApiSettings} from '../api-connector/api-settings.service'
import {ApplicationsService} from '../api-connector/applications.service'
import {AbstractBaseClasse} from "../shared_modules/baseClass/abstract-base-class";
import {Flavor} from "../virtualmachines/virtualmachinemodels/flavor";
import {FlavorService} from "../api-connector/flavor.service";

@Component({
templateUrl: 'addsinglevm.component.html',
providers: [SpecialHardwareService, ApiSettings, ApplicationsService]
providers: [FlavorService, SpecialHardwareService, ApiSettings, ApplicationsService]
})

export class AddsinglevmComponent extends AbstractBaseClasse{
export class AddsinglevmComponent extends AbstractBaseClasse {
/**
* Check if the shortname provided is valid.
* @type {boolean}
*/
public wronginput: boolean = false;


/**
* List of flavors.
*/
public flavorList: Flavor[];


public error: string[];
public project_application_vms_requested=3;
public project_application_vms_requested = 3;


public acknowledgeModalMessage: string = 'The development and support of the cloud is possible above all through the funding of the cloud infrastructure by the Federal Ministry of Education and Research (BMBF)!\n' +
Expand All @@ -30,14 +39,16 @@ export class AddsinglevmComponent extends AbstractBaseClasse{

/**
* Available special hardware.
* @type {any[]}
* @type {any[]}
*/
special_hardware: SpecialHardware[] = new Array();

constructor(private specialhardwareservice: SpecialHardwareService,
private applicationsservice: ApplicationsService) {
private applicationsservice: ApplicationsService, private flavorService: FlavorService) {
super();
this.getSpecialHardware();
this.getListOfFlavors();


}

Expand Down Expand Up @@ -96,6 +107,13 @@ export class AddsinglevmComponent extends AbstractBaseClasse{
}
}

/**
* gets a list of all available Flavors from the flavorservice and puts them into the array flavorList
*/
getListOfFlavors() {
this.flavorService.getListOfFlavorsAvailable().subscribe(flavors => {this.flavorList = flavors;console.log(this.flavorList)});
}


/**
* Check if shortname is valid.
Expand Down
91 changes: 83 additions & 8 deletions src/app/virtualmachines/virtualmachinemodels/flavor.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,89 @@
import {FlavorType} from "./flavorType";

export class Flavor {
id: string;
name: string;
vcpus: number;
ram: number;
rootdisk: number;
gpu: number;
epheremal_disk: number;
type: FlavorType;
private _id: string;
private _name: string;
private _vcpus: number;
private _ram: number;
private _rootdisk: number;
private _gpu: number;
private _epheremal_disk: number;
private _type: FlavorType;
private _simple_vm: boolean;


get id(): string {
return this._id;
}

set id(value: string) {
this._id = value;
}

get name(): string {
return this._name;
}

set name(value: string) {
this._name = value;
}

get vcpus(): number {
return this._vcpus;
}

set vcpus(value: number) {
this._vcpus = value;
}

get ram(): number {
return this._ram;
}

set ram(value: number) {
this._ram = value;
}

get rootdisk(): number {
return this._rootdisk;
}

set rootdisk(value: number) {
this._rootdisk = value;
}

get gpu(): number {
return this._gpu;
}

set gpu(value: number) {
this._gpu = value;
}

get epheremal_disk(): number {
return this._epheremal_disk;
}

set epheremal_disk(value: number) {
this._epheremal_disk = value;
}

get type(): FlavorType {
return this._type;
}

set type(value: FlavorType) {
this._type = value;
}

get simple_vm(): boolean {
return this._simple_vm;
}

set simple_vm(value: boolean) {
this._simple_vm = value;
}


}

Expand Down

0 comments on commit 29dbc46

Please sign in to comment.