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

View File

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

View File

@ -1,6 +1,6 @@
import { BrowserModule } from '@angular/platform-browser';
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 { AppComponent } from './app.component';
@ -27,7 +27,7 @@ import { ConfirmationService, MessageService, MenuItem } from 'primeng/api';
import { TranslateModule, TranslateLoader } from '@ngx-translate/core';
import { TranslateHttpLoader } from '@ngx-translate/http-loader';
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 { ProfileComponent } from './control-panel/profile/profile/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 { ToastModule } from 'primeng/toast';
import { DropdownModule } from 'primeng/dropdown';
import { EditAutomationComponent } from './control-panel/profile/automation/edit-automation/edit-automation.component';
import { DevicesComponent } from './control-panel/profile/devices/devices.component';
import { DashboardComponent } from './control-panel/profile/dashboard/dashboard.component';
import { EditAutomationComponent } from './control-panel/automation/edit-automation/edit-automation.component';
import { DevicesComponent } from './control-panel/devices/devices.component';
import { BetComponent } from './control-panel/bet/bet.component';
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,
EditAutomationComponent,
DevicesComponent,
DashboardComponent,
BetComponent,
EnergyComponent,
SidebarDashboardComponent,
SidebarNavItemComponent,
SidebarNavDropItemComponent,
ElectricityComponent,
GasComponent,
WaterComponent
BetComponent
],
imports: [
BrowserModule,
@ -111,7 +95,6 @@ export function HttpLoaderFactory(http: HttpClient) {
ToastModule,
DropdownModule,
PanelMenuModule,
ChartModule,
TranslateModule.forRoot({
loader: {
provide: TranslateLoader,
@ -130,6 +113,9 @@ export function HttpLoaderFactory(http: HttpClient) {
{ provide: HTTP_INTERCEPTORS, useClass: JwtInterceptor, multi: true },
{ provide: HTTP_INTERCEPTORS, useClass: ErrorInterceptor, multi: true },
],
bootstrap: [AppComponent]
bootstrap: [AppComponent],
schemas: [
CUSTOM_ELEMENTS_SCHEMA
]
})
export class AppModule { }

View File

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

View File

@ -1,7 +1,7 @@
import { Component, OnInit } from '@angular/core';
import { Router, ActivatedRoute } from '@angular/router';
import { ConfirmationService } from 'primeng/api';
import { NotificationsService } from '../../../../_services/notifications.service';
import { NotificationsService } from '../../../_services/notifications.service';
@Component({
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 { LayoutService } from '../../../../_api/services';
import { PanelSection } from '../../../../_api/models';
import { LayoutService } from '../../../_api/services';
import { PanelSection } from '../../../_api/models';
import { Router, Route, ActivatedRoute } from '@angular/router';
@Component({
@ -16,7 +16,7 @@ export class SidebarDashboardComponent implements OnInit {
UrlRegex = /.*dashboard/;
constructor(private _layoutService: LayoutService,
constructor(private _layoutService: LayoutService,
private _router: Router,
private _route: ActivatedRoute
) { }