]>
Commit | Line | Data |
---|---|---|
11fdf7f2 TL |
1 | import { CommonModule } from '@angular/common'; |
2 | import { NgModule } from '@angular/core'; | |
3 | import { FormsModule, ReactiveFormsModule } from '@angular/forms'; | |
4 | import { RouterModule, Routes } from '@angular/router'; | |
5 | ||
f67539c2 TL |
6 | import { TreeModule } from '@circlon/angular-tree-component'; |
7 | import { NgbNavModule, NgbPopoverModule, NgbTooltipModule } from '@ng-bootstrap/ng-bootstrap'; | |
8 | import { NgxPipeFunctionModule } from 'ngx-pipe-function'; | |
11fdf7f2 | 9 | |
f67539c2 TL |
10 | import { ActionLabels, URLVerbs } from '~/app/shared/constants/app.constants'; |
11 | import { FeatureTogglesGuardService } from '~/app/shared/services/feature-toggles-guard.service'; | |
2a845540 | 12 | import { ModuleStatusGuardService } from '~/app/shared/services/module-status-guard.service'; |
f67539c2 | 13 | import { SharedModule } from '~/app/shared/shared.module'; |
eafe8130 | 14 | import { IscsiSettingComponent } from './iscsi-setting/iscsi-setting.component'; |
11fdf7f2 TL |
15 | import { IscsiTabsComponent } from './iscsi-tabs/iscsi-tabs.component'; |
16 | import { IscsiTargetDetailsComponent } from './iscsi-target-details/iscsi-target-details.component'; | |
17 | import { IscsiTargetDiscoveryModalComponent } from './iscsi-target-discovery-modal/iscsi-target-discovery-modal.component'; | |
18 | import { IscsiTargetFormComponent } from './iscsi-target-form/iscsi-target-form.component'; | |
19 | import { IscsiTargetImageSettingsModalComponent } from './iscsi-target-image-settings-modal/iscsi-target-image-settings-modal.component'; | |
20 | import { IscsiTargetIqnSettingsModalComponent } from './iscsi-target-iqn-settings-modal/iscsi-target-iqn-settings-modal.component'; | |
21 | import { IscsiTargetListComponent } from './iscsi-target-list/iscsi-target-list.component'; | |
22 | import { IscsiComponent } from './iscsi/iscsi.component'; | |
23 | import { MirroringModule } from './mirroring/mirroring.module'; | |
24 | import { OverviewComponent as RbdMirroringComponent } from './mirroring/overview/overview.component'; | |
2a845540 | 25 | import { PoolEditModeModalComponent } from './mirroring/pool-edit-mode-modal/pool-edit-mode-modal.component'; |
11fdf7f2 TL |
26 | import { RbdConfigurationFormComponent } from './rbd-configuration-form/rbd-configuration-form.component'; |
27 | import { RbdConfigurationListComponent } from './rbd-configuration-list/rbd-configuration-list.component'; | |
28 | import { RbdDetailsComponent } from './rbd-details/rbd-details.component'; | |
29 | import { RbdFormComponent } from './rbd-form/rbd-form.component'; | |
11fdf7f2 | 30 | import { RbdListComponent } from './rbd-list/rbd-list.component'; |
9f95a23c TL |
31 | import { RbdNamespaceFormModalComponent } from './rbd-namespace-form/rbd-namespace-form-modal.component'; |
32 | import { RbdNamespaceListComponent } from './rbd-namespace-list/rbd-namespace-list.component'; | |
33 | import { RbdPerformanceComponent } from './rbd-performance/rbd-performance.component'; | |
34 | import { RbdSnapshotFormModalComponent } from './rbd-snapshot-form/rbd-snapshot-form-modal.component'; | |
11fdf7f2 | 35 | import { RbdSnapshotListComponent } from './rbd-snapshot-list/rbd-snapshot-list.component'; |
9f95a23c | 36 | import { RbdTabsComponent } from './rbd-tabs/rbd-tabs.component'; |
11fdf7f2 TL |
37 | import { RbdTrashListComponent } from './rbd-trash-list/rbd-trash-list.component'; |
38 | import { RbdTrashMoveModalComponent } from './rbd-trash-move-modal/rbd-trash-move-modal.component'; | |
39 | import { RbdTrashPurgeModalComponent } from './rbd-trash-purge-modal/rbd-trash-purge-modal.component'; | |
40 | import { RbdTrashRestoreModalComponent } from './rbd-trash-restore-modal/rbd-trash-restore-modal.component'; | |
41 | ||
42 | @NgModule({ | |
11fdf7f2 TL |
43 | imports: [ |
44 | CommonModule, | |
45 | MirroringModule, | |
46 | FormsModule, | |
47 | ReactiveFormsModule, | |
f67539c2 TL |
48 | NgbNavModule, |
49 | NgbPopoverModule, | |
50 | NgbTooltipModule, | |
51 | NgxPipeFunctionModule, | |
11fdf7f2 TL |
52 | SharedModule, |
53 | RouterModule, | |
f67539c2 | 54 | TreeModule |
11fdf7f2 TL |
55 | ], |
56 | declarations: [ | |
57 | RbdListComponent, | |
58 | IscsiComponent, | |
eafe8130 | 59 | IscsiSettingComponent, |
11fdf7f2 TL |
60 | IscsiTabsComponent, |
61 | IscsiTargetListComponent, | |
62 | RbdDetailsComponent, | |
63 | RbdFormComponent, | |
9f95a23c TL |
64 | RbdNamespaceFormModalComponent, |
65 | RbdNamespaceListComponent, | |
11fdf7f2 | 66 | RbdSnapshotListComponent, |
9f95a23c | 67 | RbdSnapshotFormModalComponent, |
11fdf7f2 TL |
68 | RbdTrashListComponent, |
69 | RbdTrashMoveModalComponent, | |
11fdf7f2 TL |
70 | RbdTrashRestoreModalComponent, |
71 | RbdTrashPurgeModalComponent, | |
72 | IscsiTargetDetailsComponent, | |
73 | IscsiTargetFormComponent, | |
74 | IscsiTargetImageSettingsModalComponent, | |
75 | IscsiTargetIqnSettingsModalComponent, | |
76 | IscsiTargetDiscoveryModalComponent, | |
77 | RbdConfigurationListComponent, | |
9f95a23c TL |
78 | RbdConfigurationFormComponent, |
79 | RbdTabsComponent, | |
80 | RbdPerformanceComponent | |
11fdf7f2 TL |
81 | ], |
82 | exports: [RbdConfigurationListComponent, RbdConfigurationFormComponent] | |
83 | }) | |
84 | export class BlockModule {} | |
85 | ||
86 | /* The following breakdown is needed to allow importing block.module without | |
87 | the routes (e.g.: this module is imported by pool.module for RBD QoS | |
88 | components) | |
89 | */ | |
90 | const routes: Routes = [ | |
91 | { path: '', redirectTo: 'rbd', pathMatch: 'full' }, | |
92 | { | |
93 | path: 'rbd', | |
2a845540 TL |
94 | canActivate: [FeatureTogglesGuardService, ModuleStatusGuardService], |
95 | data: { | |
96 | moduleStatusGuardConfig: { | |
97 | uiApiPath: 'block/rbd', | |
98 | redirectTo: 'error', | |
99 | header: 'No RBD pools available', | |
100 | button_name: 'Create RBD pool', | |
101 | button_route: '/pool/create' | |
102 | }, | |
103 | breadcrumbs: 'Images' | |
104 | }, | |
11fdf7f2 | 105 | children: [ |
9f95a23c TL |
106 | { path: '', component: RbdListComponent }, |
107 | { | |
108 | path: 'namespaces', | |
109 | component: RbdNamespaceListComponent, | |
110 | data: { breadcrumbs: 'Namespaces' } | |
111 | }, | |
112 | { | |
113 | path: 'trash', | |
114 | component: RbdTrashListComponent, | |
115 | data: { breadcrumbs: 'Trash' } | |
116 | }, | |
117 | { | |
118 | path: 'performance', | |
119 | component: RbdPerformanceComponent, | |
120 | data: { breadcrumbs: 'Overall Performance' } | |
121 | }, | |
11fdf7f2 TL |
122 | { |
123 | path: URLVerbs.CREATE, | |
124 | component: RbdFormComponent, | |
125 | data: { breadcrumbs: ActionLabels.CREATE } | |
126 | }, | |
127 | { | |
9f95a23c | 128 | path: `${URLVerbs.EDIT}/:image_spec`, |
11fdf7f2 TL |
129 | component: RbdFormComponent, |
130 | data: { breadcrumbs: ActionLabels.EDIT } | |
131 | }, | |
132 | { | |
9f95a23c | 133 | path: `${URLVerbs.CLONE}/:image_spec/:snap`, |
11fdf7f2 TL |
134 | component: RbdFormComponent, |
135 | data: { breadcrumbs: ActionLabels.CLONE } | |
136 | }, | |
137 | { | |
9f95a23c | 138 | path: `${URLVerbs.COPY}/:image_spec`, |
11fdf7f2 TL |
139 | component: RbdFormComponent, |
140 | data: { breadcrumbs: ActionLabels.COPY } | |
141 | }, | |
142 | { | |
9f95a23c | 143 | path: `${URLVerbs.COPY}/:image_spec/:snap`, |
11fdf7f2 TL |
144 | component: RbdFormComponent, |
145 | data: { breadcrumbs: ActionLabels.COPY } | |
146 | } | |
147 | ] | |
148 | }, | |
149 | { | |
150 | path: 'mirroring', | |
151 | component: RbdMirroringComponent, | |
2a845540 TL |
152 | canActivate: [FeatureTogglesGuardService, ModuleStatusGuardService], |
153 | data: { | |
154 | moduleStatusGuardConfig: { | |
155 | uiApiPath: 'block/mirroring', | |
156 | redirectTo: 'error', | |
157 | header: $localize`RBD mirroring is not configured`, | |
158 | button_name: $localize`Configure RBD Mirroring`, | |
159 | button_title: $localize`This will create rbd-mirror service and a replicated RBD pool`, | |
160 | component: 'RBD Mirroring', | |
161 | uiConfig: true | |
162 | }, | |
163 | breadcrumbs: 'Mirroring' | |
164 | }, | |
165 | children: [ | |
166 | { | |
167 | path: `${URLVerbs.EDIT}/:pool_name`, | |
168 | component: PoolEditModeModalComponent, | |
169 | outlet: 'modal' | |
170 | } | |
171 | ] | |
11fdf7f2 TL |
172 | }, |
173 | // iSCSI | |
174 | { | |
175 | path: 'iscsi', | |
176 | canActivate: [FeatureTogglesGuardService], | |
177 | data: { breadcrumbs: 'iSCSI' }, | |
178 | children: [ | |
179 | { path: '', redirectTo: 'overview', pathMatch: 'full' }, | |
180 | { path: 'overview', component: IscsiComponent, data: { breadcrumbs: 'Overview' } }, | |
181 | { | |
182 | path: 'targets', | |
183 | data: { breadcrumbs: 'Targets' }, | |
184 | children: [ | |
185 | { path: '', component: IscsiTargetListComponent }, | |
186 | { | |
eafe8130 | 187 | path: URLVerbs.CREATE, |
11fdf7f2 | 188 | component: IscsiTargetFormComponent, |
eafe8130 | 189 | data: { breadcrumbs: ActionLabels.CREATE } |
11fdf7f2 TL |
190 | }, |
191 | { | |
192 | path: `${URLVerbs.EDIT}/:target_iqn`, | |
193 | component: IscsiTargetFormComponent, | |
194 | data: { breadcrumbs: ActionLabels.EDIT } | |
195 | } | |
196 | ] | |
197 | } | |
198 | ] | |
199 | } | |
200 | ]; | |
201 | ||
202 | @NgModule({ | |
203 | imports: [BlockModule, RouterModule.forChild(routes)] | |
204 | }) | |
205 | export class RoutedBlockModule {} |