]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/pybind/mgr/dashboard/frontend/src/app/app-routing.module.ts
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / pybind / mgr / dashboard / frontend / src / app / app-routing.module.ts
index 91af17f809bcb07b0c29fca85b21b20834ffe950..4ca71f17259d23ca4c9379842568071a95a2c2d0 100644 (file)
@@ -1,7 +1,7 @@
-import { NgModule } from '@angular/core';
+import { Injectable, NgModule } from '@angular/core';
 import { ActivatedRouteSnapshot, PreloadAllModules, RouterModule, Routes } from '@angular/router';
 
-import * as _ from 'lodash';
+import _ from 'lodash';
 
 import { CephfsListComponent } from './ceph/cephfs/cephfs-list/cephfs-list.component';
 import { ConfigurationFormComponent } from './ceph/cluster/configuration/configuration-form/configuration-form.component';
@@ -16,25 +16,24 @@ import { MgrModuleListComponent } from './ceph/cluster/mgr-modules/mgr-module-li
 import { MonitorComponent } from './ceph/cluster/monitor/monitor.component';
 import { OsdFormComponent } from './ceph/cluster/osd/osd-form/osd-form.component';
 import { OsdListComponent } from './ceph/cluster/osd/osd-list/osd-list.component';
-import { MonitoringListComponent } from './ceph/cluster/prometheus/monitoring-list/monitoring-list.component';
+import { ActiveAlertListComponent } from './ceph/cluster/prometheus/active-alert-list/active-alert-list.component';
+import { RulesListComponent } from './ceph/cluster/prometheus/rules-list/rules-list.component';
 import { SilenceFormComponent } from './ceph/cluster/prometheus/silence-form/silence-form.component';
+import { SilenceListComponent } from './ceph/cluster/prometheus/silence-list/silence-list.component';
 import { ServiceFormComponent } from './ceph/cluster/services/service-form/service-form.component';
 import { ServicesComponent } from './ceph/cluster/services/services.component';
 import { TelemetryComponent } from './ceph/cluster/telemetry/telemetry.component';
 import { DashboardComponent } from './ceph/dashboard/dashboard/dashboard.component';
-import { Nfs501Component } from './ceph/nfs/nfs-501/nfs-501.component';
 import { NfsFormComponent } from './ceph/nfs/nfs-form/nfs-form.component';
 import { NfsListComponent } from './ceph/nfs/nfs-list/nfs-list.component';
 import { PerformanceCounterComponent } from './ceph/performance-counter/performance-counter/performance-counter.component';
 import { LoginPasswordFormComponent } from './core/auth/login-password-form/login-password-form.component';
 import { LoginComponent } from './core/auth/login/login.component';
-import { SsoNotFoundComponent } from './core/auth/sso/sso-not-found/sso-not-found.component';
 import { UserPasswordFormComponent } from './core/auth/user-password-form/user-password-form.component';
-import { ForbiddenComponent } from './core/forbidden/forbidden.component';
+import { ErrorComponent } from './core/error/error.component';
 import { BlankLayoutComponent } from './core/layouts/blank-layout/blank-layout.component';
 import { LoginLayoutComponent } from './core/layouts/login-layout/login-layout.component';
 import { WorkbenchLayoutComponent } from './core/layouts/workbench-layout/workbench-layout.component';
-import { NotFoundComponent } from './core/not-found/not-found.component';
 import { ActionLabels, URLVerbs } from './shared/constants/app.constants';
 import { BreadcrumbsResolver, IBreadcrumb } from './shared/models/breadcrumbs';
 import { AuthGuardService } from './shared/services/auth-guard.service';
@@ -43,6 +42,7 @@ import { FeatureTogglesGuardService } from './shared/services/feature-toggles-gu
 import { ModuleStatusGuardService } from './shared/services/module-status-guard.service';
 import { NoSsoGuardService } from './shared/services/no-sso-guard.service';
 
+@Injectable()
 export class PerformanceCounterBreadcrumbsResolver extends BreadcrumbsResolver {
   resolve(route: ActivatedRouteSnapshot) {
     const result: IBreadcrumb[] = [];
@@ -65,6 +65,7 @@ export class PerformanceCounterBreadcrumbsResolver extends BreadcrumbsResolver {
   }
 }
 
+@Injectable()
 export class StartCaseBreadcrumbsResolver extends BreadcrumbsResolver {
   resolve(route: ActivatedRouteSnapshot) {
     const path = route.params.name;
@@ -83,6 +84,8 @@ const routes: Routes = [
     canActivateChild: [AuthGuardService, ChangePasswordGuardService],
     children: [
       { path: 'dashboard', component: DashboardComponent },
+      { path: 'error', component: ErrorComponent },
+
       // Cluster
       {
         path: 'hosts',
@@ -103,7 +106,17 @@ const routes: Routes = [
       },
       {
         path: 'services',
-        data: { breadcrumbs: 'Cluster/Services' },
+        canActivateChild: [ModuleStatusGuardService],
+        data: {
+          moduleStatusGuardConfig: {
+            apiPath: 'orchestrator',
+            redirectTo: 'error',
+            section: 'orch',
+            section_info: 'Orchestrator',
+            header: 'Orchestrator is not available'
+          },
+          breadcrumbs: 'Cluster/Services'
+        },
         children: [
           { path: '', component: ServicesComponent },
           {
@@ -115,8 +128,18 @@ const routes: Routes = [
       },
       {
         path: 'inventory',
+        canActivate: [ModuleStatusGuardService],
         component: InventoryComponent,
-        data: { breadcrumbs: 'Cluster/Inventory' }
+        data: {
+          moduleStatusGuardConfig: {
+            apiPath: 'orchestrator',
+            redirectTo: 'error',
+            section: 'orch',
+            section_info: 'Orchestrator',
+            header: 'Orchestrator is not available'
+          },
+          breadcrumbs: 'Cluster/Inventory'
+        }
       },
       {
         path: 'osd',
@@ -161,29 +184,46 @@ const routes: Routes = [
         path: 'monitoring',
         data: { breadcrumbs: 'Cluster/Monitoring' },
         children: [
+          { path: '', redirectTo: 'active-alerts', pathMatch: 'full' },
           {
-            path: '',
-            component: MonitoringListComponent
-          },
-          {
-            path: 'silence/' + URLVerbs.CREATE,
-            component: SilenceFormComponent,
-            data: { breadcrumbs: `${ActionLabels.CREATE} Silence` }
-          },
-          {
-            path: `silence/${URLVerbs.CREATE}/:id`,
-            component: SilenceFormComponent,
-            data: { breadcrumbs: ActionLabels.CREATE }
+            path: 'active-alerts',
+            data: { breadcrumbs: 'Active Alerts' },
+            component: ActiveAlertListComponent
           },
           {
-            path: `silence/${URLVerbs.EDIT}/:id`,
-            component: SilenceFormComponent,
-            data: { breadcrumbs: ActionLabels.EDIT }
+            path: 'alerts',
+            data: { breadcrumbs: 'Alerts' },
+            component: RulesListComponent
           },
           {
-            path: `silence/${URLVerbs.RECREATE}/:id`,
-            component: SilenceFormComponent,
-            data: { breadcrumbs: ActionLabels.RECREATE }
+            path: 'silences',
+            data: { breadcrumbs: 'Silences' },
+            children: [
+              {
+                path: '',
+                component: SilenceListComponent
+              },
+              {
+                path: URLVerbs.CREATE,
+                component: SilenceFormComponent,
+                data: { breadcrumbs: `${ActionLabels.CREATE} Silence` }
+              },
+              {
+                path: `${URLVerbs.CREATE}/:id`,
+                component: SilenceFormComponent,
+                data: { breadcrumbs: ActionLabels.CREATE }
+              },
+              {
+                path: `${URLVerbs.EDIT}/:id`,
+                component: SilenceFormComponent,
+                data: { breadcrumbs: ActionLabels.EDIT }
+              },
+              {
+                path: `${URLVerbs.RECREATE}/:id`,
+                component: SilenceFormComponent,
+                data: { breadcrumbs: ActionLabels.RECREATE }
+              }
+            ]
           }
         ]
       },
@@ -238,7 +278,10 @@ const routes: Routes = [
         data: {
           moduleStatusGuardConfig: {
             apiPath: 'rgw',
-            redirectTo: 'rgw/501'
+            redirectTo: 'error',
+            section: 'rgw',
+            section_info: 'Object Gateway',
+            header: 'The Object Gateway Service is not configured'
           },
           breadcrumbs: true,
           text: 'Object Gateway',
@@ -266,18 +309,16 @@ const routes: Routes = [
         ]
       },
       // NFS
-      {
-        path: 'nfs/501/:message',
-        component: Nfs501Component,
-        data: { breadcrumbs: 'NFS' }
-      },
       {
         path: 'nfs',
         canActivateChild: [FeatureTogglesGuardService, ModuleStatusGuardService],
         data: {
           moduleStatusGuardConfig: {
             apiPath: 'nfs-ganesha',
-            redirectTo: 'nfs/501'
+            redirectTo: 'error',
+            section: 'nfs-ganesha',
+            section_info: 'NFS GANESHA',
+            header: 'NFS-Ganesha is not configured'
           },
           breadcrumbs: 'NFS'
         },
@@ -312,14 +353,7 @@ const routes: Routes = [
   {
     path: '',
     component: BlankLayoutComponent,
-    children: [
-      // Single Sign-On (SSO)
-      { path: 'sso/404', component: SsoNotFoundComponent },
-      // System
-      { path: '403', component: ForbiddenComponent },
-      { path: '404', component: NotFoundComponent },
-      { path: '**', redirectTo: '/404' }
-    ]
+    children: [{ path: '**', redirectTo: '/error' }]
   }
 ];