diff --git a/ogWebconsole/src/app/components/groups/components/client-main-view/client-main-view.component.html b/ogWebconsole/src/app/components/groups/components/client-main-view/client-main-view.component.html
index 273c99e..699bfd9 100644
--- a/ogWebconsole/src/app/components/groups/components/client-main-view/client-main-view.component.html
+++ b/ogWebconsole/src/app/components/groups/components/client-main-view/client-main-view.component.html
@@ -66,5 +66,5 @@
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 2ef9ded..5040fd7 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
@@ -17,7 +17,7 @@ interface Partition {
})
export class PartitionAssistantComponent implements OnInit {
@Input() data: any;
- @Input() clientUuid: string | undefined; // El clientUuid que necesitas
+ @Input() clientUuid: string | undefined;
errorMessage = '';
originalPartitions: any[] = [];
@@ -33,7 +33,7 @@ export class PartitionAssistantComponent implements OnInit {
initializeDisks() {
const partitionsFromData = this.data.partitions;
- this.originalPartitions = JSON.parse(JSON.stringify(partitionsFromData)); // Guardar una copia de las particiones originales
+ this.originalPartitions = JSON.parse(JSON.stringify(partitionsFromData));
const disksMap = new Map();
@@ -48,7 +48,7 @@ export class PartitionAssistantComponent implements OnInit {
} else {
disk!.partitions.push({
size: this.convertBytesToGB(partition.size),
- type: 'NTFS', // Puedes cambiar el tipo según sea necesario
+ type: 'NTFS',
sizeBytes: partition.size,
format: false,
color: '#' + Math.floor(Math.random() * 16777215).toString(16),
@@ -77,7 +77,6 @@ export class PartitionAssistantComponent implements OnInit {
});
}
- // Añadir una nueva partición
addPartition(diskNumber: number) {
const disk = this.disks.find(d => d.diskNumber === diskNumber);
@@ -86,10 +85,10 @@ export class PartitionAssistantComponent implements OnInit {
if (remainingGB > 0) {
disk.partitions.push({
size: 0,
- type: 'NTFS', // Tipo por defecto, puede ser cambiado por el usuario
+ type: 'NTFS',
sizeBytes: 0,
format: false,
- color: '#' + Math.floor(Math.random() * 16777215).toString(16), // Color aleatorio
+ color: '#' + Math.floor(Math.random() * 16777215).toString(16),
percentage: 0
});
this.updatePartitionPercentages(disk.partitions, disk.totalDiskSize);
@@ -99,7 +98,6 @@ export class PartitionAssistantComponent implements OnInit {
}
}
- // Actualizar el tamaño de una partición
updatePartitionSize(diskNumber: number, index: number, size: number) {
const disk = this.disks.find(d => d.diskNumber === diskNumber);
if (disk) {
@@ -138,7 +136,7 @@ export class PartitionAssistantComponent implements OnInit {
p => p.diskNumber === disk.diskNumber && p.partitionNumber === index + 1
);
- // Si no existe en las originales, es nueva
+
if (!originalPartition) {
modifiedPartitions.push({ partition, diskNumber: disk.diskNumber, partitionNumber: index + 1 });
} else if (this.isPartitionModified(originalPartition, partition)) {
@@ -178,7 +176,6 @@ export class PartitionAssistantComponent implements OnInit {
});
}
- // Eliminar partición de un disco
removePartition(diskNumber: number, index: number) {
const disk = this.disks.find(d => d.diskNumber === diskNumber);
diff --git a/ogWebconsole/src/app/components/groups/components/client-main-view/restore-image/restore-image.component.css b/ogWebconsole/src/app/components/groups/components/client-main-view/restore-image/restore-image.component.css
index e69de29..ad6b310 100644
--- a/ogWebconsole/src/app/components/groups/components/client-main-view/restore-image/restore-image.component.css
+++ b/ogWebconsole/src/app/components/groups/components/client-main-view/restore-image/restore-image.component.css
@@ -0,0 +1,71 @@
+.partition-assistant {
+ font-family: 'Roboto', sans-serif;
+ background-color: #f9f9f9;
+ padding: 20px;
+ border-radius: 10px;
+ box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
+ margin: 20px auto;
+ }
+
+ .header {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ margin-bottom: 15px;
+ padding: 10px;
+ background-color: #fff;
+ border-radius: 8px;
+ box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
+ }
+
+ .partition-table {
+ width: 100%;
+ border-collapse: collapse;
+ background-color: #fff;
+ border-radius: 8px;
+ box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
+ overflow: hidden;
+ margin-bottom: 20px;
+ }
+
+ .partition-table th {
+ background-color: #f5f5f5;
+ color: #333;
+ padding: 12px;
+ font-weight: 600;
+ }
+
+ .partition-table td {
+ padding: 10px;
+ text-align: center;
+ border-bottom: 1px solid #eee;
+ }
+
+ .partition-table select {
+ padding: 5px;
+ border-radius: 4px;
+ border: 1px solid #ccc;
+ width: 100%;
+ }
+
+ .actions {
+ display: flex;
+ justify-content: flex-end;
+ padding-top: 10px;
+ }
+
+ button.mat-flat-button {
+ background-color: #28a745;
+ color: white;
+ padding: 10px 20px;
+ border-radius: 4px;
+ font-size: 1rem;
+ font-weight: 500;
+ cursor: pointer;
+ transition: background-color 0.3s ease;
+ }
+
+ button.mat-flat-button:hover {
+ background-color: #218838;
+ }
+
\ No newline at end of file
diff --git a/ogWebconsole/src/app/components/groups/components/client-main-view/restore-image/restore-image.component.html b/ogWebconsole/src/app/components/groups/components/client-main-view/restore-image/restore-image.component.html
index 8351543..373f3b7 100644
--- a/ogWebconsole/src/app/components/groups/components/client-main-view/restore-image/restore-image.component.html
+++ b/ogWebconsole/src/app/components/groups/components/client-main-view/restore-image/restore-image.component.html
@@ -1 +1,37 @@
-restore-image works!
+
+
+
+
+
+
+ Partición |
+ Imagen ISO |
+ OgLive |
+
+
+
+
+ {{ partition.partitionNumber }} |
+
+
+ |
+
+
+ |
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ogWebconsole/src/app/components/groups/components/client-main-view/restore-image/restore-image.component.ts b/ogWebconsole/src/app/components/groups/components/client-main-view/restore-image/restore-image.component.ts
index 46f1874..2f4ef5d 100644
--- a/ogWebconsole/src/app/components/groups/components/client-main-view/restore-image/restore-image.component.ts
+++ b/ogWebconsole/src/app/components/groups/components/client-main-view/restore-image/restore-image.component.ts
@@ -1,10 +1,68 @@
-import { Component } from '@angular/core';
+import { Component, Input, OnInit } from '@angular/core';
+
+interface Partition {
+ diskNumber: number;
+ partitionNumber: number;
+ associatedImage?: string;
+ associatedOgLive?: string;
+}
@Component({
selector: 'app-restore-image',
templateUrl: './restore-image.component.html',
- styleUrl: './restore-image.component.css'
+ styleUrls: ['./restore-image.component.css']
})
-export class RestoreImageComponent {
+export class RestoreImageComponent implements OnInit {
+ @Input() data: any;
+ disks: { diskNumber: number; partitions: Partition[] }[] = [];
+ availableImages: string[] = [];
+ availableOgLives: string[] = [];
+
+ ngOnInit(): void {
+ this.initializeDisks();
+ this.availableImages = ['Windows10.iso', 'Ubuntu.iso', 'macOS.iso'];
+ this.availableOgLives = ['LiveCD1', 'LiveCD2', 'LiveCD3'];
+ }
+
+ initializeDisks() {
+ const partitionsFromData = this.data.partitions;
+ const disksMap = new Map();
+
+ partitionsFromData.forEach((partition: any) => {
+ if (!disksMap.has(partition.diskNumber)) {
+ disksMap.set(partition.diskNumber, []);
+ }
+
+ disksMap.get(partition.diskNumber)!.push({
+ diskNumber: partition.diskNumber,
+ partitionNumber: partition.partitionNumber
+ });
+ });
+
+ disksMap.forEach((partitions, diskNumber) => {
+ this.disks.push({ diskNumber, partitions });
+ });
+ }
+
+ onImageSelected(partition: Partition, event: Event) {
+ const selectElement = event.target as HTMLSelectElement;
+ partition.associatedImage = selectElement.value;
+ }
+
+ onOgLiveSelected(partition: Partition, event: Event) {
+ const selectElement = event.target as HTMLSelectElement;
+ partition.associatedOgLive = selectElement.value;
+ }
+
+ saveAssociations() {
+ this.disks.forEach(disk => {
+ disk.partitions.forEach(partition => {
+ if (partition.associatedImage || partition.associatedOgLive) {
+ console.log(`Guardando para disco ${partition.diskNumber}, partición ${partition.partitionNumber}, Imagen: ${partition.associatedImage}, OgLive: ${partition.associatedOgLive}`);
+
+ }
+ });
+ });
+ }
}