From 9c87423f88a599640062a1851404c6c75a3a4dca Mon Sep 17 00:00:00 2001 From: Nizamudeen A Date: Wed, 15 Jun 2022 22:52:39 +0530 Subject: [PATCH] mgr/dashboard: Error page cleanup Resolves: rhbz#1891012 Some error page cleanups Signed-off-by: Nizamudeen A (cherry picked from commit ec899f2de30760edd6aa10fb7d5bdd61fadf83af) --- .../src/app/core/error/error.component.html | 96 +++++++++++-------- .../src/app/core/error/error.component.scss | 29 ------ .../app/core/error/error.component.spec.ts | 9 +- .../src/app/core/error/error.component.ts | 44 +++++---- .../services/module-status-guard.service.ts | 3 +- 5 files changed, 88 insertions(+), 93 deletions(-) diff --git a/src/pybind/mgr/dashboard/frontend/src/app/core/error/error.component.html b/src/pybind/mgr/dashboard/frontend/src/app/core/error/error.component.html index 0d63566acff36..259afc5139851 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/core/error/error.component.html +++ b/src/pybind/mgr/dashboard/frontend/src/app/core/error/error.component.html @@ -2,48 +2,62 @@ Error Page -
-
-
-
- -


-

{{ header }}

-
-

{{ message }}

-
- - -


-

Page not Found

-
-

Sorry, we couldn’t find what you were looking for. - The page you requested may have been changed or moved.

-
-
-

Please consult the documentation on how to configure and enable - the {{ section_info }} management functionality.

-
-

-
- - - -
- -
- +
+
+
+
+ + +
+

{{ header }}

+

{{ message }}

+

Please consult the documentation on how to configure and enable + the {{ sectionInfo }} management functionality.

+
+
+ +
+
+ +
+
+ + + + + + + + + +
+

Page not Found

+ +

Sorry, we couldn’t find what you were looking for. + The page you requested may have been changed or moved.

+
+
+ + +
+ +
+
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/core/error/error.component.scss b/src/pybind/mgr/dashboard/frontend/src/app/core/error/error.component.scss index 618202da8bd23..feb4e0f95829a 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/core/error/error.component.scss +++ b/src/pybind/mgr/dashboard/frontend/src/app/core/error/error.component.scss @@ -9,35 +9,6 @@ i { margin-top: 120px; } -.text-center { - background-color: vv.$body-bg-alt; -} - -.dashboard { - background-color: vv.$body-bg-alt; - height: 100%; - position: relative; -} - -.content { - left: 50%; - position: absolute; - top: 40%; - transform: translate(-50%, -50%); - width: 100%; -} - -.row { - display: block; - margin-left: -29px; - margin-right: -29px; - padding-top: 10em; -} - -.fa-exclamation-triangle { - color: vv.$danger; -} - .fa-lock { color: vv.$danger; } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/core/error/error.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/core/error/error.component.spec.ts index 3e9b24ebf8e61..65b93330033fb 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/core/error/error.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/core/error/error.component.spec.ts @@ -2,6 +2,8 @@ import { HttpClientTestingModule } from '@angular/common/http/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { RouterTestingModule } from '@angular/router/testing'; +import { ToastrModule } from 'ngx-toastr'; + import { SharedModule } from '~/app/shared/shared.module'; import { configureTestBed } from '~/testing/unit-test-helper'; import { ErrorComponent } from './error.component'; @@ -12,7 +14,12 @@ describe('ErrorComponent', () => { configureTestBed({ declarations: [ErrorComponent], - imports: [HttpClientTestingModule, RouterTestingModule, SharedModule] + imports: [ + HttpClientTestingModule, + RouterTestingModule, + SharedModule, + ToastrModule.forRoot() + ] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/core/error/error.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/core/error/error.component.ts index ae57035693431..6a995bc4e583a 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/core/error/error.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/core/error/error.component.ts @@ -25,14 +25,19 @@ export class ErrorComponent implements OnDestroy, OnInit { docUrl: string; source: string; routerSubscription: Subscription; - bootstrap: string; + uiConfig: string; uiApiPath: string; - button_route: string; - button_name: string; + buttonRoute: string; + buttonName: string; + buttonTitle: string; + component: string; - constructor(private router: Router, private docService: DocService, + constructor( + private router: Router, + private docService: DocService, private http: HttpClient, - private notificationService: NotificationService, ) {} + private notificationService: NotificationService + ) {} ngOnInit() { this.fetchData(); @@ -43,27 +48,18 @@ export class ErrorComponent implements OnDestroy, OnInit { }); } - doBootstrap() { + doConfigure() { this.http.post(`ui-api/${this.uiApiPath}/configure`, {}).subscribe({ next: () => { - this.notificationService.show( - NotificationType.info, - 'Configuring RBD Mirroring' - ); + this.notificationService.show(NotificationType.info, `Configuring ${this.component}`); }, error: (error: any) => { - this.notificationService.show( - NotificationType.error, - error - ); + this.notificationService.show(NotificationType.error, error); }, complete: () => { setTimeout(() => { this.router.navigate([this.uiApiPath]); - this.notificationService.show( - NotificationType.success, - 'Configured RBD Mirroring' - ); + this.notificationService.show(NotificationType.success, `Configured ${this.component}`); }, 3000); } }); @@ -79,15 +75,21 @@ export class ErrorComponent implements OnDestroy, OnInit { this.message = history.state.message; this.header = history.state.header; this.section = history.state.section; +<<<<<<< HEAD this.section_info = history.state.section_info; this.button_name = history.state.button_name; this.button_route = history.state.button_route; +======= + this.sectionInfo = history.state.section_info; +>>>>>>> 5b33f500f5d (mgr/dashboard: Error page cleanup) this.icon = history.state.icon; this.source = history.state.source; - this.bootstrap = history.state.bootstrap; + this.uiConfig = history.state.uiConfig; this.uiApiPath = history.state.uiApiPath; - this.button_route = history.state.button_route; - this.button_name = history.state.button_name; + this.buttonRoute = history.state.button_route; + this.buttonName = history.state.button_name; + this.buttonTitle = history.state.button_title; + this.component = history.state.component; this.docUrl = this.docService.urlGenerator(this.section); } catch (error) { this.router.navigate(['/error']); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/module-status-guard.service.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/module-status-guard.service.ts index 9d677aee53f7f..df6f4854e1967 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/module-status-guard.service.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/module-status-guard.service.ts @@ -85,7 +85,8 @@ export class ModuleStatusGuardService implements CanActivate, CanActivateChild { button_title: config.button_title, uiConfig: config.uiConfig, uiApiPath: config.uiApiPath, - icon: Icons.wrench + icon: Icons.wrench, + component: config.component } }); } -- 2.39.5