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 240771b..3e0dd5e 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
@@ -147,8 +147,21 @@
-
+
+
+
+
+
+
+
@@ -186,19 +199,18 @@
-
-
+
= 5
}">
|
- └
+ = 5" class="logical-indent">└
{{ partition.partitionNumber }}
|
@@ -213,12 +225,12 @@
|
+ (input)="updatePartitionSize(selectedDisk.diskNumber, partition, partition.size)" />
|
+ (input)="updatePartitionSizeFromPercentage(selectedDisk.diskNumber, partition, partition.percentage)" />
|
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 bc955b0..b9e5db1 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
@@ -374,56 +374,90 @@ export class PartitionAssistantComponent implements OnInit, AfterViewInit, OnDes
}
addPartition(diskNumber: number) {
- const disk = this.disks.find((d) => d.diskNumber === diskNumber);
-
- if (disk) {
- const remainingGB = this.getRemainingGB(disk.partitions, disk.totalDiskSize);
-
- if (remainingGB > 0) {
- const removedPartitions = disk.partitions.filter((p) => !p.removed);
- const maxPartitionNumber =
- removedPartitions.length > 0 ? Math.max(...removedPartitions.map((p) => p.partitionNumber)) : 0;
- const newPartitionNumber = maxPartitionNumber + 1;
-
- // Verificar si es UEFI y es la primera partición
- const isUEFI = this.selectedModelClient?.firmwareType === 'UEFI';
- const isFirstPartition = removedPartitions.length === 0;
- const isFirstDisk = diskNumber === 1;
-
- // Si es UEFI, primera partición y primer disco, crear partición EFI
- const shouldCreateEFI = isUEFI && isFirstPartition && isFirstDisk;
-
- disk.partitions.push({
- partitionNumber: newPartitionNumber,
- size: shouldCreateEFI ? 512 : 0,
- partitionCode: shouldCreateEFI ? 'EFI' : 'EMPTY',
- filesystem: shouldCreateEFI ? 'FAT32' : 'EXT4',
- memoryUsage: 0,
- sizeBytes: shouldCreateEFI ? 512 : 0,
- format: false,
- color: this.getNextPartitionColor(),
- percentage: 0,
- removed: false
- });
- this.updatePartitionPercentages(disk.partitions, disk.totalDiskSize);
- this.updateDiskChart(disk);
-
- this.resetValidationStatus();
- this.validationSubject.next();
-
- setTimeout(() => {
- this.resizeChart();
- }, 100);
- } else {
- this.toastService.error(this.translate.instant('notEnoughFreeSpace'));
- }
- }
+ this.addPrimaryPartition(diskNumber);
}
- updatePartitionSize(diskNumber: number, index: number, size: number) {
+ addPrimaryPartition(diskNumber: number): void {
+ const disk = this.disks.find(d => d.diskNumber === diskNumber);
+ if (!disk) return;
+
+ const remainingGB = this.getRemainingGB(disk.partitions, disk.totalDiskSize);
+ if (remainingGB <= 0) {
+ this.toastService.error(this.translate.instant('notEnoughFreeSpace'));
+ return;
+ }
+
+ const activePrimary = disk.partitions.filter(p => !p.removed && p.partitionNumber < 5);
+ if (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 newNumber = maxPrimary + 1;
+
+ const isUEFI = this.selectedModelClient?.firmwareType === 'UEFI';
+ const isFirstPartition = disk.partitions.filter(p => !p.removed).length === 0;
+ const isFirstDisk = diskNumber === 1;
+ const shouldCreateEFI = isUEFI && isFirstPartition && isFirstDisk;
+
+ disk.partitions.push({
+ partitionNumber: newNumber,
+ size: shouldCreateEFI ? 512 : 0,
+ partitionCode: shouldCreateEFI ? 'EFI' : 'EMPTY',
+ filesystem: shouldCreateEFI ? 'FAT32' : 'EXT4',
+ memoryUsage: 0,
+ sizeBytes: shouldCreateEFI ? 512 : 0,
+ format: false,
+ color: this.getNextPartitionColor(),
+ percentage: 0,
+ removed: false
+ });
+
+ this.updatePartitionPercentages(disk.partitions, disk.totalDiskSize);
+ this.updateDiskChart(disk);
+ this.resetValidationStatus();
+ this.validationSubject.next();
+ setTimeout(() => this.resizeChart(), 100);
+ }
+
+ addLogicalPartition(diskNumber: number): void {
+ const disk = this.disks.find(d => d.diskNumber === diskNumber);
+ if (!disk) return;
+
+ const remainingGB = this.getRemainingGB(disk.partitions, disk.totalDiskSize);
+ if (remainingGB <= 0) {
+ this.toastService.error(this.translate.instant('notEnoughFreeSpace'));
+ return;
+ }
+
+ const activeLogical = disk.partitions.filter(p => !p.removed && p.partitionNumber >= 5);
+ const maxLogical = activeLogical.length > 0 ? Math.max(...activeLogical.map(p => p.partitionNumber)) : 4;
+ const newNumber = maxLogical + 1;
+
+ disk.partitions.push({
+ partitionNumber: newNumber,
+ size: 0,
+ partitionCode: 'EMPTY',
+ filesystem: 'EXT4',
+ memoryUsage: 0,
+ sizeBytes: 0,
+ format: false,
+ color: this.getNextPartitionColor(),
+ percentage: 0,
+ removed: false
+ });
+
+ this.updatePartitionPercentages(disk.partitions, disk.totalDiskSize);
+ this.updateDiskChart(disk);
+ this.resetValidationStatus();
+ this.validationSubject.next();
+ setTimeout(() => this.resizeChart(), 100);
+ }
+
+ updatePartitionSize(diskNumber: number, partition: Partition, size: number) {
const disk = this.disks.find((d) => d.diskNumber === diskNumber);
if (disk) {
- const partition = disk.partitions[index];
const remainingGB = this.getRemainingGB(disk.partitions, disk.totalDiskSize) + partition.size;
if (partition) {
partition.percentage = Number(((size / disk.totalDiskSize) * 100).toFixed(2));
@@ -549,10 +583,9 @@ export class PartitionAssistantComponent implements OnInit, AfterViewInit, OnDes
}
}
- updatePartitionSizeFromPercentage(diskNumber: number, partitionIndex: number, percentage: number): void {
+ updatePartitionSizeFromPercentage(diskNumber: number, partition: Partition, percentage: number): void {
const disk = this.disks.find(d => d.diskNumber === diskNumber);
if (disk) {
- const partition = disk.partitions[partitionIndex];
if (partition) {
partition.size = (disk.totalDiskSize * percentage) / 100;
}
@@ -901,11 +934,31 @@ export class PartitionAssistantComponent implements OnInit, AfterViewInit, OnDes
}
isLogicalPartition(partitions: Partition[], currentIndex: number): boolean {
- for (let i = 0; i < currentIndex; i++) {
- if (!partitions[i].removed && partitions[i].partitionCode === 'EXTENDED') {
- return true;
+ return partitions[currentIndex]?.partitionNumber >= 5;
+ }
+
+ getAvailablePartitionTypes(partition: Partition) {
+ const hasExtended = this.selectedDisk?.partitions.some(
+ (p: Partition) => !p.removed && p.partitionCode === 'EXTENDED' && p !== partition
+ );
+ return hasExtended
+ ? this.partitionTypes.filter((t: any) => t.name !== 'EXTENDED')
+ : this.partitionTypes;
+ }
+
+ get orderedPartitions(): Partition[] {
+ 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);
+ 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[] = [];
+ for (const p of primaries) {
+ result.push(p);
+ if (p.partitionCode === 'EXTENDED') {
+ result.push(...logicals);
}
}
- return false;
+ return result;
}
}
diff --git a/ogWebconsole/src/app/components/groups/groups.component.html b/ogWebconsole/src/app/components/groups/groups.component.html
index 7102ce4..8cf3c89 100644
--- a/ogWebconsole/src/app/components/groups/groups.component.html
+++ b/ogWebconsole/src/app/components/groups/groups.component.html
@@ -322,9 +322,9 @@
diff --git a/ogWebconsole/src/app/components/groups/groups.component.ts b/ogWebconsole/src/app/components/groups/groups.component.ts
index 8ae2cc6..75f61a5 100644
--- a/ogWebconsole/src/app/components/groups/groups.component.ts
+++ b/ogWebconsole/src/app/components/groups/groups.component.ts
@@ -319,6 +319,7 @@ export class GroupsComponent implements OnInit, OnDestroy {
name: node.name,
type: node.type,
'@id': node['@id'],
+ remotePc: node.remotePc,
children: children,
hasClients: hasClients,
};
diff --git a/ogWebconsole/src/app/components/groups/model/model.ts b/ogWebconsole/src/app/components/groups/model/model.ts
index d12df49..ec6c71f 100644
--- a/ogWebconsole/src/app/components/groups/model/model.ts
+++ b/ogWebconsole/src/app/components/groups/model/model.ts
@@ -14,6 +14,7 @@ export interface UnidadOrganizativa {
name: string;
type: string;
'@id': string;
+ remotePc?: boolean;
clients?: Client[];
children?: UnidadOrganizativa[];
parent?: UnidadOrganizativa;
@@ -68,6 +69,7 @@ export interface TreeNode {
name: string;
type: string;
'@id'?: string;
+ remotePc?: boolean;
children?: TreeNode[];
hasClients?: boolean;
clients?: Client[];
|