move to new listing service

This commit is contained in:
Dan Percic 2021-10-06 01:18:15 +03:00
parent 3adc2db48b
commit 3a08bd36e8
42 changed files with 83 additions and 142 deletions

View File

@ -178,6 +178,7 @@
"prefer-const": "error",
"radix": "error",
"curly": "error",
"comma-dangle": "error",
"max-len": [
"error",
{

View File

@ -3,7 +3,7 @@
"printWidth": 140,
"tabWidth": 4,
"singleQuote": true,
"trailingComma": "none",
"trailingComma": "all",
"arrowParens": "avoid",
"overrides": [
{

View File

@ -5,8 +5,8 @@ module.exports = {
'ts-jest': {
stringifyContentPathRegex: '\\.(html|svg)$',
tsconfig: '<rootDir>/tsconfig.spec.json'
}
tsconfig: '<rootDir>/tsconfig.spec.json',
},
},
coverageDirectory: '../../coverage/apps/red-ui',
@ -14,7 +14,7 @@ module.exports = {
snapshotSerializers: [
'jest-preset-angular/build/serializers/no-ng-attributes',
'jest-preset-angular/build/serializers/ng-snapshot',
'jest-preset-angular/build/serializers/html-comment'
'jest-preset-angular/build/serializers/html-comment',
],
transform: { '^.+\\.(ts|js|html)$': 'jest-preset-angular' }
transform: { '^.+\\.(ts|js|html)$': 'jest-preset-angular' },
};

View File

@ -17,7 +17,7 @@
<ng-template #bulkActions>
<iqser-circle-button
(action)="deleteItems()"
*ngIf="entitiesService.areSomeSelected$ | async"
*ngIf="listingService.areSomeSelected$ | async"
[tooltip]="'downloads-list.bulk.delete' | translate"
[type]="circleButtonTypes.dark"
icon="red:trash"

View File

@ -51,9 +51,9 @@ export class DownloadsListScreenComponent extends ListingComponent<DownloadStatu
}
private async _deleteItems(downloads?: DownloadStatusWrapper[]) {
const storageIds = (downloads || this.entitiesService.selected).map(d => d.storageId);
const storageIds = (downloads || this.listingService.selected).map(d => d.storageId);
await this._downloadControllerService.deleteDownload({ storageIds }).toPromise();
this.entitiesService.setSelected([]);
this.listingService.setSelected([]);
await this._loadData();
}

View File

@ -277,7 +277,7 @@ export class AnnotationWrapper {
return;
}
if (redactionLogEntryWrapper.type === 'manual' ) {
if (redactionLogEntryWrapper.type === 'manual') {
if (redactionLogEntryWrapper.status === 'REQUESTED') {
annotationWrapper.superType = 'suggestion-add';
return;

View File

@ -2,5 +2,5 @@ export enum FileType {
ORIGINAL = 'ORIGINAL',
ANNOTATED = 'ANNOTATED',
REDACTED = 'REDACTED',
FLAT_REDACTED = 'FLAT_REDACTED'
FLAT_REDACTED = 'FLAT_REDACTED',
}

View File

@ -9,7 +9,7 @@ export enum NotificationTypeEnum {
USER_REMOVED_AS_DOSSIER_MEMBER = 'USER_REMOVED_AS_DOSSIER_MEMBER',
USER_PROMOTED_TO_APPROVER = 'USER_PROMOTED_TO_APPROVER',
USER_DEGRADED_TO_REVIEWER = 'USER_DEGRADED_TO_REVIEWER',
DOSSIER_OWNER_DELETED = 'DOSSIER_OWNER_DELETED'
DOSSIER_OWNER_DELETED = 'DOSSIER_OWNER_DELETED',
}
export type NotificationType = NotificationTypeEnum;

View File

@ -61,7 +61,7 @@ export class DossierTemplateActionsComponent implements OnInit {
this._loadingService.stop();
});
await this._dossierTemplateControllerService.deleteDossierTemplates([this.dossierTemplateId]).toPromise();
await this._dossierTemplatesService.loadAll();
await this._dossierTemplatesService.loadAll().toPromise();
await this._appStateService.loadDictionaryData();
await this._router.navigate(['main', 'admin']);
this._loadingService.stop();

View File

@ -100,7 +100,7 @@ export class AddEditDossierTemplateDialogComponent {
validTo: this.hasValidTo ? this.dossierTemplateForm.get('validTo').value : null
};
await this._dossierTemplateController.createOrUpdateDossierTemplate(dossierTemplate).toPromise();
await this._dossierTemplatesService.loadAll();
await this._dossierTemplatesService.loadAll().toPromise();
await this._appStateService.loadDictionaryData();
this.dialogRef.close(true);
}

View File

@ -10,7 +10,7 @@
></iqser-table>
<ng-template #bulkActions>
<ng-container *ngIf="entitiesService.areSomeSelected$ | async">
<ng-container *ngIf="listingService.areSomeSelected$ | async">
<iqser-circle-button
[matMenuTriggerFor]="readOnlyMenu"
[tooltip]="'file-attributes-csv-import.table-header.actions.read-only' | translate"

View File

@ -52,7 +52,7 @@ export class ActiveFieldsListingComponent extends ListingComponent<Field> implem
ngOnChanges(changes: SimpleChanges): void {
if (changes.entities) {
this.entitiesService.setEntities(this.entities);
this.entitiesService.updateSelection();
this.listingService.updateSelection();
}
}
@ -60,11 +60,11 @@ export class ActiveFieldsListingComponent extends ListingComponent<Field> implem
this.allEntities.filter(field => this.isSelected(field)).forEach(field => (field.primaryAttribute = false));
this.entitiesService.setEntities(this.allEntities.filter(field => !this.isSelected(field)));
this.entitiesChange.emit(this.allEntities);
this.entitiesService.setSelected([]);
this.listingService.setSelected([]);
}
setAttributeForSelection(attribute: string, value: any) {
for (const item of this.entitiesService.selected) {
for (const item of this.listingService.selected) {
this.allEntities.find(f => f.csvColumn === item.csvColumn)[attribute] = value;
}
}

View File

@ -52,7 +52,7 @@
<ng-template #bulkActions>
<iqser-circle-button
(action)="openDeleteDictionariesDialog($event)"
*ngIf="currentUser.isAdmin && (entitiesService.areSomeSelected$ | async)"
*ngIf="currentUser.isAdmin && (listingService.areSomeSelected$ | async)"
[tooltip]="'dictionary-listing.bulk.delete' | translate"
[type]="circleButtonTypes.dark"
icon="red:trash"

View File

@ -63,7 +63,7 @@ export class DictionaryListingScreenComponent extends ListingComponent<TypeValue
this._loadDictionaryData();
}
openDeleteDictionariesDialog($event?: MouseEvent, types = this.entitiesService.selected) {
openDeleteDictionariesDialog($event?: MouseEvent, types = this.listingService.selected) {
this._dialogService.openDialog('confirm', $event, null, async () => {
this._loadingService.start();
await this._dictionaryService
@ -72,7 +72,7 @@ export class DictionaryListingScreenComponent extends ListingComponent<TypeValue
this._dossierTemplatesService.activeDossierTemplateId
)
.toPromise();
this.entitiesService.setSelected([]);
this.listingService.setSelected([]);
await this._appStateService.loadDictionaryData();
this._loadDictionaryData(false);
this._calculateData();

View File

@ -40,7 +40,7 @@
<ng-template #bulkActions>
<iqser-circle-button
(action)="openConfirmDeleteAttributeDialog($event)"
*ngIf="currentUser.isAdmin && entitiesService.areSomeSelected$ | async"
*ngIf="currentUser.isAdmin && listingService.areSomeSelected$ | async"
[tooltip]="'dossier-attributes-listing.bulk.delete' | translate"
[type]="circleButtonTypes.dark"
icon="red:trash"

View File

@ -58,9 +58,9 @@ export class DossierAttributesListingScreenComponent extends ListingComponent<Do
openConfirmDeleteAttributeDialog($event: MouseEvent, dossierAttribute?: IDossierAttributeConfig) {
this._dialogService.openDialog('confirm', $event, null, async () => {
this._loadingService.start();
const ids = dossierAttribute ? [dossierAttribute.id] : this.entitiesService.selected.map(item => item.id);
const ids = dossierAttribute ? [dossierAttribute.id] : this.listingService.selected.map(item => item.id);
await this._dossierAttributesService.deleteConfigs(ids);
this.entitiesService.setSelected([]);
this.listingService.setSelected([]);
await this._loadData();
});
}

View File

@ -29,7 +29,7 @@
<ng-template #bulkActions>
<iqser-circle-button
(action)="openBulkDeleteTemplatesDialog($event)"
*ngIf="currentUser.isAdmin && (entitiesService.areSomeSelected$ | async)"
*ngIf="currentUser.isAdmin && (listingService.areSomeSelected$ | async)"
[tooltip]="'dossier-templates-listing.bulk.delete' | translate"
[type]="circleButtonTypes.dark"
icon="red:trash"

View File

@ -5,13 +5,11 @@ import { AdminDialogService } from '../../services/admin-dialog.service';
import { DossierTemplate } from '@models/file/dossier-template';
import {
CircleButtonTypes,
DefaultListingServicesTmp,
EntitiesService,
FilterService,
IconButtonTypes,
ListingComponent,
LoadingService,
SearchService,
SortingService,
TableColumnConfig,
Toaster
} from '@iqser/common-ui';
@ -26,9 +24,7 @@ import { DossierTemplatesService } from '../../../dossier/services/dossier-templ
styleUrls: ['./dossier-templates-listing-screen.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
providers: [
FilterService,
SearchService,
SortingService,
...DefaultListingServicesTmp,
{ provide: EntitiesService, useExisting: DossierTemplatesService },
{ provide: ListingComponent, useExisting: forwardRef(() => DossierTemplatesListingScreenComponent) }
]
@ -81,7 +77,7 @@ export class DossierTemplatesListingScreenComponent extends ListingComponent<Dos
});
}
private async _deleteTemplates(templateIds = this.entitiesService.selected.map(d => d.dossierTemplateId)) {
private async _deleteTemplates(templateIds = this.listingService.selected.map(d => d.dossierTemplateId)) {
await this._dossierTemplateControllerService
.deleteDossierTemplates(templateIds)
.toPromise()
@ -92,7 +88,7 @@ export class DossierTemplatesListingScreenComponent extends ListingComponent<Dos
this._toaster.error(_('dossier-templates-listing.error.generic'));
}
});
this.entitiesService.setSelected([]);
this.listingService.setSelected([]);
await this._dossierTemplatesService.loadAll();
await this._appStateService.loadDictionaryData();
this.loadDossierTemplatesData();

View File

@ -39,7 +39,7 @@
<ng-template #bulkActions>
<iqser-circle-button
(click)="openConfirmDeleteAttributeDialog($event)"
*ngIf="currentUser.isAdmin && (entitiesService.areSomeSelected$ | async)"
*ngIf="currentUser.isAdmin && (listingService.areSomeSelected$ | async)"
[tooltip]="'file-attributes-listing.bulk-actions.delete' | translate"
[type]="circleButtonTypes.dark"
icon="red:trash"

View File

@ -92,7 +92,7 @@ export class FileAttributesListingScreenComponent extends ListingComponent<FileA
} else {
await this._fileAttributesService
.deleteFileAttributes(
this.entitiesService.selected.map(f => f.id),
this.listingService.selected.map(f => f.id),
dossierTemplateId
)
.toPromise();

View File

@ -43,8 +43,7 @@ export class ReportsScreenComponent implements OnInit {
private readonly _toaster: Toaster,
private readonly _loadingService: LoadingService,
readonly permissionsService: PermissionsService
) {
}
) {}
async ngOnInit() {
this._loadingService.start();
@ -104,9 +103,7 @@ export class ReportsScreenComponent implements OnInit {
});
this._dialogService.openDialog('confirm', null, data, null, async result => {
if (result) {
await this._reportTemplateService
.uploadTemplateForm(dossierTemplateId, result > 1, file)
.toPromise();
await this._reportTemplateService.uploadTemplateForm(dossierTemplateId, result > 1, file).toPromise();
await this._loadReportTemplates();
}
});

View File

@ -33,7 +33,7 @@
<iqser-circle-button
(action)="hardDelete()"
*ngIf="entitiesService.areSomeSelected$ | async"
*ngIf="listingService.areSomeSelected$ | async"
[tooltip]="'trash.bulk.delete' | translate"
[type]="circleButtonTypes.dark"
icon="red:trash"

View File

@ -55,7 +55,7 @@ export class TrashScreenComponent extends ListingComponent<DossierListItem> impl
}
private get _canRestoreSelected$(): Observable<boolean> {
return this.entitiesService.selectedEntities$.pipe(
return this.listingService.selectedEntities$.pipe(
map(entities => entities.length && !entities.find(dossier => !dossier.canRestore)),
distinctUntilChanged()
);
@ -73,7 +73,7 @@ export class TrashScreenComponent extends ListingComponent<DossierListItem> impl
this._loadingService.stop();
}
hardDelete(dossiers = this.entitiesService.selected): void {
hardDelete(dossiers = this.listingService.selected): void {
const data = new ConfirmationDialogInput({
title: _('confirmation-dialog.delete-dossier.title'),
titleColor: TitleColors.PRIMARY,
@ -92,7 +92,7 @@ export class TrashScreenComponent extends ListingComponent<DossierListItem> impl
});
}
restore(dossiers = this.entitiesService.selected): void {
restore(dossiers = this.listingService.selected): void {
this._loadingService.loadWhile(this._restore(dossiers));
}
@ -142,6 +142,6 @@ export class TrashScreenComponent extends ListingComponent<DossierListItem> impl
private _removeFromList(ids: string[]): void {
const entities = this.entitiesService.all.filter(e => !ids.includes(e.id));
this.entitiesService.setEntities(entities);
this.entitiesService.setSelected([]);
this.listingService.setSelected([]);
}
}

View File

@ -54,7 +54,7 @@
<ng-template #bulkActions>
<iqser-circle-button
(action)="bulkDelete()"
*ngIf="entitiesService.areSomeSelected$ | async"
*ngIf="listingService.areSomeSelected$ | async"
[disabled]="(canDeleteSelected$ | async) === false"
[tooltip]="
(canDeleteSelected$ | async) ? ('user-listing.bulk.delete' | translate) : ('user-listing.bulk.delete-disabled' | translate)

View File

@ -56,7 +56,7 @@ export class UserListingScreenComponent extends ListingComponent<User> implement
}
private get _canDeleteSelected$(): Observable<boolean> {
const entities$ = this.entitiesService.selectedEntities$;
const entities$ = this.listingService.selectedEntities$;
return entities$.pipe(map(all => !all.find(u => u.id === this.currentUser.id)));
}

View File

@ -27,7 +27,7 @@
<iqser-circle-button
(action)="hardDelete()"
*ngIf="entitiesService.areSomeSelected$ | async"
*ngIf="listingService.areSomeSelected$ | async"
[tooltip]="'edit-dossier-dialog.deleted-documents.bulk.delete' | translate"
[type]="circleButtonTypes.dark"
icon="red:trash"

View File

@ -66,13 +66,13 @@ export class EditDossierDeletedDocumentsComponent extends ListingComponent<FileL
}
private get _canRestoreSelected$(): Observable<boolean> {
return this.entitiesService.selectedEntities$.pipe(
return this.listingService.selectedEntities$.pipe(
map(entities => entities.length && !entities.find(file => !file.canRestore)),
distinctUntilChanged()
);
}
hardDelete(files = this.entitiesService.selected) {
hardDelete(files = this.listingService.selected) {
const data = new ConfirmationDialogInput({
title: _('confirmation-dialog.permanently-delete-file.title'),
titleColor: TitleColors.PRIMARY,
@ -105,7 +105,7 @@ export class EditDossierDeletedDocumentsComponent extends ListingComponent<FileL
save() {}
restore(files = this.entitiesService.selected) {
restore(files = this.listingService.selected) {
this._loadingService.loadWhile(this._restore(files));
}
@ -129,7 +129,7 @@ export class EditDossierDeletedDocumentsComponent extends ListingComponent<FileL
private _removeFromList(ids: string[]): void {
const entities = this.entitiesService.all.filter(e => !ids.includes(e.fileId));
this.entitiesService.setEntities(entities);
this.entitiesService.setSelected([]);
this.listingService.setSelected([]);
}
private _toListItems(files: IFile[]): FileListItem[] {

View File

@ -6,7 +6,7 @@ import { File } from '@models/file/file';
import { FileActionService } from '../../../../shared/services/file-action.service';
import { Observable } from 'rxjs';
import { DossiersDialogService } from '../../../../services/dossiers-dialog.service';
import { CircleButtonTypes, ConfirmationDialogInput, EntitiesService, LoadingService } from '@iqser/common-ui';
import { CircleButtonTypes, ConfirmationDialogInput, ListingService, LoadingService } from '@iqser/common-ui';
import { TranslateService } from '@ngx-translate/core';
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
import { Dossier } from '@state/model/dossier';
@ -31,11 +31,11 @@ export class DossierOverviewBulkActionsComponent {
private readonly _fileActionService: FileActionService,
private readonly _loadingService: LoadingService,
private readonly _translateService: TranslateService,
private readonly _entitiesService: EntitiesService<File>
private readonly _listingService: ListingService<File>
) {}
get selectedFiles(): File[] {
return this._entitiesService.selected;
return this._listingService.selected;
}
get areAllFilesSelected() {
@ -133,7 +133,7 @@ export class DossierOverviewBulkActionsComponent {
.toPromise();
await this._appStateService.reloadActiveDossierFiles();
this.reload.emit();
this._entitiesService.setSelected([]);
this._listingService.setSelected([]);
this._loadingService.stop();
}
);

View File

@ -14,7 +14,7 @@
<iqser-circle-button
(action)="reanalyseDossier()"
*ngIf="permissionsService.displayReanalyseBtn(currentDossier)"
[tooltipClass]="'small ' + ((entitiesService.areSomeSelected$ | async) ? '' : 'warn')"
[tooltipClass]="'small ' + ((listingService.areSomeSelected$ | async) ? '' : 'warn')"
[tooltip]="'dossier-overview.new-rule.toast.actions.reanalyse-all' | translate"
[type]="circleButtonTypes.warn"
icon="iqser:refresh"

View File

@ -233,7 +233,7 @@ export class DossierOverviewScreenComponent extends ListingComponent<File> imple
}
async bulkActionPerformed(): Promise<void> {
this.entitiesService.setSelected([]);
this.listingService.setSelected([]);
await this.reloadDossiers();
}

View File

@ -11,16 +11,7 @@ import { tap } from 'rxjs/operators';
import { Router } from '@angular/router';
import { DossiersDialogService } from '../../../services/dossiers-dialog.service';
import { groupBy, StatusSorter } from '@utils/index';
import {
EntitiesService,
FilterService,
ListingComponent,
OnAttach,
OnDetach,
SearchService,
SortingService,
TableComponent
} from '@iqser/common-ui';
import { DefaultListingServicesTmp, EntitiesService, ListingComponent, OnAttach, OnDetach, TableComponent } from '@iqser/common-ui';
import { fileStatusTranslations } from '../../../translations/file-status-translations';
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
import { ConfigService } from '../config.service';
@ -30,9 +21,7 @@ import { DossiersService } from '../../../services/dossiers.service';
templateUrl: './dossiers-listing-screen.component.html',
styleUrls: ['./dossiers-listing-screen.component.scss'],
providers: [
FilterService,
SearchService,
SortingService,
...DefaultListingServicesTmp,
{ provide: EntitiesService, useExisting: DossiersService },
{ provide: ListingComponent, useExisting: forwardRef(() => DossiersListingScreenComponent) }
]

View File

@ -2,11 +2,11 @@ import { EntitiesService } from '@iqser/common-ui';
import { DossierTemplate } from '@models/file/dossier-template';
import { IDossierTemplate } from '@redaction/red-ui-http';
import { Injectable, Injector } from '@angular/core';
import { TEMPORARY_INJECTOR } from './injector';
import { BehaviorSubject, Observable } from 'rxjs';
import { BehaviorSubject, forkJoin, Observable } from 'rxjs';
import { FileAttributesService } from './file-attributes.service';
import { ActivationEnd, Router } from '@angular/router';
import { currentComponentRoute } from '@utils/functions';
import { map, switchMap } from 'rxjs/operators';
@Injectable({
providedIn: 'root'
@ -20,7 +20,7 @@ export class DossierTemplatesService extends EntitiesService<DossierTemplate, ID
private readonly _fileAttributesService: FileAttributesService,
private readonly _router: Router
) {
super(TEMPORARY_INJECTOR(_injector), 'dossier-template');
super(_injector, DossierTemplate, 'dossier-template');
this.activeDossierTemplate$ = this._activeDossierTemplate$.asObservable();
_router.events.pipe(currentComponentRoute).subscribe((event: ActivationEnd) => {
@ -52,33 +52,11 @@ export class DossierTemplatesService extends EntitiesService<DossierTemplate, ID
return this._activeDossierTemplate$.value?.dossierTemplateId;
}
async loadAll(): Promise<void> {
const dossierTemplates = await this.get().toPromise();
this.setEntities(dossierTemplates.map(dossierTemplate => new DossierTemplate(dossierTemplate)));
for (const dossierTemplate of this.all) {
await this._fileAttributesService.getFileAttributesConfig(dossierTemplate.dossierTemplateId).toPromise();
}
}
async loadAllIfEmpty(): Promise<void> {
if (!this.all.length) {
await this.loadAll();
}
}
/**
* Gets all dossier templates.
*/
get(): Observable<IDossierTemplate[]>;
/**
* Gets one dossier template by id.
*/
get(dossierTemplateId: string): Observable<IDossierTemplate>;
get(dossierTemplateId?: string) {
if (dossierTemplateId) {
return super._getOne([dossierTemplateId]);
}
return super.getAll();
loadAll(): Observable<DossierTemplate[]> {
const getAttributes = (entities: DossierTemplate[]) => entities.map(e => this._fileAttributesService.getFileAttributesConfig(e.id));
return super.loadAll().pipe(
switchMap(entities => forkJoin(getAttributes(entities))),
map(() => this.all)
);
}
}

View File

@ -3,7 +3,6 @@ import { DossierRequest, IDossier } from '@redaction/red-ui-http';
import { EntitiesService, List, QueryParam, RequiredParam, Toaster, Validate } from '@iqser/common-ui';
import { Dossier } from '@state/model/dossier';
import { catchError, map, tap } from 'rxjs/operators';
import { TEMPORARY_INJECTOR } from './injector';
import { BehaviorSubject, Observable, of } from 'rxjs';
import { ActivationEnd, Router } from '@angular/router';
import { File } from '@models/file/file';
@ -33,7 +32,7 @@ export class DossiersService extends EntitiesService<Dossier, IDossier> {
private readonly _dictionaryService: DictionaryService,
private readonly _toaster: Toaster
) {
super(TEMPORARY_INJECTOR(_injector), 'dossier');
super(_injector, Dossier, 'dossier');
this.activeDossier$ = this._activeDossier$.asObservable();
_router.events.pipe(currentComponentRoute).subscribe((event: ActivationEnd) => {
@ -98,12 +97,6 @@ export class DossiersService extends EntitiesService<Dossier, IDossier> {
}
}
get(): Observable<IDossier[]>;
get(dossierId: string): Observable<IDossier>;
get(dossierId?: string): Observable<IDossier | IDossier[]> {
return dossierId ? super._getOne([dossierId]) : super.getAll();
}
@Validate()
createOrUpdate(@RequiredParam() dossier: DossierRequest): Observable<Dossier | undefined> {
return this._post(dossier).pipe(

View File

@ -1,7 +1,6 @@
import { EntitiesService, List, RequiredParam, Validate } from '@iqser/common-ui';
import { FileAttributes, FileAttributesConfig, IFileAttributeConfig } from '@redaction/red-ui-http';
import { Injectable, Injector } from '@angular/core';
import { TEMPORARY_INJECTOR } from './injector';
import { BehaviorSubject, Observable, of } from 'rxjs';
import { catchError, map, tap } from 'rxjs/operators';
import { FileAttributeConfig } from '@models/file/file-attribute-config';
@ -15,20 +14,13 @@ export class FileAttributesService extends EntitiesService<FileAttributeConfig,
private readonly _fileAttributesConfig$ = new BehaviorSubject<FileAttributesConfigMap>({});
constructor(protected readonly _injector: Injector) {
super(TEMPORARY_INJECTOR(_injector), 'fileAttributes');
super(_injector, FileAttributeConfig, 'fileAttributes');
}
get fileAttributesConfig(): FileAttributesConfigMap {
return this._fileAttributesConfig$.value;
}
fetch(): Observable<FileAttributeConfig[]> {
return this.getAll().pipe(
map(entities => entities.map(entity => new FileAttributeConfig(entity))),
tap(entities => this.setEntities(entities))
);
}
/**
* Get the file attributes that can be used at importing csv.
*/

View File

@ -2,7 +2,6 @@ import { Injectable, Injector } from '@angular/core';
import { EntitiesService, List, RequiredParam, Validate } from '@iqser/common-ui';
import { IFile } from '@redaction/red-ui-http';
import { File } from '@models/file/file';
import { TEMPORARY_INJECTOR } from './injector';
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';
import { UserService } from '@services/user.service';
@ -12,7 +11,7 @@ import { UserService } from '@services/user.service';
})
export class FilesService extends EntitiesService<File, IFile> {
constructor(protected readonly _injector: Injector, private readonly _userService: UserService) {
super(TEMPORARY_INJECTOR(_injector), 'status');
super(_injector, File, 'status');
}
getExistingFilesFor(dossierId: string): List<File> {
@ -31,7 +30,7 @@ export class FilesService extends EntitiesService<File, IFile> {
* Gets the status for a file from a dossier.
*/
get(dossierId: string, fileId: string): Observable<IFile>;
get(dossierId?: string, fileId?: string) {
get(dossierId?: string, fileId?: string): Observable<IFile | IFile[]> {
if (dossierId && fileId) {
return super._getOne([dossierId, fileId]);
}

View File

@ -1,5 +1,5 @@
import { Injector } from "@angular/core";
import { FilterService, SearchService } from "@iqser/common-ui";
import { Injector } from '@angular/core';
import { FilterService, SearchService } from '@iqser/common-ui';
/**
* This should be removed when refactoring is done

View File

@ -58,7 +58,6 @@ export class EditorComponent implements OnInit, OnChanges {
}
ngOnChanges(changes: SimpleChanges) {
console.log(changes);
this.revert();
}

View File

@ -4,7 +4,6 @@ import { EntitiesService, List, QueryParam, RequiredParam, Toaster, Validate } f
import { Colors, IDictionary, ITypeValue, UpdateTypeValue } from '@redaction/red-ui-http';
import { tap } from 'rxjs/operators';
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
import { TEMPORARY_INJECTOR } from '../../dossier/services/injector';
import { Dictionary } from '@models/dictionary';
const MIN_WORD_LENGTH = 2;
@ -14,7 +13,7 @@ const MIN_WORD_LENGTH = 2;
})
export class DictionaryService extends EntitiesService<Dictionary, IDictionary> {
constructor(private readonly _toaster: Toaster, protected readonly _injector: Injector) {
super(TEMPORARY_INJECTOR(_injector), 'dictionary');
super(_injector, Dictionary, 'dictionary');
}
/**

View File

@ -1,11 +1,10 @@
import {DownloadStatus} from '@redaction/red-ui-http';
import {IListable} from '@iqser/common-ui';
import { DownloadStatus } from '@redaction/red-ui-http';
import { IListable } from '@iqser/common-ui';
export class DownloadStatusWrapper implements IListable {
inProgress: boolean;
constructor(private _downloadStatus: DownloadStatus) {
}
constructor(private _downloadStatus: DownloadStatus) {}
get id() {
return this.storageId;
@ -24,7 +23,6 @@ export class DownloadStatusWrapper implements IListable {
return this._downloadStatus.creationDate;
}
get filename() {
return this._downloadStatus.filename;
}

View File

@ -2,7 +2,7 @@ enum PageRotation {
E_0 = 0,
E_90 = 1,
E_180 = 2,
E_270 = 3
E_270 = 3,
}
export function translateQuads(page: number, rotation: number, quads: any) {

View File

@ -11,8 +11,8 @@ $primary-palette: (
contrast: (
default: variables.$light,
lighter: variables.$light,
darker: variables.$light
)
darker: variables.$light,
),
);
$secondary-palette: (
@ -23,8 +23,8 @@ $secondary-palette: (
contrast: (
default: variables.$light,
lighter: variables.$light,
darker: variables.$light
)
darker: variables.$light,
),
);
$red-palette: (
@ -35,8 +35,8 @@ $red-palette: (
contrast: (
default: variables.$light,
lighter: variables.$light,
darker: variables.$light
)
darker: variables.$light,
),
);
$gn-next-primary: mat.define-palette($primary-palette, default, lighter, darker, text);
@ -48,15 +48,15 @@ $gn-next-mat-theme: mat.define-light-theme(
color: (
primary: $gn-next-primary,
accent: $gn-next-secondary,
warn: $gn-next-warning
)
warn: $gn-next-warning,
),
)
);
@include mat.all-component-themes($gn-next-mat-theme);
$custom-typography: mat.define-typography-config(
$font-family: 'Inter, sans-serif'
$font-family: 'Inter, sans-serif',
);
@include mat.all-component-typographies($custom-typography);

@ -1 +1 @@
Subproject commit 916bf9bda3aea9538fb508fb9fce9b8986645f8d
Subproject commit 61fb1a40063e27f335b0345552b8874eba2ac899