From 90d21c0779c40755da196afada0fcaaf8b2f7ec8 Mon Sep 17 00:00:00 2001 From: apuente Date: Wed, 9 Oct 2024 11:12:10 +0200 Subject: [PATCH 1/5] refs #909 Create dockerfile --- ogWebconsole/dockerfile | 14 ++ .../advanced-search.component.html | 2 +- .../advanced-search.component.ts | 11 -- .../app/components/groups/groups.component.ts | 1 - .../app/layout/sidebar/sidebar.component.html | 120 ------------------ 5 files changed, 15 insertions(+), 133 deletions(-) create mode 100644 ogWebconsole/dockerfile diff --git a/ogWebconsole/dockerfile b/ogWebconsole/dockerfile new file mode 100644 index 0000000..47594cb --- /dev/null +++ b/ogWebconsole/dockerfile @@ -0,0 +1,14 @@ +FROM node:22.1.0 + +WORKDIR /app + +RUN npm install -g npm@latest + +RUN npm install -g @angular/cli@^12.0.0 + +COPY . /app +RUN npm install + +EXPOSE 4200 + +CMD ["ng", "serve", "--host", "0.0.0.0", "--disable-host-check"] \ No newline at end of file diff --git a/ogWebconsole/src/app/components/groups/components/advanced-search/advanced-search.component.html b/ogWebconsole/src/app/components/groups/components/advanced-search/advanced-search.component.html index b192713..944582c 100644 --- a/ogWebconsole/src/app/components/groups/components/advanced-search/advanced-search.component.html +++ b/ogWebconsole/src/app/components/groups/components/advanced-search/advanced-search.component.html @@ -99,7 +99,7 @@ - + diff --git a/ogWebconsole/src/app/components/groups/components/advanced-search/advanced-search.component.ts b/ogWebconsole/src/app/components/groups/components/advanced-search/advanced-search.component.ts index 1a5a00a..5d80354 100644 --- a/ogWebconsole/src/app/components/groups/components/advanced-search/advanced-search.component.ts +++ b/ogWebconsole/src/app/components/groups/components/advanced-search/advanced-search.component.ts @@ -414,15 +414,4 @@ export class AdvancedSearchComponent { - onDobleClick(event: MouseEvent, data: any, type: string): void { - console.log('Doble click en:', data); - - if (type === 'client') { - this.router.navigate(['client', data]); - } - else { - console.error('ADD VIEW FOR OU'); - } - } - } diff --git a/ogWebconsole/src/app/components/groups/groups.component.ts b/ogWebconsole/src/app/components/groups/groups.component.ts index 133e09b..1e65b69 100644 --- a/ogWebconsole/src/app/components/groups/groups.component.ts +++ b/ogWebconsole/src/app/components/groups/groups.component.ts @@ -259,7 +259,6 @@ export class GroupsComponent implements OnInit { if (type != "client") { const dialogRef = this.dialog.open(EditOrganizationalUnitComponent, { data: { uuid }, width: '700px'}); } else { - console.log('Editar cliente'); const dialogRef = this.dialog.open(EditClientComponent, { data: { uuid }, width: '700px' } ); } } diff --git a/ogWebconsole/src/app/layout/sidebar/sidebar.component.html b/ogWebconsole/src/app/layout/sidebar/sidebar.component.html index ace6206..3a33a6d 100644 --- a/ogWebconsole/src/app/layout/sidebar/sidebar.component.html +++ b/ogWebconsole/src/app/layout/sidebar/sidebar.component.html @@ -14,98 +14,6 @@ - - - playlist_play - Acciones - - - - - - - - chevron_right - Comandos - - - - - chevron_right - Grupos - - - - - chevron_right - Tareas - - - - - notifications - Trazas - - - - - - - - - settings_ethernet - DHCP - - - - - - - - lan - Subnets - - - - - - - - - desktop_windows - Boot - - - - - - - - analytics - Estado - - - - - album - ogLive - - - - - assignment - Plantillas PXE - - - - - save - Arranque PXE - - - - - calendar_month @@ -113,33 +21,5 @@ - - - settings_input_component - Componentes - - - - - - warehouse - Repositorios - - - - - - list - Menús - - - - - - search - Buscar - - - From 3d7842de92a99138ef9befe635bf00315ca6a43b Mon Sep 17 00:00:00 2001 From: apuente Date: Wed, 9 Oct 2024 11:28:49 +0200 Subject: [PATCH 2/5] refs #909 New env base url --- ogWebconsole/.env | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ogWebconsole/.env b/ogWebconsole/.env index 454cc0f..ca61761 100644 --- a/ogWebconsole/.env +++ b/ogWebconsole/.env @@ -1,2 +1,8 @@ #NG_APP_BASE_API_URL=http://127.0.0.1:8090 -NG_APP_BASE_API_URL=http://127.0.0.1:8080 +NG_APP_BASE_API_URL=https://127.0.0.1:8443 + + + + + + From 6e559af6866e34c710f7e75f528f3dcdb20b4834 Mon Sep 17 00:00:00 2001 From: apuente Date: Wed, 9 Oct 2024 16:47:23 +0200 Subject: [PATCH 3/5] refs #909 New ssl certs --- ogWebconsole/.env | 9 +----- ogWebconsole/angular.json | 6 ++++ .../create-organizational-unit.component.ts | 2 ++ .../edit-organizational-unit.component.ts | 25 ++++++----------- ogWebconsole/ssl/oggui.uds-test.net.crt.pem | 28 +++++++++++++++++++ ogWebconsole/ssl/oggui.uds-test.net.key.pem | 28 +++++++++++++++++++ 6 files changed, 73 insertions(+), 25 deletions(-) create mode 100644 ogWebconsole/ssl/oggui.uds-test.net.crt.pem create mode 100644 ogWebconsole/ssl/oggui.uds-test.net.key.pem diff --git a/ogWebconsole/.env b/ogWebconsole/.env index ca61761..100978f 100644 --- a/ogWebconsole/.env +++ b/ogWebconsole/.env @@ -1,8 +1 @@ -#NG_APP_BASE_API_URL=http://127.0.0.1:8090 -NG_APP_BASE_API_URL=https://127.0.0.1:8443 - - - - - - +NG_APP_BASE_API_URL=https://127.0.0.1:8443 \ No newline at end of file diff --git a/ogWebconsole/angular.json b/ogWebconsole/angular.json index a5fa49e..a32ccff 100644 --- a/ogWebconsole/angular.json +++ b/ogWebconsole/angular.json @@ -86,6 +86,12 @@ }, "serve": { "builder": "@ngx-env/builder:dev-server", + "options": { + "port": 4200, + "ssl": true, + "sslKey": "./ssl/oggui.uds-test.net.key.pem", + "sslCert": "./ssl/oggui.uds-test.net.crt.pem" + }, "configurations": { "production": { "buildTarget": "ogWebconsole:build:production" diff --git a/ogWebconsole/src/app/components/groups/shared/organizational-units/create-organizational-unit/create-organizational-unit.component.ts b/ogWebconsole/src/app/components/groups/shared/organizational-units/create-organizational-unit/create-organizational-unit.component.ts index 86fa72f..a0b7089 100644 --- a/ogWebconsole/src/app/components/groups/shared/organizational-units/create-organizational-unit/create-organizational-unit.component.ts +++ b/ogWebconsole/src/app/components/groups/shared/organizational-units/create-organizational-unit/create-organizational-unit.component.ts @@ -138,10 +138,12 @@ export class CreateOrganizationalUnitComponent implements OnInit { response => { this.unitAdded.emit(); this.dialogRef.close(); + this.toastService.success('Cliente creado exitosamente', 'Éxito'); this.openSnackBar(false, 'Cliente creado exitosamente'); }, error => { console.error('Error al realizar POST:', error); + this.toastService.error('Ha ocurrido un error'); this.openSnackBar(true, 'Error al crear la unidad organizativa: ' + error.error['hydra:description']); } ); diff --git a/ogWebconsole/src/app/components/groups/shared/organizational-units/edit-organizational-unit/edit-organizational-unit.component.ts b/ogWebconsole/src/app/components/groups/shared/organizational-units/edit-organizational-unit/edit-organizational-unit.component.ts index f5419fe..cb9f3f7 100644 --- a/ogWebconsole/src/app/components/groups/shared/organizational-units/edit-organizational-unit/edit-organizational-unit.component.ts +++ b/ogWebconsole/src/app/components/groups/shared/organizational-units/edit-organizational-unit/edit-organizational-unit.component.ts @@ -122,7 +122,7 @@ export class EditOrganizationalUnitComponent implements OnInit { response => this.calendars = response['hydra:member'], error => { console.error('Error loading calendars', error); - this.openSnackBar(true, 'Error loading calendars'); + this.toastService.error('Error loading current calendar'); } ); } @@ -133,7 +133,7 @@ export class EditOrganizationalUnitComponent implements OnInit { response => this.currentCalendar = response, error => { console.error('Error loading current calendar', error); - this.openSnackBar(true, 'Error loading current calendar'); + this.toastService.error('Error loading current calendar'); } );} @@ -148,7 +148,6 @@ export class EditOrganizationalUnitComponent implements OnInit { this.http.get(url).subscribe( data => { - console.log('Data fetched for edit:', data); this.generalFormGroup.patchValue({ name: data.name, parent: data.parent ? data.parent['@id'] : '', @@ -185,7 +184,7 @@ export class EditOrganizationalUnitComponent implements OnInit { error => { console.error('Error fetching data for edit:', error); - this.openSnackBar(true, 'Error al cargar la unidad organizativa: ' + error.error['hydra:description']) + this.toastService.error('Error fetching data'); this.onNoClick() } ); @@ -195,8 +194,6 @@ export class EditOrganizationalUnitComponent implements OnInit { onSubmit() { if (this.generalFormGroup.valid && this.additionalInfoFormGroup.valid && this.networkSettingsFormGroup.valid) { const parentValue = this.generalFormGroup.value.parent; - - console.log(this.generalFormGroup.value.remoetCalendar); const formData = { name: this.generalFormGroup.value.name, parent: parentValue || null, @@ -209,7 +206,6 @@ export class EditOrganizationalUnitComponent implements OnInit { if (this.isEditMode) { - // Edit mode: Send PUT request to update the unit const putUrl = `${this.baseUrl}/organizational-units/${this.data.uuid}`; const headers = new HttpHeaders({ 'Content-Type': 'application/json' }); @@ -218,26 +214,26 @@ export class EditOrganizationalUnitComponent implements OnInit { console.log('PUT successful:', response); this.unitAdded.emit(); this.dialogRef.close(); + this.toastService.success('Editado exitosamente', 'Éxito'); }, error => { console.error('Error al realizar PUT:', error); + this.toastService.error('Error al editar:', error); } ); } else { - // Create mode: Send POST request to create a new unit const postUrl = `${this.baseUrl}/organizational-units`; const headers = new HttpHeaders({ 'Content-Type': 'application/json' }); this.http.post(postUrl, formData, { headers }).subscribe( response => { - console.log('POST successful:', response); this.unitAdded.emit(); this.dialogRef.close(); - this.openSnackBar(false, 'Cliente creado exitosamente'); + this.toastService.success('Editado exitosamente', 'Éxito'); }, error => { console.error('Error al realizar POST:', error); - this.openSnackBar(true, 'Error al crear la unidad organizativa: ' + error.error['hydra:description']); + this.toastService.error('Error al editar:', error); } ); } @@ -248,10 +244,5 @@ export class EditOrganizationalUnitComponent implements OnInit { this.dialogRef.close(); } - openSnackBar(isError: boolean, message: string) { - if (isError) { - this.toastService.error(' Error al crear el cliente: ' + message, 'Error'); - } else - this.toastService.success('Cliente creado exitosamente', 'Éxito'); - } + } diff --git a/ogWebconsole/ssl/oggui.uds-test.net.crt.pem b/ogWebconsole/ssl/oggui.uds-test.net.crt.pem new file mode 100644 index 0000000..9945136 --- /dev/null +++ b/ogWebconsole/ssl/oggui.uds-test.net.crt.pem @@ -0,0 +1,28 @@ +-----BEGIN CERTIFICATE----- +MIIEwzCCAqugAwIBAgICEAAwDQYJKoZIhvcNAQELBQAwSTELMAkGA1UEBhMCRVMx +DzANBgNVBAgMBk1hZHJpZDEPMA0GA1UEBwwGTWFkcmlkMRgwFgYDVQQDDA9jYS51 +ZHMtdGVzdC5uZXQwHhcN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EgDUWaSJCwfs8Lp0yk +5GTckf4Ch6h89DMwt4PhD6zY8Rd72FQgNCVjg3F3A5yFE8iZd4KY/h1KBVMqwaeE +VjkpH4XzzNwUz0M/13278XLaVoDyOoFuzN8E/lPnfsdUUQjXUy1OlKpI5JerkGnE ++LlZbkZwJHwxS4e3sGKPjpMmBh5FOciYUBiCManlYtWwRbhTgKJt28wULBnh2eCw +8tdoo8L+5q9q3ke6bLbmfVPtFefKL+3fO7qWyubCTkT79HGetpShGmmansTH7P0G +7viwO1ispK2POTKt+DqEw+iuFEEWuw4SiVXxrY9uUs4VIExhsImNGOQoyxnYCz1t +kUs+jJ4PAPtuHqjjYdrcf057axQipkO2K2iGjdlG8mp7U3cOZwdpMkmfdhpfiyAW +w/L8jq15EtBxR6cINLdTTX/ySpjfV1g= +-----END CERTIFICATE----- diff --git a/ogWebconsole/ssl/oggui.uds-test.net.key.pem b/ogWebconsole/ssl/oggui.uds-test.net.key.pem new file mode 100644 index 0000000..b15401a --- /dev/null +++ b/ogWebconsole/ssl/oggui.uds-test.net.key.pem @@ -0,0 +1,28 @@ +-----BEGIN PRIVATE KEY----- +MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCpTPUluEIIXSEd +SVvVp/B6GoDdb8iexioUF0T0F3C+fMy5WmfsPGwwDZzq/XLcFT937aX3glAb7rqA +C9zy7bUfV9UKyZNjeZMxGcs9nJH/Vy6W4eXiPhKGo+ZNTS3rfW6yowTTft9swQ6k +Dx4Wo7a8hHUTauxz4sIQyoS4ciQRVlt+kJ6ULW5Xw0agaVLA0OeiOHxJ1/u4UhHt +iUhzf15QqAxFi9Po8Li7ZlbRm+GUl+WpBQxpD11dmGh0xCxc3hEKY/n31YFU++xV +Hqq2FP2IdVUqPRun1+f+hxs+dd1CBHw6CMJGTcDi57XVybjKattemUXhderLb6GY +uHGPhds3AgMBAAECggEAAtBl/WvZTSJJ0Ul4M/jypP+ZHL/QPzNesll1//NTyxbF +SwoW/X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YoK4HN1Xf1oJtG19Peo3yxh43cfJpNRXzee8lUMw +uVNlNPNvpnPh8UA2RFz6wdQXYmEYPLFbh2Pp07FBDSmQFJ8ZsejIK1RFfWT2x31t +BK3S+KNu2bajwPPgfodQPSk= +-----END PRIVATE KEY----- From 8ee00eaf19f55364289d097b593b14d7475b1675 Mon Sep 17 00:00:00 2001 From: apuente Date: Wed, 9 Oct 2024 16:55:27 +0200 Subject: [PATCH 4/5] refs #909 New dockerfile ssl --- ogWebconsole/.env | 2 +- ogWebconsole/dockerfile | 2 +- .../edit-organizational-unit.component.ts | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ogWebconsole/.env b/ogWebconsole/.env index 100978f..72796c1 100644 --- a/ogWebconsole/.env +++ b/ogWebconsole/.env @@ -1 +1 @@ -NG_APP_BASE_API_URL=https://127.0.0.1:8443 \ No newline at end of file +NG_APP_BASE_API_URL=https://127.0.0.1:8444 \ No newline at end of file diff --git a/ogWebconsole/dockerfile b/ogWebconsole/dockerfile index 47594cb..5611da3 100644 --- a/ogWebconsole/dockerfile +++ b/ogWebconsole/dockerfile @@ -11,4 +11,4 @@ RUN npm install EXPOSE 4200 -CMD ["ng", "serve", "--host", "0.0.0.0", "--disable-host-check"] \ No newline at end of file +CMD ["ng", "serve", "--ssl","--host", "0.0.0.0", "--disable-host-check"] \ No newline at end of file diff --git a/ogWebconsole/src/app/components/groups/shared/organizational-units/edit-organizational-unit/edit-organizational-unit.component.ts b/ogWebconsole/src/app/components/groups/shared/organizational-units/edit-organizational-unit/edit-organizational-unit.component.ts index cb9f3f7..c7b5607 100644 --- a/ogWebconsole/src/app/components/groups/shared/organizational-units/edit-organizational-unit/edit-organizational-unit.component.ts +++ b/ogWebconsole/src/app/components/groups/shared/organizational-units/edit-organizational-unit/edit-organizational-unit.component.ts @@ -209,6 +209,7 @@ export class EditOrganizationalUnitComponent implements OnInit { const putUrl = `${this.baseUrl}/organizational-units/${this.data.uuid}`; const headers = new HttpHeaders({ 'Content-Type': 'application/json' }); + console.log('PUT URLLLLL:', formData); this.http.put(putUrl, formData, { headers }).subscribe( response => { console.log('PUT successful:', response); From 5b57cf4fb2d837f31b0e421f528111f5c08595fa Mon Sep 17 00:00:00 2001 From: apuente Date: Wed, 9 Oct 2024 16:58:18 +0200 Subject: [PATCH 5/5] refs #909 Add null validations --- .../edit-organizational-unit.component.ts | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/ogWebconsole/src/app/components/groups/shared/organizational-units/edit-organizational-unit/edit-organizational-unit.component.ts b/ogWebconsole/src/app/components/groups/shared/organizational-units/edit-organizational-unit/edit-organizational-unit.component.ts index c7b5607..1bc65e3 100644 --- a/ogWebconsole/src/app/components/groups/shared/organizational-units/edit-organizational-unit/edit-organizational-unit.component.ts +++ b/ogWebconsole/src/app/components/groups/shared/organizational-units/edit-organizational-unit/edit-organizational-unit.component.ts @@ -46,38 +46,38 @@ export class EditOrganizationalUnitComponent implements OnInit { this.isEditMode = !!data?.uuid; this.generalFormGroup = this._formBuilder.group({ - name: ['', Validators.required], - parent: [''], - description: [''], - type: ['', Validators.required] + name: [null], + parent: [null], + description: [null], + type: [null] }); this.additionalInfoFormGroup = this._formBuilder.group({ - comments: [''], + comments: [null], }); this.networkSettingsFormGroup = this._formBuilder.group({ - proxy: [''], - dns: [''], - netmask: [''], - router: [''], - ntp: [''], - p2pMode: [''], - p2pTime: [0, Validators.min(0)], - mcastIp: [''], - mcastSpeed: [0, Validators.min(0)], - mcastPort: [0, Validators.min(0)], - mcastMode: [''], + proxy: [null], + dns: [null], + netmask: [null], + router: [null], + ntp: [null], + p2pMode: [null], + p2pTime: [null], + mcastIp: [null], + mcastSpeed: [null], + mcastPort: [null], + mcastMode: [null], menu: [null], hardwareProfile: [null], validation: [false] }); this.classroomInfoFormGroup = this._formBuilder.group({ - location: [''], + location: [null], projector: [false], board: [false], - capacity: [0, Validators.min(0)], + capacity: [null], remoteCalendar: [null] });