From 07741cd9fa0240cf6a716aa387faa6ed4fea1136 Mon Sep 17 00:00:00 2001 From: Manuel Aranda Date: Thu, 7 May 2026 22:21:21 +0200 Subject: [PATCH] Fixed partition assistant --- .../create-task-script.component.css | 5 +++++ .../create-task-script.component.html | 19 +++++++++++++++++-- .../create-task-script.component.ts | 12 +++++++++++- .../partition-assistant.component.html | 10 +++++----- .../partition-assistant.component.ts | 11 +++++++++-- 5 files changed, 47 insertions(+), 10 deletions(-) diff --git a/ogWebconsole/src/app/components/commands/commands-task/create-task-script/create-task-script.component.css b/ogWebconsole/src/app/components/commands/commands-task/create-task-script/create-task-script.component.css index 8ab6216..f91ccfb 100644 --- a/ogWebconsole/src/app/components/commands/commands-task/create-task-script/create-task-script.component.css +++ b/ogWebconsole/src/app/components/commands/commands-task/create-task-script/create-task-script.component.css @@ -258,6 +258,11 @@ width: 100%; } +.half-width { + width: calc(50% - 8px); + margin-right: 8px; +} + .radio-row { display: flex; gap: 24px; diff --git a/ogWebconsole/src/app/components/commands/commands-task/create-task-script/create-task-script.component.html b/ogWebconsole/src/app/components/commands/commands-task/create-task-script/create-task-script.component.html index 2bf3038..0c0897e 100644 --- a/ogWebconsole/src/app/components/commands/commands-task/create-task-script/create-task-script.component.html +++ b/ogWebconsole/src/app/components/commands/commands-task/create-task-script/create-task-script.component.html @@ -104,8 +104,8 @@ - -
+
{{ getSelectedActionIcon() }} @@ -113,6 +113,21 @@
+ +
+
+ login +
+ + {{ 'labelDisk' | translate }} + + + + {{ 'partition' | translate }} + + +
+
diff --git a/ogWebconsole/src/app/components/commands/commands-task/create-task-script/create-task-script.component.ts b/ogWebconsole/src/app/components/commands/commands-task/create-task-script/create-task-script.component.ts index 77cb78e..959c979 100644 --- a/ogWebconsole/src/app/components/commands/commands-task/create-task-script/create-task-script.component.ts +++ b/ogWebconsole/src/app/components/commands/commands-task/create-task-script/create-task-script.component.ts @@ -50,6 +50,8 @@ export class CreateTaskScriptComponent implements OnInit { selectedCategory: string = ''; selectedAction: string = ''; + loginDisk: number = 1; + loginPartition: number = 1; categories: ActionCategory[] = [ { @@ -238,11 +240,15 @@ export class CreateTaskScriptComponent implements OnInit { case 'power-on': case 'shutdown': case 'reboot': - case 'login': type = this.selectedAction; content = this.selectedAction; break; + case 'login': + type = 'login'; + content = 'login'; + break; + default: this.toastService.error(this.translate.instant('unrecognizedActionType')); return; @@ -255,6 +261,10 @@ export class CreateTaskScriptComponent implements OnInit { type: type, }; + if (this.selectedAction === 'login') { + payload.parameters = { disk: this.loginDisk, partition: this.loginPartition }; + } + this.http.post(`${this.baseUrl}/command-task-scripts`, payload).subscribe({ next: () => { this.toastService.success(this.translate.instant('actionAddedSuccess')); diff --git a/ogWebconsole/src/app/components/groups/components/client-main-view/partition-assistant/partition-assistant.component.html b/ogWebconsole/src/app/components/groups/components/client-main-view/partition-assistant/partition-assistant.component.html index 3e0dd5e..2aee91a 100644 --- a/ogWebconsole/src/app/components/groups/components/client-main-view/partition-assistant/partition-assistant.component.html +++ b/ogWebconsole/src/app/components/groups/components/client-main-view/partition-assistant/partition-assistant.component.html @@ -154,9 +154,9 @@ - @@ -201,11 +201,11 @@ - └ + └ {{ partition.partitionNumber }} diff --git a/ogWebconsole/src/app/components/groups/components/client-main-view/partition-assistant/partition-assistant.component.ts b/ogWebconsole/src/app/components/groups/components/client-main-view/partition-assistant/partition-assistant.component.ts index 2786d6e..97adcac 100644 --- a/ogWebconsole/src/app/components/groups/components/client-main-view/partition-assistant/partition-assistant.component.ts +++ b/ogWebconsole/src/app/components/groups/components/client-main-view/partition-assistant/partition-assistant.component.ts @@ -387,12 +387,15 @@ export class PartitionAssistantComponent implements OnInit, AfterViewInit, OnDes } const activePrimary = disk.partitions.filter(p => !p.removed && p.partitionNumber < 5); - if (activePrimary.length >= 4) { + if (this.partitionCode !== 'GPT' && activePrimary.length >= 4) { this.toastService.error('No se pueden añadir más de 4 particiones primarias'); return; } - const maxPrimary = activePrimary.length > 0 ? Math.max(...activePrimary.map(p => p.partitionNumber)) : 0; + const allActive = disk.partitions.filter(p => !p.removed); + const maxPrimary = this.partitionCode === 'GPT' + ? (allActive.length > 0 ? Math.max(...allActive.map(p => p.partitionNumber)) : 0) + : (activePrimary.length > 0 ? Math.max(...activePrimary.map(p => p.partitionNumber)) : 0); const newNumber = maxPrimary + 1; const isUEFI = this.selectedModelClient?.firmwareType === 'UEFI'; @@ -934,6 +937,7 @@ export class PartitionAssistantComponent implements OnInit, AfterViewInit, OnDes } isLogicalPartition(partitions: Partition[], currentIndex: number): boolean { + if (this.partitionCode === 'GPT') return false; return partitions[currentIndex]?.partitionNumber >= 5; } @@ -951,6 +955,9 @@ export class PartitionAssistantComponent implements OnInit, AfterViewInit, OnDes if (!this.selectedDisk) return []; const sortByNumber = (a: Partition, b: Partition) => a.partitionNumber - b.partitionNumber; const active: Partition[] = this.selectedDisk.partitions.filter((p: Partition) => !p.removed); + if (this.partitionCode === 'GPT') { + return active.sort(sortByNumber); + } const primaries = active.filter((p: Partition) => p.partitionNumber < 5).sort(sortByNumber); const logicals = active.filter((p: Partition) => p.partitionNumber >= 5).sort(sortByNumber); const result: Partition[] = [];