Refactor execute command component: replace command names with translation keys and update localization files for execute commands
testing/ogGui-multibranch/pipeline/head This commit looks good Details

pull/22/head
Lucas Lara García 2025-05-07 11:58:51 +02:00
parent a3f99958a3
commit bdd6206e18
5 changed files with 43 additions and 17 deletions

View File

@ -19,6 +19,6 @@
<button mat-menu-item [disabled]="command.disabled
|| (command.slug === 'create-image' && clientData.length > 1)" *ngFor="let command of arrayCommands"
(click)="onCommandSelect(command.slug)">
{{ command.name }}
{{ command.translationKey | translate }}
</button>
</mat-menu>

View File

@ -21,17 +21,17 @@ export class ExecuteCommandComponent implements OnInit {
loading: boolean = true;
arrayCommands: any[] = [
{ name: 'Enceder', slug: 'power-on', disabled: false },
{ name: 'Apagar', slug: 'power-off', disabled: false },
{ name: 'Reiniciar', slug: 'reboot', disabled: false },
{ name: 'Iniciar Sesión', slug: 'login', disabled: true },
{ name: 'Crear imagen', slug: 'create-image', disabled: false },
{ name: 'Clonar/desplegar imagen', slug: 'deploy-image', disabled: false },
{ name: 'Eliminar Imagen Cache', slug: 'delete-image-cache', disabled: true },
{ name: 'Particionar y Formatear', slug: 'partition', disabled: false },
{ name: 'Inventario Software', slug: 'software-inventory', disabled: true },
{ name: 'Inventario Hardware', slug: 'hardware-inventory', disabled: true },
{ name: 'Ejecutar comando', slug: 'run-script', disabled: false },
{ translationKey: 'executeCommands.powerOn', slug: 'power-on', disabled: false },
{ translationKey: 'executeCommands.powerOff', slug: 'power-off', disabled: false },
{ translationKey: 'executeCommands.reboot', slug: 'reboot', disabled: false },
{ translationKey: 'executeCommands.login', slug: 'login', disabled: true },
{ translationKey: 'executeCommands.createImage', slug: 'create-image', disabled: false },
{ translationKey: 'executeCommands.deployImage', slug: 'deploy-image', disabled: false },
{ translationKey: 'executeCommands.deleteImageCache', slug: 'delete-image-cache', disabled: true },
{ translationKey: 'executeCommands.partition', slug: 'partition', disabled: false },
{ translationKey: 'executeCommands.softwareInventory', slug: 'software-inventory', disabled: true },
{ translationKey: 'executeCommands.hardwareInventory', slug: 'hardware-inventory', disabled: true },
{ translationKey: 'executeCommands.runScript', slug: 'run-script', disabled: false },
];
client: any = {};
@ -232,7 +232,7 @@ export class ExecuteCommandComponent implements OnInit {
this.router.navigate(['/clients/run-script'], {
queryParams: {
clientData: JSON.stringify(clientDataToSend) ,
clientData: JSON.stringify(clientDataToSend),
runScriptContext: JSON.stringify(this.runScriptContext)
}
})

View File

@ -205,7 +205,7 @@
<span>{{ 'partitions' | translate }}</span>
</button>
<app-execute-command [clientData]="selectedNode?.clients || []" [buttonType]="'menu-item'"
[buttonText]="'Ejecutar comandos'" [icon]="'terminal'"
[buttonText]="'ejecutarComandos' | translate" [icon]="'terminal'"
[disabled]="!((selectedNode?.clients ?? []).length > 0)" [runScriptContext]="selectedNode?.name || ''"
[runScriptContext]="getRunScriptContext(selectedNode?.clients || [])">
</app-execute-command>

View File

@ -489,10 +489,23 @@
"usedPercentageLabel": "Used",
"errorLoadingData": "Error fetching data. Service not available",
"repositoryTitleStep": "On this screen you can manage image repositories.",
"partitions": "Particiones",
"partitions": "Partitions",
"clientsViewStepText": "Display of the selected organizational unit's clients",
"vistalista": "List View",
"vistatarjeta": "Card View",
"ejecutarComandos": "Execute Commands",
"searchState": "Search state"
"searchState": "Search state",
"executeCommands": {
"powerOn": "Power On",
"powerOff": "Shut Down",
"reboot": "Reboot",
"login": "Login",
"createImage": "Create Image",
"deployImage": "Deploy Image",
"deleteImageCache": "Delete Image Cache",
"partition": "Partition and Format",
"softwareInventory": "Software Inventory",
"hardwareInventory": "Hardware Inventory",
"runScript": "Run Script"
}
}

View File

@ -496,5 +496,18 @@
"vistalista": "Vista Lista",
"vistatarjeta": "Vista Tarjeta",
"ejecutarComandos": "Ejecutar Comandos",
"searchState": "Buscar por estado"
"searchState": "Buscar por estado",
"executeCommands": {
"powerOn": "Encender",
"powerOff": "Apagar",
"reboot": "Reiniciar",
"login": "Iniciar Sesión",
"createImage": "Crear imagen",
"deployImage": "Clonar/desplegar imagen",
"deleteImageCache": "Eliminar Imagen Cache",
"partition": "Particionar y Formatear",
"softwareInventory": "Inventario Software",
"hardwareInventory": "Inventario Hardware",
"runScript": "Ejecutar script"
}
}