Merge pull request #4520 from vvlladd28/improvement/menu-system-settings

UI: Move Resource library to system settings menu
This commit is contained in:
Vladyslav 2021-04-30 08:53:48 +03:00 committed by GitHub
commit 069a51c05c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 75 additions and 135 deletions

View File

@ -103,19 +103,12 @@ export class MenuService {
path: '/widgets-bundles', path: '/widgets-bundles',
icon: 'now_widgets' icon: 'now_widgets'
}, },
{
id: guid(),
name: 'resource.resources-library',
type: 'link',
path: '/resources-library',
icon: 'folder'
},
{ {
id: guid(), id: guid(),
name: 'admin.system-settings', name: 'admin.system-settings',
type: 'toggle', type: 'toggle',
path: '/settings', path: '/settings',
height: '200px', height: '240px',
icon: 'settings', icon: 'settings',
pages: [ pages: [
{ {
@ -152,6 +145,13 @@ export class MenuService {
type: 'link', type: 'link',
path: '/settings/oauth2', path: '/settings/oauth2',
icon: 'security' icon: 'security'
},
{
id: guid(),
name: 'resource.resources-library',
type: 'link',
path: '/settings/resources-library',
icon: 'folder'
} }
] ]
} }
@ -188,16 +188,6 @@ export class MenuService {
} }
] ]
}, },
{
name: 'resource.management',
places: [
{
name: 'resource.resources-library',
icon: 'folder',
path: '/resources-library'
}
]
},
{ {
name: 'admin.system-settings', name: 'admin.system-settings',
places: [ places: [
@ -225,6 +215,11 @@ export class MenuService {
name: 'admin.oauth2.oauth2', name: 'admin.oauth2.oauth2',
icon: 'security', icon: 'security',
path: '/settings/oauth2' path: '/settings/oauth2'
},
{
name: 'resource.resources-library',
icon: 'folder',
path: '/resources-library'
} }
] ]
} }
@ -337,20 +332,6 @@ export class MenuService {
path: '/dashboards', path: '/dashboards',
icon: 'dashboards' icon: 'dashboards'
}, },
{
id: guid(),
name: 'resource.resources-library',
type: 'link',
path: '/resources-library',
icon: 'folder'
},
{
id: guid(),
name: 'admin.home-settings',
type: 'link',
path: '/settings/home',
icon: 'settings_applications'
},
{ {
id: guid(), id: guid(),
name: 'audit-log.audit-logs', name: 'audit-log.audit-logs',
@ -365,6 +346,30 @@ export class MenuService {
path: '/usage', path: '/usage',
icon: 'insert_chart', icon: 'insert_chart',
notExact: true notExact: true
},
{
id: guid(),
name: 'admin.system-settings',
type: 'toggle',
path: '/settings',
height: '80px',
icon: 'settings',
pages: [
{
id: guid(),
name: 'admin.home-settings',
type: 'link',
path: '/settings/home',
icon: 'settings_applications'
},
{
id: guid(),
name: 'resource.resources-library',
type: 'link',
path: '/settings/resources-library',
icon: 'folder'
}
]
} }
); );
return sections; return sections;
@ -455,16 +460,6 @@ export class MenuService {
); );
} }
homeSections.push( homeSections.push(
{
name: 'resource.management',
places: [
{
name: 'resource.resources-library',
icon: 'folder',
path: '/resources-library'
}
]
},
{ {
name: 'dashboard.management', name: 'dashboard.management',
places: [ places: [
@ -494,6 +489,21 @@ export class MenuService {
path: '/usage' path: '/usage'
} }
] ]
},
{
name: 'admin.system-settings',
places: [
{
name: 'admin.home-settings',
icon: 'settings_applications',
path: '/settings/home'
},
{
name: 'resource.resources-library',
icon: 'folder',
path: '/settings/resources-library'
}
]
} }
); );
return homeSections; return homeSections;

View File

@ -23,16 +23,12 @@ import { Authority } from '@shared/models/authority.enum';
import { GeneralSettingsComponent } from '@modules/home/pages/admin/general-settings.component'; import { GeneralSettingsComponent } from '@modules/home/pages/admin/general-settings.component';
import { SecuritySettingsComponent } from '@modules/home/pages/admin/security-settings.component'; import { SecuritySettingsComponent } from '@modules/home/pages/admin/security-settings.component';
import { OAuth2SettingsComponent } from '@home/pages/admin/oauth2-settings.component'; import { OAuth2SettingsComponent } from '@home/pages/admin/oauth2-settings.component';
import { User } from '@shared/models/user.model';
import { Store } from '@ngrx/store';
import { AppState } from '@core/core.state';
import { UserService } from '@core/http/user.service';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
import { getCurrentAuthUser } from '@core/auth/auth.selectors';
import { OAuth2Service } from '@core/http/oauth2.service'; import { OAuth2Service } from '@core/http/oauth2.service';
import { UserProfileResolver } from '@home/pages/profile/profile-routing.module';
import { SmsProviderComponent } from '@home/pages/admin/sms-provider.component'; import { SmsProviderComponent } from '@home/pages/admin/sms-provider.component';
import { HomeSettingsComponent } from '@home/pages/admin/home-settings.component'; import { HomeSettingsComponent } from '@home/pages/admin/home-settings.component';
import { EntitiesTableComponent } from '@home/components/entity/entities-table.component';
import { ResourcesLibraryTableConfigResolver } from '@home/pages/admin/resource/resources-library-table-config.resolve';
@Injectable() @Injectable()
export class OAuth2LoginProcessingUrlResolver implements Resolve<string> { export class OAuth2LoginProcessingUrlResolver implements Resolve<string> {
@ -146,6 +142,21 @@ const routes: Routes = [
icon: 'settings_applications' icon: 'settings_applications'
} }
} }
},
{
path: 'resources-library',
component: EntitiesTableComponent,
data: {
auth: [Authority.TENANT_ADMIN, Authority.SYS_ADMIN],
title: 'resource.resources-library',
breadcrumb: {
label: 'resource.resources-library',
icon: 'folder'
}
},
resolve: {
entitiesTableConfig: ResourcesLibraryTableConfigResolver
}
} }
] ]
} }
@ -155,7 +166,8 @@ const routes: Routes = [
imports: [RouterModule.forChild(routes)], imports: [RouterModule.forChild(routes)],
exports: [RouterModule], exports: [RouterModule],
providers: [ providers: [
OAuth2LoginProcessingUrlResolver OAuth2LoginProcessingUrlResolver,
ResourcesLibraryTableConfigResolver
] ]
}) })
export class AdminRoutingModule { } export class AdminRoutingModule { }

View File

@ -27,6 +27,7 @@ import { OAuth2SettingsComponent } from '@modules/home/pages/admin/oauth2-settin
import { SmsProviderComponent } from '@home/pages/admin/sms-provider.component'; import { SmsProviderComponent } from '@home/pages/admin/sms-provider.component';
import { SendTestSmsDialogComponent } from '@home/pages/admin/send-test-sms-dialog.component'; import { SendTestSmsDialogComponent } from '@home/pages/admin/send-test-sms-dialog.component';
import { HomeSettingsComponent } from '@home/pages/admin/home-settings.component'; import { HomeSettingsComponent } from '@home/pages/admin/home-settings.component';
import { ResourcesLibraryComponent } from '@home/pages/admin/resource/resources-library.component';
@NgModule({ @NgModule({
declarations: declarations:
@ -37,7 +38,8 @@ import { HomeSettingsComponent } from '@home/pages/admin/home-settings.component
SendTestSmsDialogComponent, SendTestSmsDialogComponent,
SecuritySettingsComponent, SecuritySettingsComponent,
OAuth2SettingsComponent, OAuth2SettingsComponent,
HomeSettingsComponent HomeSettingsComponent,
ResourcesLibraryComponent
], ],
imports: [ imports: [
CommonModule, CommonModule,

View File

@ -32,7 +32,7 @@ import { getCurrentAuthUser } from '@core/auth/auth.selectors';
import { Store } from '@ngrx/store'; import { Store } from '@ngrx/store';
import { AppState } from '@core/core.state'; import { AppState } from '@core/core.state';
import { Authority } from '@shared/models/authority.enum'; import { Authority } from '@shared/models/authority.enum';
import { ResourcesLibraryComponent } from '@home/pages/resource/resources-library.component'; import { ResourcesLibraryComponent } from '@home/pages/admin/resource/resources-library.component';
import { PageLink } from '@shared/models/page/page-link'; import { PageLink } from '@shared/models/page/page-link';
import { EntityAction } from '@home/models/entity/entity-component.models'; import { EntityAction } from '@home/models/entity/entity-component.models';
import { map } from 'rxjs/operators'; import { map } from 'rxjs/operators';

View File

@ -35,7 +35,6 @@ import { modulesMap } from '../../common/modules-map';
import { DeviceProfileModule } from './device-profile/device-profile.module'; import { DeviceProfileModule } from './device-profile/device-profile.module';
import { ApiUsageModule } from '@home/pages/api-usage/api-usage.module'; import { ApiUsageModule } from '@home/pages/api-usage/api-usage.module';
import { EdgeModule } from '@home/pages/edge/edge.module'; import { EdgeModule } from '@home/pages/edge/edge.module';
import { ResourceModule } from '@home/pages/resource/resource.module';
import { FirmwareModule } from '@home/pages/firmware/firmware.module'; import { FirmwareModule } from '@home/pages/firmware/firmware.module';
@NgModule({ @NgModule({
@ -56,7 +55,6 @@ import { FirmwareModule } from '@home/pages/firmware/firmware.module';
DashboardModule, DashboardModule,
AuditLogModule, AuditLogModule,
ApiUsageModule, ApiUsageModule,
ResourceModule,
FirmwareModule, FirmwareModule,
UserModule UserModule
], ],

View File

@ -1,48 +0,0 @@
///
/// Copyright © 2016-2021 The Thingsboard Authors
///
/// 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.
///
import { RouterModule, Routes } from '@angular/router';
import { EntitiesTableComponent } from '@home/components/entity/entities-table.component';
import { Authority } from '@shared/models/authority.enum';
import { NgModule } from '@angular/core';
import { ResourcesLibraryTableConfigResolver } from './resources-library-table-config.resolve';
const routes: Routes = [
{
path: 'resources-library',
component: EntitiesTableComponent,
data: {
auth: [Authority.TENANT_ADMIN, Authority.SYS_ADMIN],
title: 'resource.resources-library',
breadcrumb: {
label: 'resource.resources-library',
icon: 'folder'
}
},
resolve: {
entitiesTableConfig: ResourcesLibraryTableConfigResolver
}
}
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule],
providers: [
ResourcesLibraryTableConfigResolver
]
})
export class ResourcesLibraryRoutingModule{ }

View File

@ -1,33 +0,0 @@
///
/// Copyright © 2016-2021 The Thingsboard Authors
///
/// 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.
///
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { ResourcesLibraryRoutingModule } from '@home/pages/resource/resource-routing.module';
import { SharedModule } from '@shared/shared.module';
import { HomeComponentsModule } from '@home/components/home-components.module';
import { ResourcesLibraryComponent } from './resources-library.component';
@NgModule({
declarations: [ResourcesLibraryComponent],
imports: [
CommonModule,
SharedModule,
HomeComponentsModule,
ResourcesLibraryRoutingModule
]
})
export class ResourceModule { }

View File

@ -2247,7 +2247,6 @@
"drop-file": "Drop a resource file or click to select a file to upload.", "drop-file": "Drop a resource file or click to select a file to upload.",
"empty": "Resource is empty", "empty": "Resource is empty",
"export": "Export resource", "export": "Export resource",
"management": "Resource management",
"no-resource-matching": "No resource matching '{{widgetsBundle}}' were found.", "no-resource-matching": "No resource matching '{{widgetsBundle}}' were found.",
"no-resource-text": "No resources found", "no-resource-text": "No resources found",
"open-widgets-bundle": "Open widgets bundle", "open-widgets-bundle": "Open widgets bundle",