mirror of
https://github.com/fabioformosa/quartz-manager.git
synced 2026-05-14 22:00:30 +09:00
upgraded frontend to angular ver 7
This commit is contained in:
@@ -1,57 +0,0 @@
|
|||||||
{
|
|
||||||
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
|
|
||||||
"project": {
|
|
||||||
"name": "angular-spring-starter"
|
|
||||||
},
|
|
||||||
"apps": [
|
|
||||||
{
|
|
||||||
"root": "src",
|
|
||||||
"outDir": "../server/src/main/resources/static",
|
|
||||||
"assets": [
|
|
||||||
"assets",
|
|
||||||
"favicon.ico"
|
|
||||||
],
|
|
||||||
"index": "index.html",
|
|
||||||
"main": "main.ts",
|
|
||||||
"polyfills": "polyfills.ts",
|
|
||||||
"test": "test.ts",
|
|
||||||
"tsconfig": "tsconfig.app.json",
|
|
||||||
"testTsconfig": "tsconfig.spec.json",
|
|
||||||
"prefix": "app",
|
|
||||||
"styles": [
|
|
||||||
"styles.css"
|
|
||||||
],
|
|
||||||
"scripts": [],
|
|
||||||
"environmentSource": "environments/environment.ts",
|
|
||||||
"environments": {
|
|
||||||
"dev": "environments/environment.ts",
|
|
||||||
"prod": "environments/environment.prod.ts"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"e2e": {
|
|
||||||
"protractor": {
|
|
||||||
"config": "./protractor.conf.js"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"lint": [
|
|
||||||
{
|
|
||||||
"project": "src/tsconfig.app.json"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"project": "src/tsconfig.spec.json"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"project": "e2e/tsconfig.e2e.json"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"test": {
|
|
||||||
"karma": {
|
|
||||||
"config": "./karma.conf.js"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"defaults": {
|
|
||||||
"styleExt": "css",
|
|
||||||
"component": {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
128
quartz-manager-frontend/angular.json
Normal file
128
quartz-manager-frontend/angular.json
Normal file
@@ -0,0 +1,128 @@
|
|||||||
|
{
|
||||||
|
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
|
||||||
|
"version": 1,
|
||||||
|
"newProjectRoot": "projects",
|
||||||
|
"projects": {
|
||||||
|
"angular-spring-starter": {
|
||||||
|
"root": "",
|
||||||
|
"sourceRoot": "src",
|
||||||
|
"projectType": "application",
|
||||||
|
"architect": {
|
||||||
|
"build": {
|
||||||
|
"builder": "@angular-devkit/build-angular:browser",
|
||||||
|
"options": {
|
||||||
|
"outputPath": "../server/src/main/resources/static",
|
||||||
|
"index": "src/index.html",
|
||||||
|
"main": "src/main.ts",
|
||||||
|
"tsConfig": "src/tsconfig.app.json",
|
||||||
|
"polyfills": "src/polyfills.ts",
|
||||||
|
"assets": [
|
||||||
|
"src/assets",
|
||||||
|
"src/favicon.ico"
|
||||||
|
],
|
||||||
|
"styles": [
|
||||||
|
"src/styles.css"
|
||||||
|
],
|
||||||
|
"scripts": []
|
||||||
|
},
|
||||||
|
"configurations": {
|
||||||
|
"production": {
|
||||||
|
"optimization": true,
|
||||||
|
"outputHashing": "all",
|
||||||
|
"sourceMap": false,
|
||||||
|
"extractCss": true,
|
||||||
|
"namedChunks": false,
|
||||||
|
"aot": true,
|
||||||
|
"extractLicenses": true,
|
||||||
|
"vendorChunk": false,
|
||||||
|
"buildOptimizer": true,
|
||||||
|
"fileReplacements": [
|
||||||
|
{
|
||||||
|
"replace": "src/environments/environment.ts",
|
||||||
|
"with": "src/environments/environment.prod.ts"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"serve": {
|
||||||
|
"builder": "@angular-devkit/build-angular:dev-server",
|
||||||
|
"options": {
|
||||||
|
"browserTarget": "angular-spring-starter:build"
|
||||||
|
},
|
||||||
|
"configurations": {
|
||||||
|
"production": {
|
||||||
|
"browserTarget": "angular-spring-starter:build:production"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"extract-i18n": {
|
||||||
|
"builder": "@angular-devkit/build-angular:extract-i18n",
|
||||||
|
"options": {
|
||||||
|
"browserTarget": "angular-spring-starter:build"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"test": {
|
||||||
|
"builder": "@angular-devkit/build-angular:karma",
|
||||||
|
"options": {
|
||||||
|
"main": "src/test.ts",
|
||||||
|
"karmaConfig": "./karma.conf.js",
|
||||||
|
"polyfills": "src/polyfills.ts",
|
||||||
|
"tsConfig": "src/tsconfig.spec.json",
|
||||||
|
"scripts": [],
|
||||||
|
"styles": [
|
||||||
|
"src/styles.css"
|
||||||
|
],
|
||||||
|
"assets": [
|
||||||
|
"src/assets",
|
||||||
|
"src/favicon.ico"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"lint": {
|
||||||
|
"builder": "@angular-devkit/build-angular:tslint",
|
||||||
|
"options": {
|
||||||
|
"tsConfig": [
|
||||||
|
"src/tsconfig.app.json",
|
||||||
|
"src/tsconfig.spec.json"
|
||||||
|
],
|
||||||
|
"exclude": []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"angular-spring-starter-e2e": {
|
||||||
|
"root": "e2e",
|
||||||
|
"sourceRoot": "e2e",
|
||||||
|
"projectType": "application",
|
||||||
|
"architect": {
|
||||||
|
"e2e": {
|
||||||
|
"builder": "@angular-devkit/build-angular:protractor",
|
||||||
|
"options": {
|
||||||
|
"protractorConfig": "./protractor.conf.js",
|
||||||
|
"devServerTarget": "angular-spring-starter:serve"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"lint": {
|
||||||
|
"builder": "@angular-devkit/build-angular:tslint",
|
||||||
|
"options": {
|
||||||
|
"tsConfig": [
|
||||||
|
"e2e/tsconfig.e2e.json"
|
||||||
|
],
|
||||||
|
"exclude": []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"defaultProject": "angular-spring-starter",
|
||||||
|
"schematics": {
|
||||||
|
"@schematics/angular:component": {
|
||||||
|
"prefix": "app",
|
||||||
|
"styleext": "css"
|
||||||
|
},
|
||||||
|
"@schematics/angular:directive": {
|
||||||
|
"prefix": "app"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,33 +4,31 @@
|
|||||||
module.exports = function (config) {
|
module.exports = function (config) {
|
||||||
config.set({
|
config.set({
|
||||||
basePath: '',
|
basePath: '',
|
||||||
frameworks: ['jasmine', '@angular/cli'],
|
frameworks: ['jasmine', '@angular-devkit/build-angular'],
|
||||||
plugins: [
|
plugins: [
|
||||||
require('karma-jasmine'),
|
require('karma-jasmine'),
|
||||||
require('karma-chrome-launcher'),
|
require('karma-chrome-launcher'),
|
||||||
require('karma-jasmine-html-reporter'),
|
require('karma-jasmine-html-reporter'),
|
||||||
require('karma-coverage-istanbul-reporter'),
|
require('karma-coverage-istanbul-reporter'),
|
||||||
require('@angular/cli/plugins/karma')
|
require('@angular-devkit/build-angular/plugins/karma')
|
||||||
],
|
],
|
||||||
client:{
|
client:{
|
||||||
clearContext: false // leave Jasmine Spec Runner output visible in browser
|
clearContext: false // leave Jasmine Spec Runner output visible in browser
|
||||||
},
|
},
|
||||||
files: [
|
files: [
|
||||||
{ pattern: './src/test.ts', watched: false }
|
|
||||||
],
|
],
|
||||||
preprocessors: {
|
preprocessors: {
|
||||||
'./src/test.ts': ['@angular/cli']
|
|
||||||
},
|
},
|
||||||
mime: {
|
mime: {
|
||||||
'text/x-typescript': ['ts','tsx']
|
'text/x-typescript': ['ts','tsx']
|
||||||
},
|
},
|
||||||
coverageIstanbulReporter: {
|
coverageIstanbulReporter: {
|
||||||
reports: [ 'html', 'lcovonly' ],
|
dir: require('path').join(__dirname, 'coverage'), reports: [ 'html', 'lcovonly' ],
|
||||||
fixWebpackSourcePaths: true
|
fixWebpackSourcePaths: true
|
||||||
},
|
},
|
||||||
angularCli: {
|
|
||||||
environment: 'dev'
|
|
||||||
},
|
|
||||||
reporters: config.angularCli && config.angularCli.codeCoverage
|
reporters: config.angularCli && config.angularCli.codeCoverage
|
||||||
? ['progress', 'coverage-istanbul']
|
? ['progress', 'coverage-istanbul']
|
||||||
: ['progress', 'kjhtml'],
|
: ['progress', 'kjhtml'],
|
||||||
|
|||||||
@@ -12,34 +12,37 @@
|
|||||||
},
|
},
|
||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@angular/animations": "5.2.8",
|
"@angular/animations": "7.2.13",
|
||||||
"@angular/cdk": "5.2.4",
|
"@angular/cdk": "7.3.7",
|
||||||
"@angular/common": "5.2.8",
|
"@angular/common": "7.2.13",
|
||||||
"@angular/compiler": "5.2.8",
|
"@angular/compiler": "7.2.13",
|
||||||
"@angular/core": "5.2.8",
|
"@angular/core": "7.2.13",
|
||||||
"@angular/flex-layout": "5.0.0-beta.13",
|
"@angular/flex-layout": "7.0.0-beta.24",
|
||||||
"@angular/forms": "5.2.8",
|
"@angular/forms": "7.2.13",
|
||||||
"@angular/http": "5.2.8",
|
"@angular/http": "7.2.13",
|
||||||
"@angular/material": "5.2.4",
|
"@angular/material": "7.3.7",
|
||||||
"@angular/platform-browser": "5.2.8",
|
"@angular/platform-browser": "7.2.13",
|
||||||
"@angular/platform-browser-dynamic": "5.2.8",
|
"@angular/platform-browser-dynamic": "7.2.13",
|
||||||
"@angular/platform-server": "5.2.8",
|
"@angular/platform-server": "7.2.13",
|
||||||
"@angular/router": "5.2.8",
|
"@angular/router": "7.2.13",
|
||||||
"@fortawesome/fontawesome": "^1.1.4",
|
"@fortawesome/fontawesome": "^1.1.4",
|
||||||
"@fortawesome/fontawesome-free-regular": "^5.0.8",
|
"@fortawesome/fontawesome-free-regular": "^5.0.8",
|
||||||
"@fortawesome/fontawesome-free-solid": "^5.0.8",
|
"@fortawesome/fontawesome-free-solid": "^5.0.8",
|
||||||
"@stomp/ng2-stompjs": "^0.6.3",
|
"@stomp/ng2-stompjs": "^0.6.3",
|
||||||
"core-js": "2.5.1",
|
"core-js": "2.5.1",
|
||||||
"hammerjs": "2.0.8",
|
"hammerjs": "2.0.8",
|
||||||
"rxjs": "5.5.2",
|
"net": "^1.0.2",
|
||||||
|
"rxjs": "6.4.0",
|
||||||
"stompjs": "^2.3.3",
|
"stompjs": "^2.3.3",
|
||||||
|
"tslib": "^1.9.0",
|
||||||
"zone.js": "0.8.18"
|
"zone.js": "0.8.18"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@angular-devkit/build-angular": "~0.13.0",
|
||||||
"@angular-devkit/core": "^0.2.0",
|
"@angular-devkit/core": "^0.2.0",
|
||||||
"@angular/cli": "1.5.3",
|
"@angular/cli": "7.3.7",
|
||||||
"@angular/compiler-cli": "5.2.8",
|
"@angular/compiler-cli": "7.2.13",
|
||||||
"@angular/language-service": "5.2.8",
|
"@angular/language-service": "7.2.13",
|
||||||
"@types/hammerjs": "2.0.34",
|
"@types/hammerjs": "2.0.34",
|
||||||
"@types/jasmine": "2.5.54",
|
"@types/jasmine": "2.5.54",
|
||||||
"@types/jasminewd2": "2.0.3",
|
"@types/jasminewd2": "2.0.3",
|
||||||
@@ -56,6 +59,6 @@
|
|||||||
"protractor": "5.1.2",
|
"protractor": "5.1.2",
|
||||||
"ts-node": "3.0.6",
|
"ts-node": "3.0.6",
|
||||||
"tslint": "5.7.0",
|
"tslint": "5.7.0",
|
||||||
"typescript": "2.4.2"
|
"typescript": "3.2.4"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,12 +4,12 @@
|
|||||||
<p [class]="notification.msgType" *ngIf="notification">{{notification.msgBody}}</p>
|
<p [class]="notification.msgType" *ngIf="notification">{{notification.msgBody}}</p>
|
||||||
<mat-card-content>
|
<mat-card-content>
|
||||||
<form *ngIf="!submitted" [formGroup]="form" (ngSubmit)="onSubmit()" #changePasswordForm="ngForm">
|
<form *ngIf="!submitted" [formGroup]="form" (ngSubmit)="onSubmit()" #changePasswordForm="ngForm">
|
||||||
<mat-input-container>
|
<mat-form-field>
|
||||||
<input matInput formControlName="oldPassword" required type="password" placeholder="old password">
|
<input matInput formControlName="oldPassword" required type="password" placeholder="old password">
|
||||||
</mat-input-container>
|
</mat-form-field>
|
||||||
<mat-input-container>
|
<mat-form-field>
|
||||||
<input matInput formControlName="newPassword" required type="password" placeholder="new password">
|
<input matInput formControlName="newPassword" required type="password" placeholder="new password">
|
||||||
</mat-input-container>
|
</mat-form-field>
|
||||||
<button type="submit" [disabled]="!changePasswordForm.form.valid" mat-raised-button color="primary">Change Password</button>
|
<button type="submit" [disabled]="!changePasswordForm.form.valid" mat-raised-button color="primary">Change Password</button>
|
||||||
</form>
|
</form>
|
||||||
<mat-spinner *ngIf="submitted" mode="indeterminate"></mat-spinner>
|
<mat-spinner *ngIf="submitted" mode="indeterminate"></mat-spinner>
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ mat-card {
|
|||||||
-webkit-animation: fadein 1s; /* Safari and Chrome */
|
-webkit-animation: fadein 1s; /* Safari and Chrome */
|
||||||
}
|
}
|
||||||
|
|
||||||
mat-input-container {
|
mat-form-field {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
|||||||
import { AuthService } from 'app/service';
|
import { AuthService } from 'app/service';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
import { DisplayMessage } from '../shared/models/display-message';
|
import { DisplayMessage } from '../shared/models/display-message';
|
||||||
|
import { delay, mergeMap } from 'rxjs/operators';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-change-password',
|
selector: 'app-change-password',
|
||||||
@@ -50,9 +51,7 @@ export class ChangePasswordComponent implements OnInit {
|
|||||||
this.submitted = true;
|
this.submitted = true;
|
||||||
|
|
||||||
this.authService.changePassowrd(this.form.value)
|
this.authService.changePassowrd(this.form.value)
|
||||||
// show me the animation
|
.pipe(delay(1000), mergeMap(() => this.authService.logout()))
|
||||||
.delay(1000)
|
|
||||||
.mergeMap(() => this.authService.logout())
|
|
||||||
.subscribe(() => {
|
.subscribe(() => {
|
||||||
this.router.navigate(['/login', { msgType: 'success', msgBody: 'Success! Please sign in with your new password.'}]);
|
this.router.navigate(['/login', { msgType: 'success', msgBody: 'Success! Please sign in with your new password.'}]);
|
||||||
}, error => {
|
}, error => {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
|
import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
|
||||||
|
|
||||||
import { LogsWebsocketService, ApiService } from '../../service';
|
import { LogsWebsocketService, ApiService } from '../../service';
|
||||||
import { Observable } from 'rxjs/Observable';
|
import { Observable } from 'rxjs';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'logs-panel',
|
selector: 'logs-panel',
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core'
|
import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core'
|
||||||
import { ProgressWebsocketService } from '../../service';
|
import { ProgressWebsocketService } from '../../service';
|
||||||
|
|
||||||
import { Observable } from 'rxjs/Observable';
|
import { Observable } from 'rxjs';
|
||||||
// import {Message} from '@stomp/stompjs';
|
// import {Message} from '@stomp/stompjs';
|
||||||
|
|
||||||
// import { Subscription } from 'rxjs/Subscription';
|
// import { Subscription } from 'rxjs/Subscription';
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { Router, CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';
|
import { Router, CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';
|
||||||
import { UserService } from '../service';
|
import { UserService } from '../service';
|
||||||
import { Observable } from 'rxjs/Observable';
|
import { Observable } from 'rxjs';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class AdminGuard implements CanActivate {
|
export class AdminGuard implements CanActivate {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { Router, CanActivate } from '@angular/router';
|
import { Router, CanActivate } from '@angular/router';
|
||||||
import { UserService } from '../service';
|
import { UserService } from '../service';
|
||||||
import { Observable } from 'rxjs/Observable';
|
import { Observable } from 'rxjs';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class GuestGuard implements CanActivate {
|
export class GuestGuard implements CanActivate {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { Router, CanActivate } from '@angular/router';
|
import { Router, CanActivate } from '@angular/router';
|
||||||
import { UserService } from '../service';
|
import { UserService } from '../service';
|
||||||
import { Observable } from 'rxjs/Observable';
|
import { Observable } from 'rxjs';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class LoginGuard implements CanActivate {
|
export class LoginGuard implements CanActivate {
|
||||||
|
|||||||
@@ -15,12 +15,12 @@
|
|||||||
<p [class]="notification.msgType" *ngIf="notification">{{notification.msgBody}}</p>
|
<p [class]="notification.msgType" *ngIf="notification">{{notification.msgBody}}</p>
|
||||||
|
|
||||||
<form *ngIf="!submitted" [formGroup]="form" (ngSubmit)="onSubmit()" #loginForm="ngForm">
|
<form *ngIf="!submitted" [formGroup]="form" (ngSubmit)="onSubmit()" #loginForm="ngForm">
|
||||||
<mat-input-container>
|
<mat-form-field>
|
||||||
<input matInput formControlName="username" required placeholder="user">
|
<input matInput formControlName="username" required placeholder="user">
|
||||||
</mat-input-container>
|
</mat-form-field>
|
||||||
<mat-input-container>
|
<mat-form-field>
|
||||||
<input matInput formControlName="password" required type="password" placeholder="password">
|
<input matInput formControlName="password" required type="password" placeholder="password">
|
||||||
</mat-input-container>
|
</mat-form-field>
|
||||||
<button type="submit" [disabled]="!loginForm.form.valid" mat-raised-button color="primary">Login</button>
|
<button type="submit" [disabled]="!loginForm.form.valid" mat-raised-button color="primary">Login</button>
|
||||||
</form>
|
</form>
|
||||||
<!-- <br>
|
<!-- <br>
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ mat-card {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mat-input-container {
|
mat-form-field {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,14 +3,16 @@ import { Component, OnInit, OnDestroy } from '@angular/core';
|
|||||||
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
||||||
import { Router, ActivatedRoute } from '@angular/router';
|
import { Router, ActivatedRoute } from '@angular/router';
|
||||||
import { DisplayMessage } from '../shared/models/display-message';
|
import { DisplayMessage } from '../shared/models/display-message';
|
||||||
import { Subscription } from 'rxjs/Subscription';
|
import { Subscription } from 'rxjs';
|
||||||
|
import { takeUntil, delay } from 'rxjs/operators'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
UserService,
|
UserService,
|
||||||
AuthService
|
AuthService
|
||||||
} from '../service';
|
} from '../service';
|
||||||
|
|
||||||
import { Observable } from 'rxjs/Observable';
|
import { Observable } from 'rxjs';
|
||||||
import { Subject } from 'rxjs/SUbject';
|
import { Subject } from 'rxjs';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-login',
|
selector: 'app-login',
|
||||||
@@ -50,7 +52,7 @@ export class LoginComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.route.params
|
this.route.params
|
||||||
.takeUntil(this.ngUnsubscribe)
|
.pipe(takeUntil(this.ngUnsubscribe))
|
||||||
.subscribe((params: DisplayMessage) => {
|
.subscribe((params: DisplayMessage) => {
|
||||||
this.notification = params;
|
this.notification = params;
|
||||||
});
|
});
|
||||||
@@ -92,7 +94,7 @@ export class LoginComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
this.authService.login(this.form.value)
|
this.authService.login(this.form.value)
|
||||||
// show me the animation
|
// show me the animation
|
||||||
.delay(1000)
|
.pipe(delay(1000))
|
||||||
.subscribe(data => {
|
.subscribe(data => {
|
||||||
this.userService.getMyInfo().subscribe();
|
this.userService.getMyInfo().subscribe();
|
||||||
this.router.navigate([this.returnUrl]);
|
this.router.navigate([this.returnUrl]);
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
import { HttpClient, HttpHeaders, HttpResponse, HttpRequest, HttpEventType, HttpParams } from '@angular/common/http';
|
import { HttpClient, HttpHeaders, HttpResponse, HttpRequest, HttpEventType, HttpParams } from '@angular/common/http';
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { Observable } from 'rxjs/Observable';
|
import { Observable } from 'rxjs';
|
||||||
import 'rxjs/Rx';
|
import { catchError, map, filter } from 'rxjs/operators'
|
||||||
import 'rxjs/add/observable/throw';
|
|
||||||
import { serialize } from 'app/shared/utilities/serialize';
|
import { serialize } from 'app/shared/utilities/serialize';
|
||||||
|
|
||||||
export enum RequestMethod {
|
export enum RequestMethod {
|
||||||
@@ -36,7 +35,7 @@ export class ApiService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return this.http.get(path, options)
|
return this.http.get(path, options)
|
||||||
.catch(this.checkError.bind(this));
|
.pipe(catchError(this.checkError.bind(this)));
|
||||||
}
|
}
|
||||||
|
|
||||||
post(path: string, body: any, customHeaders?: HttpHeaders): Observable<any> {
|
post(path: string, body: any, customHeaders?: HttpHeaders): Observable<any> {
|
||||||
@@ -58,9 +57,11 @@ export class ApiService {
|
|||||||
});
|
});
|
||||||
|
|
||||||
return this.http.request(req)
|
return this.http.request(req)
|
||||||
.filter(response => response instanceof HttpResponse)
|
.pipe(
|
||||||
.map((response: HttpResponse<any>) => response.body)
|
filter(response => response instanceof HttpResponse),
|
||||||
.catch(error => this.checkError(error));
|
map((response: HttpResponse<any>) => response.body),
|
||||||
|
catchError(error => this.checkError(error))
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Display error if logged in, otherwise redirect to IDP
|
// Display error if logged in, otherwise redirect to IDP
|
||||||
|
|||||||
@@ -3,7 +3,8 @@ import { HttpHeaders } from '@angular/common/http';
|
|||||||
import { ApiService } from './api.service';
|
import { ApiService } from './api.service';
|
||||||
import { UserService } from './user.service';
|
import { UserService } from './user.service';
|
||||||
import { ConfigService } from './config.service';
|
import { ConfigService } from './config.service';
|
||||||
import { Observable } from 'rxjs/Observable';
|
import { Observable } from 'rxjs';
|
||||||
|
import { map } from 'rxjs/operators';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class AuthService {
|
export class AuthService {
|
||||||
@@ -20,10 +21,10 @@ export class AuthService {
|
|||||||
'Content-Type': 'application/x-www-form-urlencoded'
|
'Content-Type': 'application/x-www-form-urlencoded'
|
||||||
});
|
});
|
||||||
const body = `username=${user.username}&password=${user.password}`;
|
const body = `username=${user.username}&password=${user.password}`;
|
||||||
return this.apiService.post(this.config.login_url, body, loginHeaders).map(() => {
|
return this.apiService.post(this.config.login_url, body, loginHeaders).pipe(map(() => {
|
||||||
console.log("Login success");
|
console.log("Login success");
|
||||||
this.userService.getMyInfo().subscribe();
|
this.userService.getMyInfo().subscribe();
|
||||||
});
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
signup(user){
|
signup(user){
|
||||||
@@ -31,16 +32,16 @@ export class AuthService {
|
|||||||
'Accept': 'application/json',
|
'Accept': 'application/json',
|
||||||
'Content-Type': 'application/json'
|
'Content-Type': 'application/json'
|
||||||
});
|
});
|
||||||
return this.apiService.post(this.config.signup_url, JSON.stringify(user), signupHeaders).map(() =>{
|
return this.apiService.post(this.config.signup_url, JSON.stringify(user), signupHeaders).pipe(map(() =>{
|
||||||
console.log("Sign up success");
|
console.log("Sign up success");
|
||||||
});
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
logout() {
|
logout() {
|
||||||
return this.apiService.post(this.config.logout_url, {})
|
return this.apiService.post(this.config.logout_url, {})
|
||||||
.map(() => {
|
.pipe(map(() => {
|
||||||
this.userService.currentUser = null;
|
this.userService.currentUser = null;
|
||||||
});
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
changePassowrd(passwordChanger) {
|
changePassowrd(passwordChanger) {
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ import { Headers } from '@angular/http';
|
|||||||
import { ApiService } from './api.service';
|
import { ApiService } from './api.service';
|
||||||
import { ConfigService } from './config.service';
|
import { ConfigService } from './config.service';
|
||||||
|
|
||||||
|
import { map } from 'rxjs/operators'
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class UserService {
|
export class UserService {
|
||||||
|
|
||||||
@@ -41,7 +43,7 @@ export class UserService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getMyInfo() {
|
getMyInfo() {
|
||||||
return this.apiService.get(this.config.whoami_url).map(user => this.currentUser = user);
|
return this.apiService.get(this.config.whoami_url).pipe(map(user => this.currentUser = user));
|
||||||
}
|
}
|
||||||
|
|
||||||
getAll() {
|
getAll() {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { Injectable, OnInit } from '@angular/core';
|
import { Injectable, OnInit } from '@angular/core';
|
||||||
import { Headers } from '@angular/http';
|
import { Headers } from '@angular/http';
|
||||||
|
|
||||||
import { Observable } from 'rxjs/Observable';
|
import { Observable } from 'rxjs';
|
||||||
|
|
||||||
import { ApiService } from './api.service';
|
import { ApiService } from './api.service';
|
||||||
|
|
||||||
|
|||||||
@@ -15,22 +15,22 @@
|
|||||||
<p [class]="notification.msgType" *ngIf="notification">{{notification.msgBody}}</p>
|
<p [class]="notification.msgType" *ngIf="notification">{{notification.msgBody}}</p>
|
||||||
|
|
||||||
<form *ngIf="!submitted" [formGroup]="form" (ngSubmit)="onSubmit()" #signupForm="ngForm">
|
<form *ngIf="!submitted" [formGroup]="form" (ngSubmit)="onSubmit()" #signupForm="ngForm">
|
||||||
<mat-input-container>
|
<mat-form-field>
|
||||||
<label>Username: </label>
|
<label>Username: </label>
|
||||||
<input matInput formControlName="username" required>
|
<input matInput formControlName="username" required>
|
||||||
</mat-input-container>
|
</mat-form-field>
|
||||||
<mat-input-container>
|
<mat-form-field>
|
||||||
<label>Password: </label>
|
<label>Password: </label>
|
||||||
<input matInput formControlName="password" required type="password">
|
<input matInput formControlName="password" required type="password">
|
||||||
</mat-input-container>
|
</mat-form-field>
|
||||||
<mat-input-container>
|
<mat-form-field>
|
||||||
<label>First Name: </label>
|
<label>First Name: </label>
|
||||||
<input matInput formControlName="firstname">
|
<input matInput formControlName="firstname">
|
||||||
</mat-input-container>
|
</mat-form-field>
|
||||||
<mat-input-container>
|
<mat-form-field>
|
||||||
<label>Last Name: </label>
|
<label>Last Name: </label>
|
||||||
<input matInput formControlName="lastname">
|
<input matInput formControlName="lastname">
|
||||||
</mat-input-container>
|
</mat-form-field>
|
||||||
<button type="submit" [disabled]="!signupForm.form.valid" mat-raised-button color="primary">Sign up</button>
|
<button type="submit" [disabled]="!signupForm.form.valid" mat-raised-button color="primary">Sign up</button>
|
||||||
</form>
|
</form>
|
||||||
<br>
|
<br>
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mat-input-container {
|
mat-form-field {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,14 +3,15 @@ import { Component, OnInit, OnDestroy } from '@angular/core';
|
|||||||
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
||||||
import { Router, ActivatedRoute } from '@angular/router';
|
import { Router, ActivatedRoute } from '@angular/router';
|
||||||
import { DisplayMessage } from '../shared/models/display-message';
|
import { DisplayMessage } from '../shared/models/display-message';
|
||||||
import { Subscription } from 'rxjs/Subscription';
|
import { Subscription } from 'rxjs';
|
||||||
|
import { takeUntil, delay } from 'rxjs/operators'
|
||||||
import {
|
import {
|
||||||
UserService,
|
UserService,
|
||||||
AuthService
|
AuthService
|
||||||
} from '../service';
|
} from '../service';
|
||||||
|
|
||||||
import { Observable } from 'rxjs/Observable';
|
import { Observable } from 'rxjs';
|
||||||
import { Subject } from 'rxjs/SUbject';
|
import { Subject } from 'rxjs';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-signup',
|
selector: 'app-signup',
|
||||||
@@ -49,8 +50,9 @@ export class SignupComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.route.params
|
this.route.params.pipe(
|
||||||
.takeUntil(this.ngUnsubscribe)
|
takeUntil(this.ngUnsubscribe)
|
||||||
|
)
|
||||||
.subscribe((params: DisplayMessage) => {
|
.subscribe((params: DisplayMessage) => {
|
||||||
this.notification = params;
|
this.notification = params;
|
||||||
});
|
});
|
||||||
@@ -82,7 +84,7 @@ export class SignupComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
this.authService.signup(this.form.value)
|
this.authService.signup(this.form.value)
|
||||||
// show me the animation
|
// show me the animation
|
||||||
.delay(1000)
|
.pipe(delay(1000))
|
||||||
.subscribe(data => {
|
.subscribe(data => {
|
||||||
console.log(data);
|
console.log(data);
|
||||||
this.authService.login(this.form.value).subscribe(data =>{
|
this.authService.login(this.form.value).subscribe(data =>{
|
||||||
|
|||||||
@@ -42,7 +42,6 @@
|
|||||||
|
|
||||||
/** Evergreen browsers require these. **/
|
/** Evergreen browsers require these. **/
|
||||||
import 'core-js/es6/reflect';
|
import 'core-js/es6/reflect';
|
||||||
import 'core-js/es7/reflect';
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -56,6 +55,8 @@ import 'core-js/es7/reflect';
|
|||||||
*/
|
*/
|
||||||
import 'zone.js/dist/zone'; // Included with Angular CLI.
|
import 'zone.js/dist/zone'; // Included with Angular CLI.
|
||||||
|
|
||||||
|
(window as any).global = window
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************************************
|
/***************************************************************************************************
|
||||||
|
|||||||
@@ -11,7 +11,8 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"test.ts"
|
"test.ts",
|
||||||
|
"polyfills.ts"
|
||||||
],
|
],
|
||||||
"include": [
|
"include": [
|
||||||
"**/*.spec.ts",
|
"**/*.spec.ts",
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"compileOnSave": false,
|
"compileOnSave": false,
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
|
"importHelpers": true,
|
||||||
"outDir": "./dist/out-tsc",
|
"outDir": "./dist/out-tsc",
|
||||||
"baseUrl": "src",
|
"baseUrl": "src",
|
||||||
"sourceMap": true,
|
"sourceMap": true,
|
||||||
@@ -15,6 +16,7 @@
|
|||||||
"lib": [
|
"lib": [
|
||||||
"es2016",
|
"es2016",
|
||||||
"dom"
|
"dom"
|
||||||
]
|
],
|
||||||
|
"module": "es2015"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
"curly": true,
|
"curly": true,
|
||||||
"eofline": true,
|
"eofline": true,
|
||||||
"forin": true,
|
"forin": true,
|
||||||
"import-blacklist": [true, "rxjs"],
|
"import-blacklist": [true],
|
||||||
"import-spacing": true,
|
"import-spacing": true,
|
||||||
"indent": [
|
"indent": [
|
||||||
true,
|
true,
|
||||||
|
|||||||
Reference in New Issue
Block a user