Bootstrap of angular app.
This commit is contained in:
13
src/main/ts/.editorconfig
Normal file
13
src/main/ts/.editorconfig
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
# Editor configuration, see https://editorconfig.org
|
||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
charset = utf-8
|
||||||
|
indent_style = tab
|
||||||
|
indent_size = 2
|
||||||
|
insert_final_newline = true
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
|
||||||
|
[*.md]
|
||||||
|
max_line_length = off
|
||||||
|
trim_trailing_whitespace = false
|
||||||
46
src/main/ts/.gitignore
vendored
Normal file
46
src/main/ts/.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
|
||||||
150
src/main/ts/angular.json
Normal file
150
src/main/ts/angular.json
Normal file
@@ -0,0 +1,150 @@
|
|||||||
|
{
|
||||||
|
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
|
||||||
|
"version": 1,
|
||||||
|
"newProjectRoot": "projects",
|
||||||
|
"projects": {
|
||||||
|
"cerberus": {
|
||||||
|
"root": "",
|
||||||
|
"sourceRoot": "src",
|
||||||
|
"projectType": "application",
|
||||||
|
"prefix": "app",
|
||||||
|
"schematics": {
|
||||||
|
"@schematics/angular:component": {
|
||||||
|
"style": "scss"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"architect": {
|
||||||
|
"build": {
|
||||||
|
"builder": "@angular-devkit/build-angular:browser",
|
||||||
|
"options": {
|
||||||
|
"outputPath": "dist/cerberus",
|
||||||
|
"index": "src/index.html",
|
||||||
|
"main": "src/main.ts",
|
||||||
|
"polyfills": "src/polyfills.ts",
|
||||||
|
"tsConfig": "src/tsconfig.app.json",
|
||||||
|
"assets": [
|
||||||
|
"src/favicon.ico",
|
||||||
|
"src/assets"
|
||||||
|
],
|
||||||
|
"styles": [
|
||||||
|
"node_modules/@fortawesome/fontawesome-free/scss/fontawesome.scss",
|
||||||
|
"node_modules/@fortawesome/fontawesome-free/scss/solid.scss",
|
||||||
|
"node_modules/@fortawesome/fontawesome-free/scss/regular.scss",
|
||||||
|
"node_modules/@fortawesome/fontawesome-free/scss/brands.scss",
|
||||||
|
"node_modules/angular-bootstrap-md/assets/scss/bootstrap/bootstrap.scss",
|
||||||
|
"node_modules/angular-bootstrap-md/assets/scss/mdb.scss",
|
||||||
|
"node_modules/animate.css/animate.css",
|
||||||
|
"src/styles.scss"
|
||||||
|
],
|
||||||
|
"scripts": [
|
||||||
|
"node_modules/chart.js/dist/Chart.js",
|
||||||
|
"node_modules/hammerjs/hammer.min.js"
|
||||||
|
],
|
||||||
|
"es5BrowserSupport": true
|
||||||
|
},
|
||||||
|
"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"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"serve": {
|
||||||
|
"builder": "@angular-devkit/build-angular:dev-server",
|
||||||
|
"options": {
|
||||||
|
"browserTarget": "cerberus:build"
|
||||||
|
},
|
||||||
|
"configurations": {
|
||||||
|
"production": {
|
||||||
|
"browserTarget": "cerberus:build:production"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"extract-i18n": {
|
||||||
|
"builder": "@angular-devkit/build-angular:extract-i18n",
|
||||||
|
"options": {
|
||||||
|
"browserTarget": "cerberus:build"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"test": {
|
||||||
|
"builder": "@angular-devkit/build-angular:karma",
|
||||||
|
"options": {
|
||||||
|
"main": "src/test.ts",
|
||||||
|
"polyfills": "src/polyfills.ts",
|
||||||
|
"tsConfig": "src/tsconfig.spec.json",
|
||||||
|
"karmaConfig": "src/karma.conf.js",
|
||||||
|
"styles": [
|
||||||
|
"src/styles.scss"
|
||||||
|
],
|
||||||
|
"scripts": [],
|
||||||
|
"assets": [
|
||||||
|
"src/favicon.ico",
|
||||||
|
"src/assets"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"lint": {
|
||||||
|
"builder": "@angular-devkit/build-angular:tslint",
|
||||||
|
"options": {
|
||||||
|
"tsConfig": [
|
||||||
|
"src/tsconfig.app.json",
|
||||||
|
"src/tsconfig.spec.json"
|
||||||
|
],
|
||||||
|
"exclude": [
|
||||||
|
"**/node_modules/**"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"cerberus-e2e": {
|
||||||
|
"root": "e2e/",
|
||||||
|
"projectType": "application",
|
||||||
|
"prefix": "",
|
||||||
|
"architect": {
|
||||||
|
"e2e": {
|
||||||
|
"builder": "@angular-devkit/build-angular:protractor",
|
||||||
|
"options": {
|
||||||
|
"protractorConfig": "e2e/protractor.conf.js",
|
||||||
|
"devServerTarget": "cerberus:serve"
|
||||||
|
},
|
||||||
|
"configurations": {
|
||||||
|
"production": {
|
||||||
|
"devServerTarget": "cerberus:serve:production"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"lint": {
|
||||||
|
"builder": "@angular-devkit/build-angular:tslint",
|
||||||
|
"options": {
|
||||||
|
"tsConfig": "e2e/tsconfig.e2e.json",
|
||||||
|
"exclude": [
|
||||||
|
"**/node_modules/**"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"defaultProject": "cerberus"
|
||||||
|
}
|
||||||
28
src/main/ts/e2e/protractor.conf.js
Normal file
28
src/main/ts/e2e/protractor.conf.js
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
// Protractor configuration file, see link for more information
|
||||||
|
// https://github.com/angular/protractor/blob/master/lib/config.ts
|
||||||
|
|
||||||
|
const { SpecReporter } = require('jasmine-spec-reporter');
|
||||||
|
|
||||||
|
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.e2e.json')
|
||||||
|
});
|
||||||
|
jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
|
||||||
|
}
|
||||||
|
};
|
||||||
23
src/main/ts/e2e/src/app.e2e-spec.ts
Normal file
23
src/main/ts/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('Welcome to cerberus!');
|
||||||
|
});
|
||||||
|
|
||||||
|
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
src/main/ts/e2e/src/app.po.ts
Normal file
11
src/main/ts/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 h1')).getText() as Promise<string>;
|
||||||
|
}
|
||||||
|
}
|
||||||
13
src/main/ts/e2e/tsconfig.e2e.json
Normal file
13
src/main/ts/e2e/tsconfig.e2e.json
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"extends": "../tsconfig.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"outDir": "../out-tsc/app",
|
||||||
|
"module": "commonjs",
|
||||||
|
"target": "es5",
|
||||||
|
"types": [
|
||||||
|
"jasmine",
|
||||||
|
"jasminewd2",
|
||||||
|
"node"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
12583
src/main/ts/package-lock.json
generated
Normal file
12583
src/main/ts/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
54
src/main/ts/package.json
Normal file
54
src/main/ts/package.json
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
{
|
||||||
|
"name": "cerberus",
|
||||||
|
"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.4",
|
||||||
|
"@angular/common": "~8.2.4",
|
||||||
|
"@angular/compiler": "~8.2.4",
|
||||||
|
"@angular/core": "~8.2.4",
|
||||||
|
"@angular/forms": "~8.2.4",
|
||||||
|
"@angular/platform-browser": "~8.2.4",
|
||||||
|
"@angular/platform-browser-dynamic": "~8.2.4",
|
||||||
|
"@angular/router": "~8.2.4",
|
||||||
|
"@fortawesome/fontawesome-free": "^5.10.2",
|
||||||
|
"@types/chart.js": "^2.8.4",
|
||||||
|
"angular-bootstrap-md": "^8.2.0",
|
||||||
|
"animate.css": "^3.7.2",
|
||||||
|
"chart.js": "^2.8.0",
|
||||||
|
"core-js": "^3.2.1",
|
||||||
|
"hammerjs": "^2.0.8",
|
||||||
|
"rxjs": "~6.5.3",
|
||||||
|
"tslib": "^1.10.0",
|
||||||
|
"zone.js": "~0.10.2"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@angular-devkit/build-angular": "~0.803.2",
|
||||||
|
"@angular/cli": "~8.3.2",
|
||||||
|
"@angular/compiler-cli": "~8.2.4",
|
||||||
|
"@angular/language-service": "~8.2.4",
|
||||||
|
"@types/jasmine": "~3.4.0",
|
||||||
|
"@types/jasminewd2": "~2.0.6",
|
||||||
|
"@types/node": "~12.7.4",
|
||||||
|
"codelyzer": "~5.1.0",
|
||||||
|
"jasmine-core": "~3.4.0",
|
||||||
|
"jasmine-spec-reporter": "~4.2.1",
|
||||||
|
"karma": "~4.3.0",
|
||||||
|
"karma-chrome-launcher": "~3.1.0",
|
||||||
|
"karma-coverage-istanbul-reporter": "~2.1.0",
|
||||||
|
"karma-jasmine": "~2.0.1",
|
||||||
|
"karma-jasmine-html-reporter": "^1.4.2",
|
||||||
|
"protractor": "~5.4.2",
|
||||||
|
"ts-node": "~8.3.0",
|
||||||
|
"tslint": "~5.19.0",
|
||||||
|
"typescript": "^3.5.3"
|
||||||
|
}
|
||||||
|
}
|
||||||
10
src/main/ts/src/app/app-routing.module.ts
Normal file
10
src/main/ts/src/app/app-routing.module.ts
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { Routes, RouterModule } from '@angular/router';
|
||||||
|
|
||||||
|
const routes: Routes = [];
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [RouterModule.forRoot(routes)],
|
||||||
|
exports: [RouterModule]
|
||||||
|
})
|
||||||
|
export class AppRoutingModule { }
|
||||||
6
src/main/ts/src/app/app.component.html
Normal file
6
src/main/ts/src/app/app.component.html
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<app-header></app-header>
|
||||||
|
<app-notifications></app-notifications>
|
||||||
|
<main class="container">
|
||||||
|
<router-outlet></router-outlet>
|
||||||
|
</main>
|
||||||
|
<app-footer></app-footer>
|
||||||
6
src/main/ts/src/app/app.component.scss
Normal file
6
src/main/ts/src/app/app.component.scss
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
main {
|
||||||
|
&.container {
|
||||||
|
margin-top: 75px;
|
||||||
|
padding: 15px 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
35
src/main/ts/src/app/app.component.spec.ts
Normal file
35
src/main/ts/src/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 'cerberus'`, () => {
|
||||||
|
const fixture = TestBed.createComponent(AppComponent);
|
||||||
|
const app = fixture.debugElement.componentInstance;
|
||||||
|
expect(app.title).toEqual('cerberus');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should render title in a h1 tag', () => {
|
||||||
|
const fixture = TestBed.createComponent(AppComponent);
|
||||||
|
fixture.detectChanges();
|
||||||
|
const compiled = fixture.debugElement.nativeElement;
|
||||||
|
expect(compiled.querySelector('h1').textContent).toContain('Welcome to cerberus!');
|
||||||
|
});
|
||||||
|
});
|
||||||
10
src/main/ts/src/app/app.component.ts
Normal file
10
src/main/ts/src/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 = 'cerberus';
|
||||||
|
}
|
||||||
31
src/main/ts/src/app/app.module.ts
Normal file
31
src/main/ts/src/app/app.module.ts
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
|
||||||
|
import { BrowserModule } from '@angular/platform-browser';
|
||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
|
||||||
|
import { AppRoutingModule } from './app-routing.module';
|
||||||
|
import { AppComponent } from './app.component';
|
||||||
|
import { MDBBootstrapModule } from 'angular-bootstrap-md';
|
||||||
|
import { HeaderComponent } from './header/header.component';
|
||||||
|
import { FooterComponent } from './footer/footer.component';
|
||||||
|
import { NotificationElement } from './core/notifications/notification-element/notification-element.component';
|
||||||
|
import { NotificationsComponent } from './core/notifications/notifications.component';
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
declarations: [
|
||||||
|
AppComponent,
|
||||||
|
FooterComponent,
|
||||||
|
HeaderComponent,
|
||||||
|
NotificationElement,
|
||||||
|
NotificationsComponent
|
||||||
|
],
|
||||||
|
imports: [
|
||||||
|
BrowserModule,
|
||||||
|
AppRoutingModule,
|
||||||
|
MDBBootstrapModule.forRoot()
|
||||||
|
],
|
||||||
|
providers: [],
|
||||||
|
bootstrap: [
|
||||||
|
AppComponent
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export class AppModule { }
|
||||||
26
src/main/ts/src/app/core/notifications/notification-class.ts
Normal file
26
src/main/ts/src/app/core/notifications/notification-class.ts
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
/**
|
||||||
|
* Class which represents a notification class.
|
||||||
|
* It serves to set the notification appearence.
|
||||||
|
*/
|
||||||
|
export class NotificationClass {
|
||||||
|
/**
|
||||||
|
* Default constructor.
|
||||||
|
* @param {string} icon Class name of font-awsome icon.
|
||||||
|
* @param {string} clazz The class to set notification style.
|
||||||
|
*/
|
||||||
|
constructor(
|
||||||
|
public icon: string,
|
||||||
|
public clazz: string,
|
||||||
|
) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constant instances of NotificationClass.
|
||||||
|
*/
|
||||||
|
export const NotificationClasses = Object.freeze({
|
||||||
|
'Error': new NotificationClass('exclamation-circle ', 'alert-danger'),
|
||||||
|
'Warn': new NotificationClass('exclamation-triangle', 'alert-warning'),
|
||||||
|
'Info': new NotificationClass('info-circle', 'alert-info'),
|
||||||
|
'Success': new NotificationClass('check-circle', 'alert-success')
|
||||||
|
});
|
||||||
|
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
<div id="notification" #notification class="alert {{model.notificationClass.clazz}}" role="alert">
|
||||||
|
<mdb-icon fas [icon]="model.notificationClass.icon"></mdb-icon> {{model.content}}
|
||||||
|
<span id="close">
|
||||||
|
<i class="fa fa-times-circle fas close"
|
||||||
|
(click)="model.hide()"></i>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,78 @@
|
|||||||
|
import { NotificationClass } from '../notification-class';
|
||||||
|
import { Component, Input, OnInit, ViewChild, ElementRef } from '@angular/core';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class which represents a notification in the notifications list.
|
||||||
|
*/
|
||||||
|
@Component({
|
||||||
|
selector: 'app-notification-element',
|
||||||
|
templateUrl: 'notification-element.component.html',
|
||||||
|
styles: [`
|
||||||
|
#notification {
|
||||||
|
transition: all 0.7s ease-out;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
.close {
|
||||||
|
position: absolute;
|
||||||
|
right: 7px;
|
||||||
|
top: 12px;
|
||||||
|
font-size: 19px;
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
#notification:hover .close {
|
||||||
|
opacity: 0.5;
|
||||||
|
}
|
||||||
|
`]
|
||||||
|
})
|
||||||
|
export class NotificationElement implements OnInit {
|
||||||
|
/**
|
||||||
|
* The notification model.
|
||||||
|
*/
|
||||||
|
@Input() model: NotificationModel;
|
||||||
|
/**
|
||||||
|
* The notification DOM element.
|
||||||
|
*/
|
||||||
|
@ViewChild('notification', {static: true}) notification: ElementRef;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the DOM element in the model object and plays with opacity.
|
||||||
|
*/
|
||||||
|
ngOnInit(): void {
|
||||||
|
this.model.notification = this.notification;
|
||||||
|
|
||||||
|
this.notification.nativeElement.style.opacity = 0;
|
||||||
|
setTimeout(() => {
|
||||||
|
this.notification.nativeElement.style.opacity = 1;
|
||||||
|
}, 100);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class which represents the notification model.
|
||||||
|
*/
|
||||||
|
export class NotificationModel {
|
||||||
|
/**
|
||||||
|
* Element which represents the DOM element of the notification element.
|
||||||
|
*/
|
||||||
|
notification: ElementRef;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default constructor.
|
||||||
|
* @param {string} content The message of the notification.
|
||||||
|
* @param {NotificationClass} notificationClass The category of the notification (info, error...).
|
||||||
|
*/
|
||||||
|
constructor(
|
||||||
|
public content: string,
|
||||||
|
public notificationClass: NotificationClass
|
||||||
|
) {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hides the notification DOM element.
|
||||||
|
*/
|
||||||
|
public hide(): void {
|
||||||
|
this.notification.nativeElement.style.opacity = 0;
|
||||||
|
setTimeout(() => {
|
||||||
|
this.notification.nativeElement.style.display = 'none';
|
||||||
|
}, 800);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<div id="notification-container">
|
||||||
|
<app-notification-element *ngFor="let notification of notificationList"
|
||||||
|
[model]="notification"></app-notification-element>
|
||||||
|
</div>
|
||||||
|
|
||||||
@@ -0,0 +1,108 @@
|
|||||||
|
import { NotificationClass, NotificationClasses } from './notification-class';
|
||||||
|
import { NotificationModel } from './notification-element/notification-element.component';
|
||||||
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class which offers the notifications service.
|
||||||
|
*/
|
||||||
|
@Component({
|
||||||
|
selector: 'app-notifications',
|
||||||
|
templateUrl: 'notifications.component.html',
|
||||||
|
styles: [`
|
||||||
|
#notification-container {
|
||||||
|
position: fixed;
|
||||||
|
top: 50px;
|
||||||
|
right: 20px;
|
||||||
|
width: 300px;
|
||||||
|
z-index: 1100;
|
||||||
|
}
|
||||||
|
`]
|
||||||
|
})
|
||||||
|
export class NotificationsComponent implements OnInit {
|
||||||
|
/**
|
||||||
|
* Singleton of the notification service.
|
||||||
|
*/
|
||||||
|
private static component: NotificationsComponent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List of notifications model.
|
||||||
|
*/
|
||||||
|
notificationList: Array<NotificationModel> = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates an error notification.
|
||||||
|
* @param {string} message The content of the notification.
|
||||||
|
*/
|
||||||
|
public static error(message: string): void {
|
||||||
|
NotificationsComponent.notif(message, NotificationClasses.Error);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a warning notification.
|
||||||
|
* @param {string} message The content of the notification.
|
||||||
|
*/
|
||||||
|
public static warn(message: string): void {
|
||||||
|
NotificationsComponent.notif(message, NotificationClasses.Warn);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates an info notification.
|
||||||
|
* @param {string} message The content of the notification.
|
||||||
|
*/
|
||||||
|
public static info(message: string): void {
|
||||||
|
NotificationsComponent.notif(message, NotificationClasses.Info);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a success notification.
|
||||||
|
* @param {string} message The content of the notification.
|
||||||
|
*/
|
||||||
|
public static success(message: string): void {
|
||||||
|
NotificationsComponent.notif(message, NotificationClasses.Success);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a notification. The {@code notifClass} param defines the category of
|
||||||
|
* the notification (info, error...).
|
||||||
|
* @param {string} message The content of the notification.
|
||||||
|
* @param {NotificationClass} notifClass The category of the notification.
|
||||||
|
*/
|
||||||
|
private static notif(message: string, notifClass: NotificationClass): void {
|
||||||
|
const elem = new NotificationModel(message, notifClass);
|
||||||
|
|
||||||
|
NotificationsComponent.component.notificationList.push(elem);
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
elem.hide();
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
NotificationsComponent.clearNotificationList();
|
||||||
|
}, 900);
|
||||||
|
}, 4500);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clears the consumed notifications in the list.
|
||||||
|
* When a notification is created, a cooldown is set to hide it after a certain time period.
|
||||||
|
* In this cooldown, the notification have only its display as {@code none}, but the
|
||||||
|
* notification isn't remove from the list. This method removes it.
|
||||||
|
*/
|
||||||
|
private static clearNotificationList(): void {
|
||||||
|
NotificationsComponent.component.notificationList.forEach(elem => {
|
||||||
|
if (elem.notification.nativeElement.style.display === 'none') {
|
||||||
|
const index = NotificationsComponent.component.notificationList.indexOf(elem);
|
||||||
|
if (index > -1) {
|
||||||
|
NotificationsComponent.component.notificationList.splice(index, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the reference of the singleton here because this component
|
||||||
|
* is created at the application startup.
|
||||||
|
*/
|
||||||
|
ngOnInit(): void {
|
||||||
|
NotificationsComponent.component = this;
|
||||||
|
}
|
||||||
|
}
|
||||||
8
src/main/ts/src/app/footer/footer.component.html
Normal file
8
src/main/ts/src/app/footer/footer.component.html
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
<footer class="font-small brown darken-2">
|
||||||
|
<span id="middle-area">
|
||||||
|
© 2019 Copyright - Cerberus
|
||||||
|
</span>
|
||||||
|
<span id="right-area">
|
||||||
|
v1.0.0-SNAPSHOT
|
||||||
|
</span>
|
||||||
|
</footer>
|
||||||
31
src/main/ts/src/app/footer/footer.component.scss
Normal file
31
src/main/ts/src/app/footer/footer.component.scss
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
footer {
|
||||||
|
position: absolute;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
padding: 10px 30px;
|
||||||
|
color: #9d9d9d;
|
||||||
|
|
||||||
|
#left-area {
|
||||||
|
position: absolute;
|
||||||
|
top: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#middle-area {
|
||||||
|
display: block;
|
||||||
|
width: 70%;
|
||||||
|
margin: auto;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
#right-area {
|
||||||
|
position: absolute;
|
||||||
|
top: 11px;
|
||||||
|
right: 15px;
|
||||||
|
|
||||||
|
button {
|
||||||
|
padding-right: 1.14rem;
|
||||||
|
padding-left: 1.14rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
28
src/main/ts/src/app/footer/footer.component.spec.ts
Normal file
28
src/main/ts/src/app/footer/footer.component.spec.ts
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
/* tslint:disable:no-unused-variable */
|
||||||
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
import { By } from '@angular/platform-browser';
|
||||||
|
import { DebugElement } from '@angular/core';
|
||||||
|
|
||||||
|
import { FooterComponent } from './footer.component';
|
||||||
|
|
||||||
|
describe('FooterComponent', () => {
|
||||||
|
let component: FooterComponent;
|
||||||
|
let fixture: ComponentFixture<FooterComponent>;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [ FooterComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(FooterComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
15
src/main/ts/src/app/footer/footer.component.ts
Normal file
15
src/main/ts/src/app/footer/footer.component.ts
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-footer',
|
||||||
|
templateUrl: './footer.component.html',
|
||||||
|
styleUrls: ['./footer.component.scss']
|
||||||
|
})
|
||||||
|
export class FooterComponent implements OnInit {
|
||||||
|
|
||||||
|
constructor() { }
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
19
src/main/ts/src/app/header/header.component.html
Normal file
19
src/main/ts/src/app/header/header.component.html
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
<header class="fixed-top brown darken-2 white-text">
|
||||||
|
<span id="left-area">
|
||||||
|
<button mdbBtn class="flat rounded-circle" mdbWavesEffect>
|
||||||
|
<i class="fa fa-bars"></i>
|
||||||
|
</button>
|
||||||
|
</span>
|
||||||
|
<span id="middle-area">
|
||||||
|
<a [routerLink]="['/']" routerLinkActive="router-link-active">
|
||||||
|
<img src="assets/images/icon.png" alt="Cerberus" />
|
||||||
|
<span id="title">Cerberus</span>
|
||||||
|
</a>
|
||||||
|
</span>
|
||||||
|
<span id="right-area">
|
||||||
|
<button mdbBtn class="flat rounded-pill" mdbWavesEffect>
|
||||||
|
<i class="fa fa-sign-in-alt"></i>
|
||||||
|
Connexion
|
||||||
|
</button>
|
||||||
|
</span>
|
||||||
|
</header>
|
||||||
44
src/main/ts/src/app/header/header.component.scss
Normal file
44
src/main/ts/src/app/header/header.component.scss
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
h1 {
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
header {
|
||||||
|
padding: 10px 30px;
|
||||||
|
|
||||||
|
#left-area {
|
||||||
|
position: absolute;
|
||||||
|
top: 12px;
|
||||||
|
|
||||||
|
button {
|
||||||
|
font-size: 1rem;
|
||||||
|
padding: 5px 10px !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#middle-area {
|
||||||
|
display: block;
|
||||||
|
width: 70%;
|
||||||
|
margin: auto;
|
||||||
|
|
||||||
|
#title {
|
||||||
|
display: inline-block;
|
||||||
|
vertical-align: middle;
|
||||||
|
font-weight: bolder;
|
||||||
|
color: white;
|
||||||
|
font-size: 2em;
|
||||||
|
padding-left: 10px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#right-area {
|
||||||
|
position: absolute;
|
||||||
|
top: 5px;
|
||||||
|
right: 15px;
|
||||||
|
|
||||||
|
button {
|
||||||
|
padding-right: 1.14rem;
|
||||||
|
padding-left: 1.14rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
28
src/main/ts/src/app/header/header.component.spec.ts
Normal file
28
src/main/ts/src/app/header/header.component.spec.ts
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
/* tslint:disable:no-unused-variable */
|
||||||
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
import { By } from '@angular/platform-browser';
|
||||||
|
import { DebugElement } from '@angular/core';
|
||||||
|
|
||||||
|
import { HeaderComponent } from './header.component';
|
||||||
|
|
||||||
|
describe('HeaderComponent', () => {
|
||||||
|
let component: HeaderComponent;
|
||||||
|
let fixture: ComponentFixture<HeaderComponent>;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [ HeaderComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(HeaderComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
19
src/main/ts/src/app/header/header.component.ts
Normal file
19
src/main/ts/src/app/header/header.component.ts
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
import { NotificationsComponent } from './../core/notifications/notifications.component';
|
||||||
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-header',
|
||||||
|
templateUrl: './header.component.html',
|
||||||
|
styleUrls: ['./header.component.scss']
|
||||||
|
})
|
||||||
|
export class HeaderComponent implements OnInit {
|
||||||
|
|
||||||
|
constructor() { }
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
}
|
||||||
|
|
||||||
|
helloWorld() {
|
||||||
|
NotificationsComponent.info('Hello world!');
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
src/main/ts/src/assets/images/icon.png
Normal file
BIN
src/main/ts/src/assets/images/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 8.2 KiB |
|
Before Width: | Height: | Size: 338 KiB After Width: | Height: | Size: 338 KiB |
11
src/main/ts/src/browserslist
Normal file
11
src/main/ts/src/browserslist
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
# This file is currently used by autoprefixer to adjust CSS to support the below specified browsers
|
||||||
|
# For additional information regarding the format and rule options, please see:
|
||||||
|
# https://github.com/browserslist/browserslist#queries
|
||||||
|
#
|
||||||
|
# For IE 9-11 support, please remove 'not' from the last line of the file and adjust as needed
|
||||||
|
|
||||||
|
> 0.5%
|
||||||
|
last 2 versions
|
||||||
|
Firefox ESR
|
||||||
|
not dead
|
||||||
|
not IE 9-11
|
||||||
3
src/main/ts/src/environments/environment.prod.ts
Normal file
3
src/main/ts/src/environments/environment.prod.ts
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
export const environment = {
|
||||||
|
production: true
|
||||||
|
};
|
||||||
16
src/main/ts/src/environments/environment.ts
Normal file
16
src/main/ts/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
src/main/ts/src/favicon.ico
Normal file
BIN
src/main/ts/src/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.4 KiB |
14
src/main/ts/src/index.html
Normal file
14
src/main/ts/src/index.html
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>Cerberus</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>
|
||||||
32
src/main/ts/src/karma.conf.js
Normal file
32
src/main/ts/src/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/cerberus'),
|
||||||
|
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
|
||||||
|
});
|
||||||
|
};
|
||||||
12
src/main/ts/src/main.ts
Normal file
12
src/main/ts/src/main.ts
Normal file
@@ -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));
|
||||||
63
src/main/ts/src/polyfills.ts
Normal file
63
src/main/ts/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__BLACK_LISTED_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
|
||||||
|
*/
|
||||||
20
src/main/ts/src/styles.scss
Normal file
20
src/main/ts/src/styles.scss
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
body {
|
||||||
|
display: flex;
|
||||||
|
position: relative;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: space-between;
|
||||||
|
min-height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
a, button {
|
||||||
|
&.flat, &.flat:hover, &.flat:active, &.flat:focus, &.flat:focus-within {
|
||||||
|
box-shadow: none;
|
||||||
|
background-color: transparent;
|
||||||
|
color: inherit;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
html {
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
20
src/main/ts/src/test.ts
Normal file
20
src/main/ts/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);
|
||||||
11
src/main/ts/src/tsconfig.app.json
Normal file
11
src/main/ts/src/tsconfig.app.json
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"extends": "../tsconfig.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"outDir": "../out-tsc/app",
|
||||||
|
"types": []
|
||||||
|
},
|
||||||
|
"exclude": [
|
||||||
|
"test.ts",
|
||||||
|
"**/*.spec.ts"
|
||||||
|
]
|
||||||
|
}
|
||||||
18
src/main/ts/src/tsconfig.spec.json
Normal file
18
src/main/ts/src/tsconfig.spec.json
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"extends": "../tsconfig.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"outDir": "../out-tsc/spec",
|
||||||
|
"types": [
|
||||||
|
"jasmine",
|
||||||
|
"node"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"test.ts",
|
||||||
|
"polyfills.ts"
|
||||||
|
],
|
||||||
|
"include": [
|
||||||
|
"**/*.spec.ts",
|
||||||
|
"**/*.d.ts"
|
||||||
|
]
|
||||||
|
}
|
||||||
17
src/main/ts/src/tslint.json
Normal file
17
src/main/ts/src/tslint.json
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"extends": "../tslint.json",
|
||||||
|
"rules": {
|
||||||
|
"directive-selector": [
|
||||||
|
true,
|
||||||
|
"attribute",
|
||||||
|
"app",
|
||||||
|
"camelCase"
|
||||||
|
],
|
||||||
|
"component-selector": [
|
||||||
|
true,
|
||||||
|
"element",
|
||||||
|
"app",
|
||||||
|
"kebab-case"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
22
src/main/ts/tsconfig.json
Normal file
22
src/main/ts/tsconfig.json
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
"compileOnSave": false,
|
||||||
|
"compilerOptions": {
|
||||||
|
"baseUrl": "./",
|
||||||
|
"outDir": "./dist/out-tsc",
|
||||||
|
"sourceMap": true,
|
||||||
|
"declaration": false,
|
||||||
|
"module": "es2015",
|
||||||
|
"moduleResolution": "node",
|
||||||
|
"emitDecoratorMetadata": true,
|
||||||
|
"experimentalDecorators": true,
|
||||||
|
"importHelpers": true,
|
||||||
|
"target": "es5",
|
||||||
|
"typeRoots": [
|
||||||
|
"node_modules/@types"
|
||||||
|
],
|
||||||
|
"lib": [
|
||||||
|
"es2018",
|
||||||
|
"dom"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
75
src/main/ts/tslint.json
Normal file
75
src/main/ts/tslint.json
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
{
|
||||||
|
"extends": "tslint:recommended",
|
||||||
|
"rulesDirectory": [
|
||||||
|
"codelyzer"
|
||||||
|
],
|
||||||
|
"rules": {
|
||||||
|
"array-type": false,
|
||||||
|
"arrow-parens": false,
|
||||||
|
"deprecation": {
|
||||||
|
"severity": "warn"
|
||||||
|
},
|
||||||
|
"import-blacklist": [
|
||||||
|
true,
|
||||||
|
"rxjs/Rx"
|
||||||
|
],
|
||||||
|
"interface-name": false,
|
||||||
|
"max-classes-per-file": false,
|
||||||
|
"max-line-length": [
|
||||||
|
true,
|
||||||
|
140
|
||||||
|
],
|
||||||
|
"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-output-on-prefix": true,
|
||||||
|
"use-input-property-decorator": true,
|
||||||
|
"use-output-property-decorator": true,
|
||||||
|
"use-host-property-decorator": true,
|
||||||
|
"no-input-rename": true,
|
||||||
|
"no-output-rename": true,
|
||||||
|
"use-life-cycle-interface": true,
|
||||||
|
"use-pipe-transform-interface": true,
|
||||||
|
"component-class-suffix": true,
|
||||||
|
"directive-class-suffix": true
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user