Merge branch 'VM/RED-7903' into 'master'
RED-7903 - Show dummy redaction/hints while file is still processing Closes RED-7903 See merge request redactmanager/red-ui!260
This commit is contained in:
commit
96593d708f
@ -18,33 +18,36 @@ function wrongSuperTypeHandler(): never | undefined {
|
|||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function resolveRedactionType(entry: IEntityLogEntry, hint = false) {
|
||||||
|
const redaction = hint ? SuperTypes.Hint : SuperTypes.Redaction;
|
||||||
|
const manualRedaction = hint ? SuperTypes.ManualHint : SuperTypes.ManualRedaction;
|
||||||
|
|
||||||
|
const manualChanges = entry.manualChanges;
|
||||||
|
const hasEngines = entry.engines.length;
|
||||||
|
const lastRelevantManualChange = manualChanges?.at(-1);
|
||||||
|
if (!!lastRelevantManualChange && !hasEngines) {
|
||||||
|
const pending = lastRelevantManualChange && !lastRelevantManualChange.processed;
|
||||||
|
if (pending && entry.dictionaryEntry) {
|
||||||
|
return redaction;
|
||||||
|
}
|
||||||
|
return manualRedaction;
|
||||||
|
}
|
||||||
|
return redaction;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* https://knecon.atlassian.net/wiki/spaces/RED/pages/102072322/EntityLog+-+Enum+combinations
|
* https://knecon.atlassian.net/wiki/spaces/RED/pages/102072322/EntityLog+-+Enum+combinations
|
||||||
*/
|
*/
|
||||||
export const SuperTypeMapper: Record<EntityType, Record<EntryState, (entry: IEntityLogEntry) => SuperType | undefined>> = {
|
export const SuperTypeMapper: Record<EntityType, Record<EntryState, (entry: IEntityLogEntry) => SuperType | undefined>> = {
|
||||||
[EntityTypes.ENTITY]: {
|
[EntityTypes.ENTITY]: {
|
||||||
[EntryStates.APPLIED]: entry => {
|
[EntryStates.APPLIED]: entry => resolveRedactionType(entry),
|
||||||
const hasManualChanges = entry.manualChanges.length;
|
|
||||||
const hasEngines = entry.engines.length;
|
|
||||||
if (hasManualChanges && !hasEngines) {
|
|
||||||
return SuperTypes.ManualRedaction;
|
|
||||||
}
|
|
||||||
return SuperTypes.Redaction;
|
|
||||||
},
|
|
||||||
[EntryStates.SKIPPED]: () => SuperTypes.Skipped,
|
[EntryStates.SKIPPED]: () => SuperTypes.Skipped,
|
||||||
[EntryStates.IGNORED]: () => SuperTypes.Skipped,
|
[EntryStates.IGNORED]: () => SuperTypes.Skipped,
|
||||||
[EntryStates.REMOVED]: wrongSuperTypeHandler,
|
[EntryStates.REMOVED]: wrongSuperTypeHandler,
|
||||||
},
|
},
|
||||||
[EntityTypes.HINT]: {
|
[EntityTypes.HINT]: {
|
||||||
[EntryStates.APPLIED]: wrongSuperTypeHandler,
|
[EntryStates.APPLIED]: wrongSuperTypeHandler,
|
||||||
[EntryStates.SKIPPED]: entry => {
|
[EntryStates.SKIPPED]: entry => resolveRedactionType(entry, true),
|
||||||
const hasManualChanges = entry.manualChanges.length;
|
|
||||||
const hasEngines = entry.engines.length;
|
|
||||||
if (hasManualChanges && !hasEngines) {
|
|
||||||
return SuperTypes.ManualHint;
|
|
||||||
}
|
|
||||||
return SuperTypes.Hint;
|
|
||||||
},
|
|
||||||
[EntryStates.IGNORED]: () => SuperTypes.IgnoredHint,
|
[EntryStates.IGNORED]: () => SuperTypes.IgnoredHint,
|
||||||
[EntryStates.REMOVED]: wrongSuperTypeHandler,
|
[EntryStates.REMOVED]: wrongSuperTypeHandler,
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user