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, "useTabs": false,
"printWidth": 100, "printWidth": 140,
"tabWidth": 4, "tabWidth": 4,
"singleQuote": true, "singleQuote": true,
"trailingComma": "none", "trailingComma": "none",

View File

@ -7,7 +7,7 @@ To re-generate http rune swagger
YOu need swagger-codegen installed `brew install swagger-codegen` 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 URL="$BASE"redaction-gateway-v1/v2/api-docs?group=redaction-gateway-v1
rm -Rf /tmp/swagger rm -Rf /tmp/swagger
mkdir -p /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 { RouterModule } from '@angular/router';
import { SmtpConfigScreenComponent } from './screens/smtp-config/smtp-config-screen.component'; import { SmtpConfigScreenComponent } from './screens/smtp-config/smtp-config-screen.component';
import { ReportsScreenComponent } from './screens/reports/reports-screen.component'; import { ReportsScreenComponent } from './screens/reports/reports-screen.component';
import { DossierAttributesListingScreenComponent } from './screens/dossier-attributes-listing/dossier-attributes-listing-screen.component';
const routes = [ const routes = [
{ path: '', redirectTo: 'dossier-templates', pathMatch: 'full' }, { path: '', redirectTo: 'dossier-templates', pathMatch: 'full' },
@ -90,6 +91,14 @@ const routes = [
routeGuards: [AuthGuard, RedRoleGuard, AppStateGuard] routeGuards: [AuthGuard, RedRoleGuard, AppStateGuard]
} }
}, },
{
path: 'dossier-attributes',
component: DossierAttributesListingScreenComponent,
canActivate: [CompositeRouteGuard],
data: {
routeGuards: [AuthGuard, RedRoleGuard, AppStateGuard]
}
},
{ {
path: 'default-colors', path: 'default-colors',
component: DefaultColorsScreenComponent, component: DefaultColorsScreenComponent,

View File

@ -34,6 +34,7 @@ export class AdminSideNavComponent {
{ screen: 'default-colors' }, { screen: 'default-colors' },
{ screen: 'watermark' }, { screen: 'watermark' },
{ screen: 'file-attributes', onlyAdmin: true }, { screen: 'file-attributes', onlyAdmin: true },
{ screen: 'dossier-attributes', onlyAdmin: true },
{ screen: 'reports', onlyAdmin: true, onlyDevMode: 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 { ReportsScreenComponent } from './screens/reports/reports-screen.component';
import { ResetPasswordComponent } from './dialogs/add-edit-user-dialog/reset-password/reset-password.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 { 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 = [ const dialogs = [
AddEditDossierTemplateDialogComponent, AddEditDossierTemplateDialogComponent,
@ -46,7 +48,8 @@ const dialogs = [
SmtpAuthDialogComponent, SmtpAuthDialogComponent,
AddEditUserDialogComponent, AddEditUserDialogComponent,
ConfirmDeleteUsersDialogComponent, ConfirmDeleteUsersDialogComponent,
FileAttributesCsvImportDialogComponent FileAttributesCsvImportDialogComponent,
AddEditDossierAttributeDialogComponent
]; ];
const screens = [ const screens = [
@ -62,7 +65,8 @@ const screens = [
UserListingScreenComponent, UserListingScreenComponent,
WatermarkScreenComponent, WatermarkScreenComponent,
SmtpConfigScreenComponent, SmtpConfigScreenComponent,
ReportsScreenComponent ReportsScreenComponent,
DossierAttributesListingScreenComponent
]; ];
const components = [ const components = [
@ -83,13 +87,6 @@ const components = [
@NgModule({ @NgModule({
declarations: [...components], declarations: [...components],
providers: [AdminDialogService], providers: [AdminDialogService],
imports: [ imports: [CommonModule, SharedModule, AdminRoutingModule, NgxChartsModule, ColorPickerModule, MonacoEditorModule]
CommonModule,
SharedModule,
AdminRoutingModule,
NgxChartsModule,
ColorPickerModule,
MonacoEditorModule
]
}) })
export class AdminModule {} 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> <redaction-admin-breadcrumbs class="flex-1"></redaction-admin-breadcrumbs>
<div class="actions flex-1"> <div class="actions flex-1">
<redaction-dossier-template-actions></redaction-dossier-template-actions>
<redaction-circle-button <redaction-circle-button
[routerLink]="['../..']" [routerLink]="['../..']"
icon="red:close" icon="red:close"
@ -28,10 +30,7 @@
</div> </div>
<span class="all-caps-label"> <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> </span>
<redaction-circle-button <redaction-circle-button
@ -49,13 +48,7 @@
placeholder="file-attributes-listing.search" placeholder="file-attributes-listing.search"
type="search" type="search"
></redaction-input-with-action> ></redaction-input-with-action>
<input <input #fileInput (change)="importCSV($event.target['files'])" accept=".csv" class="csv-input" type="file" />
#fileInput
(change)="importCSV($event.target['files'])"
accept=".csv"
class="csv-input"
type="file"
/>
<redaction-circle-button <redaction-circle-button
(action)="fileInput.click()" (action)="fileInput.click()"
@ -74,11 +67,7 @@
</div> </div>
</div> </div>
<div <div [class.no-data]="!allEntities.length" class="table-header" redactionSyncWidth="table-item">
[class.no-data]="!allEntities.length"
class="table-header"
redactionSyncWidth="table-item"
>
<div class="select-oval-placeholder"></div> <div class="select-oval-placeholder"></div>
<redaction-table-col-name <redaction-table-col-name
@ -106,9 +95,7 @@
label="file-attributes-listing.table-col-names.read-only" label="file-attributes-listing.table-col-names.read-only"
></redaction-table-col-name> ></redaction-table-col-name>
<redaction-table-col-name <redaction-table-col-name label="file-attributes-listing.table-col-names.csv-column"></redaction-table-col-name>
label="file-attributes-listing.table-col-names.csv-column"
></redaction-table-col-name>
<redaction-table-col-name <redaction-table-col-name
class="flex-center" class="flex-center"
@ -137,26 +124,18 @@
<cdk-virtual-scroll-viewport [itemSize]="80" redactionHasScrollbar> <cdk-virtual-scroll-viewport [itemSize]="80" redactionHasScrollbar>
<!-- Table lines --> <!-- Table lines -->
<div <div
*cdkVirtualFor=" *cdkVirtualFor="let attribute of displayedEntities | sortBy: sortingOption.order:sortingOption.column"
let attribute of displayedEntities
| sortBy: sortingOption.order:sortingOption.column
"
class="table-item" class="table-item"
> >
<div (click)="toggleEntitySelected($event, attribute)" class="selection-column"> <div (click)="toggleEntitySelected($event, attribute)" class="selection-column">
<redaction-round-checkbox <redaction-round-checkbox [active]="isSelected(attribute)"></redaction-round-checkbox>
[active]="isSelected(attribute)"
></redaction-round-checkbox>
</div> </div>
<div class="label"> <div class="label">
<span>{{ attribute.label }}</span> <span>{{ attribute.label }}</span>
</div> </div>
<div <div [translate]="'file-attribute-types.' + attribute.type" class="small-label"></div>
[translate]="'file-attribute-types.' + attribute.type"
class="small-label"
></div>
<div class="center read-only"> <div class="center read-only">
<mat-icon <mat-icon
@ -170,11 +149,7 @@
{{ attribute.csvColumnHeader }} {{ attribute.csvColumnHeader }}
</div> </div>
<div class="center"> <div class="center">
<redaction-round-checkbox <redaction-round-checkbox *ngIf="attribute.primaryAttribute" [active]="true" [size]="18"></redaction-round-checkbox>
*ngIf="attribute.primaryAttribute"
[active]="true"
[size]="18"
></redaction-round-checkbox>
</div> </div>
<div class="actions-container"> <div class="actions-container">
<div class="action-buttons"> <div class="action-buttons">

View File

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

View File

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

View File

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

View File

@ -3,6 +3,8 @@
<redaction-admin-breadcrumbs class="flex-1"></redaction-admin-breadcrumbs> <redaction-admin-breadcrumbs class="flex-1"></redaction-admin-breadcrumbs>
<div class="actions flex-1"> <div class="actions flex-1">
<redaction-dossier-template-actions></redaction-dossier-template-actions>
<redaction-circle-button <redaction-circle-button
[routerLink]="['../..']" [routerLink]="['../..']"
icon="red:close" icon="red:close"
@ -27,11 +29,7 @@
text="watermark-screen.action.save" text="watermark-screen.action.save"
type="primary" type="primary"
></redaction-icon-button> ></redaction-icon-button>
<div <div (click)="revert()" class="all-caps-label cancel" translate="watermark-screen.action.revert"></div>
(click)="revert()"
class="all-caps-label cancel"
translate="watermark-screen.action.revert"
></div>
</div> </div>
</div> </div>
@ -52,10 +50,7 @@
</div> </div>
<div class="red-input-group"> <div class="red-input-group">
<label <label class="all-caps-label mb-8" translate="watermark-screen.form.orientation"></label>
class="all-caps-label mb-8"
translate="watermark-screen.form.orientation"
></label>
<div class="square-options"> <div class="square-options">
<div <div
(click)="setValue('orientation', option)" (click)="setValue('orientation', option)"
@ -70,34 +65,17 @@
</div> </div>
<div class="red-input-group"> <div class="red-input-group">
<label <label class="all-caps-label" translate="watermark-screen.form.font-size"></label>
class="all-caps-label" <mat-slider (change)="configChanged()" color="primary" formControlName="fontSize" max="50" min="5"></mat-slider>
translate="watermark-screen.form.font-size"
></label>
<mat-slider
(change)="configChanged()"
color="primary"
formControlName="fontSize"
max="50"
min="5"
></mat-slider>
</div> </div>
<div class="red-input-group"> <div class="red-input-group">
<label class="all-caps-label" translate="watermark-screen.form.opacity"></label> <label class="all-caps-label" translate="watermark-screen.form.opacity"></label>
<mat-slider <mat-slider (change)="configChanged()" color="primary" formControlName="opacity" min="1"></mat-slider>
(change)="configChanged()"
color="primary"
formControlName="opacity"
min="1"
></mat-slider>
</div> </div>
<div class="red-input-group w-150"> <div class="red-input-group w-150">
<label <label class="all-caps-label mb-5" translate="watermark-screen.form.color"></label>
class="all-caps-label mb-5"
translate="watermark-screen.form.color"
></label>
<input <input
class="hex-color-input" class="hex-color-input"
formControlName="hexColor" formControlName="hexColor"
@ -117,20 +95,14 @@
class="input-icon" class="input-icon"
> >
<mat-icon <mat-icon
*ngIf=" *ngIf="!configForm.get('hexColor')?.value || configForm.get('hexColor').value?.length === 0"
!configForm.get('hexColor')?.value ||
configForm.get('hexColor').value?.length === 0
"
svgIcon="red:color-picker" svgIcon="red:color-picker"
></mat-icon> ></mat-icon>
</div> </div>
</div> </div>
<div class="red-input-group"> <div class="red-input-group">
<label <label class="all-caps-label mb-8" translate="watermark-screen.form.font-type"></label>
class="all-caps-label mb-8"
translate="watermark-screen.form.font-type"
></label>
<div class="square-options"> <div class="square-options">
<div <div
(click)="setValue('fontType', option.value)" (click)="setValue('fontType', option.value)"
@ -154,6 +126,4 @@
</div> </div>
</section> </section>
<redaction-full-page-loading-indicator <redaction-full-page-loading-indicator [displayed]="!viewReady"></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 _formBuilder: FormBuilder,
private readonly _activatedRoute: ActivatedRoute private readonly _activatedRoute: ActivatedRoute
) { ) {
this.appStateService.activateDossierTemplate( this.appStateService.activateDossierTemplate(_activatedRoute.snapshot.params.dossierTemplateId);
_activatedRoute.snapshot.params.dossierTemplateId
);
this._initForm(); this._initForm();
} }
@ -80,22 +78,15 @@ export class WatermarkScreenComponent implements OnInit {
}; };
const observable = watermark.text const observable = watermark.text
? this._watermarkControllerService.saveWatermark( ? this._watermarkControllerService.saveWatermark(watermark, this.appStateService.activeDossierTemplateId)
watermark, : this._watermarkControllerService.deleteWatermark(this.appStateService.activeDossierTemplateId);
this.appStateService.activeDossierTemplateId
)
: this._watermarkControllerService.deleteWatermark(
this.appStateService.activeDossierTemplateId
);
observable.subscribe( observable.subscribe(
() => { () => {
this._loadWatermark(); this._loadWatermark();
this._notificationService.showToastNotification( this._notificationService.showToastNotification(
this._translateService.instant( this._translateService.instant(
watermark.text watermark.text ? 'watermark-screen.action.change-success' : 'watermark-screen.action.delete-success'
? 'watermark-screen.action.change-success'
: 'watermark-screen.action.delete-success'
), ),
null, null,
NotificationType.SUCCESS NotificationType.SUCCESS
@ -126,20 +117,18 @@ export class WatermarkScreenComponent implements OnInit {
} }
private _loadWatermark() { private _loadWatermark() {
this._watermarkControllerService this._watermarkControllerService.getWatermark(this.appStateService.activeDossierTemplateId).subscribe(
.getWatermark(this.appStateService.activeDossierTemplateId) watermark => {
.subscribe( this._watermark = watermark;
watermark => { this.configForm.setValue({ ...this._watermark });
this._watermark = watermark; this._loadViewer();
this.configForm.setValue({ ...this._watermark }); },
this._loadViewer(); () => {
}, this._watermark = DEFAULT_WATERMARK;
() => { this.configForm.setValue({ ...this._watermark });
this._watermark = DEFAULT_WATERMARK; this._loadViewer();
this.configForm.setValue({ ...this._watermark }); }
this._loadViewer(); );
}
);
} }
private _loadViewer() { private _loadViewer() {
@ -186,22 +175,11 @@ export class WatermarkScreenComponent implements OnInit {
const text = this.configForm.get('text').value || ''; const text = this.configForm.get('text').value || '';
const fontSize = this.configForm.get('fontSize').value; const fontSize = this.configForm.get('fontSize').value;
const fontType = this.configForm.get('fontType').value; const fontType = this.configForm.get('fontType').value;
const orientation: WatermarkModelRes.OrientationEnum = const orientation: WatermarkModelRes.OrientationEnum = this.configForm.get('orientation').value;
this.configForm.get('orientation').value;
const opacity = this.configForm.get('opacity').value; const opacity = this.configForm.get('opacity').value;
const color = this.configForm.get('hexColor').value; const color = this.configForm.get('hexColor').value;
await stampPDFPage( await stampPDFPage(document, pdfNet, text, fontSize, fontType, orientation, opacity, color, 1);
document,
pdfNet,
text,
fontSize,
fontType,
orientation,
opacity,
color,
1
);
this._instance.docViewer.refreshAll(); this._instance.docViewer.refreshAll();
this._instance.docViewer.updateView([0], 0); this._instance.docViewer.updateView([0], 0);
this._changeDetectorRef.detectChanges(); this._changeDetectorRef.detectChanges();
@ -210,26 +188,11 @@ export class WatermarkScreenComponent implements OnInit {
private _initForm() { private _initForm() {
this.configForm = this._formBuilder.group({ this.configForm = this._formBuilder.group({
text: [{ value: null, disabled: !this.permissionsService.isAdmin() }], text: [{ value: null, disabled: !this.permissionsService.isAdmin() }],
hexColor: [ hexColor: [{ value: null, disabled: !this.permissionsService.isAdmin() }, Validators.required],
{ value: null, disabled: !this.permissionsService.isAdmin() }, opacity: [{ value: null, disabled: !this.permissionsService.isAdmin() }, Validators.required],
Validators.required fontSize: [{ value: null, disabled: !this.permissionsService.isAdmin() }, Validators.required],
], fontType: [{ value: null, disabled: !this.permissionsService.isAdmin() }, Validators.required],
opacity: [ orientation: [{ value: null, disabled: !this.permissionsService.isAdmin() }, Validators.required]
{ 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 { FileAttributesCsvImportDialogComponent } from '../dialogs/file-attributes-csv-import-dialog/file-attributes-csv-import-dialog.component';
import { ComponentType } from '@angular/cdk/portal'; import { ComponentType } from '@angular/cdk/portal';
import { DialogService } from '../../shared/services/dialog.service'; import { DialogService } from '../../shared/services/dialog.service';
import { AddEditDossierAttributeDialogComponent } from '../dialogs/add-edit-dossier-attribute-dialog/add-edit-dossier-attribute-dialog.component';
type DialogType = type DialogType =
| 'confirm' | 'confirm'
@ -23,7 +24,8 @@ type DialogType =
| 'addEditUser' | 'addEditUser'
| 'deleteUsers' | 'deleteUsers'
| 'smtpAuthConfig' | 'smtpAuthConfig'
| 'addEditDossierTemplate'; | 'addEditDossierTemplate'
| 'addEditDossierAttribute';
type AdminDialogConfig = { type AdminDialogConfig = {
[key in DialogType]: { [key in DialogType]: {
@ -72,6 +74,10 @@ export class AdminDialogService extends DialogService<DialogType> {
addEditDossierTemplate: { addEditDossierTemplate: {
component: AddEditDossierTemplateDialogComponent, component: AddEditDossierTemplateDialogComponent,
dialogConfig: { width: '900px', autoFocus: true } dialogConfig: { width: '900px', autoFocus: true }
},
addEditDossierAttribute: {
component: AddEditDossierAttributeDialogComponent,
dialogConfig: { autoFocus: true }
} }
}; };

View File

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

View File

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

View File

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

View File

@ -86,6 +86,23 @@
"new": "Add New File Attribute" "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": { "add-edit-user": {
"actions": { "actions": {
"cancel": "Cancel", "cancel": "Cancel",
@ -827,6 +844,12 @@
"NUMBER": "Number", "NUMBER": "Number",
"TEXT": "Free Text" "TEXT": "Free Text"
}, },
"dossier-attribute-types": {
"DATE": "Date",
"NUMBER": "Number",
"TEXT": "Free Text",
"IMAGE": "Image"
},
"file-attributes": "File Attributes", "file-attributes": "File Attributes",
"file-attributes-csv-import": { "file-attributes-csv-import": {
"action": { "action": {
@ -914,6 +937,33 @@
}, },
"upload-csv": "Upload File Attributes Configuration" "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": { "file-preview": {
"assign-me": "Assign to me", "assign-me": "Assign to me",
"assign-reviewer": "Assign Reviewer", "assign-reviewer": "Assign Reviewer",

View File

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

View File

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