diff --git a/ogWebconsole/.env b/ogWebconsole/.env index 5bd451a..0da820a 100644 --- a/ogWebconsole/.env +++ b/ogWebconsole/.env @@ -1 +1,2 @@ -NG_APP_BASE_API_URL=http://127.0.0.1:8090 +#NG_APP_BASE_API_URL=http://127.0.0.1:8090 +NG_APP_BASE_API_URL=http://127.0.0.1:8001 \ No newline at end of file diff --git a/ogWebconsole/src/app/app-routing.module.ts b/ogWebconsole/src/app/app-routing.module.ts index 432180e..c2e2ca4 100644 --- a/ogWebconsole/src/app/app-routing.module.ts +++ b/ogWebconsole/src/app/app-routing.module.ts @@ -15,6 +15,7 @@ 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'; const routes: Routes = [ { path: '', redirectTo: 'auth/login', pathMatch: 'full' }, { @@ -31,7 +32,8 @@ const routes: Routes = [ { path: 'pxe-boot-file', component: PxeBootFilesComponent }, { path: 'ogboot-status', component: OgbootStatusComponent }, { path: 'dhcp', component: OgdhcpComponent }, - { path: 'dhcp-subnets', component: OgDhcpSubnetsComponent } + { path: 'dhcp-subnets', component: OgDhcpSubnetsComponent }, + { path: 'commands', component: CommandsComponent }, ], }, { diff --git a/ogWebconsole/src/app/app.module.ts b/ogWebconsole/src/app/app.module.ts index 6133f67..1e5d17d 100644 --- a/ogWebconsole/src/app/app.module.ts +++ b/ogWebconsole/src/app/app.module.ts @@ -83,6 +83,7 @@ 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'; @NgModule({ declarations: [ AppComponent, @@ -124,7 +125,8 @@ import { AddClientsToSubnetComponent } from './components/ogdhcp/og-dhcp-subnets OgdhcpComponent, OgDhcpSubnetsComponent, CreateSubnetComponent, - AddClientsToSubnetComponent + AddClientsToSubnetComponent, + CommandsComponent ], bootstrap: [AppComponent], imports: [BrowserModule, diff --git a/ogWebconsole/src/app/components/commands/commands.component.css b/ogWebconsole/src/app/components/commands/commands.component.css new file mode 100644 index 0000000..1b0af12 --- /dev/null +++ b/ogWebconsole/src/app/components/commands/commands.component.css @@ -0,0 +1,36 @@ +.commands-list { + margin-bottom: 20px; +} + +.command-item { + cursor: pointer; + margin-bottom: 10px; + padding: 10px; + border: 1px solid #ccc; + border-radius: 4px; + background-color: #f9f9f9; +} + +.command-item:hover { + background-color: #e9e9e9; +} + +.command-details { + padding: 20px; + border: 1px solid #ddd; + background-color: #f4f4f4; + border-radius: 4px; +} + +.script-display { + margin-top: 20px; + background-color: #000; + color: #fff; + padding: 10px; + border-radius: 4px; +} + +pre { + margin: 0; + font-family: 'Courier New', Courier, monospace; +} diff --git a/ogWebconsole/src/app/components/commands/commands.component.html b/ogWebconsole/src/app/components/commands/commands.component.html new file mode 100644 index 0000000..52ddfd2 --- /dev/null +++ b/ogWebconsole/src/app/components/commands/commands.component.html @@ -0,0 +1,22 @@ +
+

Lista de Comandos

+ +
+ +
+

Detalles del Comando

+

Nombre: {{ selectedCommand.name }}

+

Comentarios: {{ selectedCommand.comments }}

+

Creado por: {{ selectedCommand.createdBy }}

+

Fecha de Creación: {{ selectedCommand.createdAt | date:'medium' }}

+ +
+

Script:

+
{{ selectedCommand.script }}
+
+
+ \ No newline at end of file diff --git a/ogWebconsole/src/app/components/commands/commands.component.spec.ts b/ogWebconsole/src/app/components/commands/commands.component.spec.ts new file mode 100644 index 0000000..1a54ea7 --- /dev/null +++ b/ogWebconsole/src/app/components/commands/commands.component.spec.ts @@ -0,0 +1,23 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { CommandsComponent } from './commands.component'; + +describe('CommandsComponent', () => { + let component: CommandsComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [CommandsComponent] + }) + .compileComponents(); + + fixture = TestBed.createComponent(CommandsComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/ogWebconsole/src/app/components/commands/commands.component.ts b/ogWebconsole/src/app/components/commands/commands.component.ts new file mode 100644 index 0000000..bb3c8c2 --- /dev/null +++ b/ogWebconsole/src/app/components/commands/commands.component.ts @@ -0,0 +1,37 @@ +import { Component, OnInit } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; // Importar HttpClient + +@Component({ + selector: 'app-commands', + templateUrl: './commands.component.html', + styleUrls: ['./commands.component.css'] +}) +export class CommandsComponent implements OnInit { + + commands: any[] = []; + selectedCommand: any = null; + + // URL de la API + private apiUrl = 'http://127.0.0.1:8001/commands?page=1&itemsPerPage=30'; + + constructor(private http: HttpClient) { } + + ngOnInit(): void { + this.loadCommands(); // Llamada a la API cuando el componente se inicializa + } + + loadCommands(): void { + this.http.get(this.apiUrl).subscribe( + (data) => { + this.commands = data['hydra:member']; // Almacena los comandos en la variable + }, + (error) => { + console.error('Error fetching commands', error); + } + ); + } + + selectCommand(command: any): void { + this.selectedCommand = command; // Almacena el comando seleccionado + } +} diff --git a/ogWebconsole/src/app/layout/sidebar/sidebar.component.html b/ogWebconsole/src/app/layout/sidebar/sidebar.component.html index c644912..8b5eebc 100644 --- a/ogWebconsole/src/app/layout/sidebar/sidebar.component.html +++ b/ogWebconsole/src/app/layout/sidebar/sidebar.component.html @@ -15,9 +15,9 @@ - + chevron_right - Acciones + Comandos