From 730a7b066b9f65331624d94233b2d5994732609c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20Echterh=C3=B6lter?= Date: Wed, 7 Aug 2024 14:59:38 +0200 Subject: [PATCH] feat: removing unused ui's, removing backend and updating dockerfile --- .dockerignore | 5 +- Dockerfile | 27 --- backend/index.js | 23 -- backend/package-lock.json | 226 ------------------ backend/package.json | 14 -- frontend/angular.json | 6 +- frontend/package.json | 1 + .../account-list/account-list.component.html | 58 ----- .../account-list/account-list.component.scss | 0 .../account-list.component.spec.ts | 23 -- .../account-list/account-list.component.ts | 30 --- frontend/src/app/apollo-factory.ts | 44 ---- frontend/src/app/app.config.ts | 23 +- frontend/src/app/app.routes.ts | 3 +- frontend/src/app/graphql.config.ts | 2 - frontend/src/app/models/account.ts | 20 -- .../services/account-service.service.spec.ts | 16 -- .../app/services/account-service.service.ts | 55 ----- package.json | 2 - 19 files changed, 10 insertions(+), 568 deletions(-) delete mode 100644 Dockerfile delete mode 100644 backend/index.js delete mode 100644 backend/package-lock.json delete mode 100644 backend/package.json delete mode 100644 frontend/src/app/account-list/account-list.component.html delete mode 100644 frontend/src/app/account-list/account-list.component.scss delete mode 100644 frontend/src/app/account-list/account-list.component.spec.ts delete mode 100644 frontend/src/app/account-list/account-list.component.ts delete mode 100644 frontend/src/app/apollo-factory.ts delete mode 100644 frontend/src/app/graphql.config.ts delete mode 100644 frontend/src/app/models/account.ts delete mode 100644 frontend/src/app/services/account-service.service.spec.ts delete mode 100644 frontend/src/app/services/account-service.service.ts diff --git a/.dockerignore b/.dockerignore index ce3edeb..c83c9b2 100644 --- a/.dockerignore +++ b/.dockerignore @@ -7,7 +7,4 @@ !frontend/tsconfig.json !frontend/src/** -!backend/package.json -!backend/package-lock.json -!backend/index.js - +!nginx.conf diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 48c54f5..0000000 --- a/Dockerfile +++ /dev/null @@ -1,27 +0,0 @@ -FROM node:20.11 as build - -COPY frontend/package.json frontend/package-lock.json /app/frontend/ -COPY backend/package.json backend/package-lock.json /app/backend/ - -WORKDIR /app/backend -RUN npm ci - -WORKDIR /app/frontend -RUN npm ci - -COPY /frontend ./ -RUN npm run build - -WORKDIR /app/backend -COPY /backend ./ -RUN npm run build - -FROM node:20.11.0-alpine - -# Applications -COPY --from=build /app /app - -WORKDIR /app/backend -EXPOSE 8080 - -CMD ["node", "index"] diff --git a/backend/index.js b/backend/index.js deleted file mode 100644 index e6b963b..0000000 --- a/backend/index.js +++ /dev/null @@ -1,23 +0,0 @@ -var finalhandler = require('finalhandler') -var http = require('http') -var serveStatic = require('serve-static') - -var serve = serveStatic('../frontend/dist/example-content/browser', { - index: false, - setHeaders: setHeaders -}) - -// Set header to force download -function setHeaders (res, path) { - res.setHeader('Access-Control-Allow-Origin', '*') -} - -// Create server -var server = http.createServer(function onRequest (req, res) { - serve(req, res, finalhandler(req, res)) -}) - -// Listen -let PORT = process.env.PORT || 8080; -server.listen(PORT) -console.log(`Server listening on port ${PORT}`) \ No newline at end of file diff --git a/backend/package-lock.json b/backend/package-lock.json deleted file mode 100644 index 4097c45..0000000 --- a/backend/package-lock.json +++ /dev/null @@ -1,226 +0,0 @@ -{ - "name": "example-content-backend", - "version": "0.0.0", - "lockfileVersion": 3, - "requires": true, - "packages": { - "": { - "name": "example-content-backend", - "version": "0.0.0", - "dependencies": { - "finalhandler": "^1.2.0", - "serve-static": "^1.15.0" - } - }, - "node_modules/debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dependencies": { - "ms": "2.0.0" - } - }, - "node_modules/debug/node_modules/ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" - }, - "node_modules/depd": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", - "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/destroy": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz", - "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==", - "engines": { - "node": ">= 0.8", - "npm": "1.2.8000 || >= 1.4.16" - } - }, - "node_modules/ee-first": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", - "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==" - }, - "node_modules/encodeurl": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", - "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/escape-html": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", - "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==" - }, - "node_modules/etag": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", - "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/finalhandler": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.2.0.tgz", - "integrity": "sha512-5uXcUVftlQMFnWC9qu/svkWv3GTd2PfUhK/3PLkYNAe7FbqJMt3515HaxE6eRL74GdsriiwujiawdaB1BpEISg==", - "dependencies": { - "debug": "2.6.9", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "on-finished": "2.4.1", - "parseurl": "~1.3.3", - "statuses": "2.0.1", - "unpipe": "~1.0.0" - }, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/fresh": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", - "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/http-errors": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", - "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==", - "dependencies": { - "depd": "2.0.0", - "inherits": "2.0.4", - "setprototypeof": "1.2.0", - "statuses": "2.0.1", - "toidentifier": "1.0.1" - }, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" - }, - "node_modules/mime": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", - "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", - "bin": { - "mime": "cli.js" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" - }, - "node_modules/on-finished": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", - "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", - "dependencies": { - "ee-first": "1.1.1" - }, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/parseurl": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", - "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/range-parser": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", - "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/send": { - "version": "0.18.0", - "resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz", - "integrity": "sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==", - "dependencies": { - "debug": "2.6.9", - "depd": "2.0.0", - "destroy": "1.2.0", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "etag": "~1.8.1", - "fresh": "0.5.2", - "http-errors": "2.0.0", - "mime": "1.6.0", - "ms": "2.1.3", - "on-finished": "2.4.1", - "range-parser": "~1.2.1", - "statuses": "2.0.1" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/serve-static": { - "version": "1.15.0", - "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.15.0.tgz", - "integrity": "sha512-XGuRDNjXUijsUL0vl6nSD7cwURuzEgglbOaFuZM9g3kwDXOWVTck0jLzjPzGD+TazWbboZYu52/9/XPdUgne9g==", - "dependencies": { - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "parseurl": "~1.3.3", - "send": "0.18.0" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/setprototypeof": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", - "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==" - }, - "node_modules/statuses": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", - "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/toidentifier": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", - "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", - "engines": { - "node": ">=0.6" - } - }, - "node_modules/unpipe": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", - "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==", - "engines": { - "node": ">= 0.8" - } - } - } -} diff --git a/backend/package.json b/backend/package.json deleted file mode 100644 index 62f0cd3..0000000 --- a/backend/package.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "name": "example-content-backend", - "version": "0.0.0", - "scripts": { - "build": "echo 'No build step'", - "test": "echo 'No test step'", - "start": "node index.js" - }, - "private": true, - "dependencies": { - "finalhandler": "^1.2.0", - "serve-static": "^1.15.0" - } -} diff --git a/frontend/angular.json b/frontend/angular.json index 29478e5..f4f2ca5 100644 --- a/frontend/angular.json +++ b/frontend/angular.json @@ -17,7 +17,7 @@ "build": { "builder": "@angular-devkit/build-angular:application", "options": { - "outputPath": "dist/example-content", + "outputPath": "dist", "index": "src/index.html", "browser": "src/main.ts", "polyfills": [ @@ -62,8 +62,8 @@ "budgets": [ { "type": "initial", - "maximumWarning": "500kb", - "maximumError": "1mb" + "maximumWarning": "3mb", + "maximumError": "5mb" }, { "type": "anyComponentStyle", diff --git a/frontend/package.json b/frontend/package.json index 99cd45e..b4b823b 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -5,6 +5,7 @@ "ng": "ng", "start": "ng serve", "build": "ng build", + "build-prod": "ng build -c production", "watch": "ng build --watch --configuration development", "test": "echo 'tests skipped for now'" }, diff --git a/frontend/src/app/account-list/account-list.component.html b/frontend/src/app/account-list/account-list.component.html deleted file mode 100644 index 33dfc25..0000000 --- a/frontend/src/app/account-list/account-list.component.html +++ /dev/null @@ -1,58 +0,0 @@ -
- - - - - - - Accounts - - - - - - - - - - - -
- - - - - - - - - - - - - - - -
NameDisplay Name
- {{ row.metadata.name }} - - {{ row.spec.displayName }} -
-
-
-
-

No Accounts so far

-

Create your first Account!

-
- - - -
-
-
-
-
-
\ No newline at end of file diff --git a/frontend/src/app/account-list/account-list.component.scss b/frontend/src/app/account-list/account-list.component.scss deleted file mode 100644 index e69de29..0000000 diff --git a/frontend/src/app/account-list/account-list.component.spec.ts b/frontend/src/app/account-list/account-list.component.spec.ts deleted file mode 100644 index d2be096..0000000 --- a/frontend/src/app/account-list/account-list.component.spec.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { AccountListComponent } from './account-list.component'; - -describe('AccountListComponent', () => { - let component: AccountListComponent; - let fixture: ComponentFixture; - - beforeEach(async () => { - await TestBed.configureTestingModule({ - imports: [AccountListComponent] - }) - .compileComponents(); - - fixture = TestBed.createComponent(AccountListComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/frontend/src/app/account-list/account-list.component.ts b/frontend/src/app/account-list/account-list.component.ts deleted file mode 100644 index 9a14d58..0000000 --- a/frontend/src/app/account-list/account-list.component.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { Component, OnInit } from "@angular/core"; -import { FundamentalNgxCoreModule, IllustratedMessageModule } from "@fundamental-ngx/core"; -import { AccountService } from "../services/account-service.service"; -import { BehaviorSubject, Observable } from "rxjs"; -import { Account } from "../models/account"; -import { CommonModule } from "@angular/common"; - -@Component({ - selector: "app-account-list", - standalone: true, - imports: [FundamentalNgxCoreModule, CommonModule,IllustratedMessageModule], - templateUrl: "./account-list.component.html", - styleUrl: "./account-list.component.scss", -}) -export class AccountListComponent implements OnInit { - constructor(private accountService: AccountService){} - - sceneConfig = { - scene: { url: 'assets/images/sapIllus-Scene-NoSearchResults.svg', id: 'sapIllus-Scene-NoSearchResults' }, - dialog: { url: 'assets/images/sapIllus-Dialog-NoSearchResults.svg', id: 'sapIllus-Dialog-NoSearchResults' } - }; - - - accounts: Observable = new BehaviorSubject([]); - - ngOnInit(): void { - this.accounts = this.accountService.getAccounts() - this.accounts.subscribe(res => console.log(res)) - } -} diff --git a/frontend/src/app/apollo-factory.ts b/frontend/src/app/apollo-factory.ts deleted file mode 100644 index 121d6c2..0000000 --- a/frontend/src/app/apollo-factory.ts +++ /dev/null @@ -1,44 +0,0 @@ -import { Injectable } from "@angular/core"; -import { ApolloLink, InMemoryCache } from "@apollo/client"; -import { setContext } from "@apollo/client/link/context"; -import { apiurl } from "./graphql.config"; -import { PortalLuigiContextService } from "./services/luigi-context.service"; -import { HttpLink } from 'apollo-angular/http'; -import { first } from "rxjs"; - -@Injectable({ - providedIn: 'root' -}) -export class ApolloFactory { - constructor(private luigiContextService:PortalLuigiContextService){} - - - createApollo(httpLink: HttpLink) { - const basic = setContext((operation, context) => ({ - headers: { - Accept: 'charset=utf-8', - }, - })); - - const auth = setContext((operation, context) => { - let ctx = this.luigiContextService.getContext() - if (ctx.token === null) { - return {}; - } else { - return { - headers: { - Authorization: `Bearer ${ctx.token}`, - }, - }; - } - }); - - const link = ApolloLink.from([basic, auth, httpLink.create({ uri: apiurl })]); - const cache = new InMemoryCache(); - - return { - link, - cache, - }; - } -} \ No newline at end of file diff --git a/frontend/src/app/app.config.ts b/frontend/src/app/app.config.ts index 58945c8..8593d28 100644 --- a/frontend/src/app/app.config.ts +++ b/frontend/src/app/app.config.ts @@ -5,35 +5,20 @@ import { routes } from './app.routes'; import { provideAnimations } from '@angular/platform-browser/animations'; import { provideTheming, themingInitializer } from '@fundamental-ngx/core/theming'; import { ContentDensityService, RtlService } from '@fundamental-ngx/core'; -import { Apollo, APOLLO_OPTIONS } from 'apollo-angular'; import { HttpLink } from 'apollo-angular/http'; -import { ApolloClientOptions, ApolloLink, InMemoryCache } from '@apollo/client'; -import { apiurl } from './graphql.config'; import { HttpClientModule } from '@angular/common/http'; -import { setContext } from '@apollo/client/link/context'; -import { ApolloFactory } from './apollo-factory'; export const appConfig: ApplicationConfig = { providers: [ - provideRouter(routes), - provideAnimations(), - provideTheming({ defaultTheme: 'sap_horizon', changeThemeOnQueryParamChange: true }), + provideRouter(routes), + provideAnimations(), + provideTheming({ defaultTheme: 'sap_horizon', changeThemeOnQueryParamChange: true }), themingInitializer(), RtlService, - ApolloFactory, ContentDensityService, importProvidersFrom(HttpClientModule), - { - provide: APOLLO_OPTIONS, - useFactory: apolloOptionsFactory, - deps: [HttpLink, ApolloFactory], - }, - Apollo] + ] }; -export function apolloOptionsFactory(httpLink: HttpLink, apolloFactory: ApolloFactory) { - // Use the ApolloFactory to create the Apollo configuration - return apolloFactory.createApollo(httpLink); -} \ No newline at end of file diff --git a/frontend/src/app/app.routes.ts b/frontend/src/app/app.routes.ts index fca97fa..2855f2b 100644 --- a/frontend/src/app/app.routes.ts +++ b/frontend/src/app/app.routes.ts @@ -1,6 +1,5 @@ import { Routes } from '@angular/router'; -import { AccountListComponent } from './account-list/account-list.component'; export const routes: Routes = [ - { path: 'account-list', component: AccountListComponent }, + ]; diff --git a/frontend/src/app/graphql.config.ts b/frontend/src/app/graphql.config.ts deleted file mode 100644 index b950fce..0000000 --- a/frontend/src/app/graphql.config.ts +++ /dev/null @@ -1,2 +0,0 @@ -// export const apiurl = 'https://api.d1.openmfp.dxp.k8s.ondemand.com/example-gateway/graphql'; -export const apiurl = 'http://localhost:8000/example-gateway/graphql'; diff --git a/frontend/src/app/models/account.ts b/frontend/src/app/models/account.ts deleted file mode 100644 index 02e1c58..0000000 --- a/frontend/src/app/models/account.ts +++ /dev/null @@ -1,20 +0,0 @@ -export interface AccountsResponse { - coreOpenmfpIo: coreOpenmfpIo -} - -export interface coreOpenmfpIo { - accounts: Account[] -} - -export interface Account { - metadata: ObjectMetadata; - spec: AccountSpec -} - -export interface ObjectMetadata { - name: String -} -export interface AccountSpec { - displayName: String - // type: String -} \ No newline at end of file diff --git a/frontend/src/app/services/account-service.service.spec.ts b/frontend/src/app/services/account-service.service.spec.ts deleted file mode 100644 index beaedd5..0000000 --- a/frontend/src/app/services/account-service.service.spec.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { TestBed } from '@angular/core/testing'; - -import { AccountServiceService } from './account-service.service'; - -describe('AccountServiceService', () => { - let service: AccountServiceService; - - beforeEach(() => { - TestBed.configureTestingModule({}); - service = TestBed.inject(AccountServiceService); - }); - - it('should be created', () => { - expect(service).toBeTruthy(); - }); -}); diff --git a/frontend/src/app/services/account-service.service.ts b/frontend/src/app/services/account-service.service.ts deleted file mode 100644 index 9d3a0a4..0000000 --- a/frontend/src/app/services/account-service.service.ts +++ /dev/null @@ -1,55 +0,0 @@ -import { Injectable } from '@angular/core'; -import { distinctUntilChanged, first, map, mergeMap, Observable } from 'rxjs'; -import { Account, AccountsResponse } from '../models/account'; -import { Apollo, gql } from 'apollo-angular'; -import { PortalLuigiContextService } from './luigi-context.service'; - -export const POLLING_INTERVAL = 5000; - -const accountsQuery = gql ` -query { - coreOpenmfpIo { - accounts(namespace: "demo-root") { - metadata { - name - } - spec { - displayName - # type - } - } - } -} -` - -@Injectable({ - providedIn: 'root' -}) -export class AccountService { - - constructor( - private luigiContextService: PortalLuigiContextService, - private apollo : Apollo - ) { } - - public getAccounts(): Observable { - return this.luigiContextService.contextObservable().pipe( - first(), - mergeMap(context => - this.apollo.watchQuery({ - query: accountsQuery, - pollInterval: POLLING_INTERVAL, - fetchPolicy: 'no-cache', - }).valueChanges.pipe( - map((apolloResponse) => { - console.log(apolloResponse); - return apolloResponse.data.coreOpenmfpIo.accounts - } - ), - distinctUntilChanged() - ) - ) - ) - } - -} diff --git a/package.json b/package.json index 816599a..dad29d3 100644 --- a/package.json +++ b/package.json @@ -5,10 +5,8 @@ "npm:install:ui": "cd frontend && npm install", "test": "concurrently 'npm:test:*(!cov)'", "test:ui": "cd frontend && npm run test", - "test:backend": "cd backend && npm run test", "build": "concurrently 'npm:build:*'", "build:ui": "cd frontend && npm run build", - "build:backend": "cd backend && npm run build", "prepare": "husky && npm run npm:install:ui" }, "private": true,