Pull request #238: Manage dossier attributes

Merge in RED/ui from RED-1688 to master

* commit 'e061992b848f5458a0e49c290fbc4305282bfa05':
  Manage dossier attributes
This commit is contained in:
Adina Teudan 2021-07-14 13:18:21 +02:00
commit 1f4befe9f0
26 changed files with 672 additions and 391 deletions

View File

@ -1,6 +1,6 @@
{
"useTabs": false,
"printWidth": 100,
"printWidth": 140,
"tabWidth": 4,
"singleQuote": true,
"trailingComma": "none",

View File

@ -7,7 +7,7 @@ To re-generate http rune swagger
YOu need swagger-codegen installed `brew install swagger-codegen`
```
BASE=https://dev-06.iqser.cloud/
BASE=https://red-staging.iqser.cloud/
URL="$BASE"redaction-gateway-v1/v2/api-docs?group=redaction-gateway-v1
rm -Rf /tmp/swagger
mkdir -p /tmp/swagger

View File

@ -18,6 +18,7 @@ import { AuditScreenComponent } from './screens/audit/audit-screen.component';
import { RouterModule } from '@angular/router';
import { SmtpConfigScreenComponent } from './screens/smtp-config/smtp-config-screen.component';
import { ReportsScreenComponent } from './screens/reports/reports-screen.component';
import { DossierAttributesListingScreenComponent } from './screens/dossier-attributes-listing/dossier-attributes-listing-screen.component';
const routes = [
{ path: '', redirectTo: 'dossier-templates', pathMatch: 'full' },
@ -90,6 +91,14 @@ const routes = [
routeGuards: [AuthGuard, RedRoleGuard, AppStateGuard]
}
},
{
path: 'dossier-attributes',
component: DossierAttributesListingScreenComponent,
canActivate: [CompositeRouteGuard],
data: {
routeGuards: [AuthGuard, RedRoleGuard, AppStateGuard]
}
},
{
path: 'default-colors',
component: DefaultColorsScreenComponent,

View File

@ -34,6 +34,7 @@ export class AdminSideNavComponent {
{ screen: 'default-colors' },
{ screen: 'watermark' },
{ screen: 'file-attributes', onlyAdmin: true },
{ screen: 'dossier-attributes', onlyAdmin: true },
{ screen: 'reports', onlyAdmin: true, onlyDevMode: true }
]
};

View File

@ -36,6 +36,8 @@ import { MonacoEditorModule } from '@materia-ui/ngx-monaco-editor';
import { ReportsScreenComponent } from './screens/reports/reports-screen.component';
import { ResetPasswordComponent } from './dialogs/add-edit-user-dialog/reset-password/reset-password.component';
import { UserDetailsComponent } from './dialogs/add-edit-user-dialog/user-details/user-details.component';
import { AddEditDossierAttributeDialogComponent } from './dialogs/add-edit-dossier-attribute-dialog/add-edit-dossier-attribute-dialog.component';
import { DossierAttributesListingScreenComponent } from './screens/dossier-attributes-listing/dossier-attributes-listing-screen.component';
const dialogs = [
AddEditDossierTemplateDialogComponent,
@ -46,7 +48,8 @@ const dialogs = [
SmtpAuthDialogComponent,
AddEditUserDialogComponent,
ConfirmDeleteUsersDialogComponent,
FileAttributesCsvImportDialogComponent
FileAttributesCsvImportDialogComponent,
AddEditDossierAttributeDialogComponent
];
const screens = [
@ -62,7 +65,8 @@ const screens = [
UserListingScreenComponent,
WatermarkScreenComponent,
SmtpConfigScreenComponent,
ReportsScreenComponent
ReportsScreenComponent,
DossierAttributesListingScreenComponent
];
const components = [
@ -83,13 +87,6 @@ const components = [
@NgModule({
declarations: [...components],
providers: [AdminDialogService],
imports: [
CommonModule,
SharedModule,
AdminRoutingModule,
NgxChartsModule,
ColorPickerModule,
MonacoEditorModule
]
imports: [CommonModule, SharedModule, AdminRoutingModule, NgxChartsModule, ColorPickerModule, MonacoEditorModule]
})
export class AdminModule {}

View File

@ -0,0 +1,48 @@
<section class="dialog">
<div class="dialog-header heading-l">
{{
(dossierAttribute ? 'add-edit-dossier-attribute.title.edit' : 'add-edit-dossier-attribute.title.new')
| translate: { name: dossierAttribute?.label }
}}
</div>
<form (submit)="saveFileAttribute()" [formGroup]="dossierAttributeForm">
<div class="dialog-content">
<div class="red-input-group required w-300">
<label translate="add-edit-dossier-attribute.form.label"></label>
<input
formControlName="label"
name="label"
placeholder="{{ 'add-edit-dossier-attribute.form.label-placeholder' | translate }}"
type="text"
/>
</div>
<div class="red-input-group required w-300">
<label translate="add-edit-dossier-attribute.form.placeholder"></label>
<input
formControlName="placeholder"
name="placeholder"
placeholder="{{ 'add-edit-dossier-attribute.form.placeholder-placeholder' | translate }}"
type="text"
/>
</div>
<div class="red-input-group w-300 required">
<label translate="add-edit-dossier-attribute.form.type"></label>
<mat-select formControlName="type">
<mat-option *ngFor="let type of typeOptions" [value]="type">
{{ 'dossier-attribute-types.' + type | translate }}
</mat-option>
</mat-select>
</div>
</div>
<div class="dialog-actions">
<button [disabled]="dossierAttributeForm.invalid || !changed" color="primary" mat-flat-button type="submit">
{{ 'add-edit-dossier-attribute.save' | translate }}
</button>
</div>
</form>
<redaction-circle-button class="dialog-close" icon="red:close" mat-dialog-close></redaction-circle-button>
</section>

View File

@ -0,0 +1,85 @@
import { Component, Inject } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { DossierAttributeConfig, DossierAttributesControllerService, FileAttributeConfig } from '@redaction/red-ui-http';
import { AppStateService } from '../../../../state/app-state.service';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
import { LoadingService } from '../../../../services/loading.service';
import { ErrorMessageService } from '../../../../services/error-message.service';
import { NotificationService, NotificationType } from '../../../../services/notification.service';
import { HttpErrorResponse } from '@angular/common/http';
@Component({
selector: 'redaction-add-edit-dossier-attribute-dialog',
templateUrl: './add-edit-dossier-attribute-dialog.component.html',
styleUrls: ['./add-edit-dossier-attribute-dialog.component.scss']
})
export class AddEditDossierAttributeDialogComponent {
dossierAttributeForm: FormGroup;
dossierAttribute: DossierAttributeConfig;
dossierTemplateId: string;
readonly typeOptions = [
DossierAttributeConfig.TypeEnum.TEXT,
DossierAttributeConfig.TypeEnum.NUMBER,
DossierAttributeConfig.TypeEnum.DATE,
DossierAttributeConfig.TypeEnum.IMAGE
];
constructor(
private readonly _appStateService: AppStateService,
private readonly _formBuilder: FormBuilder,
private readonly _loadingService: LoadingService,
private readonly _dossierAttributesService: DossierAttributesControllerService,
private readonly _errorMessageService: ErrorMessageService,
private readonly _notificationService: NotificationService,
public dialogRef: MatDialogRef<AddEditDossierAttributeDialogComponent>,
@Inject(MAT_DIALOG_DATA)
public data: { dossierAttribute: DossierAttributeConfig; dossierTemplateId: string }
) {
this.dossierAttribute = data.dossierAttribute;
this.dossierTemplateId = data.dossierTemplateId;
this.dossierAttributeForm = this._formBuilder.group({
label: [this.dossierAttribute?.label, Validators.required],
placeholder: [this.dossierAttribute?.placeholder, Validators.required],
type: [this.dossierAttribute?.type || FileAttributeConfig.TypeEnum.TEXT, Validators.required]
});
}
get changed(): boolean {
if (!this.dossierAttribute) return true;
for (const key of Object.keys(this.dossierAttributeForm.getRawValue())) {
if (this.dossierAttribute[key] !== this.dossierAttributeForm.get(key).value) {
return true;
}
}
return false;
}
saveFileAttribute() {
this._loadingService.start();
const attribute: DossierAttributeConfig = {
id: this.dossierAttribute?.id,
editable: true,
...this.dossierAttributeForm.getRawValue()
};
this._dossierAttributesService
.addOrUpdateDossierAttributesConfig(attribute, this._appStateService.activeDossierTemplateId)
.subscribe(
() => {
this.dialogRef.close(true);
},
(err: HttpErrorResponse) => {
this._loadingService.stop();
this._notificationService.showToastNotification(
this._errorMessageService.getMessage(err, 'add-edit-dossier-attribute.error.generic'),
null,
NotificationType.ERROR
);
}
);
}
}

View File

@ -0,0 +1,139 @@
<section>
<div class="page-header">
<redaction-admin-breadcrumbs class="flex-1"></redaction-admin-breadcrumbs>
<div class="actions flex-1">
<redaction-dossier-template-actions></redaction-dossier-template-actions>
<redaction-circle-button
[routerLink]="['../..']"
icon="red:close"
tooltip="common.close"
tooltipPosition="below"
></redaction-circle-button>
</div>
</div>
<div class="red-content-inner">
<div class="overlay-shadow"></div>
<redaction-admin-side-nav type="dossier-templates"></redaction-admin-side-nav>
<div class="content-container">
<div *ngIf="allEntities.length" class="header-item">
<div class="select-all-container">
<redaction-round-checkbox
(click)="toggleSelectAll()"
[active]="areAllEntitiesSelected"
[indeterminate]="areSomeEntitiesSelected && !areAllEntitiesSelected"
></redaction-round-checkbox>
</div>
<span class="all-caps-label">
{{ 'dossier-attributes-listing.table-header.title' | translate: { length: displayedEntities.length } }}
</span>
<redaction-circle-button
(action)="openConfirmDeleteAttributeDialog($event)"
*ngIf="areSomeEntitiesSelected"
icon="red:trash"
tooltip="dossier-attributes-listing.bulk.delete"
type="dark-bg"
></redaction-circle-button>
<div class="attributes-actions-container">
<redaction-input-with-action
[form]="searchForm"
placeholder="dossier-attributes-listing.search"
type="search"
></redaction-input-with-action>
<redaction-icon-button
(action)="openAddEditAttributeDialog($event)"
icon="red:plus"
text="dossier-attributes-listing.add-new"
type="primary"
></redaction-icon-button>
</div>
</div>
<div *ngIf="allEntities.length" class="table-header" redactionSyncWidth="table-item">
<div class="select-oval-placeholder"></div>
<redaction-table-col-name
(toggleSort)="toggleSort($event)"
[activeSortingOption]="sortingOption"
[withSort]="true"
column="label"
label="dossier-attributes-listing.table-col-names.label"
></redaction-table-col-name>
<redaction-table-col-name label="dossier-attributes-listing.table-col-names.placeholder"></redaction-table-col-name>
<redaction-table-col-name
(toggleSort)="toggleSort($event)"
[activeSortingOption]="sortingOption"
[withSort]="true"
column="type"
label="dossier-attributes-listing.table-col-names.type"
></redaction-table-col-name>
<div></div>
<div class="scrollbar-placeholder"></div>
</div>
<redaction-empty-state
(action)="openAddEditAttributeDialog($event)"
*ngIf="!allEntities.length"
[showButton]="true"
icon="red:attribute"
screen="dossier-attributes-listing"
></redaction-empty-state>
<redaction-empty-state
*ngIf="allEntities.length && !displayedEntities.length"
screen="dossier-attributes-listing"
type="no-match"
></redaction-empty-state>
<cdk-virtual-scroll-viewport [itemSize]="50" redactionHasScrollbar>
<div
*cdkVirtualFor="let attribute of displayedEntities | sortBy: sortingOption.order:sortingOption.column"
class="table-item pointer"
>
<div (click)="toggleEntitySelected($event, attribute)" class="selection-column">
<redaction-round-checkbox [active]="isSelected(attribute)"></redaction-round-checkbox>
</div>
<div>
{{ attribute.label }}
</div>
<div class="small-label">
{{ attribute.placeholder }}
</div>
<div class="small-label">
{{ 'dossier-attribute-types.' + attribute.type | translate }}
</div>
<div class="actions-container">
<div class="action-buttons">
<redaction-circle-button
(action)="openAddEditAttributeDialog($event, attribute)"
icon="red:edit"
tooltip="dossier-attributes-listing.action.edit"
type="dark-bg"
>
</redaction-circle-button>
<redaction-circle-button
(action)="openConfirmDeleteAttributeDialog($event, attribute)"
icon="red:trash"
tooltip="file-attributes-listing.action.delete"
type="dark-bg"
>
</redaction-circle-button>
</div>
</div>
<div class="scrollbar-placeholder"></div>
</div>
</cdk-virtual-scroll-viewport>
</div>
</div>
</section>

View File

@ -0,0 +1,50 @@
@import '../../../../../assets/styles/red-mixins';
.page-header .actions {
display: flex;
justify-content: flex-end;
}
.header-item {
padding: 0 24px 0 10px;
}
redaction-table-col-name::ng-deep {
> div {
padding-left: 10px !important;
}
}
.content-container {
.header-item {
.attributes-actions-container {
display: flex;
flex: 1;
justify-content: flex-end;
> *:not(:last-child) {
margin-right: 10px;
}
}
}
cdk-virtual-scroll-viewport {
::ng-deep.cdk-virtual-scroll-content-wrapper {
grid-template-columns: auto 2fr 2fr 1fr 1fr 11px;
.table-item > div {
height: 50px;
&:not(.scrollbar-placeholder) {
padding-left: 10px;
}
}
}
&.has-scrollbar:hover {
::ng-deep.cdk-virtual-scroll-content-wrapper {
grid-template-columns: auto 2fr 2fr 1fr 1fr;
}
}
}
}

View File

@ -0,0 +1,66 @@
import { Component, Injector, OnInit } from '@angular/core';
import { BaseListingComponent } from '../../../shared/base/base-listing.component';
import { DossierAttributeConfig, DossierAttributesControllerService } from '@redaction/red-ui-http';
import { AppStateService } from '../../../../state/app-state.service';
import { ActivatedRoute } from '@angular/router';
import { AdminDialogService } from '../../services/admin-dialog.service';
import { LoadingService } from '../../../../services/loading.service';
@Component({
selector: 'redaction-dossier-attributes',
templateUrl: './dossier-attributes-listing-screen.component.html',
styleUrls: ['./dossier-attributes-listing-screen.component.scss']
})
export class DossierAttributesListingScreenComponent extends BaseListingComponent<DossierAttributeConfig> implements OnInit {
protected readonly _searchKey = 'label';
protected readonly _selectionKey = 'id';
protected readonly _sortKey = 'dossier-attributes-listing';
constructor(
protected readonly _injector: Injector,
private readonly _appStateService: AppStateService,
private readonly _activatedRoute: ActivatedRoute,
private readonly _dialogService: AdminDialogService,
private readonly _loadingService: LoadingService,
private readonly _dossierAttributesService: DossierAttributesControllerService
) {
super(_injector);
this._appStateService.activateDossierTemplate(_activatedRoute.snapshot.params.dossierTemplateId);
}
async ngOnInit() {
await this._loadData();
}
openConfirmDeleteAttributeDialog($event: MouseEvent, dossierAttribute?: DossierAttributeConfig) {
this._dialogService.openDialog('confirm', $event, null, async () => {
this._loadingService.start();
const ids = dossierAttribute ? [dossierAttribute.id] : this.selectedEntitiesIds;
await this._dossierAttributesService
.deleteDossierAttributesConfig(ids, this._appStateService.activeDossierTemplateId)
.toPromise();
await this._loadData();
});
}
openAddEditAttributeDialog($event: MouseEvent, dossierAttribute?: DossierAttributeConfig) {
const dossierTemplateId = this._appStateService.activeDossierTemplateId;
this._dialogService.openDialog(
'addEditDossierAttribute',
$event,
{ dossierAttribute, dossierTemplateId },
async () => await this._loadData()
);
}
private async _loadData() {
this._loadingService.start();
const response = await this._dossierAttributesService
.getDossierAttributesConfig(this._appStateService.activeDossierTemplateId)
.toPromise();
this.allEntities = response?.dossierAttributeConfigs || [];
this._executeSearchImmediately();
this._loadingService.stop();
}
}

View File

@ -3,6 +3,8 @@
<redaction-admin-breadcrumbs class="flex-1"></redaction-admin-breadcrumbs>
<div class="actions flex-1">
<redaction-dossier-template-actions></redaction-dossier-template-actions>
<redaction-circle-button
[routerLink]="['../..']"
icon="red:close"
@ -28,10 +30,7 @@
</div>
<span class="all-caps-label">
{{
'file-attributes-listing.table-header.title'
| translate: { length: displayedEntities.length }
}}
{{ 'file-attributes-listing.table-header.title' | translate: { length: displayedEntities.length } }}
</span>
<redaction-circle-button
@ -49,13 +48,7 @@
placeholder="file-attributes-listing.search"
type="search"
></redaction-input-with-action>
<input
#fileInput
(change)="importCSV($event.target['files'])"
accept=".csv"
class="csv-input"
type="file"
/>
<input #fileInput (change)="importCSV($event.target['files'])" accept=".csv" class="csv-input" type="file" />
<redaction-circle-button
(action)="fileInput.click()"
@ -74,11 +67,7 @@
</div>
</div>
<div
[class.no-data]="!allEntities.length"
class="table-header"
redactionSyncWidth="table-item"
>
<div [class.no-data]="!allEntities.length" class="table-header" redactionSyncWidth="table-item">
<div class="select-oval-placeholder"></div>
<redaction-table-col-name
@ -106,9 +95,7 @@
label="file-attributes-listing.table-col-names.read-only"
></redaction-table-col-name>
<redaction-table-col-name
label="file-attributes-listing.table-col-names.csv-column"
></redaction-table-col-name>
<redaction-table-col-name label="file-attributes-listing.table-col-names.csv-column"></redaction-table-col-name>
<redaction-table-col-name
class="flex-center"
@ -137,26 +124,18 @@
<cdk-virtual-scroll-viewport [itemSize]="80" redactionHasScrollbar>
<!-- Table lines -->
<div
*cdkVirtualFor="
let attribute of displayedEntities
| sortBy: sortingOption.order:sortingOption.column
"
*cdkVirtualFor="let attribute of displayedEntities | sortBy: sortingOption.order:sortingOption.column"
class="table-item"
>
<div (click)="toggleEntitySelected($event, attribute)" class="selection-column">
<redaction-round-checkbox
[active]="isSelected(attribute)"
></redaction-round-checkbox>
<redaction-round-checkbox [active]="isSelected(attribute)"></redaction-round-checkbox>
</div>
<div class="label">
<span>{{ attribute.label }}</span>
</div>
<div
[translate]="'file-attribute-types.' + attribute.type"
class="small-label"
></div>
<div [translate]="'file-attribute-types.' + attribute.type" class="small-label"></div>
<div class="center read-only">
<mat-icon
@ -170,11 +149,7 @@
{{ attribute.csvColumnHeader }}
</div>
<div class="center">
<redaction-round-checkbox
*ngIf="attribute.primaryAttribute"
[active]="true"
[size]="18"
></redaction-round-checkbox>
<redaction-round-checkbox *ngIf="attribute.primaryAttribute" [active]="true" [size]="18"></redaction-round-checkbox>
</div>
<div class="actions-container">
<div class="action-buttons">

View File

@ -1,10 +1,6 @@
import { Component, ElementRef, Injector, OnInit, ViewChild } from '@angular/core';
import { PermissionsService } from '@services/permissions.service';
import {
FileAttributeConfig,
FileAttributesConfig,
FileAttributesControllerService
} from '@redaction/red-ui-http';
import { FileAttributeConfig, FileAttributesConfig, FileAttributesControllerService } from '@redaction/red-ui-http';
import { AppStateService } from '@state/app-state.service';
import { ActivatedRoute } from '@angular/router';
import { AdminDialogService } from '../../services/admin-dialog.service';
@ -16,10 +12,7 @@ import { LoadingService } from '../../../../services/loading.service';
templateUrl: './file-attributes-listing-screen.component.html',
styleUrls: ['./file-attributes-listing-screen.component.scss']
})
export class FileAttributesListingScreenComponent
extends BaseListingComponent<FileAttributeConfig>
implements OnInit
{
export class FileAttributesListingScreenComponent extends BaseListingComponent<FileAttributeConfig> implements OnInit {
protected readonly _searchKey = 'label';
protected readonly _selectionKey = 'id';
protected readonly _sortKey = 'file-attributes-listing';
@ -37,9 +30,7 @@ export class FileAttributesListingScreenComponent
protected readonly _injector: Injector
) {
super(_injector);
this._appStateService.activateDossierTemplate(
_activatedRoute.snapshot.params.dossierTemplateId
);
this._appStateService.activateDossierTemplate(_activatedRoute.snapshot.params.dossierTemplateId);
}
async ngOnInit() {
@ -54,10 +45,7 @@ export class FileAttributesListingScreenComponent
async newValue => {
this._loadingService.start();
await this._fileAttributesService
.setFileAttributesConfiguration(
newValue,
this._appStateService.activeDossierTemplateId
)
.setFileAttributesConfiguration(newValue, this._appStateService.activeDossierTemplateId)
.toPromise();
await this._loadData();
}
@ -69,17 +57,11 @@ export class FileAttributesListingScreenComponent
this._loadingService.start();
if (fileAttribute) {
await this._fileAttributesService
.deleteFileAttribute(
this._appStateService.activeDossierTemplateId,
fileAttribute.id
)
.deleteFileAttribute(this._appStateService.activeDossierTemplateId, fileAttribute.id)
.toPromise();
} else {
await this._fileAttributesService
.deleteFileAttributes(
this.selectedEntitiesIds,
this._appStateService.activeDossierTemplateId
)
.deleteFileAttributes(this.selectedEntitiesIds, this._appStateService.activeDossierTemplateId)
.toPromise();
}
await this._loadData();

View File

@ -3,6 +3,8 @@
<redaction-admin-breadcrumbs class="flex-1"></redaction-admin-breadcrumbs>
<div class="actions flex-1">
<redaction-dossier-template-actions></redaction-dossier-template-actions>
<redaction-circle-button
[routerLink]="['../..']"
icon="red:close"
@ -33,8 +35,7 @@
<ng-container *ngFor="let placeholder of placeholders">
<div class="placeholder">{{ getPlaceholderDisplayValue(placeholder) }}</div>
<div class="description">
What is and how to use it in your document. The readable content of a page
when looking at its layout must be nice.
What is and how to use it in your document. The readable content of a page when looking at its layout must be nice.
</div>
</ng-container>
</div>

View File

@ -12,12 +12,7 @@ import { LoadingService } from '../../../../services/loading.service';
styleUrls: ['./reports-screen.component.scss']
})
export class ReportsScreenComponent implements OnInit {
placeholders: string[] = [
'report',
'predefined placeholder 1',
'signature 01',
'new attribute'
];
placeholders: string[] = ['report', 'predefined placeholder 1', 'signature 01', 'new attribute'];
availableTemplates: ReportTemplate[];
@ViewChild('fileInput') private _fileInput: ElementRef;
@ -29,9 +24,7 @@ export class ReportsScreenComponent implements OnInit {
private readonly _dialogService: AdminDialogService,
private readonly _loadingService: LoadingService
) {
this._appStateService.activateDossierTemplate(
_activatedRoute.snapshot.params.dossierTemplateId
);
this._appStateService.activateDossierTemplate(_activatedRoute.snapshot.params.dossierTemplateId);
}
getPlaceholderDisplayValue(placeholder: string): string {
@ -47,9 +40,7 @@ export class ReportsScreenComponent implements OnInit {
this._loadingService.start();
const file = $event.target.files[0];
await this._reportTemplateService
.uploadTemplateForm(this._appStateService.activeDossierTemplateId, file)
.toPromise();
await this._reportTemplateService.uploadTemplateForm(this._appStateService.activeDossierTemplateId, file).toPromise();
this._fileInput.nativeElement.value = null;
await this._loadReportTemplates();
@ -65,9 +56,7 @@ export class ReportsScreenComponent implements OnInit {
deleteTemplate(template: ReportTemplate) {
this._dialogService.openDialog('confirm', null, null, async () => {
this._loadingService.start();
await this._reportTemplateService
.deleteTemplate(template.dossierTemplateId, template.templateId)
.toPromise();
await this._reportTemplateService.deleteTemplate(template.dossierTemplateId, template.templateId).toPromise();
await this._loadReportTemplates();
});
}

View File

@ -3,6 +3,8 @@
<redaction-admin-breadcrumbs class="flex-1"></redaction-admin-breadcrumbs>
<div class="actions flex-1">
<redaction-dossier-template-actions></redaction-dossier-template-actions>
<redaction-circle-button
[routerLink]="['../..']"
icon="red:close"
@ -27,11 +29,7 @@
text="watermark-screen.action.save"
type="primary"
></redaction-icon-button>
<div
(click)="revert()"
class="all-caps-label cancel"
translate="watermark-screen.action.revert"
></div>
<div (click)="revert()" class="all-caps-label cancel" translate="watermark-screen.action.revert"></div>
</div>
</div>
@ -52,10 +50,7 @@
</div>
<div class="red-input-group">
<label
class="all-caps-label mb-8"
translate="watermark-screen.form.orientation"
></label>
<label class="all-caps-label mb-8" translate="watermark-screen.form.orientation"></label>
<div class="square-options">
<div
(click)="setValue('orientation', option)"
@ -70,34 +65,17 @@
</div>
<div class="red-input-group">
<label
class="all-caps-label"
translate="watermark-screen.form.font-size"
></label>
<mat-slider
(change)="configChanged()"
color="primary"
formControlName="fontSize"
max="50"
min="5"
></mat-slider>
<label class="all-caps-label" translate="watermark-screen.form.font-size"></label>
<mat-slider (change)="configChanged()" color="primary" formControlName="fontSize" max="50" min="5"></mat-slider>
</div>
<div class="red-input-group">
<label class="all-caps-label" translate="watermark-screen.form.opacity"></label>
<mat-slider
(change)="configChanged()"
color="primary"
formControlName="opacity"
min="1"
></mat-slider>
<mat-slider (change)="configChanged()" color="primary" formControlName="opacity" min="1"></mat-slider>
</div>
<div class="red-input-group w-150">
<label
class="all-caps-label mb-5"
translate="watermark-screen.form.color"
></label>
<label class="all-caps-label mb-5" translate="watermark-screen.form.color"></label>
<input
class="hex-color-input"
formControlName="hexColor"
@ -117,20 +95,14 @@
class="input-icon"
>
<mat-icon
*ngIf="
!configForm.get('hexColor')?.value ||
configForm.get('hexColor').value?.length === 0
"
*ngIf="!configForm.get('hexColor')?.value || configForm.get('hexColor').value?.length === 0"
svgIcon="red:color-picker"
></mat-icon>
</div>
</div>
<div class="red-input-group">
<label
class="all-caps-label mb-8"
translate="watermark-screen.form.font-type"
></label>
<label class="all-caps-label mb-8" translate="watermark-screen.form.font-type"></label>
<div class="square-options">
<div
(click)="setValue('fontType', option.value)"
@ -154,6 +126,4 @@
</div>
</section>
<redaction-full-page-loading-indicator
[displayed]="!viewReady"
></redaction-full-page-loading-indicator>
<redaction-full-page-loading-indicator [displayed]="!viewReady"></redaction-full-page-loading-indicator>

View File

@ -47,9 +47,7 @@ export class WatermarkScreenComponent implements OnInit {
private readonly _formBuilder: FormBuilder,
private readonly _activatedRoute: ActivatedRoute
) {
this.appStateService.activateDossierTemplate(
_activatedRoute.snapshot.params.dossierTemplateId
);
this.appStateService.activateDossierTemplate(_activatedRoute.snapshot.params.dossierTemplateId);
this._initForm();
}
@ -80,22 +78,15 @@ export class WatermarkScreenComponent implements OnInit {
};
const observable = watermark.text
? this._watermarkControllerService.saveWatermark(
watermark,
this.appStateService.activeDossierTemplateId
)
: this._watermarkControllerService.deleteWatermark(
this.appStateService.activeDossierTemplateId
);
? this._watermarkControllerService.saveWatermark(watermark, this.appStateService.activeDossierTemplateId)
: this._watermarkControllerService.deleteWatermark(this.appStateService.activeDossierTemplateId);
observable.subscribe(
() => {
this._loadWatermark();
this._notificationService.showToastNotification(
this._translateService.instant(
watermark.text
? 'watermark-screen.action.change-success'
: 'watermark-screen.action.delete-success'
watermark.text ? 'watermark-screen.action.change-success' : 'watermark-screen.action.delete-success'
),
null,
NotificationType.SUCCESS
@ -126,20 +117,18 @@ export class WatermarkScreenComponent implements OnInit {
}
private _loadWatermark() {
this._watermarkControllerService
.getWatermark(this.appStateService.activeDossierTemplateId)
.subscribe(
watermark => {
this._watermark = watermark;
this.configForm.setValue({ ...this._watermark });
this._loadViewer();
},
() => {
this._watermark = DEFAULT_WATERMARK;
this.configForm.setValue({ ...this._watermark });
this._loadViewer();
}
);
this._watermarkControllerService.getWatermark(this.appStateService.activeDossierTemplateId).subscribe(
watermark => {
this._watermark = watermark;
this.configForm.setValue({ ...this._watermark });
this._loadViewer();
},
() => {
this._watermark = DEFAULT_WATERMARK;
this.configForm.setValue({ ...this._watermark });
this._loadViewer();
}
);
}
private _loadViewer() {
@ -186,22 +175,11 @@ export class WatermarkScreenComponent implements OnInit {
const text = this.configForm.get('text').value || '';
const fontSize = this.configForm.get('fontSize').value;
const fontType = this.configForm.get('fontType').value;
const orientation: WatermarkModelRes.OrientationEnum =
this.configForm.get('orientation').value;
const orientation: WatermarkModelRes.OrientationEnum = this.configForm.get('orientation').value;
const opacity = this.configForm.get('opacity').value;
const color = this.configForm.get('hexColor').value;
await stampPDFPage(
document,
pdfNet,
text,
fontSize,
fontType,
orientation,
opacity,
color,
1
);
await stampPDFPage(document, pdfNet, text, fontSize, fontType, orientation, opacity, color, 1);
this._instance.docViewer.refreshAll();
this._instance.docViewer.updateView([0], 0);
this._changeDetectorRef.detectChanges();
@ -210,26 +188,11 @@ export class WatermarkScreenComponent implements OnInit {
private _initForm() {
this.configForm = this._formBuilder.group({
text: [{ value: null, disabled: !this.permissionsService.isAdmin() }],
hexColor: [
{ value: null, disabled: !this.permissionsService.isAdmin() },
Validators.required
],
opacity: [
{ value: null, disabled: !this.permissionsService.isAdmin() },
Validators.required
],
fontSize: [
{ value: null, disabled: !this.permissionsService.isAdmin() },
Validators.required
],
fontType: [
{ value: null, disabled: !this.permissionsService.isAdmin() },
Validators.required
],
orientation: [
{ value: null, disabled: !this.permissionsService.isAdmin() },
Validators.required
]
hexColor: [{ value: null, disabled: !this.permissionsService.isAdmin() }, Validators.required],
opacity: [{ value: null, disabled: !this.permissionsService.isAdmin() }, Validators.required],
fontSize: [{ value: null, disabled: !this.permissionsService.isAdmin() }, Validators.required],
fontType: [{ value: null, disabled: !this.permissionsService.isAdmin() }, Validators.required],
orientation: [{ value: null, disabled: !this.permissionsService.isAdmin() }, Validators.required]
});
}
}

View File

@ -12,6 +12,7 @@ import { ConfirmDeleteUsersDialogComponent } from '../dialogs/confirm-delete-use
import { FileAttributesCsvImportDialogComponent } from '../dialogs/file-attributes-csv-import-dialog/file-attributes-csv-import-dialog.component';
import { ComponentType } from '@angular/cdk/portal';
import { DialogService } from '../../shared/services/dialog.service';
import { AddEditDossierAttributeDialogComponent } from '../dialogs/add-edit-dossier-attribute-dialog/add-edit-dossier-attribute-dialog.component';
type DialogType =
| 'confirm'
@ -23,7 +24,8 @@ type DialogType =
| 'addEditUser'
| 'deleteUsers'
| 'smtpAuthConfig'
| 'addEditDossierTemplate';
| 'addEditDossierTemplate'
| 'addEditDossierAttribute';
type AdminDialogConfig = {
[key in DialogType]: {
@ -72,6 +74,10 @@ export class AdminDialogService extends DialogService<DialogType> {
addEditDossierTemplate: {
component: AddEditDossierTemplateDialogComponent,
dialogConfig: { width: '900px', autoFocus: true }
},
addEditDossierAttribute: {
component: AddEditDossierAttributeDialogComponent,
dialogConfig: { autoFocus: true }
}
};

View File

@ -1,7 +1,7 @@
import { ApplicationRef, Injectable } from '@angular/core';
import { FileUploadModel } from '../model/file-upload.model';
import { AppStateService } from '@state/app-state.service';
import { HttpEventType } from '@angular/common/http';
import { HttpErrorResponse, HttpEventType } from '@angular/common/http';
import { interval, Subscription } from 'rxjs';
import { AppConfigKey, AppConfigService } from '@app-config/app-config.service';
import { TranslateService } from '@ngx-translate/core';
@ -9,6 +9,7 @@ import { UploadDownloadDialogService } from './upload-download-dialog.service';
import { toNumber } from '@utils/functions';
import { UploadControllerService } from '@redaction/red-ui-http';
import { isCsv } from '@utils/file-drop-utils';
import { ErrorMessageService } from '@services/error-message.service';
export interface ActiveUpload {
subscription: Subscription;
@ -31,19 +32,17 @@ export class FileUploadService {
private readonly _translateService: TranslateService,
private readonly _appConfigService: AppConfigService,
private readonly _uploadControllerService: UploadControllerService,
private readonly _dialogService: UploadDownloadDialogService
private readonly _dialogService: UploadDownloadDialogService,
private readonly _errorMessageService: ErrorMessageService
) {
this._uploadControllerService.defaultHeaders =
this._uploadControllerService.defaultHeaders.append('ngsw-bypass', 'true');
this._uploadControllerService.defaultHeaders = this._uploadControllerService.defaultHeaders.append('ngsw-bypass', 'true');
interval(2500).subscribe(() => {
this._handleUploads();
});
}
get activeDossierKeys() {
return Object.keys(this.groupedFiles).filter(
dossierId => this.groupedFiles[dossierId].length > 0
);
return Object.keys(this.groupedFiles).filter(dossierId => this.groupedFiles[dossierId].length > 0);
}
scheduleUpload(item: FileUploadModel) {
@ -133,18 +132,12 @@ export class FileUploadService {
}
private _handleUploads() {
if (
this._activeUploads.length < FileUploadService.MAX_PARALLEL_UPLOADS &&
this._pendingUploads.length > 0
) {
if (this._activeUploads.length < FileUploadService.MAX_PARALLEL_UPLOADS && this._pendingUploads.length > 0) {
let cnt = FileUploadService.MAX_PARALLEL_UPLOADS - this._activeUploads.length;
while (cnt > 0 && this._pendingUploads.length > 0) {
// Only schedule CSVs when no other file types in queue.
// CSVs are sorted at the end of `_pendingUploads`.
if (
isCsv(this._pendingUploads[0]) &&
this._activeUploads.filter(upload => !isCsv(upload.fileUploadModel)).length > 0
) {
if (isCsv(this._pendingUploads[0]) && this._activeUploads.filter(upload => !isCsv(upload.fileUploadModel)).length > 0) {
return;
}
@ -161,18 +154,11 @@ export class FileUploadService {
private _createSubscription(uploadFile: FileUploadModel) {
this.activeUploads++;
const obs = this._uploadControllerService.uploadFileForm(
uploadFile.dossierId,
uploadFile.file,
'events',
true
);
const obs = this._uploadControllerService.uploadFileForm(uploadFile.dossierId, uploadFile.file, 'events', true);
return obs.subscribe(
async event => {
if (event.type === HttpEventType.UploadProgress) {
uploadFile.progress = Math.round(
(event.loaded / (event.total || event.loaded)) * 100
);
uploadFile.progress = Math.round((event.loaded / (event.total || event.loaded)) * 100);
this._applicationRef.tick();
}
if (event.type === HttpEventType.Response) {
@ -189,15 +175,11 @@ export class FileUploadService {
await this._appStateService.reloadActiveDossierFiles();
}
},
err => {
(err: HttpErrorResponse) => {
uploadFile.completed = true;
uploadFile.error = {
// Extract error message
message:
this._translateService.instant('upload-status.error.generic') +
(err?.error?.message?.includes('message')
? ` ${err.error.message.match('"message":"(.*?)\\"')[1]}`
: '')
message: this._errorMessageService.getMessage(err, 'upload-status.error.generic')
};
this._removeUpload(uploadFile);
if (uploadFile.retryCount < 5 && err.status !== 400) {

View File

@ -0,0 +1,18 @@
import { Injectable } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { HttpErrorResponse } from '@angular/common/http';
@Injectable({
providedIn: 'root'
})
export class ErrorMessageService {
constructor(private readonly _translateService: TranslateService) {}
_parseErrorResponse(err: HttpErrorResponse) {
return err?.error?.message?.includes('message') ? ` ${err.error.message.match('"message":"(.*?)\\"')[1]}` : '';
}
getMessage(err: HttpErrorResponse, defaultMessage: string) {
return this._translateService.instant(defaultMessage) + this._parseErrorResponse(err);
}
}

View File

@ -11,7 +11,8 @@ export type ScreenName =
| 'dictionary-listing'
| 'dossier-templates-listing'
| 'default-colors'
| 'file-attributes-listing';
| 'file-attributes-listing'
| 'dossier-attributes-listing';
@Injectable({
providedIn: 'root'
@ -23,7 +24,8 @@ export class SortingService {
'dictionary-listing': { column: 'label', order: 'asc' },
'dossier-templates-listing': { column: 'name', order: 'asc' },
'default-colors': { column: 'key', order: 'asc' },
'file-attributes-listing': { column: 'label', order: 'asc' }
'file-attributes-listing': { column: 'label', order: 'asc' },
'dossier-attributes-listing': { column: 'label', order: 'asc' }
};
toggleSort(screen: ScreenName, column: string) {

View File

@ -5,7 +5,7 @@ export class GlobalErrorHandler extends ErrorHandler {
handleError(error: Error): void {
const chunkFailedMessage = /Loading chunk [\d]+ failed/;
if (chunkFailedMessage.test(error.message)) {
if (chunkFailedMessage.test(error?.message)) {
window.location.reload();
}

View File

@ -1,6 +1,6 @@
{
"OAUTH_URL": "https://dev-06.iqser.cloud/auth/realms/redaction",
"API_URL": "https://dev-06.iqser.cloud/redaction-gateway-v1",
"OAUTH_URL": "https://red-staging.iqser.cloud/auth/realms/redaction",
"API_URL": "https://red-staging.iqser.cloud/redaction-gateway-v1",
"OAUTH_CLIENT_ID": "redaction",
"BACKEND_APP_VERSION": "4.4.40",
"FRONTEND_APP_VERSION": "1.1",

View File

@ -86,6 +86,23 @@
"new": "Add New File Attribute"
}
},
"add-edit-dossier-attribute": {
"form": {
"label": "Attribute Name",
"label-placeholder": "Enter Name",
"placeholder": "Attribute Placeholder",
"placeholder-placeholder": "Enter Placeholder",
"type": "Attribute Type"
},
"save": "Save Attribute",
"title": {
"edit": "Edit {{name}} Dossier Attribute",
"new": "Add New Dossier Attribute"
},
"error": {
"generic": "Failed to save attribute!"
}
},
"add-edit-user": {
"actions": {
"cancel": "Cancel",
@ -827,6 +844,12 @@
"NUMBER": "Number",
"TEXT": "Free Text"
},
"dossier-attribute-types": {
"DATE": "Date",
"NUMBER": "Number",
"TEXT": "Free Text",
"IMAGE": "Image"
},
"file-attributes": "File Attributes",
"file-attributes-csv-import": {
"action": {
@ -914,6 +937,33 @@
},
"upload-csv": "Upload File Attributes Configuration"
},
"dossier-attributes": "Dossier Attributes",
"dossier-attributes-listing": {
"action": {
"delete": "Delete Attribute",
"edit": "Edit Attribute"
},
"add-new": "New Attribute",
"bulk": {
"delete": "Delete Selected Attributes"
},
"no-match": {
"title": "No attributes match your current filters."
},
"no-data": {
"action": "New Attribute",
"title": "There are no dossier attributes."
},
"search": "Search...",
"table-col-names": {
"label": "Label",
"placeholder": "Placeholder",
"type": "Type"
},
"table-header": {
"title": "{{length}} dossier attributes"
}
},
"file-preview": {
"assign-me": "Assign to me",
"assign-reviewer": "Assign Reviewer",

View File

@ -24,6 +24,7 @@ import { SmtpConfigurationControllerService } from './smtpConfigurationControlle
import { ReportTemplateControllerService } from './reportTemplateController.service';
import { UploadControllerService } from './uploadController.service';
import { GeneralSettingsControllerService } from './generalSettingsController.service';
import { DossierAttributesControllerService } from './dossierAttributesController.service';
export * from './auditController.service';
@ -77,6 +78,8 @@ export * from './uploadController.service';
export * from './generalSettingsController.service';
export * from './dossierAttributesController.service';
export const APIS = [
AuditControllerService,
DebugControllerService,
@ -103,5 +106,6 @@ export const APIS = [
SmtpConfigurationControllerService,
ReportTemplateControllerService,
UploadControllerService,
GeneralSettingsControllerService
GeneralSettingsControllerService,
DossierAttributesControllerService
];

View File

@ -11,7 +11,7 @@
*/ /* tslint:disable:no-unused-variable member-ordering */
import { Inject, Injectable, Optional } from '@angular/core';
import { HttpClient, HttpEvent, HttpHeaders, HttpResponse } from '@angular/common/http';
import { HttpClient, HttpEvent, HttpHeaders, HttpParams, HttpResponse } from '@angular/common/http';
import { Observable } from 'rxjs';
@ -23,12 +23,13 @@ import { DossierAttributesRes } from '../model/dossierAttributesRes';
import { BASE_PATH } from '../variables';
import { Configuration } from '../configuration';
import { CustomHttpUrlEncodingCodec } from '../encoder';
@Injectable()
export class DossierAttributesControllerService {
protected basePath = '';
public defaultHeaders = new HttpHeaders();
public configuration = new Configuration();
protected basePath = '';
constructor(
protected httpClient: HttpClient,
@ -44,20 +45,6 @@ export class DossierAttributesControllerService {
}
}
/**
* @param consumes string[] mime-types
* @return true: consumes contains 'multipart/form-data', false: otherwise
*/
private canConsumeForm(consumes: string[]): boolean {
const form = 'multipart/form-data';
for (const consume of consumes) {
if (form === consume) {
return true;
}
}
return false;
}
/**
* Add or update a dossier attribute in existing dossier.
* None
@ -72,18 +59,21 @@ export class DossierAttributesControllerService {
observe?: 'body',
reportProgress?: boolean
): Observable<DossierAttributesRes>;
public addOrUpdateDossierAttributes(
body: DossierAttributeReq,
dossierId: string,
observe?: 'response',
reportProgress?: boolean
): Observable<HttpResponse<DossierAttributesRes>>;
public addOrUpdateDossierAttributes(
body: DossierAttributeReq,
dossierId: string,
observe?: 'events',
reportProgress?: boolean
): Observable<HttpEvent<DossierAttributesRes>>;
public addOrUpdateDossierAttributes(
body: DossierAttributeReq,
dossierId: string,
@ -91,15 +81,11 @@ export class DossierAttributesControllerService {
reportProgress: boolean = false
): Observable<any> {
if (body === null || body === undefined) {
throw new Error(
'Required parameter body was null or undefined when calling addOrUpdateDossierAttributes.'
);
throw new Error('Required parameter body was null or undefined when calling addOrUpdateDossierAttributes.');
}
if (dossierId === null || dossierId === undefined) {
throw new Error(
'Required parameter dossierId was null or undefined when calling addOrUpdateDossierAttributes.'
);
throw new Error('Required parameter dossierId was null or undefined when calling addOrUpdateDossierAttributes.');
}
let headers = this.defaultHeaders;
@ -107,24 +93,20 @@ export class DossierAttributesControllerService {
// authentication (RED-OAUTH) required
if (this.configuration.accessToken) {
const accessToken =
typeof this.configuration.accessToken === 'function'
? this.configuration.accessToken()
: this.configuration.accessToken;
typeof this.configuration.accessToken === 'function' ? this.configuration.accessToken() : this.configuration.accessToken;
headers = headers.set('Authorization', 'Bearer ' + accessToken);
}
// to determine the Accept header
const httpHeaderAccepts: string[] = ['application/json'];
const httpHeaderAcceptSelected: string | undefined =
this.configuration.selectHeaderAccept(httpHeaderAccepts);
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected !== undefined) {
headers = headers.set('Accept', httpHeaderAcceptSelected);
}
// to determine the Content-Type header
const consumes: string[] = ['application/json'];
const httpContentTypeSelected: string | undefined =
this.configuration.selectHeaderContentType(consumes);
const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes);
if (httpContentTypeSelected !== undefined) {
headers = headers.set('Content-Type', httpContentTypeSelected);
}
@ -156,18 +138,21 @@ export class DossierAttributesControllerService {
observe?: 'body',
reportProgress?: boolean
): Observable<DossierAttributeConfig>;
public addOrUpdateDossierAttributesConfig(
body: DossierAttributeConfig,
dossierTemplateId: string,
observe?: 'response',
reportProgress?: boolean
): Observable<HttpResponse<DossierAttributeConfig>>;
public addOrUpdateDossierAttributesConfig(
body: DossierAttributeConfig,
dossierTemplateId: string,
observe?: 'events',
reportProgress?: boolean
): Observable<HttpEvent<DossierAttributeConfig>>;
public addOrUpdateDossierAttributesConfig(
body: DossierAttributeConfig,
dossierTemplateId: string,
@ -175,15 +160,11 @@ export class DossierAttributesControllerService {
reportProgress: boolean = false
): Observable<any> {
if (body === null || body === undefined) {
throw new Error(
'Required parameter body was null or undefined when calling addOrUpdateDossierAttributesConfig.'
);
throw new Error('Required parameter body was null or undefined when calling addOrUpdateDossierAttributesConfig.');
}
if (dossierTemplateId === null || dossierTemplateId === undefined) {
throw new Error(
'Required parameter dossierTemplateId was null or undefined when calling addOrUpdateDossierAttributesConfig.'
);
throw new Error('Required parameter dossierTemplateId was null or undefined when calling addOrUpdateDossierAttributesConfig.');
}
let headers = this.defaultHeaders;
@ -191,33 +172,27 @@ export class DossierAttributesControllerService {
// authentication (RED-OAUTH) required
if (this.configuration.accessToken) {
const accessToken =
typeof this.configuration.accessToken === 'function'
? this.configuration.accessToken()
: this.configuration.accessToken;
typeof this.configuration.accessToken === 'function' ? this.configuration.accessToken() : this.configuration.accessToken;
headers = headers.set('Authorization', 'Bearer ' + accessToken);
}
// to determine the Accept header
const httpHeaderAccepts: string[] = ['application/json'];
const httpHeaderAcceptSelected: string | undefined =
this.configuration.selectHeaderAccept(httpHeaderAccepts);
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected !== undefined) {
headers = headers.set('Accept', httpHeaderAcceptSelected);
}
// to determine the Content-Type header
const consumes: string[] = ['application/json'];
const httpContentTypeSelected: string | undefined =
this.configuration.selectHeaderContentType(consumes);
const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes);
if (httpContentTypeSelected !== undefined) {
headers = headers.set('Content-Type', httpContentTypeSelected);
}
return this.httpClient.request<DossierAttributeConfig>(
'post',
`${this.basePath}/dossier-attributes/config/${encodeURIComponent(
String(dossierTemplateId)
)}`,
`${this.basePath}/dossier-attributes/config/${encodeURIComponent(String(dossierTemplateId))}`,
{
body: body,
withCredentials: this.configuration.withCredentials,
@ -242,18 +217,21 @@ export class DossierAttributesControllerService {
observe?: 'body',
reportProgress?: boolean
): Observable<any>;
public deleteDossierAttribute(
dossierAttributeId: string,
dossierId: string,
observe?: 'response',
reportProgress?: boolean
): Observable<HttpResponse<any>>;
public deleteDossierAttribute(
dossierAttributeId: string,
dossierId: string,
observe?: 'events',
reportProgress?: boolean
): Observable<HttpEvent<any>>;
public deleteDossierAttribute(
dossierAttributeId: string,
dossierId: string,
@ -261,15 +239,11 @@ export class DossierAttributesControllerService {
reportProgress: boolean = false
): Observable<any> {
if (dossierAttributeId === null || dossierAttributeId === undefined) {
throw new Error(
'Required parameter dossierAttributeId was null or undefined when calling deleteDossierAttribute.'
);
throw new Error('Required parameter dossierAttributeId was null or undefined when calling deleteDossierAttribute.');
}
if (dossierId === null || dossierId === undefined) {
throw new Error(
'Required parameter dossierId was null or undefined when calling deleteDossierAttribute.'
);
throw new Error('Required parameter dossierId was null or undefined when calling deleteDossierAttribute.');
}
let headers = this.defaultHeaders;
@ -277,25 +251,22 @@ export class DossierAttributesControllerService {
// authentication (RED-OAUTH) required
if (this.configuration.accessToken) {
const accessToken =
typeof this.configuration.accessToken === 'function'
? this.configuration.accessToken()
: this.configuration.accessToken;
typeof this.configuration.accessToken === 'function' ? this.configuration.accessToken() : this.configuration.accessToken;
headers = headers.set('Authorization', 'Bearer ' + accessToken);
}
// to determine the Accept header
const httpHeaderAccepts: string[] = [];
const httpHeaderAcceptSelected: string | undefined =
this.configuration.selectHeaderAccept(httpHeaderAccepts);
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected !== undefined) {
headers = headers.set('Accept', httpHeaderAcceptSelected);
}
return this.httpClient.request<any>(
'delete',
`${this.basePath}/dossier-attributes/set/${encodeURIComponent(
String(dossierId)
)}/${encodeURIComponent(String(dossierAttributeId))}`,
`${this.basePath}/dossier-attributes/set/${encodeURIComponent(String(dossierId))}/${encodeURIComponent(
String(dossierAttributeId)
)}`,
{
withCredentials: this.configuration.withCredentials,
headers: headers,
@ -319,18 +290,21 @@ export class DossierAttributesControllerService {
observe?: 'body',
reportProgress?: boolean
): Observable<any>;
public deleteDossierAttributeConfig(
dossierAttributeId: string,
dossierTemplateId: string,
observe?: 'response',
reportProgress?: boolean
): Observable<HttpResponse<any>>;
public deleteDossierAttributeConfig(
dossierAttributeId: string,
dossierTemplateId: string,
observe?: 'events',
reportProgress?: boolean
): Observable<HttpEvent<any>>;
public deleteDossierAttributeConfig(
dossierAttributeId: string,
dossierTemplateId: string,
@ -338,15 +312,11 @@ export class DossierAttributesControllerService {
reportProgress: boolean = false
): Observable<any> {
if (dossierAttributeId === null || dossierAttributeId === undefined) {
throw new Error(
'Required parameter dossierAttributeId was null or undefined when calling deleteDossierAttributeConfig.'
);
throw new Error('Required parameter dossierAttributeId was null or undefined when calling deleteDossierAttributeConfig.');
}
if (dossierTemplateId === null || dossierTemplateId === undefined) {
throw new Error(
'Required parameter dossierTemplateId was null or undefined when calling deleteDossierAttributeConfig.'
);
throw new Error('Required parameter dossierTemplateId was null or undefined when calling deleteDossierAttributeConfig.');
}
let headers = this.defaultHeaders;
@ -354,25 +324,22 @@ export class DossierAttributesControllerService {
// authentication (RED-OAUTH) required
if (this.configuration.accessToken) {
const accessToken =
typeof this.configuration.accessToken === 'function'
? this.configuration.accessToken()
: this.configuration.accessToken;
typeof this.configuration.accessToken === 'function' ? this.configuration.accessToken() : this.configuration.accessToken;
headers = headers.set('Authorization', 'Bearer ' + accessToken);
}
// to determine the Accept header
const httpHeaderAccepts: string[] = [];
const httpHeaderAcceptSelected: string | undefined =
this.configuration.selectHeaderAccept(httpHeaderAccepts);
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected !== undefined) {
headers = headers.set('Accept', httpHeaderAcceptSelected);
}
return this.httpClient.request<any>(
'delete',
`${this.basePath}/dossier-attributes/config/${encodeURIComponent(
String(dossierTemplateId)
)}/${encodeURIComponent(String(dossierAttributeId))}`,
`${this.basePath}/dossier-attributes/config/${encodeURIComponent(String(dossierTemplateId))}/${encodeURIComponent(
String(dossierAttributeId)
)}`,
{
withCredentials: this.configuration.withCredentials,
headers: headers,
@ -385,45 +352,51 @@ export class DossierAttributesControllerService {
/**
* Bulk delete dossier attributes.
* None
* @param body dossierId
* @param dossierAttributeIds dossierAttributeIds
* @param dossierTemplateId dossierTemplateId
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
public deleteDossierAttributesConfig(
body: Array<string>,
dossierAttributeIds: Array<string>,
dossierTemplateId: string,
observe?: 'body',
reportProgress?: boolean
): Observable<any>;
public deleteDossierAttributesConfig(
body: Array<string>,
dossierAttributeIds: Array<string>,
dossierTemplateId: string,
observe?: 'response',
reportProgress?: boolean
): Observable<HttpResponse<any>>;
public deleteDossierAttributesConfig(
body: Array<string>,
dossierAttributeIds: Array<string>,
dossierTemplateId: string,
observe?: 'events',
reportProgress?: boolean
): Observable<HttpEvent<any>>;
public deleteDossierAttributesConfig(
body: Array<string>,
dossierAttributeIds: Array<string>,
dossierTemplateId: string,
observe: any = 'body',
reportProgress: boolean = false
): Observable<any> {
if (body === null || body === undefined) {
throw new Error(
'Required parameter body was null or undefined when calling deleteDossierAttributesConfig.'
);
if (dossierAttributeIds === null || dossierAttributeIds === undefined) {
throw new Error('Required parameter dossierAttributeIds was null or undefined when calling deleteDossierAttributesConfig.');
}
if (dossierTemplateId === null || dossierTemplateId === undefined) {
throw new Error(
'Required parameter dossierTemplateId was null or undefined when calling deleteDossierAttributesConfig.'
);
throw new Error('Required parameter dossierTemplateId was null or undefined when calling deleteDossierAttributesConfig.');
}
let queryParameters = new HttpParams({ encoder: new CustomHttpUrlEncodingCodec() });
if (dossierAttributeIds) {
dossierAttributeIds.forEach(element => {
queryParameters = queryParameters.append('dossierAttributeIds', <any>element);
});
}
let headers = this.defaultHeaders;
@ -431,35 +404,22 @@ export class DossierAttributesControllerService {
// authentication (RED-OAUTH) required
if (this.configuration.accessToken) {
const accessToken =
typeof this.configuration.accessToken === 'function'
? this.configuration.accessToken()
: this.configuration.accessToken;
typeof this.configuration.accessToken === 'function' ? this.configuration.accessToken() : this.configuration.accessToken;
headers = headers.set('Authorization', 'Bearer ' + accessToken);
}
// to determine the Accept header
const httpHeaderAccepts: string[] = [];
const httpHeaderAcceptSelected: string | undefined =
this.configuration.selectHeaderAccept(httpHeaderAccepts);
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected !== undefined) {
headers = headers.set('Accept', httpHeaderAcceptSelected);
}
// to determine the Content-Type header
const consumes: string[] = ['application/json'];
const httpContentTypeSelected: string | undefined =
this.configuration.selectHeaderContentType(consumes);
if (httpContentTypeSelected !== undefined) {
headers = headers.set('Content-Type', httpContentTypeSelected);
}
return this.httpClient.request<any>(
'post',
`${this.basePath}/dossier-attributes/config/delete/${encodeURIComponent(
String(dossierTemplateId)
)}`,
`${this.basePath}/dossier-attributes/config/delete/${encodeURIComponent(String(dossierTemplateId))}`,
{
body: body,
params: queryParameters,
withCredentials: this.configuration.withCredentials,
headers: headers,
observe: observe,
@ -475,30 +435,23 @@ export class DossierAttributesControllerService {
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
public getDossierAttributes(
dossierId: string,
observe?: 'body',
reportProgress?: boolean
): Observable<DossierAttributesRes>;
public getDossierAttributes(dossierId: string, observe?: 'body', reportProgress?: boolean): Observable<DossierAttributesRes>;
public getDossierAttributes(
dossierId: string,
observe?: 'response',
reportProgress?: boolean
): Observable<HttpResponse<DossierAttributesRes>>;
public getDossierAttributes(
dossierId: string,
observe?: 'events',
reportProgress?: boolean
): Observable<HttpEvent<DossierAttributesRes>>;
public getDossierAttributes(
dossierId: string,
observe: any = 'body',
reportProgress: boolean = false
): Observable<any> {
public getDossierAttributes(dossierId: string, observe: any = 'body', reportProgress: boolean = false): Observable<any> {
if (dossierId === null || dossierId === undefined) {
throw new Error(
'Required parameter dossierId was null or undefined when calling getDossierAttributes.'
);
throw new Error('Required parameter dossierId was null or undefined when calling getDossierAttributes.');
}
let headers = this.defaultHeaders;
@ -506,16 +459,13 @@ export class DossierAttributesControllerService {
// authentication (RED-OAUTH) required
if (this.configuration.accessToken) {
const accessToken =
typeof this.configuration.accessToken === 'function'
? this.configuration.accessToken()
: this.configuration.accessToken;
typeof this.configuration.accessToken === 'function' ? this.configuration.accessToken() : this.configuration.accessToken;
headers = headers.set('Authorization', 'Bearer ' + accessToken);
}
// to determine the Accept header
const httpHeaderAccepts: string[] = ['application/json'];
const httpHeaderAcceptSelected: string | undefined =
this.configuration.selectHeaderAccept(httpHeaderAccepts);
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected !== undefined) {
headers = headers.set('Accept', httpHeaderAcceptSelected);
}
@ -544,25 +494,22 @@ export class DossierAttributesControllerService {
observe?: 'body',
reportProgress?: boolean
): Observable<DossierAttributesConfig>;
public getDossierAttributesConfig(
dossierTemplateId: string,
observe?: 'response',
reportProgress?: boolean
): Observable<HttpResponse<DossierAttributesConfig>>;
public getDossierAttributesConfig(
dossierTemplateId: string,
observe?: 'events',
reportProgress?: boolean
): Observable<HttpEvent<DossierAttributesConfig>>;
public getDossierAttributesConfig(
dossierTemplateId: string,
observe: any = 'body',
reportProgress: boolean = false
): Observable<any> {
public getDossierAttributesConfig(dossierTemplateId: string, observe: any = 'body', reportProgress: boolean = false): Observable<any> {
if (dossierTemplateId === null || dossierTemplateId === undefined) {
throw new Error(
'Required parameter dossierTemplateId was null or undefined when calling getDossierAttributesConfig.'
);
throw new Error('Required parameter dossierTemplateId was null or undefined when calling getDossierAttributesConfig.');
}
let headers = this.defaultHeaders;
@ -570,25 +517,20 @@ export class DossierAttributesControllerService {
// authentication (RED-OAUTH) required
if (this.configuration.accessToken) {
const accessToken =
typeof this.configuration.accessToken === 'function'
? this.configuration.accessToken()
: this.configuration.accessToken;
typeof this.configuration.accessToken === 'function' ? this.configuration.accessToken() : this.configuration.accessToken;
headers = headers.set('Authorization', 'Bearer ' + accessToken);
}
// to determine the Accept header
const httpHeaderAccepts: string[] = ['application/json'];
const httpHeaderAcceptSelected: string | undefined =
this.configuration.selectHeaderAccept(httpHeaderAccepts);
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected !== undefined) {
headers = headers.set('Accept', httpHeaderAcceptSelected);
}
return this.httpClient.request<DossierAttributesConfig>(
'get',
`${this.basePath}/dossier-attributes/config/${encodeURIComponent(
String(dossierTemplateId)
)}`,
`${this.basePath}/dossier-attributes/config/${encodeURIComponent(String(dossierTemplateId))}`,
{
withCredentials: this.configuration.withCredentials,
headers: headers,
@ -612,18 +554,21 @@ export class DossierAttributesControllerService {
observe?: 'body',
reportProgress?: boolean
): Observable<DossierAttributesRes>;
public setDossierAttributes(
body: DossierAttributesReq,
dossierId: string,
observe?: 'response',
reportProgress?: boolean
): Observable<HttpResponse<DossierAttributesRes>>;
public setDossierAttributes(
body: DossierAttributesReq,
dossierId: string,
observe?: 'events',
reportProgress?: boolean
): Observable<HttpEvent<DossierAttributesRes>>;
public setDossierAttributes(
body: DossierAttributesReq,
dossierId: string,
@ -631,15 +576,11 @@ export class DossierAttributesControllerService {
reportProgress: boolean = false
): Observable<any> {
if (body === null || body === undefined) {
throw new Error(
'Required parameter body was null or undefined when calling setDossierAttributes.'
);
throw new Error('Required parameter body was null or undefined when calling setDossierAttributes.');
}
if (dossierId === null || dossierId === undefined) {
throw new Error(
'Required parameter dossierId was null or undefined when calling setDossierAttributes.'
);
throw new Error('Required parameter dossierId was null or undefined when calling setDossierAttributes.');
}
let headers = this.defaultHeaders;
@ -647,24 +588,20 @@ export class DossierAttributesControllerService {
// authentication (RED-OAUTH) required
if (this.configuration.accessToken) {
const accessToken =
typeof this.configuration.accessToken === 'function'
? this.configuration.accessToken()
: this.configuration.accessToken;
typeof this.configuration.accessToken === 'function' ? this.configuration.accessToken() : this.configuration.accessToken;
headers = headers.set('Authorization', 'Bearer ' + accessToken);
}
// to determine the Accept header
const httpHeaderAccepts: string[] = ['application/json'];
const httpHeaderAcceptSelected: string | undefined =
this.configuration.selectHeaderAccept(httpHeaderAccepts);
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected !== undefined) {
headers = headers.set('Accept', httpHeaderAcceptSelected);
}
// to determine the Content-Type header
const consumes: string[] = ['application/json'];
const httpContentTypeSelected: string | undefined =
this.configuration.selectHeaderContentType(consumes);
const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes);
if (httpContentTypeSelected !== undefined) {
headers = headers.set('Content-Type', httpContentTypeSelected);
}
@ -696,18 +633,21 @@ export class DossierAttributesControllerService {
observe?: 'body',
reportProgress?: boolean
): Observable<DossierAttributesConfig>;
public setDossierAttributesConfig(
body: DossierAttributesConfig,
dossierTemplateId: string,
observe?: 'response',
reportProgress?: boolean
): Observable<HttpResponse<DossierAttributesConfig>>;
public setDossierAttributesConfig(
body: DossierAttributesConfig,
dossierTemplateId: string,
observe?: 'events',
reportProgress?: boolean
): Observable<HttpEvent<DossierAttributesConfig>>;
public setDossierAttributesConfig(
body: DossierAttributesConfig,
dossierTemplateId: string,
@ -715,15 +655,11 @@ export class DossierAttributesControllerService {
reportProgress: boolean = false
): Observable<any> {
if (body === null || body === undefined) {
throw new Error(
'Required parameter body was null or undefined when calling setDossierAttributesConfig.'
);
throw new Error('Required parameter body was null or undefined when calling setDossierAttributesConfig.');
}
if (dossierTemplateId === null || dossierTemplateId === undefined) {
throw new Error(
'Required parameter dossierTemplateId was null or undefined when calling setDossierAttributesConfig.'
);
throw new Error('Required parameter dossierTemplateId was null or undefined when calling setDossierAttributesConfig.');
}
let headers = this.defaultHeaders;
@ -731,33 +667,27 @@ export class DossierAttributesControllerService {
// authentication (RED-OAUTH) required
if (this.configuration.accessToken) {
const accessToken =
typeof this.configuration.accessToken === 'function'
? this.configuration.accessToken()
: this.configuration.accessToken;
typeof this.configuration.accessToken === 'function' ? this.configuration.accessToken() : this.configuration.accessToken;
headers = headers.set('Authorization', 'Bearer ' + accessToken);
}
// to determine the Accept header
const httpHeaderAccepts: string[] = ['application/json'];
const httpHeaderAcceptSelected: string | undefined =
this.configuration.selectHeaderAccept(httpHeaderAccepts);
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected !== undefined) {
headers = headers.set('Accept', httpHeaderAcceptSelected);
}
// to determine the Content-Type header
const consumes: string[] = ['application/json'];
const httpContentTypeSelected: string | undefined =
this.configuration.selectHeaderContentType(consumes);
const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes);
if (httpContentTypeSelected !== undefined) {
headers = headers.set('Content-Type', httpContentTypeSelected);
}
return this.httpClient.request<DossierAttributesConfig>(
'put',
`${this.basePath}/dossier-attributes/config/${encodeURIComponent(
String(dossierTemplateId)
)}`,
`${this.basePath}/dossier-attributes/config/${encodeURIComponent(String(dossierTemplateId))}`,
{
body: body,
withCredentials: this.configuration.withCredentials,
@ -767,4 +697,18 @@ export class DossierAttributesControllerService {
}
);
}
/**
* @param consumes string[] mime-types
* @return true: consumes contains 'multipart/form-data', false: otherwise
*/
private canConsumeForm(consumes: string[]): boolean {
const form = 'multipart/form-data';
for (const consume of consumes) {
if (form === consume) {
return true;
}
}
return false;
}
}