Commit 069a51c05c8a0d402728d2fc87d4e17b00b45cab

Authored by Vladyslav
Committed by GitHub
2 parents e6d3b1d3 52c34068

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

UI: Move Resource library to system settings menu
@@ -105,17 +105,10 @@ export class MenuService { @@ -105,17 +105,10 @@ export class MenuService {
105 }, 105 },
106 { 106 {
107 id: guid(), 107 id: guid(),
108 - name: 'resource.resources-library',  
109 - type: 'link',  
110 - path: '/resources-library',  
111 - icon: 'folder'  
112 - },  
113 - {  
114 - id: guid(),  
115 name: 'admin.system-settings', 108 name: 'admin.system-settings',
116 type: 'toggle', 109 type: 'toggle',
117 path: '/settings', 110 path: '/settings',
118 - height: '200px', 111 + height: '240px',
119 icon: 'settings', 112 icon: 'settings',
120 pages: [ 113 pages: [
121 { 114 {
@@ -152,6 +145,13 @@ export class MenuService { @@ -152,6 +145,13 @@ export class MenuService {
152 type: 'link', 145 type: 'link',
153 path: '/settings/oauth2', 146 path: '/settings/oauth2',
154 icon: 'security' 147 icon: 'security'
  148 + },
  149 + {
  150 + id: guid(),
  151 + name: 'resource.resources-library',
  152 + type: 'link',
  153 + path: '/settings/resources-library',
  154 + icon: 'folder'
155 } 155 }
156 ] 156 ]
157 } 157 }
@@ -189,16 +189,6 @@ export class MenuService { @@ -189,16 +189,6 @@ export class MenuService {
189 ] 189 ]
190 }, 190 },
191 { 191 {
192 - name: 'resource.management',  
193 - places: [  
194 - {  
195 - name: 'resource.resources-library',  
196 - icon: 'folder',  
197 - path: '/resources-library'  
198 - }  
199 - ]  
200 - },  
201 - {  
202 name: 'admin.system-settings', 192 name: 'admin.system-settings',
203 places: [ 193 places: [
204 { 194 {
@@ -225,6 +215,11 @@ export class MenuService { @@ -225,6 +215,11 @@ export class MenuService {
225 name: 'admin.oauth2.oauth2', 215 name: 'admin.oauth2.oauth2',
226 icon: 'security', 216 icon: 'security',
227 path: '/settings/oauth2' 217 path: '/settings/oauth2'
  218 + },
  219 + {
  220 + name: 'resource.resources-library',
  221 + icon: 'folder',
  222 + path: '/resources-library'
228 } 223 }
229 ] 224 ]
230 } 225 }
@@ -339,20 +334,6 @@ export class MenuService { @@ -339,20 +334,6 @@ export class MenuService {
339 }, 334 },
340 { 335 {
341 id: guid(), 336 id: guid(),
342 - name: 'resource.resources-library',  
343 - type: 'link',  
344 - path: '/resources-library',  
345 - icon: 'folder'  
346 - },  
347 - {  
348 - id: guid(),  
349 - name: 'admin.home-settings',  
350 - type: 'link',  
351 - path: '/settings/home',  
352 - icon: 'settings_applications'  
353 - },  
354 - {  
355 - id: guid(),  
356 name: 'audit-log.audit-logs', 337 name: 'audit-log.audit-logs',
357 type: 'link', 338 type: 'link',
358 path: '/auditLogs', 339 path: '/auditLogs',
@@ -365,6 +346,30 @@ export class MenuService { @@ -365,6 +346,30 @@ export class MenuService {
365 path: '/usage', 346 path: '/usage',
366 icon: 'insert_chart', 347 icon: 'insert_chart',
367 notExact: true 348 notExact: true
  349 + },
  350 + {
  351 + id: guid(),
  352 + name: 'admin.system-settings',
  353 + type: 'toggle',
  354 + path: '/settings',
  355 + height: '80px',
  356 + icon: 'settings',
  357 + pages: [
  358 + {
  359 + id: guid(),
  360 + name: 'admin.home-settings',
  361 + type: 'link',
  362 + path: '/settings/home',
  363 + icon: 'settings_applications'
  364 + },
  365 + {
  366 + id: guid(),
  367 + name: 'resource.resources-library',
  368 + type: 'link',
  369 + path: '/settings/resources-library',
  370 + icon: 'folder'
  371 + }
  372 + ]
368 } 373 }
369 ); 374 );
370 return sections; 375 return sections;
@@ -456,16 +461,6 @@ export class MenuService { @@ -456,16 +461,6 @@ export class MenuService {
456 } 461 }
457 homeSections.push( 462 homeSections.push(
458 { 463 {
459 - name: 'resource.management',  
460 - places: [  
461 - {  
462 - name: 'resource.resources-library',  
463 - icon: 'folder',  
464 - path: '/resources-library'  
465 - }  
466 - ]  
467 - },  
468 - {  
469 name: 'dashboard.management', 464 name: 'dashboard.management',
470 places: [ 465 places: [
471 { 466 {
@@ -494,6 +489,21 @@ export class MenuService { @@ -494,6 +489,21 @@ export class MenuService {
494 path: '/usage' 489 path: '/usage'
495 } 490 }
496 ] 491 ]
  492 + },
  493 + {
  494 + name: 'admin.system-settings',
  495 + places: [
  496 + {
  497 + name: 'admin.home-settings',
  498 + icon: 'settings_applications',
  499 + path: '/settings/home'
  500 + },
  501 + {
  502 + name: 'resource.resources-library',
  503 + icon: 'folder',
  504 + path: '/settings/resources-library'
  505 + }
  506 + ]
497 } 507 }
498 ); 508 );
499 return homeSections; 509 return homeSections;
@@ -23,16 +23,12 @@ import { Authority } from '@shared/models/authority.enum'; @@ -23,16 +23,12 @@ import { Authority } from '@shared/models/authority.enum';
23 import { GeneralSettingsComponent } from '@modules/home/pages/admin/general-settings.component'; 23 import { GeneralSettingsComponent } from '@modules/home/pages/admin/general-settings.component';
24 import { SecuritySettingsComponent } from '@modules/home/pages/admin/security-settings.component'; 24 import { SecuritySettingsComponent } from '@modules/home/pages/admin/security-settings.component';
25 import { OAuth2SettingsComponent } from '@home/pages/admin/oauth2-settings.component'; 25 import { OAuth2SettingsComponent } from '@home/pages/admin/oauth2-settings.component';
26 -import { User } from '@shared/models/user.model';  
27 -import { Store } from '@ngrx/store';  
28 -import { AppState } from '@core/core.state';  
29 -import { UserService } from '@core/http/user.service';  
30 import { Observable } from 'rxjs'; 26 import { Observable } from 'rxjs';
31 -import { getCurrentAuthUser } from '@core/auth/auth.selectors';  
32 import { OAuth2Service } from '@core/http/oauth2.service'; 27 import { OAuth2Service } from '@core/http/oauth2.service';
33 -import { UserProfileResolver } from '@home/pages/profile/profile-routing.module';  
34 import { SmsProviderComponent } from '@home/pages/admin/sms-provider.component'; 28 import { SmsProviderComponent } from '@home/pages/admin/sms-provider.component';
35 import { HomeSettingsComponent } from '@home/pages/admin/home-settings.component'; 29 import { HomeSettingsComponent } from '@home/pages/admin/home-settings.component';
  30 +import { EntitiesTableComponent } from '@home/components/entity/entities-table.component';
  31 +import { ResourcesLibraryTableConfigResolver } from '@home/pages/admin/resource/resources-library-table-config.resolve';
36 32
37 @Injectable() 33 @Injectable()
38 export class OAuth2LoginProcessingUrlResolver implements Resolve<string> { 34 export class OAuth2LoginProcessingUrlResolver implements Resolve<string> {
@@ -146,6 +142,21 @@ const routes: Routes = [ @@ -146,6 +142,21 @@ const routes: Routes = [
146 icon: 'settings_applications' 142 icon: 'settings_applications'
147 } 143 }
148 } 144 }
  145 + },
  146 + {
  147 + path: 'resources-library',
  148 + component: EntitiesTableComponent,
  149 + data: {
  150 + auth: [Authority.TENANT_ADMIN, Authority.SYS_ADMIN],
  151 + title: 'resource.resources-library',
  152 + breadcrumb: {
  153 + label: 'resource.resources-library',
  154 + icon: 'folder'
  155 + }
  156 + },
  157 + resolve: {
  158 + entitiesTableConfig: ResourcesLibraryTableConfigResolver
  159 + }
149 } 160 }
150 ] 161 ]
151 } 162 }
@@ -155,7 +166,8 @@ const routes: Routes = [ @@ -155,7 +166,8 @@ const routes: Routes = [
155 imports: [RouterModule.forChild(routes)], 166 imports: [RouterModule.forChild(routes)],
156 exports: [RouterModule], 167 exports: [RouterModule],
157 providers: [ 168 providers: [
158 - OAuth2LoginProcessingUrlResolver 169 + OAuth2LoginProcessingUrlResolver,
  170 + ResourcesLibraryTableConfigResolver
159 ] 171 ]
160 }) 172 })
161 export class AdminRoutingModule { } 173 export class AdminRoutingModule { }
@@ -27,6 +27,7 @@ import { OAuth2SettingsComponent } from '@modules/home/pages/admin/oauth2-settin @@ -27,6 +27,7 @@ import { OAuth2SettingsComponent } from '@modules/home/pages/admin/oauth2-settin
27 import { SmsProviderComponent } from '@home/pages/admin/sms-provider.component'; 27 import { SmsProviderComponent } from '@home/pages/admin/sms-provider.component';
28 import { SendTestSmsDialogComponent } from '@home/pages/admin/send-test-sms-dialog.component'; 28 import { SendTestSmsDialogComponent } from '@home/pages/admin/send-test-sms-dialog.component';
29 import { HomeSettingsComponent } from '@home/pages/admin/home-settings.component'; 29 import { HomeSettingsComponent } from '@home/pages/admin/home-settings.component';
  30 +import { ResourcesLibraryComponent } from '@home/pages/admin/resource/resources-library.component';
30 31
31 @NgModule({ 32 @NgModule({
32 declarations: 33 declarations:
@@ -37,7 +38,8 @@ import { HomeSettingsComponent } from '@home/pages/admin/home-settings.component @@ -37,7 +38,8 @@ import { HomeSettingsComponent } from '@home/pages/admin/home-settings.component
37 SendTestSmsDialogComponent, 38 SendTestSmsDialogComponent,
38 SecuritySettingsComponent, 39 SecuritySettingsComponent,
39 OAuth2SettingsComponent, 40 OAuth2SettingsComponent,
40 - HomeSettingsComponent 41 + HomeSettingsComponent,
  42 + ResourcesLibraryComponent
41 ], 43 ],
42 imports: [ 44 imports: [
43 CommonModule, 45 CommonModule,
ui-ngx/src/app/modules/home/pages/admin/resource/resources-library-table-config.resolve.ts renamed from ui-ngx/src/app/modules/home/pages/resource/resources-library-table-config.resolve.ts
@@ -32,7 +32,7 @@ import { getCurrentAuthUser } from '@core/auth/auth.selectors'; @@ -32,7 +32,7 @@ import { getCurrentAuthUser } from '@core/auth/auth.selectors';
32 import { Store } from '@ngrx/store'; 32 import { Store } from '@ngrx/store';
33 import { AppState } from '@core/core.state'; 33 import { AppState } from '@core/core.state';
34 import { Authority } from '@shared/models/authority.enum'; 34 import { Authority } from '@shared/models/authority.enum';
35 -import { ResourcesLibraryComponent } from '@home/pages/resource/resources-library.component'; 35 +import { ResourcesLibraryComponent } from '@home/pages/admin/resource/resources-library.component';
36 import { PageLink } from '@shared/models/page/page-link'; 36 import { PageLink } from '@shared/models/page/page-link';
37 import { EntityAction } from '@home/models/entity/entity-component.models'; 37 import { EntityAction } from '@home/models/entity/entity-component.models';
38 import { map } from 'rxjs/operators'; 38 import { map } from 'rxjs/operators';
ui-ngx/src/app/modules/home/pages/admin/resource/resources-library.component.html renamed from ui-ngx/src/app/modules/home/pages/resource/resources-library.component.html
ui-ngx/src/app/modules/home/pages/admin/resource/resources-library.component.ts renamed from ui-ngx/src/app/modules/home/pages/resource/resources-library.component.ts
@@ -35,7 +35,6 @@ import { modulesMap } from '../../common/modules-map'; @@ -35,7 +35,6 @@ import { modulesMap } from '../../common/modules-map';
35 import { DeviceProfileModule } from './device-profile/device-profile.module'; 35 import { DeviceProfileModule } from './device-profile/device-profile.module';
36 import { ApiUsageModule } from '@home/pages/api-usage/api-usage.module'; 36 import { ApiUsageModule } from '@home/pages/api-usage/api-usage.module';
37 import { EdgeModule } from '@home/pages/edge/edge.module'; 37 import { EdgeModule } from '@home/pages/edge/edge.module';
38 -import { ResourceModule } from '@home/pages/resource/resource.module';  
39 import { FirmwareModule } from '@home/pages/firmware/firmware.module'; 38 import { FirmwareModule } from '@home/pages/firmware/firmware.module';
40 39
41 @NgModule({ 40 @NgModule({
@@ -56,7 +55,6 @@ import { FirmwareModule } from '@home/pages/firmware/firmware.module'; @@ -56,7 +55,6 @@ import { FirmwareModule } from '@home/pages/firmware/firmware.module';
56 DashboardModule, 55 DashboardModule,
57 AuditLogModule, 56 AuditLogModule,
58 ApiUsageModule, 57 ApiUsageModule,
59 - ResourceModule,  
60 FirmwareModule, 58 FirmwareModule,
61 UserModule 59 UserModule
62 ], 60 ],
1 -///  
2 -/// Copyright © 2016-2021 The Thingsboard Authors  
3 -///  
4 -/// Licensed under the Apache License, Version 2.0 (the "License");  
5 -/// you may not use this file except in compliance with the License.  
6 -/// You may obtain a copy of the License at  
7 -///  
8 -/// http://www.apache.org/licenses/LICENSE-2.0  
9 -///  
10 -/// Unless required by applicable law or agreed to in writing, software  
11 -/// distributed under the License is distributed on an "AS IS" BASIS,  
12 -/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
13 -/// See the License for the specific language governing permissions and  
14 -/// limitations under the License.  
15 -///  
16 -  
17 -import { RouterModule, Routes } from '@angular/router';  
18 -import { EntitiesTableComponent } from '@home/components/entity/entities-table.component';  
19 -import { Authority } from '@shared/models/authority.enum';  
20 -import { NgModule } from '@angular/core';  
21 -import { ResourcesLibraryTableConfigResolver } from './resources-library-table-config.resolve';  
22 -  
23 -const routes: Routes = [  
24 - {  
25 - path: 'resources-library',  
26 - component: EntitiesTableComponent,  
27 - data: {  
28 - auth: [Authority.TENANT_ADMIN, Authority.SYS_ADMIN],  
29 - title: 'resource.resources-library',  
30 - breadcrumb: {  
31 - label: 'resource.resources-library',  
32 - icon: 'folder'  
33 - }  
34 - },  
35 - resolve: {  
36 - entitiesTableConfig: ResourcesLibraryTableConfigResolver  
37 - }  
38 - }  
39 -];  
40 -  
41 -@NgModule({  
42 - imports: [RouterModule.forChild(routes)],  
43 - exports: [RouterModule],  
44 - providers: [  
45 - ResourcesLibraryTableConfigResolver  
46 - ]  
47 -})  
48 -export class ResourcesLibraryRoutingModule{ }  
1 -///  
2 -/// Copyright © 2016-2021 The Thingsboard Authors  
3 -///  
4 -/// Licensed under the Apache License, Version 2.0 (the "License");  
5 -/// you may not use this file except in compliance with the License.  
6 -/// You may obtain a copy of the License at  
7 -///  
8 -/// http://www.apache.org/licenses/LICENSE-2.0  
9 -///  
10 -/// Unless required by applicable law or agreed to in writing, software  
11 -/// distributed under the License is distributed on an "AS IS" BASIS,  
12 -/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
13 -/// See the License for the specific language governing permissions and  
14 -/// limitations under the License.  
15 -///  
16 -  
17 -import { NgModule } from '@angular/core';  
18 -import { CommonModule } from '@angular/common';  
19 -import { ResourcesLibraryRoutingModule } from '@home/pages/resource/resource-routing.module';  
20 -import { SharedModule } from '@shared/shared.module';  
21 -import { HomeComponentsModule } from '@home/components/home-components.module';  
22 -import { ResourcesLibraryComponent } from './resources-library.component';  
23 -  
24 -@NgModule({  
25 - declarations: [ResourcesLibraryComponent],  
26 - imports: [  
27 - CommonModule,  
28 - SharedModule,  
29 - HomeComponentsModule,  
30 - ResourcesLibraryRoutingModule  
31 - ]  
32 -})  
33 -export class ResourceModule { }  
@@ -2247,7 +2247,6 @@ @@ -2247,7 +2247,6 @@
2247 "drop-file": "Drop a resource file or click to select a file to upload.", 2247 "drop-file": "Drop a resource file or click to select a file to upload.",
2248 "empty": "Resource is empty", 2248 "empty": "Resource is empty",
2249 "export": "Export resource", 2249 "export": "Export resource",
2250 - "management": "Resource management",  
2251 "no-resource-matching": "No resource matching '{{widgetsBundle}}' were found.", 2250 "no-resource-matching": "No resource matching '{{widgetsBundle}}' were found.",
2252 "no-resource-text": "No resources found", 2251 "no-resource-text": "No resources found",
2253 "open-widgets-bundle": "Open widgets bundle", 2252 "open-widgets-bundle": "Open widgets bundle",