From 9d0bc03400c4329d927fa61228135299182caf31 Mon Sep 17 00:00:00 2001 From: jmbardallo Date: Tue, 31 Mar 2026 13:05:02 +0200 Subject: [PATCH] =?UTF-8?q?A=C3=B1adido=20comando=20Refrescar=20tanto=20en?= =?UTF-8?q?=20un=20cliente=20como=20en=20un=20grupo=20de=20clientes,=20de?= =?UTF-8?q?=20forma=20que=20se=20ejecuta=20el=20comando=20Actualizar=20en?= =?UTF-8?q?=20el=20ogAgent=20y=20se=20actualiza=20la=20informaci=C3=B3n=20?= =?UTF-8?q?de=20las=20particiones=20del=20cliente=20y=20se=20recarga=20el?= =?UTF-8?q?=20men=C3=BA=20del=20ogbrowser.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 4 +++ .../execute-command.component.ts | 28 +++++++++++++++++-- .../src/app/shared/constants/command-types.ts | 5 ++++ ogWebconsole/src/locale/en.json | 3 +- ogWebconsole/src/locale/es.json | 3 +- 5 files changed, 39 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 311e0a5..f8a7de9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,8 @@ # Changelog +## [1.3.0] - 2026-03-31 +### Added +- Añadido comando "Refrescar" tanto en un cliente como en un grupo de clientes, de forma que se ejecuta el comando Actualizar en el ogAgent y se actualiza la información de las particiones del cliente y se recarga el menú del ogbrowser. + ## [1.2.7] - 2026-03-31 ### Added - Rediseño de la plantilla para seleccion de particiones, se ha creado un componente compartido por la vista de crear imagen y deploy de imagenes. diff --git a/ogWebconsole/src/app/components/commands/main-commands/execute-command/execute-command.component.ts b/ogWebconsole/src/app/components/commands/main-commands/execute-command/execute-command.component.ts index e8bf0bf..11505fd 100644 --- a/ogWebconsole/src/app/components/commands/main-commands/execute-command/execute-command.component.ts +++ b/ogWebconsole/src/app/components/commands/main-commands/execute-command/execute-command.component.ts @@ -37,6 +37,7 @@ export class ExecuteCommandComponent implements OnInit { { translationKey: 'executeCommands.softwareInventory', slug: 'software-inventory', disabled: false }, { translationKey: 'executeCommands.hardwareInventory', slug: 'hardware-inventory', disabled: false }, { translationKey: 'executeCommands.runScript', slug: 'run-script', disabled: false }, + { translationKey: 'executeCommands.refresh', slug: 'refresh', disabled: false }, ]; client: any = {}; @@ -79,7 +80,8 @@ export class ExecuteCommandComponent implements OnInit { 'software-inventory', 'hardware-inventory', 'remove-cache-image', - 'partition' + 'partition', + 'refresh' ], 'ou-minimal': [ 'power-on', @@ -112,7 +114,7 @@ export class ExecuteCommandComponent implements OnInit { if (states[0] === 'off' || states[0] === 'disconnected') { command.disabled = !['power-on', 'create-image'].includes(command.slug); } else { - command.disabled = !['power-off', 'reboot', 'login', 'create-image', 'deploy-image', 'remove-cache-image', 'partition', 'run-script', 'software-inventory', 'hardware-inventory'].includes(command.slug); + command.disabled = !['power-off', 'reboot', 'login', 'create-image', 'deploy-image', 'remove-cache-image', 'partition', 'run-script', 'software-inventory', 'hardware-inventory', 'refresh'].includes(command.slug); } } else { if (command.slug === 'software-inventory') { @@ -125,6 +127,11 @@ export class ExecuteCommandComponent implements OnInit { command.disabled = true; } } + + if (command.slug === 'refresh') { + command.disabled = !states.every(state => state === 'og-live'); + } + return command; }); } @@ -173,6 +180,10 @@ export class ExecuteCommandComponent implements OnInit { if (action === 'software-inventory') { this.softwareInventory(); } + + if (action === 'refresh') { + this.refreshClient(); + } } rebootClient(): void { @@ -188,6 +199,19 @@ export class ExecuteCommandComponent implements OnInit { ); } + refreshClient(): void { + this.http.post(`${this.baseUrl}/clients/server/refresh`, { + clients: this.clientData.map((client: any) => client['@id']) + }).subscribe( + response => { + this.toastService.success('Petición de refresco enviada correctamente'); + }, + error => { + this.toastService.error(error.error['hydra:description'] || 'Error de conexión con el cliente'); + } + ); + } + loginClient(): void { const clientDataToSend = this.clientData.map(client => ({ name: client.name, diff --git a/ogWebconsole/src/app/shared/constants/command-types.ts b/ogWebconsole/src/app/shared/constants/command-types.ts index 1d52dbe..7e4c0a9 100644 --- a/ogWebconsole/src/app/shared/constants/command-types.ts +++ b/ogWebconsole/src/app/shared/constants/command-types.ts @@ -72,5 +72,10 @@ export const COMMAND_TYPES: any = { 'kill-job': { en: 'Cancel Task', es: 'Cancelar Tarea' + }, + + refresh: { + en: 'Refresh', + es: 'Refrescar' } }; diff --git a/ogWebconsole/src/locale/en.json b/ogWebconsole/src/locale/en.json index 98298f3..c8efa4e 100644 --- a/ogWebconsole/src/locale/en.json +++ b/ogWebconsole/src/locale/en.json @@ -517,7 +517,8 @@ "partition": "Partition and Format", "softwareInventory": "Software Inventory", "hardwareInventory": "Hardware Inventory", - "runScript": "Run Script" + "runScript": "Run Script", + "refresh": "Refresh" }, "changeOU": "Change Organizational Unit", "moveClientsTooltip": "Move clients to another organizational unit", diff --git a/ogWebconsole/src/locale/es.json b/ogWebconsole/src/locale/es.json index 0ed3206..b991651 100644 --- a/ogWebconsole/src/locale/es.json +++ b/ogWebconsole/src/locale/es.json @@ -518,7 +518,8 @@ "partition": "Particionar y Formatear", "softwareInventory": "Inventario Software", "hardwareInventory": "Inventario Hardware", - "runScript": "Ejecutar script" + "runScript": "Ejecutar script", + "refresh": "Refrescar" }, "changeOU": "Mover", "moveClientsTooltip": "Mover clientes a otra unidad organizativa", -- 2.40.1