diff --git a/src/app/app.routes.ts b/src/app/app.routes.ts index f3b55a376..75bea0771 100644 --- a/src/app/app.routes.ts +++ b/src/app/app.routes.ts @@ -43,6 +43,7 @@ import { ms365ModuleRoutes } from './modules/ms365_module/ms365_module.routes'; import { mshypervModuleRoutes } from './modules/mshyperv_module/mshyperv_module.routes'; import { ciscoModuleRoutes } from './modules/cisco_module/cisco_module.routes'; import { broadcomProxyModuleRoutes } from './modules/broadcomproxy_module/broadcomproxy_module.routes'; +import { nginxModuleRoutes } from './modules/nginx_module/nginx_module.routes'; @Component({ selector: 'legacy-redirect', @@ -107,7 +108,8 @@ const moduleRoutes: Routes = [ ...ms365ModuleRoutes, ...mshypervModuleRoutes, ...ciscoModuleRoutes, - ...broadcomProxyModuleRoutes + ...broadcomProxyModuleRoutes, + ...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..bef6cab8f --- /dev/null +++ b/src/app/modules/nginx_module/pages/wizards/nginx/nginx-wizard.interface.ts @@ -0,0 +1,31 @@ +import { WizardGet, WizardPost } from '../../../../../pages/wizards/wizards.interface'; + +// WIZARD GET +export interface NginxWizardGet extends WizardGet { +} + + +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 { +} + 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..6b5480347 --- /dev/null +++ b/src/app/modules/nginx_module/pages/wizards/nginx/nginx.component.html @@ -0,0 +1,119 @@ + + + + + + +
+ {{ t('Configuration Wizard: nginx Status') }} +
+
+ +
+
+ + + {{ t('Host Information') }} + +
+
+ + + {{ t('Configure services for nginx Status') }} + +
+
+
+
+
+ + + +
+
+
+
+ + +
+ +

+ {{ 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. +
+
+
+
+
+
+ + + + +
+
+ +
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..cb5952a12 --- /dev/null +++ b/src/app/modules/nginx_module/pages/wizards/nginx/nginx.component.ts @@ -0,0 +1,60 @@ +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 { + AccordionButtonDirective, + AccordionComponent, + AccordionItemComponent, + CardBodyComponent, + CardComponent, + CardHeaderComponent, + CardTitleDirective, + TemplateIdDirective +} 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 { 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, + AccordionButtonDirective, + AccordionComponent, + AccordionItemComponent, + TemplateIdDirective, + ], + 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 = { +// Default fields from the base wizard + host_id: 0, + services: [], + } as NginxWizardPost; + +} 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 } } 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 @@ + + + + + + + + + + + + +