Skip to content

Commit

Permalink
Merge pull request #5944 from deNBI/feat/gpu_specification_facility
Browse files Browse the repository at this point in the history
feat(GPUSpecification):only facility which created it can alter it, a…
  • Loading branch information
dweinholz authored Nov 3, 2023
2 parents 0498757 + 09d5ee5 commit 8b42751
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 7 deletions.
2 changes: 2 additions & 0 deletions src/app/facility_manager/facilitymanager.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { BsDatepickerModule } from 'ngx-bootstrap/datepicker';
import { NgbPaginationModule, NgbTypeaheadModule } from '@ng-bootstrap/ng-bootstrap';
import { NgSelectModule } from '@ng-select/ng-select';
import { AlertComponent, BadgeComponent } from '@coreui/angular';
import { TooltipModule } from 'ngx-bootstrap/tooltip';
import { FacilityProjectsOverviewComponent } from '../facility_manager/facilityprojectsoverview.component';
import { ImageTagComponent } from '../facility_manager/imagetags.component';
import { FacilitymanagerRoutingModule } from './facilitymanager-routing.module';
Expand Down Expand Up @@ -46,6 +47,7 @@ import { SharedModuleModule } from '../shared/shared_modules/shared-module.modul
SharedModuleModule,
AlertComponent,
BadgeComponent,
TooltipModule,
],
declarations: [
FacilityProjectsOverviewComponent,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
<div class="card border-success" id="new_GPU_card" style="margin: 5px">
<div class="card-body">
<div class="alert alert-warning">
These specifications are global and can be used for all Facilities in their Machine definitions.
<br />However, an existing specification can only be modified by a manager of the facility that created it.
</div>

<h5 class="card-title">New GPU</h5>
<div class="row" [formGroup]="newGPUFormGroup">
<div class="col-2">
Expand Down Expand Up @@ -93,38 +98,44 @@ <h5 class="card-title">New GPU</h5>
id="{{ gpu?.id + '_card' }}"
*ngFor="let gpu of gpuSpecifications"
style="margin: 5px"
[ngClass]="this.gpuSpecificationUpdateList[gpu.id] ? 'border-warning' : 'border-primary'"
[ngClass]="gpuSpecificationUpdateList[gpu.id] ? 'border-warning' : 'border-primary'"
>
<div class="card-body">
<h5 class="card-title">{{ gpu?.type }}</h5>
<div class="row" [formGroup]="gpuFormGroups[gpu.id]">
<div class="col-2" style="margin: 5px">
<div class="text-muted"><small>Actions</small></div>
<div class="btn-group-vertical" role="group">
<div
class="btn-group-vertical"
role="group"
tooltip="Only an admin from the facility which created the specification can alter it"
>
<button
(click)="deleteGPUSpecification(gpu.id)"
class="btn btn-danger"
[disabled]="!gpu.is_changeable"
*ngIf="!this.gpuSpecificationUpdateList[gpu.id]"
>
Remove
</button>
<button
class="btn btn-warning"
(click)="changeGPUSpecificationToUpdate(gpu)"
*ngIf="!this.gpuSpecificationUpdateList[gpu.id]"
[disabled]="!gpu.is_changeable"
*ngIf="!gpuSpecificationUpdateList[gpu.id]"
>
Update
</button>
<button
(click)="updateGPUSpecification(gpu); changeGPUSpecificationToUpdate(gpu)"
class="btn btn-success"
*ngIf="this.gpuSpecificationUpdateList[gpu.id]"
*ngIf="gpuSpecificationUpdateList[gpu.id]"
>
Save
</button>
<button
class="btn btn-info"
*ngIf="this.gpuSpecificationUpdateList[gpu.id]"
*ngIf="gpuSpecificationUpdateList[gpu.id]"
(click)="reloadGPUSpecification(gpu); changeGPUSpecificationToUpdate(gpu)"
>
Cancel
Expand Down
3 changes: 2 additions & 1 deletion src/app/facility_manager/resources/gpu-specification.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
export class GPUSpecification {
id: string;
type: string = 'UNUSED';
is_changeable: boolean = false;
ram: number = 0;
cores: number = 0;

Expand All @@ -14,7 +15,7 @@ export class GPUSpecification {
this.type = gpuSpecification.type;
this.ram = gpuSpecification.ram;
this.cores = gpuSpecification.cores;
this.is_changeable = gpuSpecification.is_changeable;
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ export class ResourcemachineOverviewComponent implements OnInit {
);
} else {
const machine: ResourceMachine = this.resourceMachines.find(
(gpu: GPUSpecification): boolean => gpu.id === machine_id,
(res: ResourceMachine): boolean => res.id === machine_id,
);
const gpu_id: string = this.machinesFormGroups[machine_id].get(`${machine.id}_gpu_used_${slot}`).value;
machine.gpu_slots[slot] = this.gpu_types.find((gpu: GPUSpecification): boolean => gpu.id === gpu_id);
Expand Down

0 comments on commit 8b42751

Please sign in to comment.