Curly & pretty
This commit is contained in:
parent
d72ccfb8b9
commit
3816dbf3dd
@ -177,6 +177,7 @@
|
||||
"no-var": "error",
|
||||
"prefer-const": "error",
|
||||
"radix": "error",
|
||||
"curly": "error",
|
||||
"max-len": [
|
||||
"error",
|
||||
{
|
||||
|
||||
@ -4,10 +4,7 @@
|
||||
"overrides": [
|
||||
{
|
||||
"files": ["*.ts"],
|
||||
"extends": [
|
||||
"plugin:@nrwl/nx/angular",
|
||||
"plugin:@angular-eslint/template/process-inline-templates"
|
||||
],
|
||||
"extends": ["plugin:@nrwl/nx/angular", "plugin:@angular-eslint/template/process-inline-templates"],
|
||||
"parserOptions": {
|
||||
"project": ["apps/red-ui/tsconfig.*?.json"]
|
||||
},
|
||||
|
||||
@ -5,10 +5,7 @@ module.exports = {
|
||||
'ts-jest': {
|
||||
stringifyContentPathRegex: '\\.(html|svg)$',
|
||||
astTransformers: {
|
||||
before: [
|
||||
'jest-preset-angular/build/InlineFilesTransformer',
|
||||
'jest-preset-angular/build/StripStylesTransformer'
|
||||
]
|
||||
before: ['jest-preset-angular/build/InlineFilesTransformer', 'jest-preset-angular/build/StripStylesTransformer']
|
||||
},
|
||||
tsconfig: '<rootDir>/tsconfig.spec.json'
|
||||
}
|
||||
|
||||
@ -84,7 +84,9 @@ export class NotificationsComponent {
|
||||
const res = {};
|
||||
for (const notification of notifications) {
|
||||
const date = this._datePipe.transform(notification.creationDate, 'sophisticatedDate');
|
||||
if (!res[date]) res[date] = [];
|
||||
if (!res[date]) {
|
||||
res[date] = [];
|
||||
}
|
||||
res[date].push(notification);
|
||||
}
|
||||
for (const key of Object.keys(res)) {
|
||||
|
||||
@ -409,7 +409,9 @@ export class AnnotationWrapper {
|
||||
private static _getShortContent(annotationWrapper: AnnotationWrapper, entry: RedactionLogEntryWrapper) {
|
||||
if (annotationWrapper.legalBasis) {
|
||||
const lb = entry.legalBasisMapping?.find(lbm => lbm.reason.toLowerCase().includes(annotationWrapper.legalBasis.toLowerCase()));
|
||||
if (lb) return lb.name;
|
||||
if (lb) {
|
||||
return lb.name;
|
||||
}
|
||||
}
|
||||
|
||||
return annotationWrapper.legalBasis;
|
||||
|
||||
@ -198,8 +198,12 @@ export class ComboChartComponent extends BaseChartComponent {
|
||||
}
|
||||
}
|
||||
|
||||
if (date) return 'time';
|
||||
if (num) return 'linear';
|
||||
if (date) {
|
||||
return 'time';
|
||||
}
|
||||
if (num) {
|
||||
return 'linear';
|
||||
}
|
||||
return 'ordinal';
|
||||
}
|
||||
|
||||
|
||||
@ -178,7 +178,9 @@ export class ComboSeriesVerticalComponent implements OnChanges {
|
||||
}
|
||||
|
||||
isActive(entry): boolean {
|
||||
if (!this.activeEntries) return false;
|
||||
if (!this.activeEntries) {
|
||||
return false;
|
||||
}
|
||||
const item = this.activeEntries.find(d => entry.name === d.name && entry.series === d.series);
|
||||
return item !== undefined;
|
||||
}
|
||||
|
||||
@ -64,7 +64,9 @@ export class AddEditDictionaryDialogComponent {
|
||||
}
|
||||
|
||||
get changed(): boolean {
|
||||
if (!this.dictionary) return true;
|
||||
if (!this.dictionary) {
|
||||
return true;
|
||||
}
|
||||
|
||||
for (const key of Object.keys(this.dictionaryForm.getRawValue())) {
|
||||
if (key === 'caseSensitive') {
|
||||
|
||||
@ -49,7 +49,9 @@ export class AddEditDossierAttributeDialogComponent extends AutoUnsubscribe impl
|
||||
}
|
||||
|
||||
get changed(): boolean {
|
||||
if (!this.dossierAttribute) return true;
|
||||
if (!this.dossierAttribute) {
|
||||
return true;
|
||||
}
|
||||
|
||||
for (const key of Object.keys(this.dossierAttributeForm.getRawValue())) {
|
||||
if (this.dossierAttribute[key] !== this.dossierAttributeForm.get(key).value) {
|
||||
|
||||
@ -67,7 +67,9 @@ export class AddEditDossierTemplateDialogComponent implements OnInit {
|
||||
}
|
||||
|
||||
get changed(): boolean {
|
||||
if (!this.dossierTemplate) return true;
|
||||
if (!this.dossierTemplate) {
|
||||
return true;
|
||||
}
|
||||
|
||||
for (const key of Object.keys(this.dossierTemplateForm.getRawValue())) {
|
||||
if (key === 'validFrom') {
|
||||
|
||||
@ -39,7 +39,9 @@ export class AddEditFileAttributeDialogComponent {
|
||||
}
|
||||
|
||||
get changed(): boolean {
|
||||
if (!this.fileAttribute) return true;
|
||||
if (!this.fileAttribute) {
|
||||
return true;
|
||||
}
|
||||
|
||||
for (const key of Object.keys(this.fileAttributeForm.getRawValue())) {
|
||||
if (key === 'readonly') {
|
||||
|
||||
@ -30,7 +30,9 @@ export class UserDetailsComponent implements OnInit {
|
||||
) {}
|
||||
|
||||
get changed(): boolean {
|
||||
if (!this.user) return true;
|
||||
if (!this.user) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (this.user.roles.length !== this.activeRoles.length) {
|
||||
return true;
|
||||
|
||||
@ -75,7 +75,9 @@ export class ActiveFieldsListingComponent extends ListingComponent<Field> implem
|
||||
return;
|
||||
}
|
||||
|
||||
for (const f of this.allEntities) f.primaryAttribute = false;
|
||||
for (const f of this.allEntities) {
|
||||
f.primaryAttribute = false;
|
||||
}
|
||||
field.primaryAttribute = true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
import {Component, Inject, Injector} from '@angular/core';
|
||||
import {AbstractControl, FormBuilder, FormGroup, ValidatorFn, Validators} from '@angular/forms';
|
||||
import {MAT_DIALOG_DATA, MatDialogRef} from '@angular/material/dialog';
|
||||
import { Component, Inject, Injector } from '@angular/core';
|
||||
import { AbstractControl, FormBuilder, FormGroup, ValidatorFn, Validators } from '@angular/forms';
|
||||
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
||||
import * as Papa from 'papaparse';
|
||||
import {FileAttributeConfig, FileAttributesConfig, FileAttributesControllerService} from '@redaction/red-ui-http';
|
||||
import {Observable} from 'rxjs';
|
||||
import {map, startWith} from 'rxjs/operators';
|
||||
import {DefaultListingServices, Listable, ListingComponent, TableColumnConfig, Toaster} from '@iqser/common-ui';
|
||||
import {marker as _} from '@biesbjerg/ngx-translate-extract-marker';
|
||||
import { FileAttributeConfig, FileAttributesConfig, FileAttributesControllerService } from '@redaction/red-ui-http';
|
||||
import { Observable } from 'rxjs';
|
||||
import { map, startWith } from 'rxjs/operators';
|
||||
import { DefaultListingServices, Listable, ListingComponent, TableColumnConfig, Toaster } from '@iqser/common-ui';
|
||||
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||
|
||||
export interface Field extends Listable {
|
||||
id: string;
|
||||
@ -75,7 +75,7 @@ export class FileAttributesCsvImportDialogComponent extends ListingComponent<Fie
|
||||
header: true,
|
||||
delimiter: this.baseConfigForm.get('delimiter').value
|
||||
});
|
||||
this.baseConfigForm.patchValue({delimiter: this.parseResult.meta.delimiter});
|
||||
this.baseConfigForm.patchValue({ delimiter: this.parseResult.meta.delimiter });
|
||||
|
||||
// Filter duplicate columns
|
||||
if (this.parseResult?.data?.length) {
|
||||
@ -188,7 +188,7 @@ export class FileAttributesCsvImportDialogComponent extends ListingComponent<Fie
|
||||
|
||||
try {
|
||||
await this._fileAttributesControllerService.setFileAttributesConfig(fileAttributes, this.data.dossierTemplateId).toPromise();
|
||||
this._toaster.success(_('file-attributes-csv-import.save.success'), {params: {count: this.activeFields.length}});
|
||||
this._toaster.success(_('file-attributes-csv-import.save.success'), { params: { count: this.activeFields.length } });
|
||||
} catch (e) {
|
||||
this._toaster.error(_('file-attributes-csv-import.save.error'));
|
||||
}
|
||||
@ -216,7 +216,7 @@ export class FileAttributesCsvImportDialogComponent extends ListingComponent<Fie
|
||||
if ((this.parseResult?.meta?.fields || []).indexOf(control.value) !== -1) {
|
||||
return null; /* valid option selected */
|
||||
}
|
||||
return {invalidAutocompleteString: {value: control.value}};
|
||||
return { invalidAutocompleteString: { value: control.value } };
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@ -112,16 +112,20 @@ export class DictionaryListingScreenComponent extends ListingComponent<TypeValue
|
||||
const appStateDictionaryData = this._appStateService.dictionaryData[this._appStateService.activeDossierTemplateId];
|
||||
const entities = Object.values(appStateDictionaryData).filter(d => !d.virtual);
|
||||
|
||||
if (!loadEntries)
|
||||
if (!loadEntries) {
|
||||
this.entitiesService.setEntities(
|
||||
entities.map(dict => {
|
||||
dict.entries = this.allEntities.find(d => d.type === dict.type)?.entries || [];
|
||||
return dict;
|
||||
})
|
||||
);
|
||||
else this.entitiesService.setEntities(entities);
|
||||
} else {
|
||||
this.entitiesService.setEntities(entities);
|
||||
}
|
||||
|
||||
if (!loadEntries) return;
|
||||
if (!loadEntries) {
|
||||
return;
|
||||
}
|
||||
|
||||
const dataObs = this.allEntities.map(dict =>
|
||||
this._dictionaryControllerService.getDictionaryForType(this._appStateService.activeDossierTemplateId, dict.type).pipe(
|
||||
|
||||
@ -67,7 +67,9 @@ export class GeneralConfigScreenComponent extends AutoUnsubscribe implements OnI
|
||||
}
|
||||
|
||||
get smtpConfigurationChanged(): boolean {
|
||||
if (!this._initialSMTPConfiguration) return true;
|
||||
if (!this._initialSMTPConfiguration) {
|
||||
return true;
|
||||
}
|
||||
|
||||
for (const key of Object.keys(this.smtpForm.getRawValue())) {
|
||||
if (this._initialSMTPConfiguration[key] !== this.smtpForm.get(key).value) {
|
||||
@ -79,7 +81,9 @@ export class GeneralConfigScreenComponent extends AutoUnsubscribe implements OnI
|
||||
}
|
||||
|
||||
get generalConfigurationChanged(): boolean {
|
||||
if (!this._initialGeneralConfiguration) return true;
|
||||
if (!this._initialGeneralConfiguration) {
|
||||
return true;
|
||||
}
|
||||
|
||||
for (const key of Object.keys(this.configForm.getRawValue())) {
|
||||
if (this._initialGeneralConfiguration[key] !== this.configForm.get(key).value) {
|
||||
|
||||
@ -21,7 +21,9 @@ export class CommentsComponent {
|
||||
) {}
|
||||
|
||||
addComment(value: string): void {
|
||||
if (!value) return;
|
||||
if (!value) {
|
||||
return;
|
||||
}
|
||||
this._manualAnnotationService
|
||||
.addComment(value, this.annotation.id)
|
||||
.toPromise()
|
||||
|
||||
@ -42,7 +42,9 @@ export class DossierListingActionsComponent {
|
||||
}
|
||||
|
||||
get statusConfig(): readonly StatusBarConfig<string>[] {
|
||||
if (!this.dossier) return [];
|
||||
if (!this.dossier) {
|
||||
return [];
|
||||
}
|
||||
|
||||
const obj = this.dossier.files.reduce((acc, file) => {
|
||||
const status = file.status;
|
||||
|
||||
@ -5,7 +5,7 @@ import { AppStateService } from '@state/app-state.service';
|
||||
import { FileActionService } from '../../services/file-action.service';
|
||||
import { DossiersDialogService } from '../../services/dossiers-dialog.service';
|
||||
import { ConfirmationDialogInput } from '@shared/dialogs/confirmation-dialog/confirmation-dialog.component';
|
||||
import {AutoUnsubscribe, CircleButtonType, CircleButtonTypes, LoadingService, StatusBarConfig, Toaster} from '@iqser/common-ui';
|
||||
import { AutoUnsubscribe, CircleButtonType, CircleButtonTypes, LoadingService, StatusBarConfig, Toaster } from '@iqser/common-ui';
|
||||
import { FileManagementControllerService, FileStatus } from '@redaction/red-ui-http';
|
||||
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||
import { UserService } from '@services/user.service';
|
||||
|
||||
@ -148,14 +148,18 @@ export class FileWorkloadComponent {
|
||||
primary: NestedFilter[],
|
||||
secondary: NestedFilter[] = []
|
||||
): Map<number, AnnotationWrapper[]> {
|
||||
if (!primary) return;
|
||||
if (!primary) {
|
||||
return;
|
||||
}
|
||||
this.displayedAnnotations = this._annotationProcessingService.filterAndGroupAnnotations(annotations, primary, secondary);
|
||||
this.displayedPages = [...this.displayedAnnotations.keys()];
|
||||
return this.displayedAnnotations;
|
||||
}
|
||||
|
||||
annotationClicked(annotation: AnnotationWrapper, $event: MouseEvent): void {
|
||||
if (($event.target as IqserEventTarget).localName === 'input') return;
|
||||
if (($event.target as IqserEventTarget).localName === 'input') {
|
||||
return;
|
||||
}
|
||||
this.pagesPanelActive = false;
|
||||
this.logAnnotation(annotation);
|
||||
if (this.isSelected(annotation)) {
|
||||
|
||||
@ -112,7 +112,9 @@ export class EditDossierDialogComponent {
|
||||
}
|
||||
|
||||
afterSave() {
|
||||
if (this._data?.afterSave) this._data.afterSave();
|
||||
if (this._data?.afterSave) {
|
||||
this._data.afterSave();
|
||||
}
|
||||
}
|
||||
|
||||
async save() {
|
||||
|
||||
@ -177,11 +177,21 @@ export class DossierListingScreenComponent
|
||||
// Needs work
|
||||
entry.files.forEach(file => {
|
||||
allDistinctFileStatus.add(file.status);
|
||||
if (file.analysisRequired) allDistinctNeedsWork.add('analysis');
|
||||
if (entry.hintsOnly) allDistinctNeedsWork.add('hint');
|
||||
if (entry.hasRedactions) allDistinctNeedsWork.add('redaction');
|
||||
if (entry.hasSuggestions) allDistinctNeedsWork.add('suggestion');
|
||||
if (entry.hasNone) allDistinctNeedsWork.add('none');
|
||||
if (file.analysisRequired) {
|
||||
allDistinctNeedsWork.add('analysis');
|
||||
}
|
||||
if (entry.hintsOnly) {
|
||||
allDistinctNeedsWork.add('hint');
|
||||
}
|
||||
if (entry.hasRedactions) {
|
||||
allDistinctNeedsWork.add('redaction');
|
||||
}
|
||||
if (entry.hasSuggestions) {
|
||||
allDistinctNeedsWork.add('suggestion');
|
||||
}
|
||||
if (entry.hasNone) {
|
||||
allDistinctNeedsWork.add('none');
|
||||
}
|
||||
});
|
||||
|
||||
allDistinctDossierTemplates.add(entry.dossierTemplateId);
|
||||
|
||||
@ -219,7 +219,9 @@ export class DossierOverviewScreenComponent extends ListingComponent<FileStatusW
|
||||
}
|
||||
|
||||
calculateData(): void {
|
||||
if (!this._appStateService.activeDossierId) return;
|
||||
if (!this._appStateService.activeDossierId) {
|
||||
return;
|
||||
}
|
||||
|
||||
this._loadEntitiesFromState();
|
||||
this._computeAllFilters();
|
||||
@ -297,16 +299,22 @@ export class DossierOverviewScreenComponent extends ListingComponent<FileStatusW
|
||||
|
||||
private _loadEntitiesFromState() {
|
||||
this.currentDossier = this._appStateService.activeDossier;
|
||||
if (this.currentDossier) this.entitiesService.setEntities(this.currentDossier.files);
|
||||
if (this.currentDossier) {
|
||||
this.entitiesService.setEntities(this.currentDossier.files);
|
||||
}
|
||||
}
|
||||
|
||||
private async _uploadFiles(files: FileUploadModel[]) {
|
||||
const fileCount = await this._fileUploadService.uploadFiles(files);
|
||||
if (fileCount) this._statusOverlayService.openUploadStatusOverlay();
|
||||
if (fileCount) {
|
||||
this._statusOverlayService.openUploadStatusOverlay();
|
||||
}
|
||||
}
|
||||
|
||||
private _computeAllFilters() {
|
||||
if (!this.currentDossier) return;
|
||||
if (!this.currentDossier) {
|
||||
return;
|
||||
}
|
||||
|
||||
const allDistinctFileStatusWrapper = new Set<string>();
|
||||
const allDistinctPeople = new Set<string>();
|
||||
@ -320,14 +328,30 @@ export class DossierOverviewScreenComponent extends ListingComponent<FileStatusW
|
||||
allDistinctFileStatusWrapper.add(file.status);
|
||||
allDistinctAddedDates.add(moment(file.added).format('DD/MM/YYYY'));
|
||||
|
||||
if (file.analysisRequired) allDistinctNeedsWork.add('analysis');
|
||||
if (file.hintsOnly) allDistinctNeedsWork.add('hint');
|
||||
if (file.hasRedactions) allDistinctNeedsWork.add('redaction');
|
||||
if (file.hasSuggestions) allDistinctNeedsWork.add('suggestion');
|
||||
if (file.hasUpdates) allDistinctNeedsWork.add('updated');
|
||||
if (file.hasImages) allDistinctNeedsWork.add('image');
|
||||
if (file.hasNone) allDistinctNeedsWork.add('none');
|
||||
if (file.hasAnnotationComments) allDistinctNeedsWork.add('comment');
|
||||
if (file.analysisRequired) {
|
||||
allDistinctNeedsWork.add('analysis');
|
||||
}
|
||||
if (file.hintsOnly) {
|
||||
allDistinctNeedsWork.add('hint');
|
||||
}
|
||||
if (file.hasRedactions) {
|
||||
allDistinctNeedsWork.add('redaction');
|
||||
}
|
||||
if (file.hasSuggestions) {
|
||||
allDistinctNeedsWork.add('suggestion');
|
||||
}
|
||||
if (file.hasUpdates) {
|
||||
allDistinctNeedsWork.add('updated');
|
||||
}
|
||||
if (file.hasImages) {
|
||||
allDistinctNeedsWork.add('image');
|
||||
}
|
||||
if (file.hasNone) {
|
||||
allDistinctNeedsWork.add('none');
|
||||
}
|
||||
if (file.hasAnnotationComments) {
|
||||
allDistinctNeedsWork.add('comment');
|
||||
}
|
||||
|
||||
// extract values for dynamic filters
|
||||
this.fileAttributeConfigs.forEach(config => {
|
||||
|
||||
@ -140,7 +140,9 @@ export class SearchScreenComponent extends ListingComponent<ListItem> implements
|
||||
|
||||
private _toListItem({ dossierId, fileId, unmatchedTerms, highlights }: MatchedDocument): ListItem {
|
||||
const fileWrapper = this._getFileWrapper(dossierId, fileId);
|
||||
if (!fileWrapper) return undefined;
|
||||
if (!fileWrapper) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return {
|
||||
id: fileId,
|
||||
|
||||
@ -141,20 +141,28 @@ export class AnnotationProcessingService {
|
||||
}
|
||||
|
||||
private _matchesOne = (filters: NestedFilter[], condition: (filter: NestedFilter) => boolean): boolean => {
|
||||
if (filters.length === 0) return true;
|
||||
if (filters.length === 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
for (const filter of filters) {
|
||||
if (condition(filter)) return true;
|
||||
if (condition(filter)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
private _matchesAll = (filters: NestedFilter[], condition: (filter: NestedFilter) => boolean): boolean => {
|
||||
if (filters.length === 0) return true;
|
||||
if (filters.length === 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
for (const filter of filters) {
|
||||
if (!condition(filter)) return false;
|
||||
if (!condition(filter)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@ -22,7 +22,9 @@ export class AssignUserDropdownComponent {
|
||||
|
||||
@Input()
|
||||
set value(value: UserWrapper | string) {
|
||||
if (this.oldUser === undefined) this.oldUser = value;
|
||||
if (this.oldUser === undefined) {
|
||||
this.oldUser = value;
|
||||
}
|
||||
this._currentUser = value;
|
||||
}
|
||||
|
||||
|
||||
@ -75,7 +75,9 @@ export class DictionaryManagerComponent implements OnChanges, OnInit {
|
||||
.subscribe(entries => {
|
||||
this.diffEditorText = entries;
|
||||
this.showDiffEditor = true;
|
||||
if (this.showDiffEditor) this._diffEditor?.getOriginalEditor().setValue(this.diffEditorText);
|
||||
if (this.showDiffEditor) {
|
||||
this._diffEditor?.getOriginalEditor().setValue(this.diffEditorText);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -145,14 +147,18 @@ export class DictionaryManagerComponent implements OnChanges, OnInit {
|
||||
}
|
||||
|
||||
nextSearchMatch(): void {
|
||||
if (this.findMatches.length <= 0) return;
|
||||
if (this.findMatches.length <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.currentMatch = this.currentMatch < this.findMatches.length ? this.currentMatch + 1 : 1;
|
||||
this._scrollToCurrentMatch();
|
||||
}
|
||||
|
||||
previousSearchMatch(): void {
|
||||
if (this.findMatches.length <= 0) return;
|
||||
if (this.findMatches.length <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.currentMatch = this.currentMatch > 1 ? this.currentMatch - 1 : this.findMatches.length;
|
||||
this._scrollToCurrentMatch();
|
||||
|
||||
@ -42,9 +42,15 @@ export class InitialsAvatarComponent extends AutoUnsubscribe implements OnChange
|
||||
}
|
||||
|
||||
private get _colorClass() {
|
||||
if (this._isCurrentUser) return 'red-white';
|
||||
if (this.disabled) return 'inactive';
|
||||
if (this.color.includes('-')) return this.color;
|
||||
if (this._isCurrentUser) {
|
||||
return 'red-white';
|
||||
}
|
||||
if (this.disabled) {
|
||||
return 'inactive';
|
||||
}
|
||||
if (this.color.includes('-')) {
|
||||
return this.color;
|
||||
}
|
||||
|
||||
return `${this.color}-dark`;
|
||||
}
|
||||
@ -79,7 +85,9 @@ export class InitialsAvatarComponent extends AutoUnsubscribe implements OnChange
|
||||
}
|
||||
|
||||
private _getInitials(): string {
|
||||
if (!this.displayName) return '?';
|
||||
if (!this.displayName) {
|
||||
return '?';
|
||||
}
|
||||
|
||||
return this.displayName
|
||||
.split(' ')
|
||||
|
||||
@ -31,7 +31,9 @@ export class PageHeaderComponent<T> {
|
||||
constructor(@Optional() readonly filterService: FilterService, @Optional() readonly searchService: SearchService<T>) {}
|
||||
|
||||
get _showResetFilters$(): Observable<boolean> {
|
||||
if (!this.filterService) return of(false);
|
||||
if (!this.filterService) {
|
||||
return of(false);
|
||||
}
|
||||
|
||||
return combineLatest([this.filterService.showResetFilters$, this.searchService.valueChanges$]).pipe(
|
||||
map(([showResetFilters, searchValue]) => showResetFilters || !!searchValue),
|
||||
|
||||
@ -72,7 +72,9 @@ export class SelectComponent implements AfterViewInit, ControlValueAccessor {
|
||||
}
|
||||
|
||||
toggleSelection(chip: MatChip): void {
|
||||
if (!this.disabled) chip.toggleSelected(true);
|
||||
if (!this.disabled) {
|
||||
chip.toggleSelected(true);
|
||||
}
|
||||
}
|
||||
|
||||
selectAll($event) {
|
||||
@ -100,6 +102,8 @@ export class SelectComponent implements AfterViewInit, ControlValueAccessor {
|
||||
}
|
||||
|
||||
private _propagateChange(value: any[]): void {
|
||||
if (this._onChange) this._onChange(value);
|
||||
if (this._onChange) {
|
||||
this._onChange(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -62,7 +62,9 @@ export class SimpleDoughnutChartComponent implements OnChanges {
|
||||
calculateChartData() {
|
||||
let angleOffset = -90;
|
||||
this.chartData = this.config.map(dataVal => {
|
||||
if (dataVal.value === 0) return null;
|
||||
if (dataVal.value === 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const res = { degrees: angleOffset };
|
||||
angleOffset = this.dataPercentage(dataVal.value) * 360 + angleOffset;
|
||||
|
||||
@ -79,7 +79,9 @@ export class ConfirmationDialogComponent {
|
||||
translate<T extends ConfirmationDialogInput | string>(obj: T): T {
|
||||
const translateKeys = ['title', 'question', 'details', 'confirmationText', 'alternativeConfirmationText', 'denyText'];
|
||||
|
||||
if (typeof obj === 'string') return this._translateService.instant(obj, this.config.translateParams);
|
||||
if (typeof obj === 'string') {
|
||||
return this._translateService.instant(obj, this.config.translateParams);
|
||||
}
|
||||
|
||||
const stringKeys = Object.keys(obj).filter(key => typeof key === 'string' && !!obj[key] && translateKeys.includes(key));
|
||||
stringKeys.forEach(key => (obj[key] = this.translate(obj[key])));
|
||||
|
||||
@ -31,25 +31,39 @@ export class DatePipe extends BaseDatePipe implements PipeTransform {
|
||||
transform(value: null | undefined, format?: string, timezone?: string, locale?: string): null;
|
||||
transform(value: Date | string | number | null | undefined, format?: string, timezone?: string, locale?: string): string | null;
|
||||
transform(value: any, format?: string, timezone?: string, locale?: string): string {
|
||||
if (format === 'timeFromNow') return this._getTimeFromNow(value);
|
||||
if (format === 'sophisticatedDate') return this._getSophisticatedDate(value);
|
||||
if (format === 'exactDate') return this._getExactDate(value);
|
||||
if (format === 'timeFromNow') {
|
||||
return this._getTimeFromNow(value);
|
||||
}
|
||||
if (format === 'sophisticatedDate') {
|
||||
return this._getSophisticatedDate(value);
|
||||
}
|
||||
if (format === 'exactDate') {
|
||||
return this._getExactDate(value);
|
||||
}
|
||||
return super.transform(value, format, timezone, locale);
|
||||
}
|
||||
|
||||
private _getTimeFromNow(value: string) {
|
||||
const { daysLeft, hoursLeft, minutesLeft } = getLeftDateTime(value);
|
||||
|
||||
if (daysLeft === 0 && hoursLeft === 0 && minutesLeft > 0) return this._translateService.instant('time.less-than-an-hour');
|
||||
if (daysLeft === 0 && hoursLeft === 0 && minutesLeft > 0) {
|
||||
return this._translateService.instant('time.less-than-an-hour');
|
||||
}
|
||||
|
||||
const hoursDisplay = this._translateService.instant('time.hours', { hours: hoursLeft });
|
||||
|
||||
if (daysLeft === 0 && hoursLeft > 0) return hoursDisplay;
|
||||
if (daysLeft === 0 && hoursLeft > 0) {
|
||||
return hoursDisplay;
|
||||
}
|
||||
|
||||
const daysDisplay = this._translateService.instant('time.days', { days: daysLeft });
|
||||
|
||||
if (daysLeft > 0 && hoursLeft > 0) return `${daysDisplay} ${hoursDisplay}`;
|
||||
if (daysLeft > 0) return daysDisplay;
|
||||
if (daysLeft > 0 && hoursLeft > 0) {
|
||||
return `${daysDisplay} ${hoursDisplay}`;
|
||||
}
|
||||
if (daysLeft > 0) {
|
||||
return daysDisplay;
|
||||
}
|
||||
|
||||
return this._translateService.instant(`time.no-time-left`);
|
||||
}
|
||||
@ -67,10 +81,14 @@ export class DatePipe extends BaseDatePipe implements PipeTransform {
|
||||
const thisYear = now.year();
|
||||
|
||||
const isTodayFormat = date.isSame(new Date(), 'day');
|
||||
if (isTodayFormat) return moment(date, ['h:mm A']).format('HH:mm');
|
||||
if (isTodayFormat) {
|
||||
return moment(date, ['h:mm A']).format('HH:mm');
|
||||
}
|
||||
|
||||
const isYesterdayFormat = date.isSame(yesterday, 'd');
|
||||
if (isYesterdayFormat) return this._translateService.instant('yesterday');
|
||||
if (isYesterdayFormat) {
|
||||
return this._translateService.instant('yesterday');
|
||||
}
|
||||
|
||||
const isShortMonthFormat = day < thisDay - 1 && (year === thisYear || month >= thisMonth - 3);
|
||||
if (isShortMonthFormat) {
|
||||
|
||||
@ -40,7 +40,9 @@ export class DictionarySaveService {
|
||||
return obs.pipe(
|
||||
tap(
|
||||
() => {
|
||||
if (showToast) this._toaster.success(_('dictionary-overview.success.generic'));
|
||||
if (showToast) {
|
||||
this._toaster.success(_('dictionary-overview.success.generic'));
|
||||
}
|
||||
},
|
||||
() => this._toaster.error(_('dictionary-overview.error.generic'))
|
||||
)
|
||||
|
||||
@ -118,7 +118,9 @@ export class PermissionsService {
|
||||
|
||||
canDownloadFiles(fileStatus = this._activeFile): boolean {
|
||||
const dossier = this._appStateService.getDossierById(fileStatus?.dossierId);
|
||||
if (!dossier) return false;
|
||||
if (!dossier) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return fileStatus.isApproved && this.isApprover(dossier);
|
||||
}
|
||||
|
||||
@ -116,7 +116,11 @@ export class UserService {
|
||||
|
||||
hasAnyRole(requiredRoles: string[], user: UserWrapper = this._currentUser) {
|
||||
if (requiredRoles?.length > 0) {
|
||||
for (const role of requiredRoles) if (user.roles.indexOf(role) >= 0) return true;
|
||||
for (const role of requiredRoles) {
|
||||
if (user.roles.indexOf(role) >= 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -296,7 +296,9 @@ export class AppStateService {
|
||||
}
|
||||
|
||||
async activateFile(dossierId: string, fileId: string) {
|
||||
if (this.activeDossierId === dossierId && this.activeFileId === fileId) return;
|
||||
if (this.activeDossierId === dossierId && this.activeFileId === fileId) {
|
||||
return;
|
||||
}
|
||||
await this.activateDossier(dossierId);
|
||||
if (this.activeDossier) {
|
||||
this._appState.activeFileId = fileId;
|
||||
|
||||
@ -28,7 +28,9 @@ export class CustomRouteReuseStrategy implements RouteReuseStrategy {
|
||||
}
|
||||
|
||||
store(route: ActivatedRouteSnapshot, handle: DetachedRouteHandle): void {
|
||||
if (handle === null) return;
|
||||
if (handle === null) {
|
||||
return;
|
||||
}
|
||||
CustomRouteReuseStrategy._removeTooltips();
|
||||
|
||||
const element: any = handle;
|
||||
|
||||
@ -1,7 +1,9 @@
|
||||
type StatusSorterItem = { key?: string } | string;
|
||||
|
||||
const byStatus = (a: StatusSorterItem, b: StatusSorterItem) => {
|
||||
if (typeof a !== typeof b) return;
|
||||
if (typeof a !== typeof b) {
|
||||
return;
|
||||
}
|
||||
|
||||
const x = typeof a === 'string' ? a : a.key;
|
||||
const y = typeof b === 'string' ? b : b.key;
|
||||
|
||||
@ -1 +1 @@
|
||||
Subproject commit 6d9806160ac35b0db437c3ea0fbf5596e29fda1e
|
||||
Subproject commit 1afafe0e28239da365d9f1e663763b210b9a9b6f
|
||||
Loading…
x
Reference in New Issue
Block a user