2019-08-12 19:34:23 +03:00
|
|
|
///
|
2022-01-17 14:07:46 +02:00
|
|
|
/// Copyright © 2016-2022 The Thingsboard Authors
|
2019-08-12 19:34:23 +03:00
|
|
|
///
|
|
|
|
|
/// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
|
/// you may not use this file except in compliance with the License.
|
|
|
|
|
/// You may obtain a copy of the License at
|
|
|
|
|
///
|
|
|
|
|
/// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
///
|
|
|
|
|
/// Unless required by applicable law or agreed to in writing, software
|
|
|
|
|
/// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
|
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
|
/// See the License for the specific language governing permissions and
|
|
|
|
|
/// limitations under the License.
|
|
|
|
|
///
|
|
|
|
|
|
2020-10-14 16:43:07 +03:00
|
|
|
import { Injectable, NgModule } from '@angular/core';
|
|
|
|
|
import { Resolve, RouterModule, Routes } from '@angular/router';
|
2019-08-12 19:34:23 +03:00
|
|
|
|
|
|
|
|
import { MailServerComponent } from '@modules/home/pages/admin/mail-server.component';
|
|
|
|
|
import { ConfirmOnExitGuard } from '@core/guards/confirm-on-exit.guard';
|
|
|
|
|
import { Authority } from '@shared/models/authority.enum';
|
2020-04-02 11:01:13 +03:00
|
|
|
import { GeneralSettingsComponent } from '@modules/home/pages/admin/general-settings.component';
|
|
|
|
|
import { SecuritySettingsComponent } from '@modules/home/pages/admin/security-settings.component';
|
2020-07-09 13:47:35 +03:00
|
|
|
import { OAuth2SettingsComponent } from '@home/pages/admin/oauth2-settings.component';
|
2020-10-14 16:43:07 +03:00
|
|
|
import { Observable } from 'rxjs';
|
|
|
|
|
import { OAuth2Service } from '@core/http/oauth2.service';
|
2020-11-20 13:08:20 +02:00
|
|
|
import { SmsProviderComponent } from '@home/pages/admin/sms-provider.component';
|
2021-02-03 12:21:55 +02:00
|
|
|
import { HomeSettingsComponent } from '@home/pages/admin/home-settings.component';
|
2021-04-29 16:55:05 +03:00
|
|
|
import { EntitiesTableComponent } from '@home/components/entity/entities-table.component';
|
|
|
|
|
import { ResourcesLibraryTableConfigResolver } from '@home/pages/admin/resource/resources-library-table-config.resolve';
|
2021-12-28 12:01:26 +02:00
|
|
|
import { EntityDetailsPageComponent } from '@home/components/entity/entity-details-page.component';
|
2022-01-12 19:28:42 +02:00
|
|
|
import { entityDetailsPageBreadcrumbLabelFunction } from '@home/pages/home-pages.models';
|
2021-12-28 12:01:26 +02:00
|
|
|
import { BreadCrumbConfig } from '@shared/components/breadcrumb';
|
2022-02-18 16:41:24 +02:00
|
|
|
import { QueuesTableConfigResolver } from '@home/pages/admin/queue/queues-table-config.resolver';
|
2022-05-31 16:16:24 +03:00
|
|
|
import { RepositoryAdminSettingsComponent } from '@home/pages/admin/repository-admin-settings.component';
|
2022-05-31 18:42:33 +03:00
|
|
|
import { AutoCommitAdminSettingsComponent } from '@home/pages/admin/auto-commit-admin-settings.component';
|
2022-04-28 23:03:37 +03:00
|
|
|
import { TwoFactorAuthSettingsComponent } from '@home/pages/admin/two-factor-auth-settings.component';
|
2023-02-07 16:42:36 +02:00
|
|
|
import { NotificationSettingsComponent } from '@home/pages/admin/notification-settings.component';
|
2020-10-14 16:43:07 +03:00
|
|
|
|
|
|
|
|
@Injectable()
|
|
|
|
|
export class OAuth2LoginProcessingUrlResolver implements Resolve<string> {
|
|
|
|
|
|
|
|
|
|
constructor(private oauth2Service: OAuth2Service) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
resolve(): Observable<string> {
|
|
|
|
|
return this.oauth2Service.getLoginProcessingUrl();
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-08-12 19:34:23 +03:00
|
|
|
|
|
|
|
|
const routes: Routes = [
|
|
|
|
|
{
|
|
|
|
|
path: 'settings',
|
|
|
|
|
data: {
|
2021-02-03 12:21:55 +02:00
|
|
|
auth: [Authority.SYS_ADMIN, Authority.TENANT_ADMIN],
|
2019-08-12 19:34:23 +03:00
|
|
|
breadcrumb: {
|
|
|
|
|
label: 'admin.system-settings',
|
|
|
|
|
icon: 'settings'
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
children: [
|
|
|
|
|
{
|
|
|
|
|
path: '',
|
2021-02-03 12:21:55 +02:00
|
|
|
data: {
|
|
|
|
|
auth: [Authority.SYS_ADMIN, Authority.TENANT_ADMIN],
|
|
|
|
|
redirectTo: {
|
|
|
|
|
SYS_ADMIN: '/settings/general',
|
|
|
|
|
TENANT_ADMIN: '/settings/home'
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-08-12 19:34:23 +03:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
path: 'general',
|
|
|
|
|
component: GeneralSettingsComponent,
|
|
|
|
|
canDeactivate: [ConfirmOnExitGuard],
|
|
|
|
|
data: {
|
|
|
|
|
auth: [Authority.SYS_ADMIN],
|
|
|
|
|
title: 'admin.general-settings',
|
|
|
|
|
breadcrumb: {
|
|
|
|
|
label: 'admin.general',
|
|
|
|
|
icon: 'settings_applications'
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
path: 'outgoing-mail',
|
|
|
|
|
component: MailServerComponent,
|
|
|
|
|
canDeactivate: [ConfirmOnExitGuard],
|
|
|
|
|
data: {
|
|
|
|
|
auth: [Authority.SYS_ADMIN],
|
|
|
|
|
title: 'admin.outgoing-mail-settings',
|
|
|
|
|
breadcrumb: {
|
|
|
|
|
label: 'admin.outgoing-mail',
|
|
|
|
|
icon: 'mail'
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
2020-11-20 13:08:20 +02:00
|
|
|
{
|
|
|
|
|
path: 'sms-provider',
|
|
|
|
|
component: SmsProviderComponent,
|
|
|
|
|
canDeactivate: [ConfirmOnExitGuard],
|
|
|
|
|
data: {
|
|
|
|
|
auth: [Authority.SYS_ADMIN],
|
|
|
|
|
title: 'admin.sms-provider-settings',
|
|
|
|
|
breadcrumb: {
|
|
|
|
|
label: 'admin.sms-provider',
|
|
|
|
|
icon: 'sms'
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
2019-08-12 19:34:23 +03:00
|
|
|
{
|
|
|
|
|
path: 'security-settings',
|
|
|
|
|
component: SecuritySettingsComponent,
|
|
|
|
|
canDeactivate: [ConfirmOnExitGuard],
|
|
|
|
|
data: {
|
|
|
|
|
auth: [Authority.SYS_ADMIN],
|
|
|
|
|
title: 'admin.security-settings',
|
|
|
|
|
breadcrumb: {
|
|
|
|
|
label: 'admin.security-settings',
|
|
|
|
|
icon: 'security'
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-07-09 13:47:35 +03:00
|
|
|
},
|
|
|
|
|
{
|
2020-09-08 17:05:13 +03:00
|
|
|
path: 'oauth2',
|
2020-07-09 13:47:35 +03:00
|
|
|
component: OAuth2SettingsComponent,
|
|
|
|
|
canDeactivate: [ConfirmOnExitGuard],
|
|
|
|
|
data: {
|
2020-09-21 16:10:00 +03:00
|
|
|
auth: [Authority.SYS_ADMIN],
|
2020-09-08 17:05:13 +03:00
|
|
|
title: 'admin.oauth2.oauth2',
|
2020-07-09 13:47:35 +03:00
|
|
|
breadcrumb: {
|
2020-09-08 17:05:13 +03:00
|
|
|
label: 'admin.oauth2.oauth2',
|
2020-07-09 13:47:35 +03:00
|
|
|
icon: 'security'
|
|
|
|
|
}
|
2020-10-14 16:43:07 +03:00
|
|
|
},
|
|
|
|
|
resolve: {
|
|
|
|
|
loginProcessingUrl: OAuth2LoginProcessingUrlResolver
|
2020-07-09 13:47:35 +03:00
|
|
|
}
|
2021-02-03 12:21:55 +02:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
path: 'home',
|
|
|
|
|
component: HomeSettingsComponent,
|
|
|
|
|
canDeactivate: [ConfirmOnExitGuard],
|
|
|
|
|
data: {
|
|
|
|
|
auth: [Authority.TENANT_ADMIN],
|
|
|
|
|
title: 'admin.home-settings',
|
|
|
|
|
breadcrumb: {
|
|
|
|
|
label: 'admin.home-settings',
|
|
|
|
|
icon: 'settings_applications'
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-04-29 16:55:05 +03:00
|
|
|
},
|
2023-02-07 16:42:36 +02:00
|
|
|
{
|
|
|
|
|
path: 'notification',
|
|
|
|
|
component: NotificationSettingsComponent,
|
|
|
|
|
canDeactivate: [ConfirmOnExitGuard],
|
|
|
|
|
data: {
|
|
|
|
|
auth: [Authority.TENANT_ADMIN, Authority.SYS_ADMIN],
|
|
|
|
|
title: 'admin.notification.notification-settings',
|
|
|
|
|
breadcrumb: {
|
|
|
|
|
label: 'admin.notification.notification-settings',
|
|
|
|
|
icon: 'notifications'
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
2021-04-29 16:55:05 +03:00
|
|
|
{
|
|
|
|
|
path: 'resources-library',
|
|
|
|
|
data: {
|
|
|
|
|
breadcrumb: {
|
|
|
|
|
label: 'resource.resources-library',
|
|
|
|
|
icon: 'folder'
|
|
|
|
|
}
|
|
|
|
|
},
|
2021-12-28 12:01:26 +02:00
|
|
|
children: [
|
|
|
|
|
{
|
|
|
|
|
path: '',
|
|
|
|
|
component: EntitiesTableComponent,
|
|
|
|
|
data: {
|
|
|
|
|
auth: [Authority.TENANT_ADMIN, Authority.SYS_ADMIN],
|
|
|
|
|
title: 'resource.resources-library',
|
|
|
|
|
},
|
|
|
|
|
resolve: {
|
|
|
|
|
entitiesTableConfig: ResourcesLibraryTableConfigResolver
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
path: ':entityId',
|
|
|
|
|
component: EntityDetailsPageComponent,
|
|
|
|
|
canDeactivate: [ConfirmOnExitGuard],
|
|
|
|
|
data: {
|
|
|
|
|
breadcrumb: {
|
|
|
|
|
labelFunction: entityDetailsPageBreadcrumbLabelFunction,
|
|
|
|
|
icon: 'folder'
|
|
|
|
|
} as BreadCrumbConfig<EntityDetailsPageComponent>,
|
|
|
|
|
auth: [Authority.TENANT_ADMIN, Authority.SYS_ADMIN],
|
|
|
|
|
title: 'resource.resources-library'
|
|
|
|
|
},
|
|
|
|
|
resolve: {
|
|
|
|
|
entitiesTableConfig: ResourcesLibraryTableConfigResolver
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
]
|
2022-02-18 16:41:24 +02:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
path: 'queues',
|
|
|
|
|
data: {
|
|
|
|
|
breadcrumb: {
|
|
|
|
|
label: 'admin.queues',
|
|
|
|
|
icon: 'swap_calls'
|
|
|
|
|
}
|
|
|
|
|
},
|
2022-05-05 11:02:45 +03:00
|
|
|
children: [
|
|
|
|
|
{
|
|
|
|
|
path: '',
|
|
|
|
|
component: EntitiesTableComponent,
|
|
|
|
|
data: {
|
|
|
|
|
auth: [Authority.SYS_ADMIN],
|
|
|
|
|
title: 'admin.queues'
|
|
|
|
|
},
|
|
|
|
|
resolve: {
|
|
|
|
|
entitiesTableConfig: QueuesTableConfigResolver
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
path: ':entityId',
|
|
|
|
|
component: EntityDetailsPageComponent,
|
|
|
|
|
canDeactivate: [ConfirmOnExitGuard],
|
|
|
|
|
data: {
|
|
|
|
|
breadcrumb: {
|
|
|
|
|
labelFunction: entityDetailsPageBreadcrumbLabelFunction,
|
|
|
|
|
icon: 'swap_calls'
|
|
|
|
|
} as BreadCrumbConfig<EntityDetailsPageComponent>,
|
|
|
|
|
auth: [Authority.SYS_ADMIN],
|
|
|
|
|
title: 'admin.queues'
|
|
|
|
|
},
|
|
|
|
|
resolve: {
|
|
|
|
|
entitiesTableConfig: QueuesTableConfigResolver
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
]
|
2022-05-23 17:55:43 +03:00
|
|
|
},
|
2022-05-20 15:02:30 +03:00
|
|
|
{
|
2022-04-28 23:03:37 +03:00
|
|
|
path: '2fa',
|
|
|
|
|
component: TwoFactorAuthSettingsComponent,
|
|
|
|
|
canDeactivate: [ConfirmOnExitGuard],
|
|
|
|
|
data: {
|
2022-05-16 17:21:04 +03:00
|
|
|
auth: [Authority.SYS_ADMIN],
|
2022-04-28 23:03:37 +03:00
|
|
|
title: 'admin.2fa.2fa',
|
|
|
|
|
breadcrumb: {
|
|
|
|
|
label: 'admin.2fa.2fa',
|
|
|
|
|
icon: 'mdi:two-factor-authentication',
|
|
|
|
|
isMdiIcon: true
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-06-02 13:59:15 +03:00
|
|
|
},
|
|
|
|
|
{
|
2022-05-31 16:16:24 +03:00
|
|
|
path: 'repository',
|
|
|
|
|
component: RepositoryAdminSettingsComponent,
|
2022-05-20 15:02:30 +03:00
|
|
|
canDeactivate: [ConfirmOnExitGuard],
|
|
|
|
|
data: {
|
|
|
|
|
auth: [Authority.TENANT_ADMIN],
|
2022-05-31 16:16:24 +03:00
|
|
|
title: 'admin.repository-settings',
|
2022-05-20 15:02:30 +03:00
|
|
|
breadcrumb: {
|
2022-05-31 16:16:24 +03:00
|
|
|
label: 'admin.repository-settings',
|
2022-05-20 15:02:30 +03:00
|
|
|
icon: 'manage_history'
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-05-31 18:42:33 +03:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
path: 'auto-commit',
|
|
|
|
|
component: AutoCommitAdminSettingsComponent,
|
|
|
|
|
canDeactivate: [ConfirmOnExitGuard],
|
|
|
|
|
data: {
|
|
|
|
|
auth: [Authority.TENANT_ADMIN],
|
|
|
|
|
title: 'admin.auto-commit-settings',
|
|
|
|
|
breadcrumb: {
|
|
|
|
|
label: 'admin.auto-commit-settings',
|
|
|
|
|
icon: 'settings_backup_restore'
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-08-12 19:34:23 +03:00
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
@NgModule({
|
|
|
|
|
imports: [RouterModule.forChild(routes)],
|
2020-10-14 16:43:07 +03:00
|
|
|
exports: [RouterModule],
|
|
|
|
|
providers: [
|
2021-04-29 16:55:05 +03:00
|
|
|
OAuth2LoginProcessingUrlResolver,
|
2022-02-18 16:41:24 +02:00
|
|
|
ResourcesLibraryTableConfigResolver,
|
|
|
|
|
QueuesTableConfigResolver
|
2020-10-14 16:43:07 +03:00
|
|
|
]
|
2019-08-12 19:34:23 +03:00
|
|
|
})
|
|
|
|
|
export class AdminRoutingModule { }
|