CP Service generation updated + Add bet component + configurations to automations + WIP Dashboard

This commit is contained in:
Thomas Fransolet 2020-03-04 23:14:54 +01:00
parent cf1300150a
commit 237a74434c
36 changed files with 332 additions and 171 deletions

6
package-lock.json generated
View File

@ -8925,9 +8925,9 @@
"integrity": "sha512-p/hzIjUVccW4eJPhuORHI3AUkDpqfvCQVrjxbFEejnTEdWY4C8fomVfjiaA9jCu83fSQnBHuRIGB96iAR8R6uA==" "integrity": "sha512-p/hzIjUVccW4eJPhuORHI3AUkDpqfvCQVrjxbFEejnTEdWY4C8fomVfjiaA9jCu83fSQnBHuRIGB96iAR8R6uA=="
}, },
"primeng": { "primeng": {
"version": "8.0.1", "version": "9.0.0",
"resolved": "https://registry.npmjs.org/primeng/-/primeng-8.0.1.tgz", "resolved": "https://registry.npmjs.org/primeng/-/primeng-9.0.0.tgz",
"integrity": "sha512-87HQEh+S4lm4r280Thlk3pHzJJ1lr4Dl82zidnfWeOBZ5lMbK2w9w9yKJH875aPKWs0MMDVZeQ5V9jMWolRjlA==" "integrity": "sha512-gR9uvEc9/1BXV9tfMt9dggvCAlNZjhrlarbfLPViY6Hqqr588WhOOvU40Gm8rh3sbXkfisuc6Rvhu7ePQXscHA=="
}, },
"process": { "process": {
"version": "0.11.10", "version": "0.11.10",

View File

@ -35,7 +35,7 @@
"ngx-bootstrap": "^3.2.0", "ngx-bootstrap": "^3.2.0",
"popper": "^1.0.1", "popper": "^1.0.1",
"primeicons": "^1.0.0", "primeicons": "^1.0.0",
"primeng": "^8.0.1", "primeng": "^9.0.0",
"rxjs": "~6.5.2", "rxjs": "~6.5.2",
"tslib": "^1.9.0", "tslib": "^1.9.0",
"zone.js": "~0.9.1" "zone.js": "~0.9.1"

View File

@ -5,6 +5,7 @@ export { FacebookAuthModel } from './models/facebook-auth-model';
export { GoogleAuthModel } from './models/google-auth-model'; export { GoogleAuthModel } from './models/google-auth-model';
export { SmartPrinterMessage } from './models/smart-printer-message'; export { SmartPrinterMessage } from './models/smart-printer-message';
export { SmartGardenMessage } from './models/smart-garden-message'; export { SmartGardenMessage } from './models/smart-garden-message';
export { TokenDTO } from './models/token-dto';
export { UserInfo } from './models/user-info'; export { UserInfo } from './models/user-info';
export { ScreenConfiguration } from './models/screen-configuration'; export { ScreenConfiguration } from './models/screen-configuration';
export { Widget } from './models/widget'; export { Widget } from './models/widget';

View File

@ -0,0 +1,5 @@
/* tslint:disable */
export interface TokenDTO {
email?: string;
password?: string;
}

View File

@ -2,7 +2,7 @@
import { ScreenConfiguration } from './screen-configuration'; import { ScreenConfiguration } from './screen-configuration';
import { Device } from './device'; import { Device } from './device';
export interface UserInfo { export interface UserInfo {
dateCreation?: string; address?: string;
id?: string; id?: string;
email?: string; email?: string;
password?: string; password?: string;
@ -10,10 +10,11 @@ export interface UserInfo {
lastName?: string; lastName?: string;
token?: string; token?: string;
birthday?: string; birthday?: string;
dateCreation?: string;
role?: string; role?: string;
address?: string;
city?: string; city?: string;
state?: string; state?: string;
country?: string;
language?: string; language?: string;
timeZone?: string; timeZone?: string;
postalCode?: number; postalCode?: number;

View File

@ -8,13 +8,14 @@ import { Observable as __Observable } from 'rxjs';
import { map as __map, filter as __filter } from 'rxjs/operators'; import { map as __map, filter as __filter } from 'rxjs/operators';
import { UserInfo } from '../models/user-info'; import { UserInfo } from '../models/user-info';
import { TokenDTO } from '../models/token-dto';
import { User } from '../models/user'; import { User } from '../models/user';
@Injectable({ @Injectable({
providedIn: 'root', providedIn: 'root',
}) })
class TokenService extends __BaseService { class TokenService extends __BaseService {
static readonly CreatePath = '/api/token'; static readonly ConnectUserPath = '/api/token';
static readonly Create_1Path = '/token'; static readonly CreatePath = '/token';
constructor( constructor(
config: __Configuration, config: __Configuration,
@ -24,20 +25,14 @@ class TokenService extends __BaseService {
} }
/** /**
* @param params The `TokenService.CreateParams` containing the following parameters: * @param tokenDTO undefined
*
* - `password`:
*
* - `email`:
*
* @return Success * @return Success
*/ */
CreateResponse(params: TokenService.CreateParams): __Observable<__StrictHttpResponse<UserInfo>> { ConnectUserResponse(tokenDTO?: TokenDTO): __Observable<__StrictHttpResponse<UserInfo>> {
let __params = this.newParams(); let __params = this.newParams();
let __headers = new HttpHeaders(); let __headers = new HttpHeaders();
let __body: any = null; let __body: any = null;
if (params.password != null) __params = __params.set('password', params.password.toString()); __body = tokenDTO;
if (params.email != null) __params = __params.set('email', params.email.toString());
let req = new HttpRequest<any>( let req = new HttpRequest<any>(
'POST', 'POST',
this.rootUrl + `/api/token`, this.rootUrl + `/api/token`,
@ -56,16 +51,11 @@ class TokenService extends __BaseService {
); );
} }
/** /**
* @param params The `TokenService.CreateParams` containing the following parameters: * @param tokenDTO undefined
*
* - `password`:
*
* - `email`:
*
* @return Success * @return Success
*/ */
Create(params: TokenService.CreateParams): __Observable<UserInfo> { ConnectUser(tokenDTO?: TokenDTO): __Observable<UserInfo> {
return this.CreateResponse(params).pipe( return this.ConnectUserResponse(tokenDTO).pipe(
__map(_r => _r.body as UserInfo) __map(_r => _r.body as UserInfo)
); );
} }
@ -73,7 +63,7 @@ class TokenService extends __BaseService {
/** /**
* @param user undefined * @param user undefined
*/ */
Create_1Response(user?: User): __Observable<__StrictHttpResponse<null>> { CreateResponse(user?: User): __Observable<__StrictHttpResponse<null>> {
let __params = this.newParams(); let __params = this.newParams();
let __headers = new HttpHeaders(); let __headers = new HttpHeaders();
let __body: any = null; let __body: any = null;
@ -98,22 +88,14 @@ class TokenService extends __BaseService {
/** /**
* @param user undefined * @param user undefined
*/ */
Create_1(user?: User): __Observable<null> { Create(user?: User): __Observable<null> {
return this.Create_1Response(user).pipe( return this.CreateResponse(user).pipe(
__map(_r => _r.body as null) __map(_r => _r.body as null)
); );
} }
} }
module TokenService { module TokenService {
/**
* Parameters for Create
*/
export interface CreateParams {
password?: string;
email?: string;
}
} }
export { TokenService } export { TokenService }

View File

@ -4,6 +4,7 @@ import { Observable, BehaviorSubject } from 'rxjs';
import { TokenService } from '../_api/services/token.service'; import { TokenService } from '../_api/services/token.service';
import { UserInfo } from '../_api/models/user-info'; import { UserInfo } from '../_api/models/user-info';
import { map } from 'rxjs/operators'; import { map } from 'rxjs/operators';
import { TokenDTO } from '../_api/models';
@Injectable({ @Injectable({
providedIn: 'root' providedIn: 'root'
@ -24,16 +25,16 @@ export class AuthenticationService {
this.currentUser = this.currentUserSubject.asObservable(); this.currentUser = this.currentUserSubject.asObservable();
} }
public GetToken(user: UserInfo): Observable<any> { public GetToken(user: TokenDTO): Observable<any> {
return this._tokenService.Create(user); return this._tokenService.ConnectUser(user);
} }
public GetAuthStatus() { public GetAuthStatus() {
return this.IsLoggedIn; return this.IsLoggedIn;
} }
public Login(user: UserInfo) { public Login(tokenDTO: TokenDTO) {
return this._tokenService.Create(user) return this._tokenService.ConnectUser(tokenDTO)
.pipe(map(user => { .pipe(map(user => {
// store user details and jwt token in local storage to keep user logged in between page refreshes // store user details and jwt token in local storage to keep user logged in between page refreshes
localStorage.setItem('currentUser', JSON.stringify(user)); localStorage.setItem('currentUser', JSON.stringify(user));

View File

@ -1,14 +1,15 @@
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 { ConfigurationComponent } from './control-panel/profile/configuration/configuration.component'; import { AutomationComponent } from './control-panel/profile/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 { EditConfigurationComponent } from './control-panel/profile/configuration/edit-configuration/edit-configuration.component'; import { EditAutomationComponent } from './control-panel/profile/automation/edit-automation/edit-automation.component';
import { DevicesComponent } from './control-panel/profile/devices/devices.component'; import { DevicesComponent } from './control-panel/profile/devices/devices.component';
import { DashboardComponent } from './control-panel/profile/dashboard/dashboard.component'; import { DashboardComponent } from './control-panel/profile/dashboard/dashboard.component';
import { BetComponent } from './control-panel/bet/bet.component';
const routes: Routes = const routes: Routes =
[ [
@ -23,12 +24,15 @@ const routes: Routes =
{ path: '', component: ProfileComponent}, { path: '', component: ProfileComponent},
{ path: 'dashboard', component: DashboardComponent}, { path: 'dashboard', component: DashboardComponent},
{ path: 'edit', component: EditProfileComponent}, { path: 'edit', component: EditProfileComponent},
{ path: 'configurations', children: [ { path: 'automation', children: [
{ path: '', component: ConfigurationComponent}, { path: '', component: AutomationComponent},
{ path: ':configurationId', component: EditConfigurationComponent} { path: ':configurationId', component: EditAutomationComponent}
]}, ]},
{ path: 'devices', children: [ { path: 'devices', children: [
{ path: '', component: DevicesComponent} { path: '', component: DevicesComponent}
]},
{ path: 'bet', children: [
{ path: '', component: BetComponent}
]} ]}
]} ]}
] ]

View File

@ -11,7 +11,8 @@
<button *ngIf="!Connected" pButton type="button" [label]="LabelHeaderContact" ></button> <button *ngIf="!Connected" pButton type="button" [label]="LabelHeaderContact" ></button>
<button *ngIf="Connected" pButton type="button" label="MY DASHBOARD" (click)="GoToDashboard()"></button> <button *ngIf="Connected" pButton type="button" label="MY DASHBOARD" (click)="GoToDashboard()"></button>
<button *ngIf="Connected" pButton type="button" label="MY DEVICES" (click)="GoToDevices()"></button> <button *ngIf="Connected" pButton type="button" label="MY DEVICES" (click)="GoToDevices()"></button>
<button *ngIf="Connected" pButton type="button" label="MY CONFIGURATIONS" (click)="GoToConfiguration()"></button> <button *ngIf="Connected" pButton type="button" label="MY AUTOMATIONS" (click)="GoToAutomation()"></button>
<button *ngIf="Connected" pButton type="button" label="MY BETS" (click)="GoToBet()"></button>
<button *ngIf="!Connected" pButton type="button" label="{{LabelHeaderSignIn}}" icon="pi pi-pencil" iconPos="right" (click)="SignUp()"></button> <button *ngIf="!Connected" pButton type="button" label="{{LabelHeaderSignIn}}" icon="pi pi-pencil" iconPos="right" (click)="SignUp()"></button>
<button *ngIf="!Connected" pButton type="button" label="{{LabelHeaderLogIn}}" icon="pi pi-sign-in" iconPos="right" (click)="DisplayLoginModal = true"></button> <button *ngIf="!Connected" pButton type="button" label="{{LabelHeaderLogIn}}" icon="pi pi-sign-in" iconPos="right" (click)="DisplayLoginModal = true"></button>
<p-splitButton *ngIf="Connected" type="button" [label]="ConnectedUser.firstName" [model]="ItemsUserDropDown" (onClick)="GoToProfile()"></p-splitButton> <p-splitButton *ngIf="Connected" type="button" [label]="ConnectedUser.firstName" [model]="ItemsUserDropDown" (onClick)="GoToProfile()"></p-splitButton>

View File

@ -5,7 +5,7 @@ import { TranslateService } from '@ngx-translate/core';
import { AuthenticationService } from './_services/authentication.service'; import { AuthenticationService } from './_services/authentication.service';
import { Router } from '@angular/router'; import { Router } from '@angular/router';
import { first } from 'rxjs/operators'; import { first } from 'rxjs/operators';
import { UserInfo } from './_api/models'; import { UserInfo, TokenDTO } from './_api/models';
import { UserService } from './_api/services'; import { UserService } from './_api/services';
@ -33,7 +33,7 @@ export class AppComponent implements OnInit {
public CreateUser: UserInfo = {}; public CreateUser: UserInfo = {};
public ConfirmPassword: string; public ConfirmPassword: string;
public UserTryingToLogin: UserInfo = {}; public UserTryingToLogin: TokenDTO = {};
// Sign in // Sign in
public ErrorTextSignIn = ''; public ErrorTextSignIn = '';
@ -105,19 +105,20 @@ export class AppComponent implements OnInit {
} }
); );
this._translateService.get('App.Home.UserDropDown.ModifyUser').subscribe(modifyLabel => { this._translateService.get(['App.Home.UserDropDown.ModifyUser', 'App.Home.UserDropDown.Logout',
this._translateService.get('App.Home.UserDropDown.Logout').subscribe(logoutLabel => { 'App.Home.UserDropDown.Profile']).subscribe(labels => {
this.ItemsUserDropDown = [ this.ItemsUserDropDown = [
{label: modifyLabel, icon: 'fa fa-edit', command: () => { {label: labels['App.Home.UserDropDown.Profile'], icon: 'fa fa-user', command: () => {
this._router.navigate(['/profile/' + this.ConnectedUser.id]);
}},
{label: labels['App.Home.UserDropDown.ModifyUser'], icon: 'fa fa-edit', command: () => {
this._router.navigate(['/profile/' + this.ConnectedUser.id + '/edit']); this._router.navigate(['/profile/' + this.ConnectedUser.id + '/edit']);
}}, }},
{label: logoutLabel, icon: 'fa fa-sign-out', command: () => { {label: labels['App.Home.UserDropDown.Logout'], icon: 'fa fa-sign-out', command: () => {
this.Logout(); this.Logout();
}} }}
]; ];
}); });
});
} }
@ -135,8 +136,8 @@ export class AppComponent implements OnInit {
this.Email = null; this.Email = null;
this.Password = null; this.Password = null;
this._authService.IsLoggedIn = true; this._authService.IsLoggedIn = true;
this._router.navigate(['/profile/' + this.ConnectedUser.id]);
this.ErrorTextLogin = ''; this.ErrorTextLogin = '';
this.GoToDashboard();
}, },
error => { error => {
this._translateService.get('App.Home.Login.ErrorText').subscribe(loginErrorText => { this._translateService.get('App.Home.Login.ErrorText').subscribe(loginErrorText => {
@ -170,14 +171,18 @@ export class AppComponent implements OnInit {
this._router.navigate(['/profile/' + this.ConnectedUser.id]); this._router.navigate(['/profile/' + this.ConnectedUser.id]);
} }
public GoToConfiguration() { public GoToAutomation() {
this._router.navigate(['/profile/' + this.ConnectedUser.id + '/configurations']); this._router.navigate(['/profile/' + this.ConnectedUser.id + '/automation']);
} }
public GoToDevices() { public GoToDevices() {
this._router.navigate(['/profile/' + this.ConnectedUser.id + '/devices']); this._router.navigate(['/profile/' + this.ConnectedUser.id + '/devices']);
} }
public GoToBet() {
this._router.navigate(['/profile/' + this.ConnectedUser.id + '/bet']);
}
public CreateProfile() { public CreateProfile() {
if (this.CorrectForm()) { if (this.CorrectForm()) {
this.CreateUser.deviceIds = []; this.CreateUser.deviceIds = [];
@ -241,50 +246,27 @@ export class AppComponent implements OnInit {
public InitLabels() { public InitLabels() {
// HEADERS // HEADERS
this._translateService.get('App.Home.Login.Header').subscribe(label => { this._translateService.get(['App.Home.Login.Header', 'App.Home.SignIn.Header', 'App.Home.About.Header', 'App.Home.Team.Header',
this.LabelHeaderLogIn = label; 'App.Home.Contact.Header', 'App.Home.Login.Identify', 'App.Home.SignIn.CreateProfile', 'App.Common.Form.LastName',
}); 'App.Common.Form.FirstName', 'App.Common.Form.Email', 'App.Common.Form.Password', 'App.Common.Form.ConfirmPassword',
this._translateService.get('App.Home.SignIn.Header').subscribe(label => { 'App.Common.Form.Create'
this.LabelHeaderSignIn = label; ]).subscribe(labelTab => {
}); this.LabelHeaderLogIn = labelTab['App.Home.Login.Header'];
this._translateService.get('App.Home.About.Header').subscribe(label => { this.LabelHeaderSignIn = labelTab['App.Home.SignIn.Header'];
this.LabelHeaderAbout = label; this.LabelHeaderAbout = labelTab['App.Home.About.Header'];
}); this.LabelHeaderTeam = labelTab['App.Home.Team.Header'];
this._translateService.get('App.Home.Team.Header').subscribe(label => { this.LabelHeaderContact = labelTab['App.Home.Contact.Header'];
this.LabelHeaderTeam = label;
});
this._translateService.get('App.Home.Contact.Header').subscribe(label => {
this.LabelHeaderContact = label;
});
// LOGIN // LOGIN
this._translateService.get('App.Home.Login.Identify').subscribe(label => { this.LabelLoginIdentify = labelTab['App.Home.Login.Identify'];
this.LabelLoginIdentify = label;
});
// SIGN IN // SIGN IN
this._translateService.get('App.Home.SignIn.CreateProfile').subscribe(label => { this.LabelSignInCreateProfile = labelTab['App.Home.SignIn.CreateProfile'];
this.LabelSignInCreateProfile = label;
});
// FORM // FORM
this._translateService.get('App.Common.Form.LastName').subscribe(label => { this.LabelFormLastName = labelTab['App.Common.Form.LastName'];
this.LabelFormLastName = label; this.LabelFormFirstName = labelTab['App.Common.Form.FirstName'];
}); this.LabelFormEmail = labelTab['App.Common.Form.Email'];
this._translateService.get('App.Common.Form.FirstName').subscribe(label => { this.LabelFormPassword = labelTab['App.Common.Form.Password'];
this.LabelFormFirstName = label; this.LabelFormConfirmPassword = labelTab['App.Common.Form.ConfirmPassword'];
}); this.LabelFormCreate = labelTab['App.Common.Form.Create'];
this._translateService.get('App.Common.Form.Email').subscribe(label => {
this.LabelFormEmail = label;
});
this._translateService.get('App.Common.Form.Password').subscribe(label => {
this.LabelFormPassword = label;
});
this._translateService.get('App.Common.Form.ConfirmPassword').subscribe(label => {
this.LabelFormConfirmPassword = label;
});
this._translateService.get('App.Common.Form.Create').subscribe(label => {
this.LabelFormCreate = label;
}); });
} }
} }

View File

@ -22,12 +22,12 @@ import { AppService } from './_services/app.service';
import { FormsModule } from '@angular/forms'; import { FormsModule } from '@angular/forms';
import { CalendarModule } from 'primeng/calendar'; import { CalendarModule } from 'primeng/calendar';
import { ConfirmDialogModule } from 'primeng/confirmdialog'; import { ConfirmDialogModule } from 'primeng/confirmdialog';
import { ConfirmationService, MessageService } from 'primeng/api'; 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 { ConfigurationComponent } from './control-panel/profile/configuration/configuration.component'; import { AutomationComponent } from './control-panel/profile/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,9 +36,12 @@ 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 { EditConfigurationComponent } from './control-panel/profile/configuration/edit-configuration/edit-configuration.component'; import { EditAutomationComponent } from './control-panel/profile/automation/edit-automation/edit-automation.component';
import { DevicesComponent } from './control-panel/profile/devices/devices.component'; import { DevicesComponent } from './control-panel/profile/devices/devices.component';
import { DashboardComponent } from './control-panel/profile/dashboard/dashboard.component'; import { DashboardComponent } from './control-panel/profile/dashboard/dashboard.component';
import { BetComponent } from './control-panel/bet/bet.component';
import { PanelMenuModule } from 'primeng/panelmenu';
import { EnergyComponent } from './control-panel/profile/dashboard/energy/energy.component';
@ -67,13 +70,15 @@ export function HttpLoaderFactory(http: HttpClient) {
AppComponent, AppComponent,
HomeComponent, HomeComponent,
BorderCardDirective, BorderCardDirective,
ConfigurationComponent, AutomationComponent,
NotFoundComponent, NotFoundComponent,
ProfileComponent, ProfileComponent,
EditProfileComponent, EditProfileComponent,
EditConfigurationComponent, EditAutomationComponent,
DevicesComponent, DevicesComponent,
DashboardComponent DashboardComponent,
BetComponent,
EnergyComponent
], ],
imports: [ imports: [
BrowserModule, BrowserModule,
@ -94,6 +99,7 @@ export function HttpLoaderFactory(http: HttpClient) {
ConfirmDialogModule, ConfirmDialogModule,
ToastModule, ToastModule,
DropdownModule, DropdownModule,
PanelMenuModule,
TranslateModule.forRoot({ TranslateModule.forRoot({
loader: { loader: {
provide: TranslateLoader, provide: TranslateLoader,

View File

@ -0,0 +1,11 @@
<!-- THIS NEED TO BE UPDATED PROPERLY -->
<div class="blankSpace">
<br>
<br>
<br>
</div>
<h4>My Bets</h4>
<p>
This is the bet page. => You will have the possibility to search matches according to the odds you want.
</p>

View File

@ -1,20 +1,20 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { ConfigurationComponent } from './configuration.component'; import { BetComponent } from './bet.component';
describe('ConfigurationComponent', () => { describe('BetComponent', () => {
let component: ConfigurationComponent; let component: BetComponent;
let fixture: ComponentFixture<ConfigurationComponent>; let fixture: ComponentFixture<BetComponent>;
beforeEach(async(() => { beforeEach(async(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
declarations: [ ConfigurationComponent ] declarations: [ BetComponent ]
}) })
.compileComponents(); .compileComponents();
})); }));
beforeEach(() => { beforeEach(() => {
fixture = TestBed.createComponent(ConfigurationComponent); fixture = TestBed.createComponent(BetComponent);
component = fixture.componentInstance; component = fixture.componentInstance;
fixture.detectChanges(); fixture.detectChanges();
}); });

View File

@ -0,0 +1,15 @@
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-bet',
templateUrl: './bet.component.html',
styleUrls: ['./bet.component.css']
})
export class BetComponent implements OnInit {
constructor() { }
ngOnInit() {
}
}

View File

@ -0,0 +1,23 @@
<!-- THIS NEED TO BE UPDATED PROPERLY -->
<div class="blankSpace">
<br>
<br>
<br>
</div>
<h4>My Automations</h4>
<p>
This is the automatisation page. => You will find list of all automations and link to create new one.
</p>
<p>
Here a list with :
Name - last played (used) - Command buttons (edit, delete)
</p>
<button type="button" class="btn btn-primary btn-primary" (click)="OpenSelectedAutomation()">
Open an automation
</button>

View File

@ -1,20 +1,20 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { EditConfigurationComponent } from './edit-configuration.component'; import { AutomationComponent } from './automation.component';
describe('EditConfigurationComponent', () => { describe('AutomationComponent', () => {
let component: EditConfigurationComponent; let component: AutomationComponent;
let fixture: ComponentFixture<EditConfigurationComponent>; let fixture: ComponentFixture<AutomationComponent>;
beforeEach(async(() => { beforeEach(async(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
declarations: [ EditConfigurationComponent ] declarations: [ AutomationComponent ]
}) })
.compileComponents(); .compileComponents();
})); }));
beforeEach(() => { beforeEach(() => {
fixture = TestBed.createComponent(EditConfigurationComponent); fixture = TestBed.createComponent(AutomationComponent);
component = fixture.componentInstance; component = fixture.componentInstance;
fixture.detectChanges(); fixture.detectChanges();
}); });

View File

@ -5,15 +5,15 @@ import { NotificationsService } from '../../../_services/notifications.service';
import { UserInfo } from '../../../_api/models'; import { UserInfo } from '../../../_api/models';
@Component({ @Component({
selector: 'app-configuration', selector: 'app-automation',
templateUrl: './configuration.component.html', templateUrl: './automation.component.html',
styleUrls: ['./configuration.component.css'] styleUrls: ['./automation.component.css']
}) })
export class ConfigurationComponent implements OnInit { export class AutomationComponent implements OnInit {
public ConnectedUser: UserInfo; public ConnectedUser: UserInfo;
public SelectedConfig = 'hkgskjhdskj15'; public SelectedAutomation = 'hkgskjhdskj15';
constructor( constructor(
private _notifications: NotificationsService, private _notifications: NotificationsService,
@ -32,8 +32,8 @@ export class ConfigurationComponent implements OnInit {
}); });
} }
public OpenSelectedConfig() { public OpenSelectedAutomation() {
this._router.navigate([this._router.url, this.SelectedConfig]); this._router.navigate([this._router.url, this.SelectedAutomation]);
} }
} }

View File

@ -0,0 +1,9 @@
<!-- THIS NEED TO BE UPDATED PROPERLY -->
<div class="blankSpace">
<br>
<br>
<br>
</div>
<p>
This is the edit automation page. => (Existing one from MyMirror 1.0) => You will have the chance to personnalize your screen configuration
</p>

View File

@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { EditAutomationComponent } from './edit-automation.component';
describe('EditAutomationComponent', () => {
let component: EditAutomationComponent;
let fixture: ComponentFixture<EditAutomationComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ EditAutomationComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(EditAutomationComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -4,11 +4,11 @@ import { ConfirmationService } from 'primeng/api';
import { NotificationsService } from '../../../../_services/notifications.service'; import { NotificationsService } from '../../../../_services/notifications.service';
@Component({ @Component({
selector: 'app-edit-configuration', selector: 'app-edit-automation',
templateUrl: './edit-configuration.component.html', templateUrl: './edit-automation.component.html',
styleUrls: ['./edit-configuration.component.css'] styleUrls: ['./edit-automation.component.css']
}) })
export class EditConfigurationComponent implements OnInit { export class EditAutomationComponent implements OnInit {
constructor( constructor(
private _notifications: NotificationsService, private _notifications: NotificationsService,

View File

@ -1,15 +0,0 @@
<!-- THIS NEED TO BE UPDATED PROPERLY -->
<div class="blankSpace">
<br>
<br>
<br>
</div>
<p>
This is the config page. => You will find list of all configuration and link to create new one.
</p>
<button type="button" class="btn btn-primary btn-primary" (click)="OpenSelectedConfig()">
Open a config
</button>

View File

@ -1,9 +0,0 @@
<!-- THIS NEED TO BE UPDATED PROPERLY -->
<div class="blankSpace">
<br>
<br>
<br>
</div>
<p>
This is the edit config page. => (Existing one from MyMirror 1.0) => You will have the chance to personnalize your screen configuration
</p>

View File

@ -1,8 +1,6 @@
.sidebar { .sidebar {
position: fixed; position: fixed;
width: 200px; width: 180px;
height: 400px;
background: #000;
} }
.content { .content {
margin-left: 200px; margin-left: 200px;
@ -14,8 +12,6 @@
z-index: 1; z-index: 1;
} }
.info { .info {
width: 1440px;
height: 300px;
position: relative; position: relative;
background: #f55; background: #f55;
} }

View File

@ -1,9 +1,14 @@
<!-- THIS NEED TO BE UPDATED PROPERLY --> <!-- THIS NEED TO BE UPDATED PROPERLY -->
<div class="blankSpace"> <div style="height: 51px" class="blankSpace">
<br> </div>
<br> <div class="sidebar">
<p-panelMenu [model]="items" [style]="{'color': '#3366ff', 'width':'300px'}"></p-panelMenu>
</div> </div>
<div class="sidebar"></div>
<div class="content"> <div class="content">
<div class="info"></div> <div class="info">
<h4>My Dashboard</h4>
<div *ngIf="ShowEnergy">
<app-energy></app-energy>
</div>
</div>
</div> </div>

View File

@ -1,4 +1,7 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import {PanelMenuModule} from 'primeng/panelmenu';
import {MenuItem} from 'primeng/api';
import { ElementSchemaRegistry } from '@angular/compiler';
@Component({ @Component({
selector: 'app-dashboard', selector: 'app-dashboard',
@ -7,9 +10,71 @@ import { Component, OnInit } from '@angular/core';
}) })
export class DashboardComponent implements OnInit { export class DashboardComponent implements OnInit {
items: MenuItem[];
ShowEnergy = false;
constructor() { } constructor() { }
ngOnInit() { ngOnInit() {
// TODO Retrieve list from service (depends on what the user has access to)
this.items = [
{
icon: 'fas fa-seedling',
label: 'Energy',
items: [
{label: 'Electricity', icon: 'fas fa-bolt',
items: [
{label: 'Solar Panel', icon: 'fas fa-solar-panel',
command: () => { this.Open('Energy/Electricity/SolarPanel'); }}
],
command: () => { this.Open('Energy/Electricity'); }},
{label: 'Gas', icon: 'fas fa-burn'},
{label: 'Water', icon: 'fas fa-tint'}
], command: () => { this.Open('Energy'); }
},
{
label: 'Security',
icon: 'fas fa-lock',
items: [
{label: 'Alarm', icon: 'fas fa-bell'},
{label: 'Camera', icon: 'fas fa-video'}
]
},
{
label: 'Entertainment',
icon: 'fas fa-music',
items: [
{
label: 'Music',
icon: 'fas fa-music'
},
{
label: 'Tv',
icon: 'fas fa-tv',
}
]
},
{
label: 'Health',
icon: 'fas fa-heartbeat',
items: [
{
label: 'My body',
icon: ' fas fa-user-alt'
},
{
label: 'Fitness',
icon: 'fas fa-running',
}
]
}
];
}
Open(module: string) {
console.log(module);
this.ShowEnergy = true;
} }
} }

View File

@ -0,0 +1 @@
<p>energy works!</p>

View File

@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { EnergyComponent } from './energy.component';
describe('EnergyComponent', () => {
let component: EnergyComponent;
let fixture: ComponentFixture<EnergyComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ EnergyComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(EnergyComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -0,0 +1,15 @@
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-energy',
templateUrl: './energy.component.html',
styleUrls: ['./energy.component.css']
})
export class EnergyComponent implements OnInit {
constructor() { }
ngOnInit() {
}
}

View File

@ -4,18 +4,29 @@
<br> <br>
<br> <br>
</div> </div>
<h4>My Devices</h4>
<p> <p>
This is the devices page. => You will have the possibility to change parameters for all your screen devices => This is the devices page. => You will have the possibility to change parameters for all your devices =>
</p> </p>
<h4>Actions</h4>
<p> <p>
- Voir l'état de connexion (ou dernière connexion)
- Changer parametres - Changer parametres
- Changer position
- Changer Nom - Changer Nom
- Changer les owners - Changer les owners
- Supprimer du profil - Supprimer du profil
- Voir l'état de connexion - Voir l'état de connexion
- Assigner une configuration (?) - Voir les automatisations dans lesquels les devices jouent un rôle
- Voir le niveau de batterie des devices (si applicable)
</p>
<p>
Ici un petit endroit avec des trois zones : Combien de devices connectés/ non connectés ++
</p>
<p>
Ici un tableau avec la liste des devices
'Etat de connexion/date dernière connexion boule verte ou rouge '- 'Nom' - 'Dernières données recues du devices (si applicable) ou cellule en fonction du type de device' - 'Etat de batterie si applicable' - 'Boutons actions (Edit (changer le nom affiché du device), Supprimer)'
</p> </p>

View File

@ -4,7 +4,7 @@
<br> <br>
<br> <br>
</div> </div>
<h4>My Profile</h4>
<p> <p>
This is your profile view => You can see all your devices (the availability, params?), all your playlists, and links to create new configuration This is your profile view => You can see all your devices (the availability, params?), all your playlists, and links to create new configuration
</p> </p>

View File

@ -27,7 +27,8 @@
}, },
"UserDropDown": { "UserDropDown": {
"Logout": "Logout", "Logout": "Logout",
"ModifyUser": "Edit profile" "ModifyUser": "Edit profile",
"Profile": "My profile"
} }
}, },
"NotFound": { "NotFound": {

File diff suppressed because one or more lines are too long