CP Update app routing module by adding dashboard module for better visibility

This commit is contained in:
Thomas Fransolet 2020-03-10 12:15:55 +01:00
parent 69948dc6dc
commit c99533c151
41 changed files with 141 additions and 50 deletions

46
package-lock.json generated
View File

@ -1137,7 +1137,8 @@
"abbrev": { "abbrev": {
"version": "1.0.9", "version": "1.0.9",
"resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.0.9.tgz", "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.0.9.tgz",
"integrity": "sha1-kbR5JYinc4wl813W9jdSovh3YTU=" "integrity": "sha1-kbR5JYinc4wl813W9jdSovh3YTU=",
"optional": true
}, },
"accepts": { "accepts": {
"version": "1.3.5", "version": "1.3.5",
@ -4717,7 +4718,8 @@
}, },
"ansi-regex": { "ansi-regex": {
"version": "2.1.1", "version": "2.1.1",
"bundled": true "bundled": true,
"optional": true
}, },
"aproba": { "aproba": {
"version": "1.2.0", "version": "1.2.0",
@ -4735,11 +4737,13 @@
}, },
"balanced-match": { "balanced-match": {
"version": "1.0.0", "version": "1.0.0",
"bundled": true "bundled": true,
"optional": true
}, },
"brace-expansion": { "brace-expansion": {
"version": "1.1.11", "version": "1.1.11",
"bundled": true, "bundled": true,
"optional": true,
"requires": { "requires": {
"balanced-match": "^1.0.0", "balanced-match": "^1.0.0",
"concat-map": "0.0.1" "concat-map": "0.0.1"
@ -4752,15 +4756,18 @@
}, },
"code-point-at": { "code-point-at": {
"version": "1.1.0", "version": "1.1.0",
"bundled": true "bundled": true,
"optional": true
}, },
"concat-map": { "concat-map": {
"version": "0.0.1", "version": "0.0.1",
"bundled": true "bundled": true,
"optional": true
}, },
"console-control-strings": { "console-control-strings": {
"version": "1.1.0", "version": "1.1.0",
"bundled": true "bundled": true,
"optional": true
}, },
"core-util-is": { "core-util-is": {
"version": "1.0.2", "version": "1.0.2",
@ -4863,7 +4870,8 @@
}, },
"inherits": { "inherits": {
"version": "2.0.3", "version": "2.0.3",
"bundled": true "bundled": true,
"optional": true
}, },
"ini": { "ini": {
"version": "1.3.5", "version": "1.3.5",
@ -4873,6 +4881,7 @@
"is-fullwidth-code-point": { "is-fullwidth-code-point": {
"version": "1.0.0", "version": "1.0.0",
"bundled": true, "bundled": true,
"optional": true,
"requires": { "requires": {
"number-is-nan": "^1.0.0" "number-is-nan": "^1.0.0"
} }
@ -4885,17 +4894,20 @@
"minimatch": { "minimatch": {
"version": "3.0.4", "version": "3.0.4",
"bundled": true, "bundled": true,
"optional": true,
"requires": { "requires": {
"brace-expansion": "^1.1.7" "brace-expansion": "^1.1.7"
} }
}, },
"minimist": { "minimist": {
"version": "0.0.8", "version": "0.0.8",
"bundled": true "bundled": true,
"optional": true
}, },
"minipass": { "minipass": {
"version": "2.3.5", "version": "2.3.5",
"bundled": true, "bundled": true,
"optional": true,
"requires": { "requires": {
"safe-buffer": "^5.1.2", "safe-buffer": "^5.1.2",
"yallist": "^3.0.0" "yallist": "^3.0.0"
@ -4912,6 +4924,7 @@
"mkdirp": { "mkdirp": {
"version": "0.5.1", "version": "0.5.1",
"bundled": true, "bundled": true,
"optional": true,
"requires": { "requires": {
"minimist": "0.0.8" "minimist": "0.0.8"
} }
@ -4984,7 +4997,8 @@
}, },
"number-is-nan": { "number-is-nan": {
"version": "1.0.1", "version": "1.0.1",
"bundled": true "bundled": true,
"optional": true
}, },
"object-assign": { "object-assign": {
"version": "4.1.1", "version": "4.1.1",
@ -4994,6 +5008,7 @@
"once": { "once": {
"version": "1.4.0", "version": "1.4.0",
"bundled": true, "bundled": true,
"optional": true,
"requires": { "requires": {
"wrappy": "1" "wrappy": "1"
} }
@ -5069,7 +5084,8 @@
}, },
"safe-buffer": { "safe-buffer": {
"version": "5.1.2", "version": "5.1.2",
"bundled": true "bundled": true,
"optional": true
}, },
"safer-buffer": { "safer-buffer": {
"version": "2.1.2", "version": "2.1.2",
@ -5099,6 +5115,7 @@
"string-width": { "string-width": {
"version": "1.0.2", "version": "1.0.2",
"bundled": true, "bundled": true,
"optional": true,
"requires": { "requires": {
"code-point-at": "^1.0.0", "code-point-at": "^1.0.0",
"is-fullwidth-code-point": "^1.0.0", "is-fullwidth-code-point": "^1.0.0",
@ -5116,6 +5133,7 @@
"strip-ansi": { "strip-ansi": {
"version": "3.0.1", "version": "3.0.1",
"bundled": true, "bundled": true,
"optional": true,
"requires": { "requires": {
"ansi-regex": "^2.0.0" "ansi-regex": "^2.0.0"
} }
@ -5154,11 +5172,13 @@
}, },
"wrappy": { "wrappy": {
"version": "1.0.2", "version": "1.0.2",
"bundled": true "bundled": true,
"optional": true
}, },
"yallist": { "yallist": {
"version": "3.0.3", "version": "3.0.3",
"bundled": true "bundled": true,
"optional": true
} }
} }
}, },
@ -9988,7 +10008,7 @@
"resolved": "https://registry.npmjs.org/rijs.sync/-/rijs.sync-2.3.5.tgz", "resolved": "https://registry.npmjs.org/rijs.sync/-/rijs.sync-2.3.5.tgz",
"integrity": "sha512-tcbhmjLyWb+2s2gdiSmROEoD/OQPFeKC9xBnKgs0H+umY8CaVrVPGFdr1y1qovm7HxUbdk/BKqi94GQDc5XB3A==", "integrity": "sha512-tcbhmjLyWb+2s2gdiSmROEoD/OQPFeKC9xBnKgs0H+umY8CaVrVPGFdr1y1qovm7HxUbdk/BKqi94GQDc5XB3A==",
"requires": { "requires": {
"buble": "github:pemrouz/buble#4e639aeeb64712ac95dc30a52750d1ee4432c9c8", "buble": "github:pemrouz/buble",
"express": "^4.14.0", "express": "^4.14.0",
"lru_map": "^0.3.3", "lru_map": "^0.3.3",
"platform": "^1.3.4", "platform": "^1.3.4",

View File

@ -1,14 +1,13 @@
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router'; import { Routes, RouterModule } from '@angular/router';
import { HomeComponent } from './control-panel/home/home.component'; import { HomeComponent } from './control-panel/home/home.component';
import { AutomationComponent } from './control-panel/profile/automation/automation.component'; import { AutomationComponent } from './control-panel/automation/automation.component';
import { AuthGuard } from './_helpers/auth.guard'; import { AuthGuard } from './_helpers/auth.guard';
import { NotFoundComponent } from './control-panel/not-found/not-found.component'; import { NotFoundComponent } from './control-panel/not-found/not-found.component';
import { ProfileComponent } from './control-panel/profile/profile/profile.component'; import { ProfileComponent } from './control-panel/profile/profile/profile.component';
import { EditProfileComponent } from './control-panel/profile/edit-profile/edit-profile.component'; import { EditProfileComponent } from './control-panel/profile/edit-profile/edit-profile.component';
import { EditAutomationComponent } from './control-panel/profile/automation/edit-automation/edit-automation.component'; import { EditAutomationComponent } from './control-panel/automation/edit-automation/edit-automation.component';
import { DevicesComponent } from './control-panel/profile/devices/devices.component'; import { DevicesComponent } from './control-panel/devices/devices.component';
import { DashboardComponent } from './control-panel/profile/dashboard/dashboard.component';
import { BetComponent } from './control-panel/bet/bet.component'; import { BetComponent } from './control-panel/bet/bet.component';
const routes: Routes = const routes: Routes =
@ -22,9 +21,11 @@ const routes: Routes =
{ path: '', component: ProfileComponent}, { path: '', component: ProfileComponent},
{ path: ':profileId', children: [ { path: ':profileId', children: [
{ path: '', component: ProfileComponent}, { path: '', component: ProfileComponent},
{ path: 'dashboard', component: DashboardComponent, children: [ { path: 'dashboard',
{ path: '**', component: DashboardComponent} loadChildren: () =>
]}, import('../app/control-panel/dashboard/dashboard.module').then(m => m.DashboardModule),
canActivate: [ AuthGuard ]
},
{ path: 'edit', component: EditProfileComponent}, { path: 'edit', component: EditProfileComponent},
{ path: 'automation', children: [ { path: 'automation', children: [
{ path: '', component: AutomationComponent}, { path: '', component: AutomationComponent},

View File

@ -1,6 +1,6 @@
import { BrowserModule } from '@angular/platform-browser'; import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { NgModule, Provider, APP_INITIALIZER } from '@angular/core'; import { NgModule, CUSTOM_ELEMENTS_SCHEMA, Provider, APP_INITIALIZER } from '@angular/core';
import { AppRoutingModule } from './app-routing.module'; import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component'; import { AppComponent } from './app.component';
@ -27,7 +27,7 @@ import { ConfirmationService, MessageService, MenuItem } from 'primeng/api';
import { TranslateModule, TranslateLoader } from '@ngx-translate/core'; import { TranslateModule, TranslateLoader } from '@ngx-translate/core';
import { TranslateHttpLoader } from '@ngx-translate/http-loader'; import { TranslateHttpLoader } from '@ngx-translate/http-loader';
import { AuthenticationService } from './_services/authentication.service'; import { AuthenticationService } from './_services/authentication.service';
import { AutomationComponent } from './control-panel/profile/automation/automation.component'; import { AutomationComponent } from './control-panel/automation/automation.component';
import { NotFoundComponent } from './control-panel/not-found/not-found.component'; import { NotFoundComponent } from './control-panel/not-found/not-found.component';
import { ProfileComponent } from './control-panel/profile/profile/profile.component'; import { ProfileComponent } from './control-panel/profile/profile/profile.component';
import { EditProfileComponent } from './control-panel/profile/edit-profile/edit-profile.component'; import { EditProfileComponent } from './control-panel/profile/edit-profile/edit-profile.component';
@ -36,18 +36,10 @@ import { ErrorInterceptor } from './_helpers/error.interceptor';
import { NotificationsService } from './_services/notifications.service'; import { NotificationsService } from './_services/notifications.service';
import { ToastModule } from 'primeng/toast'; import { ToastModule } from 'primeng/toast';
import { DropdownModule } from 'primeng/dropdown'; import { DropdownModule } from 'primeng/dropdown';
import { EditAutomationComponent } from './control-panel/profile/automation/edit-automation/edit-automation.component'; import { EditAutomationComponent } from './control-panel/automation/edit-automation/edit-automation.component';
import { DevicesComponent } from './control-panel/profile/devices/devices.component'; import { DevicesComponent } from './control-panel/devices/devices.component';
import { DashboardComponent } from './control-panel/profile/dashboard/dashboard.component';
import { BetComponent } from './control-panel/bet/bet.component'; import { BetComponent } from './control-panel/bet/bet.component';
import { PanelMenuModule } from 'primeng/panelmenu'; import { PanelMenuModule } from 'primeng/panelmenu';
import { EnergyComponent } from './control-panel/profile/dashboard/energy/energy.component';
import { SidebarDashboardComponent, SidebarNavItemComponent, SidebarNavDropItemComponent } from './control-panel/profile/dashboard/sidebar/sidebarDashboard.component';
import { ElectricityComponent } from './control-panel/profile/dashboard/energy/electricity/electricity.component';
import { GasComponent } from './control-panel/profile/dashboard/energy/gas/gas.component';
import { WaterComponent } from './control-panel/profile/dashboard/energy/water/water.component';
import { ChartModule } from 'primeng/chart';
@ -81,15 +73,7 @@ export function HttpLoaderFactory(http: HttpClient) {
EditProfileComponent, EditProfileComponent,
EditAutomationComponent, EditAutomationComponent,
DevicesComponent, DevicesComponent,
DashboardComponent, BetComponent
BetComponent,
EnergyComponent,
SidebarDashboardComponent,
SidebarNavItemComponent,
SidebarNavDropItemComponent,
ElectricityComponent,
GasComponent,
WaterComponent
], ],
imports: [ imports: [
BrowserModule, BrowserModule,
@ -111,7 +95,6 @@ export function HttpLoaderFactory(http: HttpClient) {
ToastModule, ToastModule,
DropdownModule, DropdownModule,
PanelMenuModule, PanelMenuModule,
ChartModule,
TranslateModule.forRoot({ TranslateModule.forRoot({
loader: { loader: {
provide: TranslateLoader, provide: TranslateLoader,
@ -130,6 +113,9 @@ export function HttpLoaderFactory(http: HttpClient) {
{ provide: HTTP_INTERCEPTORS, useClass: JwtInterceptor, multi: true }, { provide: HTTP_INTERCEPTORS, useClass: JwtInterceptor, multi: true },
{ provide: HTTP_INTERCEPTORS, useClass: ErrorInterceptor, multi: true }, { provide: HTTP_INTERCEPTORS, useClass: ErrorInterceptor, multi: true },
], ],
bootstrap: [AppComponent] bootstrap: [AppComponent],
schemas: [
CUSTOM_ELEMENTS_SCHEMA
]
}) })
export class AppModule { } export class AppModule { }

View File

@ -1,8 +1,8 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { Router, ActivatedRoute } from '@angular/router'; import { Router, ActivatedRoute } from '@angular/router';
import { ConfirmationService } from 'primeng/api'; import { ConfirmationService } from 'primeng/api';
import { NotificationsService } from '../../../_services/notifications.service'; import { NotificationsService } from '../../_services/notifications.service';
import { UserInfo } from '../../../_api/models'; import { UserInfo } from '../../_api/models';
@Component({ @Component({
selector: 'app-automation', selector: 'app-automation',

View File

@ -1,7 +1,7 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { Router, ActivatedRoute } from '@angular/router'; import { Router, ActivatedRoute } from '@angular/router';
import { ConfirmationService } from 'primeng/api'; import { ConfirmationService } from 'primeng/api';
import { NotificationsService } from '../../../../_services/notifications.service'; import { NotificationsService } from '../../../_services/notifications.service';
@Component({ @Component({
selector: 'app-edit-automation', selector: 'app-edit-automation',

View File

@ -0,0 +1,16 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { EnergyComponent } from './energy/energy.component';
import { DashboardComponent } from './dashboard.component';
const routes: Routes =
[
{ path: '', component: DashboardComponent},
{ path: 'energy', component: EnergyComponent }
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [ RouterModule]
})
export class DashboardRoutingModule { }

View File

@ -0,0 +1,68 @@
import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { DropdownModule } from 'primeng/dropdown';
import { PanelMenuModule } from 'primeng/panelmenu';
import { EnergyComponent } from './energy/energy.component';
import { SidebarDashboardComponent, SidebarNavItemComponent, SidebarNavDropItemComponent } from './sidebar/sidebarDashboard.component';
import { ElectricityComponent } from './energy/electricity/electricity.component';
import { GasComponent } from './energy/gas/gas.component';
import { WaterComponent } from './energy/water/water.component';
import { ChartModule } from 'primeng/chart';
import { DashboardRoutingModule } from './dashboard-routing.module';
import { CommonModule } from '@angular/common';
import { ToolbarModule } from 'primeng/toolbar';
import { ButtonModule } from 'primeng/button';
import { DialogModule } from 'primeng/dialog';
import { InputTextModule } from 'primeng/inputtext';
import { HttpClientModule } from '@angular/common/http';
import { FormsModule } from '@angular/forms';
import { CalendarModule } from 'primeng/calendar';
import { ConfirmDialogModule } from 'primeng/confirmdialog';
import { ToastModule } from 'primeng/toast';
import { SplitButtonModule } from 'primeng/splitbutton';
import { DashboardComponent } from './dashboard.component';
@NgModule({
declarations: [
DashboardComponent,
EnergyComponent,
SidebarDashboardComponent,
SidebarNavItemComponent,
SidebarNavDropItemComponent,
ElectricityComponent,
GasComponent,
WaterComponent
],
imports: [
DashboardRoutingModule,
DropdownModule,
PanelMenuModule,
ChartModule,
CommonModule,
ToolbarModule,
ButtonModule,
SplitButtonModule,
DialogModule,
InputTextModule,
HttpClientModule,
FormsModule,
CalendarModule,
ConfirmDialogModule,
ToastModule,
DropdownModule,
PanelMenuModule
],
exports: [
EnergyComponent,
SidebarDashboardComponent,
SidebarNavItemComponent,
SidebarNavDropItemComponent,
ElectricityComponent,
GasComponent,
WaterComponent
],
schemas: [
CUSTOM_ELEMENTS_SCHEMA
]
})
export class DashboardModule { }

View File

@ -1,6 +1,6 @@
import { Component, OnInit, Input } from '@angular/core'; import { Component, OnInit, Input } from '@angular/core';
import { LayoutService } from '../../../../_api/services'; import { LayoutService } from '../../../_api/services';
import { PanelSection } from '../../../../_api/models'; import { PanelSection } from '../../../_api/models';
import { Router, Route, ActivatedRoute } from '@angular/router'; import { Router, Route, ActivatedRoute } from '@angular/router';
@Component({ @Component({