refs #1048. Updated client view and partition assistant

oggui/translations
Manuel Aranda Rosales 2024-11-15 12:59:17 +01:00
parent 4dfc45b125
commit ddfbcdf46d
12 changed files with 106 additions and 38 deletions

View File

@ -76,12 +76,17 @@ table {
}
.chip-success {
background-color: #2ea22e !important;
background-color: #32c532 !important;
color: white;
}
.chip-pending {
background-color: orange !important;
background-color: #bebdbd !important;
color: black;
}
.chip-in-progress {
background-color: #f5a623 !important;
color: white;
}

View File

@ -30,6 +30,7 @@
<mat-select [(ngModel)]="filters['status']" (selectionChange)="loadTraces()" placeholder="Seleccionar opción" >
<mat-option [value]="'failed'">Fallido</mat-option>
<mat-option [value]="'pending'">Pendiente de ejecutar</mat-option>
<mat-option [value]="'in-progress'">Ejecutando</mat-option>
<mat-option [value]="'success'">Completado con éxito</mat-option>
</mat-select>
</mat-form-field>
@ -49,13 +50,15 @@
<mat-chip [ngClass]="{
'chip-failed': trace.status === 'failed',
'chip-success': trace.status === 'success',
'chip-pending': trace.status === 'pending'
'chip-pending': trace.status === 'pending',
'chip-in-progress': trace.status === 'in-progress'
}">
{{
trace.status === 'failed' ? 'Fallido' :
trace.status === 'success' ? 'Finalizado con éxito' :
trace.status === 'pending' ? 'Pendiente de ejecutar' :
trace.status
trace.status === 'in-progress' ? 'Ejecutando' :
trace.status
}}
</mat-chip>
</ng-container>

View File

@ -74,9 +74,15 @@ mat-card-subtitle a:hover {
flex-grow: 1;
}
button {
margin-left: 10px;
margin-bottom: 20px;
.button-group {
display: flex;
flex-wrap: wrap;
gap: 10px;
align-items: center;
}
.button-group button {
flex-grow: 1;
}
.item-content {
@ -84,10 +90,6 @@ button {
width: 100%;
}
.item-content mat-icon {
margin-right: 10px;
}
.clickable-item:hover {
cursor: pointer;
}
@ -139,7 +141,7 @@ mat-spinner {
display: flex;
align-items: center;
gap: 10px;
padding: 20px;
padding: 10px;
}
.header mat-form-field {

View File

@ -21,6 +21,8 @@
<button mat-button (click)="changeViewMode('list')" [class.active]="viewMode === 'list'">
<mat-icon>list</mat-icon> Lista
</button>
<button mat-button (click)="toggleSelectAll()">
<mat-icon>checkbox</mat-icon> Seleccionar/Deseleccionar Todos</button>
</div>
<div class="main-content">
@ -38,10 +40,19 @@
<input matInput placeholder="Unidad organizativa" (input)="applyFilter()" [(ngModel)]="filterName" i18n-placeholder="@@namePlaceholder">
</mat-form-field>
<button mat-raised-button color="primary" (click)="toggleSelectAll()">Seleccionar/Deseleccionar Todos</button>
<button mat-raised-button color="primary" (click)="saveFilters()" i18n="@@saveFiltersButton">Guardar Filtros</button>
<button mat-raised-button color="accent" (click)="sendActions()" i18n="@@sendFiltersButton" [disabled]="selectedElements.length === 0">Enviar Acción</button>
<button mat-flat-button color="primary" [disabled]="selectedElements.length === 0" (click)="onPxeBootFile()">Añadir fichero PXE</button>
<div class="button-group">
<button mat-raised-button color="primary" (click)="saveFilters()" i18n="@@saveFiltersButton">Guardar Filtros</button>
<button mat-raised-button color="accent" [disabled]="selectedElements.length === 0 || selectedFilter1 === 'ou'" (click)="sendActions()" i18n="@@sendFiltersButton" >Enviar Acción</button>
<button mat-flat-button color="primary" [disabled]="selectedElements.length === 0 || selectedFilter1 === 'ou'" (click)="onPxeBootFile()">Añadir fichero PXE</button>
<button mat-raised-button color="primary" [matMenuTriggerFor]="menu" [disabled]="selectedFilter1 === 'ou'">
Asistentes
</button>
<mat-menu #menu="matMenu">
<button mat-menu-item [disabled]="selectedElements.length > 1 || !selectedElements.length" (click)="onCommandSelect('partition')">Asistente de particionado</button>
<button mat-menu-item [disabled]="selectedElements.length > 1 || !selectedElements.length" (click)="onCommandSelect('create-image')">Crear una imagen</button>
<button mat-menu-item [disabled]="selectedElements.length > 1 || !selectedElements.length" (click)="onCommandSelect('deploy-image')">Desplegar una imagen</button>
</mat-menu>
</div>
</div>
<div class="results">

View File

@ -428,6 +428,42 @@ export class AdvancedSearchComponent {
});
}
onCommandSelect(action: any): void {
if (action === 'partition') {
this.openPartitionAssistant();
}
if (action === 'create-image') {
this.openCreateImageAssistant();
}
if (action === 'deploy-image') {
this.openDeployImageAssistant();
}
}
openPartitionAssistant(): void {
const client = this.selectedElements[0];
console.log(client)
this.router.navigate([`${client}/partition-assistant`]).then(r => {
console.log('navigated', r);
});
}
openCreateImageAssistant(): void {
const client = this.selectedElements[0];
this.router.navigate([`${client}/create-image`]).then(r => {
console.log('navigated', r);
});
}
openDeployImageAssistant(): void {
const client = this.selectedElements[0];
this.router.navigate([`${client}/deploy-image`]).then(r => {
console.log('navigated', r);
});
}
onDobleClick(event: MouseEvent, data: any, type: string): void {
if (type === 'client') {
this.router.navigate(['client', data]);

View File

@ -98,7 +98,6 @@ export class ClientMainViewComponent implements OnInit {
ngOnInit() {
this.clientData = history.state.clientData;
console.log(this.clientData)
this.loadPartitions()
this.updateGeneralData();
this.updateNetworkData();
@ -229,19 +228,19 @@ export class ClientMainViewComponent implements OnInit {
}
openPartitionAssistant(): void {
this.router.navigate([`/client/${this.clientData.uuid}/partition-assistant`]).then(r => {
this.router.navigate([`/clients/${this.clientData.uuid}/partition-assistant`]).then(r => {
console.log('navigated', r);
});
}
openCreateImageAssistant(): void {
this.router.navigate([`/client/${this.clientData.uuid}/create-image`]).then(r => {
this.router.navigate([`/clients/${this.clientData.uuid}/create-image`]).then(r => {
console.log('navigated', r);
});
}
openDeployImageAssistant(): void {
this.router.navigate([`/client/${this.clientData.uuid}/deploy-image`]).then(r => {
this.router.navigate([`/clients/${this.clientData.uuid}/deploy-image`]).then(r => {
console.log('navigated', r);
});
}

View File

@ -149,7 +149,7 @@ export class CreateImageComponent {
name: this.name,
image: this.selectedImage,
partition: this.selectedPartition['@id'],
input: 'assistant'
source: 'assistant'
};

View File

@ -26,11 +26,11 @@ export class DeployImageComponent {
mcastIp: string = '';
mcastPort: string = '';
mcastMode: string = '';
mcastSpeed: string = '';
mcastMaxClients: string = '';
mcastMaxTime: string = '';
mcastSpeed: Number = 0;
mcastMaxClients: Number = 0;
mcastMaxTime: Number = 0;
p2pMode: string = '';
p2pTime: string = '';
p2pTime: Number = 0;
name: string = '';
protected p2pModeOptions = [
@ -116,7 +116,15 @@ export class DeployImageComponent {
(response: any) => {
if (response.partitions) {
this.clientName = response.name;
this.dataSource.data = response?.partitions;
this.dataSource.data = response.partitions.filter((partition: any) => {
return partition.partitionNumber !== 0;
});
this.p2pMode = response.organizationalUnit?.networkSettings?.p2pMode;
this.p2pTime = response.organizationalUnit?.networkSettings?.p2pTime;
this.mcastSpeed = response.organizationalUnit?.networkSettings?.mcastSpeed;
this.mcastMode = response.organizationalUnit?.networkSettings?.mcastMode;
this.mcastPort = response.organizationalUnit?.networkSettings?.mcastPort;
this.mcastIp = response.organizationalUnit?.networkSettings?.mcastIp;
}
},
(error) => {
@ -140,13 +148,17 @@ export class DeployImageComponent {
save(): void {
const payload = {
client: `/clients/${this.clientId}`,
name: this.name,
image: this.selectedImage,
partition: this.selectedPartition['@id']
method: this.selectedMethod,
partition: this.selectedPartition['@id'],
p2pMode: this.p2pMode,
p2pTime: this.p2pTime,
mcastIp: this.mcastIp,
mcastPort: this.mcastPort,
mcastMode: this.mcastMode,
mcastSpeed: this.mcastSpeed,
};
this.http.post(`${this.baseUrl}/images`, payload)
this.http.post(`${this.baseUrl}${this.selectedImage}/deploy-image`, payload)
.subscribe({
next: (response) => {
this.toastService.success('Imagen creada exitosamente');

View File

@ -142,7 +142,7 @@ export class ClientTabViewComponent {
this.syncStatus = false;
},
error => {
this.toastService.error(error.error['hydra:description']);
this.toastService.error('Error de conexión con el cliente');
this.syncStatus = false;
}
);
@ -151,7 +151,7 @@ export class ClientTabViewComponent {
handleClientClick(event: MouseEvent, client: any): void {
event.stopPropagation();
this.router.navigate(['client', client.uuid], { state: { clientData: client } });
this.router.navigate(['clients', client.uuid], { state: { clientData: client } });
}

View File

@ -10,6 +10,7 @@
<mat-menu #menu="matMenu">
<button mat-menu-item routerLink="/users" i18n="@@usersMenuItem">Usuarios</button>
<button mat-menu-item routerLink="/user-groups" i18n="@@rolesMenuItem">Roles</button>
<button mat-menu-item routerLink="/var-envs" i18n="@@rolesMenuItem">Variables de entorno</button>
</mat-menu>
<button mat-flat-button color="warn" routerLink="/auth/login" i18n="@@logout">Salir</button>
</div>

View File

@ -149,10 +149,10 @@
</span>
</mat-list-item>
<mat-list-item routerLink="/repositories">
<span class="entry">
<mat-icon class="icon">warehouse</mat-icon>
<span i18n="@@repositories">Repositorios</span>
<mat-list-item>
<span class="entry" routerLink="/repositories">
<mat-icon class="icon">warehouse </mat-icon>
<span i18n="@@actions">Repositorios</span>
</span>
</mat-list-item>

View File

@ -29,7 +29,6 @@ export class SidebarComponent {
this.showSoftwareSub = !this.showSoftwareSub;
}
constructor(public dialog: MatDialog) {}
ngOnInit(): void {