Introduce common modules map
This commit is contained in:
parent
dddbe34f1b
commit
bf2d3cbffe
55
ui-ngx/src/app/modules/common/modules-map.ts
Normal file
55
ui-ngx/src/app/modules/common/modules-map.ts
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
///
|
||||||
|
/// Copyright © 2016-2020 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 * as AngularCore from '@angular/core';
|
||||||
|
import * as AngularCommon from '@angular/common';
|
||||||
|
import * as AngularForms from '@angular/forms';
|
||||||
|
import * as AngularRouter from '@angular/router';
|
||||||
|
import * as AngularCdkKeycodes from '@angular/cdk/keycodes';
|
||||||
|
import * as AngularCdkCoercion from '@angular/cdk/coercion';
|
||||||
|
import * as AngularMaterialChips from '@angular/material/chips';
|
||||||
|
import * as AngularMaterialAutocomplete from '@angular/material/autocomplete';
|
||||||
|
import * as AngularMaterialDialog from '@angular/material/dialog';
|
||||||
|
import * as NgrxStore from '@ngrx/store';
|
||||||
|
import * as RxJs from 'rxjs';
|
||||||
|
import * as RxJsOperators from 'rxjs/operators';
|
||||||
|
import * as TranslateCore from '@ngx-translate/core';
|
||||||
|
import * as TbCore from '@core/public-api';
|
||||||
|
import * as TbShared from '@shared/public-api';
|
||||||
|
import * as TbHomeComponents from '@home/components/public-api';
|
||||||
|
import * as _moment from 'moment';
|
||||||
|
|
||||||
|
declare const SystemJS;
|
||||||
|
|
||||||
|
export const modulesMap: {[key: string]: any} = {
|
||||||
|
'@angular/core': SystemJS.newModule(AngularCore),
|
||||||
|
'@angular/common': SystemJS.newModule(AngularCommon),
|
||||||
|
'@angular/forms': SystemJS.newModule(AngularForms),
|
||||||
|
'@angular/router': SystemJS.newModule(AngularRouter),
|
||||||
|
'@angular/cdk/keycodes': SystemJS.newModule(AngularCdkKeycodes),
|
||||||
|
'@angular/cdk/coercion': SystemJS.newModule(AngularCdkCoercion),
|
||||||
|
'@angular/material/chips': SystemJS.newModule(AngularMaterialChips),
|
||||||
|
'@angular/material/autocomplete': SystemJS.newModule(AngularMaterialAutocomplete),
|
||||||
|
'@angular/material/dialog': SystemJS.newModule(AngularMaterialDialog),
|
||||||
|
'@ngrx/store': SystemJS.newModule(NgrxStore),
|
||||||
|
rxjs: SystemJS.newModule(RxJs),
|
||||||
|
'rxjs/operators': SystemJS.newModule(RxJsOperators),
|
||||||
|
'@ngx-translate/core': SystemJS.newModule(TranslateCore),
|
||||||
|
'@core/public-api': SystemJS.newModule(TbCore),
|
||||||
|
'@shared/public-api': SystemJS.newModule(TbShared),
|
||||||
|
'@home/components/public-api': SystemJS.newModule(TbHomeComponents),
|
||||||
|
moment: SystemJS.newModule(_moment)
|
||||||
|
};
|
||||||
@ -25,6 +25,8 @@ import { DashboardUtilsService } from '@core/services/dashboard-utils.service';
|
|||||||
import { DashboardResolver } from '@app/modules/home/pages/dashboard/dashboard-routing.module';
|
import { DashboardResolver } from '@app/modules/home/pages/dashboard/dashboard-routing.module';
|
||||||
import { UtilsService } from '@core/services/utils.service';
|
import { UtilsService } from '@core/services/utils.service';
|
||||||
import { Widget } from '@app/shared/models/widget.models';
|
import { Widget } from '@app/shared/models/widget.models';
|
||||||
|
import { MODULES_MAP } from '../../shared/models/constants';
|
||||||
|
import { modulesMap } from '../common/modules-map';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class WidgetEditorDashboardResolver implements Resolve<Dashboard> {
|
export class WidgetEditorDashboardResolver implements Resolve<Dashboard> {
|
||||||
@ -92,7 +94,11 @@ const routes: Routes = [
|
|||||||
imports: [RouterModule.forChild(routes)],
|
imports: [RouterModule.forChild(routes)],
|
||||||
exports: [RouterModule],
|
exports: [RouterModule],
|
||||||
providers: [
|
providers: [
|
||||||
WidgetEditorDashboardResolver
|
WidgetEditorDashboardResolver,
|
||||||
|
{
|
||||||
|
provide: MODULES_MAP,
|
||||||
|
useValue: modulesMap
|
||||||
|
}
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class DashboardPagesRoutingModule { }
|
export class DashboardPagesRoutingModule { }
|
||||||
|
|||||||
@ -29,46 +29,8 @@ import { EntityViewModule } from '@modules/home/pages/entity-view/entity-view.mo
|
|||||||
import { RuleChainModule } from '@modules/home/pages/rulechain/rulechain.module';
|
import { RuleChainModule } from '@modules/home/pages/rulechain/rulechain.module';
|
||||||
import { WidgetLibraryModule } from '@modules/home/pages/widget/widget-library.module';
|
import { WidgetLibraryModule } from '@modules/home/pages/widget/widget-library.module';
|
||||||
import { DashboardModule } from '@modules/home/pages/dashboard/dashboard.module';
|
import { DashboardModule } from '@modules/home/pages/dashboard/dashboard.module';
|
||||||
import * as AngularCore from '@angular/core';
|
|
||||||
import * as AngularCommon from '@angular/common';
|
|
||||||
import * as AngularForms from '@angular/forms';
|
|
||||||
import * as AngularRouter from '@angular/router';
|
|
||||||
import * as AngularCdkKeycodes from '@angular/cdk/keycodes';
|
|
||||||
import * as AngularCdkCoercion from '@angular/cdk/coercion';
|
|
||||||
import * as AngularMaterialChips from '@angular/material/chips';
|
|
||||||
import * as AngularMaterialAutocomplete from '@angular/material/autocomplete';
|
|
||||||
import * as AngularMaterialDialog from '@angular/material/dialog';
|
|
||||||
import * as NgrxStore from '@ngrx/store';
|
|
||||||
import * as RxJs from 'rxjs';
|
|
||||||
import * as RxJsOperators from 'rxjs/operators';
|
|
||||||
import * as TranslateCore from '@ngx-translate/core';
|
|
||||||
import * as TbCore from '@core/public-api';
|
|
||||||
import * as TbShared from '@shared/public-api';
|
|
||||||
import * as TbHomeComponents from '@home/components/public-api';
|
|
||||||
import * as _moment from 'moment';
|
|
||||||
import { MODULES_MAP } from '@shared/public-api';
|
import { MODULES_MAP } from '@shared/public-api';
|
||||||
|
import { modulesMap } from '../../common/modules-map';
|
||||||
declare const SystemJS;
|
|
||||||
|
|
||||||
const modulesMap: {[key: string]: any} = {
|
|
||||||
'@angular/core': SystemJS.newModule(AngularCore),
|
|
||||||
'@angular/common': SystemJS.newModule(AngularCommon),
|
|
||||||
'@angular/forms': SystemJS.newModule(AngularForms),
|
|
||||||
'@angular/router': SystemJS.newModule(AngularRouter),
|
|
||||||
'@angular/cdk/keycodes': SystemJS.newModule(AngularCdkKeycodes),
|
|
||||||
'@angular/cdk/coercion': SystemJS.newModule(AngularCdkCoercion),
|
|
||||||
'@angular/material/chips': SystemJS.newModule(AngularMaterialChips),
|
|
||||||
'@angular/material/autocomplete': SystemJS.newModule(AngularMaterialAutocomplete),
|
|
||||||
'@angular/material/dialog': SystemJS.newModule(AngularMaterialDialog),
|
|
||||||
'@ngrx/store': SystemJS.newModule(NgrxStore),
|
|
||||||
rxjs: SystemJS.newModule(RxJs),
|
|
||||||
'rxjs/operators': SystemJS.newModule(RxJsOperators),
|
|
||||||
'@ngx-translate/core': SystemJS.newModule(TranslateCore),
|
|
||||||
'@core/public-api': SystemJS.newModule(TbCore),
|
|
||||||
'@shared/public-api': SystemJS.newModule(TbShared),
|
|
||||||
'@home/components/public-api': SystemJS.newModule(TbHomeComponents),
|
|
||||||
moment: SystemJS.newModule(_moment)
|
|
||||||
};
|
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
exports: [
|
exports: [
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user