fixed issue with undefined ruleset, removed default ruleset

This commit is contained in:
Timo 2021-05-07 11:13:26 +03:00
parent 990bc2dfec
commit 5946d9cad0
3 changed files with 23 additions and 10 deletions

View File

@ -1,7 +1,6 @@
import { Component, Input, OnInit } from '@angular/core';
import { FilterModel } from '../../../shared/components/filter/model/filter.model';
import { AppStateService } from '../../../../state/app-state.service';
import { DEFAULT_RUL_SET_UUID } from '../../../../utils/rule-set-default';
@Component({
selector: 'redaction-type-filter',
@ -29,9 +28,6 @@ export class TypeFilterComponent implements OnInit {
constructor(private readonly _appStateService: AppStateService) {}
ngOnInit(): void {
this.dictionaryColor = this._appStateService.getDictionaryColor(
this.filter.key,
this._appStateService.activeProject?.ruleSetId || DEFAULT_RUL_SET_UUID
);
this.dictionaryColor = this._appStateService.getDictionaryColor(this.filter.key);
}
}

View File

@ -1,7 +1,6 @@
import { EventEmitter, Injectable } from '@angular/core';
import {
DictionaryControllerService,
FileAttributeConfig,
FileAttributesConfig,
FileAttributesControllerService,
FileStatus,
@ -135,6 +134,12 @@ export class AppStateService {
if (!ruleSetId && this.activeProject) {
ruleSetId = this.activeProject.ruleSetId;
}
if (!ruleSetId) {
ruleSetId = this.ruleSets.length > 0 ? this.ruleSets[0].ruleSetId : undefined;
}
if (!ruleSetId) {
return undefined;
}
const color = this._dictionaryData[ruleSetId][type]?.hexColor;
return color ? color : this._dictionaryData[ruleSetId]['default'].hexColor;
}
@ -143,8 +148,13 @@ export class AppStateService {
if (!ruleSetId && this.activeProject) {
ruleSetId = this.activeProject.ruleSetId;
}
return this._dictionaryData[ruleSetId][type].label;
if (!ruleSetId) {
ruleSetId = this.ruleSets.length > 0 ? this.ruleSets[0].ruleSetId : undefined;
}
if (!ruleSetId) {
return undefined;
}
return this._dictionaryData[ruleSetId][type]?.label;
}
get aggregatedFiles(): FileStatusWrapper[] {
@ -190,6 +200,13 @@ export class AppStateService {
ruleSetId = this.activeProject.ruleSetId;
}
if (!ruleSetId) {
ruleSetId = this.ruleSets.length > 0 ? this.ruleSets[0].ruleSetId : undefined;
}
if (!ruleSetId) {
return undefined;
}
const data = this._dictionaryData[ruleSetId][key];
return data ? data : this._dictionaryData[ruleSetId]['default'];
}

View File

@ -1,6 +1,6 @@
{
"OAUTH_URL": "https://redkc-staging.iqser.cloud/auth/realms/redaction",
"API_URL": "https://redapi-staging.iqser.cloud",
"OAUTH_URL": "https://redacto-seeds-auth.apps.prod.euc1.devops.syngentadigitalapps.com/auth/realms/redaction",
"API_URL": "https://redacto-seeds-api.apps.prod.euc1.devops.syngentadigitalapps.com",
"OAUTH_CLIENT_ID": "redaction",
"BACKEND_APP_VERSION": "4.4.40",
"FRONTEND_APP_VERSION": "1.1",