From fc6f3bc5ccf446c9f66683f433a856075a9d7d2c Mon Sep 17 00:00:00 2001 From: Jan Nox Date: Fri, 10 Oct 2025 14:20:39 +0200 Subject: [PATCH 1/4] * Add wizard front-end * add Routes. --- src/app/app.routes.ts | 4 +- .../nginx_module/nginx_module.routes.ts | 9 +++ .../wizards/nginx/nginx-wizard.interface.ts | 38 +++++++++ .../wizards/nginx/nginx-wizard.service.ts | 40 ++++++++++ .../pages/wizards/nginx/nginx.component.css | 0 .../pages/wizards/nginx/nginx.component.html | 80 +++++++++++++++++++ .../wizards/nginx/nginx.component.spec.ts | 23 ++++++ .../pages/wizards/nginx/nginx.component.ts | 59 ++++++++++++++ src/assets/images/wizards/nginx_logo.svg | 21 +++++ 9 files changed, 273 insertions(+), 1 deletion(-) create mode 100644 src/app/modules/nginx_module/nginx_module.routes.ts create mode 100644 src/app/modules/nginx_module/pages/wizards/nginx/nginx-wizard.interface.ts create mode 100644 src/app/modules/nginx_module/pages/wizards/nginx/nginx-wizard.service.ts create mode 100644 src/app/modules/nginx_module/pages/wizards/nginx/nginx.component.css create mode 100644 src/app/modules/nginx_module/pages/wizards/nginx/nginx.component.html create mode 100644 src/app/modules/nginx_module/pages/wizards/nginx/nginx.component.spec.ts create mode 100644 src/app/modules/nginx_module/pages/wizards/nginx/nginx.component.ts create mode 100644 src/assets/images/wizards/nginx_logo.svg diff --git a/src/app/app.routes.ts b/src/app/app.routes.ts index 1a052dc6a..ac34f1667 100644 --- a/src/app/app.routes.ts +++ b/src/app/app.routes.ts @@ -40,6 +40,7 @@ import { servicenowModuleRoutes } from './modules/servicenow_module/servicenow_m import { dellModuleRoutes } from './modules/dell_module/dell_module.routes'; import { proxmoxModuleRoutes } from './modules/proxmox_module/proxmox_module.routes'; import { ms365ModuleRoutes } from './modules/ms365_module/ms365_module.routes'; +import { nginxModuleRoutes } from './modules/nginx_module/nginx_module.routes'; @Component({ selector: 'legacy-redirect', @@ -101,7 +102,8 @@ const moduleRoutes: Routes = [ ...servicenowModuleRoutes, ...dellModuleRoutes, ...proxmoxModuleRoutes, - ...ms365ModuleRoutes + ...ms365ModuleRoutes, + ...nginxModuleRoutes ]; /*** Core routes ***/ const coreRoutes: Routes = [{ diff --git a/src/app/modules/nginx_module/nginx_module.routes.ts b/src/app/modules/nginx_module/nginx_module.routes.ts new file mode 100644 index 000000000..f4b52c0a0 --- /dev/null +++ b/src/app/modules/nginx_module/nginx_module.routes.ts @@ -0,0 +1,9 @@ +import { Routes } from '@angular/router'; +import { NginxComponent } from './pages/wizards/nginx/nginx.component'; + +export const nginxModuleRoutes: Routes = [ + { + path: 'nginx_module/wizards/nginx/:hostId/nginx', + loadComponent: () => import('./pages/wizards/nginx/nginx.component').then(m => NginxComponent), + }, +]; diff --git a/src/app/modules/nginx_module/pages/wizards/nginx/nginx-wizard.interface.ts b/src/app/modules/nginx_module/pages/wizards/nginx/nginx-wizard.interface.ts new file mode 100644 index 000000000..c599cb799 --- /dev/null +++ b/src/app/modules/nginx_module/pages/wizards/nginx/nginx-wizard.interface.ts @@ -0,0 +1,38 @@ +import { WizardGet, WizardPost } from '../../../../../pages/wizards/wizards.interface'; + +// WIZARD GET +export interface NginxWizardGet extends WizardGet { + pveUsername: string + pveApiTokenName: string + pveApiTokenSecret: string +} + + +export interface Servicecommandargumentvalue { + commandargument: Commandargument + commandargument_id: number + created: string + id: number + modified: string + servicetemplate_id: number + value: string +} + +export interface Commandargument { + command_id: number + created: string + human_name: string + id: number + modified: string + name: string +} + + +// WIZARD POST +export interface NginxWizardPost extends WizardPost { + pveUsername: string + pveApiTokenName: string + pveApiTokenSecret: string + storageServices: any[] | undefined +} + diff --git a/src/app/modules/nginx_module/pages/wizards/nginx/nginx-wizard.service.ts b/src/app/modules/nginx_module/pages/wizards/nginx/nginx-wizard.service.ts new file mode 100644 index 000000000..61d0fbaf2 --- /dev/null +++ b/src/app/modules/nginx_module/pages/wizards/nginx/nginx-wizard.service.ts @@ -0,0 +1,40 @@ +import { Injectable } from '@angular/core'; +import { catchError, map, Observable, of } from 'rxjs'; +import { WizardsService } from '../../../../../pages/wizards/wizards.service'; +import { GenericResponseWrapper, GenericValidationError } from '../../../../../generic-responses'; +import { NginxWizardGet, NginxWizardPost, } from './nginx-wizard.interface'; + +@Injectable({ + providedIn: 'root' +}) +export class NginxWizardService extends WizardsService { + + public fetch(hostId: number): Observable { + return this.http.get(`${this.proxyPath}/nginx_module/wizards/nginx/${hostId}.json?angular=true`).pipe( + map((data: NginxWizardGet): NginxWizardGet => { + return data; + }) + ); + } + + public submit(post: NginxWizardPost): Observable { + return this.http.post(`${this.proxyPath}/nginx_module/wizards/nginx.json?angular=true`, post) + .pipe( + map(data => { + return { + success: true, + data: null + }; + }), + catchError((error: any) => { + const err = error.error.error as GenericValidationError; + return of({ + success: false, + data: err + }); + }) + ); + } + + +} diff --git a/src/app/modules/nginx_module/pages/wizards/nginx/nginx.component.css b/src/app/modules/nginx_module/pages/wizards/nginx/nginx.component.css new file mode 100644 index 000000000..e69de29bb diff --git a/src/app/modules/nginx_module/pages/wizards/nginx/nginx.component.html b/src/app/modules/nginx_module/pages/wizards/nginx/nginx.component.html new file mode 100644 index 000000000..262b13c47 --- /dev/null +++ b/src/app/modules/nginx_module/pages/wizards/nginx/nginx.component.html @@ -0,0 +1,80 @@ + + + + + + +
+ {{ t('Configuration Wizard: nginx') }} +
+
+ +
+
+ + + {{ t('Host Information') }} + +
+
+ + + {{ t('Configure services for nginx') }} + +
+
+
+
+
+ + + +
+
+
+
+ + + + + + +
+ +
diff --git a/src/app/modules/nginx_module/pages/wizards/nginx/nginx.component.spec.ts b/src/app/modules/nginx_module/pages/wizards/nginx/nginx.component.spec.ts new file mode 100644 index 000000000..14f73e38f --- /dev/null +++ b/src/app/modules/nginx_module/pages/wizards/nginx/nginx.component.spec.ts @@ -0,0 +1,23 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { NginxComponent } from './nginx.component'; + +describe('NginxComponent', () => { + let component: NginxComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + imports: [NginxComponent] + }) + .compileComponents(); + + fixture = TestBed.createComponent(NginxComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/modules/nginx_module/pages/wizards/nginx/nginx.component.ts b/src/app/modules/nginx_module/pages/wizards/nginx/nginx.component.ts new file mode 100644 index 000000000..4a6d25aa8 --- /dev/null +++ b/src/app/modules/nginx_module/pages/wizards/nginx/nginx.component.ts @@ -0,0 +1,59 @@ +import { ChangeDetectionStrategy, Component, inject, ViewChild } from '@angular/core'; +import { WizardsAbstractComponent } from '../../../../../pages/wizards/wizards-abstract/wizards-abstract.component'; +import { BackButtonDirective } from '../../../../../directives/back-button.directive'; +import { CardBodyComponent, CardComponent, CardHeaderComponent, CardTitleDirective } from '@coreui/angular'; +import { FaIconComponent } from '@fortawesome/angular-fontawesome'; +import { FormsModule, ReactiveFormsModule } from '@angular/forms'; +import { TranslocoDirective, TranslocoPipe } from '@jsverse/transloco'; +import { + WizardsDynamicfieldsComponent +} from '../../../../../components/wizards/wizards-dynamicfields/wizards-dynamicfields.component'; +import { NginxWizardGet, NginxWizardPost } from './nginx-wizard.interface'; +import { NginxWizardService } from './nginx-wizard.service'; +import { RouterLink } from '@angular/router'; + +@Component({ + selector: 'oitc-nginx', + imports: [ + BackButtonDirective, + CardBodyComponent, + CardComponent, + CardHeaderComponent, + CardTitleDirective, + FaIconComponent, + ReactiveFormsModule, + TranslocoDirective, + TranslocoPipe, + WizardsDynamicfieldsComponent, + FormsModule, + RouterLink, + ], + templateUrl: './nginx.component.html', + styleUrl: './nginx.component.css', + changeDetection: ChangeDetectionStrategy.OnPush +}) +export class NginxComponent extends WizardsAbstractComponent { + + @ViewChild(WizardsDynamicfieldsComponent) childComponentLocal!: WizardsDynamicfieldsComponent; + protected override WizardService: NginxWizardService = inject(NginxWizardService); + public checked: boolean = false; + + protected override post: NginxWizardPost = { + pveUsername: '', + pveApiTokenName: '', + pveApiTokenSecret: '', + storageServices: [], +// Default fields from the base wizard + host_id: 0, + services: [], + } as NginxWizardPost; + + protected override wizardLoad(result: NginxWizardGet): void { + console.warn(result); + this.post.pveUsername = result.pveUsername; + this.post.pveApiTokenName = result.pveApiTokenName; + this.post.pveApiTokenSecret = result.pveApiTokenSecret; + super.wizardLoad(result); + } + +} diff --git a/src/assets/images/wizards/nginx_logo.svg b/src/assets/images/wizards/nginx_logo.svg new file mode 100644 index 000000000..e4b731f39 --- /dev/null +++ b/src/assets/images/wizards/nginx_logo.svg @@ -0,0 +1,21 @@ + + + + + + + + + + + + + From d241114e0bfb31b6d1626b61d151cd8f72b5ad49 Mon Sep 17 00:00:00 2001 From: Jan Nox Date: Mon, 13 Oct 2025 11:32:33 +0200 Subject: [PATCH 2/4] * Add webserver filter * Rename wizard --- .../nginx_module/pages/wizards/nginx/nginx.component.html | 8 ++++---- .../wizards/wizards-index/wizards-index.component.html | 6 ++++++ .../wizards/wizards-index/wizards-index.component.ts | 3 ++- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/app/modules/nginx_module/pages/wizards/nginx/nginx.component.html b/src/app/modules/nginx_module/pages/wizards/nginx/nginx.component.html index 262b13c47..c48957a6c 100644 --- a/src/app/modules/nginx_module/pages/wizards/nginx/nginx.component.html +++ b/src/app/modules/nginx_module/pages/wizards/nginx/nginx.component.html @@ -14,7 +14,7 @@ @@ -22,7 +22,7 @@
- {{ t('Configuration Wizard: nginx') }} + {{ t('Configuration Wizard: nginx Status') }}
@@ -38,7 +38,7 @@
class="col-xs-12 col-md-4 col-lg-2 wizard-bg-inactive d-inline-flex align-items-center justify-content-center wizard-active"> - {{ t('Configure services for nginx') }} + {{ t('Configure services for nginx Status') }}
@@ -70,7 +70,7 @@
[(post)]="post.services" [errors]="errors" [titleErrorField]="'services'" - [title]="'nginx services'|transloco" + [title]="'nginx Status services'|transloco" /> diff --git a/src/app/pages/wizards/wizards-index/wizards-index.component.html b/src/app/pages/wizards/wizards-index/wizards-index.component.html index 2556aaa98..4b469b425 100644 --- a/src/app/pages/wizards/wizards-index/wizards-index.component.html +++ b/src/app/pages/wizards/wizards-index/wizards-index.component.html @@ -88,6 +88,12 @@
{{ t('Configuration Wizards') }}
{{ t('Hardware') }} + diff --git a/src/app/pages/wizards/wizards-index/wizards-index.component.ts b/src/app/pages/wizards/wizards-index/wizards-index.component.ts index 5bff2b839..8ba750828 100644 --- a/src/app/pages/wizards/wizards-index/wizards-index.component.ts +++ b/src/app/pages/wizards/wizards-index/wizards-index.component.ts @@ -80,7 +80,8 @@ export class WizardsIndexComponent implements OnInit, OnDestroy { docker: true, macos: true, virtualization: true, - hardware: true + hardware: true, + webserver: true } } From 242312bcb3dbf4b041f2e3bb6ae94c5956824b6f Mon Sep 17 00:00:00 2001 From: Jan Nox Date: Fri, 31 Oct 2025 12:49:21 +0100 Subject: [PATCH 3/4] ITC-3591: - Remove unused code from front-end --- .../pages/wizards/nginx/nginx-wizard.interface.ts | 7 ------- .../pages/wizards/nginx/nginx.component.ts | 14 +------------- 2 files changed, 1 insertion(+), 20 deletions(-) diff --git a/src/app/modules/nginx_module/pages/wizards/nginx/nginx-wizard.interface.ts b/src/app/modules/nginx_module/pages/wizards/nginx/nginx-wizard.interface.ts index c599cb799..bef6cab8f 100644 --- a/src/app/modules/nginx_module/pages/wizards/nginx/nginx-wizard.interface.ts +++ b/src/app/modules/nginx_module/pages/wizards/nginx/nginx-wizard.interface.ts @@ -2,9 +2,6 @@ import { WizardGet, WizardPost } from '../../../../../pages/wizards/wizards.inte // WIZARD GET export interface NginxWizardGet extends WizardGet { - pveUsername: string - pveApiTokenName: string - pveApiTokenSecret: string } @@ -30,9 +27,5 @@ export interface Commandargument { // WIZARD POST export interface NginxWizardPost extends WizardPost { - pveUsername: string - pveApiTokenName: string - pveApiTokenSecret: string - storageServices: any[] | undefined } diff --git a/src/app/modules/nginx_module/pages/wizards/nginx/nginx.component.ts b/src/app/modules/nginx_module/pages/wizards/nginx/nginx.component.ts index 4a6d25aa8..0e0f250b4 100644 --- a/src/app/modules/nginx_module/pages/wizards/nginx/nginx.component.ts +++ b/src/app/modules/nginx_module/pages/wizards/nginx/nginx.component.ts @@ -8,7 +8,7 @@ import { TranslocoDirective, TranslocoPipe } from '@jsverse/transloco'; import { WizardsDynamicfieldsComponent } from '../../../../../components/wizards/wizards-dynamicfields/wizards-dynamicfields.component'; -import { NginxWizardGet, NginxWizardPost } from './nginx-wizard.interface'; +import { NginxWizardPost } from './nginx-wizard.interface'; import { NginxWizardService } from './nginx-wizard.service'; import { RouterLink } from '@angular/router'; @@ -39,21 +39,9 @@ export class NginxComponent extends WizardsAbstractComponent { public checked: boolean = false; protected override post: NginxWizardPost = { - pveUsername: '', - pveApiTokenName: '', - pveApiTokenSecret: '', - storageServices: [], // Default fields from the base wizard host_id: 0, services: [], } as NginxWizardPost; - protected override wizardLoad(result: NginxWizardGet): void { - console.warn(result); - this.post.pveUsername = result.pveUsername; - this.post.pveApiTokenName = result.pveApiTokenName; - this.post.pveApiTokenSecret = result.pveApiTokenSecret; - super.wizardLoad(result); - } - } From 9b762beb4acf9f66e1b088f0b38b52ada8586a84 Mon Sep 17 00:00:00 2001 From: abergen Date: Thu, 13 Nov 2025 10:31:13 +0000 Subject: [PATCH 4/4] ITC-3591 - added help box for nginx status wizard --- .../pages/wizards/nginx/nginx.component.html | 39 +++++++++++++++++++ .../pages/wizards/nginx/nginx.component.ts | 15 ++++++- 2 files changed, 53 insertions(+), 1 deletion(-) diff --git a/src/app/modules/nginx_module/pages/wizards/nginx/nginx.component.html b/src/app/modules/nginx_module/pages/wizards/nginx/nginx.component.html index c48957a6c..6b5480347 100644 --- a/src/app/modules/nginx_module/pages/wizards/nginx/nginx.component.html +++ b/src/app/modules/nginx_module/pages/wizards/nginx/nginx.component.html @@ -66,6 +66,45 @@
+
+ +

+ {{ t('nginx Status') }} +

+
+ + + + + + + +
+
    +
  1. + {{ t('Add the following code to your nginx configuration file in the monitored server:') }} +
    location /stub_status {
    +  # Turn on nginx stats
    +  stub_status on;
    +
    +  # Disable access.log for stats
    +  access_log off;
    +  }
    +
  2. +
  3. + {{ t('Restart the ngninx server:') }} +
    systemctl restart nginx
    +
  4. +
+
+
+
+
+
+