From f91add6ce1d3a2aa2368eec79d0a56ca967a5fd1 Mon Sep 17 00:00:00 2001 From: Viktor Rudko <43116821+vktrrdk@users.noreply.github.com> Date: Tue, 9 Jan 2024 15:42:12 +0100 Subject: [PATCH 1/2] =?UTF-8?q?feat(Virtual=20Machine):=20Add=20informatio?= =?UTF-8?q?n=20confirmation=20date=20and=20responsi=E2=80=A6=20(#5987)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat(Virtual Machine): Add information confirmation date and responsible person * adjusted * further work * adjustments * removed unneccessary this --------- Co-authored-by: denbicloud <46009071+denbicloud@users.noreply.github.com> --- .../api-connector/virtualmachine.service.ts | 2 +- .../virtualmachinemodels/virtualmachine.ts | 3 + .../virtualmachineinfo.component.html | 36 +++++++++++- .../virtualmachineinfo.component.ts | 55 +++++++++++++++++-- .../vmdetail/vmdetail.component.ts | 5 +- 5 files changed, 93 insertions(+), 8 deletions(-) diff --git a/src/app/api-connector/virtualmachine.service.ts b/src/app/api-connector/virtualmachine.service.ts index a6d8b8e71b..1be56155dd 100644 --- a/src/app/api-connector/virtualmachine.service.ts +++ b/src/app/api-connector/virtualmachine.service.ts @@ -402,7 +402,7 @@ export class VirtualmachineService { } setVmNeeded(openstack_id: string): Observable { - return this.http.post(`${this.baseVmUrl}${openstack_id}/need/`, null, { + return this.http.post(`${this.baseVmUrl}${openstack_id}/need/`, { withCredentials: true, }); } diff --git a/src/app/virtualmachines/virtualmachinemodels/virtualmachine.ts b/src/app/virtualmachines/virtualmachinemodels/virtualmachine.ts index f69ba22a4b..a489241fd8 100644 --- a/src/app/virtualmachines/virtualmachinemodels/virtualmachine.ts +++ b/src/app/virtualmachines/virtualmachinemodels/virtualmachine.ts @@ -22,6 +22,7 @@ export class VirtualMachine { created_at_date: string; deleted_at_date: string; still_used_confirmation_requested_date: Date; + still_used_confirmed_user_id: string; stopped_at: string; elixir_id: string; fixed_ip: string; @@ -45,6 +46,8 @@ export class VirtualMachine { days_running: number; backend: Backend; conda_packages: CondaPackage[] = []; + still_used_confirmed_date: Date; + // still used confirmed date missing in webapp! migrate_project_to_simple_vm: boolean = false; project_is_migrated_to_simple_vm: boolean = false; diff --git a/src/app/virtualmachines/vmdetail/virtualmachineinfo/virtualmachineinfo.component.html b/src/app/virtualmachines/vmdetail/virtualmachineinfo/virtualmachineinfo.component.html index 4ce3f08dea..376c631140 100644 --- a/src/app/virtualmachines/vmdetail/virtualmachineinfo/virtualmachineinfo.component.html +++ b/src/app/virtualmachines/vmdetail/virtualmachineinfo/virtualmachineinfo.component.html @@ -28,7 +28,7 @@
Deleted at (d-m-y)
- {{ virtualMachine.deleted_at_date | date : 'dd-MM-yyyy' }} + {{ virtualMachine.deleted_at_date | date: 'dd-MM-yyyy' }}
@@ -53,6 +53,40 @@ +
+
+
+ Usage confirmation requested at (d-m-y)
+ {{ + virtualMachine.still_used_confirmation_requested_date | date: 'dd-MM-yyyy' + }} +
+
+ +
+
+ Usage confirmed at (d-m-y)
+ {{ virtualMachine.still_used_confirmed_date | date: 'dd-MM-yyyy' }} +
+
+
+
+ Usage confirmed by {{ virtualMachine.still_used_confirmed_user_id }}
+ {{ this.userSurname }}, {{ this.userName }} +
+
+
+ +
+
+ Usage confirmed at (d-m-y)
+ Usage not confirmed yet! +
+
+
+
+
diff --git a/src/app/virtualmachines/vmdetail/virtualmachineinfo/virtualmachineinfo.component.ts b/src/app/virtualmachines/vmdetail/virtualmachineinfo/virtualmachineinfo.component.ts index 0ec2a5b3ce..83ff113828 100644 --- a/src/app/virtualmachines/vmdetail/virtualmachineinfo/virtualmachineinfo.component.ts +++ b/src/app/virtualmachines/vmdetail/virtualmachineinfo/virtualmachineinfo.component.ts @@ -1,4 +1,7 @@ -import { ChangeDetectionStrategy, Component, Input } from '@angular/core'; +import { + Component, Input, OnChanges, SimpleChanges, OnInit, ChangeDetectorRef, +} from '@angular/core'; +import { UserService } from 'app/api-connector/user.service'; import { VirtualMachineStates } from '../../virtualmachinemodels/virtualmachinestates'; import { VirtualMachine } from '../../virtualmachinemodels/virtualmachine'; @@ -8,11 +11,53 @@ import { VirtualMachine } from '../../virtualmachinemodels/virtualmachine'; @Component({ selector: 'app-virtualmachineinfo', templateUrl: './virtualmachineinfo.component.html', - changeDetection: ChangeDetectionStrategy.OnPush, styleUrls: ['./virtualmachineinfo.component.scss'], + + providers: [UserService], }) -export class VirtualmachineinfoComponent { +export class VirtualmachineinfoComponent implements OnChanges, OnInit { VirtualMachineStates: VirtualMachineStates = new VirtualMachineStates(); - @Input() virtualMachine: VirtualMachine; - @Input() cluster_machine: boolean = false; + @Input() virtualMachine: VirtualMachine; + @Input() cluster_machine: boolean = false; + + userName: string = ''; + userSurname: string = ''; + + constructor( + private userService: UserService, + private changeDetectorRef: ChangeDetectorRef, + ) { + this.userService = userService; + this.changeDetectorRef = changeDetectorRef; + } + + ngOnInit(): void { + if (this.virtualMachine) { + if (this.virtualMachine.still_used_confirmed_user_id) { + this.userService + .getMemberDetailsByElixirId(this.virtualMachine.still_used_confirmed_user_id) + .subscribe((result: any) => { + this.userName = result['firstName']; + this.userSurname = result['lastName']; + this.changeDetectorRef.detectChanges(); + }); + } + } + } + + ngOnChanges(changes: SimpleChanges): void { + const { changedVM } = changes; + console.log(changedVM); + if (changedVM) { + if (changedVM['virtualMachine']['currentValue']['still_used_confirmed_user_id']) { + this.userService + .getMemberDetailsByElixirId(this.virtualMachine.still_used_confirmed_user_id) + .subscribe((result: any) => { + this.userName = result['firstName']; + this.userSurname = result['lastName']; + this.changeDetectorRef.detectChanges(); + }); + } + } + } } diff --git a/src/app/virtualmachines/vmdetail/vmdetail.component.ts b/src/app/virtualmachines/vmdetail/vmdetail.component.ts index 669dcb6832..02e085dc0e 100644 --- a/src/app/virtualmachines/vmdetail/vmdetail.component.ts +++ b/src/app/virtualmachines/vmdetail/vmdetail.component.ts @@ -1,4 +1,4 @@ -import { Component, OnInit } from '@angular/core'; +import { Component, OnInit, ChangeDetectorRef } from '@angular/core'; import { ActivatedRoute, Router } from '@angular/router'; import { Subject, Subscription } from 'rxjs'; import { debounceTime, distinctUntilChanged } from 'rxjs/operators'; @@ -177,6 +177,7 @@ export class VmDetailComponent extends AbstractBaseClass implements OnInit { private biocondaService: BiocondaService, private clipboardService: ClipboardService, private groupService: GroupService, + private cdr: ChangeDetectorRef, ) { super(); } @@ -242,6 +243,8 @@ export class VmDetailComponent extends AbstractBaseClass implements OnInit { this.virtualmachineService.setVmNeeded(this.virtualMachine.openstackid).subscribe((res: any): void => { if (res['still_needed']) { this.virtualMachine.still_used_confirmation_requested = false; + this.virtualMachine.still_used_confirmed_date = new Date(); + this.cdr.detectChanges(); } }); } From 12bfce9a831ecee12b25c95a5841800e4e9ea311 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 11 Jan 2024 02:03:06 +0000 Subject: [PATCH 2/2] feat(Dependencies): Update dependency follow-redirects to v1.15.4 [SECURITY] | datasource | package | from | to | | ---------- | ---------------- | ------ | ------ | | npm | follow-redirects | 1.15.3 | 1.15.4 | --- package-lock.json | 18 +++++++++--------- package.json | 4 ++-- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/package-lock.json b/package-lock.json index 58daeb7e8b..0ab39e82a5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@denbi/cloud-portal-webapp", - "version": "4.807.0", + "version": "4.808.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@denbi/cloud-portal-webapp", - "version": "4.807.0", + "version": "4.808.0", "dependencies": { "@angular-eslint/eslint-plugin": "^16.0.3", "@angular/animations": "16.2.12", @@ -42,7 +42,7 @@ "d3": "7.8.5", "export-to-csv": "1.2.1", "file-saver": "2.0.5", - "follow-redirects": "1.15.3", + "follow-redirects": "1.15.4", "html2canvas": "1.4.1", "is-promise": "4.0.0", "jsnlog": "2.30.0", @@ -11253,9 +11253,9 @@ "license": "ISC" }, "node_modules/follow-redirects": { - "version": "1.15.3", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.3.tgz", - "integrity": "sha512-1VzOtuEM8pC9SFU1E+8KfTjZyMztRsgEfwQl44z8A25uy13jSzTj6dyK2Df52iV0vgHCfBwLhDWevLn95w5v6Q==", + "version": "1.15.4", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.4.tgz", + "integrity": "sha512-Cr4D/5wlrb0z9dgERpUL3LrmPKVDsETIJhaCMeDfuFYcqa5bldGV6wBsAN6X/vxlXQtFBMrXdXxdL8CbDTGniw==", "funding": [ { "type": "individual", @@ -28672,9 +28672,9 @@ "dev": true }, "follow-redirects": { - "version": "1.15.3", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.3.tgz", - "integrity": "sha512-1VzOtuEM8pC9SFU1E+8KfTjZyMztRsgEfwQl44z8A25uy13jSzTj6dyK2Df52iV0vgHCfBwLhDWevLn95w5v6Q==" + "version": "1.15.4", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.4.tgz", + "integrity": "sha512-Cr4D/5wlrb0z9dgERpUL3LrmPKVDsETIJhaCMeDfuFYcqa5bldGV6wBsAN6X/vxlXQtFBMrXdXxdL8CbDTGniw==" }, "font-family-papandreou": { "version": "0.2.0-patch2" diff --git a/package.json b/package.json index a4a27f1d97..fd17418d6d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@denbi/cloud-portal-webapp", - "version": "4.807.0", + "version": "4.808.0", "description": "de.NBI Cloud Portal", "scripts": { "ng": "ng serve", @@ -52,7 +52,7 @@ "d3": "7.8.5", "export-to-csv": "1.2.1", "file-saver": "2.0.5", - "follow-redirects": "1.15.3", + "follow-redirects": "1.15.4", "html2canvas": "1.4.1", "is-promise": "4.0.0", "jsnlog": "2.30.0",