Merge branch 'develop' of ssh://ognproject.evlt.uma.es:21987/opengnsys/oggui into develop
commit
38fef827a9
|
@ -0,0 +1,45 @@
|
|||
pipeline {
|
||||
agent { label 'jenkins-slave' }
|
||||
environment {
|
||||
DOCKER_REPO = "opengnsys"
|
||||
DOCKER_CREDENTIALS = credentials('docker-hub-credentials')
|
||||
DOCKER_TAG = "${env.BUILD_NUMBER}"
|
||||
DOCKER_IMAGE_NAME = "oggui"
|
||||
BRANCH_NAME = "${GIT_BRANCH.split("/")[1]}"
|
||||
}
|
||||
stages {
|
||||
stage ('Checkout') {
|
||||
steps {
|
||||
checkout scm
|
||||
}
|
||||
}
|
||||
stage('Build') {
|
||||
steps {
|
||||
echo 'Building....'
|
||||
script {
|
||||
dir('ogWebconsole') {
|
||||
IMAGE_ID = "${DOCKER_REPO}/${DOCKER_IMAGE_NAME}:${BRANCH_NAME}-${DOCKER_TAG}"
|
||||
if (BRANCH_NAME == 'main') {
|
||||
LATEST_ID = 'latest'
|
||||
} else {
|
||||
LATEST_ID = "${DOCKER_REPO}/${DOCKER_IMAGE_NAME}:${BRANCH_NAME}-latest"
|
||||
}
|
||||
docker.build("${IMAGE_ID}", "-f Dockerfile .")
|
||||
docker.build("${LATEST_ID}", "-f Dockerfile .")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Push') {
|
||||
steps {
|
||||
echo 'Pushing....'
|
||||
script {
|
||||
docker.withRegistry('https://index.docker.io/v1/', 'docker-hub-credentials' ) {
|
||||
docker.image("${IMAGE_ID}").push()
|
||||
docker.image("${LATEST_ID}").push()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
<h2 class="title" i18n="@@searchTitle">Búsqueda</h2>
|
||||
<h2 class="title" i18n="@@searchTitle">Búsqueda avanzada</h2>
|
||||
<div class="container">
|
||||
<div class="header">
|
||||
<mat-form-field>
|
||||
|
@ -104,7 +104,7 @@
|
|||
class="result-card"
|
||||
(dblclick)="onDobleClick($event, result.uuid, result.type)"
|
||||
[ngClass]="{
|
||||
'red-card': result.type === 'client' && result.status === 'power-off',
|
||||
'red-card': result.type === 'client' && result.status === 'off',
|
||||
'green-card': result.type === 'client' && result.status === 'active'
|
||||
}"
|
||||
>
|
||||
|
|
|
@ -65,6 +65,8 @@
|
|||
<ng-container matColumnDef="actions">
|
||||
<th mat-header-cell *matHeaderCellDef i18n="@@columnActions" style="text-align: center;">Acciones</th>
|
||||
<td mat-cell *matCellDef="let client" style="text-align: center;">
|
||||
<button *ngIf="!syncStatus" mat-icon-button color="primary" (click)="getStatus(client)"><mat-icon>sync</mat-icon></button>
|
||||
<button *ngIf="syncStatus" mat-icon-button color="primary"><mat-spinner diameter="24"></mat-spinner></button>
|
||||
<button mat-icon-button color="info" (click)="handleClientClick($event, client)"><mat-icon i18n="@@deleteElementTooltip">visibility</mat-icon></button>
|
||||
<button mat-icon-button color="primary" (click)="onEditClick($event, client.uuid)" i18n="@@editImage"> <mat-icon>edit</mat-icon></button>
|
||||
<button mat-icon-button color="warn" (click)="onDeleteClick($event, client)">
|
||||
|
|
|
@ -24,6 +24,7 @@ export class ClientTabViewComponent {
|
|||
dataSource = new MatTableDataSource<any>();
|
||||
length: number = 0;
|
||||
loading:boolean = false;
|
||||
syncStatus: boolean = false;
|
||||
itemsPerPage: number = 10;
|
||||
pageSizeOptions: number[] = [5, 10, 25, 100];
|
||||
page: number = 0;
|
||||
|
@ -132,6 +133,22 @@ export class ClientTabViewComponent {
|
|||
});
|
||||
}
|
||||
|
||||
getStatus(client: any): void {
|
||||
this.syncStatus = true;
|
||||
this.http.post(`${this.baseUrl}${client['@id']}/agent/status`, {}).subscribe(
|
||||
response => {
|
||||
this.toastService.success('Cliente actualizado correctamente');
|
||||
this.search()
|
||||
this.syncStatus = false;
|
||||
},
|
||||
error => {
|
||||
this.toastService.error(error.error['hydra:description']);
|
||||
this.syncStatus = false;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
handleClientClick(event: MouseEvent, client: any): void {
|
||||
event.stopPropagation();
|
||||
/* const dialogRef = this.dialog.open(ClientViewComponent, { data: { client }, width: '800px', height:'700px' }); */
|
||||
|
|
|
@ -36,10 +36,6 @@
|
|||
padding: 5px;
|
||||
}
|
||||
|
||||
button{
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
.mat-chip-success {
|
||||
background-color: #4CAF50 !important;
|
||||
color: white !important;
|
||||
|
@ -50,3 +46,8 @@ button{
|
|||
color: white !important;
|
||||
}
|
||||
|
||||
.button-row{
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<div class="header-container">
|
||||
<h2 class="title" i18n="@@adminImagesTitle">Administrar unidades organizativas</h2>
|
||||
<div class="images-button-row">
|
||||
<div class="button-row">
|
||||
<button mat-flat-button color="primary" (click)="resetFilters()">Reiniciar filtros</button>
|
||||
<button mat-flat-button color="primary" (click)="addOrganizationalUnit($event)">Añadir OU</button>
|
||||
</div>
|
||||
|
@ -43,12 +43,21 @@
|
|||
|
||||
<ng-container matColumnDef="actions">
|
||||
<th mat-header-cell *matHeaderCellDef i18n="@@columnActions" style="text-align: center;">Acciones</th>
|
||||
<td mat-cell *matCellDef="let client" style="text-align: center;">
|
||||
<button mat-icon-button color="info" (click)="onShowClick($event, client)"><mat-icon i18n="@@deleteElementTooltip">visibility</mat-icon></button>
|
||||
<button mat-icon-button color="primary" (click)="onEditClick($event, client.uuid)" i18n="@@editImage"> <mat-icon>edit</mat-icon></button>
|
||||
<button mat-icon-button color="warn" (click)="onDeleteClick($event, client)">
|
||||
<mat-icon i18n="@@deleteElementTooltip">delete</mat-icon>
|
||||
<td mat-cell *matCellDef="let ou" style="text-align: center;">
|
||||
<button mat-icon-button color="info" (click)="onShowClick($event, ou)"><mat-icon i18n="@@deleteElementTooltip">visibility</mat-icon></button>
|
||||
<button mat-icon-button color="primary" (click)="onEditClick($event, ou.uuid)" i18n="@@editImage"> <mat-icon>edit</mat-icon></button>
|
||||
<button mat-icon-button color="warn" (click)="onDeleteClick($event, ou)"><mat-icon>delete</mat-icon></button>
|
||||
<button mat-icon-button color="info" [matMenuTriggerFor]="menu">
|
||||
<mat-icon>menu</mat-icon>
|
||||
</button>
|
||||
<mat-menu #menu="matMenu">
|
||||
<button mat-menu-item [disabled]="ou.type !== 'classroom'" (click)="roomMap(ou)">
|
||||
<span i18n="@@viewTreeMenu">Plano de aula</span>
|
||||
</button>
|
||||
<button mat-menu-item [disabled]="ou.type !== 'organizational-unit'" (click)="onTreeClick(ou)">
|
||||
<span i18n="@@viewTreeMenu">Ver organigrama</span>
|
||||
</button>
|
||||
</mat-menu>
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
|
|
|
@ -19,6 +19,8 @@ import {
|
|||
import {
|
||||
EditOrganizationalUnitComponent
|
||||
} from "../../shared/organizational-units/edit-organizational-unit/edit-organizational-unit.component";
|
||||
import {ClassroomViewDialogComponent} from "../../shared/classroom-view/classroom-view-modal";
|
||||
import {TreeViewComponent} from "../../shared/tree-view/tree-view.component";
|
||||
|
||||
@Component({
|
||||
selector: 'app-organizational-unit-tab-view',
|
||||
|
@ -84,6 +86,18 @@ export class OrganizationalUnitTabViewComponent {
|
|||
this.getOrganizationalUnits();
|
||||
}
|
||||
|
||||
roomMap(room: any): void {
|
||||
console.log(room)
|
||||
const dialogRef = this.dialog.open(ClassroomViewDialogComponent, {
|
||||
width: '90vw',
|
||||
data: { clients: room.clients }
|
||||
});
|
||||
}
|
||||
|
||||
onTreeClick(data: any): void {
|
||||
const dialogRef = this.dialog.open(TreeViewComponent, { data: { data }, width: '800px'});
|
||||
}
|
||||
|
||||
getOrganizationalUnits() {
|
||||
this.http.get<any>(`${this.apiUrl}?&page=${this.page + 1}&itemsPerPage=${this.itemsPerPage}`, { params: this.filters }).subscribe(
|
||||
(data) => {
|
||||
|
|
|
@ -21,7 +21,11 @@
|
|||
}
|
||||
|
||||
.header-container {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
height: 100px;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.unidad-card, .elements-card {
|
||||
|
@ -29,6 +33,7 @@
|
|||
background-color: #fafafa;
|
||||
height: 600px;
|
||||
overflow-y: auto;
|
||||
box-shadow: none !important;
|
||||
}
|
||||
|
||||
.element-content {
|
||||
|
@ -71,11 +76,7 @@ mat-card-subtitle a:hover {
|
|||
|
||||
.groups-button-row {
|
||||
display: flex;
|
||||
flex-grow: 1;
|
||||
gap: 10px;
|
||||
margin-bottom: 20px;
|
||||
margin-left: 10px;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.item-content {
|
||||
|
|
|
@ -8,14 +8,9 @@
|
|||
<button mat-raised-button (click)="openBottomSheet()" i18n="@@legendButton">Leyenda</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="search-container">
|
||||
<div class="classroomBtn-container">
|
||||
<button mat-flat-button class="roomMap-btn" color="accent" (click)="roomMap()" *ngIf="selectedDetail && selectedDetail.type === 'classroom'" i18n="@@classroomMapButton">Plano de aula</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="groupLists-container">
|
||||
<mat-card class="card unidad-card">
|
||||
<mat-card-title i18n="@@organizationalUnitTitle">Unidad organizativa</mat-card-title>
|
||||
<mat-card-title i18n="@@organizationalUnitTitle">Centros</mat-card-title>
|
||||
<mat-card-content>
|
||||
<mat-spinner *ngIf="loading"></mat-spinner>
|
||||
<mat-list *ngIf="!loading">
|
||||
|
@ -82,7 +77,7 @@
|
|||
<mat-card class="card elements-card">
|
||||
<mat-card-title>
|
||||
<div class="title-with-breadcrumb">
|
||||
<span i18n="@@internalElementsTitle">Elementos internos</span>
|
||||
<span i18n="@@internalElementsTitle"></span>
|
||||
<mat-card-subtitle>
|
||||
<ng-container *ngFor="let crumb of breadcrumb; let i = index">
|
||||
<a (click)="navigateToBreadcrumb(i)">{{ crumb }}</a>
|
||||
|
|
|
@ -183,7 +183,6 @@ export class GroupsComponent implements OnInit {
|
|||
this.dataService.getOrganizationalUnits().subscribe(
|
||||
data => {
|
||||
this.organizationalUnits = data
|
||||
this.loadChildrenAndClients(parent?.id);
|
||||
},
|
||||
error => console.error('Error fetching unidades organizativas', error)
|
||||
);
|
||||
|
|
|
@ -4,7 +4,7 @@ import { MAT_DIALOG_DATA } from '@angular/material/dialog';
|
|||
@Component({
|
||||
selector: 'app-classroom-view-dialog',
|
||||
template: `
|
||||
<h2 mat-dialog-title>Plano de {{ classroomName }}</h2>
|
||||
<h2 mat-dialog-title>Plano de aula</h2>
|
||||
<app-classroom-view [clients]="data.clients"></app-classroom-view>
|
||||
`,
|
||||
styles: [`
|
||||
|
@ -17,17 +17,5 @@ export class ClassroomViewDialogComponent {
|
|||
classroomName: string | undefined;
|
||||
|
||||
constructor(@Inject(MAT_DIALOG_DATA) public data: any) {
|
||||
console.log('ClassroomViewDialogComponent');
|
||||
console.log(data);
|
||||
}
|
||||
ngOnInit() {
|
||||
if (this.data.clients && this.data.clients.length > 0) {
|
||||
this.classroomName = this.data.clients[0].organizationalUnit.name;
|
||||
} else {
|
||||
this.classroomName = 'N/A';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
flex-wrap: wrap;
|
||||
gap: 10px;
|
||||
border: 3px solid black;
|
||||
margin: 10px;
|
||||
}
|
||||
|
||||
.classroom-group {
|
||||
|
@ -97,6 +98,10 @@ mat-chip {
|
|||
margin: 0 auto;
|
||||
}
|
||||
|
||||
mat-dialog-content {
|
||||
min-height: 70vh;
|
||||
}
|
||||
|
||||
.mat-dialog-content.loading {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
|
|
@ -23,6 +23,6 @@
|
|||
</div>
|
||||
</div>
|
||||
</mat-dialog-content>
|
||||
<mat-dialog-actions>
|
||||
<mat-dialog-actions align="end">
|
||||
<button mat-raised-button color="primary" class="saveDisposition-btn" (click)="saveDisposition()">Guardar disposición</button>
|
||||
</mat-dialog-actions>
|
||||
|
|
|
@ -36,7 +36,7 @@ export class ClassroomViewComponent implements OnInit, OnChanges {
|
|||
|
||||
groupClientsByOrganizationalUnit(): void {
|
||||
const grouped = this.clients.reduce((acc, client) => {
|
||||
const ouName = client.organizationalUnit.name;
|
||||
const ouName = 'text';
|
||||
if (!acc[ouName]) {
|
||||
acc[ouName] = [];
|
||||
}
|
||||
|
|
|
@ -1,70 +1,83 @@
|
|||
.global-selectors {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 15px;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.global-selectors mat-form-field {
|
||||
flex: 1;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.global-selectors button {
|
||||
height: 40px;
|
||||
padding: 0 20px;
|
||||
}
|
||||
|
||||
.filters-container {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: flex-end;
|
||||
gap: 10px;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
.filters-container mat-form-field {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.mat-elevation-z8 {
|
||||
margin-top: 15px;
|
||||
}
|
||||
|
||||
.mat-table {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
mat-header-cell, mat-cell {
|
||||
text-align: center;
|
||||
font-size: 14px;
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
mat-form-field {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.mat-paginator {
|
||||
margin-top: 20px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
mat-select, mat-input {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.mat-form-field-appearance-fill .mat-form-field-flex {
|
||||
padding: 8px 0;
|
||||
}
|
||||
|
||||
button.mat-flat-button {
|
||||
padding: 8px 16px;
|
||||
font-size: 14px;
|
||||
.title {
|
||||
font-size: 24px;
|
||||
}
|
||||
|
||||
.divider {
|
||||
margin: 20px 0;
|
||||
}
|
||||
|
||||
table {
|
||||
width: 100%;
|
||||
margin-top: 50px;
|
||||
}
|
||||
|
||||
.search-container {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
padding: 0 5px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.global-selectors {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 10px;
|
||||
padding: 0 5px;
|
||||
}
|
||||
|
||||
.selected-global {
|
||||
width: 450px;
|
||||
}
|
||||
|
||||
.search-string {
|
||||
flex: 2;
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
.search-boolean {
|
||||
flex: 1;
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
.save-button{
|
||||
justify-self: end;
|
||||
}
|
||||
|
||||
.header-container {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.mat-elevation-z8 {
|
||||
box-shadow: 0px 0px 0px rgba(0,0,0,0.2);
|
||||
}
|
||||
|
||||
.paginator-container {
|
||||
display: flex;
|
||||
justify-content: end;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
.example-headers-align .mat-expansion-panel-header-description {
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.example-headers-align .mat-mdc-form-field + .mat-mdc-form-field {
|
||||
margin-left: 8px;
|
||||
}
|
||||
|
||||
.example-button-row {
|
||||
display: table-cell;
|
||||
max-width: 600px;
|
||||
}
|
||||
|
||||
.example-button-row .mat-mdc-button-base {
|
||||
margin: 8px 8px 8px 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,21 +1,10 @@
|
|||
<mat-accordion class="example-headers-align">
|
||||
<mat-expansion-panel hideToggle>
|
||||
<mat-expansion-panel-header>
|
||||
<mat-panel-title> Sincronización ogBoot </mat-panel-title>
|
||||
</mat-expansion-panel-header>
|
||||
|
||||
<div class="example-button-row">
|
||||
<button mat-flat-button color="primary" (click)="syncOgCore()"> Sincronizar OgCore</button>
|
||||
</div>
|
||||
</mat-expansion-panel>
|
||||
</mat-accordion>
|
||||
|
||||
<div class="header-container">
|
||||
<h2 class="title">Administrar ficheros de arranque PXE</h2>
|
||||
<h2 class="title">Netboot avanzado</h2>
|
||||
</div>
|
||||
|
||||
<div [formGroup]="taskForm" class="filters-container">
|
||||
<mat-form-field appearance="fill" class="full-width">
|
||||
<div [formGroup]="taskForm" class="search-container">
|
||||
<mat-form-field appearance="fill" class="search-boolean">
|
||||
<mat-label>Selecciona Unidad Organizacional</mat-label>
|
||||
<mat-select formControlName="organizationalUnit" (selectionChange)="onOrganizationalUnitChange()">
|
||||
<mat-option *ngIf="loadingUnits" disabled>Cargando unidades...</mat-option>
|
||||
|
@ -26,7 +15,7 @@
|
|||
<mat-error *ngIf="taskForm.get('organizationalUnit')?.invalid">Este campo es obligatorio</mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="fill" class="full-width">
|
||||
<mat-form-field appearance="fill" class="search-boolean">
|
||||
<mat-label>Selecciona aula</mat-label>
|
||||
<mat-select formControlName="selectedChild" (selectionChange)="onChildChange()">
|
||||
<mat-option *ngIf="selectedUnitChildren.length === 0" disabled>No hay aulas disponibles</mat-option>
|
||||
|
@ -40,14 +29,14 @@
|
|||
<mat-divider class="divider"></mat-divider>
|
||||
|
||||
<div class="global-selectors">
|
||||
<mat-form-field appearance="fill">
|
||||
<mat-label>Global ogLive</mat-label>
|
||||
<mat-select [(value)]="globalOgLive">
|
||||
<mat-form-field appearance="fill" class="selected-global">
|
||||
<mat-label>Seleccione plantilla para aplicar a todos los clientes</mat-label>
|
||||
<mat-select [(value)]="globalOgLive" (selectionChange)="applyToAll()" >
|
||||
<mat-option *ngFor="let option of ogLiveOptions" [value]="option['@id']">{{ option.name }}</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
|
||||
<button mat-flat-button color="primary" (click)="applyToAll()">Aplicar a todos</button>
|
||||
<button mat-flat-button color="primary" [disabled]="selectedUnitChildren.length === 0" (click)="saveOgLiveTemplates()">Guardar</button>
|
||||
</div>
|
||||
|
||||
<mat-table [dataSource]="dataSource" class="mat-elevation-z8">
|
||||
|
@ -80,14 +69,3 @@
|
|||
<mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>
|
||||
<mat-row *matRowDef="let row; columns: displayedColumns;"></mat-row>
|
||||
</mat-table>
|
||||
|
||||
<div class="save-button"
|
||||
>
|
||||
<button mat-flat-button color="primary" (click)="saveOgLiveTemplates()">Guardar</button>
|
||||
</div>
|
||||
|
||||
<mat-paginator [length]="length"
|
||||
[pageSize]="itemsPerPage"
|
||||
[pageSizeOptions]="pageSizeOptions"
|
||||
(page)="onPageChange($event)">
|
||||
</mat-paginator>
|
|
@ -3,6 +3,8 @@ import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
|||
import { HttpClient } from '@angular/common/http';
|
||||
import { ToastrService } from 'ngx-toastr';
|
||||
import { PageEvent } from '@angular/material/paginator';
|
||||
import {Observable} from "rxjs";
|
||||
import {ServerInfoDialogComponent} from "../../ogdhcp/og-dhcp-subnets/server-info-dialog/server-info-dialog.component";
|
||||
|
||||
@Component({
|
||||
selector: 'app-pxe-boot-files',
|
||||
|
@ -26,6 +28,7 @@ export class PxeBootFilesComponent implements OnInit {
|
|||
filters: any = {};
|
||||
displayedColumns: string[] = ['id', 'name', 'ogLive'];
|
||||
|
||||
|
||||
constructor(
|
||||
private fb: FormBuilder,
|
||||
private http: HttpClient,
|
||||
|
@ -152,15 +155,4 @@ export class PxeBootFilesComponent implements OnInit {
|
|||
this.itemsPerPage = event.pageSize;
|
||||
this.fetchPxeTemplates();
|
||||
}
|
||||
|
||||
syncOgCore(): void {
|
||||
this.http.post(`${this.baseUrl}/sync`, {}).subscribe(
|
||||
() => {
|
||||
this.toastService.success('Sincronización completada');
|
||||
},
|
||||
error => {
|
||||
this.toastService.error('Error al sincronizar');
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
<div matListItemLine>{{ client.mac }}</div>
|
||||
</div>
|
||||
<div class="icon-container">
|
||||
<button mat-icon-button color="info" (click)="showInfo(client)" i18n="@@editImage"> <mat-icon>visibility</mat-icon></button>
|
||||
<button mat-icon-button color="primary" (click)="addClientToTemplate(client)" i18n="@@editImage"> <mat-icon>sync</mat-icon></button>
|
||||
<button mat-icon-button color="warn" class="right-icon" (click)="deleteClient(client)">
|
||||
<mat-icon>delete</mat-icon>
|
||||
|
|
|
@ -4,6 +4,10 @@ import {MAT_DIALOG_DATA, MatDialog, MatDialogRef} from "@angular/material/dialog
|
|||
import {HttpClient} from "@angular/common/http";
|
||||
import {ToastrService} from "ngx-toastr";
|
||||
import {DeleteModalComponent} from "../../../../shared/delete_modal/delete-modal/delete-modal.component";
|
||||
import {Observable} from "rxjs";
|
||||
import {
|
||||
ServerInfoDialogComponent
|
||||
} from "../../../ogdhcp/og-dhcp-subnets/server-info-dialog/server-info-dialog.component";
|
||||
|
||||
@Component({
|
||||
selector: 'app-clients',
|
||||
|
@ -14,6 +18,7 @@ export class ClientsComponent {
|
|||
baseUrl: string = import.meta.env.NG_APP_BASE_API_URL;
|
||||
templateForm!: FormGroup;
|
||||
clients: any[] = [];
|
||||
alertMessage: string | null = null;
|
||||
|
||||
constructor(
|
||||
public dialogRef: MatDialogRef<ClientsComponent>,
|
||||
|
@ -54,6 +59,28 @@ export class ClientsComponent {
|
|||
);
|
||||
}
|
||||
|
||||
loadAlert(client: any): Observable<any> {
|
||||
return this.http.post<any>(`${this.baseUrl}/clients/server/${client.uuid}/get-pxe`, {});
|
||||
}
|
||||
|
||||
showInfo(client:any) {
|
||||
this.loadAlert(client).subscribe(
|
||||
response => {
|
||||
this.alertMessage = response.message;
|
||||
|
||||
this.dialog.open(ServerInfoDialogComponent, {
|
||||
width: '600px',
|
||||
data: {
|
||||
message: this.alertMessage
|
||||
}
|
||||
});
|
||||
},
|
||||
error => {
|
||||
console.error('Error al cargar la información del alert', error);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
deleteClient(client: any): void {
|
||||
const dialogRef = this.dialog.open(DeleteModalComponent, {
|
||||
width: '300px',
|
||||
|
@ -62,7 +89,7 @@ export class ClientsComponent {
|
|||
|
||||
dialogRef.afterClosed().subscribe(result => {
|
||||
if (result) {
|
||||
this.http.post(`${this.baseUrl}/pxe-templates/${this.data.uuid}/delete-client`, { client: client['@id'] }).subscribe({
|
||||
this.http.post(`${this.baseUrl}/pxe-templates/${this.data.data.uuid}/delete-client`, { client: client['@id'] }).subscribe({
|
||||
next: () => {
|
||||
this.toastService.success('Cliente eliminado exitosamente');
|
||||
this.dialogRef.close();
|
||||
|
|
|
@ -13,9 +13,9 @@
|
|||
</mat-accordion>
|
||||
|
||||
<div class="header-container">
|
||||
<h2 class="title" i18n="@@subnetsTitle">Administrar Subnets</h2>
|
||||
<h2 class="title" i18n="@@subnetsTitle">Administrar Subredes</h2>
|
||||
<div class="subnets-button-row">
|
||||
<button mat-flat-button color="primary" (click)="addSubnet()">Añadir Subnet</button>
|
||||
<button mat-flat-button color="primary" (click)="addSubnet()">Añadir Subred</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<h2 mat-dialog-title>Información de Subnets</h2>
|
||||
<h2 mat-dialog-title>Información de Subred</h2>
|
||||
<mat-dialog-content>
|
||||
<pre>{{ data | json }}</pre>
|
||||
</mat-dialog-content>
|
||||
|
|
|
@ -69,7 +69,7 @@
|
|||
<mat-list-item routerLink="/subnets">
|
||||
<span class="entry">
|
||||
<mat-icon class="icon">lan</mat-icon>
|
||||
<span i18n="@@gallery">Subnets</span>
|
||||
<span i18n="@@gallery">Subredes</span>
|
||||
</span>
|
||||
</mat-list-item>
|
||||
</mat-nav-list>
|
||||
|
|
Loading…
Reference in New Issue