refs #1048. Updated client view and partition assistant
							parent
							
								
									4dfc45b125
								
							
						
					
					
						commit
						ddfbcdf46d
					
				|  | @ -76,12 +76,17 @@ table { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| .chip-success { | .chip-success { | ||||||
|   background-color: #2ea22e !important; |   background-color: #32c532 !important; | ||||||
|   color: white; |   color: white; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| .chip-pending { | .chip-pending { | ||||||
|   background-color: orange !important; |   background-color: #bebdbd !important; | ||||||
|   color: black; |   color: black; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | .chip-in-progress { | ||||||
|  |   background-color: #f5a623 !important; | ||||||
|  |   color: white; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  |  | ||||||
|  | @ -30,6 +30,7 @@ | ||||||
|     <mat-select [(ngModel)]="filters['status']" (selectionChange)="loadTraces()" placeholder="Seleccionar opción" > |     <mat-select [(ngModel)]="filters['status']" (selectionChange)="loadTraces()" placeholder="Seleccionar opción" > | ||||||
|       <mat-option [value]="'failed'">Fallido</mat-option> |       <mat-option [value]="'failed'">Fallido</mat-option> | ||||||
|       <mat-option [value]="'pending'">Pendiente de ejecutar</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-option [value]="'success'">Completado con éxito</mat-option> | ||||||
|     </mat-select> |     </mat-select> | ||||||
|   </mat-form-field> |   </mat-form-field> | ||||||
|  | @ -49,13 +50,15 @@ | ||||||
|           <mat-chip [ngClass]="{ |           <mat-chip [ngClass]="{ | ||||||
|               'chip-failed': trace.status === 'failed', |               'chip-failed': trace.status === 'failed', | ||||||
|               'chip-success': trace.status === 'success', |               '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 === 'failed' ? 'Fallido' : | ||||||
|                 trace.status === 'success' ? 'Finalizado con éxito' : |                 trace.status === 'success' ? 'Finalizado con éxito' : | ||||||
|                   trace.status === 'pending' ? 'Pendiente de ejecutar' : |                   trace.status === 'pending' ? 'Pendiente de ejecutar' : | ||||||
|                     trace.status |                     trace.status === 'in-progress' ? 'Ejecutando' : | ||||||
|  |                       trace.status | ||||||
|             }} |             }} | ||||||
|           </mat-chip> |           </mat-chip> | ||||||
|         </ng-container> |         </ng-container> | ||||||
|  |  | ||||||
|  | @ -74,9 +74,15 @@ mat-card-subtitle a:hover { | ||||||
|   flex-grow: 1; |   flex-grow: 1; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| button { | .button-group { | ||||||
|   margin-left: 10px; |   display: flex; | ||||||
|   margin-bottom: 20px; |   flex-wrap: wrap; | ||||||
|  |   gap: 10px; | ||||||
|  |   align-items: center; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | .button-group button { | ||||||
|  |   flex-grow: 1; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| .item-content { | .item-content { | ||||||
|  | @ -84,10 +90,6 @@ button { | ||||||
|   width: 100%; |   width: 100%; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| .item-content mat-icon { |  | ||||||
|   margin-right: 10px; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| .clickable-item:hover { | .clickable-item:hover { | ||||||
|   cursor: pointer; |   cursor: pointer; | ||||||
| } | } | ||||||
|  | @ -139,7 +141,7 @@ mat-spinner { | ||||||
|   display: flex; |   display: flex; | ||||||
|   align-items: center; |   align-items: center; | ||||||
|   gap: 10px; |   gap: 10px; | ||||||
|   padding: 20px; |   padding: 10px; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| .header mat-form-field { | .header mat-form-field { | ||||||
|  |  | ||||||
|  | @ -21,6 +21,8 @@ | ||||||
|     <button mat-button (click)="changeViewMode('list')" [class.active]="viewMode === 'list'"> |     <button mat-button (click)="changeViewMode('list')" [class.active]="viewMode === 'list'"> | ||||||
|       <mat-icon>list</mat-icon> Lista |       <mat-icon>list</mat-icon> Lista | ||||||
|     </button> |     </button> | ||||||
|  |     <button mat-button (click)="toggleSelectAll()"> | ||||||
|  |       <mat-icon>checkbox</mat-icon> Seleccionar/Deseleccionar Todos</button> | ||||||
|   </div> |   </div> | ||||||
| 
 | 
 | ||||||
|   <div class="main-content"> |   <div class="main-content"> | ||||||
|  | @ -38,10 +40,19 @@ | ||||||
|         <input matInput placeholder="Unidad organizativa" (input)="applyFilter()" [(ngModel)]="filterName" i18n-placeholder="@@namePlaceholder"> |         <input matInput placeholder="Unidad organizativa" (input)="applyFilter()" [(ngModel)]="filterName" i18n-placeholder="@@namePlaceholder"> | ||||||
|       </mat-form-field> |       </mat-form-field> | ||||||
| 
 | 
 | ||||||
|       <button mat-raised-button color="primary" (click)="toggleSelectAll()">Seleccionar/Deseleccionar Todos</button> |       <div class="button-group"> | ||||||
|       <button mat-raised-button color="primary" (click)="saveFilters()" i18n="@@saveFiltersButton">Guardar Filtros</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-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" (click)="onPxeBootFile()">Añadir fichero PXE</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> | ||||||
| 
 | 
 | ||||||
|     <div class="results"> |     <div class="results"> | ||||||
|  |  | ||||||
|  | @ -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 { |   onDobleClick(event: MouseEvent, data: any, type: string): void { | ||||||
|     if (type === 'client') { |     if (type === 'client') { | ||||||
|       this.router.navigate(['client', data]); |       this.router.navigate(['client', data]); | ||||||
|  |  | ||||||
|  | @ -98,7 +98,6 @@ export class ClientMainViewComponent implements OnInit { | ||||||
| 
 | 
 | ||||||
|   ngOnInit() { |   ngOnInit() { | ||||||
|     this.clientData = history.state.clientData; |     this.clientData = history.state.clientData; | ||||||
|     console.log(this.clientData) |  | ||||||
|     this.loadPartitions() |     this.loadPartitions() | ||||||
|     this.updateGeneralData(); |     this.updateGeneralData(); | ||||||
|     this.updateNetworkData(); |     this.updateNetworkData(); | ||||||
|  | @ -229,19 +228,19 @@ export class ClientMainViewComponent implements OnInit { | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   openPartitionAssistant(): void { |   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); |       console.log('navigated', r); | ||||||
|     }); |     }); | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   openCreateImageAssistant(): void { |   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); |       console.log('navigated', r); | ||||||
|     }); |     }); | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   openDeployImageAssistant(): void { |   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); |       console.log('navigated', r); | ||||||
|     }); |     }); | ||||||
|   } |   } | ||||||
|  |  | ||||||
|  | @ -149,7 +149,7 @@ export class CreateImageComponent { | ||||||
|       name: this.name, |       name: this.name, | ||||||
|       image: this.selectedImage, |       image: this.selectedImage, | ||||||
|       partition: this.selectedPartition['@id'], |       partition: this.selectedPartition['@id'], | ||||||
|       input: 'assistant' |       source: 'assistant' | ||||||
|     }; |     }; | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -26,11 +26,11 @@ export class DeployImageComponent { | ||||||
|   mcastIp: string = ''; |   mcastIp: string = ''; | ||||||
|   mcastPort: string = ''; |   mcastPort: string = ''; | ||||||
|   mcastMode: string = ''; |   mcastMode: string = ''; | ||||||
|   mcastSpeed: string = ''; |   mcastSpeed: Number = 0; | ||||||
|   mcastMaxClients: string = ''; |   mcastMaxClients: Number = 0; | ||||||
|   mcastMaxTime: string = ''; |   mcastMaxTime: Number = 0; | ||||||
|   p2pMode: string = ''; |   p2pMode: string = ''; | ||||||
|   p2pTime: string = ''; |   p2pTime: Number = 0; | ||||||
|   name: string = ''; |   name: string = ''; | ||||||
| 
 | 
 | ||||||
|   protected p2pModeOptions = [ |   protected p2pModeOptions = [ | ||||||
|  | @ -116,7 +116,15 @@ export class DeployImageComponent { | ||||||
|       (response: any) => { |       (response: any) => { | ||||||
|         if (response.partitions) { |         if (response.partitions) { | ||||||
|           this.clientName = response.name; |           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) => { |       (error) => { | ||||||
|  | @ -140,13 +148,17 @@ export class DeployImageComponent { | ||||||
|   save(): void { |   save(): void { | ||||||
|     const payload = { |     const payload = { | ||||||
|       client: `/clients/${this.clientId}`, |       client: `/clients/${this.clientId}`, | ||||||
|       name: this.name, |       method: this.selectedMethod, | ||||||
|       image: this.selectedImage, |       partition: this.selectedPartition['@id'], | ||||||
|       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}${this.selectedImage}/deploy-image`, payload) | ||||||
|     this.http.post(`${this.baseUrl}/images`, payload) |  | ||||||
|       .subscribe({ |       .subscribe({ | ||||||
|           next: (response) => { |           next: (response) => { | ||||||
|             this.toastService.success('Imagen creada exitosamente'); |             this.toastService.success('Imagen creada exitosamente'); | ||||||
|  |  | ||||||
|  | @ -142,7 +142,7 @@ export class ClientTabViewComponent { | ||||||
|         this.syncStatus = false; |         this.syncStatus = false; | ||||||
|       }, |       }, | ||||||
|       error => { |       error => { | ||||||
|         this.toastService.error(error.error['hydra:description']); |         this.toastService.error('Error de conexión con el cliente'); | ||||||
|         this.syncStatus = false; |         this.syncStatus = false; | ||||||
|       } |       } | ||||||
|     ); |     ); | ||||||
|  | @ -151,7 +151,7 @@ export class ClientTabViewComponent { | ||||||
| 
 | 
 | ||||||
|   handleClientClick(event: MouseEvent, client: any): void { |   handleClientClick(event: MouseEvent, client: any): void { | ||||||
|     event.stopPropagation(); |     event.stopPropagation(); | ||||||
|     this.router.navigate(['client', client.uuid], { state: { clientData: client } }); |     this.router.navigate(['clients', client.uuid], { state: { clientData: client } }); | ||||||
| 
 | 
 | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -10,6 +10,7 @@ | ||||||
|     <mat-menu #menu="matMenu"> |     <mat-menu #menu="matMenu"> | ||||||
|       <button mat-menu-item routerLink="/users" i18n="@@usersMenuItem">Usuarios</button> |       <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="/user-groups" i18n="@@rolesMenuItem">Roles</button> | ||||||
|  |       <button mat-menu-item routerLink="/var-envs" i18n="@@rolesMenuItem">Variables de entorno</button> | ||||||
|     </mat-menu> |     </mat-menu> | ||||||
|     <button mat-flat-button color="warn" routerLink="/auth/login" i18n="@@logout">Salir</button> |     <button mat-flat-button color="warn" routerLink="/auth/login" i18n="@@logout">Salir</button> | ||||||
|   </div> |   </div> | ||||||
|  |  | ||||||
|  | @ -149,10 +149,10 @@ | ||||||
|     </span> |     </span> | ||||||
|   </mat-list-item> |   </mat-list-item> | ||||||
| 
 | 
 | ||||||
|   <mat-list-item routerLink="/repositories"> |   <mat-list-item> | ||||||
|     <span class="entry"> |     <span class="entry" routerLink="/repositories"> | ||||||
|       <mat-icon class="icon">warehouse</mat-icon> |       <mat-icon class="icon">warehouse </mat-icon> | ||||||
|       <span i18n="@@repositories">Repositorios</span> |       <span i18n="@@actions">Repositorios</span> | ||||||
|     </span> |     </span> | ||||||
|   </mat-list-item> |   </mat-list-item> | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -29,7 +29,6 @@ export class SidebarComponent { | ||||||
|     this.showSoftwareSub = !this.showSoftwareSub; |     this.showSoftwareSub = !this.showSoftwareSub; | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
|   constructor(public dialog: MatDialog) {} |   constructor(public dialog: MatDialog) {} | ||||||
| 
 | 
 | ||||||
|   ngOnInit(): void { |   ngOnInit(): void { | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue