WIP on master
RED-10557 - included file attributes in CSV export + setting
This commit is contained in:
parent
5c8c191151
commit
4b5f3ab969
@ -77,6 +77,14 @@
|
||||
</mat-checkbox>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="options-wrapper">
|
||||
<div class="iqser-input-group mt-0">
|
||||
<mat-checkbox color="primary" formControlName="includeInCsvExport" name="includeInCsvExport">
|
||||
{{ 'add-edit-file-attribute.form.includeInCsvExport' | translate }}
|
||||
</mat-checkbox>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="dialog-actions">
|
||||
<iqser-icon-button
|
||||
|
||||
@ -81,6 +81,7 @@ export class AddEditFileAttributeDialogComponent extends BaseDialogComponent {
|
||||
primaryAttribute: [fileAttribute?.primaryAttribute],
|
||||
filterable: { value: fileAttribute?.filterable, disabled: !this.canSetFilterable },
|
||||
displayedInFileList: { value: fileAttribute?.displayedInFileList, disabled: !this.canSetDisplayed },
|
||||
includeInCsvExport: [fileAttribute?.includeInCsvExport],
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -104,6 +104,10 @@
|
||||
<iqser-round-checkbox *ngIf="attribute.primaryAttribute" [size]="18" active></iqser-round-checkbox>
|
||||
</div>
|
||||
|
||||
<div class="center cell">
|
||||
<iqser-round-checkbox *ngIf="attribute.includeInCsvExport" [size]="18" active></iqser-round-checkbox>
|
||||
</div>
|
||||
|
||||
<div class="cell">
|
||||
<div *allow="roles.fileAttributes.writeConfig; if: currentUser.isAdmin" class="action-buttons">
|
||||
<div [attr.help-mode-key]="'edit_delete_file_attribute'">
|
||||
|
||||
@ -84,6 +84,7 @@ export default class FileAttributesListingScreenComponent extends ListingCompone
|
||||
rightIcon: 'red:status-info',
|
||||
rightIconTooltip: _('file-attributes-listing.table-col-names.primary-info-tooltip'),
|
||||
},
|
||||
{ label: _('file-attributes-listing.table-col-names.include-in-csv-export'), class: 'flex-center' },
|
||||
];
|
||||
readonly roles = Roles;
|
||||
|
||||
|
||||
@ -103,15 +103,42 @@ export class DossierOverviewScreenHeaderComponent {
|
||||
}
|
||||
|
||||
async downloadDossierAsCSV() {
|
||||
console.log('FILE ATTRIBUTES: ', this._fileAttributesService.getFileAttributeConfig(this.dossier().dossierTemplateId));
|
||||
|
||||
const displayedEntities = await firstValueFrom(this.listingService.displayed$);
|
||||
const entities = this.sortingService.defaultSort(displayedEntities);
|
||||
const fileName = this.dossier().dossierName + '.export.csv';
|
||||
const configNames = this._fileAttributesService
|
||||
.getFileAttributeConfig(this.dossier().dossierTemplateId)
|
||||
.fileAttributeConfigs.filter(a => a.includeInCsvExport)
|
||||
.map(c => ({ label: c.label, id: c.id }));
|
||||
for (const entity of entities) {
|
||||
console.log('--------------------------');
|
||||
console.log(
|
||||
...Object.keys(entity.fileAttributes.attributeIdToValue).reduce((result, key) => {
|
||||
const match = configNames.find(item => item.id === key);
|
||||
if (match) {
|
||||
result.push(entity.fileAttributes.attributeIdToValue[key]);
|
||||
}
|
||||
return result;
|
||||
}, []),
|
||||
);
|
||||
}
|
||||
|
||||
const mapper = (file?: File) => ({
|
||||
...file,
|
||||
hasAnnotations: file.hasRedactions,
|
||||
assignee: this._userService.getName(file.assignee) || '-',
|
||||
primaryAttribute: this._primaryFileAttributeService.getPrimaryFileAttributeValue(file, this.dossier().dossierTemplateId),
|
||||
...Object.keys(file.fileAttributes.attributeIdToValue).reduce((result, key) => {
|
||||
const match = configNames.find(item => item.id === key);
|
||||
if (match) {
|
||||
result.push(match.label);
|
||||
}
|
||||
return result;
|
||||
}, []),
|
||||
});
|
||||
|
||||
const documineOnlyFields = ['hasAnnotations'];
|
||||
const redactionOnlyFields = ['hasHints', 'hasImages', 'hasUpdates', 'hasRedactions'];
|
||||
const fileFields = [
|
||||
@ -128,6 +155,7 @@ export class DossierOverviewScreenHeaderComponent {
|
||||
'lastProcessed',
|
||||
...(this.isDocumine ? documineOnlyFields : redactionOnlyFields),
|
||||
'excluded',
|
||||
...configNames.map(c => c.label),
|
||||
];
|
||||
saveAsCSV(fileName, entities, fileFields, mapper);
|
||||
}
|
||||
|
||||
@ -22,6 +22,8 @@ export function saveAsCSV(fileName: string, objects: readonly any[], fields: str
|
||||
const headerLine = fields.map(f => '"' + humanize(camelCaseToSnakeCase(f)) + '"').join(',') + '\n';
|
||||
const csvContent = toCSVContent(objects.map(mapper), fields);
|
||||
|
||||
console.log('toCSVContent: ', objects.map(mapper));
|
||||
|
||||
const blob = new Blob([headerLine + csvContent], {
|
||||
type: 'text/csv;charset=utf-8',
|
||||
});
|
||||
|
||||
@ -173,6 +173,7 @@
|
||||
"displayedInFileList": "Wird in der Dokumentenliste angezeigt",
|
||||
"filterable": "Filterbar",
|
||||
"filterable-disabled": "Die maximale Anzahl filterbarer Attribute ({maxNumber}) wurde erreicht.",
|
||||
"includeInCsvExport": "",
|
||||
"name": "Name des Attributs",
|
||||
"name-placeholder": "Namen eingeben",
|
||||
"primary": "Zum Primärattribut machen",
|
||||
@ -1521,6 +1522,7 @@
|
||||
"csv-column": "CSV-Spalte",
|
||||
"displayed-in-file-list": "In Dokumentenliste anzeigen",
|
||||
"filterable": "Filterbar",
|
||||
"include-in-csv-export": "",
|
||||
"name": "Name",
|
||||
"primary": "Primärattribut",
|
||||
"primary-info-tooltip": "Der Wert des Primärattributs steht in der Dokumentenliste unter dem Dateinamen.",
|
||||
|
||||
@ -173,6 +173,7 @@
|
||||
"displayedInFileList": "Displayed in file list",
|
||||
"filterable": "Filterable",
|
||||
"filterable-disabled": "The maximum number of filterable attributes ({maxNumber}) has been reached.",
|
||||
"includeInCsvExport": "Include in CSV export",
|
||||
"name": "Attribute name",
|
||||
"name-placeholder": "Enter name",
|
||||
"primary": "Primary attribute",
|
||||
@ -1521,6 +1522,7 @@
|
||||
"csv-column": "CSV column",
|
||||
"displayed-in-file-list": "Displayed in file list",
|
||||
"filterable": "Filterable",
|
||||
"include-in-csv-export": "Include in CSV export",
|
||||
"name": "Name",
|
||||
"primary": "Primary",
|
||||
"primary-info-tooltip": "The value of the attribute set as primary is diplayed below the file name in the document list.",
|
||||
|
||||
@ -173,6 +173,7 @@
|
||||
"displayedInFileList": "Wird in der Dokumentenliste angezeigt",
|
||||
"filterable": "Filterbar",
|
||||
"filterable-disabled": "Die maximale Anzahl filterbarer Attribute ({maxNumber}) wurde erreicht.",
|
||||
"includeInCsvExport": "",
|
||||
"name": "Name des Attributs",
|
||||
"name-placeholder": "Namen eingeben",
|
||||
"primary": "Zum Primärattribut machen",
|
||||
@ -1521,6 +1522,7 @@
|
||||
"csv-column": "CSV-Spalte",
|
||||
"displayed-in-file-list": "In Dokumentenliste anzeigen",
|
||||
"filterable": "Filterbar",
|
||||
"include-in-csv-export": "",
|
||||
"name": "Name",
|
||||
"primary": "Primärattribut",
|
||||
"primary-info-tooltip": "Der Wert des Primärattributs steht in der Dokumentenliste unter dem Dateinamen.",
|
||||
|
||||
@ -173,6 +173,7 @@
|
||||
"displayedInFileList": "Displayed in file list",
|
||||
"filterable": "Filterable",
|
||||
"filterable-disabled": "The maximum number of filterable attributes ({maxNumber}) has been reached.",
|
||||
"includeInCsvExport": "Include in CSV export",
|
||||
"name": "Attribute name",
|
||||
"name-placeholder": "Enter name",
|
||||
"primary": "Set as primary",
|
||||
@ -1521,6 +1522,7 @@
|
||||
"csv-column": "CSV column",
|
||||
"displayed-in-file-list": "Displayed in file list",
|
||||
"filterable": "Filterable",
|
||||
"include-in-csv-export": "Include in CSV export",
|
||||
"name": "Name",
|
||||
"primary": "Primary",
|
||||
"primary-info-tooltip": "The value of the attribute set as primary is diplayed below the file name in the document list.",
|
||||
|
||||
@ -11,6 +11,7 @@ export class FileAttributeConfig implements IFileAttributeConfig, IListable {
|
||||
readonly displayedInFileList?: boolean;
|
||||
readonly filterable?: boolean;
|
||||
readonly type?: FileAttributeConfigType;
|
||||
readonly includeInCsvExport?: boolean;
|
||||
|
||||
constructor(fileAttributeConfig: IFileAttributeConfig) {
|
||||
this.id = fileAttributeConfig.id;
|
||||
@ -22,6 +23,7 @@ export class FileAttributeConfig implements IFileAttributeConfig, IListable {
|
||||
this.displayedInFileList = fileAttributeConfig.displayedInFileList;
|
||||
this.filterable = !!fileAttributeConfig.filterable;
|
||||
this.type = fileAttributeConfig.type;
|
||||
this.includeInCsvExport = fileAttributeConfig.includeInCsvExport;
|
||||
}
|
||||
|
||||
get searchKey(): string {
|
||||
|
||||
@ -9,6 +9,7 @@ export interface IFileAttributeConfig {
|
||||
readonly placeholder?: string;
|
||||
readonly primaryAttribute?: boolean;
|
||||
readonly type?: FileAttributeConfigType;
|
||||
readonly includeInCsvExport?: boolean;
|
||||
}
|
||||
|
||||
export const FileAttributeConfigTypes = {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user