diff --git a/ogWebconsole/src/app/app.module.ts b/ogWebconsole/src/app/app.module.ts
index c1c0e66..18cf7f8 100644
--- a/ogWebconsole/src/app/app.module.ts
+++ b/ogWebconsole/src/app/app.module.ts
@@ -153,6 +153,7 @@ import { OutputDialogComponent } from './components/task-logs/output-dialog/outp
import { ClientTaskLogsComponent } from './components/task-logs/client-task-logs/client-task-logs.component';
import { BootSoPartitionComponent } from './components/commands/main-commands/execute-command/boot-so-partition/boot-so-partition.component';
import { RemoveCacheImageComponent } from './components/commands/main-commands/execute-command/remove-cache-image/remove-cache-image.component';
+import { ChangeParentComponent } from './components/groups/shared/change-parent/change-parent.component';
export function HttpLoaderFactory(http: HttpClient) {
return new TranslateHttpLoader(http, './locale/', '.json');
@@ -263,7 +264,8 @@ registerLocaleData(localeEs, 'es-ES');
OutputDialogComponent,
ClientTaskLogsComponent,
BootSoPartitionComponent,
- RemoveCacheImageComponent
+ RemoveCacheImageComponent,
+ ChangeParentComponent
],
bootstrap: [AppComponent],
imports: [BrowserModule,
diff --git a/ogWebconsole/src/app/components/commands/commands-groups/commands-groups.component.html b/ogWebconsole/src/app/components/commands/commands-groups/commands-groups.component.html
index 3092715..424b5a9 100644
--- a/ogWebconsole/src/app/components/commands/commands-groups/commands-groups.component.html
+++ b/ogWebconsole/src/app/components/commands/commands-groups/commands-groups.component.html
@@ -33,15 +33,6 @@
{{ column.cell(commandGroup) }}
-
-
-
-
-
-
-
diff --git a/ogWebconsole/src/app/components/groups/groups.component.html b/ogWebconsole/src/app/components/groups/groups.component.html
index 1d7f19f..9a8f148 100644
--- a/ogWebconsole/src/app/components/groups/groups.component.html
+++ b/ogWebconsole/src/app/components/groups/groups.component.html
@@ -224,11 +224,16 @@
{{ selectedNode?.name }}
+
+
@@ -469,4 +474,4 @@
-
\ No newline at end of file
+
diff --git a/ogWebconsole/src/app/components/groups/groups.component.ts b/ogWebconsole/src/app/components/groups/groups.component.ts
index c75f2fd..ef5ace4 100644
--- a/ogWebconsole/src/app/components/groups/groups.component.ts
+++ b/ogWebconsole/src/app/components/groups/groups.component.ts
@@ -29,6 +29,7 @@ import { MatMenuTrigger } from '@angular/material/menu';
import { ClientDetailsComponent } from './shared/client-details/client-details.component';
import { PartitionTypeOrganizatorComponent } from './shared/partition-type-organizator/partition-type-organizator.component';
import { ClientTaskLogsComponent } from '../task-logs/client-task-logs/client-task-logs.component';
+import {ChangeParentComponent} from "./shared/change-parent/change-parent.component";
enum NodeType {
OrganizationalUnit = 'organizational-unit',
@@ -864,6 +865,21 @@ export class GroupsComponent implements OnInit, OnDestroy {
});
}
+ changeParent(event: MouseEvent, ): void {
+ event.stopPropagation();
+
+ const dialogRef = this.dialog.open(ChangeParentComponent, {
+ data: { clients: this.selection.selected },
+ width: '700px',
+ });
+
+ dialogRef.afterClosed().subscribe((result) => {
+ if (result) {
+ this.refreshData();
+ }
+ });
+ }
+
openClientTaskLogs(event: MouseEvent, client: Client): void {
event.stopPropagation();
diff --git a/ogWebconsole/src/app/components/groups/shared/change-parent/change-parent.component.css b/ogWebconsole/src/app/components/groups/shared/change-parent/change-parent.component.css
new file mode 100644
index 0000000..6e0686f
--- /dev/null
+++ b/ogWebconsole/src/app/components/groups/shared/change-parent/change-parent.component.css
@@ -0,0 +1,39 @@
+.loading-container {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+ height: 100px;
+}
+
+mat-form-field {
+ width: 100%;
+}
+
+mat-dialog-actions {
+ display: flex;
+ justify-content: flex-end;
+}
+
+.checkbox-group {
+ display: flex;
+ flex-direction: column;
+ gap: 10px;
+}
+
+.selected-list ul {
+ list-style: none;
+ padding: 0;
+}
+
+.selected-item {
+ display: flex;
+ justify-content: space-between; /* Alinea texto a la izquierda y botón a la derecha */
+ align-items: center; /* Centra verticalmente */
+ padding: 8px;
+ border-bottom: 1px solid #ccc;
+}
+
+.selected-item button {
+ margin-left: 10px;
+}
diff --git a/ogWebconsole/src/app/components/groups/shared/change-parent/change-parent.component.html b/ogWebconsole/src/app/components/groups/shared/change-parent/change-parent.component.html
new file mode 100644
index 0000000..a8d0f48
--- /dev/null
+++ b/ogWebconsole/src/app/components/groups/shared/change-parent/change-parent.component.html
@@ -0,0 +1,15 @@
+Mover clientes a:
+
+
+
+ Seleccione aula
+
+ {{ unit.name }}
+
+
+
+
+
+
+
+
diff --git a/ogWebconsole/src/app/components/groups/shared/change-parent/change-parent.component.spec.ts b/ogWebconsole/src/app/components/groups/shared/change-parent/change-parent.component.spec.ts
new file mode 100644
index 0000000..70d5bb2
--- /dev/null
+++ b/ogWebconsole/src/app/components/groups/shared/change-parent/change-parent.component.spec.ts
@@ -0,0 +1,23 @@
+import { ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { ChangeParentComponent } from './change-parent.component';
+
+describe('ChangeParentComponent', () => {
+ let component: ChangeParentComponent;
+ let fixture: ComponentFixture;
+
+ beforeEach(async () => {
+ await TestBed.configureTestingModule({
+ declarations: [ChangeParentComponent]
+ })
+ .compileComponents();
+
+ fixture = TestBed.createComponent(ChangeParentComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/ogWebconsole/src/app/components/groups/shared/change-parent/change-parent.component.ts b/ogWebconsole/src/app/components/groups/shared/change-parent/change-parent.component.ts
new file mode 100644
index 0000000..95a3256
--- /dev/null
+++ b/ogWebconsole/src/app/components/groups/shared/change-parent/change-parent.component.ts
@@ -0,0 +1,63 @@
+import {Component, Inject, OnInit} from '@angular/core';
+import {HttpClient} from "@angular/common/http";
+import {MAT_DIALOG_DATA, MatDialogRef} from "@angular/material/dialog";
+import {ToastrService} from "ngx-toastr";
+import {Router} from "@angular/router";
+import {ConfigService} from "@services/config.service";
+
+@Component({
+ selector: 'app-change-parent',
+ templateUrl: './change-parent.component.html',
+ styleUrl: './change-parent.component.css'
+})
+export class ChangeParentComponent implements OnInit {
+ baseUrl: string;
+ loading: boolean = true;
+ units: any[] = [];
+ newOU: any;
+
+ constructor(
+ private http: HttpClient,
+ public dialogRef: MatDialogRef,
+ private toastService: ToastrService,
+ private router: Router,
+ private configService: ConfigService,
+ @Inject(MAT_DIALOG_DATA) public data: { clients: any}
+ ) {
+ this.baseUrl = this.configService.apiUrl;
+ }
+
+ ngOnInit(): void {
+ this.loading = true;
+ this.loadUnits();
+ }
+
+ loadUnits() {
+ this.http.get(`${this.baseUrl}/organizational-units?page=1&itemsPerPage=500`).subscribe(
+ response => {
+ this.units = response['hydra:member'];
+ this.loading = false;
+ },
+ error => console.error('Error fetching organizational units:', error)
+ );
+ }
+
+ save() {
+ this.http.post(`${this.baseUrl}/clients/change-organizational-unit`, {
+ clients: this.data.clients.map((client: any) => client['@id']),
+ organizationalUnit: this.newOU['@id']
+ }).subscribe({
+ next: (response) => {
+ this.toastService.success('Parent changed successfully');
+ this.dialogRef.close(true);
+ },
+ error: error => {
+ this.toastService.error(error.error['hydra:description']);
+ }
+ })
+ }
+
+ close() {
+ this.dialogRef.close();
+ }
+}
diff --git a/ogWebconsole/src/locale/en.json b/ogWebconsole/src/locale/en.json
index 4216e74..fcfacdf 100644
--- a/ogWebconsole/src/locale/en.json
+++ b/ogWebconsole/src/locale/en.json
@@ -517,6 +517,8 @@
"hardwareInventory": "Hardware Inventory",
"runScript": "Run Script"
},
+ "changeOU": "Change Organizational Unit",
+ "moveClientsTooltip": "Move clients to another organizational unit",
"remoteAccess": "Remote access available",
"noRemoteAccess": "Remote access not available",
"capacityWarning": "The capacity cannot be negative",
@@ -532,4 +534,4 @@
"filtersStepText": "Here you can see the different filters to apply to the table information.",
"tracesProgressStepText": "Here you can see the execution status updated in real time.",
"tracesInfoStepText": "Here you can consult detailed information about the specific trace."
-}
\ No newline at end of file
+}
diff --git a/ogWebconsole/src/locale/es.json b/ogWebconsole/src/locale/es.json
index 1c430a2..d130767 100644
--- a/ogWebconsole/src/locale/es.json
+++ b/ogWebconsole/src/locale/es.json
@@ -518,6 +518,8 @@
"hardwareInventory": "Inventario Hardware",
"runScript": "Ejecutar script"
},
+ "changeOU": "Mover clientes",
+ "moveClientsTooltip": "Mover clientes a otra unidad organizativa",
"remoteAccess": "Disponible acceso remoto",
"noRemoteAccess": "No disponible acceso remoto",
"capacityWarning": "El aforo no puede ser",