diff --git a/CHANGELOG.md b/CHANGELOG.md index 2b9ed3b..d1a2277 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,20 @@ # Changelog +## [1.3.1] - 2026-04-09 +### Added +- Añadida información de la fecha de despliegue de una imagen en una particion. + +## [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. + +## [1.2.6] - 2026-03-30 +### Added +- Rediseño de la pantalla detalles de un equipo, en la partición CACHE, se muestra el listado de ficheros que contiene con el tamaño de cada uno. + ## [1.2.5] - 2026-03-27 ### Fixed - Corregido error 401 Unauthorized en la edición de menús con nombres que contienen la palabra "login". Se ha refinado el interceptor para aplicar el prefijo "Bearer" de forma selectiva mediante validación exacta del path `/auth/login`. diff --git a/ogWebconsole/src/app/app.module.ts b/ogWebconsole/src/app/app.module.ts index e2712a2..5318784 100644 --- a/ogWebconsole/src/app/app.module.ts +++ b/ogWebconsole/src/app/app.module.ts @@ -189,6 +189,7 @@ import { HardwareProfileComponent } from './components/hardware-profile/hardware import { HardwareCollectionModalComponent } from './components/hardware-profile/hardware-collection-modal/hardware-collection-modal.component'; import { HardwareTypeComponent } from './components/hardware-type/hardware-type.component'; import { ShowDetailsComponent } from './components/hardware-type/show-details/show-details.component'; +import { DiskPartitionSelectorComponent } from './components/groups/shared/disk-partition-selector/disk-partition-selector.component'; export function HttpLoaderFactory(http: HttpClient) { return new TranslateHttpLoader(http, './locale/', '.json'); } @@ -366,7 +367,7 @@ registerLocaleData(localeEs, 'es-ES'); progressAnimation: 'increasing', closeButton: true } - ), MatGridList, MatTree, MatTreeNode, MatNestedTreeNode, MatTreeNodeToggle, MatTreeNodeDef, MatTreeNodePadding, MatTreeNodeOutlet, MatPaginator, MatGridTile, MatExpansionPanel, MatExpansionPanelTitle, MatExpansionPanelDescription, MatRadioGroup, MatRadioButton, MatAutocompleteTrigger, NgOptimizedImage + ), MatGridList, MatTree, MatTreeNode, MatNestedTreeNode, MatTreeNodeToggle, MatTreeNodeDef, MatTreeNodePadding, MatTreeNodeOutlet, MatPaginator, MatGridTile, MatExpansionPanel, MatExpansionPanelTitle, MatExpansionPanelDescription, MatRadioGroup, MatRadioButton, MatAutocompleteTrigger, NgOptimizedImage, DiskPartitionSelectorComponent ], schemas: [ CUSTOM_ELEMENTS_SCHEMA, 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/components/groups/components/client-main-view/create-image/create-image.component.html b/ogWebconsole/src/app/components/groups/components/client-main-view/create-image/create-image.component.html index e118657..62861a4 100644 --- a/ogWebconsole/src/app/components/groups/components/client-main-view/create-image/create-image.component.html +++ b/ogWebconsole/src/app/components/groups/components/client-main-view/create-image/create-image.component.html @@ -206,39 +206,13 @@
- - - - - - - - - - - - - -
Seleccionar partición - - - - - {{ column.header }} - - {{ column.cell(image) }} - - - -
- {{ image.size }} MB - {{ image.size / 1024 }} GB -
-
-
+ +
diff --git a/ogWebconsole/src/app/components/groups/components/client-main-view/create-image/create-image.component.ts b/ogWebconsole/src/app/components/groups/components/client-main-view/create-image/create-image.component.ts index eb8cc5e..a9ce00f 100644 --- a/ogWebconsole/src/app/components/groups/components/client-main-view/create-image/create-image.component.ts +++ b/ogWebconsole/src/app/components/groups/components/client-main-view/create-image/create-image.component.ts @@ -62,12 +62,11 @@ export class CreateClientImageComponent implements OnInit{ return this.gitData && this.gitData.repo && this.gitData.branch; } + isPartitionDisabled = (row: any): boolean => { + return !row.operativeSystem; + }; + columns = [ - { - columnDef: 'diskNumber', - header: 'Disco', - cell: (partition: any) => partition.diskNumber - }, { columnDef: 'partitionNumber', header: 'Particion', diff --git a/ogWebconsole/src/app/components/groups/components/client-main-view/deploy-image/deploy-image.component.css b/ogWebconsole/src/app/components/groups/components/client-main-view/deploy-image/deploy-image.component.css index d2e10dd..c62d8d3 100644 --- a/ogWebconsole/src/app/components/groups/components/client-main-view/deploy-image/deploy-image.component.css +++ b/ogWebconsole/src/app/components/groups/components/client-main-view/deploy-image/deploy-image.component.css @@ -628,6 +628,11 @@ table { } } +.partition-table-container { + overflow-x: auto; + margin-top: 10px; +} + .commits-table-container { margin-top: 20px; } 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 bd1c343..4e6269c 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 @@ -16,15 +16,17 @@
- - +
+ +
+ -
+ +
+
@@ -43,7 +45,8 @@
info - Puedes marcar o desmarcar un cliente haciendo clic en el área del ordenador. Además, selecciona con "Modelo" el equipo que actuará como modelo. + Puedes marcar o desmarcar un cliente haciendo clic en el área del ordenador. Además, selecciona con "Modelo" el + equipo que actuará como modelo.
@@ -55,17 +58,11 @@
-
+
- Client Icon + Client Icon
{{ client.name | slice:0:20 }} @@ -76,9 +73,7 @@
- + Modelo @@ -89,6 +84,8 @@
+ +
@@ -97,19 +94,21 @@ image Configuración de imagen
- - - Tipo de imagen - - Monolítica - Git - - + +
+ + Tipo de imagen + + Monolítica + Git + + +
-
- - Método de deploy +
+ + Seleccione método de deploy {{ method.name }} @@ -118,7 +117,7 @@ Seleccione imagen -
{{ image.name }}
+
{{ image.name }}
{{ image.description }}
@@ -126,10 +125,11 @@
-
- - Repositorio - +
+ + Seleccionar Repositorio + {{ repo }} @@ -137,9 +137,10 @@ hourglass_empty - - Rama - + + Seleccionar Rama + {{ branch }} @@ -147,8 +148,8 @@ hourglass_empty - - Filtrar por tag + + Tag No Sí @@ -177,7 +178,7 @@ storage Selección de partición
- +
@@ -193,27 +194,12 @@
- - - - - - - - - - - - - -
Seleccionar - - - - - {{ column.header }} - {{ column.cell(image) }} -
+ +
@@ -255,8 +241,8 @@ Tags - + {{ tag }} Sin tags @@ -268,16 +254,8 @@
-
- + - - 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 57f00bf..6f6d1e5 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 @@ -58,6 +58,7 @@ export class DeployImageComponent implements OnInit{ selectedClients: any[] = []; selectedModelClient: any = null; filteredPartitions: any[] = []; + selectedRepository: any = null; imageType: string = 'monolithic'; @@ -71,14 +72,9 @@ export class DeployImageComponent implements OnInit{ dataSource = new MatTableDataSource(); columns = [ - { - columnDef: 'diskNumber', - header: 'Disco', - cell: (partition: any) => `${partition.diskNumber}` - }, { columnDef: 'partitionNumber', - header: 'Particion', + header: 'Partición', cell: (partition: any) => `${partition.partitionNumber}` }, { diff --git a/ogWebconsole/src/app/components/groups/model/model.ts b/ogWebconsole/src/app/components/groups/model/model.ts index d1dac81..f85cc05 100644 --- a/ogWebconsole/src/app/components/groups/model/model.ts +++ b/ogWebconsole/src/app/components/groups/model/model.ts @@ -47,6 +47,7 @@ export interface Client { createdBy: string; uuid: string; parentName?: string; + notes?: string; } export interface ClientCollection { diff --git a/ogWebconsole/src/app/components/groups/shared/client-details/client-details.component.css b/ogWebconsole/src/app/components/groups/shared/client-details/client-details.component.css index 0aa7a6d..abd568e 100644 --- a/ogWebconsole/src/app/components/groups/shared/client-details/client-details.component.css +++ b/ogWebconsole/src/app/components/groups/shared/client-details/client-details.component.css @@ -86,6 +86,21 @@ table { box-shadow: none; } +.notes-card { + background-color: #f1f1f1; + padding: 24px; + border-radius: 12px; + box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05); +} + +.notes-value { + font-size: 1rem; + color: #222; + white-space: pre-wrap; + word-break: break-word; + margin-top: 8px; +} + .table-header-container { display: flex; align-items: center; @@ -130,3 +145,120 @@ table { gap: 1em; margin-bottom: 40px; } + +/* ngx-charts custom wrapped legend */ +::ng-deep .charts-container .legend-labels { + display: flex !important; + flex-wrap: wrap !important; + justify-content: center !important; +} +::ng-deep .charts-container .legend-label { + width: auto !important; + margin-right: 16px !important; + margin-bottom: 8px !important; +} +::ng-deep .charts-container .legend-label-text { + max-width: none !important; + overflow: visible !important; + text-overflow: clip !important; +} +::ng-deep .charts-container .legend-wrap { + width: 100% !important; +} + +/* Extracted Card Redesign Classes */ +.disk-card-wrapper { + margin-bottom: 50px; +} +.disk-mat-card { + border-radius: 8px; + overflow: visible !important; + padding: 0; +} +.disk-card-header { + background-color: #f5f5f5; + padding: 16px 20px; + display: flex; + justify-content: space-between; + align-items: center; + border-bottom: 1px solid #e0e0e0; + border-top-left-radius: 8px; + border-top-right-radius: 8px; +} +.disk-card-title { + margin: 0; + font-size: 1.2rem; + color: #3f51b5; + font-weight: bold; +} +.disk-card-metrics-wrapper { + display: flex; + align-items: center; +} +.disk-card-metrics-chip { + background-color: white !important; + border: 1px solid #ccc; + font-weight: bold; + color: #333; +} +.disk-card-layout { + display: flex; + align-items: stretch; + background: white; + gap: 0; + border-bottom-left-radius: 8px; + border-bottom-right-radius: 8px; +} +.disk-table-container { + flex: 1; + overflow-x: auto; +} +.disk-table { + width: 100%; + box-shadow: none !important; + border: none !important; +} +.disk-chart-container { + flex: 0 0 400px; + border-left: 1px solid #e0e0e0; + display: flex; + flex-direction: column; + align-items: center; + justify-content: flex-start; + padding: 30px 20px 50px 20px; + box-sizing: border-box; + background: #fafafa; + min-height: 350px; + border-bottom-right-radius: 8px; +} +.disk-chart-wrapper { + width: 100%; + height: auto; + display: flex; + justify-content: center; +} + +/* OS Column Classes */ +.os-col-wrapper { + display: flex; + flex-direction: column; +} +.cache-title { + font-weight: bold; + font-size: 0.8rem; + color: #666; +} +.cache-item { + font-size: 0.75rem; + color: #666; +} +.image-name { + font-size: 0.75rem; + color: gray; +} +.image-date { + font-size: 0.75rem; + color: #555; + font-style: italic; + margin-top: 2px; +} diff --git a/ogWebconsole/src/app/components/groups/shared/client-details/client-details.component.html b/ogWebconsole/src/app/components/groups/shared/client-details/client-details.component.html index 1a8e3ae..c8d9c15 100644 --- a/ogWebconsole/src/app/components/groups/shared/client-details/client-details.component.html +++ b/ogWebconsole/src/app/components/groups/shared/client-details/client-details.component.html @@ -1,7 +1,8 @@ -
+ @if (!loading) { +

{{ 'clientDetailsTitle' | translate }} {{ clientData.name }}

@@ -9,75 +10,120 @@
-
+ @for (data of generalData; track data) { +
{{ data?.property }}
{{ data?.value || '--' }}
+ }
-
+ @for (data of networkData; track data) { +
{{ data?.property }}
{{ data?.value || '--' }}
+ }
+
+
{{ 'notesLabel' | translate }}
+
{{ clientNotes || '--' }}
+
+

Discos/Particiones

- {{ clientData.firmwareType }} + @if (clientData.firmwareType) { + {{ clientData.firmwareType }} + }
-
-
- - - - - - - - - - - -
{{ column.header }} - - {{ column.cell(image) }} - - - - {{ (image.size / 1024).toFixed(2) }} GB - - - - -
- {{image.operativeSystem?.name }} - {{ image.image?.name }} -
-
-
- -
- -
- -
- - -

Disco {{ disk.diskNumber }}

-

Usado: {{ (disk.used).toFixed(2) }} GB ({{ disk.percentage }}%)

-

Total: {{ disk.total }} GB

+ @for (disk of diskUsageData; track disk.diskNumber) { +
+ +
+

Disco {{ disk.diskNumber }}

+
+ + Total: {{ disk.total.toFixed(2) }} GB  |  Usado: {{ (disk.used).toFixed(2) }} GB ({{ disk.percentage }}%) +
- +
+ +
+
+ + @for (column of columns; track column.columnDef) { + + + + + } + + + + + + +
{{ column.header }} + @if (column.columnDef !== 'size' && column.columnDef !== 'operativeSystem') { + {{ column.cell(image) }} + } + @if (column.columnDef === 'size') { + + {{ (image.size / 1024).toFixed(2) }} GB + + } + + @if (column.columnDef === 'operativeSystem') { +
+ @if (image.filesystem === 'CACHE' && image.cacheContent) { + Contenido: + @for (item of parseCacheContent(image.cacheContent); track item.name) { +
+ • {{ item.name }} ({{ item.size }}) +
+ } + } + @if (image.filesystem !== 'CACHE' || !image.cacheContent) { + {{image.operativeSystem?.name }} + {{ image.image?.name }} + @if (image.deployDate) { + Instalada el {{ image.deployDate | date:'dd/MM/yyyy HH:mm' }} + } + } +
+ } +
+ +
+ +
+
+ + +
+
+
+ + }
+ } - + \ No newline at end of file diff --git a/ogWebconsole/src/app/components/groups/shared/client-details/client-details.component.ts b/ogWebconsole/src/app/components/groups/shared/client-details/client-details.component.ts index 401a40f..055ec00 100644 --- a/ogWebconsole/src/app/components/groups/shared/client-details/client-details.component.ts +++ b/ogWebconsole/src/app/components/groups/shared/client-details/client-details.component.ts @@ -37,18 +37,14 @@ export class ClientDetailsComponent { chartDisk: any[] = []; view: [number, number] = [260, 160]; showLegend: boolean = true; + legendPosition: any = 'below'; datePipe: DatePipe = new DatePipe('es-ES'); columns = [ { - columnDef: 'diskNumber', - header: 'Disco', - cell: (partition: any) => partition.diskNumber, - }, - { - columnDef: 'partitionNumber', - header: 'Particion', - cell: (partition: any) => partition.partitionNumber + columnDef: 'partition', + header: 'Partición', + cell: (partition: any) => `${partition.partitionNumber}` }, { columnDef: 'partitionCode', @@ -129,6 +125,10 @@ export class ClientDetailsComponent { ]; } + get clientNotes(): string { + return this.clientData?.notes || ''; + } + calculateDiskUsage() { const diskUsageMap = new Map(); @@ -168,7 +168,8 @@ export class ClientDetailsComponent { chartData: partitionData, total, used, - percentage: total > 0 ? Math.round((used / total) * 100) : 0 + percentage: total > 0 ? Math.round((used / total) * 100) : 0, + partitions }; }); @@ -194,6 +195,15 @@ export class ClientDetailsComponent { }); } + parseCacheContent(content: string): { name: string, size: string }[] { + if (!content) return []; + return content.split(',').map(item => { + const [name, bytes] = item.split(':'); + const sizeMB = (parseInt(bytes) / (1024 * 1024)).toFixed(2) + ' MB'; + return { name, size: sizeMB }; + }); + } + onNoClick(): void { this.dialog.closeAll(); } diff --git a/ogWebconsole/src/app/components/groups/shared/clients/manage-client/manage-client.component.css b/ogWebconsole/src/app/components/groups/shared/clients/manage-client/manage-client.component.css index e67f4b7..3ae50b9 100644 --- a/ogWebconsole/src/app/components/groups/shared/clients/manage-client/manage-client.component.css +++ b/ogWebconsole/src/app/components/groups/shared/clients/manage-client/manage-client.component.css @@ -44,6 +44,10 @@ mat-option .unit-path { row-gap: 20px; } +.full-width { + grid-column: 1 / -1; +} + .action-container { display: flex; justify-content: flex-end; diff --git a/ogWebconsole/src/app/components/groups/shared/clients/manage-client/manage-client.component.html b/ogWebconsole/src/app/components/groups/shared/clients/manage-client/manage-client.component.html index 7257e6b..75febb5 100644 --- a/ogWebconsole/src/app/components/groups/shared/clients/manage-client/manage-client.component.html +++ b/ogWebconsole/src/app/components/groups/shared/clients/manage-client/manage-client.component.html @@ -106,6 +106,12 @@ {{ 'maintenance' | translate }} + + + {{ 'notesLabel' | translate }} + +
diff --git a/ogWebconsole/src/app/components/groups/shared/clients/manage-client/manage-client.component.ts b/ogWebconsole/src/app/components/groups/shared/clients/manage-client/manage-client.component.ts index 69b13d9..7254741 100644 --- a/ogWebconsole/src/app/components/groups/shared/clients/manage-client/manage-client.component.ts +++ b/ogWebconsole/src/app/components/groups/shared/clients/manage-client/manage-client.component.ts @@ -88,7 +88,8 @@ export class ManageClientComponent implements OnInit { repository: [null], menu: [null], maintenance: [false], - resolution: [null] + resolution: [null], + notes: [''] }); } @@ -250,7 +251,8 @@ export class ManageClientComponent implements OnInit { pxeTemplate: data.pxeTemplate ? data.pxeTemplate['@id'] : null, menu: data.menu ? data.menu['@id'] : null, maintenance: data.maintenance, - resolution: data.resolution + resolution: data.resolution, + notes: data.notes || '' }); resolve(); }, diff --git a/ogWebconsole/src/app/components/groups/shared/disk-partition-selector/disk-partition-selector.component.css b/ogWebconsole/src/app/components/groups/shared/disk-partition-selector/disk-partition-selector.component.css new file mode 100644 index 0000000..aa3c38d --- /dev/null +++ b/ogWebconsole/src/app/components/groups/shared/disk-partition-selector/disk-partition-selector.component.css @@ -0,0 +1,51 @@ +/* Formatting specific to grouped partition selector */ +.disk-container { + display: flex; + flex-direction: column; + gap: 32px; + padding-top: 16px; +} + +.disk-card-wrapper { + margin-bottom: 20px; +} + +.disk-mat-card { + border-radius: 8px; + overflow: hidden; + padding: 0; +} + +.disk-card-header { + background-color: #f5f5f5; + padding: 16px 20px; + display: flex; + justify-content: space-between; + align-items: center; + border-bottom: 1px solid #e0e0e0; +} + +.disk-card-title { + margin: 0; + font-size: 1.2rem; + color: #3f51b5; + font-weight: bold; +} + +.disk-card-layout { + display: flex; + align-items: stretch; + background: white; + gap: 0; +} + +.disk-table-container { + flex: 1; + overflow-x: auto; +} + +.disk-table { + width: 100%; + box-shadow: none !important; + border: none !important; +} diff --git a/ogWebconsole/src/app/components/groups/shared/disk-partition-selector/disk-partition-selector.component.html b/ogWebconsole/src/app/components/groups/shared/disk-partition-selector/disk-partition-selector.component.html new file mode 100644 index 0000000..899e6c7 --- /dev/null +++ b/ogWebconsole/src/app/components/groups/shared/disk-partition-selector/disk-partition-selector.component.html @@ -0,0 +1,53 @@ +
+ @for (disk of diskUsageData; track disk.diskNumber) { +
+ +
+

Disco {{ disk.diskNumber }}

+
+ +
+
+ + + + + + + + @for (column of columns; track column.columnDef) { + + + + + } + + + + +
Seleccionar + + + + {{ column.header }} + @if (column.columnDef === 'size') { +
+ {{ partition.size }} MB + {{ partition.size / 1024 | number:'1.0-2' }} GB +
+ } @else { + {{ column.cell ? column.cell(partition) : partition[column.columnDef] }} + } +
+
+
+
+
+ } +
diff --git a/ogWebconsole/src/app/components/groups/shared/disk-partition-selector/disk-partition-selector.component.ts b/ogWebconsole/src/app/components/groups/shared/disk-partition-selector/disk-partition-selector.component.ts new file mode 100644 index 0000000..a3bb8ad --- /dev/null +++ b/ogWebconsole/src/app/components/groups/shared/disk-partition-selector/disk-partition-selector.component.ts @@ -0,0 +1,58 @@ +import { Component, Input, Output, EventEmitter, OnChanges, SimpleChanges } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { MatCardModule } from '@angular/material/card'; +import { MatTableModule } from '@angular/material/table'; +import { MatRadioModule } from '@angular/material/radio'; +import { FormsModule } from '@angular/forms'; + +@Component({ + selector: 'app-disk-partition-selector', + standalone: true, + imports: [CommonModule, MatCardModule, MatTableModule, MatRadioModule, FormsModule], + templateUrl: './disk-partition-selector.component.html', + styleUrl: './disk-partition-selector.component.css' +}) +export class DiskPartitionSelectorComponent implements OnChanges { + @Input() partitions: any[] = []; + @Input() columns: any[] = []; + @Input() displayedColumns: string[] = []; + @Input() selectedPartition: any; + @Input() disableCondition: (row: any) => boolean = () => false; + + @Output() selectedPartitionChange = new EventEmitter(); + + diskUsageData: any[] = []; + + ngOnChanges(changes: SimpleChanges): void { + if (changes['partitions']) { + this.calculateDiskUsage(this.partitions || []); + } + } + + calculateDiskUsage(partitions: any[]) { + this.diskUsageData = []; + const grouped = partitions.reduce((acc: any, curr: any) => { + if (!acc[curr.diskNumber]) { + acc[curr.diskNumber] = []; + } + acc[curr.diskNumber].push(curr); + return acc; + }, {}); + + for (const diskNum in grouped) { + if (grouped.hasOwnProperty(diskNum)) { + this.diskUsageData.push({ + diskNumber: diskNum, + partitions: grouped[diskNum] + }); + } + } + } + + onPartitionSelected(row: any) { + if (!this.disableCondition(row)) { + this.selectedPartition = row; + this.selectedPartitionChange.emit(this.selectedPartition); + } + } +} 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 6761d0f..bfdceb5 100644 --- a/ogWebconsole/src/locale/en.json +++ b/ogWebconsole/src/locale/en.json @@ -589,7 +589,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 dab2251..ebb45ec 100644 --- a/ogWebconsole/src/locale/es.json +++ b/ogWebconsole/src/locale/es.json @@ -590,7 +590,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",