listable
This commit is contained in:
parent
5c500e321a
commit
02b71ed2e2
@ -1,11 +1,16 @@
|
||||
import { DossierTemplateModel } from '@redaction/red-ui-http';
|
||||
import { Listable } from '@iqser/common-ui';
|
||||
|
||||
export class DossierTemplateModelWrapper {
|
||||
export class DossierTemplateModelWrapper implements Listable {
|
||||
dictionariesCount = 0;
|
||||
totalDictionaryEntries = 0;
|
||||
|
||||
constructor(public dossierTemplateModel: DossierTemplateModel) {}
|
||||
|
||||
get id() {
|
||||
return this.dossierTemplateModel.dossierTemplateId;
|
||||
}
|
||||
|
||||
get createdBy() {
|
||||
return this.dossierTemplateModel.createdBy;
|
||||
}
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
import { Listable } from '@iqser/common-ui';
|
||||
import { FileAttributesConfig, FileStatus } from '@redaction/red-ui-http';
|
||||
import { StatusSorter } from '@utils/sorters/status-sorter';
|
||||
|
||||
@ -9,7 +10,7 @@ const processingStatuses = [
|
||||
FileStatus.StatusEnum.PROCESSING
|
||||
] as const;
|
||||
|
||||
export class FileStatusWrapper implements FileStatus {
|
||||
export class FileStatusWrapper implements FileStatus, Listable {
|
||||
readonly added = this.fileStatus.added;
|
||||
readonly allManualRedactionsApplied = this.fileStatus.allManualRedactionsApplied;
|
||||
readonly analysisDuration = this.fileStatus.analysisDuration;
|
||||
@ -82,6 +83,10 @@ export class FileStatusWrapper implements FileStatus {
|
||||
readonly isWorkable = !this.isProcessing && this.canBeOpened;
|
||||
readonly canBeOCRed = !this.excluded && !this.lastOCRTime && ['UNASSIGNED', 'UNDER_REVIEW', 'UNDER_APPROVAL'].includes(this.status);
|
||||
|
||||
get id() {
|
||||
return this.fileId;
|
||||
}
|
||||
|
||||
private get _pages() {
|
||||
if (this.fileStatus.status === 'ERROR') {
|
||||
return -1;
|
||||
|
||||
@ -3,7 +3,7 @@ import { Dossier } from '@redaction/red-ui-http';
|
||||
import { LoadingService } from '@services/loading.service';
|
||||
import { AppConfigKey, AppConfigService } from '@app-config/app-config.service';
|
||||
import * as moment from 'moment';
|
||||
import { CircleButtonTypes, DefaultListingServices, ListingComponent, TableColumnConfig } from '@iqser/common-ui';
|
||||
import { CircleButtonTypes, DefaultListingServices, Listable, ListingComponent, TableColumnConfig } from '@iqser/common-ui';
|
||||
import { DossiersService } from '../../../dossier/services/dossiers.service';
|
||||
import { AdminDialogService } from '../../services/admin-dialog.service';
|
||||
import { ConfirmationDialogInput, TitleColors } from '@shared/dialogs/confirmation-dialog/confirmation-dialog.component';
|
||||
@ -12,7 +12,7 @@ import { Observable } from 'rxjs';
|
||||
import { distinctUntilChanged, map } from 'rxjs/operators';
|
||||
import { getLeftDateTime } from '@utils/functions';
|
||||
|
||||
interface DossierListItem extends Dossier {
|
||||
interface DossierListItem extends Dossier, Listable {
|
||||
readonly canRestore: boolean;
|
||||
readonly restoreDate: string;
|
||||
}
|
||||
@ -60,7 +60,7 @@ export class TrashScreenComponent extends ListingComponent<DossierListItem> impl
|
||||
}
|
||||
|
||||
private get _canRestoreSelected$(): Observable<boolean> {
|
||||
return this.entitiesService.selected$.pipe(
|
||||
return this.entitiesService.selectedEntities$.pipe(
|
||||
map(entities => entities.length && !entities.find(dossier => !dossier.canRestore)),
|
||||
distinctUntilChanged()
|
||||
);
|
||||
@ -116,6 +116,7 @@ export class TrashScreenComponent extends ListingComponent<DossierListItem> impl
|
||||
private _toListItem(dossier: Dossier): DossierListItem {
|
||||
const restoreDate = this._getRestoreDate(dossier.softDeletedTime);
|
||||
return {
|
||||
id: dossier.dossierId,
|
||||
...dossier,
|
||||
restoreDate,
|
||||
canRestore: this._canRestoreDossier(restoreDate)
|
||||
|
||||
@ -50,7 +50,7 @@ export class UserListingScreenComponent extends ListingComponent<UserWrapper> im
|
||||
}
|
||||
|
||||
private get _canDeleteSelected$(): Observable<boolean> {
|
||||
const entities$ = this.entitiesService.selected$;
|
||||
const entities$ = this.entitiesService.selectedEntities$;
|
||||
return entities$.pipe(map(all => !all.find(u => u.id === this.currentUser.id)));
|
||||
}
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { Component, EventEmitter, Injector, Input, OnInit, Output } from '@angular/core';
|
||||
import { EditDossierSectionInterface } from '../edit-dossier-section.interface';
|
||||
import { DossierWrapper } from '@state/model/dossier.wrapper';
|
||||
import { CircleButtonTypes, DefaultListingServices, ListingComponent, TableColumnConfig } from '@iqser/common-ui';
|
||||
import { CircleButtonTypes, DefaultListingServices, Listable, ListingComponent, TableColumnConfig } from '@iqser/common-ui';
|
||||
import { FileManagementControllerService, FileStatus, StatusControllerService } from '@redaction/red-ui-http';
|
||||
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||
import { LoadingService } from '@services/loading.service';
|
||||
@ -14,7 +14,7 @@ import { ConfirmationDialogInput, TitleColors } from '@shared/dialogs/confirmati
|
||||
import { DossiersDialogService } from '../../../services/dossiers-dialog.service';
|
||||
import { AppStateService } from '@state/app-state.service';
|
||||
|
||||
interface FileListItem extends FileStatus {
|
||||
interface FileListItem extends FileStatus, Listable {
|
||||
readonly canRestore: boolean;
|
||||
readonly restoreDate: string;
|
||||
}
|
||||
@ -56,7 +56,7 @@ export class EditDossierDeletedDocumentsComponent extends ListingComponent<FileL
|
||||
}
|
||||
|
||||
private get _canRestoreSelected$(): Observable<boolean> {
|
||||
return this.entitiesService.selected$.pipe(
|
||||
return this.entitiesService.selectedEntities$.pipe(
|
||||
map(entities => entities.length && !entities.find(file => !file.canRestore)),
|
||||
distinctUntilChanged()
|
||||
);
|
||||
@ -123,6 +123,7 @@ export class EditDossierDeletedDocumentsComponent extends ListingComponent<FileL
|
||||
private _toListItem(file: FileStatus): FileListItem {
|
||||
const restoreDate = this._getRestoreDate(file.softDeleted);
|
||||
return {
|
||||
id: file.fileId,
|
||||
...file,
|
||||
restoreDate,
|
||||
canRestore: this._canRestoreFile(restoreDate)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { Component, Injector, OnDestroy } from '@angular/core';
|
||||
import { DefaultListingServices, keyChecker, ListingComponent, TableColumnConfig } from '@iqser/common-ui';
|
||||
import { DefaultListingServices, keyChecker, Listable, ListingComponent, TableColumnConfig } from '@iqser/common-ui';
|
||||
import { MatchedDocument, SearchControllerService, SearchResult } from '@redaction/red-ui-http';
|
||||
import { BehaviorSubject, Observable } from 'rxjs';
|
||||
import { debounceTime, map, skip, switchMap, tap } from 'rxjs/operators';
|
||||
@ -13,7 +13,7 @@ import { SearchPositions } from '@shared/components/page-header/models/search-po
|
||||
import { DossierWrapper } from '@state/model/dossier.wrapper';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
|
||||
interface ListItem {
|
||||
interface ListItem extends Listable {
|
||||
readonly dossierId: string;
|
||||
readonly filename: string;
|
||||
readonly unmatched: string[] | null;
|
||||
@ -145,6 +145,7 @@ export class SearchScreenComponent extends ListingComponent<ListItem> implements
|
||||
if (!fileWrapper) return undefined;
|
||||
|
||||
return {
|
||||
id: fileId,
|
||||
dossierId,
|
||||
unmatched: unmatchedTerms || null,
|
||||
highlights,
|
||||
|
||||
@ -1,10 +1,15 @@
|
||||
import { DownloadDetails, DownloadStatus } from '@redaction/red-ui-http';
|
||||
import { Listable } from '@iqser/common-ui';
|
||||
|
||||
export class DownloadStatusWrapper {
|
||||
export class DownloadStatusWrapper implements Listable {
|
||||
inProgress: boolean;
|
||||
|
||||
constructor(private _downloadStatus: DownloadStatus) {}
|
||||
|
||||
get id() {
|
||||
return this._downloadStatus.storageId;
|
||||
}
|
||||
|
||||
get size() {
|
||||
const i = this._downloadStatus.fileSize === 0 ? 0 : Math.floor(Math.log(this._downloadStatus.fileSize) / Math.log(1024));
|
||||
return (this._downloadStatus.fileSize / Math.pow(1024, i)).toFixed(2) + ' ' + ['B', 'kB', 'MB', 'GB', 'TB'][i];
|
||||
|
||||
@ -6,6 +6,7 @@ import { User, UserControllerService } from '@redaction/red-ui-http';
|
||||
import { wipeCaches } from '@redaction/red-cache';
|
||||
import { BASE_HREF } from '../tokens';
|
||||
import { Subject } from 'rxjs';
|
||||
import { Listable } from '@iqser/common-ui';
|
||||
|
||||
export interface ProfileModel {
|
||||
username?: string;
|
||||
@ -15,7 +16,7 @@ export interface ProfileModel {
|
||||
language: string;
|
||||
}
|
||||
|
||||
export class UserWrapper {
|
||||
export class UserWrapper implements Listable {
|
||||
constructor(private readonly _user: KeycloakProfile | User, public roles: string[], public id: string) {}
|
||||
|
||||
email = this._user.email;
|
||||
|
||||
@ -1,8 +1,9 @@
|
||||
import { FileStatusWrapper } from '@models/file/file-status.wrapper';
|
||||
import * as moment from 'moment';
|
||||
import { Dictionary, Dossier } from '@redaction/red-ui-http';
|
||||
import { Listable } from '@iqser/common-ui';
|
||||
|
||||
export class DossierWrapper implements Dossier {
|
||||
export class DossierWrapper implements Dossier, Listable {
|
||||
readonly approverIds = this._dossier.approverIds;
|
||||
readonly date = this._dossier.date;
|
||||
readonly description = this._dossier.description;
|
||||
@ -42,6 +43,10 @@ export class DossierWrapper implements Dossier {
|
||||
this._recomputeFileStatus();
|
||||
}
|
||||
|
||||
get id() {
|
||||
return this.dossierId;
|
||||
}
|
||||
|
||||
get files() {
|
||||
return this._files;
|
||||
}
|
||||
|
||||
@ -11,8 +11,8 @@
|
||||
*/
|
||||
|
||||
export interface DossierAttributeConfig {
|
||||
id: string;
|
||||
editable?: boolean;
|
||||
id?: string;
|
||||
label?: string;
|
||||
placeholder?: string;
|
||||
type?: DossierAttributeConfig.TypeEnum;
|
||||
|
||||
@ -11,9 +11,9 @@
|
||||
*/
|
||||
|
||||
export interface FileAttributeConfig {
|
||||
id: string;
|
||||
csvColumnHeader?: string;
|
||||
editable?: boolean;
|
||||
id?: string;
|
||||
label?: string;
|
||||
placeholder?: string;
|
||||
primaryAttribute?: boolean;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user