This commit is contained in:
Michał Zieliski
2024-06-19 17:31:19 +02:00
parent 796596b093
commit a7fe3455ea
12 changed files with 3737 additions and 3372 deletions

View File

@@ -15,12 +15,15 @@
"prefix": "ipms", "prefix": "ipms",
"architect": { "architect": {
"build": { "build": {
"builder": "@angular-devkit/build-angular:browser", "builder": "@angular-devkit/build-angular:application",
"options": { "options": {
"outputPath": "dist/diunaBI", "outputPath": {
"base": "dist/diunaBI"
},
"index": "src/index.html", "index": "src/index.html",
"main": "src/main.ts", "polyfills": [
"polyfills": "src/polyfills.ts", "src/polyfills.ts"
],
"tsConfig": "tsconfig.app.json", "tsConfig": "tsconfig.app.json",
"inlineStyleLanguage": "scss", "inlineStyleLanguage": "scss",
"assets": [ "assets": [
@@ -36,8 +39,8 @@
"allowedCommonJsDependencies": [ "allowedCommonJsDependencies": [
"moment" "moment"
], ],
"serviceWorker": true, "serviceWorker": "ngsw-config.json",
"ngswConfigPath": "ngsw-config.json" "browser": "src/main.ts"
}, },
"configurations": { "configurations": {
"production": { "production": {
@@ -62,9 +65,7 @@
"outputHashing": "all" "outputHashing": "all"
}, },
"development": { "development": {
"buildOptimizer": false,
"optimization": false, "optimization": false,
"vendorChunk": true,
"extractLicenses": false, "extractLicenses": false,
"sourceMap": true, "sourceMap": true,
"namedChunks": true "namedChunks": true
@@ -76,10 +77,10 @@
"builder": "@angular-devkit/build-angular:dev-server", "builder": "@angular-devkit/build-angular:dev-server",
"configurations": { "configurations": {
"production": { "production": {
"browserTarget": "DiunaBI:build:production" "buildTarget": "DiunaBI:build:production"
}, },
"development": { "development": {
"browserTarget": "DiunaBI:build:development" "buildTarget": "DiunaBI:build:development"
} }
}, },
"defaultConfiguration": "development" "defaultConfiguration": "development"
@@ -87,7 +88,7 @@
"extract-i18n": { "extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n", "builder": "@angular-devkit/build-angular:extract-i18n",
"options": { "options": {
"browserTarget": "DiunaBI:build" "buildTarget": "DiunaBI:build"
} }
}, },
"test": { "test": {

View File

@@ -12,46 +12,46 @@
}, },
"private": true, "private": true,
"dependencies": { "dependencies": {
"@angular/animations": "^16.2.10", "@angular/animations": "^18.0.3",
"@angular/cdk": "^16.2.9", "@angular/cdk": "^18.0.3",
"@angular/common": "^16.2.10", "@angular/common": "^18.0.3",
"@angular/compiler": "^16.2.10", "@angular/compiler": "^18.0.3",
"@angular/core": "^16.2.10", "@angular/core": "^18.0.3",
"@angular/forms": "^16.2.10", "@angular/forms": "^18.0.3",
"@angular/material": "^16.2.9", "@angular/material": "^18.0.3",
"@angular/material-moment-adapter": "^16.2.9", "@angular/material-moment-adapter": "^18.0.3",
"@angular/platform-browser": "^16.2.10", "@angular/platform-browser": "^18.0.3",
"@angular/platform-browser-dynamic": "^16.2.10", "@angular/platform-browser-dynamic": "^18.0.3",
"@angular/pwa": "16.2.7", "@angular/pwa": "18.0.4",
"@angular/router": "^16.2.10", "@angular/router": "^18.0.3",
"@angular/service-worker": "^16.2.10", "@angular/service-worker": "^18.0.3",
"jwt-decode": "^3.1.2", "jwt-decode": "^4.0.0",
"moment": "^2.29.4", "moment": "^2.30.1",
"rxjs": "^7.6.0", "rxjs": "^7.6.0",
"uuid": "9.0.1", "uuid": "10.0.0",
"zone.js": "0.14.0" "zone.js": "0.14.7"
}, },
"devDependencies": { "devDependencies": {
"@angular-devkit/build-angular": "^16.2.7", "@angular-devkit/build-angular": "^18.0.4",
"@angular-eslint/builder": "16.2.0", "@angular-eslint/builder": "18.0.1",
"@angular-eslint/eslint-plugin": "16.2.0", "@angular-eslint/eslint-plugin": "18.0.1",
"@angular-eslint/eslint-plugin-template": "16.2.0", "@angular-eslint/eslint-plugin-template": "18.0.1",
"@angular-eslint/schematics": "16.2.0", "@angular-eslint/schematics": "18.0.1",
"@angular-eslint/template-parser": "16.2.0", "@angular-eslint/template-parser": "18.0.1",
"@angular/cli": "~16.2.7", "@angular/cli": "~18.0.4",
"@angular/compiler-cli": "^16.2.10", "@angular/compiler-cli": "^18.0.3",
"@types/jasmine": "5.1.1", "@types/jasmine": "5.1.4",
"@types/uuid": "9.0.6", "@types/uuid": "9.0.8",
"@typescript-eslint/eslint-plugin": "6.8.0", "@typescript-eslint/eslint-plugin": "^7.2.0",
"@typescript-eslint/parser": "6.8.0", "@typescript-eslint/parser": "^7.2.0",
"eslint": "8.51.0", "eslint": "^9.5.0",
"jasmine-core": "5.1.1", "jasmine-core": "5.1.2",
"karma": "~6.4.0", "karma": "~6.4.3",
"karma-chrome-launcher": "3.2.0", "karma-chrome-launcher": "3.2.0",
"karma-coverage": "2.2.1", "karma-coverage": "2.2.1",
"karma-jasmine": "~5.1.0", "karma-jasmine": "~5.1.0",
"karma-jasmine-html-reporter": "2.1.0", "karma-jasmine-html-reporter": "2.1.0",
"tslib": "2.6.2", "tslib": "2.6.3",
"typescript": "5.1.6" "typescript": "5.4.5"
} }
} }

View File

@@ -16,6 +16,7 @@ export class AppComponent {
private readonly _swUpdate: SwUpdate, private readonly _swUpdate: SwUpdate,
private _notifications: NotificationsService private _notifications: NotificationsService
) { ) {
console.log('AppComponent');
this.subscribeUpdates(); this.subscribeUpdates();
} }

View File

@@ -4,7 +4,7 @@ import moment, { Moment } from 'moment';
import { environment } from 'src/environments/environment'; import { environment } from 'src/environments/environment';
import { User } from '../models/user.model'; import { User } from '../models/user.model';
import { BehaviorSubject, from, Observable } from 'rxjs'; import { BehaviorSubject, from, Observable } from 'rxjs';
import jwt_decode from "jwt-decode"; import {jwtDecode} from "jwt-decode";
@Injectable({ @Injectable({
providedIn: 'root' providedIn: 'root'
@@ -27,6 +27,9 @@ export class AuthService {
this.askForAuthData(); this.askForAuthData();
// eslint-disable-next-line @typescript-eslint/ban-ts-comment // eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore // @ts-ignore
console.log('Check if loaded', window.onGoogleLibraryLoad);
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
window.onGoogleLibraryLoad = () => { window.onGoogleLibraryLoad = () => {
this.isGoogleLibLoaded.next(true); this.isGoogleLibLoaded.next(true);
}; };
@@ -47,8 +50,8 @@ export class AuthService {
}); });
} }
retrieveUserFromCredentials(credentials: string) { retrieveUserFromCredentials(credentials: string) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any // eslint-disable-next-line @typescript-eslint/no-explicit-any
const responsePayload: any = jwt_decode(credentials); const responsePayload: any = jwtDecode(credentials);
this.user = new User({ this.user = new User({
userName: `${responsePayload.given_name} ${responsePayload.family_name}`, userName: `${responsePayload.given_name} ${responsePayload.family_name}`,
email: responsePayload.email, email: responsePayload.email,
@@ -78,6 +81,7 @@ export class AuthService {
return from(this.getAPIToken()); return from(this.getAPIToken());
} }
isAuthenticated(): boolean { isAuthenticated(): boolean {
console.log('IsAuthenticated');
return !!this.apiToken && return !!this.apiToken &&
!!this.webCredentials && !!this.webCredentials &&
!!this.user && !!this.user &&

View File

@@ -1,10 +1,5 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { import { HttpRequest, HttpHandler, HttpEvent, HttpInterceptor } from '@angular/common/http';
HttpRequest,
HttpHandler,
HttpEvent,
HttpInterceptor
} from '@angular/common/http';
import { AuthService } from '../auth/auth.service'; import { AuthService } from '../auth/auth.service';
import { EMPTY, Observable } from 'rxjs'; import { EMPTY, Observable } from 'rxjs';
import moment from 'moment'; import moment from 'moment';

View File

@@ -1,10 +1,5 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { import { HttpRequest, HttpHandler, HttpEvent, HttpInterceptor } from '@angular/common/http';
HttpRequest,
HttpHandler,
HttpEvent,
HttpInterceptor
} from '@angular/common/http';
import { finalize, Observable } from 'rxjs'; import { finalize, Observable } from 'rxjs';
import { DataService } from '../services/data.service'; import { DataService } from '../services/data.service';

View File

@@ -1,9 +1,8 @@
import { Moment } from 'moment';
import { Deserializable } from './deserializable.model'; import { Deserializable } from './deserializable.model';
import { Serializable } from './serializable.model'; import { Serializable } from './serializable.model';
import * as moment from 'moment';
import { User } from './user.model'; import { User } from './user.model';
import moment, {Moment} from "moment";
export class Base implements Deserializable, Serializable { export class Base implements Deserializable, Serializable {
id?: string; id?: string;
@@ -17,7 +16,7 @@ export class Base implements Deserializable, Serializable {
constructor(data: Partial<Base> = {}) { constructor(data: Partial<Base> = {}) {
Object.assign(this, data); Object.assign(this, data);
} }
// eslint-disable-next-line @typescript-eslint/no-explicit-any // eslint-disable-next-line @typescript-eslint/no-explicit-any
deserialize(input: any): this { deserialize(input: any): this {
if (input.createdAt) { input.createdAt = moment(input.createdAt).utc(true); } if (input.createdAt) { input.createdAt = moment(input.createdAt).utc(true); }
@@ -27,9 +26,9 @@ export class Base implements Deserializable, Serializable {
Object.assign(this, input); Object.assign(this, input);
return this; return this;
} }
// eslint-disable-next-line @typescript-eslint/no-explicit-any // eslint-disable-next-line @typescript-eslint/no-explicit-any
serialize() : any { serialize() : any {
return Object.assign({}, this); return Object.assign({}, this);
} }
} }

View File

@@ -26,7 +26,9 @@ export class LoginViewComponent implements OnInit {
loading = false; loading = false;
ngOnInit(): void { ngOnInit(): void {
console.log('Init loginViewComponent');
this.auth$.isGoogleLibLoaded.subscribe((isLoaded) => { this.auth$.isGoogleLibLoaded.subscribe((isLoaded) => {
console.log('GoogleLibLoaded', isLoaded);
if (isLoaded) { if (isLoaded) {
this.initGoogleLogin(); this.initGoogleLogin();
} }

View File

@@ -2,7 +2,6 @@ import { Component, NgZone, ViewChild } from '@angular/core';
import { MatSidenav, MatSidenavModule } from '@angular/material/sidenav'; import { MatSidenav, MatSidenavModule } from '@angular/material/sidenav';
import { NavigationStart, Router, RouterLink, RouterOutlet } from '@angular/router'; import { NavigationStart, Router, RouterLink, RouterOutlet } from '@angular/router';
import { MatMenuModule } from '@angular/material/menu'; import { MatMenuModule } from '@angular/material/menu';
import * as moment from 'moment';
import packageInfo from 'package.json'; import packageInfo from 'package.json';
import { delay } from 'rxjs'; import { delay } from 'rxjs';
import { environment } from 'src/environments/environment'; import { environment } from 'src/environments/environment';
@@ -16,13 +15,14 @@ import { MatToolbarModule } from '@angular/material/toolbar';
import { MatIconModule } from '@angular/material/icon'; import { MatIconModule } from '@angular/material/icon';
import { NgIf, DatePipe } from '@angular/common'; import { NgIf, DatePipe } from '@angular/common';
import { MainMenuComponent } from 'src/app/components/main-menu/main-menu.component'; import { MainMenuComponent } from 'src/app/components/main-menu/main-menu.component';
import moment from "moment";
@Component({ @Component({
selector: 'diunabi-main-view', selector: 'diunabi-main-view',
templateUrl: './main-view.component.html', templateUrl: './main-view.component.html',
styleUrls: ['./main-view.component.scss'], styleUrls: ['./main-view.component.scss'],
standalone: true, standalone: true,
imports: [NgIf, MatIconModule, MatToolbarModule, MatButtonModule, MatSidenavModule, imports: [NgIf, MatIconModule, MatToolbarModule, MatButtonModule, MatSidenavModule,
MatListModule, RouterLink, MatDividerModule, RouterOutlet, DatePipe, MatMenuModule, MainMenuComponent] MatListModule, RouterLink, MatDividerModule, RouterOutlet, DatePipe, MatMenuModule, MainMenuComponent]
}) })
export class MainViewComponent { export class MainViewComponent {
@@ -49,7 +49,7 @@ export class MainViewComponent {
//listen to loading subject //listen to loading subject
data$.showLoader.pipe(delay(0)).subscribe(loading => { data$.showLoader.pipe(delay(0)).subscribe(loading => {
this.ngZone$.run(() => { this.ngZone$.run(() => {
this.loading = loading; this.loading = loading;
}); });
}); });

View File

@@ -2,11 +2,11 @@
@include mat.core(); @include mat.core();
$my-app-primary: mat.define-palette(mat.$orange-palette); $my-app-primary: mat.m2-define-palette(mat.$m2-orange-palette);
$my-app-accent: mat.define-palette(mat.$pink-palette, A200, A100, A400); $my-app-accent: mat.m2-define-palette(mat.$m2-pink-palette, A200, A100, A400);
$my-app-warn: mat.define-palette(mat.$red-palette); $my-app-warn: mat.m2-define-palette(mat.$m2-red-palette);
$my-app-theme: mat.define-light-theme((color: (primary: $my-app-primary, $my-app-theme: mat.m2-define-light-theme((color: (primary: $my-app-primary,
accent: $my-app-accent, accent: $my-app-accent,
warn: $my-app-warn, warn: $my-app-warn,
), ),

View File

@@ -5,13 +5,13 @@
"outDir": "./dist/out-tsc", "outDir": "./dist/out-tsc",
"forceConsistentCasingInFileNames": true, "forceConsistentCasingInFileNames": true,
"strict": true, "strict": true,
"esModuleInterop": true,
"noImplicitOverride": true, "noImplicitOverride": true,
"noPropertyAccessFromIndexSignature": true, "noPropertyAccessFromIndexSignature": true,
"noImplicitReturns": true, "noImplicitReturns": true,
"noFallthroughCasesInSwitch": true, "noFallthroughCasesInSwitch": true,
"sourceMap": true, "sourceMap": true,
"declaration": false, "declaration": false,
"downlevelIteration": true,
"experimentalDecorators": true, "experimentalDecorators": true,
"moduleResolution": "node", "moduleResolution": "node",
"importHelpers": true, "importHelpers": true,
@@ -22,8 +22,7 @@
"dom" "dom"
], ],
"useDefineForClassFields": false, "useDefineForClassFields": false,
"resolveJsonModule": true, "resolveJsonModule": true
"allowSyntheticDefaultImports": true
}, },
"angularCompilerOptions": { "angularCompilerOptions": {
"enableI18nLegacyMessageIdFormat": false, "enableI18nLegacyMessageIdFormat": false,

File diff suppressed because it is too large Load Diff