Skip to content

Commit

Permalink
chore: updated the dashboard chart colors with data from app-config
Browse files Browse the repository at this point in the history
  • Loading branch information
AnurosePrakash committed Jun 30, 2023
1 parent 8e184cd commit d6cc1e7
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 15 deletions.
3 changes: 3 additions & 0 deletions src/app/core/config/app-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ export interface AppConfig {
brandFaviconSrc: string;
brandLogoSrc: string;
brandLogoStyle: string;
chartColorNeutral: string;
chartColorSuccess: string;
chartColorFailure: string;

// EDC Backend Endpoints
connectorEndpoint: string;
Expand Down
8 changes: 7 additions & 1 deletion src/app/core/config/profiles/edc-ui-theme-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,11 @@ import {AppConfig} from '../app-config';
*/
export type EdcUiThemeConfig = Pick<
AppConfig,
'theme' | 'brandLogoStyle' | 'brandLogoSrc' | 'brandFaviconSrc'
| 'theme'
| 'brandLogoStyle'
| 'brandLogoSrc'
| 'brandFaviconSrc'
| 'chartColorNeutral'
| 'chartColorSuccess'
| 'chartColorFailure'
>;
6 changes: 6 additions & 0 deletions src/app/core/config/profiles/edc-ui-theme-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,17 @@ export const SOVITY_THEME: EdcUiThemeConfig = {
brandFaviconSrc: '/assets/images/sovity_favicon-192x192.png',
brandLogoSrc: '/assets/images/sovity_logo.svg',
brandLogoStyle: 'width: 70%;',
chartColorNeutral: '#7eb0d5',
chartColorSuccess: '#b2e061',
chartColorFailure: '#fd7f6f',
};

export const MDS_THEME: EdcUiThemeConfig = {
theme: 'theme-mds',
brandFaviconSrc: '/assets/images/mds_favicon.ico',
brandLogoSrc: '/assets/images/mds_logo.svg',
brandLogoStyle: 'height: 57px; margin-top: 5px; margin-left: 5px;',
chartColorNeutral: '#FFFF00',
chartColorSuccess: '#FFA500',
chartColorFailure: '#9ACD32',
};
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {Injectable} from '@angular/core';
import {Inject, Injectable} from '@angular/core';
import {Observable, combineLatest, merge, of, scan} from 'rxjs';
import {map} from 'rxjs/operators';
import {ActiveFeatureSet} from '../../../../core/config/active-feature-set';
import {APP_CONFIG, AppConfig} from '../../../../core/config/app-config';
import {CatalogApiUrlService} from '../../../../core/services/api/catalog-api-url.service';
import {ContractOfferService} from '../../../../core/services/api/contract-offer.service';
import {
Expand All @@ -12,18 +12,21 @@ import {
TransferProcessDto,
TransferProcessService,
} from '../../../../core/services/api/legacy-managent-api-client';
import {ConnectorInfoPropertyGridGroupBuilder} from '../../../../core/services/connector-info-property-grid-group-builder';
import {
ConnectorInfoPropertyGridGroupBuilder
} from '../../../../core/services/connector-info-property-grid-group-builder';
import {LastCommitInfoService} from '../../../../core/services/last-commit-info.service';
import {Fetched} from '../../../../core/services/models/fetched';
import {TransferProcessStates} from '../../../../core/services/models/transfer-process-states';
import {TransferProcessUtils} from '../../../../core/services/transfer-process-utils';
import {DonutChartData} from '../dashboard-donut-chart/donut-chart-data';
import {DashboardPageData, defaultDashboardData} from './dashboard-page-data';


@Injectable({providedIn: 'root'})
export class DashboardPageDataService {
constructor(
private activeFeatureSet: ActiveFeatureSet,
@Inject(APP_CONFIG) private config: AppConfig,
private catalogBrowserService: ContractOfferService,
private contractDefinitionService: ContractDefinitionService,
private contractAgreementService: ContractAgreementService,
Expand All @@ -34,7 +37,8 @@ export class DashboardPageDataService {
private transferProcessUtils: TransferProcessUtils,
private lastCommitInfoService: LastCommitInfoService,
private connectorInfoPropertyGridGroupBuilder: ConnectorInfoPropertyGridGroupBuilder,
) {}
) {
}

/**
* Fetch {@link DashboardPageData}.
Expand Down Expand Up @@ -153,15 +157,10 @@ export class DashboardPageDataService {
);

const colorsByState = new Map<string, string>();
if (this.activeFeatureSet.hasMdsFields()) {
colorsByState.set('IN_PROGRESS', '#FFFF00');
colorsByState.set('ERROR', '#FFA500');
colorsByState.set('COMPLETED', '#9ACD32');
} else {
colorsByState.set('IN_PROGRESS', '#7eb0d5');
colorsByState.set('ERROR', '#fd7f6f');
colorsByState.set('COMPLETED', '#b2e061');
}
colorsByState.set('IN_PROGRESS', this.config.chartColorNeutral);
colorsByState.set('ERROR', this.config.chartColorFailure);
colorsByState.set('COMPLETED', this.config.chartColorSuccess);

const defaultColor = '#bd7ebe';

const amountsByState = states.map(
Expand Down

0 comments on commit d6cc1e7

Please sign in to comment.