(`${this.apiUrl}?page=1&itemsPerPage=100`).subscribe(
+ (data) => {
+ this.existingTasks = data['hydra:member'];
+ resolve();
+ },
+ (error) => {
+ this.toastr.error('Error al cargar las tareas existentes');
+ reject(error);
+ }
+ );
+ });
+ }
+
onScopeChange(scope: string): void {
this.filterUnits(scope).subscribe(filteredUnits => {
this.availableOrganizationalUnits = filteredUnits;
@@ -161,6 +181,27 @@ export class CreateTaskComponent implements OnInit {
});
}
+ addToExistingTask() {
+ if (!this.selectedExistingTask) {
+ this.toastr.error('Debes seleccionar una tarea existente.');
+ return;
+ }
+
+ if (this.executionOrder == null || this.executionOrder < 1) {
+ this.toastr.error('Debes introducir un orden de ejecución válido (mayor que 0).');
+ return;
+ }
+
+ const data = {
+ taskId: this.selectedExistingTask,
+ executionOrder: this.executionOrder
+ };
+
+ this.toastr.success('Tarea actualizada con éxito');
+ this.dialogRef.close(data);
+ }
+
+
saveTask(): void {
if (this.taskForm.invalid) {
this.toastr.error('Por favor, rellene todos los campos obligatorios');
diff --git a/ogWebconsole/src/app/components/groups/components/client-main-view/deploy-image/deploy-image.component.html b/ogWebconsole/src/app/components/groups/components/client-main-view/deploy-image/deploy-image.component.html
index f01022a..9780df4 100644
--- a/ogWebconsole/src/app/components/groups/components/client-main-view/deploy-image/deploy-image.component.html
+++ b/ogWebconsole/src/app/components/groups/components/client-main-view/deploy-image/deploy-image.component.html
@@ -10,11 +10,15 @@
-
+
-
@@ -142,18 +146,21 @@
Puerto
-
+
Dirección
-
+
Modo Multicast
-
-
+
+
{{ option.name }}
@@ -161,25 +168,29 @@
Velocidad
-
+
Máximo Clientes
-
+
Tiempo Máximo de Espera
-
+
Modo P2P
-
-
+
+
{{ option.name }}
@@ -187,7 +198,8 @@
Semilla
-
+
diff --git a/ogWebconsole/src/app/components/groups/components/client-main-view/deploy-image/deploy-image.component.ts b/ogWebconsole/src/app/components/groups/components/client-main-view/deploy-image/deploy-image.component.ts
index 7ab67dc..ff560c5 100644
--- a/ogWebconsole/src/app/components/groups/components/client-main-view/deploy-image/deploy-image.component.ts
+++ b/ogWebconsole/src/app/components/groups/components/client-main-view/deploy-image/deploy-image.component.ts
@@ -332,13 +332,34 @@ export class DeployImageComponent implements OnInit{
});
}
+ isFormValid(): boolean {
+ if (!this.allSelected || !this.selectedModelClient || !this.selectedImage || !this.selectedMethod || !this.selectedPartition) {
+ return false;
+ }
+
+ if (this.isMethod('udpcast') || this.isMethod('uftp') || this.isMethod('udpcast-direct')) {
+ if (!this.mcastPort || !this.mcastIp || !this.mcastMode || !this.mcastSpeed || !this.mcastMaxClients || !this.mcastMaxTime) {
+ return false;
+ }
+ }
+
+ if (this.isMethod('p2p')) {
+ if (!this.p2pMode || !this.p2pTime) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
openScheduleModal(): void {
const dialogRef = this.dialog.open(CreateTaskComponent, {
width: '800px',
data: {
scope: this.runScriptContext.type,
- organizationalUnit: this.runScriptContext['@id']
+ organizationalUnit: this.runScriptContext['@id'],
+ source: 'assistant'
}
});
@@ -359,9 +380,9 @@ export class DeployImageComponent implements OnInit{
};
this.http.post(`${this.baseUrl}/command-task-scripts`, {
- commandTask: result['@id'],
+ commandTask: result['taskId'] ? result['taskId']['@id'] : result['@id'],
parameters: payload,
- order: 1,
+ order: result['executionOrder'] || 1,
type: 'deploy-image',
}).subscribe({
next: () => {
diff --git a/ogWebconsole/src/app/components/groups/components/client-main-view/partition-assistant/partition-assistant.component.css b/ogWebconsole/src/app/components/groups/components/client-main-view/partition-assistant/partition-assistant.component.css
index 2e034f9..9513cb6 100644
--- a/ogWebconsole/src/app/components/groups/components/client-main-view/partition-assistant/partition-assistant.component.css
+++ b/ogWebconsole/src/app/components/groups/components/client-main-view/partition-assistant/partition-assistant.component.css
@@ -267,5 +267,18 @@ button.remove-btn:hover {
font-weight: 500;
}
+.instructions-box {
+ margin-top: 15px;
+ background-color: #f5f5f5;
+ border: 1px solid #ccc;
+ padding: 15px;
+ border-radius: 6px;
+}
+
+.instructions-textarea textarea {
+ font-family: monospace;
+ white-space: pre;
+}
+
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 ec2d67c..838f72d 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
@@ -13,6 +13,12 @@
Ejecutar
+
+
+ Generar instrucciones
+
+
+
schedule Opciones de programación
@@ -86,6 +92,13 @@
+
+
+
+
+
+
+
Añadir partición
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 2eb888d..5fc8b78 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
@@ -52,6 +52,7 @@ export class PartitionAssistantComponent implements OnInit{
selectedClients: any[] = [];
selectedModelClient: any = null;
partitionCode: string = '';
+ generatedInstructions: string = '';
constructor(
private http: HttpClient,
@@ -426,7 +427,8 @@ export class PartitionAssistantComponent implements OnInit{
width: '800px',
data: {
scope: this.runScriptContext.type,
- organizationalUnit: this.runScriptContext['@id']
+ organizationalUnit: this.runScriptContext['@id'],
+ source: 'assistant'
}
});
@@ -473,4 +475,39 @@ export class PartitionAssistantComponent implements OnInit{
}
});
}
+
+ generateInstructions(): void {
+ if (!this.selectedDisk || !this.selectedDisk.partitions) {
+ this.generatedInstructions = 'No hay particiones configuradas para generar instrucciones.';
+ return;
+ }
+
+ const diskNumber = this.selectedDisk.diskNumber;
+ const partitionTable = this.partitionCode || 'MSDOS';
+
+ let instructions = `ogCreatePartitionTable ${diskNumber} ${partitionTable}\n`;
+ instructions += `ogEcho log session "[0] $MSG_HELP_ogCreatePartitions"\n`;
+ instructions += `ogEcho session "[10] $MSG_HELP_ogUnmountAll ${diskNumber}"\n`;
+ instructions += `ogUnmountAll ${diskNumber} 2>/dev/null\n`;
+ instructions += `ogUnmountCache\n`;
+ instructions += `ogEcho session "[30] $MSG_HELP_ogUpdatePartitionTable ${diskNumber}"\n`;
+ instructions += `ogDeletePartitionTable ${diskNumber}\n`;
+ instructions += `ogUpdatePartitionTable ${diskNumber}\n`;
+
+ this.selectedDisk.partitions.forEach((partition: { removed: any; partitionNumber: any; partitionCode: any; filesystem: any; size: any; format: any; }, index: any) => {
+ if (partition.removed) return;
+
+ const partNumber = partition.partitionNumber;
+ const partType = partition.partitionCode;
+ const fs = partition.filesystem;
+ const size = partition.size;
+ const shouldFormat = partition.format ? 'yes' : 'no';
+
+ instructions += `ogCreatePartition ${diskNumber} ${partNumber} ${partType} ${fs} ${size}MB ${shouldFormat}\n`;
+ });
+
+ instructions += `ogExecAndLog command session ogListPartitions ${diskNumber}\n`;
+
+ this.generatedInstructions = instructions;
+ }
}
diff --git a/ogWebconsole/src/app/components/groups/components/client-main-view/run-script-assistant/run-script-assistant.component.ts b/ogWebconsole/src/app/components/groups/components/client-main-view/run-script-assistant/run-script-assistant.component.ts
index b463fc0..2909ac5 100644
--- a/ogWebconsole/src/app/components/groups/components/client-main-view/run-script-assistant/run-script-assistant.component.ts
+++ b/ogWebconsole/src/app/components/groups/components/client-main-view/run-script-assistant/run-script-assistant.component.ts
@@ -203,7 +203,8 @@ export class RunScriptAssistantComponent implements OnInit{
width: '800px',
data: {
scope: this.runScriptContext.type,
- organizationalUnit: this.runScriptContext['@id']
+ organizationalUnit: this.runScriptContext['@id'],
+ source: 'assistant'
}
});