Commit 964c14d7 authored by Florent POITTEVIN's avatar Florent POITTEVIN
Browse files

feat: 1164 add tooltip that explain status on deposit data file status column

parent ae95288d
......@@ -226,6 +226,7 @@ export class DepositFileRoutable extends SharedAbstractDetailEditRoutable<Deposi
isSortable: true,
isFilterable: true,
translate: true,
tooltip: (value) => DataFileStatusEnumHelper.getExplanation(value as DataFileStatusEnum),
filterEnum: DataFileStatusEnumHelper.getListKeyValue(),
},
{
......
......@@ -416,19 +416,21 @@
<ng-template [ngIf]="col.translate"
[ngIfElse]="noTranslate"
>
<span [matTooltip]="getCellData(rowData, col) | translate"
[matTooltipShowDelay]="TIME_BEFORE_DISPLAY_TOOLTIP"
>
{{getCellData(rowData, col) | translate}}
</span>
<span *ngIf="getCellData(rowData, col) as value"
[matTooltip]="getTooltip(col, value) | translate"
[matTooltipShowDelay]="TIME_BEFORE_DISPLAY_TOOLTIP"
>
{{value | translate}}
</span>
</ng-template>
<ng-template #noTranslate>
<span [matTooltip]="getCellData(rowData, col)"
[matTooltipShowDelay]="TIME_BEFORE_DISPLAY_TOOLTIP"
>
{{getCellData(rowData, col)}}
</span>
<span *ngIf="getCellData(rowData, col) as value"
[matTooltip]="getTooltip(col, value)"
[matTooltipShowDelay]="TIME_BEFORE_DISPLAY_TOOLTIP"
>
{{value}}
</span>
</ng-template>
</ng-template>
......
......@@ -662,6 +662,12 @@ export class SharedDataTablePresentational<TResource extends BaseResource> exten
return SharedDataTablePresentational.isEmptyData(value);
}
getTooltip(col: DataTableColumns, value: string): string {
if (isNullOrUndefined(col.tooltip)) {
return value;
}
return col.tooltip(value);
}
}
class Context {
......
......@@ -11,8 +11,10 @@ import {
SharedInfoExcludedIgnoredFileDialogData,
} from "@shared/components/dialogs/shared-info-excluded-ignored-file/shared-info-excluded-ignored-file.dialog";
import {SharedAbstractPresentational} from "@shared/components/presentationals/shared-abstract/shared-abstract.presentational";
import {DataFileStatusEnum} from "@shared/enums/business/data-file-status.enum";
import {TRANSLATE} from "solidify-frontend";
import {
DataFileStatusEnum,
DataFileStatusEnumHelper,
} from "@shared/enums/business/data-file-status.enum";
@Component({
selector: "dlcm-shared-datafile-quick-status",
......@@ -36,6 +38,7 @@ export class SharedDatafileQuickStatusPresentational extends SharedAbstractPrese
set value(value: DataFileStatusEnum) {
this._value = value;
this.classes = this.getColor();
this.toolipToTranslate = DataFileStatusEnumHelper.getExplanation(value);
}
get value(): DataFileStatusEnum {
......@@ -66,22 +69,16 @@ export class SharedDatafileQuickStatusPresentational extends SharedAbstractPrese
getColor(): string {
switch (this.value) {
case DataFileStatusEnum.READY:
this.toolipToTranslate = TRANSLATE("dataFileQuickStatus.ready");
return this.CLASS_READY;
case DataFileStatusEnum.IN_ERROR:
this.toolipToTranslate = TRANSLATE("dataFileQuickStatus.inError");
return this.CLASS_ERROR;
case DataFileStatusEnum.EXCLUDED_FILE:
this.toolipToTranslate = TRANSLATE("dataFileQuickStatus.excludedFile");
return this.CLASS_ERROR + " " + this.CLASS_CAN_SEE_DETAIL;
case DataFileStatusEnum.IGNORED_FILE:
this.toolipToTranslate = TRANSLATE("dataFileQuickStatus.ignoredFile");
return this.CLASS_WARNING + " " + this.CLASS_CAN_SEE_DETAIL;
case DataFileStatusEnum.CLEANED:
this.toolipToTranslate = TRANSLATE("dataFileQuickStatus.cleaned");
return this.CLASS_CLEANED;
default:
this.toolipToTranslate = TRANSLATE("dataFileQuickStatus.pending");
return this.CLASS_PENDING;
}
}
......
......@@ -73,7 +73,24 @@ export class DataFileStatusEnumHelper {
{
key: DataFileStatusEnum.CLEANED,
value: TRANSLATE("CLEANED"),
}
},
];
}
static getExplanation(status: DataFileStatusEnum): string {
switch (status) {
case DataFileStatusEnum.READY:
return TRANSLATE("dataFileQuickStatus.ready");
case DataFileStatusEnum.IN_ERROR:
return TRANSLATE("dataFileQuickStatus.inError");
case DataFileStatusEnum.EXCLUDED_FILE:
return TRANSLATE("dataFileQuickStatus.excludedFile");
case DataFileStatusEnum.IGNORED_FILE:
return TRANSLATE("dataFileQuickStatus.ignoredFile");
case DataFileStatusEnum.CLEANED:
return TRANSLATE("dataFileQuickStatus.cleaned");
default:
return TRANSLATE("dataFileQuickStatus.pending");
}
}
}
......@@ -12,6 +12,7 @@ import {
export interface DataTableColumns<TResource extends BaseResourceType = any> {
field: keyof TResource & string;
header: string;
tooltip?: (value: string) => string | undefined;
type?: FieldTypeEnum;
order: OrderEnum;
filterEnum?: KeyValue[];
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment