RED-4509: Image color from entity
This commit is contained in:
parent
7d4079f3eb
commit
5c6688e2d2
@ -4,6 +4,8 @@ import { UserService } from '@services/user.service';
|
||||
import { DossiersService } from '@services/dossiers/dossiers.service';
|
||||
import { DefaultColorsService } from '@services/entity-services/default-colors.service';
|
||||
import { Observable } from 'rxjs';
|
||||
import { DictionariesMapService } from '@services/entity-services/dictionaries-map.service';
|
||||
import { map } from 'rxjs/operators';
|
||||
|
||||
@Component({
|
||||
selector: 'redaction-file-workload',
|
||||
@ -27,16 +29,17 @@ export class FileWorkloadComponent implements OnInit {
|
||||
readonly userService: UserService,
|
||||
private readonly _defaultColorsService: DefaultColorsService,
|
||||
private readonly _dossiersService: DossiersService,
|
||||
private readonly _dictionariesMapService: DictionariesMapService,
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.#dossierTemplateId = this._dossiersService.find(this.file.dossierId).dossierTemplateId;
|
||||
this.suggestionColor$ = this.#getDefaultColor$('suggestion');
|
||||
this.imageColor$ = this.#getDefaultColor$('recommendation');
|
||||
this.updatedColor$ = this.#getDefaultColor$('updated');
|
||||
this.analysisColor$ = this.#getDefaultColor$('analysis');
|
||||
this.hintColor$ = this.#getDefaultColor$('hint');
|
||||
this.redactionColor$ = this.#getDefaultColor$('redaction');
|
||||
this.imageColor$ = this._dictionariesMapService.watch$(this.#dossierTemplateId, 'image').pipe(map(e => e.hexColor));
|
||||
}
|
||||
|
||||
#getDefaultColor$(type: DefaultBasedColorType): Observable<string> {
|
||||
|
||||
@ -35,6 +35,8 @@ import { BehaviorSubject, Observable } from 'rxjs';
|
||||
import { BulkActionsService } from './services/bulk-actions.service';
|
||||
import dayjs from 'dayjs';
|
||||
import { DefaultColorsService } from '@services/entity-services/default-colors.service';
|
||||
import { map } from 'rxjs/operators';
|
||||
import { DictionariesMapService } from '@services/entity-services/dictionaries-map.service';
|
||||
|
||||
@Injectable()
|
||||
export class ConfigService {
|
||||
@ -49,6 +51,7 @@ export class ConfigService {
|
||||
private readonly _appConfigService: AppConfigService,
|
||||
private readonly _bulkActionsService: BulkActionsService,
|
||||
private readonly _defaultColorsService: DefaultColorsService,
|
||||
private readonly _dictionariesMapService: DictionariesMapService,
|
||||
) {
|
||||
this.listingMode$ = this._listingMode$.asObservable();
|
||||
}
|
||||
@ -290,7 +293,10 @@ export class ConfigService {
|
||||
label: workloadTranslations[item],
|
||||
metadata: {
|
||||
shape: AnnotationShapeMap[item],
|
||||
color$: this._defaultColorsService.getColor$(dossierTemplateId, annotationDefaultColorConfig[item]),
|
||||
color$:
|
||||
item === 'image'
|
||||
? this._dictionariesMapService.watch$(dossierTemplateId, item).pipe(map(e => e.hexColor))
|
||||
: this._defaultColorsService.getColor$(dossierTemplateId, annotationDefaultColorConfig[item]),
|
||||
},
|
||||
}),
|
||||
);
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { DefaultColorType } from './default-color-type';
|
||||
import { SuperType, SuperTypes } from '../files';
|
||||
|
||||
export type DefaultBasedColorType = SuperType | 'updated' | 'image' | 'suggestion' | 'analysis';
|
||||
export type DefaultBasedColorType = SuperType | 'updated' | 'suggestion' | 'analysis';
|
||||
|
||||
export const annotationDefaultColorConfig: Record<DefaultBasedColorType, DefaultColorType> = {
|
||||
[SuperTypes.TextHighlight]: 'redactionColor', // not actually used
|
||||
@ -25,7 +25,6 @@ export const annotationDefaultColorConfig: Record<DefaultBasedColorType, Default
|
||||
[SuperTypes.Hint]: 'hintColor',
|
||||
|
||||
updated: 'updatedColor',
|
||||
image: 'recommendationColor',
|
||||
suggestion: 'requestAddColor',
|
||||
analysis: 'analysisColor',
|
||||
} as const;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user