diff --git a/ogWebconsole/src/app/app-routing.module.ts b/ogWebconsole/src/app/app-routing.module.ts
index c2e2ca4..dbb8779 100644
--- a/ogWebconsole/src/app/app-routing.module.ts
+++ b/ogWebconsole/src/app/app-routing.module.ts
@@ -15,7 +15,9 @@ import { PxeBootFilesComponent } from './components/ogboot/pxe-boot-files/pxe-bo
import {OgbootStatusComponent} from "./components/ogboot/ogboot-status/ogboot-status.component";
import { OgdhcpComponent } from './components/ogdhcp/ogdhcp.component';
import { OgDhcpSubnetsComponent } from './components/ogdhcp/og-dhcp-subnets/og-dhcp-subnets.component';
-import { CommandsComponent } from './components/commands/commands.component';
+import { CommandsComponent } from './components/commands/main-commands/commands.component';
+import { CommandsGroupsComponent } from './components/commands/commands-groups/commands-groups.component';
+import { CommandsTaskComponent } from './components/commands/commands-task/commands-task.component';
const routes: Routes = [
{ path: '', redirectTo: 'auth/login', pathMatch: 'full' },
{
@@ -34,6 +36,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 },
],
},
{
diff --git a/ogWebconsole/src/app/app.module.ts b/ogWebconsole/src/app/app.module.ts
index f75b34a..6165226 100644
--- a/ogWebconsole/src/app/app.module.ts
+++ b/ogWebconsole/src/app/app.module.ts
@@ -83,11 +83,13 @@ import { OgdhcpComponent } from './components/ogdhcp/ogdhcp.component';
import { OgDhcpSubnetsComponent } from './components/ogdhcp/og-dhcp-subnets/og-dhcp-subnets.component';
import { CreateSubnetComponent } from './components/ogdhcp/og-dhcp-subnets/create-subnet/create-subnet.component';
import { AddClientsToSubnetComponent } from './components/ogdhcp/og-dhcp-subnets/add-clients-to-subnet/add-clients-to-subnet.component';
-import { CommandsComponent } from './components/commands/commands.component';
-import { CommandDetailComponent } from './components/commands/detail-command/command-detail.component';
-import { CreateCommandComponent } from './components/commands/create-command/create-command.component';
+import { CommandsComponent } from './components/commands/main-commands/commands.component';
+import { CommandDetailComponent } from './components/commands/main-commands/detail-command/command-detail.component';
+import { CreateCommandComponent } from './components/commands/main-commands/create-command/create-command.component';
import { MatDatepickerModule } from '@angular/material/datepicker';
import { MatNativeDateModule } from '@angular/material/core';
+import { CommandsGroupsComponent } from './components/commands/commands-groups/commands-groups.component';
+import { CommandsTaskComponent } from './components/commands/commands-task/commands-task.component';
@NgModule({
declarations: [
AppComponent,
@@ -132,7 +134,9 @@ import { MatNativeDateModule } from '@angular/material/core';
AddClientsToSubnetComponent,
CommandsComponent,
CommandDetailComponent,
- CreateCommandComponent
+ CreateCommandComponent,
+ CommandsGroupsComponent,
+ CommandsTaskComponent
],
bootstrap: [AppComponent],
imports: [BrowserModule,
diff --git a/ogWebconsole/src/app/components/commands/commands-groups/commands-groups.component.css b/ogWebconsole/src/app/components/commands/commands-groups/commands-groups.component.css
new file mode 100644
index 0000000..e69de29
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
new file mode 100644
index 0000000..aba3a48
--- /dev/null
+++ b/ogWebconsole/src/app/components/commands/commands-groups/commands-groups.component.html
@@ -0,0 +1 @@
+
commands-groups works!
diff --git a/ogWebconsole/src/app/components/commands/commands-groups/commands-groups.component.spec.ts b/ogWebconsole/src/app/components/commands/commands-groups/commands-groups.component.spec.ts
new file mode 100644
index 0000000..f9a69a0
--- /dev/null
+++ b/ogWebconsole/src/app/components/commands/commands-groups/commands-groups.component.spec.ts
@@ -0,0 +1,23 @@
+import { ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { CommandsGroupsComponent } from './commands-groups.component';
+
+describe('CommandsGroupsComponent', () => {
+ let component: CommandsGroupsComponent;
+ let fixture: ComponentFixture;
+
+ beforeEach(async () => {
+ await TestBed.configureTestingModule({
+ declarations: [CommandsGroupsComponent]
+ })
+ .compileComponents();
+
+ fixture = TestBed.createComponent(CommandsGroupsComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/ogWebconsole/src/app/components/commands/commands-groups/commands-groups.component.ts b/ogWebconsole/src/app/components/commands/commands-groups/commands-groups.component.ts
new file mode 100644
index 0000000..8729d11
--- /dev/null
+++ b/ogWebconsole/src/app/components/commands/commands-groups/commands-groups.component.ts
@@ -0,0 +1,10 @@
+import { Component } from '@angular/core';
+
+@Component({
+ selector: 'app-commands-groups',
+ templateUrl: './commands-groups.component.html',
+ styleUrl: './commands-groups.component.css'
+})
+export class CommandsGroupsComponent {
+
+}
diff --git a/ogWebconsole/src/app/components/commands/commands-task/commands-task.component.css b/ogWebconsole/src/app/components/commands/commands-task/commands-task.component.css
new file mode 100644
index 0000000..e69de29
diff --git a/ogWebconsole/src/app/components/commands/commands-task/commands-task.component.html b/ogWebconsole/src/app/components/commands/commands-task/commands-task.component.html
new file mode 100644
index 0000000..385462e
--- /dev/null
+++ b/ogWebconsole/src/app/components/commands/commands-task/commands-task.component.html
@@ -0,0 +1 @@
+commands-task works!
diff --git a/ogWebconsole/src/app/components/commands/commands-task/commands-task.component.spec.ts b/ogWebconsole/src/app/components/commands/commands-task/commands-task.component.spec.ts
new file mode 100644
index 0000000..d176107
--- /dev/null
+++ b/ogWebconsole/src/app/components/commands/commands-task/commands-task.component.spec.ts
@@ -0,0 +1,23 @@
+import { ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { CommandsTaskComponent } from './commands-task.component';
+
+describe('CommandsTaskComponent', () => {
+ let component: CommandsTaskComponent;
+ let fixture: ComponentFixture;
+
+ beforeEach(async () => {
+ await TestBed.configureTestingModule({
+ declarations: [CommandsTaskComponent]
+ })
+ .compileComponents();
+
+ fixture = TestBed.createComponent(CommandsTaskComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/ogWebconsole/src/app/components/commands/commands-task/commands-task.component.ts b/ogWebconsole/src/app/components/commands/commands-task/commands-task.component.ts
new file mode 100644
index 0000000..15cf5ff
--- /dev/null
+++ b/ogWebconsole/src/app/components/commands/commands-task/commands-task.component.ts
@@ -0,0 +1,10 @@
+import { Component } from '@angular/core';
+
+@Component({
+ selector: 'app-commands-task',
+ templateUrl: './commands-task.component.html',
+ styleUrl: './commands-task.component.css'
+})
+export class CommandsTaskComponent {
+
+}
diff --git a/ogWebconsole/src/app/components/commands/commands.component.css b/ogWebconsole/src/app/components/commands/main-commands/commands.component.css
similarity index 100%
rename from ogWebconsole/src/app/components/commands/commands.component.css
rename to ogWebconsole/src/app/components/commands/main-commands/commands.component.css
diff --git a/ogWebconsole/src/app/components/commands/commands.component.html b/ogWebconsole/src/app/components/commands/main-commands/commands.component.html
similarity index 100%
rename from ogWebconsole/src/app/components/commands/commands.component.html
rename to ogWebconsole/src/app/components/commands/main-commands/commands.component.html
diff --git a/ogWebconsole/src/app/components/commands/commands.component.spec.ts b/ogWebconsole/src/app/components/commands/main-commands/commands.component.spec.ts
similarity index 100%
rename from ogWebconsole/src/app/components/commands/commands.component.spec.ts
rename to ogWebconsole/src/app/components/commands/main-commands/commands.component.spec.ts
diff --git a/ogWebconsole/src/app/components/commands/commands.component.ts b/ogWebconsole/src/app/components/commands/main-commands/commands.component.ts
similarity index 96%
rename from ogWebconsole/src/app/components/commands/commands.component.ts
rename to ogWebconsole/src/app/components/commands/main-commands/commands.component.ts
index b2422d6..81460c5 100644
--- a/ogWebconsole/src/app/components/commands/commands.component.ts
+++ b/ogWebconsole/src/app/components/commands/main-commands/commands.component.ts
@@ -3,7 +3,7 @@ import { HttpClient } from '@angular/common/http';
import { MatDialog } from '@angular/material/dialog';
import { CommandDetailComponent } from './detail-command/command-detail.component';
import { CreateCommandComponent } from './create-command/create-command.component';
-import { DeleteModalComponent } from '../../shared/delete_modal/delete-modal/delete-modal.component';
+import { DeleteModalComponent } from '../../../shared/delete_modal/delete-modal/delete-modal.component';
import { ToastrService } from 'ngx-toastr';
@Component({
diff --git a/ogWebconsole/src/app/components/commands/create-command/create-command.component.css b/ogWebconsole/src/app/components/commands/main-commands/create-command/create-command.component.css
similarity index 100%
rename from ogWebconsole/src/app/components/commands/create-command/create-command.component.css
rename to ogWebconsole/src/app/components/commands/main-commands/create-command/create-command.component.css
diff --git a/ogWebconsole/src/app/components/commands/create-command/create-command.component.html b/ogWebconsole/src/app/components/commands/main-commands/create-command/create-command.component.html
similarity index 100%
rename from ogWebconsole/src/app/components/commands/create-command/create-command.component.html
rename to ogWebconsole/src/app/components/commands/main-commands/create-command/create-command.component.html
diff --git a/ogWebconsole/src/app/components/commands/create-command/create-command.component.spec.ts b/ogWebconsole/src/app/components/commands/main-commands/create-command/create-command.component.spec.ts
similarity index 100%
rename from ogWebconsole/src/app/components/commands/create-command/create-command.component.spec.ts
rename to ogWebconsole/src/app/components/commands/main-commands/create-command/create-command.component.spec.ts
diff --git a/ogWebconsole/src/app/components/commands/create-command/create-command.component.ts b/ogWebconsole/src/app/components/commands/main-commands/create-command/create-command.component.ts
similarity index 100%
rename from ogWebconsole/src/app/components/commands/create-command/create-command.component.ts
rename to ogWebconsole/src/app/components/commands/main-commands/create-command/create-command.component.ts
diff --git a/ogWebconsole/src/app/components/commands/detail-command/command-detail.component.css b/ogWebconsole/src/app/components/commands/main-commands/detail-command/command-detail.component.css
similarity index 100%
rename from ogWebconsole/src/app/components/commands/detail-command/command-detail.component.css
rename to ogWebconsole/src/app/components/commands/main-commands/detail-command/command-detail.component.css
diff --git a/ogWebconsole/src/app/components/commands/detail-command/command-detail.component.html b/ogWebconsole/src/app/components/commands/main-commands/detail-command/command-detail.component.html
similarity index 100%
rename from ogWebconsole/src/app/components/commands/detail-command/command-detail.component.html
rename to ogWebconsole/src/app/components/commands/main-commands/detail-command/command-detail.component.html
diff --git a/ogWebconsole/src/app/components/commands/detail-command/command-detail.component.spec.ts b/ogWebconsole/src/app/components/commands/main-commands/detail-command/command-detail.component.spec.ts
similarity index 100%
rename from ogWebconsole/src/app/components/commands/detail-command/command-detail.component.spec.ts
rename to ogWebconsole/src/app/components/commands/main-commands/detail-command/command-detail.component.spec.ts
diff --git a/ogWebconsole/src/app/components/commands/detail-command/command-detail.component.ts b/ogWebconsole/src/app/components/commands/main-commands/detail-command/command-detail.component.ts
similarity index 78%
rename from ogWebconsole/src/app/components/commands/detail-command/command-detail.component.ts
rename to ogWebconsole/src/app/components/commands/main-commands/detail-command/command-detail.component.ts
index c1a3710..d2cc7d9 100644
--- a/ogWebconsole/src/app/components/commands/detail-command/command-detail.component.ts
+++ b/ogWebconsole/src/app/components/commands/main-commands/detail-command/command-detail.component.ts
@@ -3,6 +3,7 @@ import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { MAT_DIALOG_DATA, MatDialog, MatDialogRef } from '@angular/material/dialog';
import { CreateCommandComponent } from '../create-command/create-command.component';
import { HttpClient } from '@angular/common/http';
+import { ToastrService } from 'ngx-toastr';
@Component({
selector: 'app-command-detail',
@@ -10,6 +11,7 @@ import { HttpClient } from '@angular/common/http';
styleUrls: ['./command-detail.component.css']
})
export class CommandDetailComponent implements OnInit {
+ baseUrl: string = import.meta.env.NG_APP_BASE_API_URL;
form!: FormGroup;
clients: any[] = [];
showClientSelect = false;
@@ -21,8 +23,9 @@ export class CommandDetailComponent implements OnInit {
private http: HttpClient,
public dialogRef: MatDialogRef,
private dialog: MatDialog,
+ private toastService: ToastrService,
@Inject(MAT_DIALOG_DATA) public data: any
- ) {}
+ ) { }
ngOnInit(): void {
this.form = this.fb.group({
@@ -42,8 +45,24 @@ export class CommandDetailComponent implements OnInit {
this.showClientSelect = true;
} else {
if (this.form.get('selectedClients')?.value.length > 0) {
- console.log('Ejecutar comando con los siguientes clientes:', this.form.value.selectedClients);
- console.log('Comando ejecutado', this.data.command);
+
+ const payload = {
+ clients: this.form.value.selectedClients.map((uuid: any) => `/clients/${uuid}`)
+ };
+
+ const apiUrl = `${this.baseUrl}/commands/${this.data.command.uuid}/execute`;
+
+ this.http.post(apiUrl, payload).subscribe({
+ next: () => {
+ console.log('Command executed successfully');
+ this.dialogRef.close();
+ this.toastService.success('Command executed successfully');
+ },
+ error: (error) => {
+ console.error('Error executing command:', error);
+ }
+ });
+
this.dialogRef.close();
} else {
this.form.get('selectedClients')?.markAsTouched();
diff --git a/ogWebconsole/src/app/components/groups/acctions-modal/acctions-modal.component.ts b/ogWebconsole/src/app/components/groups/acctions-modal/acctions-modal.component.ts
index c0d4d2b..8474ff9 100644
--- a/ogWebconsole/src/app/components/groups/acctions-modal/acctions-modal.component.ts
+++ b/ogWebconsole/src/app/components/groups/acctions-modal/acctions-modal.component.ts
@@ -4,7 +4,7 @@ import { MatDialogRef, MAT_DIALOG_DATA, MatDialog } from '@angular/material/dial
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/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',
diff --git a/ogWebconsole/src/app/layout/main-layout/main-layout.component.css b/ogWebconsole/src/app/layout/main-layout/main-layout.component.css
index 60e093c..79922ec 100644
--- a/ogWebconsole/src/app/layout/main-layout/main-layout.component.css
+++ b/ogWebconsole/src/app/layout/main-layout/main-layout.component.css
@@ -3,12 +3,16 @@
}
.container {
- width: auto;
- height: calc(100vh - 60px);
+ width: 100vw;
+ height: calc(100vh - 10vh);
+}
+
+.sidebar {
+ width: 250px;
}
.content {
margin: 10px;
padding: 10px;
-}
-
+ box-sizing: border-box;
+}
\ No newline at end of file
diff --git a/ogWebconsole/src/app/layout/main-layout/main-layout.component.html b/ogWebconsole/src/app/layout/main-layout/main-layout.component.html
index d9d7a08..7a97670 100644
--- a/ogWebconsole/src/app/layout/main-layout/main-layout.component.html
+++ b/ogWebconsole/src/app/layout/main-layout/main-layout.component.html
@@ -1,11 +1,11 @@
-
+
-
+
diff --git a/ogWebconsole/src/app/layout/sidebar/sidebar.component.css b/ogWebconsole/src/app/layout/sidebar/sidebar.component.css
index 23b5659..8267199 100644
--- a/ogWebconsole/src/app/layout/sidebar/sidebar.component.css
+++ b/ogWebconsole/src/app/layout/sidebar/sidebar.component.css
@@ -1,5 +1,7 @@
mat-nav-list {
- width: 250px;
+ width: auto;
+ margin-right: 3px;
+ overflow-x: hidden;
}
mat-list-item {
@@ -8,22 +10,22 @@ mat-list-item {
align-items: center;
}
-.entry{
+.entry {
display: flex;
align-items: center;
gap: 1rem;
- padding:0.75rem;
+ padding: 0.75rem;
}
mat-icon {
margin-right: 8px;
}
-.user-logged{
+.user-logged {
align-items: center;
height: 70px;
gap: 2rem;
- padding:1rem;
+ padding: 1rem;
font-size: medium;
}
@@ -39,7 +41,7 @@ mat-icon {
@media (max-width: 680px) {
mat-nav-list {
- width: 0px;
+ width: auto;
}
}
diff --git a/ogWebconsole/src/app/layout/sidebar/sidebar.component.html b/ogWebconsole/src/app/layout/sidebar/sidebar.component.html
index 8b5eebc..ee7546b 100644
--- a/ogWebconsole/src/app/layout/sidebar/sidebar.component.html
+++ b/ogWebconsole/src/app/layout/sidebar/sidebar.component.html
@@ -15,12 +15,36 @@
-
- chevron_right
- Comandos
+
+ playlist_play
+ Acciones
+
+
+
+
+ chevron_right
+ Comandos
+
+
+
+
+ splitscreen_add
+ Grupo de comandos
+
+
+
+
+ task
+ Tareas
+
+
+
+
+
+
desktop_windows
diff --git a/ogWebconsole/src/app/layout/sidebar/sidebar.component.ts b/ogWebconsole/src/app/layout/sidebar/sidebar.component.ts
index 51dc05a..963703f 100644
--- a/ogWebconsole/src/app/layout/sidebar/sidebar.component.ts
+++ b/ogWebconsole/src/app/layout/sidebar/sidebar.component.ts
@@ -13,6 +13,7 @@ export class SidebarComponent {
decodedToken: any = "";
showOgBootSub: boolean = false;
showOgDhcpSub: boolean = false;
+ showCommandSub: boolean = false;
toggleOgBootSub() {
this.showOgBootSub = !this.showOgBootSub;
@@ -20,6 +21,9 @@ export class SidebarComponent {
toggleOgDhcpSub() {
this.showOgDhcpSub = !this.showOgDhcpSub;
}
+ toggleCommandSub() {
+ this.showCommandSub = !this.showCommandSub;
+ }
constructor(public dialog: MatDialog) {}