Ver código fonte

Initial Setup - Express Webserver + Angular UI Projects

Christian Kahlau 3 anos atrás
pai
commit
819419f3ec
47 arquivos alterados com 1444 adições e 56 exclusões
  1. 2 2
      .gitignore
  2. 0 0
      common/types/buffered-data.d.ts
  3. 0 0
      common/types/reduced-data.d.ts
  4. 31 0
      common/util/logger.class.ts
  5. 2 2
      daemon/package.json
  6. 12 12
      daemon/src/index.ts
  7. 0 25
      daemon/src/util/logger.class.ts
  8. 14 15
      daemon/tsconfig.json
  9. 16 0
      ng/.browserslistrc
  10. 16 0
      ng/.editorconfig
  11. 42 0
      ng/.gitignore
  12. 4 0
      ng/.vscode/extensions.json
  13. 20 0
      ng/.vscode/launch.json
  14. 42 0
      ng/.vscode/tasks.json
  15. 27 0
      ng/README.md
  16. 97 0
      ng/angular.json
  17. 44 0
      ng/karma.conf.js
  18. 38 0
      ng/package.json
  19. 10 0
      ng/src/app/app-routing.module.ts
  20. 441 0
      ng/src/app/app.component.html
  21. 0 0
      ng/src/app/app.component.scss
  22. 35 0
      ng/src/app/app.component.spec.ts
  23. 10 0
      ng/src/app/app.component.ts
  24. 18 0
      ng/src/app/app.module.ts
  25. 0 0
      ng/src/assets/.gitkeep
  26. 3 0
      ng/src/environments/environment.prod.ts
  27. 16 0
      ng/src/environments/environment.ts
  28. BIN
      ng/src/favicon.ico
  29. 13 0
      ng/src/index.html
  30. 12 0
      ng/src/main.ts
  31. 53 0
      ng/src/polyfills.ts
  32. 1 0
      ng/src/styles.scss
  33. 26 0
      ng/src/test.ts
  34. 15 0
      ng/tsconfig.app.json
  35. 32 0
      ng/tsconfig.json
  36. 18 0
      ng/tsconfig.spec.json
  37. 21 0
      server/package.json
  38. 256 0
      server/public/3rdpartylicenses.txt
  39. BIN
      server/public/favicon.ico
  40. 12 0
      server/public/index.html
  41. 0 0
      server/public/main.bf8da756f0418f2d.js
  42. 0 0
      server/public/polyfills.eb8ade22ac9b8bf5.js
  43. 1 0
      server/public/runtime.67ac9629723b967d.js
  44. 0 0
      server/public/styles.ef46db3751d8e999.css
  45. 11 0
      server/src/index.ts
  46. 18 0
      server/src/webserver.ts
  47. 15 0
      server/tsconfig.json

+ 2 - 2
.gitignore

@@ -1,5 +1,5 @@
 node_modules/
 package-lock.json
 
-data/
-dist/
+daemon/data/
+daemon/dist/

+ 0 - 0
daemon/src/types/buffered-data.d.ts → common/types/buffered-data.d.ts


+ 0 - 0
daemon/src/types/reduced-data.d.ts → common/types/reduced-data.d.ts


+ 31 - 0
common/util/logger.class.ts

@@ -0,0 +1,31 @@
+export type LogLevel = 'ERROR' | 'WARNING' | 'INFO' | 'DEBUG';
+export class Logger {
+  public static get LOG_LEVELS(): Array<LogLevel> {
+    return ['ERROR', 'WARNING', 'INFO', 'DEBUG'];
+  }
+  private static levels: Array<LogLevel>;
+
+  public static set logLevel(logLevel: LogLevel) {
+    Logger.levels = Logger.LOG_LEVELS.slice(0, Logger.LOG_LEVELS.indexOf(logLevel) + 1);
+  }
+
+  public static get logLevel(): LogLevel {
+    return Logger.levels[Logger.levels.length - 1];
+  }
+
+  public static debug(...data: any[]) {
+    if (Logger.levels.includes('DEBUG')) console.log(...data);
+  }
+
+  public static info(...data: any[]) {
+    if (Logger.levels.includes('INFO')) console.log(...data);
+  }
+
+  public static warn(...data: any[]) {
+    if (Logger.levels.includes('WARNING')) console.warn(...data);
+  }
+
+  public static error(...data: any[]) {
+    if (Logger.levels.includes('ERROR')) console.error(...data);
+  }
+}

+ 2 - 2
daemon/package.json

@@ -1,8 +1,8 @@
 {
-  "name": "monitoring",
+  "name": "monitoring-daemon",
   "version": "1.0.0",
   "description": "",
-  "main": "dist/index.js",
+  "main": "dist/daemon/src/index.js",
   "scripts": {
     "start": "npm run build && node .",
     "build": "tsc -b"

+ 12 - 12
daemon/src/index.ts

@@ -2,10 +2,10 @@ import dotenv from 'dotenv';
 import fs, { PathLike } from 'fs';
 import fsp from 'fs/promises';
 import path from 'path';
-import moment, { Moment } from 'moment';
+import moment from 'moment';
 import { exec } from 'node-utils/shell';
 
-import { Logger, LogLevel } from './util/logger.class';
+import { Logger, LogLevel } from '../../common/util/logger.class';
 
 dotenv.config();
 
@@ -38,11 +38,11 @@ const CSV_COLS = {
 };
 
 const LOG_LEVEL: LogLevel = (process.env.LOG_LEVEL as LogLevel) || 'INFO';
-const log = new Logger(LOG_LEVEL);
+Logger.logLevel = LOG_LEVEL;
 
 let intervalHdl: NodeJS.Timer;
 
-log.info('[INFO] Starting Monitoring Deamon, pid:', process.pid);
+Logger.info('[INFO] Starting Monitoring Deamon, pid:', process.pid);
 (async () => {
   process.on('SIGABRT', exitGracefully);
   process.on('SIGQUIT', exitGracefully);
@@ -68,15 +68,15 @@ log.info('[INFO] Starting Monitoring Deamon, pid:', process.pid);
           const tmpFile = await createTmpFile();
           process.nextTick(() => reduceData(tmpFile));
         } catch (err) {
-          log.error('[ERROR] Creating Temp File for Reducing Data failed:', err);
+          Logger.error('[ERROR] Creating Temp File for Reducing Data failed:', err);
         }
       }
 
       await fsp.appendFile(DATA_BUFFER_FILE, data);
     }, 500);
   } catch (err) {
-    log.error('[FATAL]', err);
-    log.error('[EXITING]');
+    Logger.error('[FATAL]', err);
+    Logger.error('[EXITING]');
     process.exit(1);
   }
 })();
@@ -127,7 +127,7 @@ async function createTmpFile() {
 
 async function reduceData(tmpFilename: string) {
   const tmpFilepath = path.resolve(DATA_DIR, tmpFilename);
-  log.info('[INFO] Reducing data in', tmpFilepath);
+  Logger.info('[INFO] Reducing data in', tmpFilepath);
   try {
     const lines: string[][] = [];
     if (fs.existsSync(DATA_BUFFER_REMAINS)) {
@@ -140,7 +140,7 @@ async function reduceData(tmpFilename: string) {
     do {
       const line = lines.shift();
       const data = parseData(line);
-      log.debug('[DEBUG] BufferedData:', JSON.stringify(data));
+      Logger.debug('[DEBUG] BufferedData:', JSON.stringify(data));
       valueBuffer.push(data);
 
       if (valueBuffer.length <= 1) {
@@ -178,7 +178,7 @@ async function reduceData(tmpFilename: string) {
           }
         });
 
-        log.debug('[DEBUG] ReducedData:', JSON.stringify(reduced[reduced.length - 1]));
+        Logger.debug('[DEBUG] ReducedData:', JSON.stringify(reduced[reduced.length - 1]));
 
         valueBuffer = [];
       }
@@ -200,7 +200,7 @@ async function reduceData(tmpFilename: string) {
     // Delete tmpFile
     await fsp.unlink(tmpFilepath);
   } catch (err) {
-    log.error(`[ERROR] Reducing Data of tmpFile ${tmpFilepath} failed:`, err);
+    Logger.error(`[ERROR] Reducing Data of tmpFile ${tmpFilepath} failed:`, err);
   }
 }
 
@@ -259,7 +259,7 @@ function serializeReducedDataCSV(data: ReducedData) {
 }
 
 function exitGracefully(...args: any[]) {
-  log.info(`[EXITING] Graceful exit, received ${JSON.stringify(args)}`);
+  Logger.info(`[EXITING] Graceful exit, received ${JSON.stringify(args)}`);
   clearInterval(intervalHdl);
   process.exit(0);
 }

+ 0 - 25
daemon/src/util/logger.class.ts

@@ -1,25 +0,0 @@
-export type LogLevel = 'ERROR' | 'WARNING' | 'INFO' | 'DEBUG';
-export class Logger {
-  public static LOG_LEVELS: Array<LogLevel> = ['ERROR', 'WARNING', 'INFO', 'DEBUG'];
-  private levels: Array<LogLevel>;
-
-  constructor(logLevel: LogLevel) {
-    this.levels = Logger.LOG_LEVELS.slice(0, Logger.LOG_LEVELS.indexOf(logLevel) + 1);
-  }
-
-  public debug(...data: any[]) {
-    if (this.levels.includes('DEBUG')) console.log(...data);
-  }
-
-  public info(...data: any[]) {
-    if (this.levels.includes('INFO')) console.log(...data);
-  }
-
-  public warn(...data: any[]) {
-    if (this.levels.includes('WARNING')) console.warn(...data);
-  }
-
-  public error(...data: any[]) {
-    if (this.levels.includes('ERROR')) console.error(...data);
-  }
-}

+ 14 - 15
daemon/tsconfig.json

@@ -1,16 +1,15 @@
 {
-    "compilerOptions": {
-      "outDir": "./dist",
-      "esModuleInterop": true,
-      "moduleResolution": "node",
-      "module": "commonjs",
-      "target": "ES2016",
-      "sourceMap": true,
-      "baseUrl": "./src",
-      "paths": {
-        "*": ["node_modules/*", "src/*"]
-      }
-    },
-    "include": ["./src/*", "./src/**/*"]
-  }
-  
+  "compilerOptions": {
+    "outDir": "./dist",
+    "esModuleInterop": true,
+    "moduleResolution": "node",
+    "module": "commonjs",
+    "target": "ES2016",
+    "sourceMap": true,
+    "baseUrl": "./src",
+    "paths": {
+      "*": ["node_modules/*", "src/*", "../common/*"]
+    }
+  },
+  "include": ["./src/*", "./src/**/*, ../common/*", "../common/**/*"]
+}

+ 16 - 0
ng/.browserslistrc

@@ -0,0 +1,16 @@
+# 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
+
+# For the full list of supported browsers by the Angular framework, please see:
+# https://angular.io/guide/browser-support
+
+# You can see what browsers were selected by your queries by running:
+#   npx browserslist
+
+last 1 Chrome version
+last 1 Firefox version
+last 2 Edge major versions
+last 2 Safari major versions
+last 2 iOS major versions
+Firefox ESR

+ 16 - 0
ng/.editorconfig

@@ -0,0 +1,16 @@
+# Editor configuration, see https://editorconfig.org
+root = true
+
+[*]
+charset = utf-8
+indent_style = space
+indent_size = 2
+insert_final_newline = true
+trim_trailing_whitespace = true
+
+[*.ts]
+quote_type = single
+
+[*.md]
+max_line_length = off
+trim_trailing_whitespace = false

+ 42 - 0
ng/.gitignore

@@ -0,0 +1,42 @@
+# See http://help.github.com/ignore-files/ for more about ignoring files.
+
+# Compiled output
+/dist
+/tmp
+/out-tsc
+/bazel-out
+
+# Node
+/node_modules
+npm-debug.log
+yarn-error.log
+
+# IDEs and editors
+.idea/
+.project
+.classpath
+.c9/
+*.launch
+.settings/
+*.sublime-workspace
+
+# Visual Studio Code
+.vscode/*
+!.vscode/settings.json
+!.vscode/tasks.json
+!.vscode/launch.json
+!.vscode/extensions.json
+.history/*
+
+# Miscellaneous
+/.angular/cache
+.sass-cache/
+/connect.lock
+/coverage
+/libpeerconnection.log
+testem.log
+/typings
+
+# System files
+.DS_Store
+Thumbs.db

+ 4 - 0
ng/.vscode/extensions.json

@@ -0,0 +1,4 @@
+{
+  // For more information, visit: https://go.microsoft.com/fwlink/?linkid=827846
+  "recommendations": ["angular.ng-template"]
+}

+ 20 - 0
ng/.vscode/launch.json

@@ -0,0 +1,20 @@
+{
+  // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
+  "version": "0.2.0",
+  "configurations": [
+    {
+      "name": "ng serve",
+      "type": "pwa-chrome",
+      "request": "launch",
+      "preLaunchTask": "npm: start",
+      "url": "http://localhost:4200/"
+    },
+    {
+      "name": "ng test",
+      "type": "chrome",
+      "request": "launch",
+      "preLaunchTask": "npm: test",
+      "url": "http://localhost:9876/debug.html"
+    }
+  ]
+}

+ 42 - 0
ng/.vscode/tasks.json

@@ -0,0 +1,42 @@
+{
+  // For more information, visit: https://go.microsoft.com/fwlink/?LinkId=733558
+  "version": "2.0.0",
+  "tasks": [
+    {
+      "type": "npm",
+      "script": "start",
+      "isBackground": true,
+      "problemMatcher": {
+        "owner": "typescript",
+        "pattern": "$tsc",
+        "background": {
+          "activeOnStart": true,
+          "beginsPattern": {
+            "regexp": "(.*?)"
+          },
+          "endsPattern": {
+            "regexp": "bundle generation complete"
+          }
+        }
+      }
+    },
+    {
+      "type": "npm",
+      "script": "test",
+      "isBackground": true,
+      "problemMatcher": {
+        "owner": "typescript",
+        "pattern": "$tsc",
+        "background": {
+          "activeOnStart": true,
+          "beginsPattern": {
+            "regexp": "(.*?)"
+          },
+          "endsPattern": {
+            "regexp": "bundle generation complete"
+          }
+        }
+      }
+    }
+  ]
+}

+ 27 - 0
ng/README.md

@@ -0,0 +1,27 @@
+# Ng
+
+This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 14.2.3.
+
+## Development server
+
+Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The application 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.
+
+## 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 a platform of your choice. To use this command, you need to first add a package that implements end-to-end testing capabilities.
+
+## Further help
+
+To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.

+ 97 - 0
ng/angular.json

@@ -0,0 +1,97 @@
+{
+  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
+  "version": 1,
+  "newProjectRoot": "projects",
+  "projects": {
+    "ng": {
+      "projectType": "application",
+      "schematics": {
+        "@schematics/angular:component": {
+          "style": "scss"
+        }
+      },
+      "root": "",
+      "sourceRoot": "src",
+      "prefix": "app",
+      "architect": {
+        "build": {
+          "builder": "@angular-devkit/build-angular:browser",
+          "options": {
+            "outputPath": "../server/public",
+            "index": "src/index.html",
+            "main": "src/main.ts",
+            "polyfills": "src/polyfills.ts",
+            "tsConfig": "tsconfig.app.json",
+            "inlineStyleLanguage": "scss",
+            "assets": ["src/favicon.ico", "src/assets"],
+            "styles": ["src/styles.scss"],
+            "scripts": []
+          },
+          "configurations": {
+            "production": {
+              "budgets": [
+                {
+                  "type": "initial",
+                  "maximumWarning": "500kb",
+                  "maximumError": "1mb"
+                },
+                {
+                  "type": "anyComponentStyle",
+                  "maximumWarning": "2kb",
+                  "maximumError": "4kb"
+                }
+              ],
+              "fileReplacements": [
+                {
+                  "replace": "src/environments/environment.ts",
+                  "with": "src/environments/environment.prod.ts"
+                }
+              ],
+              "outputHashing": "all"
+            },
+            "development": {
+              "buildOptimizer": false,
+              "optimization": false,
+              "vendorChunk": true,
+              "extractLicenses": false,
+              "sourceMap": true,
+              "namedChunks": true
+            }
+          },
+          "defaultConfiguration": "production"
+        },
+        "serve": {
+          "builder": "@angular-devkit/build-angular:dev-server",
+          "configurations": {
+            "production": {
+              "browserTarget": "ng:build:production"
+            },
+            "development": {
+              "browserTarget": "ng:build:development"
+            }
+          },
+          "defaultConfiguration": "development"
+        },
+        "extract-i18n": {
+          "builder": "@angular-devkit/build-angular:extract-i18n",
+          "options": {
+            "browserTarget": "ng: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",
+            "inlineStyleLanguage": "scss",
+            "assets": ["src/favicon.ico", "src/assets"],
+            "styles": ["src/styles.scss"],
+            "scripts": []
+          }
+        }
+      }
+    }
+  }
+}

+ 44 - 0
ng/karma.conf.js

@@ -0,0 +1,44 @@
+// 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'),
+      require('@angular-devkit/build-angular/plugins/karma')
+    ],
+    client: {
+      jasmine: {
+        // you can add configuration options for Jasmine here
+        // the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html
+        // for example, you can disable the random execution with `random: false`
+        // or set a specific seed with `seed: 4321`
+      },
+      clearContext: false // leave Jasmine Spec Runner output visible in browser
+    },
+    jasmineHtmlReporter: {
+      suppressAll: true // removes the duplicated traces
+    },
+    coverageReporter: {
+      dir: require('path').join(__dirname, './coverage/ng'),
+      subdir: '.',
+      reporters: [
+        { type: 'html' },
+        { type: 'text-summary' }
+      ]
+    },
+    reporters: ['progress', 'kjhtml'],
+    port: 9876,
+    colors: true,
+    logLevel: config.LOG_INFO,
+    autoWatch: true,
+    browsers: ['Chrome'],
+    singleRun: false,
+    restartOnFileChange: true
+  });
+};

+ 38 - 0
ng/package.json

@@ -0,0 +1,38 @@
+{
+  "name": "monitoring-ng",
+  "version": "1.0.0",
+  "scripts": {
+    "ng": "ng",
+    "start": "ng serve",
+    "build": "ng build",
+    "watch": "ng build --watch --configuration development",
+    "test": "ng test"
+  },
+  "private": true,
+  "dependencies": {
+    "@angular/animations": "^14.2.0",
+    "@angular/common": "^14.2.0",
+    "@angular/compiler": "^14.2.0",
+    "@angular/core": "^14.2.0",
+    "@angular/forms": "^14.2.0",
+    "@angular/platform-browser": "^14.2.0",
+    "@angular/platform-browser-dynamic": "^14.2.0",
+    "@angular/router": "^14.2.0",
+    "rxjs": "~7.5.0",
+    "tslib": "^2.3.0",
+    "zone.js": "~0.11.4"
+  },
+  "devDependencies": {
+    "@angular-devkit/build-angular": "^14.2.3",
+    "@angular/cli": "~14.2.3",
+    "@angular/compiler-cli": "^14.2.0",
+    "@types/jasmine": "~4.0.0",
+    "jasmine-core": "~4.3.0",
+    "karma": "~6.4.0",
+    "karma-chrome-launcher": "~3.1.0",
+    "karma-coverage": "~2.2.0",
+    "karma-jasmine": "~5.1.0",
+    "karma-jasmine-html-reporter": "~2.0.0",
+    "typescript": "~4.7.2"
+  }
+}

+ 10 - 0
ng/src/app/app-routing.module.ts

@@ -0,0 +1,10 @@
+import { NgModule } from '@angular/core';
+import { RouterModule, Routes } from '@angular/router';
+
+const routes: Routes = [];
+
+@NgModule({
+  imports: [RouterModule.forRoot(routes)],
+  exports: [RouterModule]
+})
+export class AppRoutingModule { }

Diferenças do arquivo suprimidas por serem muito extensas
+ 441 - 0
ng/src/app/app.component.html


+ 0 - 0
ng/src/app/app.component.scss


+ 35 - 0
ng/src/app/app.component.spec.ts

@@ -0,0 +1,35 @@
+import { TestBed } from '@angular/core/testing';
+import { RouterTestingModule } from '@angular/router/testing';
+import { AppComponent } from './app.component';
+
+describe('AppComponent', () => {
+  beforeEach(async () => {
+    await TestBed.configureTestingModule({
+      imports: [
+        RouterTestingModule
+      ],
+      declarations: [
+        AppComponent
+      ],
+    }).compileComponents();
+  });
+
+  it('should create the app', () => {
+    const fixture = TestBed.createComponent(AppComponent);
+    const app = fixture.componentInstance;
+    expect(app).toBeTruthy();
+  });
+
+  it(`should have as title 'ng'`, () => {
+    const fixture = TestBed.createComponent(AppComponent);
+    const app = fixture.componentInstance;
+    expect(app.title).toEqual('ng');
+  });
+
+  it('should render title', () => {
+    const fixture = TestBed.createComponent(AppComponent);
+    fixture.detectChanges();
+    const compiled = fixture.nativeElement as HTMLElement;
+    expect(compiled.querySelector('.content span')?.textContent).toContain('ng app is running!');
+  });
+});

+ 10 - 0
ng/src/app/app.component.ts

@@ -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 = 'ng';
+}

+ 18 - 0
ng/src/app/app.module.ts

@@ -0,0 +1,18 @@
+import { NgModule } from '@angular/core';
+import { BrowserModule } from '@angular/platform-browser';
+
+import { AppRoutingModule } from './app-routing.module';
+import { AppComponent } from './app.component';
+
+@NgModule({
+  declarations: [
+    AppComponent
+  ],
+  imports: [
+    BrowserModule,
+    AppRoutingModule
+  ],
+  providers: [],
+  bootstrap: [AppComponent]
+})
+export class AppModule { }

+ 0 - 0
ng/src/assets/.gitkeep


+ 3 - 0
ng/src/environments/environment.prod.ts

@@ -0,0 +1,3 @@
+export const environment = {
+  production: true
+};

+ 16 - 0
ng/src/environments/environment.ts

@@ -0,0 +1,16 @@
+// This file can be replaced during build by using the `fileReplacements` array.
+// `ng build` 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/plugins/zone-error';  // Included with Angular CLI.

BIN
ng/src/favicon.ico


+ 13 - 0
ng/src/index.html

@@ -0,0 +1,13 @@
+<!doctype html>
+<html lang="en">
+<head>
+  <meta charset="utf-8">
+  <title>Ng</title>
+  <base href="/">
+  <meta name="viewport" content="width=device-width, initial-scale=1">
+  <link rel="icon" type="image/x-icon" href="favicon.ico">
+</head>
+<body>
+  <app-root></app-root>
+</body>
+</html>

+ 12 - 0
ng/src/main.ts

@@ -0,0 +1,12 @@
+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));

+ 53 - 0
ng/src/polyfills.ts

@@ -0,0 +1,53 @@
+/**
+ * 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 recent versions of Safari, Chrome (including
+ * Opera), Edge on the desktop, and iOS and Chrome on mobile.
+ *
+ * Learn more in https://angular.io/guide/browser-support
+ */
+
+/***************************************************************************************************
+ * BROWSER POLYFILLS
+ */
+
+/**
+ * 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';
+ *
+ * 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';  // Included with Angular CLI.
+
+
+/***************************************************************************************************
+ * APPLICATION IMPORTS
+ */

+ 1 - 0
ng/src/styles.scss

@@ -0,0 +1 @@
+/* You can add global styles to this file, and also import other style files */

+ 26 - 0
ng/src/test.ts

@@ -0,0 +1,26 @@
+// This file is required by karma.conf.js and loads recursively all the .spec and framework files
+
+import 'zone.js/testing';
+import { getTestBed } from '@angular/core/testing';
+import {
+  BrowserDynamicTestingModule,
+  platformBrowserDynamicTesting
+} from '@angular/platform-browser-dynamic/testing';
+
+declare const require: {
+  context(path: string, deep?: boolean, filter?: RegExp): {
+    <T>(id: string): T;
+    keys(): string[];
+  };
+};
+
+// 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().forEach(context);

+ 15 - 0
ng/tsconfig.app.json

@@ -0,0 +1,15 @@
+/* To learn more about this file see: https://angular.io/config/tsconfig. */
+{
+  "extends": "./tsconfig.json",
+  "compilerOptions": {
+    "outDir": "./out-tsc/app",
+    "types": []
+  },
+  "files": [
+    "src/main.ts",
+    "src/polyfills.ts"
+  ],
+  "include": [
+    "src/**/*.d.ts"
+  ]
+}

+ 32 - 0
ng/tsconfig.json

@@ -0,0 +1,32 @@
+/* To learn more about this file see: https://angular.io/config/tsconfig. */
+{
+  "compileOnSave": false,
+  "compilerOptions": {
+    "baseUrl": "./",
+    "outDir": "./dist/out-tsc",
+    "forceConsistentCasingInFileNames": true,
+    "strict": true,
+    "noImplicitOverride": true,
+    "noPropertyAccessFromIndexSignature": true,
+    "noImplicitReturns": true,
+    "noFallthroughCasesInSwitch": true,
+    "sourceMap": true,
+    "declaration": false,
+    "downlevelIteration": true,
+    "experimentalDecorators": true,
+    "moduleResolution": "node",
+    "importHelpers": true,
+    "target": "es2020",
+    "module": "es2020",
+    "lib": [
+      "es2020",
+      "dom"
+    ]
+  },
+  "angularCompilerOptions": {
+    "enableI18nLegacyMessageIdFormat": false,
+    "strictInjectionParameters": true,
+    "strictInputAccessModifiers": true,
+    "strictTemplates": true
+  }
+}

+ 18 - 0
ng/tsconfig.spec.json

@@ -0,0 +1,18 @@
+/* To learn more about this file see: https://angular.io/config/tsconfig. */
+{
+  "extends": "./tsconfig.json",
+  "compilerOptions": {
+    "outDir": "./out-tsc/spec",
+    "types": [
+      "jasmine"
+    ]
+  },
+  "files": [
+    "src/test.ts",
+    "src/polyfills.ts"
+  ],
+  "include": [
+    "src/**/*.spec.ts",
+    "src/**/*.d.ts"
+  ]
+}

+ 21 - 0
server/package.json

@@ -0,0 +1,21 @@
+{
+  "name": "monitoring-server",
+  "version": "1.0.0",
+  "description": "",
+  "main": "dist/server/src/index.js",
+  "scripts": {
+    "start": "npm run build && node .",
+    "build": "tsc -b"
+  },
+  "author": "Christian Kahlau, HostBBQ ©2022",
+  "license": "ISC",
+  "dependencies": {
+    "dotenv": "^16.0.2",
+    "express": "^4.18.1"
+  },
+  "devDependencies": {
+    "@types/express": "^4.17.14",
+    "@types/node": "^18.7.19",
+    "typescript": "^4.8.3"
+  }
+}

+ 256 - 0
server/public/3rdpartylicenses.txt

@@ -0,0 +1,256 @@
+@angular/common
+MIT
+
+@angular/core
+MIT
+
+@angular/platform-browser
+MIT
+
+@angular/router
+MIT
+
+rxjs
+Apache-2.0
+                               Apache License
+                         Version 2.0, January 2004
+                      http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+    "License" shall mean the terms and conditions for use, reproduction,
+    and distribution as defined by Sections 1 through 9 of this document.
+
+    "Licensor" shall mean the copyright owner or entity authorized by
+    the copyright owner that is granting the License.
+
+    "Legal Entity" shall mean the union of the acting entity and all
+    other entities that control, are controlled by, or are under common
+    control with that entity. For the purposes of this definition,
+    "control" means (i) the power, direct or indirect, to cause the
+    direction or management of such entity, whether by contract or
+    otherwise, or (ii) ownership of fifty percent (50%) or more of the
+    outstanding shares, or (iii) beneficial ownership of such entity.
+
+    "You" (or "Your") shall mean an individual or Legal Entity
+    exercising permissions granted by this License.
+
+    "Source" form shall mean the preferred form for making modifications,
+    including but not limited to software source code, documentation
+    source, and configuration files.
+
+    "Object" form shall mean any form resulting from mechanical
+    transformation or translation of a Source form, including but
+    not limited to compiled object code, generated documentation,
+    and conversions to other media types.
+
+    "Work" shall mean the work of authorship, whether in Source or
+    Object form, made available under the License, as indicated by a
+    copyright notice that is included in or attached to the work
+    (an example is provided in the Appendix below).
+
+    "Derivative Works" shall mean any work, whether in Source or Object
+    form, that is based on (or derived from) the Work and for which the
+    editorial revisions, annotations, elaborations, or other modifications
+    represent, as a whole, an original work of authorship. For the purposes
+    of this License, Derivative Works shall not include works that remain
+    separable from, or merely link (or bind by name) to the interfaces of,
+    the Work and Derivative Works thereof.
+
+    "Contribution" shall mean any work of authorship, including
+    the original version of the Work and any modifications or additions
+    to that Work or Derivative Works thereof, that is intentionally
+    submitted to Licensor for inclusion in the Work by the copyright owner
+    or by an individual or Legal Entity authorized to submit on behalf of
+    the copyright owner. For the purposes of this definition, "submitted"
+    means any form of electronic, verbal, or written communication sent
+    to the Licensor or its representatives, including but not limited to
+    communication on electronic mailing lists, source code control systems,
+    and issue tracking systems that are managed by, or on behalf of, the
+    Licensor for the purpose of discussing and improving the Work, but
+    excluding communication that is conspicuously marked or otherwise
+    designated in writing by the copyright owner as "Not a Contribution."
+
+    "Contributor" shall mean Licensor and any individual or Legal Entity
+    on behalf of whom a Contribution has been received by Licensor and
+    subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+    this License, each Contributor hereby grants to You a perpetual,
+    worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+    copyright license to reproduce, prepare Derivative Works of,
+    publicly display, publicly perform, sublicense, and distribute the
+    Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+    this License, each Contributor hereby grants to You a perpetual,
+    worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+    (except as stated in this section) patent license to make, have made,
+    use, offer to sell, sell, import, and otherwise transfer the Work,
+    where such license applies only to those patent claims licensable
+    by such Contributor that are necessarily infringed by their
+    Contribution(s) alone or by combination of their Contribution(s)
+    with the Work to which such Contribution(s) was submitted. If You
+    institute patent litigation against any entity (including a
+    cross-claim or counterclaim in a lawsuit) alleging that the Work
+    or a Contribution incorporated within the Work constitutes direct
+    or contributory patent infringement, then any patent licenses
+    granted to You under this License for that Work shall terminate
+    as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+    Work or Derivative Works thereof in any medium, with or without
+    modifications, and in Source or Object form, provided that You
+    meet the following conditions:
+
+    (a) You must give any other recipients of the Work or
+        Derivative Works a copy of this License; and
+
+    (b) You must cause any modified files to carry prominent notices
+        stating that You changed the files; and
+
+    (c) You must retain, in the Source form of any Derivative Works
+        that You distribute, all copyright, patent, trademark, and
+        attribution notices from the Source form of the Work,
+        excluding those notices that do not pertain to any part of
+        the Derivative Works; and
+
+    (d) If the Work includes a "NOTICE" text file as part of its
+        distribution, then any Derivative Works that You distribute must
+        include a readable copy of the attribution notices contained
+        within such NOTICE file, excluding those notices that do not
+        pertain to any part of the Derivative Works, in at least one
+        of the following places: within a NOTICE text file distributed
+        as part of the Derivative Works; within the Source form or
+        documentation, if provided along with the Derivative Works; or,
+        within a display generated by the Derivative Works, if and
+        wherever such third-party notices normally appear. The contents
+        of the NOTICE file are for informational purposes only and
+        do not modify the License. You may add Your own attribution
+        notices within Derivative Works that You distribute, alongside
+        or as an addendum to the NOTICE text from the Work, provided
+        that such additional attribution notices cannot be construed
+        as modifying the License.
+
+    You may add Your own copyright statement to Your modifications and
+    may provide additional or different license terms and conditions
+    for use, reproduction, or distribution of Your modifications, or
+    for any such Derivative Works as a whole, provided Your use,
+    reproduction, and distribution of the Work otherwise complies with
+    the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+    any Contribution intentionally submitted for inclusion in the Work
+    by You to the Licensor shall be under the terms and conditions of
+    this License, without any additional terms or conditions.
+    Notwithstanding the above, nothing herein shall supersede or modify
+    the terms of any separate license agreement you may have executed
+    with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+    names, trademarks, service marks, or product names of the Licensor,
+    except as required for reasonable and customary use in describing the
+    origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+    agreed to in writing, Licensor provides the Work (and each
+    Contributor provides its Contributions) on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+    implied, including, without limitation, any warranties or conditions
+    of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+    PARTICULAR PURPOSE. You are solely responsible for determining the
+    appropriateness of using or redistributing the Work and assume any
+    risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+    whether in tort (including negligence), contract, or otherwise,
+    unless required by applicable law (such as deliberate and grossly
+    negligent acts) or agreed to in writing, shall any Contributor be
+    liable to You for damages, including any direct, indirect, special,
+    incidental, or consequential damages of any character arising as a
+    result of this License or out of the use or inability to use the
+    Work (including but not limited to damages for loss of goodwill,
+    work stoppage, computer failure or malfunction, or any and all
+    other commercial damages or losses), even if such Contributor
+    has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+    the Work or Derivative Works thereof, You may choose to offer,
+    and charge a fee for, acceptance of support, warranty, indemnity,
+    or other liability obligations and/or rights consistent with this
+    License. However, in accepting such obligations, You may act only
+    on Your own behalf and on Your sole responsibility, not on behalf
+    of any other Contributor, and only if You agree to indemnify,
+    defend, and hold each Contributor harmless for any liability
+    incurred by, or claims asserted against, such Contributor by reason
+    of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+    To apply the Apache License to your work, attach the following
+    boilerplate notice, with the fields enclosed by brackets "[]"
+    replaced with your own identifying information. (Don't include
+    the brackets!)  The text should be enclosed in the appropriate
+    comment syntax for the file format. We also recommend that a
+    file or class name and description of purpose be included on the
+    same "printed page" as the copyright notice for easier
+    identification within third-party archives.
+
+ Copyright (c) 2015-2018 Google, Inc., Netflix, Inc., Microsoft Corp. and contributors
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ 
+
+
+tslib
+0BSD
+Copyright (c) Microsoft Corporation.
+
+Permission to use, copy, modify, and/or distribute this software for any
+purpose with or without fee is hereby granted.
+
+THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
+REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
+INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+PERFORMANCE OF THIS SOFTWARE.
+
+zone.js
+MIT
+The MIT License
+
+Copyright (c) 2010-2022 Google LLC. https://angular.io/license
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.

BIN
server/public/favicon.ico


+ 12 - 0
server/public/index.html

@@ -0,0 +1,12 @@
+<!DOCTYPE html><html lang="en"><head>
+  <meta charset="utf-8">
+  <title>Ng</title>
+  <base href="/">
+  <meta name="viewport" content="width=device-width, initial-scale=1">
+  <link rel="icon" type="image/x-icon" href="favicon.ico">
+<link rel="stylesheet" href="styles.ef46db3751d8e999.css"></head>
+<body>
+  <app-root></app-root>
+<script src="runtime.67ac9629723b967d.js" type="module"></script><script src="polyfills.eb8ade22ac9b8bf5.js" type="module"></script><script src="main.bf8da756f0418f2d.js" type="module"></script>
+
+</body></html>

Diferenças do arquivo suprimidas por serem muito extensas
+ 0 - 0
server/public/main.bf8da756f0418f2d.js


Diferenças do arquivo suprimidas por serem muito extensas
+ 0 - 0
server/public/polyfills.eb8ade22ac9b8bf5.js


+ 1 - 0
server/public/runtime.67ac9629723b967d.js

@@ -0,0 +1 @@
+(()=>{"use strict";var e,_={},b={};function n(e){var a=b[e];if(void 0!==a)return a.exports;var r=b[e]={exports:{}};return _[e](r,r.exports,n),r.exports}n.m=_,e=[],n.O=(a,r,u,l)=>{if(!r){var o=1/0;for(f=0;f<e.length;f++){for(var[r,u,l]=e[f],s=!0,t=0;t<r.length;t++)(!1&l||o>=l)&&Object.keys(n.O).every(i=>n.O[i](r[t]))?r.splice(t--,1):(s=!1,l<o&&(o=l));if(s){e.splice(f--,1);var c=u();void 0!==c&&(a=c)}}return a}l=l||0;for(var f=e.length;f>0&&e[f-1][2]>l;f--)e[f]=e[f-1];e[f]=[r,u,l]},n.n=e=>{var a=e&&e.__esModule?()=>e.default:()=>e;return n.d(a,{a}),a},n.d=(e,a)=>{for(var r in a)n.o(a,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:a[r]})},n.o=(e,a)=>Object.prototype.hasOwnProperty.call(e,a),(()=>{var e={666:0};n.O.j=u=>0===e[u];var a=(u,l)=>{var t,c,[f,o,s]=l,v=0;if(f.some(h=>0!==e[h])){for(t in o)n.o(o,t)&&(n.m[t]=o[t]);if(s)var d=s(n)}for(u&&u(l);v<f.length;v++)n.o(e,c=f[v])&&e[c]&&e[c][0](),e[c]=0;return n.O(d)},r=self.webpackChunkng=self.webpackChunkng||[];r.forEach(a.bind(null,0)),r.push=a.bind(null,r.push.bind(r))})()})();

+ 0 - 0
server/public/styles.ef46db3751d8e999.css


+ 11 - 0
server/src/index.ts

@@ -0,0 +1,11 @@
+import dotenv from 'dotenv';
+
+import { Logger, LogLevel } from '../../common/util/logger.class';
+
+dotenv.config();
+
+const LOG_LEVEL: LogLevel = (process.env.LOG_LEVEL as LogLevel) || 'INFO';
+Logger.logLevel = LOG_LEVEL;
+
+import { Webserver } from './webserver';
+new Webserver(Number(process.env.WEB_PORT ?? '80'));

+ 18 - 0
server/src/webserver.ts

@@ -0,0 +1,18 @@
+import express, { Express } from 'express';
+import { Logger } from '../../common/util/logger.class';
+
+const STATIC_DIR = process.env.STATIC_DIR || 'public';
+
+export class Webserver {
+  private app: Express;
+
+  constructor(private port: number) {
+    this.app = express();
+
+    this.app.use('/', express.static(STATIC_DIR));
+
+    this.app.listen(this.port, () => {
+      Logger.info(`[INFO] Monitoring Webserver started at http://localhost:${this.port}`);
+    });
+  }
+}

+ 15 - 0
server/tsconfig.json

@@ -0,0 +1,15 @@
+{
+  "compilerOptions": {
+    "outDir": "./dist",
+    "esModuleInterop": true,
+    "moduleResolution": "node",
+    "module": "commonjs",
+    "target": "ES2016",
+    "sourceMap": true,
+    "baseUrl": "./src",
+    "paths": {
+      "*": ["node_modules/*", "src/*", "../common/*"]
+    }
+  },
+  "include": ["./src/*", "./src/**/*, ../common/*", "../common/**/*"]
+}

Alguns arquivos não foram mostrados porque muitos arquivos mudaram nesse diff