From 2c549c7c5982eda9cff482285af4ff36fecbecd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Phillip=20K=C3=BChne?= Date: Sat, 30 Sep 2023 00:21:58 +0000 Subject: [PATCH] Now everything is actually working again. --- frontend/ng-karaoqueue/angular.json | 3 +- .../ng-karaoqueue/src/app/app.component.ts | 1 + frontend/ng-karaoqueue/src/app/app.module.ts | 1 + .../src/app/song-service.service.ts | 4 +- frontend/ng-karaoqueue/src/custom-theme.scss | 2 +- frontend/ng-karaoqueue/src/main.ts | 4 ++ frontend/ng-karaoqueue/src/polyfills.ts | 61 +++++++++++++++++++ frontend/ng-karaoqueue/src/test.ts | 34 +++++++++++ frontend/ng-karaoqueue/src/tsconfig.json | 28 +++++++++ frontend/ng-karaoqueue/tsconfig.app.json | 2 + frontend/ng-karaoqueue/tsconfig.json | 43 +++++-------- 11 files changed, 150 insertions(+), 33 deletions(-) create mode 100644 frontend/ng-karaoqueue/src/polyfills.ts create mode 100644 frontend/ng-karaoqueue/src/tsconfig.json diff --git a/frontend/ng-karaoqueue/angular.json b/frontend/ng-karaoqueue/angular.json index 1068516..c3f6d8d 100644 --- a/frontend/ng-karaoqueue/angular.json +++ b/frontend/ng-karaoqueue/angular.json @@ -13,11 +13,12 @@ "build": { "builder": "@angular-devkit/build-angular:browser", "options": { + "preserveSymlinks": true, "outputPath": "dist/ng-karaoqueue", "index": "src/index.html", "main": "src/main.ts", "polyfills": "src/polyfills.ts", - "tsConfig": "tsconfig.app.json", + "tsConfig": "src/tsconfig.json", "aot": false, "assets": [ "src/favicon.ico", diff --git a/frontend/ng-karaoqueue/src/app/app.component.ts b/frontend/ng-karaoqueue/src/app/app.component.ts index 62c71e5..de0b04e 100644 --- a/frontend/ng-karaoqueue/src/app/app.component.ts +++ b/frontend/ng-karaoqueue/src/app/app.component.ts @@ -1,4 +1,5 @@ import { Component, OnInit } from '@angular/core'; +import { RuntimeConfigLoaderService } from 'runtime-config-loader'; @Component({ diff --git a/frontend/ng-karaoqueue/src/app/app.module.ts b/frontend/ng-karaoqueue/src/app/app.module.ts index 03ec520..5ff2a2a 100644 --- a/frontend/ng-karaoqueue/src/app/app.module.ts +++ b/frontend/ng-karaoqueue/src/app/app.module.ts @@ -1,5 +1,6 @@ import { BrowserModule, DomSanitizer } from '@angular/platform-browser'; import { NgModule } from '@angular/core'; +import { RuntimeConfigLoaderModule } from 'runtime-config-loader'; import { AppRoutingModule } from './app-routing.module'; import { AppComponent } from './app.component'; diff --git a/frontend/ng-karaoqueue/src/app/song-service.service.ts b/frontend/ng-karaoqueue/src/app/song-service.service.ts index 4177637..e808af8 100644 --- a/frontend/ng-karaoqueue/src/app/song-service.service.ts +++ b/frontend/ng-karaoqueue/src/app/song-service.service.ts @@ -26,11 +26,11 @@ export class SongServiceService { let out = new Array(); -/* this.http.get(this.api +"/songs/compl?search="+text).subscribe((data: JSON) => { + this.http.get(this.api +"/songs/compl?search="+text).subscribe((data: Observable) => { data.forEach(element => { out.push(new Song(element["title"],element["artist"],element["karafun_id"],element["duo"],element["explicit"],element["_id"],element["styles"],element["languages"])); }); - });*/ + }); const observable = new Observable>( subscriber => { subscriber.next(out); diff --git a/frontend/ng-karaoqueue/src/custom-theme.scss b/frontend/ng-karaoqueue/src/custom-theme.scss index b93d68e..5a12812 100644 --- a/frontend/ng-karaoqueue/src/custom-theme.scss +++ b/frontend/ng-karaoqueue/src/custom-theme.scss @@ -142,7 +142,7 @@ $mat-dark-theme-background: ( ); // Compute font config -@include mat-core($fontConfig); +@include mat-core(); // Theme Config diff --git a/frontend/ng-karaoqueue/src/main.ts b/frontend/ng-karaoqueue/src/main.ts index e69de29..e60eb81 100644 --- a/frontend/ng-karaoqueue/src/main.ts +++ b/frontend/ng-karaoqueue/src/main.ts @@ -0,0 +1,4 @@ +import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; +import { AppModule } from './app/app.module'; + +platformBrowserDynamic().bootstrapModule(AppModule); \ No newline at end of file diff --git a/frontend/ng-karaoqueue/src/polyfills.ts b/frontend/ng-karaoqueue/src/polyfills.ts new file mode 100644 index 0000000..1daa5c5 --- /dev/null +++ b/frontend/ng-karaoqueue/src/polyfills.ts @@ -0,0 +1,61 @@ +/** + * @license + * Copyright Google LLC All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ + +/** + * This file includes polyfills needed by Angular and is loaded before the app. + * You can add your own extra polyfills to this file. + * + * This file is divided into 2 sections: + * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers. + * 2. Application imports. Files imported after ZoneJS that should be loaded before your main + * file. + * + * The current setup is for so-called "evergreen" browsers; the last versions of browsers that + * automatically update themselves. This includes recent versions of Safari, Chrome (including + * Opera), Edge on the desktop, and iOS and Chrome on mobile. + * + * Learn more in https://angular.io/guide/browser-support + */ + +/*************************************************************************************************** + * BROWSER POLYFILLS + */ + +/** + * By default, zone.js will patch all possible macroTask and DomEvents + * user can disable parts of macroTask/DomEvents patch by setting following flags + * because those flags need to be set before `zone.js` being loaded, and webpack + * will put import in the top of bundle, so user need to create a separate file + * in this directory (for example: zone-flags.ts), and put the following flags + * into that file, and then add the following code before importing zone.js. + * import './zone-flags'; + * + * The flags allowed in zone-flags.ts are listed here. + * + * The following flags will work for all browsers. + * + * (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame + * (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick + * (window as any).__zone_symbol__UNPATCHED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames + * + * in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js + * with the following flag, it will bypass `zone.js` patch for IE/Edge + * + * (window as any).__Zone_enable_cross_context_check = true; + * + */ + +/*************************************************************************************************** + * Zone JS is required by default for Angular itself. + */ +import 'zone.js'; // Included with Angular CLI. + + +/*************************************************************************************************** + * APPLICATION IMPORTS + */ \ No newline at end of file diff --git a/frontend/ng-karaoqueue/src/test.ts b/frontend/ng-karaoqueue/src/test.ts index e69de29..c71e4f3 100644 --- a/frontend/ng-karaoqueue/src/test.ts +++ b/frontend/ng-karaoqueue/src/test.ts @@ -0,0 +1,34 @@ +/** + * @license + * Copyright Google LLC All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ + +// This file is required by karma.conf.js and loads recursively all the .spec and framework files + +import 'zone.js/testing'; +import { getTestBed } from '@angular/core/testing'; +import { + BrowserDynamicTestingModule, + platformBrowserDynamicTesting +} from '@angular/platform-browser-dynamic/testing'; + +declare const require: { + context(path: string, deep?: boolean, filter?: RegExp): { + (id: string): T; + keys(): string[]; + }; +}; + +// First, initialize the Angular testing environment. +getTestBed().initTestEnvironment( + BrowserDynamicTestingModule, + platformBrowserDynamicTesting(), +); + +// Then we find all the tests. +const context = require.context('./', true, /\.spec\.ts$/); +// And load the modules. +context.keys().forEach(context); \ No newline at end of file diff --git a/frontend/ng-karaoqueue/src/tsconfig.json b/frontend/ng-karaoqueue/src/tsconfig.json new file mode 100644 index 0000000..76a733c --- /dev/null +++ b/frontend/ng-karaoqueue/src/tsconfig.json @@ -0,0 +1,28 @@ +{ + "compilerOptions": { + "baseUrl": "", + "declaration": false, + "downlevelIteration": true, + "experimentalDecorators": true, + "lib": [ + "es6", + "dom" + ], + "mapRoot": "./", + "module": "ES2022", + "moduleResolution": "node", + "outDir": "../dist/out-tsc", + "sourceMap": true, + "target": "ES2022", + "skipLibCheck": true, + "typeRoots": [ + "../node_modules/@types" + ], + "useDefineForClassFields": false + }, + "include": [ + "main.ts", + "polyfills.ts", + "src/**/*.d.ts" + ] +} \ No newline at end of file diff --git a/frontend/ng-karaoqueue/tsconfig.app.json b/frontend/ng-karaoqueue/tsconfig.app.json index ac13bf2..c3d3e40 100644 --- a/frontend/ng-karaoqueue/tsconfig.app.json +++ b/frontend/ng-karaoqueue/tsconfig.app.json @@ -7,6 +7,8 @@ }, "files": [ "src/app/app.module.ts", + "src/main.ts", + "src/polyfills.ts" ], "include": [ "src/**/*.d.ts" diff --git a/frontend/ng-karaoqueue/tsconfig.json b/frontend/ng-karaoqueue/tsconfig.json index 0612a31..dc1a581 100644 --- a/frontend/ng-karaoqueue/tsconfig.json +++ b/frontend/ng-karaoqueue/tsconfig.json @@ -1,32 +1,17 @@ -/* To learn more about this file see: https://angular.io/config/tsconfig. */ +/* + This is a "Solution Style" tsconfig.json file, and is used by editors and TypeScript’s language server to improve development experience. + It is not intended to be used to perform a compilation. + + To learn more about this file see: https://angular.io/config/solution-tsconfig. +*/ { - "compileOnSave": false, + "files": [], + "references": [ + { + "path": "./src/tsconfig.json" + } + ], "compilerOptions": { - "baseUrl": "src", - "outDir": "./dist/out-tsc", - "forceConsistentCasingInFileNames": true, - "strict": true, - "noImplicitOverride": true, - "noPropertyAccessFromIndexSignature": true, - "noImplicitReturns": true, - "noFallthroughCasesInSwitch": true, - "sourceMap": true, - "declaration": false, - "downlevelIteration": true, - "experimentalDecorators": true, - "moduleResolution": "node", - "importHelpers": true, - "target": "es2020", - "module": "es2020", - "lib": [ - "es2020", - "dom" - ] - }, - "angularCompilerOptions": { - "enableI18nLegacyMessageIdFormat": false, - "strictInjectionParameters": true, - "strictInputAccessModifiers": true, - "strictTemplates": true + "target": "ES2022", } - } \ No newline at end of file +} \ No newline at end of file