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/dockerfile b/ogWebconsole/dockerfile new file mode 100644 index 0000000..5611da3 --- /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", "--ssl","--host", "0.0.0.0", "--disable-host-check"] \ 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 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/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..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] }); @@ -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,35 +206,35 @@ 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' }); + console.log('PUT URLLLLL:', formData); this.http.put(putUrl, formData, { headers }).subscribe( response => { 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 +245,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 +ZHMtdGVzdC5uZXQwHhcNMjQxMDA5MTQyODM3WhcNMjUxMDE5MTQyODM3WjBMMQsw +CQYDVQQGEwJFUzEPMA0GA1UECAwGTWFkcmlkMQ8wDQYDVQQHDAZNYWRyaWQxGzAZ +BgNVBAMMEm9nZ3VpLnVkcy10ZXN0Lm5ldDCCASIwDQYJKoZIhvcNAQEBBQADggEP +ADCCAQoCggEBAKlM9SW4QghdIR1JW9Wn8HoagN1vyJ7GKhQXRPQXcL58zLlaZ+w8 +bDANnOr9ctwVP3ftpfeCUBvuuoAL3PLttR9X1QrJk2N5kzEZyz2ckf9XLpbh5eI+ +Eoaj5k1NLet9brKjBNN+32zBDqQPHhajtryEdRNq7HPiwhDKhLhyJBFWW36QnpQt +blfDRqBpUsDQ56I4fEnX+7hSEe2JSHN/XlCoDEWL0+jwuLtmVtGb4ZSX5akFDGkP +XV2YaHTELFzeEQpj+ffVgVT77FUeqrYU/Yh1VSo9G6fX5/6HGz513UIEfDoIwkZN +wOLntdXJuMpq216ZReF16stvoZi4cY+F2zcCAwEAAaOBsTCBrjAdBgNVHREEFjAU +ghJvZ2d1aS51ZHMtdGVzdC5uZXQwHQYDVR0OBBYEFMEnxET3oXXcuoQq7C9+AcHp +VqmyMG4GA1UdIwRnMGWhTaRLMEkxCzAJBgNVBAYTAkVTMQ8wDQYDVQQIDAZNYWRy +aWQxDzANBgNVBAcMBk1hZHJpZDEYMBYGA1UEAwwPY2EudWRzLXRlc3QubmV0ghRA +nfzWMM2iUx7UNNNmJzg92Si7NDANBgkqhkiG9w0BAQsFAAOCAgEAanwvug9UMaun +JakVSM8KPJVL2TFIKJApLbFX/zF1Z860dteJRLEY5jsk7ljZqnyXMIScUBdBVJxW +whp4dlGRBx/sLmfimn544s/Vzk90GYqbue+/ozLrFV74bn8suoZAuTQCCOHsclEp +v39R6EuvOf+htVi2jhBEtrOVPC2YMnUXCj8uUI4GLwrNlGmfZ2gl247xdsrPbrtT +ToU6y/S8AQBO7BuLVlNLGo62jgJmKLPhCkAFhiGZrVFH/3EgDUWaSJCwfs8Lp0yk +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/XTo/MjSeZAflKDrHnyIwbByJxoKEjl1lrl0xUHvJ0VqecDPktqxkiNEGfvC +U9JgFn6e+DXz4ge3t65XZLNo+nWlaRKxwkWuDlpHnfflqkj2B9xrtV5oY63Mrle7 +hkr+VvddxOfNRYH7c/ofr9sYsCdGDBLNO2x8Zo9WPlw3cBuCLcJ/L7em14mI01Jg +Nx5oVpvlM9nUqfLRbOk5dUu7dpgGzxfx1Y1hWF/qMcdzltgKqFv47WZWl89WnGbG +ifL3NbCOAQRcTQ1Qex+z/NPLe8JmoftyIdwCqwjU4QKBgQDDZVdEO18HSZq1RQe1 +b7Hd+1rkKBN1k+6Um4ZToy/6TOw0E/eZ/Xh8grpI5+zfLuVIQZ0JKGwvInybdHns +BLnPCMMRUtgf95/sfLXU4bY0aiR0DGPsGC8yfpmxnMelWW0K9HYtkmYxln/LfLM+ +tugt0Y+6oa0h708pvqvyK7x9CwKBgQDdz5+qunsxu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