Añadido translate instante en los controladores ts

pull/72/head
Juan Manuel Bardallo 2026-04-23 09:20:13 +02:00
parent 954ca0cc6e
commit 6d29d017d9
143 changed files with 2056 additions and 800 deletions

View File

@ -1,3 +1,5 @@
import { inject } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { Component } from '@angular/core';
import { HttpClient } from "@angular/common/http";
import { ToastrService } from "ngx-toastr";
@ -9,6 +11,7 @@ import { ConfigService } from '@services/config.service';
styleUrl: './env-vars.component.css'
})
export class EnvVarsComponent {
public translate = inject(TranslateService);
envVars: { name: string; value: string }[] = [];
displayedColumns: string[] = ['name', 'value'];
private apiUrl: string;
@ -31,7 +34,7 @@ export class EnvVarsComponent {
this.envVars = Object.entries(response.vars).map(([name, value]) => ({ name, value }));
},
error: (err) => {
this.toastService.error('No se pudieron cargar las variables de entorno.');
this.toastService.error(this.translate.instant('noSePudieronCargarLas'));
}
});
}
@ -48,11 +51,11 @@ export class EnvVarsComponent {
this.http.post(this.apiUrl, { vars }).subscribe({
next: () => {
this.toastService.success('Variables de entorno guardadas correctamente.');
this.toastService.success(this.translate.instant('variablesDeEntornoGuardadasCorrectamente'));
},
error: (err) => {
console.error('Error al guardar las variables de entorno:', err);
this.toastService.error('No se pudieron cargar las variables de entorno.');
console.error(this.translate.instant('errorAlGuardarLasVariables'), err);
this.toastService.error(this.translate.instant('noSePudieronCargarLas'));
}
});
}

View File

@ -1,3 +1,5 @@
import { inject } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { HttpClient } from '@angular/common/http';
import { Component, Inject } from '@angular/core';
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
@ -12,6 +14,7 @@ import { ConfigService } from '@services/config.service';
styleUrls: ['./add-role-modal.component.css']
})
export class AddRoleModalComponent {
public translate = inject(TranslateService);
roleForm: FormGroup<any>;
roleId: string | null = null;
baseUrl: string;
@ -56,7 +59,7 @@ export class AddRoleModalComponent {
this.roleId = response['@id'];
},
error: (err) => {
console.error('Error fetching remote calendar:', err);
console.error(this.translate.instant('errorFetchingRemoteCalendar'), err);
}
});
}
@ -85,23 +88,23 @@ export class AddRoleModalComponent {
if (this.roleId) {
this.http.put(`${this.baseUrl}${this.roleId}`, payload).subscribe(
(response) => {
this.toastService.success('Rol actualizado correctamente');
this.toastService.success(this.translate.instant('rolActualizadoCorrectamente'));
this.dialogRef.close();
},
(error) => {
this.toastService.error('Error al editar el rol:', error);
console.error('Error al editar el rol', error);
this.toastService.error(this.translate.instant('errorAlEditarElRol1'), error);
console.error(this.translate.instant('errorAlEditarElRol'), error);
}
);
} else {
this.http.post(`${this.baseUrl}/user-groups`, payload).subscribe(
(response) => {
this.toastService.success('Rol añadido correctamente');
this.toastService.success(this.translate.instant('rolAnadidoCorrectamente'));
this.dialogRef.close();
},
(error) => {
this.toastService.error('Error al añadir rol:', error);
console.error('Error al añadir rol', error);
this.toastService.error(this.translate.instant('errorAlAnadirRol1'), error);
console.error(this.translate.instant('errorAlAnadirRol'), error);
}
);
}

View File

@ -1,3 +1,5 @@
import { inject } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { Injectable } from '@angular/core';
import {HttpClient, HttpParams} from '@angular/common/http';
import { Observable, throwError } from 'rxjs';
@ -8,6 +10,7 @@ import { ConfigService } from '@services/config.service';
providedIn: 'root'
})
export class DataService {
public translate = inject(TranslateService);
baseUrl: string;
private apiUrl: string;
@ -31,7 +34,7 @@ export class DataService {
}
}),
catchError(error => {
console.error('Error fetching user groups', error);
console.error(this.translate.instant('errorFetchingUserGroups'), error);
return throwError(error);
})
);
@ -47,7 +50,7 @@ export class DataService {
}
}),
catchError(error => {
console.error('Error fetching user group', error);
console.error(this.translate.instant('errorFetchingUserGroup'), error);
return throwError(error);
})
);

View File

@ -24,7 +24,7 @@
<div *ngIf="!loading">
<table mat-table [dataSource]="dataSource" class="mat-elevation-z8">
<ng-container *ngFor="let column of columns" [matColumnDef]="column.columnDef">
<th mat-header-cell *matHeaderCellDef> {{ column.header }} </th>
<th mat-header-cell *matHeaderCellDef> {{ column.header | translate }} </th>
<td mat-cell *matCellDef="let role"> {{ column.cell(role) }} </td>
</ng-container>

View File

@ -1,3 +1,5 @@
import { inject } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { Component, OnInit } from '@angular/core';
import { MatTableDataSource } from '@angular/material/table';
import { MatDialog } from '@angular/material/dialog';
@ -15,6 +17,7 @@ import { ConfigService } from '@services/config.service';
styleUrls: ['./roles.component.css']
})
export class RolesComponent implements OnInit {
public translate = inject(TranslateService);
baseUrl: string = this.configService.apiUrl;
dataSource = new MatTableDataSource<any>();
filters: { [key: string]: string } = {};
@ -27,17 +30,17 @@ export class RolesComponent implements OnInit {
columns = [
{
columnDef: 'id',
header: 'ID',
header: 'id',
cell: (role: any) => `${role.id}`
},
{
columnDef: 'name',
header: 'Nombre',
header: 'nombre',
cell: (role: any) => `${role.name}`
},
{
columnDef: 'permissions',
header: 'Permisos',
header: 'permisos',
cell: (role: any) => `${role.permissions.join(', ')}`
}
];
@ -66,7 +69,7 @@ export class RolesComponent implements OnInit {
this.loading = false;
},
(error) => {
console.error('Error fetching roles', error);
console.error(this.translate.instant('errorFetchingRoles'), error);
this.loading = false;
}
);
@ -108,10 +111,10 @@ export class RolesComponent implements OnInit {
this.http.delete(apiUrl).subscribe({
next: () => {
this.search();
this.toastService.success('Role deleted successfully');
this.toastService.success(this.translate.instant('roleDeletedSuccessfully'));
},
error: (error) => {
this.toastService.error('Error deleting role:', error);
this.toastService.error(this.translate.instant('errorDeletingRole'), error);
}
});
}

View File

@ -1,3 +1,5 @@
import { inject } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { Component, EventEmitter, Inject, OnInit, Output } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
@ -18,6 +20,7 @@ interface UserGroup {
styleUrls: ['./add-user-modal.component.css']
})
export class AddUserModalComponent implements OnInit {
public translate = inject(TranslateService);
baseUrl: string;
@Output() userAdded = new EventEmitter<void>();
@Output() userEdited = new EventEmitter<void>();
@ -94,7 +97,7 @@ export class AddUserModalComponent implements OnInit {
},
error: (err) => {
this.loading = false;
console.error('Error fetching user:', err);
console.error(this.translate.instant('errorFetchingUser'), err);
}
});
}
@ -125,7 +128,7 @@ export class AddUserModalComponent implements OnInit {
if (this.userId) {
this.http.put(`${this.baseUrl}${this.userId}`, payload).subscribe(
(response) => {
this.toastService.success('Usuario editado correctamente');
this.toastService.success(this.translate.instant('usuarioEditadoCorrectamente'));
this.userEdited.emit();
this.dialogRef.close();
this.loading = false;
@ -138,7 +141,7 @@ export class AddUserModalComponent implements OnInit {
} else {
this.http.post(`${this.baseUrl}/users`, payload).subscribe(
(response) => {
this.toastService.success('Usuario añadido correctamente');
this.toastService.success(this.translate.instant('usuarioAnadidoCorrectamente'));
this.userAdded.emit();
this.dialogRef.close();
this.loading = false;

View File

@ -1,3 +1,5 @@
import { inject } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { Component, EventEmitter, Inject, Output } from '@angular/core';
import { FormGroup, FormBuilder, Validators } from '@angular/forms';
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
@ -10,6 +12,7 @@ import {ToastrService} from "ngx-toastr";
styleUrl: './change-password-modal.component.css'
})
export class ChangePasswordModalComponent {
public translate = inject(TranslateService);
@Output() userEdited = new EventEmitter<void>();
userForm: FormGroup;
passwordMismatch: boolean = false;
@ -55,10 +58,10 @@ export class ChangePasswordModalComponent {
next: () => {
this.userEdited.emit();
this.dialogRef.close();
this.toastService.success('Contraseña cambiada con éxito');
this.toastService.success(this.translate.instant('contrasenaCambiadaConExito'));
},
error: (err) => {
console.error('Error changing password:', err);
console.error(this.translate.instant('errorChangingPassword'), err);
this.toastService.error(err.error['hydra:description']);
this.resetPasswordError = err.error.message;
this.updateError = true;
@ -66,7 +69,7 @@ export class ChangePasswordModalComponent {
}
});
} else {
console.error('Form is invalid');
console.error(this.translate.instant('formIsInvalid'));
this.passwordMismatch = this.userForm.hasError('mismatch');
this.updateError = true;
this.loading = false

View File

@ -1,3 +1,5 @@
import { inject } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { Injectable } from '@angular/core';
import {HttpClient, HttpParams} from '@angular/common/http';
@ -9,6 +11,7 @@ import { ConfigService } from '@services/config.service';
providedIn: 'root'
})
export class DataService {
public translate = inject(TranslateService);
baseUrl: string;
private apiUrl: string;
@ -32,7 +35,7 @@ export class DataService {
}
}),
catchError(error => {
console.error('Error fetching users', error);
console.error(this.translate.instant('errorFetchingUsers'), error);
return throwError(error);
})
);
@ -48,7 +51,7 @@ export class DataService {
}
}),
catchError(error => {
console.error('Error fetching user group', error);
console.error(this.translate.instant('errorFetchingUserGroup'), error);
return throwError(error);
})
);
@ -64,7 +67,7 @@ export class DataService {
}
}),
catchError(error => {
console.error('Error fetching user groups', error);
console.error(this.translate.instant('errorFetchingUserGroups'), error);
return throwError(error);
})
);
@ -80,7 +83,7 @@ export class DataService {
}
}),
catchError(error => {
console.error('Error fetching organizational units', error);
console.error(this.translate.instant('errorFetchingOrganizationalUnits'), error);
return throwError(error);
})
);

View File

@ -24,7 +24,7 @@
<div *ngIf="!loading">
<table mat-table [dataSource]="dataSource" class="mat-elevation-z8">
<ng-container *ngFor="let column of columns" [matColumnDef]="column.columnDef">
<th mat-header-cell *matHeaderCellDef> {{ column.header }} </th>
<th mat-header-cell *matHeaderCellDef> {{ column.header | translate }} </th>
<td mat-cell *matCellDef="let user">
<ng-container *ngIf="column.columnDef === 'groupsView'">
<mat-chip>

View File

@ -1,3 +1,5 @@
import { inject } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { Component, OnInit } from '@angular/core';
import { MatTableDataSource } from '@angular/material/table';
import { MatDialog } from '@angular/material/dialog';
@ -13,6 +15,7 @@ import { ConfigService } from '@services/config.service';
styleUrls: ['./users.component.css']
})
export class UsersComponent implements OnInit {
public translate = inject(TranslateService);
baseUrl: string;
private apiUrl: string;
dataSource = new MatTableDataSource<any>();
@ -25,32 +28,32 @@ export class UsersComponent implements OnInit {
columns = [
{
columnDef: 'id',
header: 'ID',
header: 'id',
cell: (user: any) => `${user.id}`
},
{
columnDef: 'username',
header: 'Nombre de Usuario',
header: 'nombreDeUsuario',
cell: (user: any) => `${user.username}`
},
{
columnDef: 'groupsView',
header: 'Vista de Grupos',
header: 'vistaDeGrupos',
cell: (user: any) => `${user.groupsView}`
},
{
columnDef: 'clientsPerPage',
header: 'Clientes por página',
header: 'clientesPorPagina',
cell: (user: any) => user.clientsPerPage != null ? `${user.clientsPerPage}` : '-'
},
{
columnDef: 'allowedOrganizationalUnits',
header: 'Unidades Organizacionales Permitidas',
header: 'unidadesOrganizacionalesPermitidas',
cell: (user: any) => `${user.allowedOrganizationalUnits.map((unit: { name: any; }) => unit.name).join(', ')}`
},
{
columnDef: 'roles',
header: 'Roles',
header: 'roles',
cell: (user: any) => `${user.roles.join(', ')}`
}
];
@ -79,7 +82,7 @@ export class UsersComponent implements OnInit {
this.loading = false;
},
(error) => {
console.error('Error fetching users', error);
console.error(this.translate.instant('errorFetchingUsers'), error);
this.loading = false;
}
);
@ -123,11 +126,11 @@ export class UsersComponent implements OnInit {
this.http.delete(apiUrl).subscribe({
next: () => {
console.log('User deleted successfully');
this.toastService.success('User deleted successfully');
this.toastService.success(this.translate.instant('userDeletedSuccessfully'));
this.search();
},
error: (error) => {
console.error('Error deleting user:', error);
console.error(this.translate.instant('errorDeletingUser'), error);
}
});
}

View File

@ -30,7 +30,7 @@
<table mat-table [dataSource]="dataSource" class="mat-elevation-z8" joyrideStep="tableStep"
text="{{ 'tableStepText' | translate }}">
<ng-container *ngFor="let column of columns" [matColumnDef]="column.columnDef">
<th mat-header-cell *matHeaderCellDef> {{ column.header }} </th>
<th mat-header-cell *matHeaderCellDef> {{ column.header | translate }} </th>
<td mat-cell *matCellDef="let image">
<ng-container *ngIf="column.columnDef === 'isDefault' || column.columnDef === 'installed'">
<mat-icon [color]="image[column.columnDef] ? 'primary' : 'warn'">

View File

@ -1,3 +1,5 @@
import { inject } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { Component, OnInit, signal } from '@angular/core';
import { MatTableDataSource } from "@angular/material/table";
import { DatePipe } from "@angular/common";
@ -17,6 +19,7 @@ import { ConfigService } from '@services/config.service';
styleUrl: './calendar.component.css'
})
export class CalendarComponent implements OnInit {
public translate = inject(TranslateService);
baseUrl: string;
private apiUrl: string;
images: { downloadUrl: string; name: string; uuid: string }[] = [];
@ -34,22 +37,22 @@ export class CalendarComponent implements OnInit {
columns = [
{
columnDef: 'id',
header: 'ID',
header: 'id',
cell: (remoteCalendar: any) => `${remoteCalendar.id}`,
},
{
columnDef: 'name',
header: 'Nombre',
header: 'nombre',
cell: (remoteCalendar: any) => `${remoteCalendar.name}`
},
{
columnDef: 'rulesLength',
header: 'Nº de reglas',
header: 'nDeReglas',
cell: (remoteCalendar: any) => `${remoteCalendar.remoteCalendarRules.length}`
},
{
columnDef: 'createdAt',
header: 'Fecha de creación',
header: 'fechaDeCreacion',
cell: (remoteCalendar: any) => `${this.datePipe.transform(remoteCalendar.createdAt, 'dd/MM/yyyy hh:mm:ss')}`,
}
];
@ -89,7 +92,7 @@ export class CalendarComponent implements OnInit {
this.loading = false;
},
error => {
console.error('Error fetching calendars', error);
console.error(this.translate.instant('errorFetchingCalendars'), error);
this.loading = false;
}
);
@ -99,7 +102,7 @@ export class CalendarComponent implements OnInit {
this.syncUds = true;
this.http.post(`${this.apiUrl}/${calendar.uuid}/sync-uds`, {}).subscribe({
next: () => {
this.toastService.success('Calendarios sincronizados correctamente');
this.toastService.success(this.translate.instant('calendariosSincronizadosCorrectamente'));
this.search();
this.syncUds = false;
},
@ -136,10 +139,10 @@ export class CalendarComponent implements OnInit {
this.http.delete(apiUrl).subscribe({
next: () => {
this.search();
this.toastService.success('Calendar deleted successfully');
this.toastService.success(this.translate.instant('calendarDeletedSuccessfully'));
},
error: () => {
this.toastService.error('Error deleting calendar');
this.toastService.error(this.translate.instant('errorDeletingCalendar'));
}
});
}

View File

@ -1,3 +1,5 @@
import { inject } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { Component, Inject } from '@angular/core';
import { ToastrService } from "ngx-toastr";
import { HttpClient } from "@angular/common/http";
@ -10,6 +12,7 @@ import { ConfigService } from '@services/config.service';
styleUrl: './create-calendar-rule.component.css'
})
export class CreateCalendarRuleComponent {
public translate = inject(TranslateService);
baseUrl: string;
name: string = '';
remoteCalendarRules: any[] = [];
@ -98,7 +101,7 @@ export class CreateCalendarRuleComponent {
this.http.put(`${this.baseUrl}${this.ruleId}`, formData)
.subscribe({
next: (response) => {
this.toastService.success('Calendar rule updated successfully');
this.toastService.success(this.translate.instant('calendarRuleUpdatedSuccessfully'));
this.dialogRef.close(true);
},
error: (error) => {
@ -110,7 +113,7 @@ export class CreateCalendarRuleComponent {
this.http.post(`${this.baseUrl}/remote-calendar-rules`, formData)
.subscribe({
next: (response) => {
this.toastService.success('Calendar rule created successfully');
this.toastService.success(this.translate.instant('calendarRuleCreatedSuccessfully'));
this.dialogRef.close(true);
},
error: (error) => {

View File

@ -1,3 +1,5 @@
import { inject } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { Component, Inject, OnInit } from '@angular/core';
import { ToastrService } from "ngx-toastr";
import { HttpClient } from "@angular/common/http";
@ -13,6 +15,7 @@ import { ConfigService } from '@services/config.service';
styleUrl: './create-calendar.component.css'
})
export class CreateCalendarComponent implements OnInit {
public translate = inject(TranslateService);
baseUrl: string;
name: string = '';
remoteCalendarRules: any[] = [];
@ -50,7 +53,7 @@ export class CreateCalendarComponent implements OnInit {
});
},
error: (err) => {
console.error('Error fetching remote calendar:', err);
console.error(this.translate.instant('errorFetchingRemoteCalendar'), err);
}
});
}
@ -75,7 +78,7 @@ export class CreateCalendarComponent implements OnInit {
this.http.patch(`${this.baseUrl}${this.calendarId}`, payload)
.subscribe({
next: (response) => {
this.toastService.success('Calendar updated successfully');
this.toastService.success(this.translate.instant('calendarUpdatedSuccessfully'));
this.dialogRef.close(true);
this.load()
},
@ -88,7 +91,7 @@ export class CreateCalendarComponent implements OnInit {
this.http.post(`${this.baseUrl}/remote-calendars`, payload)
.subscribe({
next: (response) => {
this.toastService.success('Calendar created successfully');
this.toastService.success(this.translate.instant('calendarCreatedSuccessfully'));
this.dialogRef.close(true);
this.load()
},
@ -129,10 +132,10 @@ export class CreateCalendarComponent implements OnInit {
next: () => {
console.log('Calendar deleted successfully');
this.load();
this.toastService.success('Calendar deleted successfully');
this.toastService.success(this.translate.instant('calendarDeletedSuccessfully'));
},
error: (error) => {
this.toastService.error('Error deleting calendar');
this.toastService.error(this.translate.instant('errorDeletingCalendar'));
}
});
} else {

View File

@ -1,3 +1,5 @@
import { inject } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { Injectable } from '@angular/core';
import { HttpClient, HttpParams } from '@angular/common/http';
import { Observable, throwError } from 'rxjs';
@ -8,6 +10,7 @@ import { ConfigService } from '@services/config.service';
providedIn: 'root'
})
export class DataService {
public translate = inject(TranslateService);
baseUrl: string;
private apiUrl: string;
@ -28,7 +31,7 @@ export class DataService {
}
}),
catchError(error => {
console.error('Error fetching remote calendars', error);
console.error(this.translate.instant('errorFetchingRemoteCalendars'), error);
return throwError(error);
})
);
@ -44,7 +47,7 @@ export class DataService {
}
}),
catchError(error => {
console.error('Error fetching calendar', error);
console.error(this.translate.instant('errorFetchingCalendar'), error);
return throwError(error);
})
);

View File

@ -28,7 +28,7 @@
<div *ngIf="!loading">
<table mat-table [dataSource]="dataSource" class="mat-elevation-z8" joyrideStep="tableStep" text="{{ 'tableStepText' | translate }}">
<ng-container *ngFor="let column of columns" [matColumnDef]="column.columnDef">
<th mat-header-cell *matHeaderCellDef> {{ column.header }} </th>
<th mat-header-cell *matHeaderCellDef> {{ column.header | translate }} </th>
<td mat-cell *matCellDef="let commandGroup">
<ng-container *ngIf="column.columnDef !== 'commands'">
{{ column.cell(commandGroup) }}

View File

@ -1,3 +1,5 @@
import { inject } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { Component, OnInit } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { MatDialog } from '@angular/material/dialog';
@ -16,6 +18,7 @@ import { ConfigService } from '@services/config.service';
styleUrls: ['./commands-groups.component.css']
})
export class CommandsGroupsComponent implements OnInit {
public translate = inject(TranslateService);
baseUrl: string;
private apiUrl: string;
dataSource = new MatTableDataSource<any>();
@ -29,22 +32,22 @@ export class CommandsGroupsComponent implements OnInit {
columns = [
{
columnDef: 'id',
header: 'ID',
header: 'id',
cell: (group: any) => `${group.id}`,
},
{
columnDef: 'name',
header: 'Nombre',
header: 'nombre',
cell: (group: any) => `${group.name}`
},
{
columnDef: 'commands',
header: 'Lista de comandos',
header: 'listaDeComandos',
cell: (group: any) => `${group.commands}`
},
{
columnDef: 'createdAt',
header: 'Fecha de creación',
header: 'fechaDeCreacion',
cell: (group: any) => `${this.datePipe.transform(group.createdAt, 'dd/MM/yyyy hh:mm:ss')}`,
}
];
@ -69,7 +72,7 @@ export class CommandsGroupsComponent implements OnInit {
this.loading = false;
},
(error) => {
console.error('Error fetching command groups', error);
console.error(this.translate.instant('errorFetchingCommandGroups'), error);
this.loading = false;
}
);
@ -103,11 +106,11 @@ export class CommandsGroupsComponent implements OnInit {
if (result) {
this.http.delete(`${this.apiUrl}/${group.uuid}`).subscribe({
next: () => {
this.toastService.success('Grupo de comandos eliminado con éxito');
this.toastService.success(this.translate.instant('grupoDeComandosEliminadoCon'));
this.search();
},
error: (error) => {
console.error('Error al eliminar el grupo de comandos:', error);
console.error(this.translate.instant('errorAlEliminarElGrupo'), error);
}
});
}

View File

@ -1,3 +1,5 @@
import { inject } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { Component, OnInit, Inject } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
@ -11,6 +13,7 @@ import { ConfigService } from '@services/config.service';
styleUrls: ['./create-command-group.component.css']
})
export class CreateCommandGroupComponent implements OnInit {
public translate = inject(TranslateService);
baseUrl: string;
availableCommands: any[] = [];
selectedCommands: any[] = [];
@ -48,7 +51,7 @@ export class CreateCommandGroupComponent implements OnInit {
this.loading = false;
},
(error) => {
console.error('Error fetching available commands', error);
console.error(this.translate.instant('errorFetchingAvailableCommands'), error);
this.loading = false;
}
);
@ -88,23 +91,23 @@ export class CreateCommandGroupComponent implements OnInit {
const groupId = this.data.group.uuid;
this.http.patch(`${this.baseUrl}/command-groups/${groupId}`, payload).subscribe({
next: () => {
this.toastService.success('Grupo de comandos actualizado con éxito');
this.toastService.success(this.translate.instant('grupoDeComandosActualizadoCon'));
this.dialogRef.close();
},
error: (error) => {
console.error('Error actualizando el grupo de comandos', error);
this.toastService.error('Error al actualizar el grupo de comandos');
console.error(this.translate.instant('errorActualizandoElGrupoDe'), error);
this.toastService.error(this.translate.instant('errorAlActualizarElGrupo'));
}
});
} else {
this.http.post(`${this.baseUrl}/command-groups`, payload).subscribe({
next: () => {
this.toastService.success('Grupo de comandos creado con éxito');
this.toastService.success(this.translate.instant('grupoDeComandosCreadoCon'));
this.dialogRef.close();
},
error: (error) => {
console.error('Error creando el grupo de comandos', error);
this.toastService.error('Error al crear el grupo de comandos');
console.error(this.translate.instant('errorCreandoElGrupoDe'), error);
this.toastService.error(this.translate.instant('errorAlCrearElGrupo'));
}
});
}

View File

@ -1,3 +1,5 @@
import { inject } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { Component, Inject, OnInit } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
@ -11,6 +13,7 @@ import { ConfigService } from '@services/config.service';
styleUrls: ['./detail-command-group.component.css']
})
export class DetailCommandGroupComponent implements OnInit {
public translate = inject(TranslateService);
baseUrl: string;
form!: FormGroup;
clients: any[] = [];
@ -45,7 +48,7 @@ export class DetailCommandGroupComponent implements OnInit {
this.loading = false;
},
error: (error) => {
console.error('Error fetching clients:', error);
console.error(this.translate.instant('errorFetchingClients1'), error);
this.loading = false;
}
});
@ -70,11 +73,11 @@ export class DetailCommandGroupComponent implements OnInit {
this.http.post(apiUrl, payload).subscribe({
next: () => {
this.dialogRef.close();
this.toastService.success('Grupo de comandos ejecutado exitosamente');
this.toastService.success(this.translate.instant('grupoDeComandosEjecutadoExitosamente'));
this.loading = false;
},
error: (error) => {
console.error('Error ejecutando grupo de comandos:', error);
console.error(this.translate.instant('errorEjecutandoGrupoDeComandos'), error);
this.loading = false;
}
});

View File

@ -26,7 +26,7 @@
<div *ngIf="!loading">
<table mat-table [dataSource]="tasks" class="mat-elevation-z8" joyrideStep="tableStep" text="{{ 'tableStepText' | translate }}">
<ng-container *ngFor="let column of columns" [matColumnDef]="column.columnDef">
<th mat-header-cell *matHeaderCellDef> {{ column.header }} </th>
<th mat-header-cell *matHeaderCellDef> {{ column.header | translate }} </th>
<td mat-cell *matCellDef="let task">
<ng-container *ngIf="column.columnDef !== 'management' && column.columnDef !== 'scope' && column.columnDef !== 'organizationalUnit'">
{{ column.cell(task) }}

View File

@ -1,3 +1,5 @@
import { inject } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { Component, OnInit } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { MatDialog } from '@angular/material/dialog';
@ -16,6 +18,7 @@ import {DatePipe} from "@angular/common";
styleUrls: ['./commands-task.component.css']
})
export class CommandsTaskComponent implements OnInit {
public translate = inject(TranslateService);
baseUrl: string;
tasks: any[] = [];
filters: { [key: string]: string | boolean } = {};
@ -26,13 +29,13 @@ export class CommandsTaskComponent implements OnInit {
datePipe: DatePipe = new DatePipe('es-ES');
columns = [
{ columnDef: 'id', header: 'ID', cell: (task: any) => task.id },
{ columnDef: 'name', header: 'Nombre de tarea', cell: (task: any) => task.name },
{ columnDef: 'scope', header: 'Ámbito', cell: (task: any) => task.scope },
{ columnDef: 'organizationalUnit', header: 'Unidad Organizativa', cell: (task: any) => task.organizationalUnit?.name || '' },
{ columnDef: 'management', header: 'Gestiones', cell: (task: any) => task.schedules },
{ columnDef: 'nextExecution', header: 'Próxima ejecución', cell: (task: any) => this.datePipe.transform(task.nextExecution, 'dd/MM/yyyy HH:mm:ss') },
{ columnDef: 'createdBy', header: 'Creado por', cell: (task: any) => task.createdBy },
{ columnDef: 'id', header: 'id', cell: (task: any) => task.id },
{ columnDef: 'name', header: 'nombreDeTarea', cell: (task: any) => task.name },
{ columnDef: 'scope', header: 'ambito', cell: (task: any) => task.scope },
{ columnDef: 'organizationalUnit', header: 'unidadOrganizativa', cell: (task: any) => task.organizationalUnit?.name || '' },
{ columnDef: 'management', header: 'gestiones', cell: (task: any) => task.schedules },
{ columnDef: 'nextExecution', header: 'proximaEjecucion', cell: (task: any) => this.datePipe.transform(task.nextExecution, 'dd/MM/yyyy HH:mm:ss') },
{ columnDef: 'createdBy', header: 'creadoPor', cell: (task: any) => task.createdBy },
];
displayedColumns: string[] = ['id', 'name', 'scope', 'management', 'nextExecution', 'createdBy', 'actions'];
@ -65,7 +68,7 @@ export class CommandsTaskComponent implements OnInit {
this.loading = false;
},
(error) => {
console.error('Error fetching tasks', error);
console.error(this.translate.instant('errorFetchingTasks'), error);
this.loading = false;
}
);
@ -133,11 +136,11 @@ export class CommandsTaskComponent implements OnInit {
if (result) {
this.http.delete(`${this.apiUrl}/${task.uuid}`).subscribe({
next: () => {
this.toastService.success('Tarea eliminada con éxito');
this.toastService.success(this.translate.instant('tareaEliminadaConExito'));
this.loadTasks();
},
error: (error) => {
console.error('Error al eliminar la tarea:', error);
console.error(this.translate.instant('errorAlEliminarLaTarea'), error);
}
});
}

View File

@ -1,4 +1,6 @@
import {Component, Inject, OnInit} from '@angular/core';
import { inject } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import {Component, Inject, OnInit } from '@angular/core';
import {FormBuilder, FormGroup} from "@angular/forms";
import {MAT_DIALOG_DATA, MatDialogRef} from "@angular/material/dialog";
import {HttpClient} from "@angular/common/http";
@ -11,12 +13,13 @@ import {ConfigService} from "@services/config.service";
styleUrl: './create-task-schedule.component.css'
})
export class CreateTaskScheduleComponent implements OnInit{
public translate = inject(TranslateService);
form: FormGroup;
baseUrl: string;
apiUrl: string;
recurrenceTypes = [
{ value: 'none', label: 'Sin repetición' },
{ value: 'custom', label: 'Repetición personalizada' }
{ value: 'none', label : this.translate.instant('sinRepeticion') },
{ value: 'custom', label : this.translate.instant('repeticionPersonalizada') }
];
weekDays: string[] = ['monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday'];
isSingleDateSelected: boolean = true;
@ -105,7 +108,7 @@ export class CreateTaskScheduleComponent implements OnInit{
}, {});
},
(error) => {
console.error('Error loading schedule data', error);
console.error(this.translate.instant('errorLoadingScheduleData'), error);
}
);
}
@ -173,12 +176,12 @@ export class CreateTaskScheduleComponent implements OnInit{
const selectedMonthNames = Object.keys(this.selectedMonths).filter(month => this.selectedMonths[month]);
if (selectedDayNames.length === 0) {
this.toastr.error('Debe seleccionar al menos un día de la semana');
this.toastr.error(this.translate.instant('debeSeleccionarAlMenosUn1'));
return;
}
if (selectedMonthNames.length === 0) {
this.toastr.error('Debe seleccionar al menos un mes');
this.toastr.error(this.translate.instant('debeSeleccionarAlMenosUn2'));
return;
}
@ -186,12 +189,12 @@ export class CreateTaskScheduleComponent implements OnInit{
const endDate = formData.recurrenceDetails?.endDate;
if (!initDate || !endDate) {
this.toastr.error('Debe especificar fecha de inicio y fecha de fin');
this.toastr.error(this.translate.instant('debeEspecificarFechaDeInicio'));
return;
}
if (new Date(endDate) <= new Date(initDate)) {
this.toastr.error('La fecha de fin debe ser posterior a la fecha de inicio');
this.toastr.error(this.translate.instant('laFechaDeFinDebe'));
return;
}
}
@ -215,21 +218,21 @@ export class CreateTaskScheduleComponent implements OnInit{
const taskId = this.data.task.uuid;
this.http.patch<any>(`${this.baseUrl}${this.data.schedule['@id']}`, payload).subscribe({
next: () => {
this.toastr.success('Programacion de tarea actualizada con éxito');
this.toastr.success(this.translate.instant('programacionDeTareaActualizadaCon'));
this.dialogRef.close(true);
},
error: () => {
this.toastr.error('Error al actualizar la tarea');
this.toastr.error(this.translate.instant('errorAlActualizarLaTarea'));
}
});
} else {
this.http.post<any>(this.apiUrl, payload).subscribe({
next: () => {
this.toastr.success('Programacion de tarea creada con éxito');
this.toastr.success(this.translate.instant('programacionDeTareaCreadaCon'));
this.dialogRef.close(true);
},
error: () => {
this.toastr.error('Error al crear la tarea');
this.toastr.error(this.translate.instant('errorAlCrearLaTarea'));
}
});
}

View File

@ -200,7 +200,7 @@ export class CreateTaskScriptComponent implements OnInit {
saveNewScript(): void {
if (!this.newScript.trim()) {
this.toastService.error('Debe ingresar un script antes de guardar.');
this.toastService.error(this.translate.instant('debeIngresarUnScriptAntes'));
return;
}
const dialogRef = this.dialog.open(SaveScriptComponent, {
@ -209,7 +209,7 @@ export class CreateTaskScriptComponent implements OnInit {
});
dialogRef.afterClosed().subscribe(result => {
if (result) {
this.toastService.success('Script guardado correctamente');
this.toastService.success(this.translate.instant('scriptGuardadoCorrectamente'));
}
});
}
@ -244,7 +244,7 @@ export class CreateTaskScriptComponent implements OnInit {
break;
default:
this.toastService.error('Tipo de acción no reconocido');
this.toastService.error(this.translate.instant('tipoDeAccionNoReconocido'));
return;
}
@ -269,12 +269,12 @@ export class CreateTaskScriptComponent implements OnInit {
private validateScript(): boolean {
if (this.commandType === 'new') {
if (!this.newScript.trim()) {
this.toastService.error('Debe ingresar un script');
this.toastService.error(this.translate.instant('debeIngresarUnScript'));
return false;
}
} else if (this.commandType === 'existing') {
if (!this.selectedScript) {
this.toastService.error('Debe seleccionar un script');
this.toastService.error(this.translate.instant('debeSeleccionarUnScript'));
return false;
}
}

View File

@ -1,3 +1,5 @@
import { inject } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { Component, OnInit, Inject } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import {MAT_DIALOG_DATA, MatDialog, MatDialogRef} from '@angular/material/dialog';
@ -15,6 +17,7 @@ import {ShowTaskScriptComponent} from "../show-task-script/show-task-script.comp
styleUrls: ['./create-task.component.css']
})
export class CreateTaskComponent implements OnInit {
public translate = inject(TranslateService);
baseUrl: string;
taskForm: FormGroup;
availableCommandGroups: any[] = [];
@ -109,7 +112,7 @@ export class CreateTaskComponent implements OnInit {
resolve();
},
(error) => {
this.toastr.error('Error al cargar los datos de la tarea');
this.toastr.error(this.translate.instant('errorAlCargarLosDatos'));
reject(error);
}
);
@ -124,7 +127,7 @@ export class CreateTaskComponent implements OnInit {
resolve();
},
(error) => {
this.toastr.error('Error al cargar las tareas existentes');
this.toastr.error(this.translate.instant('errorAlCargarLasTareas'));
reject(error);
}
);
@ -137,7 +140,7 @@ export class CreateTaskComponent implements OnInit {
this.selectedClients = [...this.data.selectedClients];
this.clients = [...this.data.selectedClients];
} else {
this.toastr.error('No hay clientes pre-seleccionados para este ámbito');
this.toastr.error(this.translate.instant('noHayClientesPreseleccionadosPara'));
this.taskForm.get('scope')?.setValue('');
return;
}
@ -168,7 +171,7 @@ export class CreateTaskComponent implements OnInit {
this.availableOrganizationalUnits = filteredUnits;
resolve();
}, error => {
this.toastr.error('Error al filtrar las unidades organizacionales');
this.toastr.error(this.translate.instant('errorAlFiltrarLasUnidades'));
reject(error);
});
})
@ -187,7 +190,7 @@ export class CreateTaskComponent implements OnInit {
resolve();
},
(error) => {
this.toastr.error('Error al cargar los grupos de comandos');
this.toastr.error(this.translate.instant('errorAlCargarLosGrupos'));
reject(error);
});
});
@ -201,7 +204,7 @@ export class CreateTaskComponent implements OnInit {
resolve();
},
(error) => {
this.toastr.error('Error al cargar los comandos individuales');
this.toastr.error(this.translate.instant('errorAlCargarLosComandos'));
reject(error);
});
});
@ -216,7 +219,7 @@ export class CreateTaskComponent implements OnInit {
resolve();
},
(error) => {
this.toastr.error('Error al cargar las unidades organizacionales');
this.toastr.error(this.translate.instant('errorAlCargarLasUnidades'));
reject(error);
}
);
@ -225,12 +228,12 @@ export class CreateTaskComponent implements OnInit {
addToExistingTask() {
if (!this.selectedExistingTask) {
this.toastr.error('Debes seleccionar una tarea existente.');
this.toastr.error(this.translate.instant('debesSeleccionarUnaTareaExistente'));
return;
}
if (this.executionOrder == null || this.executionOrder < 1) {
this.toastr.error('Debes introducir un orden de ejecución válido (mayor que 0).');
this.toastr.error(this.translate.instant('debesIntroducirUnOrdenDe'));
return;
}
@ -239,14 +242,14 @@ export class CreateTaskComponent implements OnInit {
executionOrder: this.executionOrder
};
this.toastr.success('Tarea actualizada con éxito');
this.toastr.success(this.translate.instant('tareaActualizadaConExito'));
this.dialogRef.close(data);
}
saveTask(): void {
if (this.taskForm.invalid) {
this.toastr.error('Por favor, rellene todos los campos obligatorios');
this.toastr.error(this.translate.instant('porFavorRelleneTodosLos'));
return;
}
@ -254,12 +257,12 @@ export class CreateTaskComponent implements OnInit {
const scope = formData.scope;
if (scope === 'clients' && this.selectedClients.length === 0) {
this.toastr.error('Debe seleccionar al menos un cliente');
this.toastr.error(this.translate.instant('debeSeleccionarAlMenosUn'));
return;
}
if (scope !== 'clients' && !formData.organizationalUnit) {
this.toastr.error('Debe seleccionar una unidad organizativa');
this.toastr.error(this.translate.instant('debeSeleccionarUnaUnidadOrganizativa'));
return;
}
@ -280,17 +283,17 @@ export class CreateTaskComponent implements OnInit {
const taskId = this.data.task.uuid;
this.http.patch<any>(`${this.apiUrl}/${taskId}`, payload).subscribe({
next: () => {
this.toastr.success('Tarea actualizada con éxito');
this.toastr.success(this.translate.instant('tareaActualizadaConExito'));
this.dialogRef.close(true);
},
error: () => {
this.toastr.error('Error al actualizar la tarea');
this.toastr.error(this.translate.instant('errorAlActualizarLaTarea'));
}
});
} else {
this.http.post<any>(this.apiUrl, payload).subscribe({
next: response => {
this.toastr.success('Tarea creada con éxito');
this.toastr.success(this.translate.instant('tareaCreadaConExito'));
this.dialogRef.close(response);
if (this.data?.source === 'assistant') {
if (formData.scheduleAfterCreate) {
@ -301,7 +304,7 @@ export class CreateTaskComponent implements OnInit {
}
},
error: () => {
this.toastr.error('Error al crear la tarea');
this.toastr.error(this.translate.instant('errorAlCrearLaTarea'));
}
});
}
@ -313,7 +316,7 @@ export class CreateTaskComponent implements OnInit {
data: { task: task }
}).afterClosed().subscribe(result => {
if (result) {
this.toastr.success('Tarea programada correctamente');
this.toastr.success(this.translate.instant('tareaProgramadaCorrectamente'));
}
});
}
@ -334,7 +337,7 @@ export class CreateTaskComponent implements OnInit {
data: { task: task }
}).afterClosed().subscribe(result => {
if (result) {
this.toastr.success('Tarea programada correctamente');
this.toastr.success(this.translate.instant('tareaProgramadaCorrectamente'));
}
});
}

View File

@ -26,7 +26,7 @@
<app-loading [isLoading]="loading"></app-loading>
<table *ngIf="!loading" mat-table [dataSource]="dataSource" class="mat-elevation-z8">
<ng-container *ngFor="let column of columns" [matColumnDef]="column.columnDef">
<th mat-header-cell *matHeaderCellDef> {{ column.header }} </th>
<th mat-header-cell *matHeaderCellDef> {{ column.header | translate }} </th>
<td mat-cell *matCellDef="let schedule">
<ng-container *ngIf="column.columnDef === 'recurrenceType'">

View File

@ -1,4 +1,6 @@
import {Component, Inject, OnInit} from '@angular/core';
import { inject } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import {Component, Inject, OnInit } from '@angular/core';
import {MatTableDataSource} from "@angular/material/table";
import {Client} from "../../../groups/model/model";
import {ToastrService} from "ngx-toastr";
@ -15,6 +17,7 @@ import {DatePipe} from "@angular/common";
styleUrl: './show-task-schedule.component.css'
})
export class ShowTaskScheduleComponent implements OnInit{
public translate = inject(TranslateService);
baseUrl: string;
dataSource = new MatTableDataSource<any>([]);
length = 0;
@ -26,13 +29,13 @@ export class ShowTaskScheduleComponent implements OnInit{
datePipe: DatePipe = new DatePipe('es-ES');
columns = [
{ columnDef: 'id', header: 'ID', cell: (schedule: any) => schedule.id },
{ columnDef: 'recurrenceType', header: 'Tipo de Programación', cell: (schedule: any) => this.getRecurrenceTypeDisplay(schedule) },
{ columnDef: 'executionTime', header: 'Hora de ejecución', cell: (schedule: any) => this.formatExecutionTimeForDisplay(schedule.executionTime) },
{ columnDef: 'nextExecution', header: 'Próxima ejecución', cell: (schedule: any) => this.calculateNextExecution(schedule) },
{ columnDef: 'daysOfWeek', header: 'Días de la semana', cell: (schedule: any) => this.formatDaysOfWeek(schedule.recurrenceDetails?.daysOfWeek) },
{ columnDef: 'months', header: 'Meses', cell: (schedule: any) => this.formatMonths(schedule.recurrenceDetails?.months) },
{ columnDef: 'enabled', header: 'Estado', cell: (schedule: any) => schedule.enabled }
{ columnDef: 'id', header: 'id', cell: (schedule: any) => schedule.id },
{ columnDef: 'recurrenceType', header: 'tipoDeProgramacion', cell: (schedule: any) => this.getRecurrenceTypeDisplay(schedule) },
{ columnDef: 'executionTime', header: 'horaDeEjecucion', cell: (schedule: any) => this.formatExecutionTimeForDisplay(schedule.executionTime) },
{ columnDef: 'nextExecution', header: 'proximaEjecucion', cell: (schedule: any) => this.calculateNextExecution(schedule) },
{ columnDef: 'daysOfWeek', header: 'diasDeLaSemana', cell: (schedule: any) => this.formatDaysOfWeek(schedule.recurrenceDetails?.daysOfWeek) },
{ columnDef: 'months', header: 'meses', cell: (schedule: any) => this.formatMonths(schedule.recurrenceDetails?.months) },
{ columnDef: 'enabled', header: 'estado', cell: (schedule: any) => schedule.enabled }
];
displayedColumns: string[] = ['id', 'recurrenceType', 'executionTime', 'nextExecution', 'daysOfWeek', 'months', 'enabled', 'actions'];
@ -67,7 +70,7 @@ export class ShowTaskScheduleComponent implements OnInit{
},
(error) => {
this.loading = false;
this.toastService.error('Error al cargar las programaciones');
this.toastService.error(this.translate.instant('errorAlCargarLasProgramaciones'));
}
);
}
@ -79,7 +82,7 @@ export class ShowTaskScheduleComponent implements OnInit{
}).afterClosed().subscribe(result => {
if (result) {
this.loadData();
this.toastService.success('Programación creada correctamente');
this.toastService.success(this.translate.instant('programacionCreadaCorrectamente'));
}
});
}
@ -91,7 +94,7 @@ export class ShowTaskScheduleComponent implements OnInit{
}).afterClosed().subscribe(result => {
if (result) {
this.loadData();
this.toastService.success('Programación actualizada correctamente');
this.toastService.success(this.translate.instant('programacionActualizadaCorrectamente'));
}
});
}
@ -106,7 +109,7 @@ export class ShowTaskScheduleComponent implements OnInit{
if (result) {
this.http.delete(`${this.baseUrl}${schedule['@id']}`).subscribe(
() => {
this.toastService.success('Programación eliminada correctamente');
this.toastService.success(this.translate.instant('programacionEliminadaCorrectamente'));
this.loadData();
},
(error) => {
@ -317,7 +320,7 @@ export class ShowTaskScheduleComponent implements OnInit{
if (schedule.recurrenceType === 'none') {
return {
type: 'none',
label: 'Ejecución única',
label : this.translate.instant('ejecucionUnica'),
icon: 'event',
color: 'primary',
details: schedule.executionDate ?

View File

@ -1,4 +1,6 @@
import {Component, Inject, OnInit} from '@angular/core';
import { inject } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import {Component, Inject, OnInit } from '@angular/core';
import {MatTableDataSource} from "@angular/material/table";
import {ToastrService} from "ngx-toastr";
import {HttpClient} from "@angular/common/http";
@ -15,6 +17,7 @@ import {ViewParametersModalComponent} from "./view-parameters-modal/view-paramet
styleUrl: './show-task-script.component.css'
})
export class ShowTaskScriptComponent implements OnInit{
public translate = inject(TranslateService);
baseUrl: string;
dataSource = new MatTableDataSource<any>([]);
length = 0;
@ -25,26 +28,26 @@ export class ShowTaskScriptComponent implements OnInit{
filters: { [key: string]: string } = {};
columns = [
{ columnDef: 'id', header: 'ID', cell: (item: any) => item.id },
{ columnDef: 'order', header: 'Orden', cell: (item: any) => item.order },
{ columnDef: 'type', header: 'Tipo', cell: (item: any) => item.type },
{ columnDef: 'parameters', header: 'Parámetros', cell: (item: any) => item.parameters },
{ columnDef: 'content', header: 'Contenido', cell: (item: any) => item.content },
{ columnDef: 'id', header: 'id', cell: (item: any) => item.id },
{ columnDef: 'order', header: 'orden', cell: (item: any) => item.order },
{ columnDef: 'type', header: 'tipo', cell: (item: any) => item.type },
{ columnDef: 'parameters', header: 'parametros', cell: (item: any) => item.parameters },
{ columnDef: 'content', header: 'contenido', cell: (item: any) => item.content },
];
displayedColumns: string[] = ['order', 'type', 'content', 'parameters', 'actions'];
typeLabels: { [key: string]: { label: string, icon: string } } = {
'partition-and-format': { label: 'Particionar y formatear', icon: 'storage' },
'partition-assistant': { label: 'Asistente de particionado', icon: 'storage' },
'deploy-image': { label: 'Desplegar imagen', icon: 'cloud_download' },
'create-image': { label: 'Crear imagen', icon: 'cloud_upload' },
'run-script': { label: 'Ejecutar script', icon: 'code' },
'partition-and-format': { label : this.translate.instant('particionarYFormatear'), icon: 'storage' },
'partition-assistant': { label : this.translate.instant('asistenteDeParticionado'), icon: 'storage' },
'deploy-image': { label : this.translate.instant('desplegarImagen'), icon: 'cloud_download' },
'create-image': { label : this.translate.instant('crearImagen'), icon: 'cloud_upload' },
'run-script': { label : this.translate.instant('ejecutarScript'), icon: 'code' },
'reboot': { label: 'Reiniciar', icon: 'restart_alt' },
'shutdown': { label: 'Apagar', icon: 'power_off' },
'poweron': { label: 'Encender', icon: 'power' },
'power-on': { label: 'Encender', icon: 'power' },
'login': { label: 'Iniciar sesión', icon: 'login' },
'login': { label : this.translate.instant('iniciarSesion'), icon: 'login' },
};
getTypeDisplay(type: string): { label: string, icon: string } {
@ -94,7 +97,7 @@ export class ShowTaskScriptComponent implements OnInit{
if (result) {
this.http.delete(`${this.baseUrl}${schedule['@id']}`).subscribe(
() => {
this.toastService.success('Eliminado correctamente');
this.toastService.success(this.translate.instant('eliminadoCorrectamente'));
this.loadData();
},
(error) => {

View File

@ -26,7 +26,7 @@
<div *ngIf="!loading">
<table mat-table [dataSource]="dataSource" class="mat-elevation-z8" joyrideStep="tableStep" text="{{ 'tableStepText' | translate }}">
<ng-container *ngFor="let column of columns" [matColumnDef]="column.columnDef">
<th mat-header-cell *matHeaderCellDef> {{ column.header }} </th>
<th mat-header-cell *matHeaderCellDef> {{ column.header | translate }} </th>
<td mat-cell *matCellDef="let command">
<ng-container *ngIf="column.columnDef !== 'readOnly'">
{{ column.cell(command) }}

View File

@ -1,3 +1,5 @@
import { inject } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { Component, OnInit } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { MatDialog } from '@angular/material/dialog';
@ -16,6 +18,7 @@ import { JoyrideService } from 'ngx-joyride';
styleUrls: ['./commands.component.css']
})
export class CommandsComponent implements OnInit {
public translate = inject(TranslateService);
baseUrl: string;
private apiUrl: string;
dataSource = new MatTableDataSource<any>();
@ -29,22 +32,22 @@ export class CommandsComponent implements OnInit {
columns = [
{
columnDef: 'id',
header: 'ID',
header: 'id',
cell: (command: any) => `${command.id}`,
},
{
columnDef: 'name',
header: 'Nombre',
header: 'nombre',
cell: (command: any) => `${command.name}`
},
{
columnDef: 'readOnly',
header: 'Solo Lectura',
header: 'soloLectura',
cell: (command: any) => `${command.readOnly}`
},
{
columnDef: 'createdAt',
header: 'Fecha de creación',
header: 'fechaDeCreacion',
cell: (command: any) => `${this.datePipe.transform(command.createdAt, 'dd/MM/yyyy hh:mm:ss')}`,
}
];
@ -69,7 +72,7 @@ export class CommandsComponent implements OnInit {
this.loading = false;
},
(error) => {
console.error('Error fetching commands', error);
console.error(this.translate.instant('errorFetchingCommands'), error);
this.loading = false;
}
);
@ -106,11 +109,11 @@ export class CommandsComponent implements OnInit {
if (result) {
this.http.delete(`${this.apiUrl}/${command.uuid}`).subscribe({
next: () => {
this.toastService.success('Comando eliminado con éxito');
this.toastService.success(this.translate.instant('comandoEliminadoConExito'));
this.search();
},
error: (error) => {
console.error('Error al eliminar el comando:', error);
console.error(this.translate.instant('errorAlEliminarElComando'), error);
}
});
}

View File

@ -1,4 +1,6 @@
import {Component, Inject, OnInit} from '@angular/core';
import { inject } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import {Component, Inject, OnInit } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
import { HttpClient } from '@angular/common/http';
@ -12,6 +14,7 @@ import { ConfigService } from "@services/config.service";
styleUrls: ['./create-command.component.css']
})
export class CreateCommandComponent implements OnInit{
public translate = inject(TranslateService);
baseUrl: string;
createCommandForm: FormGroup<any>;
commandId: string | null = null;
@ -56,7 +59,7 @@ export class CreateCommandComponent implements OnInit{
this.commandId = response['@id'];
},
error: (err) => {
console.error('Error fetching remote calendar:', err);
console.error(this.translate.instant('errorFetchingRemoteCalendar'), err);
}
});
}
@ -81,7 +84,7 @@ export class CreateCommandComponent implements OnInit{
if (this.commandId) {
this.http.put(`${this.baseUrl}${this.commandId}`, payload).subscribe(
(response) => {
this.toastService.success('Comando editado correctamente');
this.toastService.success(this.translate.instant('comandoEditadoCorrectamente'));
this.dialogRef.close();
},
(error) => {
@ -91,7 +94,7 @@ export class CreateCommandComponent implements OnInit{
} else {
this.http.post(`${this.baseUrl}/commands`, payload).subscribe(
(response) => {
this.toastService.success('Comando añadido correctamente');
this.toastService.success(this.translate.instant('comandoAnadidoCorrectamente'));
this.dialogRef.close();
},
(error) => {

View File

@ -1,3 +1,5 @@
import { inject } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { ConfigService } from '@services/config.service';
import { Injectable } from '@angular/core';
import { HttpClient, HttpParams } from '@angular/common/http';
@ -8,6 +10,7 @@ import { catchError, map } from 'rxjs/operators';
providedIn: 'root'
})
export class DataService {
public translate = inject(TranslateService);
baseUrl: string;
private apiUrl: string;
@ -34,7 +37,7 @@ export class DataService {
}
}),
catchError(error => {
console.error('Error fetching commands', error);
console.error(this.translate.instant('errorFetchingCommands'), error);
return throwError(error);
})
);
@ -50,7 +53,7 @@ export class DataService {
}
}),
catchError(error => {
console.error('Error fetching user group', error);
console.error(this.translate.instant('errorFetchingUserGroup'), error);
return throwError(error);
})
);

View File

@ -1,3 +1,5 @@
import { inject } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { Component, Inject, OnInit } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { MAT_DIALOG_DATA, MatDialog, MatDialogRef } from '@angular/material/dialog';
@ -12,6 +14,7 @@ import { ConfigService } from '@services/config.service';
styleUrls: ['./command-detail.component.css']
})
export class CommandDetailComponent implements OnInit {
public translate = inject(TranslateService);
baseUrl: string;
form!: FormGroup;
clients: any[] = [];
@ -56,7 +59,7 @@ export class CommandDetailComponent implements OnInit {
dialogRef.afterClosed().subscribe(result => {
if (result) {
this.toastService.success('Comando editado');
this.toastService.success(this.translate.instant('comandoEditado'));
this.data.command = result;
}
});

View File

@ -68,7 +68,7 @@
</ng-container>
<ng-container *ngFor="let column of columns" [matColumnDef]="column.columnDef">
<th mat-header-cell *matHeaderCellDef> {{ column.header }} </th>
<th mat-header-cell *matHeaderCellDef> {{ column.header | translate }} </th>
<td mat-cell *matCellDef="let image">
<ng-container *ngIf="column.columnDef !== 'size'">
{{ column.cell(image) }}

View File

@ -1,3 +1,5 @@
import { inject } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { Component, Inject, OnInit } from '@angular/core';
import { MAT_DIALOG_DATA, MatDialogRef } from "@angular/material/dialog";
import { MatTableDataSource } from "@angular/material/table";
@ -11,6 +13,7 @@ import { ToastrService } from "ngx-toastr";
styleUrl: './boot-so-partition.component.css'
})
export class BootSoPartitionComponent implements OnInit {
public translate = inject(TranslateService);
baseUrl: string;
selectedPartition: any = null;
dataSource = new MatTableDataSource<any>();
@ -24,32 +27,32 @@ export class BootSoPartitionComponent implements OnInit {
columns = [
{
columnDef: 'diskNumber',
header: 'Disco',
header: 'disco',
cell: (partition: any) => partition.diskNumber
},
{
columnDef: 'partitionNumber',
header: 'Particion',
header: 'particion',
cell: (partition: any) => partition.partitionNumber
},
{
columnDef: 'size',
header: 'Tamaño',
header: 'tamano',
cell: (partition: any) => `${partition.size} MB`
},
{
columnDef: 'partitionCode',
header: 'Tipo de partición',
header: 'tipoDeParticion',
cell: (partition: any) => partition.partitionCode
},
{
columnDef: 'filesystem',
header: 'Sistema de ficheros',
header: 'sistemaDeFicheros',
cell: (partition: any) => partition.filesystem
},
{
columnDef: 'operativeSystem',
header: 'SO',
header: 'so',
cell: (partition: any) => partition.operativeSystem?.name
}
];
@ -92,7 +95,7 @@ export class BootSoPartitionComponent implements OnInit {
}
},
(error) => {
console.error('Error al cargar los datos del cliente:', error);
console.error(this.translate.instant('errorAlCargarLosDatos1'), error);
}
);
}
@ -133,7 +136,7 @@ export class BootSoPartitionComponent implements OnInit {
partition: this.selectedPartition['@id']
}).subscribe(
response => {
this.toastService.success('Cliente actualizado correctamente');
this.toastService.success(this.translate.instant('clienteActualizadoCorrectamente'));
this.dialogRef.close();
this.loading = false;
},

View File

@ -1,3 +1,5 @@
import { inject } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { Component, Input, OnInit } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Router } from "@angular/router";
@ -15,6 +17,7 @@ import {SoftwareProfilePartitionComponent} from "./software-profile-partition/so
styleUrls: ['./execute-command.component.css']
})
export class ExecuteCommandComponent implements OnInit {
public translate = inject(TranslateService);
@Input() runScriptContext: any = null;
@Input() clientState: string = 'off';
@Input() clientData: any[] = [];
@ -197,7 +200,7 @@ export class ExecuteCommandComponent implements OnInit {
clients: this.clientData.map((client: any) => client['@id'])
}).subscribe(
response => {
this.toastService.success('Cliente actualizado correctamente');
this.toastService.success(this.translate.instant('clienteActualizadoCorrectamente'));
},
error => {
this.toastService.error(error.error['hydra:description'] || 'Error de conexión con el cliente');
@ -210,7 +213,7 @@ export class ExecuteCommandComponent implements OnInit {
clients: this.clientData.map((client: any) => client['@id'])
}).subscribe(
response => {
this.toastService.success('Petición de refresco enviada correctamente');
this.toastService.success(this.translate.instant('peticionDeRefrescoEnviadaCorrectamente'));
},
error => {
this.toastService.error(error.error['hydra:description'] || 'Error de conexión con el cliente');
@ -237,7 +240,7 @@ export class ExecuteCommandComponent implements OnInit {
dialogRef.afterClosed().subscribe(result => {
if (result) {
this.toastService.success('Petición de arranque de SO enviada correctamente');
this.toastService.success(this.translate.instant('peticionDeArranqueDeSo'));
}
});
}
@ -261,14 +264,14 @@ export class ExecuteCommandComponent implements OnInit {
dialogRef.afterClosed().subscribe(result => {
if (result) {
this.toastService.success('Petición de borrado de caché de imagen enviada correctamente');
this.toastService.success(this.translate.instant('peticionDeBorradoDeCache'));
}
});
}
hardwareInventory(): void {
if (this.clientData.length === 0) {
this.toastService.error('No hay clientes seleccionados');
this.toastService.error(this.translate.instant('noHayClientesSeleccionados'));
return;
}
@ -278,7 +281,7 @@ export class ExecuteCommandComponent implements OnInit {
clients: this.clientData.map((client: any) => client['@id'])
}).subscribe(
response => {
this.toastService.success('Inventario de hardware actualizado correctamente');
this.toastService.success(this.translate.instant('inventarioDeHardwareActualizadoCorrectamente'));
},
error => {
this.toastService.error(error.error['hydra:description'] || 'Error de conexión con el cliente');
@ -288,7 +291,7 @@ export class ExecuteCommandComponent implements OnInit {
softwareInventory(): void {
if (this.clientData.length === 0) {
this.toastService.error('No hay clientes seleccionados');
this.toastService.error(this.translate.instant('noHayClientesSeleccionados'));
return;
}
@ -320,7 +323,7 @@ export class ExecuteCommandComponent implements OnInit {
clients: this.clientData.map((client: any) => client['@id'])
}).subscribe(
response => {
this.toastService.success('Petición de encendido enviada correctamente');
this.toastService.success(this.translate.instant('peticionDeEncendidoEnviadaCorrectamente'));
},
error => {
this.toastService.error(error.error['hydra:description'] || 'Error de conexión con el cliente');
@ -333,7 +336,7 @@ export class ExecuteCommandComponent implements OnInit {
clients: this.clientData.map((client: any) => client['@id'])
}).subscribe(
response => {
this.toastService.success('Petición de apagado enviada correctamente');
this.toastService.success(this.translate.instant('peticionDeApagadoEnviadaCorrectamente'));
},
error => {
this.toastService.error(error.error['hydra:description'] || 'Error de conexión con el cliente');
@ -404,7 +407,7 @@ export class ExecuteCommandComponent implements OnInit {
deleteClientLease(): void {
if (this.clientData.length === 0) {
this.toastService.error('No hay clientes seleccionados');
this.toastService.error(this.translate.instant('noHayClientesSeleccionados'));
return;
}
@ -415,11 +418,11 @@ export class ExecuteCommandComponent implements OnInit {
Promise.allSettled(requests).then(results => {
const errors = results.filter(r => r.status === 'rejected');
if (errors.length === 0) {
this.toastService.success('Lease(s) DHCP eliminada(s) correctamente');
this.toastService.success(this.translate.instant('leasesDhcpEliminadasCorrectamente'));
} else if (errors.length < results.length) {
this.toastService.warning(`${results.length - errors.length} lease(s) eliminada(s), ${errors.length} con error`);
} else {
this.toastService.error('Error al eliminar las leases DHCP');
this.toastService.error(this.translate.instant('errorAlEliminarLasLeases'));
}
});
}

View File

@ -68,7 +68,7 @@
</ng-container>
<ng-container *ngFor="let column of columns" [matColumnDef]="column.columnDef">
<th mat-header-cell *matHeaderCellDef> {{ column.header }} </th>
<th mat-header-cell *matHeaderCellDef> {{ column.header | translate }} </th>
<td mat-cell *matCellDef="let image">
<ng-container *ngIf="column.columnDef !== 'size' && column.columnDef !== 'operativeSystem'">
{{ column.cell(image) }}

View File

@ -1,4 +1,6 @@
import {Component, Inject} from '@angular/core';
import { inject } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import {Component, Inject } from '@angular/core';
import {MatTableDataSource} from "@angular/material/table";
import {MAT_DIALOG_DATA, MatDialogRef} from "@angular/material/dialog";
import {ConfigService} from "@services/config.service";
@ -11,6 +13,7 @@ import {ToastrService} from "ngx-toastr";
styleUrl: './remove-cache-image.component.css'
})
export class RemoveCacheImageComponent {
public translate = inject(TranslateService);
baseUrl: string;
selectedPartition: any = null;
dataSource = new MatTableDataSource<any>();
@ -24,32 +27,32 @@ export class RemoveCacheImageComponent {
columns = [
{
columnDef: 'diskNumber',
header: 'Disco',
header: 'disco',
cell: (partition: any) => partition.diskNumber
},
{
columnDef: 'partitionNumber',
header: 'Particion',
header: 'particion',
cell: (partition: any) => partition.partitionNumber
},
{
columnDef: 'size',
header: 'Tamaño',
header: 'tamano',
cell: (partition: any) => `${partition.size} MB`
},
{
columnDef: 'partitionCode',
header: 'Tipo de partición',
header: 'tipoDeParticion',
cell: (partition: any) => partition.partitionCode
},
{
columnDef: 'filesystem',
header: 'Sistema de ficheros',
header: 'sistemaDeFicheros',
cell: (partition: any) => partition.filesystem
},
{
columnDef: 'operativeSystem',
header: 'SO',
header: 'so',
cell: (partition: any) => partition.operativeSystem?.name
}
];
@ -100,7 +103,7 @@ export class RemoveCacheImageComponent {
}
},
(error) => {
console.error('Error al cargar los datos del cliente:', error);
console.error(this.translate.instant('errorAlCargarLosDatos1'), error);
}
);
}
@ -141,7 +144,7 @@ export class RemoveCacheImageComponent {
partition: this.selectedPartition['@id']
}).subscribe(
response => {
this.toastService.success('Cliente actualizado correctamente');
this.toastService.success(this.translate.instant('clienteActualizadoCorrectamente'));
this.dialogRef.close();
this.loading = false;
},

View File

@ -20,7 +20,7 @@
</ng-container>
<ng-container *ngFor="let column of columns" [matColumnDef]="column.columnDef">
<th mat-header-cell *matHeaderCellDef> {{ column.header }} </th>
<th mat-header-cell *matHeaderCellDef> {{ column.header | translate }} </th>
<td mat-cell *matCellDef="let image">
<ng-container *ngIf="column.columnDef !== 'size' && column.columnDef !== 'operativeSystem'">
{{ column.cell(image) }}

View File

@ -1,4 +1,6 @@
import {Component, Inject, OnInit} from '@angular/core';
import { inject } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import {Component, Inject, OnInit } from '@angular/core';
import {MatTableDataSource} from "@angular/material/table";
import {MAT_DIALOG_DATA, MatDialogRef} from "@angular/material/dialog";
import {ConfigService} from "@services/config.service";
@ -11,6 +13,7 @@ import {ToastrService} from "ngx-toastr";
styleUrl: './software-profile-partition.component.css'
})
export class SoftwareProfilePartitionComponent implements OnInit{
public translate = inject(TranslateService);
baseUrl: string;
selectedPartition: any = null;
dataSource = new MatTableDataSource<any>();
@ -24,32 +27,32 @@ export class SoftwareProfilePartitionComponent implements OnInit{
columns = [
{
columnDef: 'diskNumber',
header: 'Disco',
header: 'disco',
cell: (partition: any) => partition.diskNumber
},
{
columnDef: 'partitionNumber',
header: 'Particion',
header: 'particion',
cell: (partition: any) => partition.partitionNumber
},
{
columnDef: 'size',
header: 'Tamaño',
header: 'tamano',
cell: (partition: any) => `${partition.size} MB`
},
{
columnDef: 'partitionCode',
header: 'Tipo de partición',
header: 'tipoDeParticion',
cell: (partition: any) => partition.partitionCode
},
{
columnDef: 'filesystem',
header: 'Sistema de ficheros',
header: 'sistemaDeFicheros',
cell: (partition: any) => partition.filesystem
},
{
columnDef: 'operativeSystem',
header: 'SO',
header: 'so',
cell: (partition: any) => partition.operativeSystem?.name
}
];
@ -80,7 +83,7 @@ export class SoftwareProfilePartitionComponent implements OnInit{
}
},
(error) => {
console.error('Error al cargar los datos del cliente:', error);
console.error(this.translate.instant('errorAlCargarLosDatos1'), error);
}
);
}
@ -96,7 +99,7 @@ export class SoftwareProfilePartitionComponent implements OnInit{
partition: this.selectedPartition['@id'],
}).subscribe(
response => {
this.toastService.success('Inventario de software actualizado correctamente');
this.toastService.success(this.translate.instant('inventarioDeSoftwareActualizadoCorrectamente'));
this.dialogRef.close(response);
},
error => {

View File

@ -1,3 +1,5 @@
import { inject } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { HttpClient } from '@angular/common/http';
import { Component, OnInit } from '@angular/core';
import { ConfigService } from '@services/config.service';
@ -9,6 +11,7 @@ import { ToastrService } from "ngx-toastr";
styleUrl: './global-status.component.css'
})
export class GlobalStatusComponent implements OnInit {
public translate = inject(TranslateService);
baseUrl: string;
loading: boolean = false;
loadingDhcps: boolean = false;
@ -81,7 +84,7 @@ export class GlobalStatusComponent implements OnInit {
const timeoutId = setTimeout(() => {
if (!hasError) {
this.toastService.error('Error al sincronizar las subredes: tiempo de espera agotado');
this.toastService.error(this.translate.instant('errorAlSincronizarLasSubredes'));
hasError = true;
}
}, 5000);
@ -92,7 +95,7 @@ export class GlobalStatusComponent implements OnInit {
pending--;
if (pending === 0 && !hasError) {
clearTimeout(timeoutId);
this.toastService.success('Sincronización de subredes de servidores DHCP exitosa');
this.toastService.success(this.translate.instant('sincronizacionDeSubredesDeServidores'));
}
},
error: (error) => {
@ -106,7 +109,7 @@ export class GlobalStatusComponent implements OnInit {
});
});
}, error => {
console.error('Error fetching DHCP servers for subnet sync', error);
console.error(this.translate.instant('errorFetchingDhcpServersFor'), error);
});
}
@ -118,7 +121,7 @@ export class GlobalStatusComponent implements OnInit {
const timeoutId = setTimeout(() => {
if (!hasError) {
this.toastService.error('Error al sincronizar las plantillas Pxe: tiempo de espera agotado');
this.toastService.error(this.translate.instant('errorAlSincronizarLasPlantillas'));
hasError = true;
}
}, 5000);
@ -129,7 +132,7 @@ export class GlobalStatusComponent implements OnInit {
pending--;
if (pending === 0 && !hasError) {
clearTimeout(timeoutId);
this.toastService.success('Sincronización de plantillas Pxe exitosa');
this.toastService.success(this.translate.instant('sincronizacionDePlantillasPxeExitosa'));
}
},
error: (error) => {
@ -152,7 +155,7 @@ export class GlobalStatusComponent implements OnInit {
const timeoutId = setTimeout(() => {
if (!hasError) {
this.toastService.error('Error al sincronizar imagenes ogLive: tiempo de espera agotado');
this.toastService.error(this.translate.instant('errorAlSincronizarImagenesOglive'));
hasError = true;
}
}, 5000);
@ -163,7 +166,7 @@ export class GlobalStatusComponent implements OnInit {
pending--;
if (pending === 0 && !hasError) {
clearTimeout(timeoutId);
this.toastService.success('Sincronización con ogLives completada');
this.toastService.success(this.translate.instant('sincronizacionConOglivesCompletada'));
}
},
error: (error) => {
@ -190,7 +193,7 @@ export class GlobalStatusComponent implements OnInit {
this.repositories = [];
if (showLoading) this.loadingRepositories = false;
this.checkOverallLoading();
this.toastService.error('Error al cargar la lista de repositorios');
this.toastService.error(this.translate.instant('errorAlCargarLaLista2'));
}
});
}
@ -213,7 +216,7 @@ export class GlobalStatusComponent implements OnInit {
this.bootServers = [];
if (showLoading) this.loadingBootServers = false;
this.checkOverallLoading();
this.toastService.error('Error al cargar la lista de Servidores de Boot');
this.toastService.error(this.translate.instant('errorAlCargarLaLista1'));
}
});
}
@ -230,7 +233,7 @@ export class GlobalStatusComponent implements OnInit {
this.dhcps = [];
if (showLoading) this.loadingDhcps = false;
this.checkOverallLoading();
this.toastService.error('Error al cargar la lista de Dhcps');
this.toastService.error(this.translate.instant('errorAlCargarLaLista'));
}
});
}
@ -250,7 +253,7 @@ export class GlobalStatusComponent implements OnInit {
this.loadDhcps(true);
this.loadRepositories(true);
this.syncSubnets();
this.toastService.success('Datos actualizados correctamente');
this.toastService.success(this.translate.instant('datosActualizadosCorrectamente'));
}
updateLastUpdateTime(): void {

View File

@ -1,3 +1,5 @@
import { inject } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { Component, OnInit, Input } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { ConfigService } from '@services/config.service';
@ -10,6 +12,7 @@ import { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser';
styleUrl: './ogboot-status.component.css'
})
export class GlobalOgbootStatusComponent implements OnInit {
public translate = inject(TranslateService);
baseUrl: string;
loadingBootServers: boolean = false;
@ -117,9 +120,9 @@ export class GlobalOgbootStatusComponent implements OnInit {
this.loadBootServerStatus(bootServerUuid, (errorOccurred: boolean) => {
this.errorBootServers[bootServerUuid] = errorOccurred;
if (!errorOccurred) {
this.toastService.success('Estado del servidor de boot actualizado correctamente');
this.toastService.success(this.translate.instant('estadoDelServidorDeBoot'));
} else {
this.toastService.error('Error al cargar el estado del servidor de boot');
this.toastService.error(this.translate.instant('errorAlCargarElEstado2'));
}
});
}

View File

@ -1,3 +1,5 @@
import { inject } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { Component, OnInit, Input } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { ConfigService } from '@services/config.service';
@ -10,6 +12,7 @@ import { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser';
styleUrl: './ogdhcp-status.component.css'
})
export class OgdhcpStatusComponent implements OnInit {
public translate = inject(TranslateService);
baseUrl: string;
loadingDhcps: boolean = false;
@ -120,9 +123,9 @@ export class OgdhcpStatusComponent implements OnInit {
this.loadDhcpStatus(dhcpUuid, (errorOccurred: boolean) => {
this.errorDhcps[dhcpUuid] = errorOccurred;
if (!errorOccurred) {
this.toastService.success('Estado del dhcp actualizado correctamente');
this.toastService.success(this.translate.instant('estadoDelDhcpActualizadoCorrectamente'));
} else {
this.toastService.error('Error al cargar el estado del dhcp');
this.toastService.error(this.translate.instant('errorAlCargarElEstado'));
}
});
}

View File

@ -1,3 +1,5 @@
import { inject } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { Component, OnInit, Input } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { ConfigService } from '@services/config.service';
@ -10,6 +12,7 @@ import { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser';
styleUrl: './ogrepository-status.component.css'
})
export class OgrepositoryStatusComponent implements OnInit {
public translate = inject(TranslateService);
baseUrl: string;
loading: boolean = false;
@ -119,9 +122,9 @@ export class OgrepositoryStatusComponent implements OnInit {
this.loadRepositoryStatus(repositoryUuid, (errorOccurred: boolean) => {
this.errorRepositories[repositoryUuid] = errorOccurred;
if (!errorOccurred) {
this.toastService.success('Estado del repositorio actualizado correctamente');
this.toastService.success(this.translate.instant('estadoDelRepositorioActualizadoCorrectamente'));
} else {
this.toastService.error('Error al cargar el estado del repositorio');
this.toastService.error(this.translate.instant('errorAlCargarElEstado1'));
}
});
}

View File

@ -41,7 +41,7 @@
<div class="table-container">
<table mat-table [dataSource]="dataSource" class="mat-elevation-z8">
<ng-container *ngFor="let column of columns" [matColumnDef]="column.columnDef">
<th mat-header-cell *matHeaderCellDef> {{ column.header }} </th>
<th mat-header-cell *matHeaderCellDef> {{ column.header | translate }} </th>
<td mat-cell *matCellDef="let image">
<ng-container *ngIf="column.columnDef !== 'size'">
{{ column.cell(image) }}

View File

@ -1,4 +1,6 @@
import {Component, EventEmitter, OnInit, Output, ViewChild, ElementRef} from '@angular/core';
import { inject } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import {Component, EventEmitter, OnInit, Output, ViewChild, ElementRef } from '@angular/core';
import { HttpClient } from "@angular/common/http";
import { ToastrService } from "ngx-toastr";
import { ActivatedRoute, Router } from "@angular/router";
@ -17,6 +19,7 @@ import {CreateTaskComponent} from "../../../../commands/commands-task/create-tas
styleUrl: './create-image.component.css'
})
export class CreateClientImageComponent implements OnInit{
public translate = inject(TranslateService);
baseUrl: string;
@Output() dataChange = new EventEmitter<any>();
@ViewChild('partitionSection', { static: false }) partitionSection!: ElementRef;
@ -69,27 +72,27 @@ export class CreateClientImageComponent implements OnInit{
columns = [
{
columnDef: 'partitionNumber',
header: 'Particion',
header: 'particion',
cell: (partition: any) => partition.partitionNumber
},
{
columnDef: 'size',
header: 'Tamaño',
header: 'tamano',
cell: (partition: any) => `${partition.size} MB`
},
{
columnDef: 'partitionCode',
header: 'Tipo de partición',
header: 'tipoDeParticion',
cell: (partition: any) => partition.partitionCode
},
{
columnDef: 'filesystem',
header: 'Sistema de ficheros',
header: 'sistemaDeFicheros',
cell: (partition: any) => partition.filesystem
},
{
columnDef: 'operativeSystem',
header: 'SO',
header: 'so',
cell: (partition: any) => partition.operativeSystem?.name
}
];
@ -139,7 +142,7 @@ export class CreateClientImageComponent implements OnInit{
}
},
(error) => {
console.error('Error al cargar los datos del cliente:', error);
console.error(this.translate.instant('errorAlCargarLosDatos1'), error);
}
);
}
@ -155,7 +158,7 @@ export class CreateClientImageComponent implements OnInit{
this.images = response['hydra:member'];
},
(error) => {
console.error('Error al cargar las imágenes:', error);
console.error(this.translate.instant('errorAlCargarLasImagenes3'), error);
}
);
}
@ -186,7 +189,7 @@ export class CreateClientImageComponent implements OnInit{
this.checkRepositoryExists();
},
(error) => {
console.error('Error al cargar los repositorios git:', error);
console.error(this.translate.instant('errorAlCargarLosRepositorios2'), error);
this.loadingGitRepositories = false;
}
);
@ -201,7 +204,7 @@ export class CreateClientImageComponent implements OnInit{
this.loadingGitImageRepositories = false;
},
(error) => {
console.error('Error al cargar las imágenes de repositorio git:', error);
console.error(this.translate.instant('errorAlCargarLasImagenes'), error);
this.loadingGitImageRepositories = false;
}
);
@ -237,8 +240,8 @@ export class CreateClientImageComponent implements OnInit{
}
},
error => {
console.error('Error fetching branches', error);
this.toastService.error('Error al cargar las ramas del repositorio');
console.error(this.translate.instant('errorFetchingBranches'), error);
this.toastService.error(this.translate.instant('errorAlCargarLasRamas1'));
this.loadingBranches = false;
}
);
@ -261,7 +264,7 @@ export class CreateClientImageComponent implements OnInit{
dialogRef.afterClosed().subscribe(result => {
if (result) {
this.toastService.success('Rama creada correctamente');
this.toastService.success(this.translate.instant('ramaCreadaCorrectamente'));
this.destinationBranch = result.branchName || result;
this.loadBranches();
}
@ -270,7 +273,7 @@ export class CreateClientImageComponent implements OnInit{
}
if (!this.selectedGitRepository) {
this.toastService.error('Debe seleccionar un repositorio primero');
this.toastService.error(this.translate.instant('debeSeleccionarUnRepositorioPrimero'));
return;
}
@ -285,7 +288,7 @@ export class CreateClientImageComponent implements OnInit{
dialogRef.afterClosed().subscribe(result => {
if (result) {
this.toastService.success('Rama creada correctamente');
this.toastService.success(this.translate.instant('ramaCreadaCorrectamente'));
this.destinationBranch = result.branchName || result;
this.loadBranches();
}
@ -319,9 +322,9 @@ export class CreateClientImageComponent implements OnInit{
this.loadingExistingImages = false;
},
(error) => {
console.error('Error al cargar las imágenes existentes:', error);
console.error(this.translate.instant('errorAlCargarLasImagenes2'), error);
this.loadingExistingImages = false;
this.toastService.error('Error al cargar las imágenes existentes');
this.toastService.error(this.translate.instant('errorAlCargarLasImagenes1'));
}
);
}
@ -347,18 +350,18 @@ export class CreateClientImageComponent implements OnInit{
save(): void {
if (!this.selectedPartition) {
this.toastService.error('Debes seleccionar una partición');
this.toastService.error(this.translate.instant('debesSeleccionarUnaParticion'));
return;
}
if (this.imageType === 'monolithic') {
if (this.monolithicAction === 'create' && !this.name) {
this.toastService.error('Debes introducir un nombre canónico para la imagen');
this.toastService.error(this.translate.instant('debesIntroducirUnNombreCanonico'));
return;
}
if (this.monolithicAction === 'update' && !this.selectedImage) {
this.toastService.error('Debes seleccionar una imagen para actualizar');
this.toastService.error(this.translate.instant('debesSeleccionarUnaImagenPara'));
return;
}
}
@ -572,8 +575,8 @@ export class CreateClientImageComponent implements OnInit{
}
},
error: (error) => {
console.error('Error al cargar datos de Git:', error);
this.toastService.error('Error al cargar información de Git');
console.error(this.translate.instant('errorAlCargarDatosDe'), error);
this.toastService.error(this.translate.instant('errorAlCargarInformacionDe'));
this.loadingGitData = false;
}
});
@ -603,7 +606,7 @@ export class CreateClientImageComponent implements OnInit{
this.loadingBranches = false;
},
error => {
console.error('Error fetching branches for Git data', error);
console.error(this.translate.instant('errorFetchingBranchesForGit'), error);
this.loadingBranches = false;
}
);
@ -643,7 +646,7 @@ export class CreateClientImageComponent implements OnInit{
let scope = 'clients';
if (!this.client) {
this.toastService.error('No se ha cargado la información del cliente');
this.toastService.error(this.translate.instant('noSeHaCargadoLa'));
return;
}
@ -663,7 +666,7 @@ export class CreateClientImageComponent implements OnInit{
dialogRef.afterClosed().subscribe((result: any) => {
if (result) {
if (!this.selectedPartition) {
this.toastService.error('Debe seleccionar una partición');
this.toastService.error(this.translate.instant('debeSeleccionarUnaParticion'));
return;
}
@ -699,7 +702,7 @@ export class CreateClientImageComponent implements OnInit{
type: 'create-image',
}).subscribe({
next: () => {
this.toastService.success('Tarea de creación de imagen programada con éxito');
this.toastService.success(this.translate.instant('tareaDeCreacionDeImagen'));
},
error: (error) => {
this.toastService.error(error.error['hydra:description'] || 'Error al programar la tarea');

View File

@ -1,3 +1,5 @@
import { inject } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { Component, OnInit, Inject } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from "@angular/forms";
import { HttpClient } from "@angular/common/http";
@ -11,6 +13,7 @@ import { ConfigService } from '@services/config.service';
styleUrl: './create-repository-modal.component.css'
})
export class CreateRepositoryModalComponent implements OnInit {
public translate = inject(TranslateService);
baseUrl: string;
repositoryForm: FormGroup<any>;
loading: boolean = false;
@ -45,7 +48,7 @@ export class CreateRepositoryModalComponent implements OnInit {
this.http.post(`${this.baseUrl}/git-repositories`, payload).subscribe({
next: (response) => {
this.toastService.success('Repositorio creado correctamente');
this.toastService.success(this.translate.instant('repositorioCreadoCorrectamente'));
this.dialogRef.close(response);
},
error: (error) => {
@ -54,7 +57,7 @@ export class CreateRepositoryModalComponent implements OnInit {
}
});
} else {
this.toastService.error('Por favor, complete todos los campos requeridos');
this.toastService.error(this.translate.instant('porFavorCompleteTodosLos'));
}
}

View File

@ -1,3 +1,5 @@
import { inject } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { Component, EventEmitter, OnInit, Output } from '@angular/core';
import { MatTableDataSource } from "@angular/material/table";
import { SelectionModel } from "@angular/cdk/collections";
@ -16,6 +18,7 @@ import { QueueConfirmationModalComponent } from "../../../../../shared/queue-con
styleUrl: './deploy-image.component.css'
})
export class DeployImageComponent implements OnInit {
public translate = inject(TranslateService);
baseUrl: string;
@Output() dataChange = new EventEmitter<any>();
@ -75,22 +78,22 @@ export class DeployImageComponent implements OnInit {
columns = [
{
columnDef: 'partitionNumber',
header: 'Partición',
header: 'particion1',
cell: (partition: any) => `${partition.partitionNumber}`
},
{
columnDef: 'size',
header: 'Tamaño',
header: 'tamano',
cell: (partition: any) => `${partition.size} MB`
},
{
columnDef: 'filesystem',
header: 'Sistema de ficheros',
header: 'sistemaDeFicheros',
cell: (partition: any) => `${partition.filesystem}`
},
{
columnDef: 'operativeSystem',
header: 'SO',
header: 'so',
cell: (partition: any) => `${partition.operativeSystem?.name}`
}
];
@ -229,7 +232,7 @@ export class DeployImageComponent implements OnInit {
this.loadImages();
},
(error) => {
console.error('Error al cargar las particiones:', error);
console.error(this.translate.instant('errorAlCargarLasParticiones'), error);
}
);
}
@ -261,7 +264,7 @@ export class DeployImageComponent implements OnInit {
this.images = response?.['hydra:member'] || [];
},
(error) => {
console.error('Error al cargar las imágenes:', error);
console.error(this.translate.instant('errorAlCargarLasImagenes3'), error);
}
);
}
@ -350,27 +353,27 @@ export class DeployImageComponent implements OnInit {
const needsPartition = this.deployMode !== 'update-cache';
if (!this.selectedClients.length) {
this.toastService.error('Debe seleccionar al menos un cliente');
this.toastService.error(this.translate.instant('debeSeleccionarAlMenosUn'));
return;
}
if (!this.selectedImage && this.imageType !== 'git') {
this.toastService.error('Debe seleccionar una imagen');
this.toastService.error(this.translate.instant('debeSeleccionarUnaImagen'));
return;
}
if (!this.selectedMethod && this.imageType !== 'git') {
this.toastService.error('Debe seleccionar un método');
this.toastService.error(this.translate.instant('debeSeleccionarUnMetodo'));
return;
}
if (needsPartition && !this.selectedPartition) {
this.toastService.error('Debe seleccionar una partición');
this.toastService.error(this.translate.instant('debeSeleccionarUnaParticion'));
return;
}
if (this.imageType === 'git' && !this.selectedCommit) {
this.toastService.error('Debe seleccionar un commit');
this.toastService.error(this.translate.instant('debeSeleccionarUnCommit'));
return;
}
@ -381,7 +384,7 @@ export class DeployImageComponent implements OnInit {
backdropClass: 'non-clickable-backdrop'
});
this.toastService.info('Preparando petición de despliegue');
this.toastService.info(this.translate.instant('preparandoPeticionDeDespliegue'));
dialogRef.afterClosed().subscribe(result => {
if (result !== undefined) {
@ -428,7 +431,7 @@ export class DeployImageComponent implements OnInit {
this.http.post(url, payload)
.subscribe({
next: (response) => {
this.toastService.success('Petición de despliegue enviada correctamente');
this.toastService.success(this.translate.instant('peticionDeDespliegueEnviadaCorrectamente'));
this.loading = false;
this.router.navigate(['/commands-logs']);
},
@ -573,7 +576,7 @@ export class DeployImageComponent implements OnInit {
type: 'deploy-image',
}).subscribe({
next: () => {
this.toastService.success('Script añadido con éxito a la tarea');
this.toastService.success(this.translate.instant('scriptAnadidoConExitoA'));
},
error: (error) => {
this.toastService.error(error.error['hydra:description']);
@ -632,7 +635,7 @@ export class DeployImageComponent implements OnInit {
}
},
error => {
this.toastService.error('Error al cargar los repositorios git');
this.toastService.error(this.translate.instant('errorAlCargarLosRepositorios1'));
this.loadingRepositories = false;
}
);
@ -662,7 +665,7 @@ export class DeployImageComponent implements OnInit {
}
},
error => {
this.toastService.error('Error al cargar las ramas');
this.toastService.error(this.translate.instant('errorAlCargarLasRamas'));
this.loadingBranches = false;
}
);
@ -694,7 +697,7 @@ export class DeployImageComponent implements OnInit {
}
},
error => {
this.toastService.error('Error al cargar los commits');
this.toastService.error(this.translate.instant('errorAlCargarLosCommits'));
this.loadingCommits = false;
}
);

View File

@ -1,4 +1,6 @@
import {Component, EventEmitter, Inject, Input, OnInit, Output, AfterViewInit, OnDestroy, ViewChild, ElementRef, HostListener} from '@angular/core';
import { inject } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import {Component, EventEmitter, Inject, Input, OnInit, Output, AfterViewInit, OnDestroy, ViewChild, ElementRef, HostListener } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { ToastrService } from 'ngx-toastr';
import {ActivatedRoute, Router} from "@angular/router";
@ -32,6 +34,7 @@ interface Partition {
styleUrls: ['./partition-assistant.component.css']
})
export class PartitionAssistantComponent implements OnInit, AfterViewInit, OnDestroy{
public translate = inject(TranslateService);
baseUrl: string;
private apiUrl: string;
@Output() dataChange = new EventEmitter<any>();
@ -190,7 +193,7 @@ export class PartitionAssistantComponent implements OnInit, AfterViewInit, OnDes
this.initializeDisks();
},
(error) => {
console.error('Error al cargar los datos del cliente:', error);
console.error(this.translate.instant('errorAlCargarLosDatos1'), error);
}
);
}
@ -412,7 +415,7 @@ export class PartitionAssistantComponent implements OnInit, AfterViewInit, OnDes
this.resizeChart();
}, 100);
} else {
this.toastService.error('No hay suficiente espacio libre en el disco para crear una nueva partición.');
this.toastService.error(this.translate.instant('noHaySuficienteEspacioLibre'));
}
}
}
@ -457,7 +460,7 @@ export class PartitionAssistantComponent implements OnInit, AfterViewInit, OnDes
}
if (!this.selectedDisk) {
this.toastService.error('No se ha seleccionado un disco.');
this.toastService.error(this.translate.instant('noSeHaSeleccionadoUn'));
return;
}
@ -466,14 +469,14 @@ export class PartitionAssistantComponent implements OnInit, AfterViewInit, OnDes
.reduce((sum: any, partition: any) => sum + partition.size, 0);
if (totalPartitionSize > this.selectedDisk.totalDiskSize) {
this.toastService.error('El tamaño total de las particiones en el disco seleccionado excede el tamaño total del disco.');
this.toastService.error(this.translate.instant('elTamanoTotalDeLas'));
return;
}
const modifiedPartitions = this.selectedDisk.partitions.filter((partition: { removed: any; format: any; }) => !partition.removed || partition.format);
if (modifiedPartitions.length === 0) {
this.toastService.info('No hay cambios para guardar en el disco seleccionado.');
this.toastService.info(this.translate.instant('noHayCambiosParaGuardar'));
return;
}
@ -507,13 +510,13 @@ export class PartitionAssistantComponent implements OnInit, AfterViewInit, OnDes
this.http.post(this.apiUrl, bulkPayload).subscribe(
(response) => {
this.toastService.success('Particiones creadas exitosamente para el disco seleccionado.');
this.toastService.success(this.translate.instant('particionesCreadasExitosamenteParaEl'));
this.loading = false;
this.router.navigate(['/commands-logs']);
},
(error) => {
this.loading = false;
this.toastService.error('Error al crear las particiones.');
this.toastService.error(this.translate.instant('errorAlCrearLasParticiones'));
}
);
}
@ -680,7 +683,7 @@ export class PartitionAssistantComponent implements OnInit, AfterViewInit, OnDes
if (modifiedPartitions.length === 0) {
this.loading = false;
this.toastService.info('No hay cambios para guardar en el disco seleccionado.');
this.toastService.info(this.translate.instant('noHayCambiosParaGuardar'));
return;
}
@ -711,7 +714,7 @@ export class PartitionAssistantComponent implements OnInit, AfterViewInit, OnDes
type: 'partition-assistant',
}).subscribe({
next: () => {
this.toastService.success('Script añadido con éxito a la tarea');
this.toastService.success(this.translate.instant('scriptAnadidoConExitoA'));
},
error: (error) => {
this.toastService.error(error.error['hydra:description']);
@ -723,7 +726,7 @@ export class PartitionAssistantComponent implements OnInit, AfterViewInit, OnDes
generateInstructions(): void {
if (!this.selectedModelClient || !this.selectedDisk) {
this.toastService.error('Selecciona un cliente modelo y un disco.');
this.toastService.error(this.translate.instant('seleccionaUnClienteModeloY'));
return;
}
@ -777,8 +780,8 @@ export class PartitionAssistantComponent implements OnInit, AfterViewInit, OnDes
copyInstructions(): void {
if (!this.generatedInstructions) { return; }
navigator.clipboard?.writeText(this.generatedInstructions)
.then(() => this.toastService.success('Script copiado al portapapeles'))
.catch(() => this.toastService.error('No se pudo copiar el script.'));
.then(() => this.toastService.success(this.translate.instant('scriptCopiadoAlPortapapeles')))
.catch(() => this.toastService.error(this.translate.instant('noSePudoCopiarEl')));
}
@ -837,7 +840,7 @@ export class PartitionAssistantComponent implements OnInit, AfterViewInit, OnDes
});
console.log('Scroll hacia botón ejecutar completado');
} else {
console.error('No se encontró el botón execute-button');
console.error(this.translate.instant('noSeEncontroElBoton'));
}
}

View File

@ -125,7 +125,7 @@
[(ngModel)]="newScript"
(ngModelChange)="onNewScriptChange()"
rows="8"
placeholder="{{'bashScriptBoilerplate'|translate}}"
[placeholder]="'bashScriptBoilerplate'|translate"
class="script-textarea"></textarea>
<mat-hint>{{ 'writeShellCommandsHint' | translate }}</mat-hint>
</mat-form-field>

View File

@ -1,4 +1,6 @@
import {Component, EventEmitter, OnInit, Output} from '@angular/core';
import { inject } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import {Component, EventEmitter, OnInit, Output } from '@angular/core';
import { SelectionModel } from "@angular/cdk/collections";
import { HttpClient } from "@angular/common/http";
import { ToastrService } from "ngx-toastr";
@ -15,6 +17,7 @@ import {QueueConfirmationModalComponent} from "../../../../../shared/queue-confi
styleUrl: './run-script-assistant.component.css'
})
export class RunScriptAssistantComponent implements OnInit{
public translate = inject(TranslateService);
baseUrl: string;
@Output() dataChange = new EventEmitter<any>();
@ -96,7 +99,7 @@ export class RunScriptAssistantComponent implements OnInit{
saveNewScript() {
if (!this.newScript.trim()) {
this.toastService.error('Debe ingresar un script antes de guardar.');
this.toastService.error(this.translate.instant('debeIngresarUnScriptAntes'));
return;
}
const dialogRef = this.dialog.open(SaveScriptComponent, {
@ -106,7 +109,7 @@ export class RunScriptAssistantComponent implements OnInit{
dialogRef.afterClosed().subscribe(result => {
if (result) {
this.toastService.success('Script guardado correctamente');
this.toastService.success(this.translate.instant('scriptGuardadoCorrectamente'));
}
});
}
@ -205,13 +208,13 @@ export class RunScriptAssistantComponent implements OnInit{
runAsAdmin: this.runAsAdmin
}).subscribe(
response => {
this.toastService.success('Script ejecutado correctamente');
this.toastService.success(this.translate.instant('scriptEjecutadoCorrectamente'));
this.dataChange.emit();
this.router.navigate(['/commands-logs']);
this.loading = false;
},
error => {
this.toastService.error('Error al ejecutar el script');
this.toastService.error(this.translate.instant('errorAlEjecutarElScript'));
this.loading = false;
}
);
@ -258,7 +261,7 @@ export class RunScriptAssistantComponent implements OnInit{
type: 'run-script',
}).subscribe({
next: () => {
this.toastService.success('Script añadido con éxito a la tarea');
this.toastService.success(this.translate.instant('scriptAnadidoConExitoA'));
},
error: (error) => {
this.toastService.error(error.error['hydra:description']);

View File

@ -1,4 +1,6 @@
import {Component, Inject} from '@angular/core';
import { inject } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import {Component, Inject } from '@angular/core';
import {MAT_DIALOG_DATA, MatDialogRef} from "@angular/material/dialog";
import {FormBuilder, Validators} from "@angular/forms";
import {HttpClient} from "@angular/common/http";
@ -12,6 +14,7 @@ import {DataService} from "../../../../../commands/main-commands/data.service";
styleUrl: './save-script.component.css'
})
export class SaveScriptComponent {
public translate = inject(TranslateService);
commandName: string = '';
baseUrl: string;
@ -36,7 +39,7 @@ export class SaveScriptComponent {
this.http.post(`${this.baseUrl}/commands`, payload).subscribe(
(response) => {
this.toastService.success('Comando añadido correctamente');
this.toastService.success(this.translate.instant('comandoAnadidoCorrectamente'));
this.dialogRef.close();
},
(error) => {

View File

@ -1,3 +1,5 @@
import { inject } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { Component, OnInit, OnDestroy, ViewChild, QueryList, ViewChildren, ChangeDetectorRef } from '@angular/core';
import { HttpClient, HttpParams } from '@angular/common/http';
import { Router } from '@angular/router';
@ -48,6 +50,7 @@ enum NodeType {
styleUrls: ['./groups.component.css'],
})
export class GroupsComponent implements OnInit, OnDestroy {
public translate = inject(TranslateService);
@ViewChildren(MatMenuTrigger) menuTriggers!: QueryList<MatMenuTrigger>;
isSmallScreen: boolean = false;
baseUrl: string;
@ -283,7 +286,7 @@ export class GroupsComponent implements OnInit, OnDestroy {
// this.savedFilterNames = data.map((filter: { name: string; uuid: string; }) => [filter.name, filter.uuid]);
// },
// (error) => {
// console.error('Error fetching filters:', error);
// console.error(this.translate.instant('errorFetchingFilters1'), error);
// }
// )
// );
@ -297,7 +300,7 @@ export class GroupsComponent implements OnInit, OnDestroy {
this.savedFilterNames = data.map((filter: { name: string; uuid: string; }) => [filter.name, filter.uuid]);
},
(error) => {
console.error('Error fetching filters:', error);
console.error(this.translate.instant('errorFetchingFilters1'), error);
}
)
);
@ -350,8 +353,8 @@ export class GroupsComponent implements OnInit, OnDestroy {
}
},
error: (error) => {
console.error('Error fetching organizational units', error);
this.toastr.error('Ocurrió un error al cargar las unidades organizativas');
console.error(this.translate.instant('errorFetchingOrganizationalUnits'), error);
this.toastr.error(this.translate.instant('ocurrioUnErrorAlCargar'));
},
});
}
@ -561,7 +564,7 @@ export class GroupsComponent implements OnInit, OnDestroy {
console.log('Nodo padre encontrado para actualización:', parentNode);
this.refreshData(parentNode.uuid);
} else {
console.error('No se encontró el nodo padre después de la creación masiva.');
console.error(this.translate.instant('noSeEncontroElNodo'));
}
}
this.loading = false;
@ -635,7 +638,7 @@ export class GroupsComponent implements OnInit, OnDestroy {
}
},
error: (error) => {
console.error('Error deleting entity:', error);
console.error(this.translate.instant('errorDeletingEntity'), error);
const entityType = type === NodeType.Client ? 'cliente' : 'entidad';
this.toastr.error(`Error al eliminar el ${entityType}`);
},
@ -675,7 +678,7 @@ export class GroupsComponent implements OnInit, OnDestroy {
});
},
(error) => {
console.error('Error fetching room data:', error);
console.error(this.translate.instant('errorFetchingRoomData'), error);
}
)
);
@ -685,7 +688,7 @@ export class GroupsComponent implements OnInit, OnDestroy {
executeCommand(command: Command, selectedNode: TreeNode | null): void {
this.loading = true;
if (!selectedNode) {
this.toastr.error('No hay un nodo seleccionado.');
this.toastr.error(this.translate.instant('noHayUnNodoSeleccionado'));
return;
} else {
this.toastr.success(`Ejecutando comando: ${command.name} en ${selectedNode.name}`);
@ -834,7 +837,7 @@ export class GroupsComponent implements OnInit, OnDestroy {
this.subscriptions.add(
this.http.post(`${this.baseUrl}${client['@id']}/agent/status`, {}).subscribe(
() => {
this.toastr.success('Cliente actualizado correctamente');
this.toastr.success(this.translate.instant('clienteActualizadoCorrectamente'));
this.syncingClientIds.delete(client.uuid);
this.refreshData(parentNodeId)
},
@ -869,12 +872,12 @@ export class GroupsComponent implements OnInit, OnDestroy {
});
this.arrayClients = this.selectedClients.data;
this.calculateLocalStats();
this.toastr.success('Estado del aula actualizado');
this.toastr.success(this.translate.instant('estadoDelAulaActualizado'));
},
error: () => {
this.isCheckingNodeStatus = false;
this.selectedClients.data.forEach(c => c.uuid && this.syncingClientIds.delete(c.uuid));
this.toastr.error('Error al comprobar el estado del aula');
this.toastr.error(this.translate.instant('errorAlComprobarElEstado'));
},
})
);
@ -1054,14 +1057,14 @@ export class GroupsComponent implements OnInit, OnDestroy {
`);
}
} else {
this.toastr.error('No se puede acceder a los logs: IP del cliente no disponible', 'Error');
this.toastr.error(this.translate.instant('noSePuedeAccederA'), 'Error');
}
}
openClientLogsModal(event: MouseEvent, client: Client): void {
event.stopPropagation();
if (!client.mac) {
this.toastr.error('No se puede acceder a los logs: MAC del cliente no disponible', 'Error');
this.toastr.error(this.translate.instant('noSePuedeAccederA1'), 'Error');
return;
}
@ -1088,7 +1091,7 @@ export class GroupsComponent implements OnInit, OnDestroy {
const allClients = response['hydra:member'] || [];
if (allClients.length === 0) {
this.toastr.warning('Esta unidad organizativa no tiene clientes');
this.toastr.warning(this.translate.instant('estaUnidadOrganizativaNoTiene'));
return;
}
@ -1113,8 +1116,8 @@ export class GroupsComponent implements OnInit, OnDestroy {
});
},
error: (error) => {
console.error('Error al obtener los clientes de la unidad organizativa:', error);
this.toastr.error('Error al cargar los clientes de la unidad organizativa');
console.error(this.translate.instant('errorAlObtenerLosClientes1'), error);
this.toastr.error(this.translate.instant('errorAlCargarLosClientes'));
this.loading = false;
}
});
@ -1135,7 +1138,7 @@ export class GroupsComponent implements OnInit, OnDestroy {
refreshClientData(): void {
this.fetchClientsForNode(this.selectedNode);
this.toastr.success('Datos actualizados', 'Éxito');
this.toastr.success(this.translate.instant('datosActualizados'), 'Éxito');
}
exportToCSV(): void {
@ -1164,7 +1167,7 @@ export class GroupsComponent implements OnInit, OnDestroy {
link.click();
document.body.removeChild(link);
this.toastr.success('Archivo CSV exportado correctamente', 'Éxito');
this.toastr.success(this.translate.instant('archivoCsvExportadoCorrectamente'), 'Éxito');
}
private calculateLocalStats(): void {
@ -1318,7 +1321,7 @@ export class GroupsComponent implements OnInit, OnDestroy {
event.stopPropagation();
if (this.selection.selected.length === 0) {
this.toastr.warning('No hay clientes seleccionados para eliminar');
this.toastr.warning(this.translate.instant('noHayClientesSeleccionadosPara'));
return;
}
@ -1355,8 +1358,8 @@ export class GroupsComponent implements OnInit, OnDestroy {
},
error: (error) => {
this.loading = false;
console.error('Error deleting multiple clients:', error);
this.toastr.error('Error al eliminar los clientes seleccionados');
console.error(this.translate.instant('errorDeletingMultipleClients1'), error);
this.toastr.error(this.translate.instant('errorAlEliminarLosClientes'));
}
});
}

View File

@ -1,3 +1,5 @@
import { inject } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { Injectable } from '@angular/core';
import {HttpClient, HttpParams} from '@angular/common/http';
import { Observable, throwError } from 'rxjs';
@ -9,6 +11,7 @@ import { ConfigService } from '@services/config.service';
providedIn: 'root'
})
export class DataService {
public translate = inject(TranslateService);
baseUrl: string;
private apiUrl: string;
@ -35,7 +38,7 @@ export class DataService {
}
}),
catchError(error => {
console.error('Error fetching unidades organizativas', error);
console.error(this.translate.instant('errorFetchingUnidadesOrganizativas'), error);
return throwError(error);
})
);
@ -51,7 +54,7 @@ export class DataService {
}
}),
catchError(error => {
console.error('Error fetching children', error);
console.error(this.translate.instant('errorFetchingChildren'), error);
return throwError(error);
})
);
@ -67,7 +70,7 @@ export class DataService {
}
}),
catchError(error => {
console.error('Error fetching clients', error);
console.error(this.translate.instant('errorFetchingClients'), error);
return throwError(error);
})
);
@ -84,7 +87,7 @@ export class DataService {
}
}),
catchError(error => {
console.error('Error fetching clients', error);
console.error(this.translate.instant('errorFetchingClients'), error);
return throwError(error);
})
);
@ -101,7 +104,7 @@ export class DataService {
}
}),
catchError(error => {
console.error('Error fetching clients', error);
console.error(this.translate.instant('errorFetchingClients'), error);
return throwError(error);
})
);
@ -118,7 +121,7 @@ export class DataService {
}
}),
catchError(error => {
console.error('Error fetching clients', error);
console.error(this.translate.instant('errorFetchingClients'), error);
return throwError(error);
})
);
@ -132,7 +135,7 @@ export class DataService {
console.log('DELETE URL:', url); // Depuración
return this.http.delete<void>(url).pipe(
catchError(error => {
console.error('Error deleting element', error);
console.error(this.translate.instant('errorDeletingElement'), error);
return throwError(error);
})
);
@ -144,7 +147,7 @@ export class DataService {
// @ts-ignore
return this.http.post<void>(url).pipe(
catchError(error => {
console.error('Error deleting element', error);
console.error(this.translate.instant('errorDeletingElement'), error);
return throwError(error);
})
);
@ -185,7 +188,7 @@ export class DataService {
}
}),
catchError(error => {
console.error('Error fetching data', error);
console.error(this.translate.instant('errorFetchingData'), error);
return throwError(error);
})
);
@ -201,7 +204,7 @@ export class DataService {
}
}),
catchError(error => {
console.error('Error fetching filters', error);
console.error(this.translate.instant('errorFetchingFilters'), error);
return throwError(error);
})
);
@ -219,7 +222,7 @@ export class DataService {
}
}),
catchError(error => {
console.error('Error fetching filters', error);
console.error(this.translate.instant('errorFetchingFilters'), error);
return throwError(error);
})
);
@ -229,7 +232,7 @@ export class DataService {
const url = `${this.baseUrl}/organizational-units/${id}`;
return this.http.get<any>(url).pipe(
catchError(error => {
console.error('Error fetching organizational unit', error);
console.error(this.translate.instant('errorFetchingOrganizationalUnit'), error);
return throwError(error);
})
);
@ -255,7 +258,7 @@ export class DataService {
return this.http.post<any>(url, body).pipe(
catchError(error => {
console.error('Error deleting multiple clients', error);
console.error(this.translate.instant('errorDeletingMultipleClients'), error);
return throwError(error);
})
);

View File

@ -1,4 +1,6 @@
import {Component, Inject, OnInit} from '@angular/core';
import { inject } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import {Component, Inject, OnInit } from '@angular/core';
import {HttpClient} from "@angular/common/http";
import {MAT_DIALOG_DATA, MatDialogRef} from "@angular/material/dialog";
import {ToastrService} from "ngx-toastr";
@ -11,6 +13,7 @@ import {ConfigService} from "@services/config.service";
styleUrl: './change-parent.component.css'
})
export class ChangeParentComponent implements OnInit {
public translate = inject(TranslateService);
baseUrl: string;
loading: boolean = true;
units: any[] = [];
@ -38,7 +41,7 @@ export class ChangeParentComponent implements OnInit {
this.units = response['hydra:member'];
this.loading = false;
},
error => console.error('Error fetching organizational units:', error)
error => console.error(this.translate.instant('errorFetchingOrganizationalUnits1'), error)
);
}
@ -48,7 +51,7 @@ export class ChangeParentComponent implements OnInit {
organizationalUnit: this.newOU['@id']
}).subscribe({
next: (response) => {
this.toastService.success('Parent changed successfully');
this.toastService.success(this.translate.instant('parentChangedSuccessfully'));
this.dialogRef.close(true);
},
error: error => {

View File

@ -1,3 +1,5 @@
import { inject } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { Component, Input, OnInit, OnChanges } from '@angular/core';
import { MatDialog } from '@angular/material/dialog';
import { ClientViewComponent } from "../client-view/client-view.component";
@ -17,6 +19,7 @@ interface GroupedClients {
styleUrls: ['./classroom-view.component.css']
})
export class ClassroomViewComponent implements OnInit, OnChanges {
public translate = inject(TranslateService);
baseUrl: string;
@Input() clients: any[] = [];
@Input() pcInTable: number = 5;
@ -93,7 +96,7 @@ export class ClassroomViewComponent implements OnInit, OnChanges {
this.http.patch(url, payload).subscribe(response => {
this.openSnackBar(false, 'Plano actualizado!');
}, error => {
console.error('Error al actualizar cliente:', error);
console.error(this.translate.instant('errorAlActualizarCliente1'), error);
this.openSnackBar(true, error);
});
});
@ -103,8 +106,8 @@ export class ClassroomViewComponent implements OnInit, OnChanges {
openSnackBar(isError: boolean, message: string) {
if (isError) {
this.toastService.error(' Error al actualizar cliente: ' + message, 'Error');
this.toastService.error(this.translate.instant('errorAlActualizarCliente') + message, 'Error');
} else
this.toastService.success('Cliente actualizado!', 'Éxito');
this.toastService.success(this.translate.instant('clienteActualizado'), 'Éxito');
}
}

View File

@ -60,7 +60,7 @@
<table mat-table [dataSource]="disk.partitions" class="disk-table">
@for (column of columns; track column.columnDef) {
<ng-container [matColumnDef]="column.columnDef">
<th mat-header-cell *matHeaderCellDef> {{ column.header }} </th>
<th mat-header-cell *matHeaderCellDef> {{ column.header | translate }} </th>
<td mat-cell *matCellDef="let image">
@if (column.columnDef !== 'size' && column.columnDef !== 'operativeSystem') {
{{ column.cell(image) }}

View File

@ -1,3 +1,5 @@
import { inject } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { MAT_DIALOG_DATA } from '@angular/material/dialog';
import { Component, ElementRef, Inject, OnInit, ViewChild } from '@angular/core';
import { HttpClient } from '@angular/common/http';
@ -20,6 +22,7 @@ interface ClientInfo {
styleUrl: './client-details.component.css'
})
export class ClientDetailsComponent {
public translate = inject(TranslateService);
baseUrl: string;
@ViewChild('assistantContainer') assistantContainer!: ElementRef;
clientUuid: string;
@ -43,32 +46,32 @@ export class ClientDetailsComponent {
columns = [
{
columnDef: 'partition',
header: 'Partición',
header: 'particion1',
cell: (partition: any) => `${partition.partitionNumber}`
},
{
columnDef: 'partitionCode',
header: 'Tipo de partición',
header: 'tipoDeParticion',
cell: (partition: any) => partition.partitionCode
},
{
columnDef: 'description',
header: 'Sistema de ficheros',
header: 'sistemaDeFicheros',
cell: (partition: any) => partition.filesystem
},
{
columnDef: 'size',
header: 'Tamaño',
header: 'tamano',
cell: (partition: any) => `${(partition.size / 1024).toFixed(2)} GB`
},
{
columnDef: 'memoryUsage',
header: 'Uso',
header: 'uso',
cell: (partition: any) => `${partition.memoryUsage}%`
},
{
columnDef: 'operativeSystem',
header: 'SO/Imagen',
header: 'soimagen',
cell: (partition: any) => partition.operativeSystem?.name
}
];
@ -99,7 +102,7 @@ export class ClientDetailsComponent {
this.loadPartitions();
this.loading = false;
} else {
console.error('No se recibieron datos del cliente.');
console.error(this.translate.instant('noSeRecibieronDatosDel'));
}
}
@ -190,7 +193,7 @@ export class ClientDetailsComponent {
this.calculateDiskUsage();
},
error: error => {
console.error('Error al obtener las particiones:', error);
console.error(this.translate.instant('errorAlObtenerLasParticiones'), error);
}
});
}

View File

@ -1,3 +1,5 @@
import { inject } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { Component, Inject, OnInit, Optional } from '@angular/core';
import { MatDialogRef } from "@angular/material/dialog";
import { HttpClient } from "@angular/common/http";
@ -12,6 +14,7 @@ import { ConfigService } from '@services/config.service';
styleUrl: './create-multiple-client.component.css'
})
export class CreateMultipleClientComponent implements OnInit {
public translate = inject(TranslateService);
baseUrl: string = this.configService.apiUrl;
parentUnits: any[] = [];
parentUnitsWithPaths: { id: string, name: string, path: string }[] = [];
@ -56,7 +59,7 @@ export class CreateMultipleClientComponent implements OnInit {
this.loading = false;
},
error => {
console.error('Error fetching parent units:', error);
console.error(this.translate.instant('errorFetchingParentUnits'), error);
this.loading = false;
}
);
@ -91,10 +94,10 @@ export class CreateMultipleClientComponent implements OnInit {
if (clients.length > 0) {
this.uploadedClients = clients;
this.toastService.success('Archivo cargado correctamente, los datos están listos para enviarse.', 'Éxito');
this.toastService.success(this.translate.instant('archivoCargadoCorrectamenteLosDatos'), 'Éxito');
this.showTextarea = false;
} else {
this.toastService.error('No se encontraron datos válidos', 'Error');
this.toastService.error(this.translate.instant('noSeEncontraronDatosValidos'), 'Error');
this.showTextarea = true;
}
};
@ -117,10 +120,10 @@ export class CreateMultipleClientComponent implements OnInit {
if (clients.length > 0) {
this.uploadedClients = clients;
this.toastService.success('Datos cargados correctamente, los datos están listos para enviarse.', 'Éxito');
this.toastService.success(this.translate.instant('datosCargadosCorrectamenteLosDatos'), 'Éxito');
this.showTextarea = false;
} else {
this.toastService.error('No se encontraron datos válidos', 'Error');
this.toastService.error(this.translate.instant('noSeEncontraronDatosValidos'), 'Error');
this.showTextarea = true;
}
}
@ -154,7 +157,7 @@ export class CreateMultipleClientComponent implements OnInit {
);
});
} else {
this.toastService.error('No hay clientes cargados para añadir', 'Error');
this.toastService.error(this.translate.instant('noHayClientesCargadosPara'), 'Error');
}
}

View File

@ -1,3 +1,5 @@
import { inject } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { Component, Inject, OnInit } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
@ -12,6 +14,7 @@ import { ConfigService } from '@services/config.service';
styleUrls: ['./manage-client.component.css']
})
export class ManageClientComponent implements OnInit {
public translate = inject(TranslateService);
baseUrl: string;
clientForm!: FormGroup;
parentUnits: any[] = [];
@ -66,7 +69,7 @@ export class ManageClientComponent implements OnInit {
this.loading = false;
}
}).catch(error => {
console.error('Error loading data:', error);
console.error(this.translate.instant('errorLoadingData'), error);
this.loading = false;
});
}
@ -122,7 +125,7 @@ export class ManageClientComponent implements OnInit {
resolve();
},
error => {
console.error('Error fetching parent units:', error);
console.error(this.translate.instant('errorFetchingParentUnits'), error);
reject(error);
}
);
@ -145,7 +148,7 @@ export class ManageClientComponent implements OnInit {
resolve();
},
error => {
console.error('Error fetching ogLives by server:', error);
console.error(this.translate.instant('errorFetchingOglivesByServer'), error);
this.ogLives = [];
resolve(); // resolve anyway so form doesn't block
}
@ -163,7 +166,7 @@ export class ManageClientComponent implements OnInit {
resolve();
},
error => {
console.error('Error fetching PXE templates by server:', error);
console.error(this.translate.instant('errorFetchingPxeTemplatesBy'), error);
this.templates = [];
resolve();
}
@ -181,7 +184,7 @@ export class ManageClientComponent implements OnInit {
resolve();
},
error => {
console.error('Error fetching BootServers:', error);
console.error(this.translate.instant('errorFetchingBootservers'), error);
reject(error);
}
);
@ -212,7 +215,7 @@ export class ManageClientComponent implements OnInit {
resolve();
},
error => {
console.error('Error fetching menus:', error);
console.error(this.translate.instant('errorFetchingMenus1'), error);
reject(error);
}
);
@ -229,7 +232,7 @@ export class ManageClientComponent implements OnInit {
resolve();
},
error => {
console.error('Error fetching repositories:', error);
console.error(this.translate.instant('errorFetchingRepositories1'), error);
reject(error);
}
);
@ -313,7 +316,7 @@ export class ManageClientComponent implements OnInit {
}
},
error => {
console.error('Error al cargar datos del cliente:', error);
console.error(this.translate.instant('errorAlCargarDatosDel'), error);
reject(error);
}
);
@ -331,17 +334,17 @@ export class ManageClientComponent implements OnInit {
this.http.patch<any>(putUrl, formData, { headers }).subscribe(
response => {
this.dialogRef.close({ success: true });
this.toastService.success('Cliente actualizado exitosamente', 'Éxito');
this.toastService.success(this.translate.instant('clienteActualizadoExitosamente'), 'Éxito');
},
error => {
console.error('Error al realizar PUT:', error);
this.toastService.error('Error al actualizar el cliente: ' + error.error['hydra:description'], 'Error');
console.error(this.translate.instant('errorAlRealizarPut'), error);
this.toastService.error(this.translate.instant('errorAlActualizarElCliente') + error.error['hydra:description'], 'Error');
}
);
} else {
this.http.post(`${this.baseUrl}/clients`, formData).subscribe(
(response) => {
this.toastService.success('Cliente creado exitosamente', 'Éxito');
this.toastService.success(this.translate.instant('clienteCreadoExitosamente'), 'Éxito');
this.dialogRef.close({
success: true,
client: response,
@ -354,7 +357,7 @@ export class ManageClientComponent implements OnInit {
);
}
} else {
this.toastService.error('Formulario inválido. Por favor, revise los campos obligatorios.', 'Error');
this.toastService.error(this.translate.instant('formularioInvalidoPorFavorRevise'), 'Error');
}
}

View File

@ -22,7 +22,7 @@
@for (column of columns; track column.columnDef) {
<ng-container [matColumnDef]="column.columnDef">
<th mat-header-cell *matHeaderCellDef> {{ column.header }} </th>
<th mat-header-cell *matHeaderCellDef> {{ column.header | translate }} </th>
<td mat-cell *matCellDef="let partition">
@if (column.columnDef === 'size') {
<div style="display: flex; flex-direction: column;">

View File

@ -1,3 +1,5 @@
import { inject } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { Component, Inject, OnInit } from '@angular/core';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
import { HttpClient } from '@angular/common/http';
@ -11,6 +13,7 @@ import { ConfigService } from '@services/config.service';
styleUrls: ['./execute-command-ou.component.css']
})
export class ExecuteCommandOuComponent implements OnInit {
public translate = inject(TranslateService);
form: FormGroup;
clients: any[] = [];
commands: any[] = [];
@ -46,7 +49,7 @@ export class ExecuteCommandOuComponent implements OnInit {
const clientIds = this.clients.map(client => client.uuid);
this.form.get('clientSelection')?.setValue(clientIds);
},
error => console.error('Error al cargar los clientes:', error)
error => console.error(this.translate.instant('errorAlCargarLosClientes1'), error)
);
}
@ -65,7 +68,7 @@ export class ExecuteCommandOuComponent implements OnInit {
response => {
this.commands = response['hydra:member'] || [];
},
error => this.toastService.error('Error al cargar comandos:', error)
error => this.toastService.error(this.translate.instant('errorAlCargarComandos'), error)
);
}
@ -74,7 +77,7 @@ export class ExecuteCommandOuComponent implements OnInit {
response => {
this.commandGroups = response['hydra:member'] || [];
},
error => this.toastService.error('Error al cargar grupos de comandos:', error)
error => this.toastService.error(this.translate.instant('errorAlCargarGruposDe'), error)
);
}
@ -107,11 +110,11 @@ export class ExecuteCommandOuComponent implements OnInit {
this.http.post(url, payload)
.subscribe({
next: () => {
this.toastService.success('Comando ejecutado con éxito');
this.toastService.success(this.translate.instant('comandoEjecutadoConExito'));
this.dialogRef.close(true);
},
error: (error) => {
this.toastService.error('Error al ejecutar el comando:', error);
this.toastService.error(this.translate.instant('errorAlEjecutarElComando'), error);
this.dialogRef.close(false);
}
});

View File

@ -1,3 +1,5 @@
import { inject } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { Component, EventEmitter, Inject, OnInit, Output } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
@ -13,6 +15,7 @@ import { DeleteModalComponent } from '../../../../../shared/delete_modal/delete-
styleUrls: ['./manage-organizational-unit.component.css']
})
export class ManageOrganizationalUnitComponent implements OnInit {
public translate = inject(TranslateService);
baseUrl: string;
isLinear = true;
generalFormGroup: FormGroup;
@ -128,7 +131,7 @@ export class ManageOrganizationalUnitComponent implements OnInit {
this.loading = false;
}
}).catch(error => {
console.error('Error loading data:', error);
console.error(this.translate.instant('errorLoadingData'), error);
this.loading = false;
});
}
@ -173,7 +176,7 @@ export class ManageOrganizationalUnitComponent implements OnInit {
resolve();
},
error => {
console.error('Error fetching parent units:', error);
console.error(this.translate.instant('errorFetchingParentUnits'), error);
reject(error);
}
);
@ -286,8 +289,8 @@ export class ManageOrganizationalUnitComponent implements OnInit {
},
error => {
console.error('Error fetching data for edit:', error);
this.toastService.error('Error fetching data');
console.error(this.translate.instant('errorFetchingDataForEdit'), error);
this.toastService.error(this.translate.instant('errorFetchingData'));
reject(error);
this.onNoClick();
}
@ -301,8 +304,8 @@ export class ManageOrganizationalUnitComponent implements OnInit {
const confirmRef = this.dialog.open(DeleteModalComponent, {
width: '400px',
data: {
title: 'Propagar parámetros',
message: '¿Desea propagar los parámetros de red (ogLive, repositorio, menú, plantilla PXE, perfil hardware) a todos los clientes de esta unidad organizativa?',
title : this.translate.instant('propagarParametros'),
message : this.translate.instant('deseaPropagarLosParametrosDe'),
confirmText: 'Sí, propagar',
cancelText: 'No, solo guardar',
}
@ -351,11 +354,11 @@ export class ManageOrganizationalUnitComponent implements OnInit {
} else {
this.unitAdded.emit();
this.dialogRef.close({ success: true });
this.toastService.success('Editado exitosamente', 'Éxito');
this.toastService.success(this.translate.instant('editadoExitosamente'), 'Éxito');
}
},
error => {
console.error('Error al realizar PUT:', error);
console.error(this.translate.instant('errorAlRealizarPut'), error);
const errorMessages = error.error['hydra:description'].split('\n');
errorMessages.forEach((message: string) => {
const cleanedMessage = message.replace(/networkSettings\.(\w+):/, 'Error $1:');
@ -371,10 +374,10 @@ export class ManageOrganizationalUnitComponent implements OnInit {
response => {
this.unitAdded.emit(response);
this.dialogRef.close({ success: true });
this.toastService.success('Creado exitosamente', 'Éxito');
this.toastService.success(this.translate.instant('creadoExitosamente'), 'Éxito');
},
error => {
console.error('Error al realizar POST:', error);
console.error(this.translate.instant('errorAlRealizarPost'), error);
const errorMessages = error.error['hydra:description'].split('\n');
errorMessages.forEach((message: string) => {
const cleanedMessage = message.replace(/networkSettings\.(\w+):/, 'Error $1:');
@ -393,13 +396,13 @@ export class ManageOrganizationalUnitComponent implements OnInit {
() => {
this.unitAdded.emit();
this.dialogRef.close({ success: true });
this.toastService.success('Editado y parámetros propagados exitosamente', 'Éxito');
this.toastService.success(this.translate.instant('editadoYParametrosPropagadosExitosamente'), 'Éxito');
},
error => {
console.error('Error al propagar parámetros:', error);
console.error(this.translate.instant('errorAlPropagarParametros'), error);
this.unitAdded.emit();
this.dialogRef.close({ success: true });
this.toastService.warning('Guardado, pero hubo un error al propagar los parámetros', 'Aviso');
this.toastService.warning(this.translate.instant('guardadoPeroHuboUnError'), 'Aviso');
}
);
}
@ -419,7 +422,7 @@ export class ManageOrganizationalUnitComponent implements OnInit {
resolve();
},
error => {
console.error('Error fetching BootServers:', error);
console.error(this.translate.instant('errorFetchingBootservers'), error);
reject(error);
}
);
@ -435,7 +438,7 @@ export class ManageOrganizationalUnitComponent implements OnInit {
resolve();
},
error => {
console.error('Error fetching ogLives by server:', error);
console.error(this.translate.instant('errorFetchingOglivesByServer'), error);
this.ogLives = [];
resolve();
}
@ -452,7 +455,7 @@ export class ManageOrganizationalUnitComponent implements OnInit {
resolve();
},
error => {
console.error('Error fetching PXE templates by server:', error);
console.error(this.translate.instant('errorFetchingPxeTemplatesBy'), error);
this.pxeTemplates = [];
resolve();
}
@ -481,7 +484,7 @@ export class ManageOrganizationalUnitComponent implements OnInit {
resolve();
},
error => {
console.error('Error fetching hardware profiles:', error);
console.error(this.translate.instant('errorFetchingHardwareProfiles'), error);
reject(error);
}
);
@ -500,7 +503,7 @@ export class ManageOrganizationalUnitComponent implements OnInit {
resolve();
},
error => {
console.error('Error fetching menus:', error);
console.error(this.translate.instant('errorFetchingMenus1'), error);
reject(error);
}
);
@ -517,7 +520,7 @@ export class ManageOrganizationalUnitComponent implements OnInit {
resolve();
},
error => {
console.error('Error fetching ogLives:', error);
console.error(this.translate.instant('errorFetchingOglives'), error);
reject(error);
}
);
@ -533,8 +536,8 @@ export class ManageOrganizationalUnitComponent implements OnInit {
resolve();
},
error => {
console.error('Error loading calendars', error);
this.toastService.error('Error loading current calendar');
console.error(this.translate.instant('errorLoadingCalendars'), error);
this.toastService.error(this.translate.instant('errorLoadingCurrentCalendar'));
reject(error);
}
);

View File

@ -1,3 +1,5 @@
import { inject } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { HttpClient } from '@angular/common/http';
import { Component, Inject, OnInit } from '@angular/core';
import { MAT_DIALOG_DATA, MatDialogRef } from "@angular/material/dialog";
@ -10,6 +12,7 @@ import { ConfigService } from '@services/config.service';
styleUrl: './show-organizational-unit.component.css'
})
export class ShowOrganizationalUnitComponent implements OnInit {
public translate = inject(TranslateService);
baseUrl: string;
displayedColumns: string[] = ['property', 'value'];
currentCalendar: any;
@ -50,7 +53,7 @@ export class ShowOrganizationalUnitComponent implements OnInit {
this.initializeData();
},
error => {
console.error('Error loading organizational unit', error);
console.error(this.translate.instant('errorLoadingOrganizationalUnit'), error);
this.initializeData();
});
}
@ -63,7 +66,7 @@ export class ShowOrganizationalUnitComponent implements OnInit {
this.initializeData();
},
error => {
console.error('Error loading current calendar', error);
console.error(this.translate.instant('errorLoadingCurrentCalendar'), error);
this.initializeData();
}
);

View File

@ -11,7 +11,7 @@
<div *ngIf="dataSource.data.length > 0" class="hardware-table-container">
<table mat-table [dataSource]="dataSource">
<ng-container *ngFor="let column of columns" [matColumnDef]="column.columnDef">
<th mat-header-cell *matHeaderCellDef> {{ column.header }} </th>
<th mat-header-cell *matHeaderCellDef> {{ column.header | translate }} </th>
<td mat-cell *matCellDef="let hardware">
{{ column.cell(hardware) }}
</td>

View File

@ -14,22 +14,22 @@ export class HardwareCollectionModalComponent {
columns = [
{
columnDef: 'id',
header: 'ID',
header: 'id',
cell: (hardware: any) => hardware.id || hardware['@id']?.split('/').pop() || 'N/A'
},
{
columnDef: 'name',
header: 'Nombre',
header: 'nombre',
cell: (hardware: any) => hardware.name || 'N/A'
},
{
columnDef: 'type',
header: 'Tipo',
header: 'tipo',
cell: (hardware: any) => hardware.type || 'N/A'
},
{
columnDef: 'description',
header: 'Descripción',
header: 'descripcion',
cell: (hardware: any) => hardware.description || 'N/A'
}
];

View File

@ -39,7 +39,7 @@
<table mat-table [dataSource]="dataSource" class="mat-elevation-z8" joyride="tableStep"
text="Aquí se mostrará todo el hardware disponible y sus características.">
<ng-container *ngFor="let column of columns" [matColumnDef]="column.columnDef">
<th mat-header-cell *matHeaderCellDef> {{ column.header }} </th>
<th mat-header-cell *matHeaderCellDef> {{ column.header | translate }} </th>
<td mat-cell *matCellDef="let image">
<ng-container *ngIf="column.columnDef === 'isDefault' || column.columnDef === 'installed'">
<mat-icon [color]="image[column.columnDef] ? 'primary' : 'warn'">

View File

@ -1,3 +1,5 @@
import { inject } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { Component, signal } from '@angular/core';
import { MatTableDataSource } from "@angular/material/table";
import { DatePipe } from "@angular/common";
@ -19,6 +21,7 @@ import { FormControl } from '@angular/forms';
styleUrl: './hardware-profile.component.css'
})
export class HardwareProfileComponent {
public translate = inject(TranslateService);
baseUrl: string;
private apiUrl: string;
dataSource = new MatTableDataSource<any>();
@ -37,17 +40,17 @@ export class HardwareProfileComponent {
columns = [
{
columnDef: 'id',
header: 'ID',
header: 'id',
cell: (hardware: any) => `${hardware.id}`,
},
{
columnDef: 'description',
header: 'Descripción',
header: 'descripcion',
cell: (hardware: any) => hardware.description
},
{
columnDef: 'client',
header: 'Cliente',
header: 'cliente',
cell: (hardware: any) => hardware.client ? {
name: hardware.client.name || 'N/A',
ip: hardware.client.ip || 'N/A',
@ -56,7 +59,7 @@ export class HardwareProfileComponent {
},
{
columnDef: 'createdAt',
header: 'Fecha de creación',
header: 'fechaDeCreacion',
cell: (hardware: any) => `${this.datePipe.transform(hardware.createdAt, 'dd/MM/yyyy hh:mm:ss')}`,
}
];
@ -91,7 +94,7 @@ export class HardwareProfileComponent {
this.length = data['hydra:totalItems'];
},
(error) => {
console.error('Error fetching commands', error);
console.error(this.translate.instant('errorFetchingCommands'), error);
}
);
}
@ -142,10 +145,10 @@ export class HardwareProfileComponent {
this.http.delete(apiUrl).subscribe({
next: () => {
this.search();
this.toastService.success('Hardware deleted successfully');
this.toastService.success(this.translate.instant('hardwareDeletedSuccessfully'));
},
error: (error) => {
this.toastService.error('Error deleting hardware');
this.toastService.error(this.translate.instant('errorDeletingHardware'));
}
});
} else {
@ -185,8 +188,8 @@ export class HardwareProfileComponent {
this.openHardwareCollectionModal(hardwareProfile);
},
error: (error) => {
console.error('Error fetching hardware profile details:', error);
this.toastService.error('Error al obtener los detalles del perfil de hardware');
console.error(this.translate.instant('errorFetchingHardwareProfileDetails'), error);
this.toastService.error(this.translate.instant('errorAlObtenerLosDetalles'));
}
});
}

View File

@ -36,7 +36,7 @@
<table mat-table [dataSource]="dataSource" class="mat-elevation-z8" joyride="tableStep"
text="Aquí se mostrará todo el hardware disponible y sus características.">
<ng-container *ngFor="let column of columns" [matColumnDef]="column.columnDef">
<th mat-header-cell *matHeaderCellDef> {{ column.header }} </th>
<th mat-header-cell *matHeaderCellDef> {{ column.header | translate }} </th>
<td mat-cell *matCellDef="let image">
<ng-container *ngIf="column.columnDef === 'isDefault' || column.columnDef === 'installed'">
<mat-icon [color]="image[column.columnDef] ? 'primary' : 'warn'">

View File

@ -1,3 +1,5 @@
import { inject } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { Component, signal } from '@angular/core';
import { MatTableDataSource } from "@angular/material/table";
import { DatePipe } from "@angular/common";
@ -15,6 +17,7 @@ import { ConfigService } from '@services/config.service';
styleUrl: './hardware-type.component.css'
})
export class HardwareTypeComponent {
public translate = inject(TranslateService);
baseUrl: string;
private apiUrl: string;
dataSource = new MatTableDataSource<any>();
@ -30,27 +33,27 @@ export class HardwareTypeComponent {
columns = [
{
columnDef: 'id',
header: 'ID',
header: 'id',
cell: (hardware: any) => `${hardware.id}`,
},
{
columnDef: 'name',
header: 'Nombre',
header: 'nombre',
cell: (hardware: any) => hardware.name
},
{
columnDef: 'code',
header: 'Código',
header: 'codigo',
cell: (hardware: any) => hardware.code
},
{
columnDef: 'description',
header: 'Descripción',
header: 'descripcion',
cell: (hardware: any) => hardware.description
},
{
columnDef: 'createdAt',
header: 'Fecha de creación',
header: 'fechaDeCreacion',
cell: (hardware: any) => `${this.datePipe.transform(hardware.createdAt, 'dd/MM/yyyy hh:mm:ss')}`,
}
];
@ -78,7 +81,7 @@ export class HardwareTypeComponent {
this.length = data['hydra:totalItems'];
},
(error) => {
console.error('Error fetching commands', error);
console.error(this.translate.instant('errorFetchingCommands'), error);
}
);
}
@ -96,10 +99,10 @@ export class HardwareTypeComponent {
this.http.delete(apiUrl).subscribe({
next: () => {
this.search();
this.toastService.success('Hardware deleted successfully');
this.toastService.success(this.translate.instant('hardwareDeletedSuccessfully'));
},
error: (error) => {
this.toastService.error('Error deleting hardware');
this.toastService.error(this.translate.instant('errorDeletingHardware'));
}
});
} else {

View File

@ -36,7 +36,7 @@
<table mat-table [dataSource]="dataSource" class="mat-elevation-z8" joyride="tableStep"
text="Aquí se mostrará todo el hardware disponible y sus características.">
<ng-container *ngFor="let column of columns" [matColumnDef]="column.columnDef">
<th mat-header-cell *matHeaderCellDef> {{ column.header }} </th>
<th mat-header-cell *matHeaderCellDef> {{ column.header | translate }} </th>
<td mat-cell *matCellDef="let image">
<ng-container *ngIf="column.columnDef === 'isDefault' || column.columnDef === 'installed'">
<mat-icon [color]="image[column.columnDef] ? 'primary' : 'warn'">

View File

@ -1,3 +1,5 @@
import { inject } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { Component, signal } from '@angular/core';
import { MatTableDataSource } from "@angular/material/table";
import { DatePipe } from "@angular/common";
@ -16,6 +18,7 @@ import { CreateHardwareComponent } from './create-hardware/create-hardware.compo
styleUrl: './hardware.component.css'
})
export class HardwareComponent {
public translate = inject(TranslateService);
baseUrl: string;
private apiUrl: string;
dataSource = new MatTableDataSource<any>();
@ -31,22 +34,22 @@ export class HardwareComponent {
columns = [
{
columnDef: 'id',
header: 'ID',
header: 'id',
cell: (hardware: any) => `${hardware.id}`,
},
{
columnDef: 'name',
header: 'Nombre',
header: 'nombre',
cell: (hardware: any) => hardware.name
},
{
columnDef: 'type',
header: 'Tipo',
header: 'tipo',
cell: (hardware: any) => hardware.type?.name || 'N/A'
},
{
columnDef: 'createdAt',
header: 'Fecha de creación',
header: 'fechaDeCreacion',
cell: (hardware: any) => `${this.datePipe.transform(hardware.createdAt, 'dd/MM/yyyy hh:mm:ss')}`,
}
];
@ -74,7 +77,7 @@ export class HardwareComponent {
this.length = data['hydra:totalItems'];
},
(error) => {
console.error('Error fetching commands', error);
console.error(this.translate.instant('errorFetchingCommands'), error);
}
);
}
@ -92,10 +95,10 @@ export class HardwareComponent {
this.http.delete(apiUrl).subscribe({
next: () => {
this.search();
this.toastService.success('Hardware deleted successfully');
this.toastService.success(this.translate.instant('hardwareDeletedSuccessfully'));
},
error: (error) => {
this.toastService.error('Error deleting hardware');
this.toastService.error(this.translate.instant('errorDeletingHardware'));
}
});
} else {

View File

@ -1,3 +1,5 @@
import { inject } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { Component, Inject, OnInit } from '@angular/core';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
import { HttpClient } from '@angular/common/http';
@ -12,6 +14,7 @@ import { ConfigService } from '@services/config.service';
styleUrls: ['./create-image.component.css']
})
export class CreateImageComponent implements OnInit {
public translate = inject(TranslateService);
baseUrl: string;
imageForm: FormGroup<any>;
imageId: string | null = null;
@ -72,7 +75,7 @@ export class CreateImageComponent implements OnInit {
this.loading = false;
},
error: (err) => {
console.error('Error fetching remote calendar:', err);
console.error(this.translate.instant('errorFetchingRemoteCalendar'), err);
this.loading = false;
}
});
@ -89,7 +92,7 @@ export class CreateImageComponent implements OnInit {
this.softwareProfiles = response['hydra:member'];
},
error: (error) => {
this.toastService.error('Error al obtener los perfiles de software');
this.toastService.error(this.translate.instant('errorAlObtenerLosPerfiles'));
}
});
}
@ -101,7 +104,7 @@ export class CreateImageComponent implements OnInit {
this.repositories = response['hydra:member'];
},
error: (error) => {
this.toastService.error('Error al obtener los repositorios de imágenes');
this.toastService.error(this.translate.instant('errorAlObtenerLosRepositorios'));
}
});
}
@ -120,7 +123,7 @@ export class CreateImageComponent implements OnInit {
if (this.imageId) {
this.http.put(`${this.baseUrl}${this.imageId}`, payload).subscribe(
(response) => {
this.toastService.success('Imagen editada correctamente');
this.toastService.success(this.translate.instant('imagenEditadaCorrectamente'));
this.dialogRef.close();
},
(error) => {
@ -130,7 +133,7 @@ export class CreateImageComponent implements OnInit {
} else {
this.http.post(`${this.baseUrl}/images`, payload).subscribe(
(response) => {
this.toastService.success('Imagen añadida correctamente');
this.toastService.success(this.translate.instant('imagenAnadidaCorrectamente'));
this.dialogRef.close();
},
(error) => {

View File

@ -1,3 +1,5 @@
import { inject } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { Injectable } from '@angular/core';
import { HttpClient, HttpParams } from '@angular/common/http';
import { Observable, throwError } from 'rxjs';
@ -8,6 +10,7 @@ import { ConfigService } from '@services/config.service';
providedIn: 'root'
})
export class DataService {
public translate = inject(TranslateService);
baseUrl: string;
private apiUrl: string;
@ -31,7 +34,7 @@ export class DataService {
}
}),
catchError(error => {
console.error('Error fetching commands', error);
console.error(this.translate.instant('errorFetchingCommands'), error);
return throwError(error);
})
);
@ -47,7 +50,7 @@ export class DataService {
}
}),
catchError(error => {
console.error('Error fetching user group', error);
console.error(this.translate.instant('errorFetchingUserGroup'), error);
return throwError(error);
})
);

View File

@ -1,3 +1,5 @@
import { inject } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { Component, Inject, OnInit } from '@angular/core';
import { HttpClient } from "@angular/common/http";
import { MAT_DIALOG_DATA, MatDialogRef } from "@angular/material/dialog";
@ -11,6 +13,7 @@ import { ConfigService } from '@services/config.service';
styleUrl: './export-image.component.css'
})
export class ExportImageComponent implements OnInit {
public translate = inject(TranslateService);
baseUrl: string;
loading: boolean = true;
repositories: any[] = [];
@ -48,7 +51,7 @@ export class ExportImageComponent implements OnInit {
this.loading = false;
},
error => {
console.error('Error fetching repositories:', error);
console.error(this.translate.instant('errorFetchingRepositories1'), error);
this.loading = false;
}
);
@ -60,14 +63,14 @@ export class ExportImageComponent implements OnInit {
repositories: this.selectedRepositories
}).subscribe({
next: (response) => {
this.toastService.success('Petición de exportación de imagen realizada correctamente');
this.toastService.success(this.translate.instant('peticionDeExportacionDeImagen'));
this.dialogRef.close();
this.loading = false;
this.router.navigate(['/commands-logs']);
},
error: error => {
this.loading = false;
this.toastService.error('Error en la petición de exportación de imagen');
this.toastService.error(this.translate.instant('errorEnLaPeticionDe'));
}
});
}

View File

@ -30,7 +30,7 @@
<table mat-table [dataSource]="dataSource" class="mat-elevation-z8" joyrideStep="imagesTable"
text="Esta tabla muestra las imágenes disponibles.">
<ng-container *ngFor="let column of columns" [matColumnDef]="column.columnDef">
<th mat-header-cell *matHeaderCellDef> {{ column.header }} </th>
<th mat-header-cell *matHeaderCellDef> {{ column.header | translate }} </th>
<td mat-cell *matCellDef="let image">
<ng-container *ngIf="column.columnDef === 'remotePc'">
<mat-icon [color]="image[column.columnDef] ? 'primary' : 'warn'">

View File

@ -1,3 +1,5 @@
import { inject } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { Component, Input, OnInit } from '@angular/core';
import { MatDialog } from '@angular/material/dialog';
import { HttpClient } from '@angular/common/http';
@ -13,6 +15,7 @@ import { JoyrideService } from 'ngx-joyride';
styleUrls: ['./images.component.css']
})
export class ImagesComponent implements OnInit {
public translate = inject(TranslateService);
baseUrl: string;
private apiUrl: string;
dataSource = new MatTableDataSource<any>();
@ -26,32 +29,32 @@ export class ImagesComponent implements OnInit {
columns = [
{
columnDef: 'id',
header: 'Id',
header: 'id1',
cell: (image: any) => `${image.id}`
},
{
columnDef: 'name',
header: 'Nombre de imagen',
header: 'nombreDeImagen',
cell: (image: any) => `${image.name}`
},
{
columnDef: 'imageRepositories',
header: 'Repositorios',
header: 'repositorios',
cell: (image: any) => `${image.imageRepositories}`
},
{
columnDef: 'remotePc',
header: 'Remote Pc',
header: 'remotePc',
cell: (image: any) => `${image.remotePc}`
},
{
columnDef: 'isGlobal',
header: 'Imagen Global',
header: 'imagenGlobal',
cell: (image: any) => `${image.isGlobal}`
},
{
columnDef: 'createdAt',
header: 'Fecha de creación',
header: 'fechaDeCreacion',
cell: (image: any) => `${this.datePipe.transform(image.createdAt, 'dd/MM/yyyy hh:mm:ss')}`
}
];
@ -85,7 +88,7 @@ export class ImagesComponent implements OnInit {
this.search();
},
error => {
console.error('Error fetching image repositories', error);
console.error(this.translate.instant('errorFetchingImageRepositories'), error);
}
)
}
@ -109,7 +112,7 @@ export class ImagesComponent implements OnInit {
this.loading = false;
},
error => {
console.error('Error fetching images', error);
console.error(this.translate.instant('errorFetchingImages'), error);
this.loading = false;
}
);

View File

@ -1,3 +1,5 @@
import { inject } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { Component, OnInit } from '@angular/core';
import { MatDialogRef, MatDialog } from '@angular/material/dialog';
import { ToastrService } from 'ngx-toastr';
@ -17,6 +19,7 @@ export interface AssetNode {
styleUrls: ['./asset-manager-modal.component.css']
})
export class AssetManagerModalComponent implements OnInit {
public translate = inject(TranslateService);
currentPath: string = '';
assets: AssetNode[] = [];
isLoading: boolean = false;
@ -43,7 +46,7 @@ export class AssetManagerModalComponent implements OnInit {
},
error: (err) => {
this.isLoading = false;
this.toastService.error('Error al cargar la ruta actual.');
this.toastService.error(this.translate.instant('errorAlCargarLaRuta'));
console.error(err);
// If we failed traversing down, fallback to root
@ -106,7 +109,7 @@ export class AssetManagerModalComponent implements OnInit {
this.isLoading = true;
this.dataService.deleteAsset(path).subscribe({
next: (res) => {
this.toastService.success('Elemento eliminado correctamente.');
this.toastService.success(this.translate.instant('elementoEliminadoCorrectamente'));
this.loadAssets();
},
error: (err) => {
@ -124,7 +127,7 @@ export class AssetManagerModalComponent implements OnInit {
navigator.clipboard.writeText(fullUrl).then(() => {
this.toastService.info(`Enlace copiado: ${fullUrl}`);
}).catch(err => {
console.error('Error al copiar al portapapeles', err);
console.error(this.translate.instant('errorAlCopiarAlPortapapeles'), err);
});
}

View File

@ -1,3 +1,5 @@
import { inject } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { Component, Inject, OnInit } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from "@angular/forms";
import { HttpClient } from "@angular/common/http";
@ -13,6 +15,7 @@ import { ConfigService } from '@services/config.service';
styleUrl: './create-menu.component.css'
})
export class CreateMenuComponent implements OnInit {
public translate = inject(TranslateService);
baseUrl: string;
menuForm: FormGroup<any>;
menuId: string | null = null;
@ -83,7 +86,7 @@ export class CreateMenuComponent implements OnInit {
}
this.htmlEditorContent = new TextDecoder('utf-8').decode(bytes);
} catch (e) {
console.error('Failed to decode previous fileContent Base64', e);
console.error(this.translate.instant('failedToDecodePreviousFilecontent'), e);
this.htmlEditorContent = '<!-- Error decodificando HTML anterior -->';
}
this.isEditingHtml = true;
@ -96,7 +99,7 @@ export class CreateMenuComponent implements OnInit {
this.isEditingHtml = true;
},
error: (err) => {
this.toastService.error('No se pudo descargar el HTML/Twig original del menú para editarlo.');
this.toastService.error(this.translate.instant('noSePudoDescargarEl'));
console.error(err);
}
});
@ -125,18 +128,18 @@ export class CreateMenuComponent implements OnInit {
this.isEditingHtml = false;
const dataUrl = `data:text/html;base64,${renderedBase64}`;
this.safeUrl = this.sanitizer.bypassSecurityTrustResourceUrl(dataUrl);
this.toastService.success('Vista previa generada. Pulsa Guardar para aplicar la plantilla remota permanentemente.');
this.toastService.success(this.translate.instant('vistaPreviaGeneradaPulsaGuardar'));
},
error: (err) => {
console.error('Failed to preview generated HTML', err);
console.error(this.translate.instant('failedToPreviewGeneratedHtml'), err);
const msg = err.error?.message || 'Error compilando la plantilla Twig.';
this.toastService.error(msg);
}
});
} catch (e) {
console.error('Failed to encode updated HTML to Base64', e);
this.toastService.error('Hubo un problema procesando los caracteres especiales del HTML.');
console.error(this.translate.instant('failedToEncodeUpdatedHtml'), e);
this.toastService.error(this.translate.instant('huboUnProblemaProcesandoLos'));
}
}
}
@ -166,7 +169,7 @@ export class CreateMenuComponent implements OnInit {
this.updateSafeUrl()
},
error: (err) => {
console.error('Error fetching remote calendar:', err);
console.error(this.translate.instant('errorFetchingRemoteCalendar'), err);
}
});
}
@ -187,23 +190,23 @@ export class CreateMenuComponent implements OnInit {
if (this.menuId) {
this.http.put(`${this.baseUrl}${this.menuId}`, payload).subscribe(
(response) => {
this.toastService.success('Menu editado correctamente');
this.toastService.success(this.translate.instant('menuEditadoCorrectamente'));
this.dialogRef.close();
},
(error) => {
this.toastService.error(error['error']['hydra:description']);
console.error('Error al editar la imagen', error);
console.error(this.translate.instant('errorAlEditarLaImagen'), error);
}
);
} else {
this.http.post(`${this.baseUrl}/menus`, payload).subscribe(
(response) => {
this.toastService.success('Menu añadido correctamente');
this.toastService.success(this.translate.instant('menuAnadidoCorrectamente'));
this.dialogRef.close();
},
(error) => {
this.toastService.error(error['error']['hydra:description']);
console.error('Error al añadir el menu', error);
console.error(this.translate.instant('errorAlAnadirElMenu'), error);
}
);
}

View File

@ -1,3 +1,5 @@
import { inject } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { ConfigService } from '@services/config.service';
import { Injectable } from '@angular/core';
import { HttpClient, HttpParams } from '@angular/common/http';
@ -8,6 +10,7 @@ import { catchError, map } from 'rxjs/operators';
providedIn: 'root'
})
export class DataService {
public translate = inject(TranslateService);
baseUrl: string;
private apiUrl: string;
@ -20,7 +23,7 @@ export class DataService {
const url = `${this.baseUrl}/menu-raw/${publicUrl}`;
return this.http.get(url, { responseType: 'text' }).pipe(
catchError(error => {
console.error('Error fetching raw menu template', error);
console.error(this.translate.instant('errorFetchingRawMenuTemplate'), error);
return throwError(() => error);
})
);
@ -30,7 +33,7 @@ export class DataService {
const url = `${this.baseUrl}/menu-preview`;
return this.http.post(url, { templateBase64: base64Template }, { responseType: 'text' }).pipe(
catchError(error => {
console.error('Error previewing menu template', error);
console.error(this.translate.instant('errorPreviewingMenuTemplate'), error);
return throwError(() => error);
})
);
@ -51,7 +54,7 @@ export class DataService {
}
}),
catchError(error => {
console.error('Error fetching commands', error);
console.error(this.translate.instant('errorFetchingCommands'), error);
return throwError(() => error);
})
);
@ -67,7 +70,7 @@ export class DataService {
}
}),
catchError(error => {
console.error('Error fetching menus', error);
console.error(this.translate.instant('errorFetchingMenus'), error);
return throwError(() => error);
})
);
@ -77,7 +80,7 @@ export class DataService {
const params = new HttpParams().set('path', path);
return this.http.get<any[]>(`${this.baseUrl}/ogassets/list`, { params }).pipe(
catchError(error => {
console.error('Error fetching assets', error);
console.error(this.translate.instant('errorFetchingAssets'), error);
return throwError(() => error);
})
);
@ -91,7 +94,7 @@ export class DataService {
return this.http.post<any>(`${this.baseUrl}/ogassets/upload`, formData).pipe(
catchError(error => {
console.error('Error uploading assets', error);
console.error(this.translate.instant('errorUploadingAssets'), error);
return throwError(() => error);
})
);
@ -102,7 +105,7 @@ export class DataService {
body: { path }
}).pipe(
catchError(error => {
console.error('Error deleting asset', error);
console.error(this.translate.instant('errorDeletingAsset'), error);
return throwError(() => error);
})
);

View File

@ -25,7 +25,7 @@
<table mat-table [dataSource]="dataSource" class="mat-elevation-z8">
<ng-container *ngFor="let column of columns" [matColumnDef]="column.columnDef">
<th mat-header-cell *matHeaderCellDef> {{ column.header }} </th>
<th mat-header-cell *matHeaderCellDef> {{ column.header | translate }} </th>
<td mat-cell *matCellDef="let menu">
<ng-container *ngIf="column.columnDef !== 'isDefault'">
{{ column.cell(menu) }}

View File

@ -1,3 +1,5 @@
import { inject } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { Component, OnInit } from '@angular/core';
import { MatTableDataSource } from "@angular/material/table";
import { DatePipe } from "@angular/common";
@ -17,6 +19,7 @@ import { ConfigService } from '@services/config.service';
styleUrl: './menus.component.css'
})
export class MenusComponent implements OnInit {
public translate = inject(TranslateService);
baseUrl: string;
private apiUrl: string;
dataSource = new MatTableDataSource<any>();
@ -29,32 +32,32 @@ export class MenusComponent implements OnInit {
columns = [
{
columnDef: 'id',
header: 'Id',
header: 'id1',
cell: (menu: any) => `${menu.id}`
},
{
columnDef: 'name',
header: 'Nombre de menú',
header: 'nombreDeMenu',
cell: (menu: any) => `${menu.name}`
},
{
columnDef: 'publicUrl',
header: 'Url pública',
header: 'urlPublica',
cell: (menu: any) => `${this.baseUrl}/menu/${menu.publicUrl}`
},
{
columnDef: 'isDefault',
header: 'Por defecto',
header: 'porDefecto',
cell: (menu: any) => `${menu.isDefault}`
},
{
columnDef: 'resolution',
header: 'Resolución',
header: 'resolucion',
cell: (menu: any) => `${menu.resolution}`
},
{
columnDef: 'createdAt',
header: 'Fecha de creación',
header: 'fechaDeCreacion',
cell: (menu: any) => `${this.datePipe.transform(menu.createdAt, 'dd/MM/yyyy hh:mm:ss')}`
}
];
@ -106,7 +109,7 @@ export class MenusComponent implements OnInit {
this.loading = false;
},
error => {
console.error('Error fetching images', error);
console.error(this.translate.instant('errorFetchingImages'), error);
this.loading = false;
}
);
@ -129,11 +132,11 @@ export class MenusComponent implements OnInit {
if (result) {
this.http.delete(`${this.apiUrl}/${menu.uuid}`).subscribe({
next: () => {
this.toastService.success('Menu eliminado con éxito');
this.toastService.success(this.translate.instant('menuEliminadoConExito'));
this.search();
},
error: (error) => {
console.error('Error al eliminar el menú:', error);
console.error(this.translate.instant('errorAlEliminarElMenu'), error);
}
});
}

View File

@ -35,7 +35,7 @@
<table mat-table [dataSource]="dataSource" class="mat-elevation-z8" joyrideStep="tableDateStep" text="Tabla de Servidores OgBoot">
@for (column of columns; track column.columnDef) {
<ng-container [matColumnDef]="column.columnDef">
<th mat-header-cell *matHeaderCellDef> {{ column.header }} </th>
<th mat-header-cell *matHeaderCellDef> {{ column.header | translate }} </th>
<td mat-cell *matCellDef="let server">
{{ column.cell(server) }}
</td>

View File

@ -1,4 +1,6 @@
import {Component, OnInit} from '@angular/core';
import { inject } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import {Component, OnInit } from '@angular/core';
import {MatTableDataSource} from "@angular/material/table";
import {DatePipe} from "@angular/common";
import {MatDialog} from "@angular/material/dialog";
@ -17,6 +19,7 @@ import { forkJoin } from 'rxjs';
styleUrl: './boot-servers.component.css'
})
export class BootServersComponent implements OnInit {
public translate = inject(TranslateService);
baseUrl: string;
private apiUrl: string;
dataSource = new MatTableDataSource<any>();
@ -29,32 +32,32 @@ export class BootServersComponent implements OnInit {
columns = [
{
columnDef: 'id',
header: 'Id',
header: 'id1',
cell: (server: any) => `${server.id}`
},
{
columnDef: 'name',
header: 'Nombre',
header: 'nombre',
cell: (server: any) => server.name
},
{
columnDef: 'ip',
header: 'Ip',
header: 'ip',
cell: (server: any) => server.ip
},
{
columnDef: 'apiPort',
header: 'Puerto API',
header: 'puertoApi',
cell: (server: any) => server.apiPort
},
{
columnDef: 'pxePort',
header: 'Puerto PXE',
header: 'puertoPxe',
cell: (server: any) => server.pxePort
},
{
columnDef: 'createdAt',
header: 'Fecha de creación',
header: 'fechaDeCreacion',
cell: (server: any) => `${this.datePipe.transform(server.createdAt, 'dd/MM/yyyy hh:mm:ss')}`
}
];
@ -123,12 +126,12 @@ export class BootServersComponent implements OnInit {
if (result) {
this.http.delete(`${this.apiUrl}/${server.uuid}`).subscribe({
next: () => {
this.toastService.success('Servidor eliminado con éxito');
this.toastService.success(this.translate.instant('servidorEliminadoConExito'));
this.search();
},
error: (error) => {
console.error('Error al eliminar servidor:', error);
this.toastService.error('Error al eliminar el servidor');
console.error(this.translate.instant('errorAlEliminarServidor'), error);
this.toastService.error(this.translate.instant('errorAlEliminarElServidor'));
}
});
}
@ -159,13 +162,13 @@ export class BootServersComponent implements OnInit {
forkJoin(syncRequests).subscribe({
next: () => {
this.toastService.success('Sincronización completada con éxito');
this.toastService.success(this.translate.instant('sincronizacionCompletadaConExito'));
this.loading = false;
this.search();
},
error: (error: any) => {
console.error('Error durante la sincronización:', error);
this.toastService.error('Error durante la sincronización');
console.error(this.translate.instant('errorDuranteLaSincronizacion1'), error);
this.toastService.error(this.translate.instant('errorDuranteLaSincronizacion'));
this.loading = false;
}
});

View File

@ -1,3 +1,5 @@
import { inject } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { Component, Inject, OnInit } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from "@angular/forms";
import { HttpClient } from "@angular/common/http";
@ -11,6 +13,7 @@ import { ConfigService } from "@services/config.service";
styleUrl: './manage-boot-server.component.css'
})
export class ManageBootServerComponent implements OnInit {
public translate = inject(TranslateService);
baseUrl: string;
bootServerForm: FormGroup<any>;
serverId: string | null = null;
@ -52,8 +55,8 @@ export class ManageBootServerComponent implements OnInit {
this.serverId = response['@id'];
},
error: (err) => {
console.error('Error fetching boot server:', err);
this.toastService.error('Error cargando los datos del servidor');
console.error(this.translate.instant('errorFetchingBootServer'), err);
this.toastService.error(this.translate.instant('errorCargandoLosDatosDel'));
}
});
}
@ -70,7 +73,7 @@ export class ManageBootServerComponent implements OnInit {
if (this.serverId) {
this.http.put(`${this.baseUrl}${this.serverId}`, payload).subscribe({
next: () => {
this.toastService.success('Servidor Boot actualizado correctamente');
this.toastService.success(this.translate.instant('servidorBootActualizadoCorrectamente'));
this.dialogRef.close(true);
},
error: (error) => {
@ -80,7 +83,7 @@ export class ManageBootServerComponent implements OnInit {
} else {
this.http.post(`${this.baseUrl}/boot-servers`, payload).subscribe({
next: () => {
this.toastService.success('Servidor Boot añadido correctamente');
this.toastService.success(this.translate.instant('servidorBootAnadidoCorrectamente'));
this.dialogRef.close(true);
},
error: (error) => {

View File

@ -1,3 +1,5 @@
import { inject } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { Injectable } from '@angular/core';
import {HttpClient, HttpParams} from '@angular/common/http';
import { Observable, throwError } from 'rxjs';
@ -8,6 +10,7 @@ import { DataService as TemplateDataService } from './../pxe/data.service';
providedIn: 'root'
})
export class DataService {
public translate = inject(TranslateService);
baseUrl: string = this.configService.apiUrl;
private apiUrl = `${this.baseUrl}/pxe-boot-files?page=1&itemsPerPage=1000`;
@ -28,7 +31,7 @@ export class DataService {
}
}),
catchError(error => {
console.error('Error fetching images', error);
console.error(this.translate.instant('errorFetchingImages'), error);
return throwError(error);
})
);

View File

@ -1,3 +1,5 @@
import { inject } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { Component, OnInit, Input } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { HttpClient } from '@angular/common/http';
@ -16,6 +18,7 @@ import { forkJoin } from 'rxjs';
styleUrls: ['./pxe-boot-files.component.css']
})
export class PxeBootFilesComponent implements OnInit {
public translate = inject(TranslateService);
baseUrl: string;
availableOrganizationalUnits: any[] = [];
@ -80,7 +83,7 @@ export class PxeBootFilesComponent implements OnInit {
}
},
error => {
console.error('Error fetching BootServers:', error);
console.error(this.translate.instant('errorFetchingBootservers'), error);
}
);
}
@ -96,7 +99,7 @@ export class PxeBootFilesComponent implements OnInit {
response => {
this.units = response['hydra:member'];
},
error => console.error('Error fetching organizational units:', error)
error => console.error(this.translate.instant('errorFetchingOrganizationalUnits1'), error)
);
}
@ -108,7 +111,7 @@ export class PxeBootFilesComponent implements OnInit {
this.length = response['hydra:totalItems'];
},
error => {
this.toastService.error('Error al cargar las plantillas');
this.toastService.error(this.translate.instant('errorAlCargarLasPlantillas'));
}
);
}
@ -124,7 +127,7 @@ export class PxeBootFilesComponent implements OnInit {
response => {
this.dataSource.data = response['hydra:member'];
},
error => console.error('Error fetching child units:', error)
error => console.error(this.translate.instant('errorFetchingChildUnits'), error)
);
}
@ -149,8 +152,8 @@ export class PxeBootFilesComponent implements OnInit {
const dialogRef = this.dialog.open(DeleteModalComponent, {
width: '500px',
data: {
title: 'Confirmar migración de servidores',
message: 'Se han detectado ordenadores asociados a otro servidor de boot. ¿Desea moverlos al servidor actual? (Si rechaza, solo se actualizarán los ordenadores que ya pertenecen al servidor actual)',
title : this.translate.instant('confirmarMigracionDeServidores'),
message : this.translate.instant('seHanDetectadoOrdenadoresAsociados'),
confirmText: 'Mover y Guardar',
cancelText: 'Solo de este servidor'
}
@ -186,7 +189,7 @@ export class PxeBootFilesComponent implements OnInit {
const templateIds = Object.keys(groupedByTemplate);
if (templateIds.length === 0) {
this.toastService.info('No hay cambios pendientes de realizar');
this.toastService.info(this.translate.instant('noHayCambiosPendientesDe'));
return;
}

View File

@ -1,3 +1,5 @@
import { inject } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { HttpClient } from '@angular/common/http';
import { Component, Inject, OnInit } from '@angular/core';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
@ -10,6 +12,7 @@ import { ConfigService } from '@services/config.service';
styleUrls: ['./create-image.component.css']
})
export class CreatePXEImageComponent implements OnInit {
public translate = inject(TranslateService);
baseUrl: string;
downloads: any[] = [];
selectedDownload: any;
@ -46,7 +49,7 @@ export class CreatePXEImageComponent implements OnInit {
this.loading = false;
},
error: (error) => {
console.error('Error fetching downloads:', error);
console.error(this.translate.instant('errorFetchingDownloads'), error);
this.loading = false;
this.toastService.error(error.error['hydra:description'] || 'Error fetching downloads');
}
@ -66,7 +69,7 @@ export class CreatePXEImageComponent implements OnInit {
this.http.patch(`${this.baseUrl}/og-lives/${this.imageId}`, payload)
.subscribe({
next: (response) => {
this.toastService.success('Image updated successfully');
this.toastService.success(this.translate.instant('imageUpdatedSuccessfully'));
this.dialogRef.close(true);
},
error: (error) => {
@ -78,7 +81,7 @@ export class CreatePXEImageComponent implements OnInit {
this.http.post(`${this.baseUrl}/og-lives`, payload)
.subscribe({
next: (response) => {
this.toastService.success('Image created successfully');
this.toastService.success(this.translate.instant('imageCreatedSuccessfully'));
this.dialogRef.close(true);
},
error: (error) => {

View File

@ -1,3 +1,5 @@
import { inject } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { Injectable } from '@angular/core';
import { HttpClient, HttpParams } from '@angular/common/http';
import { Observable, throwError } from 'rxjs';
@ -8,6 +10,7 @@ import { ConfigService } from '@services/config.service';
providedIn: 'root'
})
export class DataService {
public translate = inject(TranslateService);
baseUrl: string;
private apiUrl: string;
@ -28,7 +31,7 @@ export class DataService {
}
}),
catchError(error => {
console.error('Error fetching images', error);
console.error(this.translate.instant('errorFetchingImages'), error);
return throwError(error);
})
);

View File

@ -73,7 +73,7 @@
@for (column of columns; track column.columnDef) {
<ng-container [matColumnDef]="column.columnDef">
<th mat-header-cell *matHeaderCellDef>{{ column.header }}</th>
<th mat-header-cell *matHeaderCellDef>{{ column.header | translate }}</th>
<td mat-cell *matCellDef="let image">
@if (column.columnDef === 'isDefault') {
<mat-chip>

View File

@ -1,3 +1,5 @@
import { inject } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { Component, OnInit, signal, Input } from '@angular/core';
import { MatDialog } from '@angular/material/dialog';
import { HttpClient } from '@angular/common/http';
@ -21,6 +23,7 @@ import { ActivatedRoute } from '@angular/router';
styleUrls: ['./pxe-images.component.css']
})
export class PXEimagesComponent implements OnInit {
public translate = inject(TranslateService);
baseUrl: string;
private apiUrl: string;
images: { downloadUrl: string; name: string; uuid: string }[] = [];
@ -41,27 +44,27 @@ export class PXEimagesComponent implements OnInit {
columns = [
{
columnDef: 'id',
header: 'ID',
header: 'id',
cell: (user: any) => `${user.id}`
},
{
columnDef: 'name',
header: 'Og Live',
header: 'ogLive',
cell: (user: any) => `${user.name}`
},
{
columnDef: 'isDefault',
header: 'Imagen por defecto',
header: 'imagenPorDefecto',
cell: (user: any) => `${user.isDefault}`
},
{
columnDef: 'status',
header: 'Estado',
header: 'estado',
cell: (image: any) => `${image.status}`
},
{
columnDef: 'createdAt',
header: 'Fecha de creación',
header: 'fechaDeCreacion',
cell: (user: any) => `${this.datePipe.transform(user.createdAt, 'dd/MM/yyyy hh:mm:ss')}`
}
];
@ -106,7 +109,7 @@ export class PXEimagesComponent implements OnInit {
}
},
error => {
console.error('Error fetching BootServers:', error);
console.error(this.translate.instant('errorFetchingBootservers'), error);
}
);
}
@ -145,7 +148,7 @@ export class PXEimagesComponent implements OnInit {
getStatusLabel(status: string): { label: string; class: string } {
const statusMap: { [key: string]: { label: string; class: string } } = {
active: { label: 'Instalada', class: 'status-active' },
inactive: { label: 'Sin instalar', class: 'status-inactive' },
inactive: { label : this.translate.instant('sinInstalar'), class: 'status-inactive' },
pending: { label: 'Instalando...', class: 'status-installing' },
failed: { label: 'Fallido', class: 'status-failed' }
};
@ -159,7 +162,7 @@ export class PXEimagesComponent implements OnInit {
case 'set-default':
this.http.post(`${this.apiUrl}/server/${image.uuid}/set-default`, {}).subscribe({
next: () => {
this.toastService.success('Petición de cambio de imagen enviada');
this.toastService.success(this.translate.instant('peticionDeCambioDeImagen'));
this.search();
},
error: (error) => {
@ -171,7 +174,7 @@ export class PXEimagesComponent implements OnInit {
case 'install':
this.http.post(`${this.apiUrl}/server/${image.uuid}/install`, {}).subscribe({
next: () => {
this.toastService.success('Petición de instalación enviada');
this.toastService.success(this.translate.instant('peticionDeInstalacionEnviada'));
this.search();
},
error: (error) => {
@ -183,7 +186,7 @@ export class PXEimagesComponent implements OnInit {
case 'uninstall':
this.http.post(`${this.apiUrl}/server/${image.uuid}/uninstall`, {}).subscribe({
next: () => {
this.toastService.success('Petición de desinstalación enviada');
this.toastService.success(this.translate.instant('peticionDeDesinstalacionEnviada'));
this.search();
},
error: (error) => {
@ -193,7 +196,7 @@ export class PXEimagesComponent implements OnInit {
});
break;
default:
console.error('Acción no soportada:', action);
console.error(this.translate.instant('accionNoSoportada'), action);
break;
}
}
@ -211,7 +214,7 @@ export class PXEimagesComponent implements OnInit {
this.http.delete(apiUrl).subscribe({
next: () => {
this.search();
this.toastService.success('oG Live deleted successfully');
this.toastService.success(this.translate.instant('ogLiveDeletedSuccessfully'));
},
error: (error) => {
this.toastService.error(error.error['hydra:description']);
@ -258,7 +261,7 @@ export class PXEimagesComponent implements OnInit {
},
error => {
this.toastService.error(error.error['hydra:description']);
console.error('Error al cargar la información del alert', error);
console.error(this.translate.instant('errorAlCargarLaInformacion'), error);
this.loading = false;
}
);

View File

@ -1,3 +1,5 @@
import { inject } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { Injectable } from '@angular/core';
import { HttpClient, HttpParams } from '@angular/common/http';
@ -9,6 +11,7 @@ import { ConfigService } from '@services/config.service';
providedIn: 'root'
})
export class DataService {
public translate = inject(TranslateService);
baseUrl: string;
private apiUrl: string;
@ -29,7 +32,7 @@ export class DataService {
}
}),
catchError(error => {
console.error('Error fetching pxe templates', error);
console.error(this.translate.instant('errorFetchingPxeTemplates'), error);
return throwError(error);
})
);

View File

@ -1,3 +1,5 @@
import { inject } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { HttpClient } from '@angular/common/http';
import { Component, Inject, OnInit } from '@angular/core';
import { FormGroup, FormBuilder, Validators } from '@angular/forms';
@ -12,6 +14,7 @@ import { ConfigService } from '@services/config.service';
styleUrls: ['./create-pxe-template.component.css']
})
export class CreatePxeTemplateComponent implements OnInit {
public translate = inject(TranslateService);
baseUrl: string;
templateForm!: FormGroup;
previewContent: string = '';
@ -91,7 +94,7 @@ export class CreatePxeTemplateComponent implements OnInit {
this.clients = data['hydra:member'];
},
error: error => {
console.error('Error al obtener los clientes PXE:', error);
console.error(this.translate.instant('errorAlObtenerLosClientes'), error);
}
});
}
@ -110,7 +113,7 @@ export class CreatePxeTemplateComponent implements OnInit {
this.http.post<any>(`${this.baseUrl}/pxe-templates`, payload).subscribe({
next: data => {
this.toastService.success('Plantilla PXE creada exitosamente');
this.toastService.success(this.translate.instant('plantillaPxeCreadaExitosamente'));
this.dialogRef.close(true);
},
error: error => {
@ -129,7 +132,7 @@ export class CreatePxeTemplateComponent implements OnInit {
this.http.patch<any>(`${this.baseUrl}/pxe-templates/${this.data.uuid}`, payload).subscribe({
next: data => {
this.toastService.success('Plantilla PXE actualizada exitosamente');
this.toastService.success(this.translate.instant('plantillaPxeActualizadaExitosamente'));
this.dialogRef.close(true);
},
error: error => {

View File

@ -55,7 +55,7 @@
@for (column of columns; track column.columnDef) {
<ng-container [matColumnDef]="column.columnDef">
<th mat-header-cell *matHeaderCellDef>{{ column.header }}</th>
<th mat-header-cell *matHeaderCellDef>{{ column.header | translate }}</th>
<td mat-cell *matCellDef="let image">
@if (column.columnDef === 'synchronized') {
<mat-chip>

View File

@ -1,5 +1,7 @@
import { inject } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { HttpClient } from '@angular/common/http';
import {Component, OnInit, Input} from '@angular/core';
import {Component, OnInit, Input } from '@angular/core';
import { CreatePxeTemplateComponent } from './manage-pxeTemplate/create-pxe-template.component';
import { MatDialog } from '@angular/material/dialog';
import { MatTableDataSource } from '@angular/material/table';
@ -20,6 +22,7 @@ import { ActivatedRoute } from '@angular/router';
styleUrls: ['./pxe.component.css']
})
export class PxeComponent implements OnInit{
public translate = inject(TranslateService);
baseUrl: string;
private apiUrl: string;
pxeTemplates: any[] = [];
@ -42,27 +45,27 @@ export class PxeComponent implements OnInit{
columns = [
{
columnDef: 'id',
header: 'ID',
header: 'id',
cell: (user: any) => `${user.id}`
},
{
columnDef: 'name',
header: 'Nombre de la plantilla',
header: 'nombreDeLaPlantilla',
cell: (user: any) => user.name
},
{
columnDef: 'synchronized',
header: 'Sincronizado',
header: 'sincronizado',
cell: (user: any) => user.synchronized
},
{
columnDef: 'isDefault',
header: 'Plantilla por defecto',
header: 'plantillaPorDefecto',
cell: (user: any) => user.isDefault
},
{
columnDef: 'createdAt',
header: 'Fecha de creación',
header: 'fechaDeCreacion',
cell: (user: any) => this.datePipe.transform(user.createdAt, 'dd/MM/yyyy hh:mm:ss')
}
];
@ -107,7 +110,7 @@ export class PxeComponent implements OnInit{
}
},
error => {
console.error('Error fetching BootServers:', error);
console.error(this.translate.instant('errorFetchingBootservers'), error);
}
);
}
@ -166,7 +169,7 @@ export class PxeComponent implements OnInit{
if (result) {
this.http.post<any>(`${this.apiUrl}/server/${image.uuid}/delete`, {}).subscribe({
next: (response) => {
this.toastService.success('Plantilla eliminada exitosamente');
this.toastService.success(this.translate.instant('plantillaEliminadaExitosamente'));
if (response && response.warning) {
this.toastService.info(response.warning, 'Información', { timeOut: 8000 });
}
@ -180,7 +183,7 @@ export class PxeComponent implements OnInit{
})
break;
default:
console.error('Acción no soportada:', action);
console.error(this.translate.instant('accionNoSoportada'), action);
break;
}
}
@ -211,7 +214,7 @@ export class PxeComponent implements OnInit{
},
error => {
this.toastService.error(error.error['hydra:description']);
console.error('Error al cargar la información del alert', error);
console.error(this.translate.instant('errorAlCargarLaInformacion'), error);
}
);
}

View File

@ -1,3 +1,5 @@
import { inject } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { Component, OnInit, Inject } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { MatDialogRef, MAT_DIALOG_DATA, MatDialog } from '@angular/material/dialog';
@ -12,6 +14,7 @@ import { ConfigService } from '@services/config.service';
styleUrls: ['./add-clients-to-subnet.component.css']
})
export class AddClientsToSubnetComponent implements OnInit {
public translate = inject(TranslateService);
baseUrl: string;
units: any[] = [];
clients: any[] = [];
@ -43,7 +46,7 @@ export class AddClientsToSubnetComponent implements OnInit {
this.units = response['hydra:member'];
this.loading = false;
},
error => console.error('Error fetching organizational units:', error)
error => console.error(this.translate.instant('errorFetchingOrganizationalUnits1'), error)
);
}
@ -52,7 +55,7 @@ export class AddClientsToSubnetComponent implements OnInit {
response => {
this.clients = response['hydra:member'];
},
error => console.error('Error fetching child units:', error)
error => console.error(this.translate.instant('errorFetchingChildUnits'), error)
);
}

View File

@ -1,3 +1,5 @@
import { inject } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { HttpClient } from '@angular/common/http';
import { Component, Inject, OnInit } from '@angular/core';
import { MAT_DIALOG_DATA, MatDialog, MatDialogRef } from '@angular/material/dialog';
@ -11,6 +13,7 @@ import { ConfigService } from '@services/config.service';
styleUrls: ['./create-subnet.component.css']
})
export class CreateSubnetComponent implements OnInit {
public translate = inject(TranslateService);
baseUrl: string;
subnetForm: FormGroup;
isEditMode: boolean = false;
@ -63,7 +66,7 @@ export class CreateSubnetComponent implements OnInit {
save(): void {
if (this.subnetForm.invalid) {
this.toastService.error('Por favor, revisa los campos del formulario');
this.toastService.error(this.translate.instant('porFavorRevisaLosCampos'));
return;
}
@ -76,7 +79,7 @@ export class CreateSubnetComponent implements OnInit {
if (!this.isEditMode) {
this.http.post(`${this.baseUrl}/subnets`, payload).subscribe({
next: () => {
this.toastService.success('Configuración de red añadida exitosamente');
this.toastService.success(this.translate.instant('configuracionDeRedAnadidaExitosamente'));
this.dialogRef.close();
},
error: (error) => {
@ -86,7 +89,7 @@ export class CreateSubnetComponent implements OnInit {
} else {
this.http.patch(`${this.baseUrl}/subnets/${this.subnetId}`, payload).subscribe({
next: () => {
this.toastService.success('Configuración de red actualizada exitosamente');
this.toastService.success(this.translate.instant('configuracionDeRedActualizadaExitosamente'));
this.dialogRef.close();
},
error: (error) => {

View File

@ -35,7 +35,7 @@
<table mat-table [dataSource]="dataSource" class="mat-elevation-z8" joyrideStep="tableDateStep" text="Tabla de Servidores DHCP">
@for (column of columns; track column.columnDef) {
<ng-container [matColumnDef]="column.columnDef">
<th mat-header-cell *matHeaderCellDef> {{ column.header }} </th>
<th mat-header-cell *matHeaderCellDef> {{ column.header | translate }} </th>
<td mat-cell *matCellDef="let server">
@if (column.columnDef !== 'subnets') {
{{ column.cell(server) }}

View File

@ -1,4 +1,6 @@
import {Component, OnInit} from '@angular/core';
import { inject } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import {Component, OnInit } from '@angular/core';
import {MatTableDataSource} from "@angular/material/table";
import {DatePipe} from "@angular/common";
import {MatDialog} from "@angular/material/dialog";
@ -16,6 +18,7 @@ import {ManageDhcpServerComponent} from "../manage-dhcp-server/manage-dhcp-serve
styleUrl: './dhcp-servers.component.css'
})
export class DhcpServersComponent implements OnInit {
public translate = inject(TranslateService);
baseUrl: string;
private apiUrl: string;
dataSource = new MatTableDataSource<any>();
@ -28,32 +31,32 @@ export class DhcpServersComponent implements OnInit {
columns = [
{
columnDef: 'id',
header: 'Id',
header: 'id1',
cell: (server: any) => `${server.id}`
},
{
columnDef: 'name',
header: 'Nombre',
header: 'nombre',
cell: (server: any) => server.name
},
{
columnDef: 'ip',
header: 'Ip',
header: 'ip',
cell: (server: any) => server.ip
},
{
columnDef: 'apiPort',
header: 'Puerto API',
header: 'puertoApi',
cell: (server: any) => server.apiPort
},
{
columnDef: 'subnets',
header: 'Subredes',
header: 'subredes',
cell: (server: any) => server.subnets
},
{
columnDef: 'createdAt',
header: 'Fecha de creación',
header: 'fechaDeCreacion',
cell: (server: any) => `${this.datePipe.transform(server.createdAt, 'dd/MM/yyyy hh:mm:ss')}`
}
];
@ -122,12 +125,12 @@ export class DhcpServersComponent implements OnInit {
if (result) {
this.http.delete(`${this.apiUrl}/${server.uuid}`).subscribe({
next: () => {
this.toastService.success('Servidor eliminado con éxito');
this.toastService.success(this.translate.instant('servidorEliminadoConExito'));
this.search();
},
error: (error) => {
console.error('Error al eliminar servidor:', error);
this.toastService.error('Error al eliminar el servidor');
console.error(this.translate.instant('errorAlEliminarServidor'), error);
this.toastService.error(this.translate.instant('errorAlEliminarElServidor'));
}
});
}

View File

@ -1,3 +1,5 @@
import { inject } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { Component, Inject, OnInit } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from "@angular/forms";
import { HttpClient } from "@angular/common/http";
@ -11,6 +13,7 @@ import { ConfigService } from "@services/config.service";
styleUrl: './manage-dhcp-server.component.css'
})
export class ManageDhcpServerComponent implements OnInit {
public translate = inject(TranslateService);
baseUrl: string;
dhcpServerForm: FormGroup<any>;
serverId: string | null = null;
@ -51,8 +54,8 @@ export class ManageDhcpServerComponent implements OnInit {
this.serverId = response['@id'];
},
error: (err) => {
console.error('Error fetching dhcp server:', err);
this.toastService.error('Error cargando los datos');
console.error(this.translate.instant('errorFetchingDhcpServer'), err);
this.toastService.error(this.translate.instant('errorCargandoLosDatos'));
}
});
}
@ -68,7 +71,7 @@ export class ManageDhcpServerComponent implements OnInit {
if (this.serverId) {
this.http.put(`${this.baseUrl}${this.serverId}`, payload).subscribe({
next: () => {
this.toastService.success('Servidor DHCP actualizado correctamente');
this.toastService.success(this.translate.instant('servidorDhcpActualizadoCorrectamente'));
this.dialogRef.close(true);
},
error: (error) => {
@ -78,7 +81,7 @@ export class ManageDhcpServerComponent implements OnInit {
} else {
this.http.post(`${this.baseUrl}/dhcp-servers`, payload).subscribe({
next: () => {
this.toastService.success('Servidor DHCP añadido correctamente');
this.toastService.success(this.translate.instant('servidorDhcpAnadidoCorrectamente'));
this.dialogRef.close(true);
},
error: (error) => {

View File

@ -48,7 +48,7 @@
text="Visualiza y administra las subredes listadas según los filtros aplicados.">
@for (column of columns; track column.columnDef) {
<ng-container [matColumnDef]="column.columnDef">
<th mat-header-cell *matHeaderCellDef> {{ column.header }} </th>
<th mat-header-cell *matHeaderCellDef> {{ column.header | translate }} </th>
<td mat-cell *matCellDef="let subnet">
@if (column.columnDef === 'synchronized') {
<mat-icon [color]="subnet[column.columnDef] ? 'primary' : 'warn'">

Some files were not shown because too many files have changed in this diff Show More