Skip to content
This repository was archived by the owner on Sep 30, 2022. It is now read-only.

Commit

Permalink
refactor: 💡 Refactored PR
Browse files Browse the repository at this point in the history
  • Loading branch information
Dominik Frantisek Bucik committed Feb 1, 2022
1 parent cbe2535 commit 136e899
Show file tree
Hide file tree
Showing 10 changed files with 550 additions and 364 deletions.
5 changes: 2 additions & 3 deletions gui/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"prefix": "app",
"schematics": {
"@schematics/angular:component": {
"styleext": "scss"
"style": "scss"
}
},
"architect": {
Expand All @@ -38,8 +38,7 @@
"scripts": [
"./node_modules/jquery/dist/jquery.min.js",
"./node_modules/popper.js/dist/umd/popper.min.js",
"./node_modules/bootstrap/dist/js/bootstrap.js",
"./node_modules/chart.js/dist/chart.js"
"./node_modules/bootstrap/dist/js/bootstrap.js"
]
},
"configurations": {
Expand Down
57 changes: 40 additions & 17 deletions gui/src/app/core/models/ProvidedServicesOverview.ts
Original file line number Diff line number Diff line change
@@ -1,34 +1,57 @@
import {ProvidedServiceOverview} from "./ProvidedServiceOverview";

export class ProvidedServicesOverview {
samlServicesCount: Map<string, number>;
oidcServicesCount: Map<string, number>;

productionServices: ProvidedServiceOverview[] = [];
stagingServices: ProvidedServiceOverview[] = [];
testingServices: ProvidedServiceOverview[] = [];

displayableProductionServices = false;
displayableStagingServices = false;
displayableTestingServices = false;

constructor(item: any) {
this.samlServicesCount = new Map<string, number>();
this.oidcServicesCount = new Map<string, number>();
this.productionServices = [];
this.stagingServices = [];
this.testingServices = [];
this.displayableProductionServices = false;
this.displayableStagingServices = false;
this.displayableTestingServices = false;

if (!item) {
return;
}

this.samlServicesCount = item.samlServicesCount;
this.oidcServicesCount = item.oidcServicesCount;
if (item['samlServicesCount']) {
for (const k of Object.keys(item.samlServicesCount)) {
this.samlServicesCount.set(k, item.samlServicesCount[k]);
}
}

if (item['oidcServicesCount']) {
for (const k of Object.keys(item.oidcServicesCount)) {
this.oidcServicesCount.set(k, item.oidcServicesCount[k]);
}
}

this.productionServices = item.services['PRODUCTION'].map(s => new ProvidedServiceOverview(s));
if (item['services'] && item.services['PRODUCTION']) {
this.displayableProductionServices = true;
item.services['PRODUCTION'].map(s => this.productionServices.push(new ProvidedServiceOverview(s)));
}

if (item.services['STAGING']) {
if (item['services'] && item.services['STAGING']) {
this.displayableStagingServices = true;
this.stagingServices = item.services['STAGING'].map(s => new ProvidedServiceOverview(s));
item.services['STAGING'].map(s => this.stagingServices.push(new ProvidedServiceOverview(s)));
}
if (item.services['TESTING']) {

if (item['services'] && item.services['TESTING']) {
this.displayableTestingServices = true;
this.testingServices = item.services['TESTING'].map(s => new ProvidedServiceOverview(s));
item.services['TESTING'].map(s => this.testingServices.push(new ProvidedServiceOverview(s)));
}
}

samlServicesCount: Map<string, bigint>;
oidcServicesCount: Map<string, bigint>;

testingServices: ProvidedServiceOverview[] = [];
productionServices: ProvidedServiceOverview[] = [];
stagingServices: ProvidedServiceOverview[] = [];

displayableStagingServices = false;
displayableTestingServices = false;

}
4 changes: 4 additions & 0 deletions gui/src/app/core/services/config.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,8 @@ export class ConfigService {
getLanguages(): Observable<string[]> {
return this.apiService.get('/config/langs');
}

getEnvironments(): Observable<string[]> {
return this.apiService.get('/config/envs');
}
}

Large diffs are not rendered by default.

Loading

0 comments on commit 136e899

Please sign in to comment.