refs #798 Merge all active branches into develop
parent
f9d19727a1
commit
d6e5be3fe1
|
@ -37,6 +37,8 @@ const routes: Routes = [
|
|||
{ path: 'dhcp', component: OgdhcpComponent },
|
||||
{ path: 'dhcp-subnets', component: OgDhcpSubnetsComponent },
|
||||
{ path: 'commands', component: CommandsComponent },
|
||||
{ path: 'commands-groups', component: CommandsGroupsComponent },
|
||||
{ path: 'commands-task', component: CommandsTaskComponent },
|
||||
{ path: 'calendars', component: CalendarComponent },
|
||||
],
|
||||
},
|
||||
|
|
|
@ -33,27 +33,27 @@ import { AddRoleModalComponent } from './components/admin/roles/roles/add-role-m
|
|||
import { ChangePasswordModalComponent } from './components/admin/users/users/change-password-modal/change-password-modal.component';
|
||||
import { GroupsComponent } from './components/groups/groups.component';
|
||||
import { MatDividerModule } from '@angular/material/divider';
|
||||
import { CreateOrganizationalUnitComponent } from './components/groups/organizational-units/create-organizational-unit/create-organizational-unit.component';
|
||||
import { CreateOrganizationalUnitComponent } from './components/groups/shared/organizational-units/create-organizational-unit/create-organizational-unit.component';
|
||||
import { MatStepperModule } from '@angular/material/stepper';
|
||||
import { MatSlideToggleModule } from '@angular/material/slide-toggle';
|
||||
import { CreateClientComponent } from './components/groups/clients/create-client/create-client.component';
|
||||
import { CreateClientComponent } from './components/groups/shared/clients/create-client/create-client.component';
|
||||
import { DeleteModalComponent } from './shared/delete_modal/delete-modal/delete-modal.component';
|
||||
import { EditOrganizationalUnitComponent } from './components/groups/organizational-units/edit-organizational-unit/edit-organizational-unit.component';
|
||||
import { EditClientComponent } from './components/groups/clients/edit-client/edit-client.component';
|
||||
import { ClassroomViewComponent } from './components/groups/classroom-view/classroom-view.component';
|
||||
import { EditOrganizationalUnitComponent } from './components/groups/shared/organizational-units/edit-organizational-unit/edit-organizational-unit.component';
|
||||
import { EditClientComponent } from './components/groups/shared/clients/edit-client/edit-client.component';
|
||||
import { ClassroomViewComponent } from './components/groups/shared/classroom-view/classroom-view.component';
|
||||
import { MatProgressSpinner } from "@angular/material/progress-spinner";
|
||||
import { MatMenu, MatMenuItem, MatMenuTrigger } from "@angular/material/menu";
|
||||
import { MatAutocomplete } from "@angular/material/autocomplete";
|
||||
import { MatChip, MatChipListbox, MatChipOption, MatChipSet, MatChipsModule } from "@angular/material/chips";
|
||||
import { ClientViewComponent } from './components/groups/client-view/client-view.component';
|
||||
import { ClientViewComponent } from './components/groups/shared/client-view/client-view.component';
|
||||
import { MatTab, MatTabGroup } from "@angular/material/tabs";
|
||||
import { MatTooltip } from "@angular/material/tooltip";
|
||||
import { MatExpansionModule } from '@angular/material/expansion';
|
||||
import { DragDropModule } from '@angular/cdk/drag-drop';
|
||||
import { ToastrModule } from 'ngx-toastr';
|
||||
import { ShowOrganizationalUnitComponent } from './components/groups/organizational-units/show-organizational-unit/show-organizational-unit.component';
|
||||
import { ShowOrganizationalUnitComponent } from './components/groups/shared/organizational-units/show-organizational-unit/show-organizational-unit.component';
|
||||
import { MatGridList, MatGridTile } from "@angular/material/grid-list";
|
||||
import { TreeViewComponent } from './components/groups/tree-view/tree-view.component';
|
||||
import { TreeViewComponent } from './components/groups/shared/tree-view/tree-view.component';
|
||||
import {
|
||||
MatNestedTreeNode,
|
||||
MatTree,
|
||||
|
@ -62,11 +62,11 @@ import {
|
|||
MatTreeNodePadding,
|
||||
MatTreeNodeToggle
|
||||
} from "@angular/material/tree";
|
||||
import { LegendComponent } from './components/groups/legend/legend.component';
|
||||
import { ClassroomViewDialogComponent } from './components/groups/classroom-view/classroom-view-modal';
|
||||
import { LegendComponent } from './components/groups/shared/legend/legend.component';
|
||||
import { ClassroomViewDialogComponent } from './components/groups/shared/classroom-view/classroom-view-modal';
|
||||
import { MatPaginator } from "@angular/material/paginator";
|
||||
import { SaveFiltersDialogComponent } from './components/groups/save-filters-dialog/save-filters-dialog.component';
|
||||
import { AcctionsModalComponent } from './components/groups/acctions-modal/acctions-modal.component';
|
||||
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 { ImagesComponent } from './components/ogboot/images/images.component';
|
||||
import { CreateImageComponent } from './components/ogboot/images/create-image/create-image/create-image.component';
|
||||
import { InfoImageComponent } from './components/ogboot/images/info-image/info-image/info-image.component';
|
||||
|
@ -97,7 +97,9 @@ import { CreateCommandGroupComponent } from './components/commands/commands-grou
|
|||
import { DetailCommandGroupComponent } from './components/commands/commands-groups/detail-command-group/detail-command-group.component';
|
||||
import { CreateTaskComponent } from './components/commands/commands-task/create-task/create-task.component';
|
||||
import { DetailTaskComponent } from './components/commands/commands-task/detail-task/detail-task.component';
|
||||
import { ClientTabViewComponent } from './components/groups/client-tab-view/client-tab-view.component';
|
||||
import { ClientTabViewComponent } from './components/groups/shared/client-tab-view/client-tab-view.component';
|
||||
import { AdminGeneralComponent } from './components/groups/components/admin-general/admin-general.component';
|
||||
import { AdvancedSearchComponent } from './components/groups/components/advanced-search/advanced-search.component';
|
||||
@NgModule({
|
||||
declarations: [
|
||||
AppComponent,
|
||||
|
@ -145,14 +147,16 @@ import { ClientTabViewComponent } from './components/groups/client-tab-view/clie
|
|||
CreateCommandComponent,
|
||||
CalendarComponent,
|
||||
CreateCalendarComponent,
|
||||
CreateCalendarRuleComponent
|
||||
CreateCalendarRuleComponent,
|
||||
CommandsGroupsComponent,
|
||||
CommandsTaskComponent,
|
||||
CreateCommandGroupComponent,
|
||||
DetailCommandGroupComponent,
|
||||
CreateTaskComponent,
|
||||
DetailTaskComponent,
|
||||
ClientTabViewComponent
|
||||
ClientTabViewComponent,
|
||||
AdminGeneralComponent,
|
||||
AdvancedSearchComponent
|
||||
],
|
||||
bootstrap: [AppComponent],
|
||||
imports: [BrowserModule,
|
||||
|
|
|
@ -1,24 +1,22 @@
|
|||
<h1 mat-dialog-title i18n="@@dialogTitleAddRole">Añadir Rol (TBD)</h1>
|
||||
<div mat-dialog-content>
|
||||
<form class="role-form">
|
||||
<form [formGroup]="roleForm" class="role-form">
|
||||
<mat-form-field class="form-field">
|
||||
<mat-label i18n="@@labelRoleName">Nombre</mat-label>
|
||||
<input matInput formControlName="rolename" required>
|
||||
<input matInput formControlName="name" required>
|
||||
</mat-form-field>
|
||||
|
||||
<section class="example-section">
|
||||
<h4 i18n="@@sectionTitlePermissions">Permisos:</h4>
|
||||
<p><mat-checkbox i18n="@@checkboxManageUsers">Gestionar los usuarios</mat-checkbox></p>
|
||||
<p><mat-checkbox i18n="@@checkboxPXEConfig">Configuración PXE</mat-checkbox></p>
|
||||
<p><mat-checkbox i18n="@@checkboxConsoleImages">Imágenes de la consola web</mat-checkbox></p>
|
||||
<p><mat-checkbox i18n="@@checkboxManageComponents">Gestionar los distintos componentes</mat-checkbox></p>
|
||||
<p><mat-checkbox i18n="@@checkboxCreateImages">Crear imágenes</mat-checkbox></p>
|
||||
<p><mat-checkbox i18n="@@checkboxServerConfigScript">script de configuración del servidor</mat-checkbox></p>
|
||||
<p><mat-checkbox i18n="@@checkboxOther">...</mat-checkbox></p>
|
||||
<p><mat-checkbox formControlName="superAdmin" i18n="@@checkboxSuperAdmin">Super Admin</mat-checkbox></p>
|
||||
<p><mat-checkbox formControlName="orgAdmin" i18n="@@checkboxOrgAdmin">Admin de Unidad Organizativa</mat-checkbox></p>
|
||||
<p><mat-checkbox formControlName="orgOperator" i18n="@@checkboxOrgOperator">Operador de Unidad Organizativa</mat-checkbox></p>
|
||||
<p><mat-checkbox formControlName="orgMinimal" i18n="@@checkboxOrgMinimal">Unidad Organizativa Mínima</mat-checkbox></p>
|
||||
<p><mat-checkbox formControlName="userRole" i18n="@@checkboxUserRole">Usuario</mat-checkbox></p>
|
||||
</section>
|
||||
</form>
|
||||
</div>
|
||||
<div mat-dialog-actions>
|
||||
<button mat-button (click)="onNoClick()" i18n="@@buttonCancel">Cancelar</button>
|
||||
<button mat-button i18n="@@buttonAdd">Añadir</button>
|
||||
<button mat-button (click)="onSubmit()" i18n="@@buttonAdd">Añadir</button>
|
||||
</div>
|
||||
|
|
|
@ -1,19 +1,62 @@
|
|||
import { HttpClient } from '@angular/common/http';
|
||||
import { Component, Inject } from '@angular/core';
|
||||
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
|
||||
import { FormBuilder, FormGroup } from '@angular/forms';
|
||||
|
||||
@Component({
|
||||
selector: 'app-add-role-modal',
|
||||
templateUrl: './add-role-modal.component.html',
|
||||
styleUrl: './add-role-modal.component.css'
|
||||
styleUrls: ['./add-role-modal.component.css']
|
||||
})
|
||||
export class AddRoleModalComponent {
|
||||
roleForm: FormGroup;
|
||||
|
||||
constructor(
|
||||
public dialogRef: MatDialogRef<AddRoleModalComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public data: any,
|
||||
private http: HttpClient
|
||||
) {}
|
||||
private http: HttpClient,
|
||||
private fb: FormBuilder
|
||||
) {
|
||||
this.roleForm = this.fb.group({
|
||||
name: [''],
|
||||
superAdmin: [false],
|
||||
orgAdmin: [false],
|
||||
orgOperator: [false],
|
||||
orgMinimal: [false],
|
||||
userRole: [false]
|
||||
});
|
||||
}
|
||||
|
||||
onNoClick(): void {
|
||||
this.dialogRef.close();
|
||||
}
|
||||
|
||||
onSubmit(): void {
|
||||
if (this.roleForm.valid) {
|
||||
const formValues = this.roleForm.value;
|
||||
|
||||
const selectedPermissions: string[] = [];
|
||||
if (formValues.superAdmin) selectedPermissions.push('ROLE_SUPER_ADMIN');
|
||||
if (formValues.orgAdmin) selectedPermissions.push('ROLE_ORGANIZATIONAL_UNIT_ADMIN');
|
||||
if (formValues.orgOperator) selectedPermissions.push('ROLE_ORGANIZATIONAL_UNIT_OPERATOR');
|
||||
if (formValues.orgMinimal) selectedPermissions.push('ROLE_ORGANIZATIONAL_UNIT_MINIMAL');
|
||||
if (formValues.userRole) selectedPermissions.push('ROLE_USER');
|
||||
|
||||
|
||||
const payload = {
|
||||
name: formValues.name,
|
||||
permissions: selectedPermissions,
|
||||
enabled: true
|
||||
};
|
||||
|
||||
this.http.post('http://127.0.0.1:8001/user-groups', payload).subscribe(
|
||||
(response) => {
|
||||
this.dialogRef.close();
|
||||
},
|
||||
(error) => {
|
||||
console.error('Error al añadir rol', error);
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,10 +51,9 @@ export class RolesComponent implements OnInit {
|
|||
addUser() {
|
||||
const dialogRef = this.dialog.open(AddRoleModalComponent);
|
||||
|
||||
/* dialogRef.componentInstance.roleAdded.subscribe(() => {
|
||||
dialogRef.afterClosed().subscribe((result) => {
|
||||
this.loadRoles();
|
||||
}); */
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
deleteRole(role: any): void {
|
||||
|
@ -69,16 +68,13 @@ export class RolesComponent implements OnInit {
|
|||
|
||||
this.http.delete(apiUrl).subscribe({
|
||||
next: () => {
|
||||
console.log('Role deleted successfully');
|
||||
this.loadRoles();
|
||||
this.toastService.success('Role deleted successfully');
|
||||
},
|
||||
error: (error) => {
|
||||
console.error('Error deleting role:', error);
|
||||
this.toastService.error('Error deleting role:', error);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
console.log('Role deletion cancelled');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
<p>admin-general works!</p>
|
|
@ -0,0 +1,23 @@
|
|||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { AdminGeneralComponent } from './admin-general.component';
|
||||
|
||||
describe('AdminGeneralComponent', () => {
|
||||
let component: AdminGeneralComponent;
|
||||
let fixture: ComponentFixture<AdminGeneralComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [AdminGeneralComponent]
|
||||
})
|
||||
.compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(AdminGeneralComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
|
@ -0,0 +1,10 @@
|
|||
import { Component } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-admin-general',
|
||||
templateUrl: './admin-general.component.html',
|
||||
styleUrl: './admin-general.component.css'
|
||||
})
|
||||
export class AdminGeneralComponent {
|
||||
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
<p>advanced-search works!</p>
|
|
@ -0,0 +1,23 @@
|
|||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { AdvancedSearchComponent } from './advanced-search.component';
|
||||
|
||||
describe('AdvancedSearchComponent', () => {
|
||||
let component: AdvancedSearchComponent;
|
||||
let fixture: ComponentFixture<AdvancedSearchComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [AdvancedSearchComponent]
|
||||
})
|
||||
.compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(AdvancedSearchComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
|
@ -0,0 +1,10 @@
|
|||
import { Component } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-advanced-search',
|
||||
templateUrl: './advanced-search.component.html',
|
||||
styleUrl: './advanced-search.component.css'
|
||||
})
|
||||
export class AdvancedSearchComponent {
|
||||
|
||||
}
|
|
@ -1,22 +1,22 @@
|
|||
import { Component, OnInit } from '@angular/core';
|
||||
import { DataService } from './data.service';
|
||||
import { ClientCollection, UnidadOrganizativa } from './model';
|
||||
import { DataService } from './services/data.service';
|
||||
import { ClientCollection, UnidadOrganizativa } from './model/model';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { CreateOrganizationalUnitComponent } from './organizational-units/create-organizational-unit/create-organizational-unit.component';
|
||||
import { CreateOrganizationalUnitComponent } from './shared/organizational-units/create-organizational-unit/create-organizational-unit.component';
|
||||
import { DeleteModalComponent } from '../../shared/delete_modal/delete-modal/delete-modal.component';
|
||||
import { CreateClientComponent } from './clients/create-client/create-client.component';
|
||||
import { EditOrganizationalUnitComponent } from './organizational-units/edit-organizational-unit/edit-organizational-unit.component';
|
||||
import { EditClientComponent } from './clients/edit-client/edit-client.component';
|
||||
import { ShowOrganizationalUnitComponent} from "./organizational-units/show-organizational-unit/show-organizational-unit.component";
|
||||
import { CreateClientComponent } from './shared/clients/create-client/create-client.component';
|
||||
import { EditOrganizationalUnitComponent } from './shared/organizational-units/edit-organizational-unit/edit-organizational-unit.component';
|
||||
import { EditClientComponent } from './shared/clients/edit-client/edit-client.component';
|
||||
import { ShowOrganizationalUnitComponent} from "./shared/organizational-units/show-organizational-unit/show-organizational-unit.component";
|
||||
import {ToastrService} from "ngx-toastr";
|
||||
import {TreeViewComponent} from "./tree-view/tree-view.component";
|
||||
import {TreeViewComponent} from "./shared/tree-view/tree-view.component";
|
||||
import {MatBottomSheet} from "@angular/material/bottom-sheet";
|
||||
import {LegendComponent} from "./legend/legend.component";
|
||||
import { ClassroomViewDialogComponent } from './classroom-view/classroom-view-modal';
|
||||
import {LegendComponent} from "./shared/legend/legend.component";
|
||||
import { ClassroomViewDialogComponent } from './shared/classroom-view/classroom-view-modal';
|
||||
import {HttpClient} from "@angular/common/http";
|
||||
import {PageEvent} from "@angular/material/paginator";
|
||||
import { SaveFiltersDialogComponent } from './save-filters-dialog/save-filters-dialog.component';
|
||||
import { AcctionsModalComponent } from './acctions-modal/acctions-modal.component';
|
||||
import { SaveFiltersDialogComponent } from './shared/save-filters-dialog/save-filters-dialog.component';
|
||||
import { AcctionsModalComponent } from './shared/acctions-modal/acctions-modal.component';
|
||||
import {MatTableDataSource} from "@angular/material/table";
|
||||
import {DatePipe} from "@angular/common";
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ import { Injectable } from '@angular/core';
|
|||
import {HttpClient, HttpParams} from '@angular/common/http';
|
||||
import { Observable, throwError } from 'rxjs';
|
||||
import { catchError, map } from 'rxjs/operators';
|
||||
import { UnidadOrganizativa } from './model';
|
||||
import { UnidadOrganizativa } from '../model/model';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
|
@ -2,9 +2,9 @@
|
|||
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 { 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 { CommandDetailComponent } from '../../../commands/main-commands/detail-command/command-detail.component';
|
||||
@Component({
|
||||
selector: 'app-acctions-modal',
|
||||
templateUrl: './acctions-modal.component.html',
|
|
@ -8,7 +8,7 @@ import {HttpClient} from "@angular/common/http";
|
|||
import {DataService} from "./data.service";
|
||||
import {EditClientComponent} from "../clients/edit-client/edit-client.component";
|
||||
import {CreateClientComponent} from "../clients/create-client/create-client.component";
|
||||
import {DeleteModalComponent} from "../../../shared/delete_modal/delete-modal/delete-modal.component";
|
||||
import {DeleteModalComponent} from "../../../../shared/delete_modal/delete-modal/delete-modal.component";
|
||||
import { throwError } from 'rxjs';
|
||||
import { catchError } from 'rxjs/operators';
|
||||
@Component({
|
|
@ -4,7 +4,7 @@ import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
|||
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
||||
import { MatSnackBar } from '@angular/material/snack-bar';
|
||||
import { ToastrService } from 'ngx-toastr';
|
||||
import { DataService } from '../../data.service';
|
||||
import { DataService } from '../../../services/data.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-create-client',
|
|
@ -3,7 +3,7 @@ import { Component, Inject } from '@angular/core';
|
|||
import { FormGroup, FormBuilder, Validators } from '@angular/forms';
|
||||
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
||||
import { CreateClientComponent } from '../create-client/create-client.component';
|
||||
import { DataService } from '../../data.service';
|
||||
import { DataService } from '../../../services/data.service';
|
||||
import { ToastrService } from 'ngx-toastr';
|
||||
|
||||
@Component({
|
|
@ -3,7 +3,7 @@ import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
|||
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
||||
import { HttpClient, HttpHeaders } from '@angular/common/http';
|
||||
import { ToastrService } from 'ngx-toastr';
|
||||
import { DataService } from '../../data.service';
|
||||
import { DataService } from '../../../services/data.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-create-organizational-unit',
|
|
@ -3,7 +3,7 @@ import { Component, EventEmitter, Inject, OnInit, Output } from '@angular/core';
|
|||
import { FormGroup, FormBuilder, Validators } from '@angular/forms';
|
||||
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
|
||||
import { CreateOrganizationalUnitComponent } from '../create-organizational-unit/create-organizational-unit.component';
|
||||
import {DataService} from "../../data.service";
|
||||
import {DataService} from "../../../services/data.service";
|
||||
import {ToastrService} from "ngx-toastr";
|
||||
|
||||
@Component({
|
|
@ -53,7 +53,7 @@ export class LoginComponent {
|
|||
localStorage.setItem('refreshToken', res.refreshToken);
|
||||
localStorage.setItem('username', this.loginObj.username);
|
||||
this.openSnackBar(false, 'Bienvenido ' + this.loginObj.username);
|
||||
this.router.navigateByUrl('/dashboard');
|
||||
this.router.navigateByUrl('/groups');
|
||||
}
|
||||
this.isLoading = false;
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue