Dynamic Table Columns Cleanup for view-cache

This commit is contained in:
Timo Bejan 2021-08-23 13:20:44 +03:00
parent 79da25c747
commit 3b1c194fba
3 changed files with 11 additions and 8 deletions

View File

@ -2,7 +2,7 @@
@import '../../../../../assets/styles/red-mixins';
:root {
--dynamic-columns: '';
--dynamic-columns: '0';
}
.file-upload-input {

View File

@ -62,7 +62,7 @@ export class DossierOverviewScreenComponent extends ListingComponent<FileStatusW
hide: !this.currentUser.isManager
}
];
tableColumnConfigs: readonly TableColumnConfig<FileStatusWrapper>[] = [
private readonly _defaultTableConfigs: readonly TableColumnConfig<FileStatusWrapper>[] = [
{
label: _('dossier-overview.table-col-names.name'),
sortByKey: 'filename'
@ -89,6 +89,8 @@ export class DossierOverviewScreenComponent extends ListingComponent<FileStatusW
sortByKey: 'statusSort'
}
];
tableColumnConfigs: readonly TableColumnConfig<FileStatusWrapper>[] = [];
collapsedDetails = false;
dossierAttributes: DossierAttributeWithValue[] = [];
fileAttributeConfigs: FileAttributeConfig[];
@ -159,7 +161,7 @@ export class DossierOverviewScreenComponent extends ListingComponent<FileStatusW
this.dossierAttributes = await this._dossierAttributesService.getValues(this.currentDossier);
this.searchService.setSearchKey('filename');
this._addDynamicColumns();
this._configureTableColumns();
} catch (e) {
} finally {
this._loadingService.stop();
@ -261,14 +263,14 @@ export class DossierOverviewScreenComponent extends ListingComponent<FileStatusW
recentlyModifiedChecker = (file: FileStatusWrapper) =>
moment(file.lastUpdated).add(this._appConfigService.getConfig(AppConfigKey.RECENT_PERIOD_IN_HOURS), 'hours').isAfter(moment());
private _addDynamicColumns() {
private _configureTableColumns() {
const dynamicColumns: TableColumnConfig<FileStatusWrapper>[] = [];
for (const config of this.displayedInFileListAttributes) {
if (config.displayedInFileList) {
dynamicColumns.push({ label: config.label, notTranslatable: true });
}
}
this.tableColumnConfigs = [this.tableColumnConfigs[0], ...dynamicColumns, ...this.tableColumnConfigs.slice(1)];
this.tableColumnConfigs = [this._defaultTableConfigs[0], ...dynamicColumns, ...this._defaultTableConfigs.slice(1)];
this.dynamicColumnsCount = dynamicColumns.length;
(this._elementRef.nativeElement as HTMLElement).style.setProperty('--dynamic-columns', `${this.dynamicColumnsCount}`);
}
@ -318,8 +320,8 @@ export class DossierOverviewScreenComponent extends ListingComponent<FileStatusW
}
let filterValue = file.fileAttributes?.attributeIdToValue[config.id];
if (!filterValue) {
filterValue = 'Empty';
file.fileAttributes.attributeIdToValue[config.id] = filterValue;
filterValue = this._translateService.instant('filters.empty');
file.fileAttributes.attributeIdToValue[config.id] = '-';
}
filters.add(filterValue);
}

View File

@ -1044,7 +1044,8 @@
"filter-by": "Filter:",
"needs-work": "Workload",
"people": "Dossier Member(s)",
"status": "Status"
"status": "Status",
"empty": "Empty"
},
"general-config-screen": {
"actions": {