diff options
Diffstat (limited to 'Timeline/ClientApp/src')
23 files changed, 431 insertions, 0 deletions
diff --git a/Timeline/ClientApp/src/app/app.component.css b/Timeline/ClientApp/src/app/app.component.css new file mode 100644 index 00000000..63459382 --- /dev/null +++ b/Timeline/ClientApp/src/app/app.component.css @@ -0,0 +1,6 @@ +body { + margin: 0; + display: flex; + justify-content: center; +} + diff --git a/Timeline/ClientApp/src/app/app.component.html b/Timeline/ClientApp/src/app/app.component.html new file mode 100644 index 00000000..ae729c0c --- /dev/null +++ b/Timeline/ClientApp/src/app/app.component.html @@ -0,0 +1,5 @@ +<body> + <div id="rootContainer"> + <router-outlet></router-outlet> + </div> +</body> diff --git a/Timeline/ClientApp/src/app/app.component.ts b/Timeline/ClientApp/src/app/app.component.ts new file mode 100644 index 00000000..7b0f6728 --- /dev/null +++ b/Timeline/ClientApp/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.css'] +}) +export class AppComponent { + title = 'app'; +} diff --git a/Timeline/ClientApp/src/app/app.module.ts b/Timeline/ClientApp/src/app/app.module.ts new file mode 100644 index 00000000..c16d8bae --- /dev/null +++ b/Timeline/ClientApp/src/app/app.module.ts @@ -0,0 +1,26 @@ +import { BrowserModule } from '@angular/platform-browser'; +import { NgModule } from '@angular/core'; +import { FormsModule } from '@angular/forms'; +import { HttpClientModule } from '@angular/common/http'; +import { RouterModule } from '@angular/router'; + +import { AppComponent } from './app.component'; +import { HomeComponent } from './home/home.component'; + +@NgModule({ + declarations: [ + AppComponent, + HomeComponent + ], + imports: [ + BrowserModule.withServerTransition({ appId: 'ng-cli-universal' }), + HttpClientModule, + FormsModule, + RouterModule.forRoot([ + { path: '', component: HomeComponent, pathMatch: 'full' } + ]) + ], + providers: [], + bootstrap: [AppComponent] +}) +export class AppModule { } diff --git a/Timeline/ClientApp/src/app/app.server.module.ts b/Timeline/ClientApp/src/app/app.server.module.ts new file mode 100644 index 00000000..cfb0e021 --- /dev/null +++ b/Timeline/ClientApp/src/app/app.server.module.ts @@ -0,0 +1,11 @@ +import { NgModule } from '@angular/core'; +import { ServerModule } from '@angular/platform-server'; +import { ModuleMapLoaderModule } from '@nguniversal/module-map-ngfactory-loader'; +import { AppComponent } from './app.component'; +import { AppModule } from './app.module'; + +@NgModule({ + imports: [AppModule, ServerModule, ModuleMapLoaderModule], + bootstrap: [AppComponent] +}) +export class AppServerModule { } diff --git a/Timeline/ClientApp/src/app/home/home.component.css b/Timeline/ClientApp/src/app/home/home.component.css new file mode 100644 index 00000000..76297a9e --- /dev/null +++ b/Timeline/ClientApp/src/app/home/home.component.css @@ -0,0 +1,49 @@ +p { + font-size: 2rem; + margin: 0; +} + +.bold { + font-weight: 600; +} + +#loginBox { + display: inline-grid; + grid-template: "username-label username-input" auto + "password-label password-input" auto + "login-button login-button" auto + "message message" auto + / max-content max-content; + align-items: center; + padding: 10px; + border: solid black 1px; +} + +#usernameLabel { + grid-area: username-label; +} + +#usernameInput { + grid-area: username-input; + margin: 2px; +} + +#passwordLabel { + grid-area: password-label; +} + +#passwordInput { + grid-area: password-input; + margin: 2px; +} + +#loginButton { + grid-area: login-button; + justify-self: end; +} + +#loginMessage { + grid-area: message; + justify-self: end; + color: red; +} diff --git a/Timeline/ClientApp/src/app/home/home.component.html b/Timeline/ClientApp/src/app/home/home.component.html new file mode 100644 index 00000000..c3c9ed73 --- /dev/null +++ b/Timeline/ClientApp/src/app/home/home.component.html @@ -0,0 +1,22 @@ +<h2> + This page is under <span class="bold">construction</span>! +</h2> + +<h2> + To-do list: +</h2> + +<ol> + <li>Learn DI and Service module in Angular.</li> + <li>Develop basic authentication module.</li> + <li>Learn Bootstrap.</li> +</ol> + +<div id="loginBox"> + <label id="usernameLabel">username</label> + <input id="usernameInput" type="text" [(ngModel)]="loginInfo.username"> + <label id="passwordLabel">password</label> + <input id="passwordInput" type="password" [(ngModel)]="loginInfo.password"> + <input id="loginButton" type="button" value="Login" (click)="tryLogin()"> + <div id="loginMessage">{{message}}</div> +</div> diff --git a/Timeline/ClientApp/src/app/home/home.component.spec.ts b/Timeline/ClientApp/src/app/home/home.component.spec.ts new file mode 100644 index 00000000..490e81bd --- /dev/null +++ b/Timeline/ClientApp/src/app/home/home.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { HomeComponent } from './home.component'; + +describe('HomeComponent', () => { + let component: HomeComponent; + let fixture: ComponentFixture<HomeComponent>; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ HomeComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(HomeComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/Timeline/ClientApp/src/app/home/home.component.ts b/Timeline/ClientApp/src/app/home/home.component.ts new file mode 100644 index 00000000..873aee7f --- /dev/null +++ b/Timeline/ClientApp/src/app/home/home.component.ts @@ -0,0 +1,27 @@ +import { Component, OnInit } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; + +class LoginInfo { + username = ''; + password = ''; +} + +@Component({ + selector: 'app-home', + templateUrl: './home.component.html', + styleUrls: ['./home.component.css'] +}) +export class HomeComponent implements OnInit { + + loginInfo = new LoginInfo(); + message = ''; + + constructor(/* private http: HttpClient */) { } + + ngOnInit() { + } + + tryLogin() { + alert('Not implemented!!!'); + } +} diff --git a/Timeline/ClientApp/src/assets/.gitkeep b/Timeline/ClientApp/src/assets/.gitkeep new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/Timeline/ClientApp/src/assets/.gitkeep diff --git a/Timeline/ClientApp/src/browserslist b/Timeline/ClientApp/src/browserslist new file mode 100644 index 00000000..8e09ab49 --- /dev/null +++ b/Timeline/ClientApp/src/browserslist @@ -0,0 +1,9 @@ +# 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 uncomment the last line of the file and adjust as needed +> 0.5% +last 2 versions +Firefox ESR +not dead +# IE 9-11
\ No newline at end of file diff --git a/Timeline/ClientApp/src/environments/environment.prod.ts b/Timeline/ClientApp/src/environments/environment.prod.ts new file mode 100644 index 00000000..3612073b --- /dev/null +++ b/Timeline/ClientApp/src/environments/environment.prod.ts @@ -0,0 +1,3 @@ +export const environment = { + production: true +}; diff --git a/Timeline/ClientApp/src/environments/environment.ts b/Timeline/ClientApp/src/environments/environment.ts new file mode 100644 index 00000000..012182ef --- /dev/null +++ b/Timeline/ClientApp/src/environments/environment.ts @@ -0,0 +1,15 @@ +// 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 +}; + +/* + * In development mode, to ignore zone related error stack frames such as + * `zone.run`, `zoneDelegate.invokeTask` for easier debugging, you can + * import the following file, but please comment it out in production mode + * because it will have performance impact when throw error + */ +// import 'zone.js/dist/zone-error'; // Included with Angular CLI. diff --git a/Timeline/ClientApp/src/index.html b/Timeline/ClientApp/src/index.html new file mode 100644 index 00000000..553e9032 --- /dev/null +++ b/Timeline/ClientApp/src/index.html @@ -0,0 +1,14 @@ +<!doctype html> +<html lang="en"> +<head> + <meta charset="utf-8"> + <title>Timeline</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>Loading...</app-root> +</body> +</html> diff --git a/Timeline/ClientApp/src/karma.conf.js b/Timeline/ClientApp/src/karma.conf.js new file mode 100644 index 00000000..4a9730b9 --- /dev/null +++ b/Timeline/ClientApp/src/karma.conf.js @@ -0,0 +1,31 @@ +// 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'), + reports: ['html', 'lcovonly'], + fixWebpackSourcePaths: true + }, + reporters: ['progress', 'kjhtml'], + port: 9876, + colors: true, + logLevel: config.LOG_INFO, + autoWatch: true, + browsers: ['Chrome'], + singleRun: false + }); +}; diff --git a/Timeline/ClientApp/src/main.ts b/Timeline/ClientApp/src/main.ts new file mode 100644 index 00000000..a2f708cb --- /dev/null +++ b/Timeline/ClientApp/src/main.ts @@ -0,0 +1,20 @@ +import { enableProdMode } from '@angular/core'; +import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; + +import { AppModule } from './app/app.module'; +import { environment } from './environments/environment'; + +export function getBaseUrl() { + return document.getElementsByTagName('base')[0].href; +} + +const providers = [ + { provide: 'BASE_URL', useFactory: getBaseUrl, deps: [] } +]; + +if (environment.production) { + enableProdMode(); +} + +platformBrowserDynamic(providers).bootstrapModule(AppModule) + .catch(err => console.log(err)); diff --git a/Timeline/ClientApp/src/polyfills.ts b/Timeline/ClientApp/src/polyfills.ts new file mode 100644 index 00000000..d310405a --- /dev/null +++ b/Timeline/ClientApp/src/polyfills.ts @@ -0,0 +1,80 @@ +/** + * 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/docs/ts/latest/guide/browser-support.html + */ + +/*************************************************************************************************** + * BROWSER POLYFILLS + */ + +/** IE9, IE10 and IE11 requires all of the following polyfills. **/ +// import 'core-js/es6/symbol'; +// import 'core-js/es6/object'; +// import 'core-js/es6/function'; +// import 'core-js/es6/parse-int'; +// import 'core-js/es6/parse-float'; +// import 'core-js/es6/number'; +// import 'core-js/es6/math'; +// import 'core-js/es6/string'; +// import 'core-js/es6/date'; +// import 'core-js/es6/array'; +// import 'core-js/es6/regexp'; +// import 'core-js/es6/map'; +// import 'core-js/es6/weak-map'; +// import 'core-js/es6/set'; + +/** IE10 and IE11 requires the following for NgClass support on SVG elements */ +// import 'classlist.js'; // Run `npm install --save classlist.js`. + +/** IE10 and IE11 requires the following for the Reflect API. */ +// import 'core-js/es6/reflect'; + + +/** Evergreen browsers require these. **/ +// Used for reflect-metadata in JIT. If you use AOT (and only Angular decorators), you can remove. +import 'core-js/es7/reflect'; + + +/** + * 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 + */ + + // (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 + */ diff --git a/Timeline/ClientApp/src/styles.css b/Timeline/ClientApp/src/styles.css new file mode 100644 index 00000000..90d4ee00 --- /dev/null +++ b/Timeline/ClientApp/src/styles.css @@ -0,0 +1 @@ +/* You can add global styles to this file, and also import other style files */ diff --git a/Timeline/ClientApp/src/test.ts b/Timeline/ClientApp/src/test.ts new file mode 100644 index 00000000..16317897 --- /dev/null +++ b/Timeline/ClientApp/src/test.ts @@ -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); diff --git a/Timeline/ClientApp/src/tsconfig.app.json b/Timeline/ClientApp/src/tsconfig.app.json new file mode 100644 index 00000000..722c370d --- /dev/null +++ b/Timeline/ClientApp/src/tsconfig.app.json @@ -0,0 +1,12 @@ +{ + "extends": "../tsconfig.json", + "compilerOptions": { + "outDir": "../out-tsc/app", + "module": "es2015", + "types": [] + }, + "exclude": [ + "src/test.ts", + "**/*.spec.ts" + ] +} diff --git a/Timeline/ClientApp/src/tsconfig.server.json b/Timeline/ClientApp/src/tsconfig.server.json new file mode 100644 index 00000000..8019d415 --- /dev/null +++ b/Timeline/ClientApp/src/tsconfig.server.json @@ -0,0 +1,9 @@ +{ + "extends": "../tsconfig.json", + "compilerOptions": { + "module": "commonjs" + }, + "angularCompilerOptions": { + "entryModule": "app/app.server.module#AppServerModule" + } +}
\ No newline at end of file diff --git a/Timeline/ClientApp/src/tsconfig.spec.json b/Timeline/ClientApp/src/tsconfig.spec.json new file mode 100644 index 00000000..8f7cedec --- /dev/null +++ b/Timeline/ClientApp/src/tsconfig.spec.json @@ -0,0 +1,19 @@ +{ + "extends": "../tsconfig.json", + "compilerOptions": { + "outDir": "../out-tsc/spec", + "module": "commonjs", + "types": [ + "jasmine", + "node" + ] + }, + "files": [ + "test.ts", + "polyfills.ts" + ], + "include": [ + "**/*.spec.ts", + "**/*.d.ts" + ] +} diff --git a/Timeline/ClientApp/src/tslint.json b/Timeline/ClientApp/src/tslint.json new file mode 100644 index 00000000..52e2c1a5 --- /dev/null +++ b/Timeline/ClientApp/src/tslint.json @@ -0,0 +1,17 @@ +{ + "extends": "../tslint.json", + "rules": { + "directive-selector": [ + true, + "attribute", + "app", + "camelCase" + ], + "component-selector": [ + true, + "element", + "app", + "kebab-case" + ] + } +} |