mirror of
https://github.com/ckaczor/HomeMonitor.git
synced 2026-02-05 09:35:42 -05:00
Start to reorganize
This commit is contained in:
13
Display - Copy/.editorconfig
Normal file
13
Display - Copy/.editorconfig
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
# Editor configuration, see https://editorconfig.org
|
||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
charset = utf-8
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 4
|
||||||
|
insert_final_newline = true
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
|
||||||
|
[*.md]
|
||||||
|
max_line_length = off
|
||||||
|
trim_trailing_whitespace = false
|
||||||
46
Display - Copy/.gitignore
vendored
Normal file
46
Display - Copy/.gitignore
vendored
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
# See http://help.github.com/ignore-files/ for more about ignoring files.
|
||||||
|
|
||||||
|
# compiled output
|
||||||
|
/dist
|
||||||
|
/tmp
|
||||||
|
/out-tsc
|
||||||
|
# Only exists if Bazel was run
|
||||||
|
/bazel-out
|
||||||
|
|
||||||
|
# dependencies
|
||||||
|
/node_modules
|
||||||
|
|
||||||
|
# profiling files
|
||||||
|
chrome-profiler-events*.json
|
||||||
|
speed-measure-plugin*.json
|
||||||
|
|
||||||
|
# IDEs and editors
|
||||||
|
/.idea
|
||||||
|
.project
|
||||||
|
.classpath
|
||||||
|
.c9/
|
||||||
|
*.launch
|
||||||
|
.settings/
|
||||||
|
*.sublime-workspace
|
||||||
|
|
||||||
|
# IDE - VSCode
|
||||||
|
.vscode/*
|
||||||
|
!.vscode/settings.json
|
||||||
|
!.vscode/tasks.json
|
||||||
|
!.vscode/launch.json
|
||||||
|
!.vscode/extensions.json
|
||||||
|
.history/*
|
||||||
|
|
||||||
|
# misc
|
||||||
|
/.sass-cache
|
||||||
|
/connect.lock
|
||||||
|
/coverage
|
||||||
|
/libpeerconnection.log
|
||||||
|
npm-debug.log
|
||||||
|
yarn-error.log
|
||||||
|
testem.log
|
||||||
|
/typings
|
||||||
|
|
||||||
|
# System Files
|
||||||
|
.DS_Store
|
||||||
|
Thumbs.db
|
||||||
27
Display - Copy/README.md
Normal file
27
Display - Copy/README.md
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
# Display
|
||||||
|
|
||||||
|
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 8.3.3.
|
||||||
|
|
||||||
|
## Development server
|
||||||
|
|
||||||
|
Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.
|
||||||
|
|
||||||
|
## Code scaffolding
|
||||||
|
|
||||||
|
Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`.
|
||||||
|
|
||||||
|
## Build
|
||||||
|
|
||||||
|
Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build.
|
||||||
|
|
||||||
|
## Running unit tests
|
||||||
|
|
||||||
|
Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
|
||||||
|
|
||||||
|
## Running end-to-end tests
|
||||||
|
|
||||||
|
Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).
|
||||||
|
|
||||||
|
## Further help
|
||||||
|
|
||||||
|
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).
|
||||||
132
Display - Copy/angular.json
Normal file
132
Display - Copy/angular.json
Normal file
@@ -0,0 +1,132 @@
|
|||||||
|
{
|
||||||
|
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
|
||||||
|
"version": 1,
|
||||||
|
"newProjectRoot": "projects",
|
||||||
|
"projects": {
|
||||||
|
"Display": {
|
||||||
|
"projectType": "application",
|
||||||
|
"schematics": {
|
||||||
|
"@schematics/angular:component": {
|
||||||
|
"style": "scss"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": "",
|
||||||
|
"sourceRoot": "src",
|
||||||
|
"prefix": "app",
|
||||||
|
"architect": {
|
||||||
|
"build": {
|
||||||
|
"builder": "@angular-devkit/build-angular:browser",
|
||||||
|
"options": {
|
||||||
|
"outputPath": "dist/Display",
|
||||||
|
"index": "src/index.html",
|
||||||
|
"main": "src/main.ts",
|
||||||
|
"polyfills": "src/polyfills.ts",
|
||||||
|
"tsConfig": "tsconfig.app.json",
|
||||||
|
"aot": false,
|
||||||
|
"assets": [
|
||||||
|
"src/favicon.ico",
|
||||||
|
"src/assets"
|
||||||
|
],
|
||||||
|
"styles": [
|
||||||
|
"./node_modules/@angular/material/prebuilt-themes/deeppurple-amber.css",
|
||||||
|
"src/styles.scss"
|
||||||
|
],
|
||||||
|
"scripts": []
|
||||||
|
},
|
||||||
|
"configurations": {
|
||||||
|
"production": {
|
||||||
|
"fileReplacements": [
|
||||||
|
{
|
||||||
|
"replace": "src/environments/environment.ts",
|
||||||
|
"with": "src/environments/environment.prod.ts"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"optimization": true,
|
||||||
|
"outputHashing": "all",
|
||||||
|
"sourceMap": false,
|
||||||
|
"extractCss": true,
|
||||||
|
"namedChunks": false,
|
||||||
|
"aot": true,
|
||||||
|
"extractLicenses": true,
|
||||||
|
"vendorChunk": false,
|
||||||
|
"buildOptimizer": true,
|
||||||
|
"budgets": [
|
||||||
|
{
|
||||||
|
"type": "initial",
|
||||||
|
"maximumWarning": "2mb",
|
||||||
|
"maximumError": "5mb"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "anyComponentStyle",
|
||||||
|
"maximumWarning": "6kb",
|
||||||
|
"maximumError": "10kb"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"serve": {
|
||||||
|
"builder": "@angular-devkit/build-angular:dev-server",
|
||||||
|
"options": {
|
||||||
|
"browserTarget": "Display:build"
|
||||||
|
},
|
||||||
|
"configurations": {
|
||||||
|
"production": {
|
||||||
|
"browserTarget": "Display:build:production"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"extract-i18n": {
|
||||||
|
"builder": "@angular-devkit/build-angular:extract-i18n",
|
||||||
|
"options": {
|
||||||
|
"browserTarget": "Display:build"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"test": {
|
||||||
|
"builder": "@angular-devkit/build-angular:karma",
|
||||||
|
"options": {
|
||||||
|
"main": "src/test.ts",
|
||||||
|
"polyfills": "src/polyfills.ts",
|
||||||
|
"tsConfig": "tsconfig.spec.json",
|
||||||
|
"karmaConfig": "karma.conf.js",
|
||||||
|
"assets": [
|
||||||
|
"src/favicon.ico",
|
||||||
|
"src/assets"
|
||||||
|
],
|
||||||
|
"styles": [
|
||||||
|
"./node_modules/@angular/material/prebuilt-themes/deeppurple-amber.css",
|
||||||
|
"src/styles.scss"
|
||||||
|
],
|
||||||
|
"scripts": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"lint": {
|
||||||
|
"builder": "@angular-devkit/build-angular:tslint",
|
||||||
|
"options": {
|
||||||
|
"tsConfig": [
|
||||||
|
"tsconfig.app.json",
|
||||||
|
"tsconfig.spec.json",
|
||||||
|
"e2e/tsconfig.json"
|
||||||
|
],
|
||||||
|
"exclude": [
|
||||||
|
"**/node_modules/**"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"e2e": {
|
||||||
|
"builder": "@angular-devkit/build-angular:protractor",
|
||||||
|
"options": {
|
||||||
|
"protractorConfig": "e2e/protractor.conf.js",
|
||||||
|
"devServerTarget": "Display:serve"
|
||||||
|
},
|
||||||
|
"configurations": {
|
||||||
|
"production": {
|
||||||
|
"devServerTarget": "Display:serve:production"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"defaultProject": "Display"
|
||||||
|
}
|
||||||
12
Display - Copy/browserslist
Normal file
12
Display - Copy/browserslist
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
|
||||||
|
# For additional information regarding the format and rule options, please see:
|
||||||
|
# https://github.com/browserslist/browserslist#queries
|
||||||
|
|
||||||
|
# You can see what browsers were selected by your queries by running:
|
||||||
|
# npx browserslist
|
||||||
|
|
||||||
|
> 0.5%
|
||||||
|
last 2 versions
|
||||||
|
Firefox ESR
|
||||||
|
not dead
|
||||||
|
not IE 9-11 # For IE 9-11 support, remove 'not'.
|
||||||
32
Display - Copy/e2e/protractor.conf.js
Normal file
32
Display - Copy/e2e/protractor.conf.js
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
// @ts-check
|
||||||
|
// Protractor configuration file, see link for more information
|
||||||
|
// https://github.com/angular/protractor/blob/master/lib/config.ts
|
||||||
|
|
||||||
|
const { SpecReporter } = require('jasmine-spec-reporter');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type { import("protractor").Config }
|
||||||
|
*/
|
||||||
|
exports.config = {
|
||||||
|
allScriptsTimeout: 11000,
|
||||||
|
specs: [
|
||||||
|
'./src/**/*.e2e-spec.ts'
|
||||||
|
],
|
||||||
|
capabilities: {
|
||||||
|
'browserName': 'chrome'
|
||||||
|
},
|
||||||
|
directConnect: true,
|
||||||
|
baseUrl: 'http://localhost:4200/',
|
||||||
|
framework: 'jasmine',
|
||||||
|
jasmineNodeOpts: {
|
||||||
|
showColors: true,
|
||||||
|
defaultTimeoutInterval: 30000,
|
||||||
|
print: function() {}
|
||||||
|
},
|
||||||
|
onPrepare() {
|
||||||
|
require('ts-node').register({
|
||||||
|
project: require('path').join(__dirname, './tsconfig.json')
|
||||||
|
});
|
||||||
|
jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
|
||||||
|
}
|
||||||
|
};
|
||||||
23
Display - Copy/e2e/src/app.e2e-spec.ts
Normal file
23
Display - Copy/e2e/src/app.e2e-spec.ts
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
import { AppPage } from './app.po';
|
||||||
|
import { browser, logging } from 'protractor';
|
||||||
|
|
||||||
|
describe('workspace-project App', () => {
|
||||||
|
let page: AppPage;
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
page = new AppPage();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should display welcome message', () => {
|
||||||
|
page.navigateTo();
|
||||||
|
expect(page.getTitleText()).toEqual('Display app is running!');
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(async () => {
|
||||||
|
// Assert that there are no errors emitted from the browser
|
||||||
|
const logs = await browser.manage().logs().get(logging.Type.BROWSER);
|
||||||
|
expect(logs).not.toContain(jasmine.objectContaining({
|
||||||
|
level: logging.Level.SEVERE,
|
||||||
|
} as logging.Entry));
|
||||||
|
});
|
||||||
|
});
|
||||||
11
Display - Copy/e2e/src/app.po.ts
Normal file
11
Display - Copy/e2e/src/app.po.ts
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
import { browser, by, element } from 'protractor';
|
||||||
|
|
||||||
|
export class AppPage {
|
||||||
|
navigateTo() {
|
||||||
|
return browser.get(browser.baseUrl) as Promise<any>;
|
||||||
|
}
|
||||||
|
|
||||||
|
getTitleText() {
|
||||||
|
return element(by.css('app-root .content span')).getText() as Promise<string>;
|
||||||
|
}
|
||||||
|
}
|
||||||
13
Display - Copy/e2e/tsconfig.json
Normal file
13
Display - Copy/e2e/tsconfig.json
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"extends": "../tsconfig.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"outDir": "../out-tsc/e2e",
|
||||||
|
"module": "commonjs",
|
||||||
|
"target": "es5",
|
||||||
|
"types": [
|
||||||
|
"jasmine",
|
||||||
|
"jasminewd2",
|
||||||
|
"node"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
32
Display - Copy/karma.conf.js
Normal file
32
Display - Copy/karma.conf.js
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
// Karma configuration file, see link for more information
|
||||||
|
// https://karma-runner.github.io/1.0/config/configuration-file.html
|
||||||
|
|
||||||
|
module.exports = function (config) {
|
||||||
|
config.set({
|
||||||
|
basePath: '',
|
||||||
|
frameworks: ['jasmine', '@angular-devkit/build-angular'],
|
||||||
|
plugins: [
|
||||||
|
require('karma-jasmine'),
|
||||||
|
require('karma-chrome-launcher'),
|
||||||
|
require('karma-jasmine-html-reporter'),
|
||||||
|
require('karma-coverage-istanbul-reporter'),
|
||||||
|
require('@angular-devkit/build-angular/plugins/karma')
|
||||||
|
],
|
||||||
|
client: {
|
||||||
|
clearContext: false // leave Jasmine Spec Runner output visible in browser
|
||||||
|
},
|
||||||
|
coverageIstanbulReporter: {
|
||||||
|
dir: require('path').join(__dirname, './coverage/Display'),
|
||||||
|
reports: ['html', 'lcovonly', 'text-summary'],
|
||||||
|
fixWebpackSourcePaths: true
|
||||||
|
},
|
||||||
|
reporters: ['progress', 'kjhtml'],
|
||||||
|
port: 9876,
|
||||||
|
colors: true,
|
||||||
|
logLevel: config.LOG_INFO,
|
||||||
|
autoWatch: true,
|
||||||
|
browsers: ['Chrome'],
|
||||||
|
singleRun: false,
|
||||||
|
restartOnFileChange: true
|
||||||
|
});
|
||||||
|
};
|
||||||
13249
Display - Copy/package-lock.json
generated
Normal file
13249
Display - Copy/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
56
Display - Copy/package.json
Normal file
56
Display - Copy/package.json
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
{
|
||||||
|
"name": "display",
|
||||||
|
"version": "0.0.0",
|
||||||
|
"scripts": {
|
||||||
|
"ng": "ng",
|
||||||
|
"start": "ng serve",
|
||||||
|
"build": "ng build",
|
||||||
|
"test": "ng test",
|
||||||
|
"lint": "ng lint",
|
||||||
|
"e2e": "ng e2e"
|
||||||
|
},
|
||||||
|
"private": true,
|
||||||
|
"dependencies": {
|
||||||
|
"@angular/animations": "^8.2.8",
|
||||||
|
"@angular/cdk": "~8.1.4",
|
||||||
|
"@angular/common": "^8.2.8",
|
||||||
|
"@angular/compiler": "^8.2.8",
|
||||||
|
"@angular/core": "^8.2.8",
|
||||||
|
"@angular/forms": "^8.2.8",
|
||||||
|
"@angular/material": "^8.2.1",
|
||||||
|
"@angular/platform-browser": "^8.2.8",
|
||||||
|
"@angular/platform-browser-dynamic": "^8.2.8",
|
||||||
|
"@angular/router": "^8.2.8",
|
||||||
|
"@aspnet/signalr": "^1.1.4",
|
||||||
|
"@webcomponents/custom-elements": "^1.3.0",
|
||||||
|
"angular-highcharts": "^8.0.3",
|
||||||
|
"hammerjs": "^2.0.8",
|
||||||
|
"highcharts": "^7.2.0",
|
||||||
|
"moment": "^2.24.0",
|
||||||
|
"ngx-socket-io": "^3.0.1",
|
||||||
|
"rxjs": "~6.4.0",
|
||||||
|
"tslib": "^1.10.0",
|
||||||
|
"zone.js": "~0.9.1"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@angular-devkit/build-angular": "^0.803.6",
|
||||||
|
"@angular/cli": "^8.3.6",
|
||||||
|
"@angular/compiler-cli": "^8.2.8",
|
||||||
|
"@angular/language-service": "^8.2.8",
|
||||||
|
"@types/jasmine": "~3.3.8",
|
||||||
|
"@types/jasminewd2": "~2.0.3",
|
||||||
|
"@types/node": "~8.9.4",
|
||||||
|
"codelyzer": "^5.1.1",
|
||||||
|
"jasmine-core": "~3.4.0",
|
||||||
|
"jasmine-spec-reporter": "~4.2.1",
|
||||||
|
"karma": "~4.1.0",
|
||||||
|
"karma-chrome-launcher": "~2.2.0",
|
||||||
|
"karma-coverage-istanbul-reporter": "~2.0.1",
|
||||||
|
"karma-jasmine": "~2.0.1",
|
||||||
|
"karma-jasmine-html-reporter": "^1.4.0",
|
||||||
|
"protractor": "~5.4.0",
|
||||||
|
"ts-node": "~7.0.0",
|
||||||
|
"tslint": "~5.15.0",
|
||||||
|
"typescript": "~3.5.3"
|
||||||
|
}
|
||||||
|
}
|
||||||
31
Display - Copy/src/app/app-routing.module.ts
Normal file
31
Display - Copy/src/app/app-routing.module.ts
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { Routes, RouterModule } from '@angular/router';
|
||||||
|
import { DashboardComponent } from './dashboard/dashboard.component';
|
||||||
|
import { LaundryComponent } from './laundry/laundry.component';
|
||||||
|
import { WeatherChartsComponent } from './weather/charts/weather-charts.component';
|
||||||
|
import { WeatherCurrentComponent } from './weather/current/weather-current.component';
|
||||||
|
|
||||||
|
const routes: Routes = [
|
||||||
|
{
|
||||||
|
path: '',
|
||||||
|
component: DashboardComponent
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'weather',
|
||||||
|
component: WeatherCurrentComponent
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'weather-charts/:type',
|
||||||
|
component: WeatherChartsComponent
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'laundry',
|
||||||
|
component: LaundryComponent
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [RouterModule.forRoot(routes)],
|
||||||
|
exports: [RouterModule]
|
||||||
|
})
|
||||||
|
export class AppRoutingModule { }
|
||||||
@@ -1,4 +1,70 @@
|
|||||||
<div class="main-container">
|
<mat-sidenav-container>
|
||||||
|
<mat-sidenav #sidenav role="navigation">
|
||||||
|
<mat-nav-list>
|
||||||
|
<a mat-list-item>
|
||||||
|
<mat-icon class="icon">input</mat-icon>
|
||||||
|
<span class="label">Login</span>
|
||||||
|
</a>
|
||||||
|
<a mat-list-item>
|
||||||
|
<mat-icon class="icon">home</mat-icon>
|
||||||
|
<span class="label">Home</span>
|
||||||
|
</a>
|
||||||
|
<a mat-list-item>
|
||||||
|
<mat-icon class="icon">dashboard</mat-icon>
|
||||||
|
<span class="label">Dashboard</span>
|
||||||
|
</a>
|
||||||
|
<a mat-list-item type="button">
|
||||||
|
<mat-icon class="icon">input</mat-icon>
|
||||||
|
<span class="label">LogOut</span>
|
||||||
|
</a>
|
||||||
|
</mat-nav-list>
|
||||||
|
</mat-sidenav>
|
||||||
|
<mat-sidenav-content>
|
||||||
|
<mat-toolbar color="primary">
|
||||||
|
<div fxHide.gt-xs>
|
||||||
|
<button mat-icon-button>
|
||||||
|
<mat-icon>menu</mat-icon>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<a>
|
||||||
|
Material Blog
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div fxFlex fxLayout fxLayoutAlign="flex-end" fxHide.xs>
|
||||||
|
<ul fxLayout fxLayoutGap="20px" class="navigation-items">
|
||||||
|
<li>
|
||||||
|
<a>
|
||||||
|
<mat-icon class="icon">input</mat-icon>
|
||||||
|
<span class="label">Login</span>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a >
|
||||||
|
<mat-icon class="icon">home</mat-icon>
|
||||||
|
<span class="label">Home</span>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a>
|
||||||
|
<mat-icon class="icon">dashboard</mat-icon>
|
||||||
|
<span class="label">Dashboard</span>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a>
|
||||||
|
<mat-icon class="icon">input</mat-icon>
|
||||||
|
<span class="label">LogOut</span>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</mat-toolbar>
|
||||||
|
<main>
|
||||||
|
</main>
|
||||||
|
</mat-sidenav-content>
|
||||||
|
</mat-sidenav-container>
|
||||||
|
<!-- <div class="main-container">
|
||||||
<header class="header header-3">
|
<header class="header header-3">
|
||||||
<div class="branding">
|
<div class="branding">
|
||||||
<a [routerLink]="['/']">
|
<a [routerLink]="['/']">
|
||||||
@@ -48,4 +114,4 @@
|
|||||||
<router-outlet></router-outlet>
|
<router-outlet></router-outlet>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div> -->
|
||||||
@@ -5,3 +5,7 @@
|
|||||||
position: relative;
|
position: relative;
|
||||||
top: -2px;
|
top: -2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.content-area {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
41
Display - Copy/src/app/app.module.ts
Normal file
41
Display - Copy/src/app/app.module.ts
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
import { BrowserModule } from '@angular/platform-browser';
|
||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { ChartModule } from 'angular-highcharts';
|
||||||
|
import { HttpClientModule } from '@angular/common/http';
|
||||||
|
import { FormsModule } from '@angular/forms';
|
||||||
|
import { AppRoutingModule } from './app-routing.module';
|
||||||
|
import { AppComponent } from './app.component';
|
||||||
|
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
||||||
|
import { SocketIoModule, SocketIoConfig } from 'ngx-socket-io';
|
||||||
|
|
||||||
|
import { MatSidenavModule,MatToolbarModule,MatIconModule,MatListModule} from '@angular/material';
|
||||||
|
|
||||||
|
import { LaundryComponent } from './laundry/laundry.component';
|
||||||
|
import { DashboardComponent } from './dashboard/dashboard.component';
|
||||||
|
import { WeatherChartsComponent } from './weather/charts/weather-charts.component';
|
||||||
|
import { WeatherCurrentComponent } from './weather/current/weather-current.component';
|
||||||
|
|
||||||
|
const config: SocketIoConfig = { url: 'http://home.kaczorzoo.net:9091', options: {} };
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
declarations: [
|
||||||
|
AppComponent,
|
||||||
|
LaundryComponent,
|
||||||
|
DashboardComponent,
|
||||||
|
WeatherChartsComponent,
|
||||||
|
WeatherCurrentComponent
|
||||||
|
],
|
||||||
|
imports: [
|
||||||
|
BrowserModule,
|
||||||
|
AppRoutingModule,
|
||||||
|
BrowserAnimationsModule,
|
||||||
|
SocketIoModule.forRoot(config),
|
||||||
|
ChartModule,
|
||||||
|
HttpClientModule,
|
||||||
|
FormsModule,
|
||||||
|
MatSidenavModule,MatToolbarModule,MatIconModule,MatListModule
|
||||||
|
],
|
||||||
|
providers: [],
|
||||||
|
bootstrap: [AppComponent]
|
||||||
|
})
|
||||||
|
export class AppModule { }
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
<!-- <div [hidden]="!loading" class="page-spinner">
|
||||||
|
<span class="spinner"></span>
|
||||||
|
</div>
|
||||||
|
<div class="chart-content">
|
||||||
|
<header class="chart-header">
|
||||||
|
<clr-dropdown class="clr-dropdown">
|
||||||
|
<button class="btn btn-outline-primary chart-button-spacer" clrDropdownTrigger>
|
||||||
|
{{ timeSpanItems[selectedTimeSpan] }}
|
||||||
|
<clr-icon shape="caret down"></clr-icon>
|
||||||
|
</button>
|
||||||
|
<clr-dropdown-menu clrPosition="bottom-left" *clrIfOpen>
|
||||||
|
<div *ngFor="let item of timeSpanItems | keyvalue" clrDropdownItem [class.active]="+item.key === selectedTimeSpan" (click)="selectedTimeSpan = +item.key">
|
||||||
|
{{ item.value }}
|
||||||
|
</div>
|
||||||
|
</clr-dropdown-menu>
|
||||||
|
</clr-dropdown>
|
||||||
|
<button class="btn btn-outline-primary" [hidden]="selectedTimeSpan !== timeSpans.Day" (click)="handleDateArrowClick(-1)">
|
||||||
|
<clr-icon shape="caret left"></clr-icon>
|
||||||
|
</button>
|
||||||
|
<button class="btn btn-outline-primary chart-button-spacer" [hidden]="selectedTimeSpan !== timeSpans.Day || isSelectedDateToday()" (click)="handleDateArrowClick(1)">
|
||||||
|
<clr-icon shape="caret right"></clr-icon>
|
||||||
|
</button>
|
||||||
|
<button class="btn btn-outline-primary" [hidden]="selectedTimeSpan !== timeSpans.Day || isSelectedDateToday()" (click)="resetToToday()">
|
||||||
|
Today
|
||||||
|
</button>
|
||||||
|
</header>
|
||||||
|
<div id="chart" [chart]="chart"></div>
|
||||||
|
</div> -->
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
.chart-content {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#chart {
|
||||||
|
position: absolute;
|
||||||
|
top: 50px;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chart-header {
|
||||||
|
background-color: rgb(250, 250, 250);
|
||||||
|
height: 50px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chart-button-spacer {
|
||||||
|
margin-right: 20px;
|
||||||
|
}
|
||||||
@@ -4,6 +4,13 @@ import { SeriesLineOptions } from 'highcharts';
|
|||||||
import { HttpClient } from '@angular/common/http';
|
import { HttpClient } from '@angular/common/http';
|
||||||
import { WeatherValue } from 'src/app/weather/service/weather-value';
|
import { WeatherValue } from 'src/app/weather/service/weather-value';
|
||||||
import { ActivatedRoute, ParamMap } from '@angular/router';
|
import { ActivatedRoute, ParamMap } from '@angular/router';
|
||||||
|
import * as moment from 'moment';
|
||||||
|
|
||||||
|
enum TimeSpan {
|
||||||
|
Last24Hours,
|
||||||
|
Day,
|
||||||
|
Custom
|
||||||
|
}
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-weather-charts',
|
selector: 'app-weather-charts',
|
||||||
@@ -12,11 +19,22 @@ import { ActivatedRoute, ParamMap } from '@angular/router';
|
|||||||
})
|
})
|
||||||
export class WeatherChartsComponent implements OnInit {
|
export class WeatherChartsComponent implements OnInit {
|
||||||
|
|
||||||
|
public chart: Chart;
|
||||||
|
|
||||||
private loading = true;
|
private loading = true;
|
||||||
|
private chartType: string;
|
||||||
|
|
||||||
|
public timeSpanItems: { [value: number]: string } = {};
|
||||||
|
public selectedTimeSpan: TimeSpan = TimeSpan.Last24Hours;
|
||||||
|
public selectedDate: Date = moment().startOf('day').toDate();
|
||||||
|
public timeSpans: typeof TimeSpan = TimeSpan;
|
||||||
|
|
||||||
constructor(private route: ActivatedRoute, private httpClient: HttpClient) { }
|
constructor(private route: ActivatedRoute, private httpClient: HttpClient) { }
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
this.timeSpanItems[TimeSpan.Last24Hours] = 'Last 24 hours';
|
||||||
|
this.timeSpanItems[TimeSpan.Day] = 'Day';
|
||||||
|
|
||||||
this.route.params.subscribe(params => {
|
this.route.params.subscribe(params => {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
|
|
||||||
@@ -24,29 +42,79 @@ export class WeatherChartsComponent implements OnInit {
|
|||||||
|
|
||||||
switch (chartType) {
|
switch (chartType) {
|
||||||
case 'temperature':
|
case 'temperature':
|
||||||
this.loadChart('PressureTemperature');
|
this.chartType = 'PressureTemperature';
|
||||||
return;
|
break;
|
||||||
|
|
||||||
case 'humidity':
|
case 'humidity':
|
||||||
this.loadChart('Humidity');
|
this.chartType = 'Humidity';
|
||||||
return;
|
break;
|
||||||
|
|
||||||
case 'pressure':
|
case 'pressure':
|
||||||
this.loadChart('Pressure');
|
this.chartType = 'Pressure';
|
||||||
return;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.loadChart();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private loadChart(chartType: string) {
|
public handleDateArrowClick(value: number) {
|
||||||
const request = this.httpClient.get<WeatherValue[]>(`http://172.23.10.3/api/weather/readings/value-history?weatherValueType=${chartType}&start=2019-09-11T00:00:00-04:00&end=2019-09-12T00:00:00-04:00&bucketMinutes=5`);
|
this.selectedDate = moment(this.selectedDate).add(value, 'day').toDate();
|
||||||
|
|
||||||
|
this.loadChart();
|
||||||
|
}
|
||||||
|
|
||||||
|
public isSelectedDateToday(): boolean {
|
||||||
|
const isToday = moment(this.selectedDate).startOf('day').isSame(moment().startOf('day'));
|
||||||
|
|
||||||
|
return isToday;
|
||||||
|
}
|
||||||
|
|
||||||
|
public resetToToday() {
|
||||||
|
this.selectedDate = moment().startOf('day').toDate();
|
||||||
|
|
||||||
|
this.loadChart();
|
||||||
|
}
|
||||||
|
|
||||||
|
public getSelectedDateDisplayString(): string {
|
||||||
|
return moment(this.selectedDate).format('LL');
|
||||||
|
}
|
||||||
|
|
||||||
|
private loadChart() {
|
||||||
|
let start: Date;
|
||||||
|
let end: Date;
|
||||||
|
|
||||||
|
switch (this.selectedTimeSpan) {
|
||||||
|
case TimeSpan.Last24Hours: {
|
||||||
|
start = moment().subtract(24, 'h').toDate();
|
||||||
|
end = moment().toDate();
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case TimeSpan.Day: {
|
||||||
|
start = moment(this.selectedDate).startOf('d').toDate();
|
||||||
|
end = moment(this.selectedDate).endOf('d').toDate();
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
default: {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const startString = moment(start).toISOString();
|
||||||
|
const endString = moment(end).toISOString();
|
||||||
|
|
||||||
|
const request = this.httpClient.get<WeatherValue[]>(`http://172.23.10.3/api/weather/readings/value-history?weatherValueType=${this.chartType}&start=${startString}&end=${endString}&bucketMinutes=5`);
|
||||||
|
|
||||||
request.subscribe(data => {
|
request.subscribe(data => {
|
||||||
const array = [];
|
const array = [];
|
||||||
|
|
||||||
data.forEach(dataElement => array.push([Date.parse(dataElement.bucket), dataElement.averageValue / 100]));
|
data.forEach(dataElement => array.push([Date.parse(dataElement.bucket), dataElement.averageValue / 100]));
|
||||||
|
|
||||||
const chart = new Chart({
|
this.chart = new Chart({
|
||||||
chart: {
|
chart: {
|
||||||
type: 'line'
|
type: 'line'
|
||||||
},
|
},
|
||||||
0
Display - Copy/src/assets/.gitkeep
Normal file
0
Display - Copy/src/assets/.gitkeep
Normal file
3
Display - Copy/src/environments/environment.prod.ts
Normal file
3
Display - Copy/src/environments/environment.prod.ts
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
export const environment = {
|
||||||
|
production: true
|
||||||
|
};
|
||||||
16
Display - Copy/src/environments/environment.ts
Normal file
16
Display - Copy/src/environments/environment.ts
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
// This file can be replaced during build by using the `fileReplacements` array.
|
||||||
|
// `ng build --prod` replaces `environment.ts` with `environment.prod.ts`.
|
||||||
|
// The list of file replacements can be found in `angular.json`.
|
||||||
|
|
||||||
|
export const environment = {
|
||||||
|
production: false
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* For easier debugging in development mode, you can import the following file
|
||||||
|
* to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`.
|
||||||
|
*
|
||||||
|
* This import should be commented out in production mode because it will have a negative impact
|
||||||
|
* on performance if an error is thrown.
|
||||||
|
*/
|
||||||
|
// import 'zone.js/dist/zone-error'; // Included with Angular CLI.
|
||||||
BIN
Display - Copy/src/favicon.ico
Normal file
BIN
Display - Copy/src/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 948 B |
18
Display - Copy/src/index.html
Normal file
18
Display - Copy/src/index.html
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html lang="en">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>Home Status</title>
|
||||||
|
<base href="/">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<link rel="icon" type="image/x-icon" href="favicon.ico">
|
||||||
|
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500&display=swap" rel="stylesheet">
|
||||||
|
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<app-root></app-root>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
||||||
13
Display - Copy/src/main.ts
Normal file
13
Display - Copy/src/main.ts
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
import 'hammerjs';
|
||||||
|
import { enableProdMode } from '@angular/core';
|
||||||
|
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
||||||
|
|
||||||
|
import { AppModule } from './app/app.module';
|
||||||
|
import { environment } from './environments/environment';
|
||||||
|
|
||||||
|
if (environment.production) {
|
||||||
|
enableProdMode();
|
||||||
|
}
|
||||||
|
|
||||||
|
platformBrowserDynamic().bootstrapModule(AppModule)
|
||||||
|
.catch(err => console.error(err));
|
||||||
63
Display - Copy/src/polyfills.ts
Normal file
63
Display - Copy/src/polyfills.ts
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
/**
|
||||||
|
* This file includes polyfills needed by Angular and is loaded before the app.
|
||||||
|
* You can add your own extra polyfills to this file.
|
||||||
|
*
|
||||||
|
* This file is divided into 2 sections:
|
||||||
|
* 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
|
||||||
|
* 2. Application imports. Files imported after ZoneJS that should be loaded before your main
|
||||||
|
* file.
|
||||||
|
*
|
||||||
|
* The current setup is for so-called "evergreen" browsers; the last versions of browsers that
|
||||||
|
* automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera),
|
||||||
|
* Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile.
|
||||||
|
*
|
||||||
|
* Learn more in https://angular.io/guide/browser-support
|
||||||
|
*/
|
||||||
|
|
||||||
|
/***************************************************************************************************
|
||||||
|
* BROWSER POLYFILLS
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** IE10 and IE11 requires the following for NgClass support on SVG elements */
|
||||||
|
// import 'classlist.js'; // Run `npm install --save classlist.js`.
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Web Animations `@angular/platform-browser/animations`
|
||||||
|
* Only required if AnimationBuilder is used within the application and using IE/Edge or Safari.
|
||||||
|
* Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0).
|
||||||
|
*/
|
||||||
|
// import 'web-animations-js'; // Run `npm install --save web-animations-js`.
|
||||||
|
|
||||||
|
/**
|
||||||
|
* By default, zone.js will patch all possible macroTask and DomEvents
|
||||||
|
* user can disable parts of macroTask/DomEvents patch by setting following flags
|
||||||
|
* because those flags need to be set before `zone.js` being loaded, and webpack
|
||||||
|
* will put import in the top of bundle, so user need to create a separate file
|
||||||
|
* in this directory (for example: zone-flags.ts), and put the following flags
|
||||||
|
* into that file, and then add the following code before importing zone.js.
|
||||||
|
* import './zone-flags.ts';
|
||||||
|
*
|
||||||
|
* The flags allowed in zone-flags.ts are listed here.
|
||||||
|
*
|
||||||
|
* The following flags will work for all browsers.
|
||||||
|
*
|
||||||
|
* (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame
|
||||||
|
* (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick
|
||||||
|
* (window as any).__zone_symbol__UNPATCHED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames
|
||||||
|
*
|
||||||
|
* in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js
|
||||||
|
* with the following flag, it will bypass `zone.js` patch for IE/Edge
|
||||||
|
*
|
||||||
|
* (window as any).__Zone_enable_cross_context_check = true;
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/***************************************************************************************************
|
||||||
|
* Zone JS is required by default for Angular itself.
|
||||||
|
*/
|
||||||
|
import 'zone.js/dist/zone'; // Included with Angular CLI.
|
||||||
|
|
||||||
|
|
||||||
|
/***************************************************************************************************
|
||||||
|
* APPLICATION IMPORTS
|
||||||
|
*/
|
||||||
35
Display - Copy/src/styles.scss
Normal file
35
Display - Copy/src/styles.scss
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
@import "~@angular/material/prebuilt-themes/indigo-pink.css";
|
||||||
|
|
||||||
|
html,
|
||||||
|
body {
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
margin: 0;
|
||||||
|
font-family: Roboto, "Helvetica Neue", sans-serif;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page-spinner {
|
||||||
|
left: 50%;
|
||||||
|
top: 25%;
|
||||||
|
z-index: 999;
|
||||||
|
position: absolute;
|
||||||
|
transform: translateX(-50%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.spinner {
|
||||||
|
height: 115px;
|
||||||
|
width: 115px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidenav .nav-group .nav-list .nav-link {
|
||||||
|
line-height: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.clr-dropdown {
|
||||||
|
margin: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
html, body { height: 100%; }
|
||||||
|
body { margin: 0; font-family: Roboto, "Helvetica Neue", sans-serif; }
|
||||||
20
Display - Copy/src/test.ts
Normal file
20
Display - Copy/src/test.ts
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
|
||||||
|
|
||||||
|
import 'zone.js/dist/zone-testing';
|
||||||
|
import { getTestBed } from '@angular/core/testing';
|
||||||
|
import {
|
||||||
|
BrowserDynamicTestingModule,
|
||||||
|
platformBrowserDynamicTesting
|
||||||
|
} from '@angular/platform-browser-dynamic/testing';
|
||||||
|
|
||||||
|
declare const require: any;
|
||||||
|
|
||||||
|
// First, initialize the Angular testing environment.
|
||||||
|
getTestBed().initTestEnvironment(
|
||||||
|
BrowserDynamicTestingModule,
|
||||||
|
platformBrowserDynamicTesting()
|
||||||
|
);
|
||||||
|
// Then we find all the tests.
|
||||||
|
const context = require.context('./', true, /\.spec\.ts$/);
|
||||||
|
// And load the modules.
|
||||||
|
context.keys().map(context);
|
||||||
18
Display - Copy/tsconfig.app.json
Normal file
18
Display - Copy/tsconfig.app.json
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"extends": "./tsconfig.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"outDir": "./out-tsc/app",
|
||||||
|
"types": []
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"src/main.ts",
|
||||||
|
"src/polyfills.ts"
|
||||||
|
],
|
||||||
|
"include": [
|
||||||
|
"src/**/*.ts"
|
||||||
|
],
|
||||||
|
"exclude": [
|
||||||
|
"src/test.ts",
|
||||||
|
"src/**/*.spec.ts"
|
||||||
|
]
|
||||||
|
}
|
||||||
26
Display - Copy/tsconfig.json
Normal file
26
Display - Copy/tsconfig.json
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
{
|
||||||
|
"compileOnSave": false,
|
||||||
|
"compilerOptions": {
|
||||||
|
"baseUrl": "./",
|
||||||
|
"outDir": "./dist/out-tsc",
|
||||||
|
"sourceMap": true,
|
||||||
|
"declaration": false,
|
||||||
|
"downlevelIteration": true,
|
||||||
|
"experimentalDecorators": true,
|
||||||
|
"module": "esnext",
|
||||||
|
"moduleResolution": "node",
|
||||||
|
"importHelpers": true,
|
||||||
|
"target": "es2015",
|
||||||
|
"typeRoots": [
|
||||||
|
"node_modules/@types"
|
||||||
|
],
|
||||||
|
"lib": [
|
||||||
|
"es2018",
|
||||||
|
"dom"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"angularCompilerOptions": {
|
||||||
|
"fullTemplateTypeCheck": true,
|
||||||
|
"strictInjectionParameters": true
|
||||||
|
}
|
||||||
|
}
|
||||||
18
Display - Copy/tsconfig.spec.json
Normal file
18
Display - Copy/tsconfig.spec.json
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"extends": "./tsconfig.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"outDir": "./out-tsc/spec",
|
||||||
|
"types": [
|
||||||
|
"jasmine",
|
||||||
|
"node"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"src/test.ts",
|
||||||
|
"src/polyfills.ts"
|
||||||
|
],
|
||||||
|
"include": [
|
||||||
|
"src/**/*.spec.ts",
|
||||||
|
"src/**/*.d.ts"
|
||||||
|
]
|
||||||
|
}
|
||||||
91
Display - Copy/tslint.json
Normal file
91
Display - Copy/tslint.json
Normal file
@@ -0,0 +1,91 @@
|
|||||||
|
{
|
||||||
|
"extends": "tslint:recommended",
|
||||||
|
"rules": {
|
||||||
|
"array-type": false,
|
||||||
|
"arrow-parens": false,
|
||||||
|
"deprecation": {
|
||||||
|
"severity": "warning"
|
||||||
|
},
|
||||||
|
"component-class-suffix": true,
|
||||||
|
"contextual-lifecycle": true,
|
||||||
|
"directive-class-suffix": true,
|
||||||
|
"directive-selector": [
|
||||||
|
true,
|
||||||
|
"attribute",
|
||||||
|
"app",
|
||||||
|
"camelCase"
|
||||||
|
],
|
||||||
|
"component-selector": [
|
||||||
|
true,
|
||||||
|
"element",
|
||||||
|
"app",
|
||||||
|
"kebab-case"
|
||||||
|
],
|
||||||
|
"import-blacklist": [
|
||||||
|
true,
|
||||||
|
"rxjs/Rx"
|
||||||
|
],
|
||||||
|
"interface-name": false,
|
||||||
|
"max-classes-per-file": false,
|
||||||
|
"max-line-length": [
|
||||||
|
false
|
||||||
|
],
|
||||||
|
"member-access": false,
|
||||||
|
"member-ordering": [
|
||||||
|
true,
|
||||||
|
{
|
||||||
|
"order": [
|
||||||
|
"static-field",
|
||||||
|
"instance-field",
|
||||||
|
"static-method",
|
||||||
|
"instance-method"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"no-consecutive-blank-lines": false,
|
||||||
|
"no-console": [
|
||||||
|
true,
|
||||||
|
"debug",
|
||||||
|
"info",
|
||||||
|
"time",
|
||||||
|
"timeEnd",
|
||||||
|
"trace"
|
||||||
|
],
|
||||||
|
"no-empty": false,
|
||||||
|
"no-inferrable-types": [
|
||||||
|
true,
|
||||||
|
"ignore-params"
|
||||||
|
],
|
||||||
|
"no-non-null-assertion": true,
|
||||||
|
"no-redundant-jsdoc": true,
|
||||||
|
"no-switch-case-fall-through": true,
|
||||||
|
"no-use-before-declare": true,
|
||||||
|
"no-var-requires": false,
|
||||||
|
"object-literal-key-quotes": [
|
||||||
|
true,
|
||||||
|
"as-needed"
|
||||||
|
],
|
||||||
|
"object-literal-sort-keys": false,
|
||||||
|
"ordered-imports": false,
|
||||||
|
"quotemark": [
|
||||||
|
true,
|
||||||
|
"single"
|
||||||
|
],
|
||||||
|
"trailing-comma": false,
|
||||||
|
"no-conflicting-lifecycle": true,
|
||||||
|
"no-host-metadata-property": true,
|
||||||
|
"no-input-rename": true,
|
||||||
|
"no-inputs-metadata-property": true,
|
||||||
|
"no-output-native": true,
|
||||||
|
"no-output-on-prefix": true,
|
||||||
|
"no-output-rename": true,
|
||||||
|
"no-outputs-metadata-property": true,
|
||||||
|
"template-banana-in-box": true,
|
||||||
|
"template-no-negated-async": true,
|
||||||
|
"use-lifecycle-interface": true,
|
||||||
|
"use-pipe-transform-interface": true
|
||||||
|
},
|
||||||
|
"rulesDirectory": [
|
||||||
|
"codelyzer"
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -28,14 +28,10 @@
|
|||||||
"src/assets"
|
"src/assets"
|
||||||
],
|
],
|
||||||
"styles": [
|
"styles": [
|
||||||
"node_modules/@clr/icons/clr-icons.min.css",
|
"./node_modules/@angular/material/prebuilt-themes/deeppurple-amber.css",
|
||||||
"node_modules/@clr/ui/clr-ui.min.css",
|
|
||||||
"src/styles.scss"
|
"src/styles.scss"
|
||||||
],
|
],
|
||||||
"scripts": [
|
"scripts": []
|
||||||
"node_modules/@webcomponents/custom-elements/custom-elements.min.js",
|
|
||||||
"node_modules/@clr/icons/clr-icons.min.js"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"configurations": {
|
"configurations": {
|
||||||
"production": {
|
"production": {
|
||||||
@@ -98,6 +94,7 @@
|
|||||||
"src/assets"
|
"src/assets"
|
||||||
],
|
],
|
||||||
"styles": [
|
"styles": [
|
||||||
|
"./node_modules/@angular/material/prebuilt-themes/deeppurple-amber.css",
|
||||||
"src/styles.scss"
|
"src/styles.scss"
|
||||||
],
|
],
|
||||||
"scripts": []
|
"scripts": []
|
||||||
@@ -132,4 +129,4 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"defaultProject": "Display"
|
"defaultProject": "Display"
|
||||||
}
|
}
|
||||||
|
|||||||
1030
Display/package-lock.json
generated
1030
Display/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -12,26 +12,24 @@
|
|||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@angular/animations": "~8.2.4",
|
"@angular/animations": "~8.2.4",
|
||||||
"@angular/cdk": "~8.1.4",
|
"@angular/cdk": "^8.2.1",
|
||||||
"@angular/common": "~8.2.4",
|
"@angular/common": "~8.2.4",
|
||||||
"@angular/compiler": "~8.2.4",
|
"@angular/compiler": "~8.2.4",
|
||||||
"@angular/core": "~8.2.4",
|
"@angular/core": "~8.2.4",
|
||||||
"@angular/forms": "~8.2.4",
|
"@angular/forms": "~8.2.4",
|
||||||
|
"@angular/material": "^8.2.1",
|
||||||
"@angular/platform-browser": "~8.2.4",
|
"@angular/platform-browser": "~8.2.4",
|
||||||
"@angular/platform-browser-dynamic": "~8.2.4",
|
"@angular/platform-browser-dynamic": "~8.2.4",
|
||||||
"@angular/router": "~8.2.4",
|
"@angular/router": "~8.2.4",
|
||||||
"@aspnet/signalr": "^1.1.4",
|
"@aspnet/signalr": "^1.1.4",
|
||||||
"@clr/angular": "^2.2.0",
|
|
||||||
"angular-highcharts": "^8.0.3",
|
"angular-highcharts": "^8.0.3",
|
||||||
"hammerjs": "^2.0.8",
|
"hammerjs": "^2.0.8",
|
||||||
"highcharts": "^7.2.0",
|
"highcharts": "^7.2.0",
|
||||||
|
"moment": "^2.24.0",
|
||||||
"ngx-socket-io": "^3.0.1",
|
"ngx-socket-io": "^3.0.1",
|
||||||
"rxjs": "~6.4.0",
|
"rxjs": "~6.4.0",
|
||||||
"tslib": "^1.10.0",
|
"tslib": "^1.10.0",
|
||||||
"zone.js": "~0.9.1",
|
"zone.js": "~0.9.1"
|
||||||
"@clr/ui": "2.2.0",
|
|
||||||
"@clr/icons": "2.2.0",
|
|
||||||
"@webcomponents/custom-elements": "^1.0.0"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@angular-devkit/build-angular": "~0.803.3",
|
"@angular-devkit/build-angular": "~0.803.3",
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
import { Routes, RouterModule } from '@angular/router';
|
import { Routes, RouterModule } from '@angular/router';
|
||||||
import { DashboardComponent } from './dashboard/dashboard.component';
|
import { DashboardComponent } from './components/dashboard/dashboard.component';
|
||||||
import { LaundryComponent } from './laundry/laundry.component';
|
import { LaundryComponent } from './components/laundry/laundry.component';
|
||||||
import { WeatherChartsComponent } from './weather/charts/weather-charts.component';
|
import { WeatherChartsComponent } from './components/weather/charts/weather-charts.component';
|
||||||
import { WeatherCurrentComponent } from './weather/current/weather-current.component';
|
import { WeatherCurrentComponent } from './components/weather/current/weather-current.component';
|
||||||
|
|
||||||
const routes: Routes = [
|
const routes: Routes = [
|
||||||
{
|
{
|
||||||
@@ -25,7 +25,7 @@ const routes: Routes = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [RouterModule.forRoot(routes)],
|
imports: [RouterModule.forRoot(routes)],
|
||||||
exports: [RouterModule]
|
exports: [RouterModule]
|
||||||
})
|
})
|
||||||
export class AppRoutingModule { }
|
export class AppRoutingModule { }
|
||||||
|
|||||||
@@ -2,25 +2,29 @@ import { BrowserModule } from '@angular/platform-browser';
|
|||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
import { ChartModule } from 'angular-highcharts';
|
import { ChartModule } from 'angular-highcharts';
|
||||||
import { HttpClientModule } from '@angular/common/http';
|
import { HttpClientModule } from '@angular/common/http';
|
||||||
import { ClarityModule } from '@clr/angular';
|
|
||||||
|
|
||||||
import { AppRoutingModule } from './app-routing.module';
|
import { AppRoutingModule } from './app-routing.module';
|
||||||
import { AppComponent } from './app.component';
|
import { AppComponent } from './components/app/app.component';
|
||||||
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
||||||
|
|
||||||
|
import { MatToolbarModule, MatIconModule, MatMenuModule, MatButtonModule, MatExpansionModule } from '@angular/material';
|
||||||
|
import { NavComponent } from './components/nav/nav.component';
|
||||||
|
import { LayoutModule } from '@angular/cdk/layout';
|
||||||
|
import { MatSidenavModule } from '@angular/material/sidenav';
|
||||||
|
import { MatListModule } from '@angular/material/list';
|
||||||
|
|
||||||
import { SocketIoModule, SocketIoConfig } from 'ngx-socket-io';
|
import { SocketIoModule, SocketIoConfig } from 'ngx-socket-io';
|
||||||
|
|
||||||
import { WeatherComponent } from './weather/weather.component';
|
import { LaundryComponent } from './components/laundry/laundry.component';
|
||||||
import { LaundryComponent } from './laundry/laundry.component';
|
import { DashboardComponent } from './components/dashboard/dashboard.component';
|
||||||
import { DashboardComponent } from './dashboard/dashboard.component';
|
import { WeatherChartsComponent } from './components/weather/charts/weather-charts.component';
|
||||||
import { WeatherChartsComponent } from './weather/charts/weather-charts.component';
|
import { WeatherCurrentComponent } from './components/weather/current/weather-current.component';
|
||||||
import { WeatherCurrentComponent } from './weather/current/weather-current.component';
|
|
||||||
|
|
||||||
const config: SocketIoConfig = { url: 'http://home.kaczorzoo.net:9091', options: {} };
|
const config: SocketIoConfig = { url: 'http://home.kaczorzoo.net:9091', options: {} };
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
declarations: [
|
declarations: [
|
||||||
AppComponent,
|
AppComponent,
|
||||||
WeatherComponent,
|
NavComponent,
|
||||||
LaundryComponent,
|
LaundryComponent,
|
||||||
DashboardComponent,
|
DashboardComponent,
|
||||||
WeatherChartsComponent,
|
WeatherChartsComponent,
|
||||||
@@ -32,8 +36,15 @@ const config: SocketIoConfig = { url: 'http://home.kaczorzoo.net:9091', options:
|
|||||||
BrowserAnimationsModule,
|
BrowserAnimationsModule,
|
||||||
SocketIoModule.forRoot(config),
|
SocketIoModule.forRoot(config),
|
||||||
ChartModule,
|
ChartModule,
|
||||||
HttpClientModule,
|
HttpClientModule,
|
||||||
ClarityModule
|
MatIconModule,
|
||||||
|
MatButtonModule,
|
||||||
|
MatToolbarModule,
|
||||||
|
MatMenuModule,
|
||||||
|
LayoutModule,
|
||||||
|
MatSidenavModule,
|
||||||
|
MatListModule,
|
||||||
|
MatExpansionModule
|
||||||
],
|
],
|
||||||
providers: [],
|
providers: [],
|
||||||
bootstrap: [AppComponent]
|
bootstrap: [AppComponent]
|
||||||
|
|||||||
1
Display/src/app/components/app/app.component.html
Normal file
1
Display/src/app/components/app/app.component.html
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<app-nav></app-nav>
|
||||||
0
Display/src/app/components/app/app.component.scss
Normal file
0
Display/src/app/components/app/app.component.scss
Normal file
35
Display/src/app/components/app/app.component.spec.ts
Normal file
35
Display/src/app/components/app/app.component.spec.ts
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
import { TestBed, async } from '@angular/core/testing';
|
||||||
|
import { RouterTestingModule } from '@angular/router/testing';
|
||||||
|
import { AppComponent } from './app.component';
|
||||||
|
|
||||||
|
describe('AppComponent', () => {
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
imports: [
|
||||||
|
RouterTestingModule
|
||||||
|
],
|
||||||
|
declarations: [
|
||||||
|
AppComponent
|
||||||
|
],
|
||||||
|
}).compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
it('should create the app', () => {
|
||||||
|
const fixture = TestBed.createComponent(AppComponent);
|
||||||
|
const app = fixture.debugElement.componentInstance;
|
||||||
|
expect(app).toBeTruthy();
|
||||||
|
});
|
||||||
|
|
||||||
|
it(`should have as title 'Display'`, () => {
|
||||||
|
const fixture = TestBed.createComponent(AppComponent);
|
||||||
|
const app = fixture.debugElement.componentInstance;
|
||||||
|
expect(app.title).toEqual('Display');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should render title', () => {
|
||||||
|
const fixture = TestBed.createComponent(AppComponent);
|
||||||
|
fixture.detectChanges();
|
||||||
|
const compiled = fixture.debugElement.nativeElement;
|
||||||
|
expect(compiled.querySelector('.content span').textContent).toContain('Display app is running!');
|
||||||
|
});
|
||||||
|
});
|
||||||
10
Display/src/app/components/app/app.component.ts
Normal file
10
Display/src/app/components/app/app.component.ts
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
import { Component } from '@angular/core';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-root',
|
||||||
|
templateUrl: './app.component.html',
|
||||||
|
styleUrls: ['./app.component.scss']
|
||||||
|
})
|
||||||
|
export class AppComponent {
|
||||||
|
title = 'Display';
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
dashboard works!
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { DashboardComponent } from './dashboard.component';
|
||||||
|
|
||||||
|
describe('DashboardComponent', () => {
|
||||||
|
let component: DashboardComponent;
|
||||||
|
let fixture: ComponentFixture<DashboardComponent>;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [ DashboardComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(DashboardComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
15
Display/src/app/components/dashboard/dashboard.component.ts
Normal file
15
Display/src/app/components/dashboard/dashboard.component.ts
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-dashboard',
|
||||||
|
templateUrl: './dashboard.component.html',
|
||||||
|
styleUrls: ['./dashboard.component.scss']
|
||||||
|
})
|
||||||
|
export class DashboardComponent implements OnInit {
|
||||||
|
|
||||||
|
constructor() { }
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
24
Display/src/app/components/laundry/laundry.component.html
Normal file
24
Display/src/app/components/laundry/laundry.component.html
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
<div class="laundry-current">
|
||||||
|
<div *ngIf="latestStatus === null">
|
||||||
|
Loading...
|
||||||
|
</div>
|
||||||
|
<div *ngIf="latestStatus !== null">
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<td class="laundry-current-header">
|
||||||
|
Washer
|
||||||
|
</td>
|
||||||
|
<td [ngClass]="latestStatus.washer.toString()">
|
||||||
|
{{ latestStatus.washer ? 'On' : 'Off' }}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="laundry-current-header">
|
||||||
|
Dryer
|
||||||
|
</td>
|
||||||
|
<td [ngClass]="latestStatus.dryer.toString()">
|
||||||
|
{{ latestStatus.dryer ? 'On' : 'Off' }}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
17
Display/src/app/components/laundry/laundry.component.scss
Normal file
17
Display/src/app/components/laundry/laundry.component.scss
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
.laundry-current {
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.laundry-current-header {
|
||||||
|
font-weight: 500;
|
||||||
|
text-align: right;
|
||||||
|
padding-right: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.true {
|
||||||
|
color: darkgoldenrod;
|
||||||
|
}
|
||||||
|
|
||||||
|
.false {
|
||||||
|
color: darkgreen;
|
||||||
|
}
|
||||||
25
Display/src/app/components/laundry/laundry.component.spec.ts
Normal file
25
Display/src/app/components/laundry/laundry.component.spec.ts
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { LaundryComponent } from './laundry.component';
|
||||||
|
|
||||||
|
describe('LaundryComponent', () => {
|
||||||
|
let component: LaundryComponent;
|
||||||
|
let fixture: ComponentFixture<LaundryComponent>;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [ LaundryComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(LaundryComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
17
Display/src/app/components/laundry/laundry.component.ts
Normal file
17
Display/src/app/components/laundry/laundry.component.ts
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
import { LaundryService } from '../../services/laundry/laundry.service';
|
||||||
|
import { LaundryStatus } from '../../services/laundry/laundry-status';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-laundry',
|
||||||
|
templateUrl: './laundry.component.html',
|
||||||
|
styleUrls: ['./laundry.component.scss']
|
||||||
|
})
|
||||||
|
export class LaundryComponent implements OnInit {
|
||||||
|
public latestStatus: LaundryStatus;
|
||||||
|
constructor(private laundryService: LaundryService) { }
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
this.laundryService.getLatestStatus().subscribe(s => this.latestStatus = s);
|
||||||
|
}
|
||||||
|
}
|
||||||
22
Display/src/app/components/nav/nav.component.html
Normal file
22
Display/src/app/components/nav/nav.component.html
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
<mat-toolbar color="primary">
|
||||||
|
<button type="button" aria-label="Toggle sidenav" mat-icon-button (click)="drawer.toggle()" *ngIf="isHandset$ | async">
|
||||||
|
<mat-icon aria-label="Side nav toggle icon">menu</mat-icon>
|
||||||
|
</button>
|
||||||
|
<span>Home Monitor</span>
|
||||||
|
</mat-toolbar>
|
||||||
|
<mat-sidenav-container class="sidenav-container">
|
||||||
|
<mat-sidenav #drawer class="sidenav" [attr.role]="(isHandset$ | async) ? 'dialog' : 'navigation'" [mode]="(isHandset$ | async) ? 'over' : 'side'" [opened]="(isHandset$ | async) ? false : true">
|
||||||
|
<mat-nav-list>
|
||||||
|
<a routerLink="/" routerLinkActive="active" [routerLinkActiveOptions]="{ exact: true }" mat-list-item>Dashboard</a>
|
||||||
|
<a routerLink="/laundry" routerLinkActive="active" [routerLinkActiveOptions]="{ exact: true }" mat-list-item>Laundry</a>
|
||||||
|
<a routerLink="/weather" routerLinkActive="active" [routerLinkActiveOptions]="{ exact: true }" mat-list-item>Weather</a>
|
||||||
|
|
||||||
|
<a routerLink="/weather-charts/temperature" routerLinkActive="active" [routerLinkActiveOptions]="{ exact: true }" mat-list-item>Temperature</a>
|
||||||
|
<a routerLink="/weather-charts/humidity" routerLinkActive="active" [routerLinkActiveOptions]="{ exact: true }" mat-list-item>Humidity</a>
|
||||||
|
<a routerLink="/weather-charts/pressure" routerLinkActive="active" [routerLinkActiveOptions]="{ exact: true }" mat-list-item>Pressure</a>
|
||||||
|
</mat-nav-list>
|
||||||
|
</mat-sidenav>
|
||||||
|
<mat-sidenav-content>
|
||||||
|
<router-outlet></router-outlet>
|
||||||
|
</mat-sidenav-content>
|
||||||
|
</mat-sidenav-container>
|
||||||
21
Display/src/app/components/nav/nav.component.scss
Normal file
21
Display/src/app/components/nav/nav.component.scss
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
.sidenav-container {
|
||||||
|
height: calc(100% - 64px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidenav {
|
||||||
|
width: 200px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidenav .mat-toolbar {
|
||||||
|
background: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mat-toolbar.mat-primary {
|
||||||
|
position: sticky;
|
||||||
|
top: 0;
|
||||||
|
z-index: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mat-sidenav-content {
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
40
Display/src/app/components/nav/nav.component.spec.ts
Normal file
40
Display/src/app/components/nav/nav.component.spec.ts
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
import { LayoutModule } from '@angular/cdk/layout';
|
||||||
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||||
|
import { MatButtonModule } from '@angular/material/button';
|
||||||
|
import { MatIconModule } from '@angular/material/icon';
|
||||||
|
import { MatListModule } from '@angular/material/list';
|
||||||
|
import { MatSidenavModule } from '@angular/material/sidenav';
|
||||||
|
import { MatToolbarModule } from '@angular/material/toolbar';
|
||||||
|
|
||||||
|
import { NavComponent } from './nav.component';
|
||||||
|
|
||||||
|
describe('NavComponent', () => {
|
||||||
|
let component: NavComponent;
|
||||||
|
let fixture: ComponentFixture<NavComponent>;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [NavComponent],
|
||||||
|
imports: [
|
||||||
|
NoopAnimationsModule,
|
||||||
|
LayoutModule,
|
||||||
|
MatButtonModule,
|
||||||
|
MatIconModule,
|
||||||
|
MatListModule,
|
||||||
|
MatSidenavModule,
|
||||||
|
MatToolbarModule,
|
||||||
|
]
|
||||||
|
}).compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(NavComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should compile', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
21
Display/src/app/components/nav/nav.component.ts
Normal file
21
Display/src/app/components/nav/nav.component.ts
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
import { Component } from '@angular/core';
|
||||||
|
import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout';
|
||||||
|
import { Observable } from 'rxjs';
|
||||||
|
import { map, shareReplay } from 'rxjs/operators';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-nav',
|
||||||
|
templateUrl: './nav.component.html',
|
||||||
|
styleUrls: ['./nav.component.scss']
|
||||||
|
})
|
||||||
|
export class NavComponent {
|
||||||
|
|
||||||
|
isHandset$: Observable<boolean> = this.breakpointObserver.observe(Breakpoints.Handset)
|
||||||
|
.pipe(
|
||||||
|
map(result => result.matches),
|
||||||
|
shareReplay()
|
||||||
|
);
|
||||||
|
|
||||||
|
constructor(private breakpointObserver: BreakpointObserver) {}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
<!-- <div [hidden]="!loading" class="page-spinner">
|
||||||
|
<span class="spinner"></span>
|
||||||
|
</div> -->
|
||||||
|
<div class="chart-content">
|
||||||
|
<!-- <header class="chart-header">
|
||||||
|
<clr-dropdown class="clr-dropdown">
|
||||||
|
<button class="btn btn-outline-primary chart-button-spacer" clrDropdownTrigger>
|
||||||
|
{{ timeSpanItems[selectedTimeSpan] }}
|
||||||
|
<clr-icon shape="caret down"></clr-icon>
|
||||||
|
</button>
|
||||||
|
<clr-dropdown-menu clrPosition="bottom-left" *clrIfOpen>
|
||||||
|
<div *ngFor="let item of timeSpanItems | keyvalue" clrDropdownItem [class.active]="+item.key === selectedTimeSpan" (click)="selectedTimeSpan = +item.key">
|
||||||
|
{{ item.value }}
|
||||||
|
</div>
|
||||||
|
</clr-dropdown-menu>
|
||||||
|
</clr-dropdown>
|
||||||
|
<button class="btn btn-outline-primary" [hidden]="selectedTimeSpan !== timeSpans.Day" (click)="handleDateArrowClick(-1)">
|
||||||
|
<clr-icon shape="caret left"></clr-icon>
|
||||||
|
</button>
|
||||||
|
<button class="btn btn-outline-primary chart-button-spacer" [hidden]="selectedTimeSpan !== timeSpans.Day || isSelectedDateToday()" (click)="handleDateArrowClick(1)">
|
||||||
|
<clr-icon shape="caret right"></clr-icon>
|
||||||
|
</button>
|
||||||
|
<button class="btn btn-outline-primary" [hidden]="selectedTimeSpan !== timeSpans.Day || isSelectedDateToday()" (click)="resetToToday()">
|
||||||
|
Today
|
||||||
|
</button>
|
||||||
|
</header> -->
|
||||||
|
<div id="chart" [chart]="chart"></div>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
.chart-content {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#chart {
|
||||||
|
position: absolute;
|
||||||
|
top: 50px;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chart-header {
|
||||||
|
background-color: rgb(250, 250, 250);
|
||||||
|
height: 50px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chart-button-spacer {
|
||||||
|
margin-right: 20px;
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { WeatherChartsComponent } from './weather-charts.component';
|
||||||
|
|
||||||
|
describe('WeatherChartsComponent', () => {
|
||||||
|
let component: WeatherChartsComponent;
|
||||||
|
let fixture: ComponentFixture<WeatherChartsComponent>;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [ WeatherChartsComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(WeatherChartsComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,158 @@
|
|||||||
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
import { Chart } from 'angular-highcharts';
|
||||||
|
import { SeriesLineOptions } from 'highcharts';
|
||||||
|
import { HttpClient } from '@angular/common/http';
|
||||||
|
import { WeatherValue } from '../../../services/weather/weather-value';
|
||||||
|
import { ActivatedRoute, ParamMap } from '@angular/router';
|
||||||
|
import * as moment from 'moment';
|
||||||
|
|
||||||
|
enum TimeSpan {
|
||||||
|
Last24Hours,
|
||||||
|
Day,
|
||||||
|
Custom
|
||||||
|
}
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-weather-charts',
|
||||||
|
templateUrl: './weather-charts.component.html',
|
||||||
|
styleUrls: ['./weather-charts.component.scss']
|
||||||
|
})
|
||||||
|
export class WeatherChartsComponent implements OnInit {
|
||||||
|
|
||||||
|
public chart: Chart;
|
||||||
|
|
||||||
|
private loading = true;
|
||||||
|
private chartType: string;
|
||||||
|
|
||||||
|
public timeSpanItems: { [value: number]: string } = {};
|
||||||
|
public selectedTimeSpan: TimeSpan = TimeSpan.Last24Hours;
|
||||||
|
public selectedDate: Date = moment().startOf('day').toDate();
|
||||||
|
public timeSpans: typeof TimeSpan = TimeSpan;
|
||||||
|
|
||||||
|
constructor(private route: ActivatedRoute, private httpClient: HttpClient) { }
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
this.timeSpanItems[TimeSpan.Last24Hours] = 'Last 24 hours';
|
||||||
|
this.timeSpanItems[TimeSpan.Day] = 'Day';
|
||||||
|
|
||||||
|
this.route.params.subscribe(params => {
|
||||||
|
this.loading = true;
|
||||||
|
|
||||||
|
const chartType = params.type;
|
||||||
|
|
||||||
|
switch (chartType) {
|
||||||
|
case 'temperature':
|
||||||
|
this.chartType = 'PressureTemperature';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'humidity':
|
||||||
|
this.chartType = 'Humidity';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'pressure':
|
||||||
|
this.chartType = 'Pressure';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.loadChart();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public handleDateArrowClick(value: number) {
|
||||||
|
this.selectedDate = moment(this.selectedDate).add(value, 'day').toDate();
|
||||||
|
|
||||||
|
this.loadChart();
|
||||||
|
}
|
||||||
|
|
||||||
|
public isSelectedDateToday(): boolean {
|
||||||
|
const isToday = moment(this.selectedDate).startOf('day').isSame(moment().startOf('day'));
|
||||||
|
|
||||||
|
return isToday;
|
||||||
|
}
|
||||||
|
|
||||||
|
public resetToToday() {
|
||||||
|
this.selectedDate = moment().startOf('day').toDate();
|
||||||
|
|
||||||
|
this.loadChart();
|
||||||
|
}
|
||||||
|
|
||||||
|
public getSelectedDateDisplayString(): string {
|
||||||
|
return moment(this.selectedDate).format('LL');
|
||||||
|
}
|
||||||
|
|
||||||
|
private loadChart() {
|
||||||
|
let start: Date;
|
||||||
|
let end: Date;
|
||||||
|
|
||||||
|
switch (this.selectedTimeSpan) {
|
||||||
|
case TimeSpan.Last24Hours: {
|
||||||
|
start = moment().subtract(24, 'h').toDate();
|
||||||
|
end = moment().toDate();
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case TimeSpan.Day: {
|
||||||
|
start = moment(this.selectedDate).startOf('d').toDate();
|
||||||
|
end = moment(this.selectedDate).endOf('d').toDate();
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
default: {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const startString = moment(start).toISOString();
|
||||||
|
const endString = moment(end).toISOString();
|
||||||
|
|
||||||
|
const request = this.httpClient.get<WeatherValue[]>(`http://172.23.10.3/api/weather/readings/value-history?weatherValueType=${this.chartType}&start=${startString}&end=${endString}&bucketMinutes=5`);
|
||||||
|
|
||||||
|
request.subscribe(data => {
|
||||||
|
const array = [];
|
||||||
|
|
||||||
|
let divisor = 1;
|
||||||
|
|
||||||
|
if (this.chartType === 'Pressure') {
|
||||||
|
divisor = 100;
|
||||||
|
}
|
||||||
|
|
||||||
|
data.forEach(dataElement => array.push([Date.parse(dataElement.bucket), dataElement.averageValue / divisor]));
|
||||||
|
|
||||||
|
this.chart = new Chart({
|
||||||
|
chart: {
|
||||||
|
type: 'line'
|
||||||
|
},
|
||||||
|
title: {
|
||||||
|
text: 'Linechart'
|
||||||
|
},
|
||||||
|
credits: {
|
||||||
|
enabled: true
|
||||||
|
},
|
||||||
|
xAxis: {
|
||||||
|
type: 'datetime',
|
||||||
|
},
|
||||||
|
yAxis: {
|
||||||
|
labels: {
|
||||||
|
format: '{value:.2f}'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
time: {
|
||||||
|
useUTC: false
|
||||||
|
},
|
||||||
|
tooltip: {
|
||||||
|
valueDecimals: 2
|
||||||
|
},
|
||||||
|
series: [
|
||||||
|
{
|
||||||
|
name: 'Line 1',
|
||||||
|
data: array
|
||||||
|
} as SeriesLineOptions
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
this.loading = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
<div class="weather-current">
|
||||||
|
<div *ngIf="latestReading === null">
|
||||||
|
Loading...
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div *ngIf="latestReading !== null">
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<td class="weather-current-header">
|
||||||
|
Temperature
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{{ latestReading.HumidityTemperature.toFixed(2) }}°F
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="weather-current-header">
|
||||||
|
Humidity
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{{ latestReading.Humidity.toFixed(2) }}%
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="weather-current-header">
|
||||||
|
Pressure
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{{ (latestReading.Pressure / 100).toFixed(2) }} mbar
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="weather-current-header">
|
||||||
|
Wind
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{{ latestReading.WindSpeed.toFixed(2) }} {{ latestReading.WindDirection }}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="weather-current-header">
|
||||||
|
Rain
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{{ latestReading.Rain.toFixed(2) }}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="weather-current-header">
|
||||||
|
Light
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{{ latestReading.LightLevel.toFixed(2) }}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
.weather-current {
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.weather-current-header {
|
||||||
|
font-weight: 500;
|
||||||
|
text-align: right;
|
||||||
|
padding-right: 10px;
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { WeatherCurrentComponent } from './weather-current.component';
|
||||||
|
|
||||||
|
describe('WeatherCurrentComponent', () => {
|
||||||
|
let component: WeatherCurrentComponent;
|
||||||
|
let fixture: ComponentFixture<WeatherCurrentComponent>;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [ WeatherCurrentComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(WeatherCurrentComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
import { WeatherReading } from '../../../services/weather/weather-reading';
|
||||||
|
import { WeatherService } from '../../../services/weather/weather.service';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-weather-current',
|
||||||
|
templateUrl: './weather-current.component.html',
|
||||||
|
styleUrls: ['./weather-current.component.scss']
|
||||||
|
})
|
||||||
|
export class WeatherCurrentComponent implements OnInit {
|
||||||
|
|
||||||
|
public latestReading: WeatherReading;
|
||||||
|
|
||||||
|
constructor(private weatherService: WeatherService) { }
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
this.weatherService.getLatestReading().subscribe(r => this.latestReading = r);
|
||||||
|
}
|
||||||
|
}
|
||||||
7
Display/src/app/services/laundry/laundry-status.spec.ts
Normal file
7
Display/src/app/services/laundry/laundry-status.spec.ts
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
import { LaundryStatus } from './laundry-status';
|
||||||
|
|
||||||
|
describe('LaundryStatus', () => {
|
||||||
|
it('should create an instance', () => {
|
||||||
|
expect(new LaundryStatus()).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
4
Display/src/app/services/laundry/laundry-status.ts
Normal file
4
Display/src/app/services/laundry/laundry-status.ts
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
export class LaundryStatus {
|
||||||
|
washer = false;
|
||||||
|
dryer = false;
|
||||||
|
}
|
||||||
12
Display/src/app/services/laundry/laundry.service.spec.ts
Normal file
12
Display/src/app/services/laundry/laundry.service.spec.ts
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
import { TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { LaundryService } from './laundry.service';
|
||||||
|
|
||||||
|
describe('LaundryService', () => {
|
||||||
|
beforeEach(() => TestBed.configureTestingModule({}));
|
||||||
|
|
||||||
|
it('should be created', () => {
|
||||||
|
const service: LaundryService = TestBed.get(LaundryService);
|
||||||
|
expect(service).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
31
Display/src/app/services/laundry/laundry.service.ts
Normal file
31
Display/src/app/services/laundry/laundry.service.ts
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
import { Injectable } from '@angular/core';
|
||||||
|
import { Observable, BehaviorSubject } from 'rxjs';
|
||||||
|
import { Socket } from 'ngx-socket-io';
|
||||||
|
import { LaundryStatus } from './laundry-status';
|
||||||
|
|
||||||
|
@Injectable({
|
||||||
|
providedIn: 'root'
|
||||||
|
})
|
||||||
|
export class LaundryService {
|
||||||
|
private latestStatus: BehaviorSubject<LaundryStatus> = new BehaviorSubject<LaundryStatus>(new LaundryStatus());
|
||||||
|
|
||||||
|
constructor(private socket: Socket) {
|
||||||
|
this.socket.on('status', (statusString: string) => {
|
||||||
|
const newStatus: LaundryStatus = JSON.parse(statusString);
|
||||||
|
|
||||||
|
if (newStatus.washer !== undefined) {
|
||||||
|
this.latestStatus.value.washer = newStatus.washer;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (newStatus.dryer !== undefined) {
|
||||||
|
this.latestStatus.value.dryer = newStatus.dryer;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.socket.emit('getStatus');
|
||||||
|
}
|
||||||
|
|
||||||
|
getLatestStatus(): Observable<LaundryStatus> {
|
||||||
|
return this.latestStatus.asObservable();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
{{loading}}
|
|
||||||
<div id="chart" [chart]="chart"></div>
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
#chart {
|
|
||||||
height: 100%;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
@@ -1,4 +1,9 @@
|
|||||||
/* You can add global styles to this file, and also import other style files */
|
html,
|
||||||
|
body {
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
html, body { height: 100%; }
|
body {
|
||||||
body { margin: 0; font-family: Roboto, "Helvetica Neue", sans-serif; }
|
margin: 0;
|
||||||
|
font-family: Roboto, "Helvetica Neue", sans-serif;
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user