Remove AcctionsModal component and associated files
testing/ogGui-multibranch/pipeline/head This commit looks good Details

deb-pkg
Lucas Lara García 2025-02-26 11:33:21 +01:00
parent c441edead4
commit dddfcd4e60
7 changed files with 5 additions and 283 deletions

View File

@ -64,7 +64,6 @@ import { LegendComponent } from './components/groups/shared/legend/legend.compon
import { ClassroomViewDialogComponent } from './components/groups/shared/classroom-view/classroom-view-modal';
import { MatPaginator } from "@angular/material/paginator";
import { SaveFiltersDialogComponent } from './components/groups/shared/save-filters-dialog/save-filters-dialog.component';
import { AcctionsModalComponent } from './components/groups/shared/acctions-modal/acctions-modal.component';
import { PXEimagesComponent } from './components/ogboot/pxe-images/pxe-images.component';
import { CreatePXEImageComponent } from './components/ogboot/pxe-images/create-image/create-image/create-image.component';
import { InfoImageComponent } from './components/ogboot/pxe-images/info-image/info-image/info-image.component';
@ -125,11 +124,11 @@ import { RepositoryImagesComponent } from './components/repositories/repository-
import { InputDialogComponent } from './components/commands/commands-task/task-logs/input-dialog/input-dialog.component';
import { ManageOrganizationalUnitComponent } from './components/groups/shared/organizational-units/manage-organizational-unit/manage-organizational-unit.component';
import { BackupImageComponent } from './components/repositories/backup-image/backup-image.component';
import {ServerInfoDialogComponent} from "./components/ogdhcp/server-info-dialog/server-info-dialog.component";
import {StatusComponent} from "./components/ogdhcp/status/status.component";
import {OgDhcpSubnetsComponent} from "./components/ogdhcp/og-dhcp-subnets.component";
import {CreateSubnetComponent} from "./components/ogdhcp/create-subnet/create-subnet.component";
import {AddClientsToSubnetComponent} from "./components/ogdhcp/add-clients-to-subnet/add-clients-to-subnet.component";
import { ServerInfoDialogComponent } from "./components/ogdhcp/server-info-dialog/server-info-dialog.component";
import { StatusComponent } from "./components/ogdhcp/status/status.component";
import { OgDhcpSubnetsComponent } from "./components/ogdhcp/og-dhcp-subnets.component";
import { CreateSubnetComponent } from "./components/ogdhcp/create-subnet/create-subnet.component";
import { AddClientsToSubnetComponent } from "./components/ogdhcp/add-clients-to-subnet/add-clients-to-subnet.component";
import { ShowClientsComponent } from './components/ogdhcp/show-clients/show-clients.component';
import { OperationResultDialogComponent } from './components/ogdhcp/operation-result-dialog/operation-result-dialog.component';
export function HttpLoaderFactory(http: HttpClient) {
@ -161,7 +160,6 @@ export function HttpLoaderFactory(http: HttpClient) {
LegendComponent,
ClassroomViewDialogComponent,
SaveFiltersDialogComponent,
AcctionsModalComponent,
PXEimagesComponent,
CreatePXEImageComponent,
InfoImageComponent,

View File

@ -1,13 +0,0 @@
/* Contenedor de los botones, organizados en 2 columnas */
.button-container {
display: grid;
grid-template-columns: 1fr 1fr; /* 2 columnas iguales */
gap: 15px; /* Espacio entre los botones */
margin-top: 15px;
}
/* Opcional: ancho 100% para los botones */
.button-action {
width: 100%;
justify-self: stretch; /* Asegura que los botones se extiendan por toda la columna */
}

View File

@ -1,14 +0,0 @@
<h1 mat-dialog-title>{{ 'actionsModalTitle' | translate }}</h1>
<mat-dialog-content>
<div class="button-container">
<button
*ngFor="let command of arrayCommands"
mat-raised-button
color="primary"
class="button-action"
(click)="onCommandClick(command)">
{{ command.name }}
</button>
</div>
</mat-dialog-content>

View File

@ -1,58 +0,0 @@
// componente
import { Component, Inject } from '@angular/core';
import { MatDialogRef, MAT_DIALOG_DATA, MatDialog } from '@angular/material/dialog';
import { ToastrService } from 'ngx-toastr';
import { CreatePxeBootFileComponent } from '../../../ogboot/pxe-boot-files/create-pxeBootFile/create-pxe-boot-file/create-pxe-boot-file.component';
import { HttpClient } from '@angular/common/http';
import { CommandDetailComponent } from '../../../commands/main-commands/detail-command/command-detail.component';
import { RouterLink } from '@angular/router';
@Component({
selector: 'app-acctions-modal',
templateUrl: './acctions-modal.component.html',
styleUrls: ['./acctions-modal.component.css']
})
export class AcctionsModalComponent {
baseUrl: string = import.meta.env.NG_APP_BASE_API_URL;
selectedElements: any;
displayedColumns: string[] = ['name', 'createdBy', 'createdAt'];
arrayCommands: any[] = [
{name: 'Enceder', slug: 'power-on'},
{name: 'Apagar', slug: 'power-off'},
{name: 'Reiniciar', slug: 'reboot'},
{name: 'Iniciar Sesión', slug: 'login'},
{name: 'Inventario Software', slug: 'software-inventory'},
{name: 'Inventario Hardware', slug: 'hardware-inventory'},
{name: 'Ejecutar script', slug: 'run-script'},
];
private apiUrl = `${this.baseUrl}/commands?page=1&itemsPerPage=40`;
ngOnInit(): void {
}
constructor(
private toastService: ToastrService,
public dialog: MatDialog,
private http: HttpClient,
@Inject(MAT_DIALOG_DATA) public data: any
) {
this.selectedElements = data?.selectedElements || [];
}
onSend(): void {
this.toastService.success('Acción enviada a: ' + this.selectedElements);
}
onPxeBootFile(): void {
const dialog = this.dialog.open(CreatePxeBootFileComponent, { data: this.selectedElements, width: '400px' });
dialog.afterClosed().subscribe(() => {
this.dialog.closeAll();
});
}
onCommandClick(command: any): void {
}
}

View File

@ -1,91 +0,0 @@
mat-form-field {
width: 100%;
margin-bottom: 16px;
padding: 5px;
}
.button-group {
display: flex;
justify-content: space-between;
}
button {
width: 48%;
}
:host {
display: block;
padding: 20px;
background-color: #f5f5f5;
border-radius: 8px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}
.mat-form-field {
width: 100%;
margin-bottom: 16px;
}
.mat-step-label {
font-weight: bold;
font-size: 1.1em;
}
button {
margin: 8px 0;
}
.mat-stepper-header {
background-color: #fff;
padding: 16px;
border-bottom: 1px solid #e0e0e0;
border-radius: 8px 8px 0 0;
}
.mat-stepper-horizontal-line {
border-color: #3f51b5;
}
.mat-stepper-horizontal {
background-color: #fff;
padding: 0;
border-radius: 8px;
overflow: hidden;
}
.mat-step-header {
background-color: #e8eaf6;
color: #3f51b5;
}
.mat-step-header .mat-step-icon {
background-color: #3f51b5;
color: #fff;
}
.mat-stepper-content {
padding: 16px;
background-color: #fff;
border-radius: 0 0 8px 8px;
}
pre {
background-color: #e8eaf6;
padding: 16px;
border-radius: 4px;
font-size: 12px;
overflow-x: auto;
}
.mat-raised-button {
margin-right: 8px;
}
.mat-button {
margin-right: 8px;
}
span{
margin: 5px;
padding-bottom: 15px;
}

View File

@ -1,19 +0,0 @@
<div class="create-PxeBootFile-container">
<h1 mat-dialog-title>{{ isEditMode ? ('editClientTitle' | translate) : ('addClientTitle' | translate) }}</h1>
<div class="mat-dialog-content">
<mat-form-field appearance="fill">
<mat-label>{{ 'selectPxeTemplateLabel' | translate }}</mat-label>
<mat-select [(value)]="selectedPxeTemplate">
<mat-option *ngFor="let template of pxeTemplates" [value]="template.uuid">
{{ template.name }}
</mat-option>
</mat-select>
</mat-form-field>
</div>
<div class="mat-dialog-actions">
<button class="ordinary-button" (click)="onCancel()">{{ 'cancelButton' | translate }}</button>
<button class="submit-button" (click)="onSave()">
{{ isEditMode ? ('saveButton' | translate) : ('addButton' | translate) }}
</button>
</div>
</div>

View File

@ -1,81 +0,0 @@
import { HttpClient } from '@angular/common/http';
import { Component, Inject, OnInit } from '@angular/core';
import { ToastrService } from 'ngx-toastr';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
@Component({
selector: 'app-create-pxe-boot-file',
templateUrl: './create-pxe-boot-file.component.html',
styleUrls: ['./create-pxe-boot-file.component.css']
})
export class CreatePxeBootFileComponent implements OnInit {
baseUrl: string = import.meta.env.NG_APP_BASE_API_URL;
pxeTemplates: any[] = [];
selectedPxeTemplate: string | undefined;
selectedElements: any;
isEditMode: boolean = false;
constructor(
private toastService: ToastrService,
private http: HttpClient,
private dialogRef: MatDialogRef<CreatePxeBootFileComponent>,
@Inject(MAT_DIALOG_DATA) public data: { clients: any[], bootFile?: any }
) {}
ngOnInit(): void {
this.selectedElements = this.data
this.loadPxeTemplates();
if (this.data.bootFile) {
this.isEditMode = true;
this.selectedPxeTemplate = this.data.bootFile.template.uuid;
}
}
loadPxeTemplates(): void {
this.http.get(`${this.baseUrl}/pxe-templates?page=1&itemsPerPage=30`)
.subscribe((response: any) => {
this.pxeTemplates = response['hydra:member'];
}, error => {
console.error('Error fetching PXE templates:', error);
});
}
onCancel(): void {
this.dialogRef.close();
}
onSave(): void {
if (this.selectedPxeTemplate) {
const payload = {
template: `/pxe-templates/${this.selectedPxeTemplate}`,
clients: this.selectedElements
};
if (this.isEditMode && this.data.bootFile) {
this.http.put(`${this.baseUrl}/pxe-boot-files/${this.data.bootFile.uuid}`, payload)
.subscribe({
next: response => {
this.toastService.success('PXE actualizado con éxito');
this.dialogRef.close(true);
},
error: error => {
this.toastService.error('Error al actualizar el PXE', error);
}
});
} else {
this.http.post(`${this.baseUrl}/pxe-boot-files`, payload)
.subscribe({
next: response => {
this.toastService.success('PXE asignado con éxito');
this.dialogRef.close(true);
},
error: error => {
this.toastService.error('Error enviando el payload', error);
}
});
}
} else {
this.toastService.error('No se ha seleccionado ninguna plantilla PXE');
}
}
}