Skip to content

Commit

Permalink
Merge branch 'feat/extern_limits' into dependabot/npm_and_yarn/es5-ex…
Browse files Browse the repository at this point in the history
…t-0.10.64
  • Loading branch information
vktrrdk committed Mar 19, 2024
2 parents 78e3ef2 + a0e18f4 commit a17e2b1
Show file tree
Hide file tree
Showing 6 changed files with 269 additions and 286 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { FlavorService } from '../../../api-connector/flavor.service';
import { FacilityService } from '../../../api-connector/facility.service';
import { UserService } from '../../../api-connector/user.service';
import { FlavorTypeShortcuts } from './flavor-type-shortcuts';
import { VolumeActionStates } from '../../../virtualmachines/volumes/volume-action-states.enum';

/**
* Application base component..
Expand All @@ -21,112 +20,112 @@ import { VolumeActionStates } from '../../../virtualmachines/volumes/volume-acti
})
export class ApplicationBaseClassComponent extends AbstractBaseClass {
/**
* If all Applications are loaded, important for the loader.
*
* @type {boolean}
*/
* If all Applications are loaded, important for the loader.
*
* @type {boolean}
*/
isLoaded: boolean = false;
FlavorTypeShortcuts: typeof FlavorTypeShortcuts = FlavorTypeShortcuts;

/**
* Selected Application.
*/
* Selected Application.
*/
selectedApplication: Application;

/**
* All available compute centers.
*
* @type {Array}
*/
* All available compute centers.
*
* @type {Array}
*/
computeCenters: ComputecenterComponent[] = [];

/**
* List of flavor types.
*/
* List of flavor types.
*/
typeList: FlavorType[];

/**
* Total number of cores.
*
* @type {number}
*/
* Total number of cores.
*
* @type {number}
*/
totalNumberOfCores: number = 0;
/**
* Total number of ram.
*
* @type {number}
*/
* Total number of ram.
*
* @type {number}
*/
totalRAM: number = 0;

/**
* Total number of GPUs
*/
* Total number of GPUs
*/
totalGPU: number = 0;

newFlavors: {
[id: string]: {
counter: number
flavor: Flavor
}
} = {};
[id: string]: {
counter: number
flavor: Flavor
}
} = {};

GPU_SHORTCUT = 'GPU';
HMF_SHORTCUT = 'HMF';

extension_request: boolean = false;

/**
* If shortname is valid.
*
* @type {boolean}
*/
* If shortname is valid.
*
* @type {boolean}
*/
public wronginput: boolean = false;
/**
*
*/
*
*/
constantStrings: Object;

/**
* List of flavors.
*/
* List of flavors.
*/
flavorList: Flavor[] = [];
extraResourceCommentRequired: boolean = false;

/**
* If all userApplications are loaded, important for the loader.
*
* @type {boolean}
*/
* If all userApplications are loaded, important for the loader.
*
* @type {boolean}
*/
isLoaded_userApplication: boolean = false;

public project_application_pi_approved: boolean = false;

/**
* Name of the project.
*/
* Name of the project.
*/
public projectName: string;

public project_application_report_allowed: boolean = false;

/**
* Applications of the user viewing the Application overview.
*
* @type {Array}
*/
* Applications of the user viewing the Application overview.
*
* @type {Array}
*/
user_applications: Application[] = [];

constructor(
protected userService: UserService,
protected applicationsService: ApplicationsService,
protected facilityService: FacilityService,
private cdRef: ChangeDetectorRef,
protected userService: UserService,
protected applicationsService: ApplicationsService,
protected facilityService: FacilityService,
private cdRef: ChangeDetectorRef,
) {
super();
}

/**
* Gets all available compute centers and saves them in the computeCenters attribute.
*/
* Gets all available compute centers and saves them in the computeCenters attribute.
*/
getComputeCenters(): void {
this.facilityService.getComputeCenters().subscribe((result: [{ [key: string]: string }]): void => {
for (const cc of result) {
Expand Down Expand Up @@ -162,8 +161,8 @@ export class ApplicationBaseClassComponent extends AbstractBaseClass {

if (
(entry?.flavor?.type?.shortcut.toUpperCase() === this.GPU_SHORTCUT
|| entry?.flavor?.type?.shortcut.toUpperCase() === this.HMF_SHORTCUT)
&& entry.counter > 0
|| entry?.flavor?.type?.shortcut.toUpperCase() === this.HMF_SHORTCUT)
&& entry.counter > 0
) {
this.extraResourceCommentRequired = true;
this.cdRef.detectChanges();
Expand All @@ -189,11 +188,11 @@ export class ApplicationBaseClassComponent extends AbstractBaseClass {
}

/**
* Get details of member like name and email by elixir.
*
* @param application
* @param collapse_id
*/
* Get details of member like name and email by elixir.
*
* @param application
* @param collapse_id
*/
public getMemberDetailsByElixirIdIfCollapsed(application: Application, collapse_id: string): void {
if (!this.getCollapseStatus(collapse_id)) {
this.getMemberDetailsByElixirId(application);
Expand All @@ -214,11 +213,11 @@ export class ApplicationBaseClassComponent extends AbstractBaseClass {
}

/**
* Get status name by status id.
*
* @param id
* @returns
*/
* Get status name by status id.
*
* @param id
* @returns
*/
public getStatusById(id: number): string {
const dummy: string = 'Unknown';
if (Application_States_Strings[Application_States[id]]) {
Expand All @@ -229,20 +228,20 @@ export class ApplicationBaseClassComponent extends AbstractBaseClass {
}

/**
* Sets the selected application.
*
* @param application
*/
* Sets the selected application.
*
* @param application
*/
setSelectedApplication(application: Application): void {
this.selectedApplication = application;
}

/**
* Uses the param types to safe the available FlavorTypes to the array typeList.
* Also it fills the array collapseList with booleans of value 'false' so all flavor-categories are shown in the application form.
*
* @param types array of all available FlavorTypes
*/
* Uses the param types to safe the available FlavorTypes to the array typeList.
* Also it fills the array collapseList with booleans of value 'false' so all flavor-categories are shown in the application form.
*
* @param types array of all available FlavorTypes
*/
setListOfTypes(types: FlavorType[]): void {
let index: number = -1;
for (let i: number = 0; i < types.length; i += 1) {
Expand All @@ -261,17 +260,17 @@ export class ApplicationBaseClassComponent extends AbstractBaseClass {
}

/**
* Check if short name is valid.
*
* @param shortname
*/
* Check if short name is valid.
*
* @param shortname
*/
public checkShortname(shortname: string): void {
this.wronginput = !/^[a-zA-Z0-9\s]*$/.test(shortname);
}

/**
* Fills the array constantStrings with values dependent of keys which are used to indicate inputs from the application-form
*/
* Fills the array constantStrings with values dependent of keys which are used to indicate inputs from the application-form
*/
generateConstants(): void {
this.constantStrings = [];
this.constantStrings['project_application_shortname'] = 'Shortname: ';
Expand Down Expand Up @@ -308,13 +307,13 @@ export class ApplicationBaseClassComponent extends AbstractBaseClass {
}

/**
* This function concatenates a given key combined with a given value to a string
* which is used on the confirmation-modal.
*
* @param key the key to access a string in the array constantStrings
* @param val the value that is concatenated with the string from the array and an optional addition (depending on the key)
* @returns the concatenated string for the confirmation-modal
*/
* This function concatenates a given key combined with a given value to a string
* which is used on the confirmation-modal.
*
* @param key the key to access a string in the array constantStrings
* @param val the value that is concatenated with the string from the array and an optional addition (depending on the key)
* @returns the concatenated string for the confirmation-modal
*/
matchString(key: string, val: string): string {
if (key in this.constantStrings) {
switch (key) {
Expand Down
26 changes: 26 additions & 0 deletions src/app/vo_manager/clients/client-limit.model.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
export class ClientLimit {
maxVolumes: number = 0;
assignedVolumes: number = 0;
currentUsedVolumes: number = 0;
newVolumes: number = 0;

maxVMs: number = 0;
assignedVMs: number = 0;
currentUsedVms: number = 0;
newVms: number = 0;

maxVolumeLimit: number = 0;
currentUsedVolumeStorage: number = 0;
assignedVolumesStorage: number = 0;
newVolumeLimit: number = 0;

maxCores: number = 0;
assignedCores: number = 0;
currentUsedCores: number = 0;
newCores: number = 0;

maxRam: number = 0;
assignedRam: number = 0;
currentUsedRam: number = 0;
newRam: number = 0;
}
Loading

0 comments on commit a17e2b1

Please sign in to comment.