diff --git a/.prettierrc b/.prettierrc index 544138be4..c9f126c1d 100644 --- a/.prettierrc +++ b/.prettierrc @@ -1,3 +1,15 @@ { - "singleQuote": true + "useTabs": false, + "printWidth": 100, + "tabWidth": 4, + "singleQuote": true, + "trailingComma": "none", + "overrides": [ + { + "files": "{apps}/**/*.html", + "options": { + "parser": "angular" + } + } + ] } diff --git a/README.md b/README.md index 5377daedc..9be2254d5 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,9 @@ # Redaction ## Swagger Generated Code + To regnerate http rune swaagger + ``` BASE=http://ingress.redaction-timo-dev-401.178.63.47.73.xip.io/ URL="$BASE"v2/api-docs?group=redaction-gateway-v1 @@ -12,19 +14,19 @@ swagger-codegen generate -i "$URL" -l typescript-angular -o /tmp/swagger ## To Create a new Stack in rancher Goto rancher.iqser.com: Select Cluster `Development`, -go to apps, click launch and select `Redaction` from the `dev` section. +go to apps, click launch and select `Redaction` from the `dev` section. Add a new name and a new namespace. Select `answers-development.yaml` and add it to answers `Edit as yaml`. -For HTTPS / Cloudflare domain go to `workloads` -> `Loadbalancing` -> `select your stack` +For HTTPS / Cloudflare domain go to `workloads` -> `Loadbalancing` -> `select your stack` Add cloudflare certificate and specify a hostname to use `timo-redaction-dev.iqser.cloud` ## Keycloak Staging Config - keycloak: - authServerUrl: 'https://redkc-staging.iqser.cloud/auth' - client: - secret: 'a4e8aa56-03b0-4e6b-b822-8ac1f41280c4' +keycloak: +authServerUrl: 'https://redkc-staging.iqser.cloud/auth' +client: +secret: 'a4e8aa56-03b0-4e6b-b822-8ac1f41280c4' ## Default Testing URL @@ -35,13 +37,12 @@ timo-redaction-dev.iqser.cloud ## Test Users -| username | role | comment | -| --- | --- | --- | -| guest | | cannot use the application | -| user | RED_USER | | -| red_manager | RED_MANAGER | | -| useradmin | RED_ADMIN, RED_USER | has super power ! | -| manageradmin | RED_ADMIN RED_MANAGER RED_USER | has super super power ! | +| username | role | comment | +| ------------ | ------------------------------ | -------------------------- | +| guest | | cannot use the application | +| user | RED_USER | | +| red_manager | RED_MANAGER | | +| useradmin | RED_ADMIN, RED_USER | has super power ! | +| manageradmin | RED_ADMIN RED_MANAGER RED_USER | has super super power ! | Password for all users is `OsloImWinter` - diff --git a/angular.json b/angular.json index 3cfc52db6..d965a80d6 100644 --- a/angular.json +++ b/angular.json @@ -1,171 +1,157 @@ { - "version": 1, - "projects": { - "red-ui": { - "projectType": "application", - "schematics": { - "@schematics/angular:component": { - "style": "scss" - } - }, - "root": "apps/red-ui", - "sourceRoot": "apps/red-ui/src", - "prefix": "redaction", - "architect": { - "build": { - "builder": "@angular-devkit/build-angular:browser", - "options": { - "outputPath": "dist/apps/red-ui", - "index": "apps/red-ui/src/index.html", - "main": "apps/red-ui/src/main.ts", - "polyfills": "apps/red-ui/src/polyfills.ts", - "tsConfig": "apps/red-ui/tsconfig.app.json", - "aot": true, - "assets": [ - "apps/red-ui/src/favicon.ico", - { - "glob": "**/*", - "input": "node_modules/@pdftron/webviewer/public/", - "output": "/assets/wv-resources/" - }, - { - "glob": "**/*", - "input": "apps/red-ui/src/assets/", - "output": "/assets/" - }, - "apps/red-ui/src/manifest.webmanifest" - ], - "styles": [ - "apps/red-ui/src/styles.scss" - ], - "scripts": [ - "node_modules/@pdftron/webviewer/webviewer.min.js" - ] - }, - "configurations": { - "production": { - "fileReplacements": [ - { - "replace": "apps/red-ui/src/environments/environment.ts", - "with": "apps/red-ui/src/environments/environment.prod.ts" + "version": 1, + "projects": { + "red-ui": { + "projectType": "application", + "schematics": { + "@schematics/angular:component": { + "style": "scss" } - ], - "optimization": true, - "outputHashing": "all", - "sourceMap": false, - "extractCss": true, - "namedChunks": false, - "extractLicenses": true, - "vendorChunk": false, - "buildOptimizer": true, - "budgets": [ - { - "type": "initial", - "maximumWarning": "2mb", - "maximumError": "5mb" + }, + "root": "apps/red-ui", + "sourceRoot": "apps/red-ui/src", + "prefix": "redaction", + "architect": { + "build": { + "builder": "@angular-devkit/build-angular:browser", + "options": { + "outputPath": "dist/apps/red-ui", + "index": "apps/red-ui/src/index.html", + "main": "apps/red-ui/src/main.ts", + "polyfills": "apps/red-ui/src/polyfills.ts", + "tsConfig": "apps/red-ui/tsconfig.app.json", + "aot": true, + "assets": [ + "apps/red-ui/src/favicon.ico", + { + "glob": "**/*", + "input": "node_modules/@pdftron/webviewer/public/", + "output": "/assets/wv-resources/" + }, + { + "glob": "**/*", + "input": "apps/red-ui/src/assets/", + "output": "/assets/" + }, + "apps/red-ui/src/manifest.webmanifest" + ], + "styles": ["apps/red-ui/src/styles.scss"], + "scripts": ["node_modules/@pdftron/webviewer/webviewer.min.js"] + }, + "configurations": { + "production": { + "fileReplacements": [ + { + "replace": "apps/red-ui/src/environments/environment.ts", + "with": "apps/red-ui/src/environments/environment.prod.ts" + } + ], + "optimization": true, + "outputHashing": "all", + "sourceMap": false, + "extractCss": true, + "namedChunks": false, + "extractLicenses": true, + "vendorChunk": false, + "buildOptimizer": true, + "budgets": [ + { + "type": "initial", + "maximumWarning": "2mb", + "maximumError": "5mb" + }, + { + "type": "anyComponentStyle", + "maximumWarning": "6kb", + "maximumError": "10kb" + } + ], + "serviceWorker": true, + "ngswConfigPath": "apps/red-ui/ngsw-config.json" + } + } }, - { - "type": "anyComponentStyle", - "maximumWarning": "6kb", - "maximumError": "10kb" + "serve": { + "builder": "@angular-devkit/build-angular:dev-server", + "options": { + "browserTarget": "red-ui:build", + "proxyConfig": "apps/red-ui/proxy.conf.json" + }, + "configurations": { + "production": { + "browserTarget": "red-ui:build:production" + } + } + }, + "extract-i18n": { + "builder": "@angular-devkit/build-angular:extract-i18n", + "options": { + "browserTarget": "red-ui:build" + } + }, + "lint": { + "builder": "@angular-devkit/build-angular:tslint", + "options": { + "tsConfig": ["apps/red-ui/tsconfig.app.json"], + "exclude": ["**/node_modules/**", "!apps/red-ui/**/*"] + } + }, + "test": { + "builder": "@nrwl/jest:jest", + "options": { + "jestConfig": "apps/red-ui/jest.config.js", + "passWithNoTests": true + } } - ], - "serviceWorker": true, - "ngswConfigPath": "apps/red-ui/ngsw-config.json" } - } }, - "serve": { - "builder": "@angular-devkit/build-angular:dev-server", - "options": { - "browserTarget": "red-ui:build", - "proxyConfig": "apps/red-ui/proxy.conf.json" - }, - "configurations": { - "production": { - "browserTarget": "red-ui:build:production" + "red-ui-http": { + "projectType": "library", + "root": "libs/red-ui-http", + "sourceRoot": "libs/red-ui-http/src", + "prefix": "redaction", + "architect": { + "build": { + "builder": "@angular-devkit/build-ng-packagr:build", + "options": { + "tsConfig": "libs/red-ui-http/tsconfig.lib.json", + "project": "libs/red-ui-http/ng-package.json" + } + }, + "lint": { + "builder": "@angular-devkit/build-angular:tslint", + "options": { + "tsConfig": ["libs/red-ui-http/tsconfig.lib.json"], + "exclude": ["**/node_modules/**", "!libs/red-ui-http/**/*"] + } + }, + "test": { + "builder": "@nrwl/jest:jest", + "options": { + "jestConfig": "libs/red-ui-http/jest.config.js", + "passWithNoTests": true + } + } + }, + "schematics": { + "@schematics/angular:component": { + "style": "scss" + } } - } - }, - "extract-i18n": { - "builder": "@angular-devkit/build-angular:extract-i18n", - "options": { - "browserTarget": "red-ui:build" - } - }, - "lint": { - "builder": "@angular-devkit/build-angular:tslint", - "options": { - "tsConfig": [ - "apps/red-ui/tsconfig.app.json" - ], - "exclude": [ - "**/node_modules/**", - "!apps/red-ui/**/*" - ] - } - }, - "test": { - "builder": "@nrwl/jest:jest", - "options": { - "jestConfig": "apps/red-ui/jest.config.js", - "passWithNoTests": true - } } - } }, - "red-ui-http": { - "projectType": "library", - "root": "libs/red-ui-http", - "sourceRoot": "libs/red-ui-http/src", - "prefix": "redaction", - "architect": { - "build": { - "builder": "@angular-devkit/build-ng-packagr:build", - "options": { - "tsConfig": "libs/red-ui-http/tsconfig.lib.json", - "project": "libs/red-ui-http/ng-package.json" - } - }, - "lint": { - "builder": "@angular-devkit/build-angular:tslint", - "options": { - "tsConfig": [ - "libs/red-ui-http/tsconfig.lib.json" - ], - "exclude": [ - "**/node_modules/**", - "!libs/red-ui-http/**/*" - ] - } - }, - "test": { - "builder": "@nrwl/jest:jest", - "options": { - "jestConfig": "libs/red-ui-http/jest.config.js", - "passWithNoTests": true - } - } - }, - "schematics": { - "@schematics/angular:component": { - "style": "scss" - } - } - } - }, - "cli": { - "defaultCollection": "@nrwl/angular", - "analytics": false - }, - "schematics": { - "@nrwl/angular:application": { - "unitTestRunner": "jest", - "e2eTestRunner": "cypress" + "cli": { + "defaultCollection": "@nrwl/angular", + "analytics": false }, - "@nrwl/angular:library": { - "unitTestRunner": "jest" - } - }, - "defaultProject": "red-ui" + "schematics": { + "@nrwl/angular:application": { + "unitTestRunner": "jest", + "e2eTestRunner": "cypress" + }, + "@nrwl/angular:library": { + "unitTestRunner": "jest" + } + }, + "defaultProject": "red-ui" } diff --git a/apps/red-ui/jest.config.js b/apps/red-ui/jest.config.js index c48b0cb26..0efc9a215 100644 --- a/apps/red-ui/jest.config.js +++ b/apps/red-ui/jest.config.js @@ -1,21 +1,21 @@ module.exports = { - name: 'red-ui', - preset: '../../jest.config.js', - setupFilesAfterEnv: ['/src/test-setup.ts'], - globals: { - 'ts-jest': { - tsConfig: '/tsconfig.spec.json', - stringifyContentPathRegex: '\\.(html|svg)$', - astTransformers: [ - 'jest-preset-angular/build/InlineFilesTransformer', - 'jest-preset-angular/build/StripStylesTransformer', - ], + name: 'red-ui', + preset: '../../jest.config.js', + setupFilesAfterEnv: ['/src/test-setup.ts'], + globals: { + 'ts-jest': { + tsConfig: '/tsconfig.spec.json', + stringifyContentPathRegex: '\\.(html|svg)$', + astTransformers: [ + 'jest-preset-angular/build/InlineFilesTransformer', + 'jest-preset-angular/build/StripStylesTransformer' + ] + } }, - }, - coverageDirectory: '../../coverage/apps/red-ui', - snapshotSerializers: [ - 'jest-preset-angular/build/AngularNoNgAttributesSnapshotSerializer.js', - 'jest-preset-angular/build/AngularSnapshotSerializer.js', - 'jest-preset-angular/build/HTMLCommentSerializer.js', - ], + coverageDirectory: '../../coverage/apps/red-ui', + snapshotSerializers: [ + 'jest-preset-angular/build/AngularNoNgAttributesSnapshotSerializer.js', + 'jest-preset-angular/build/AngularSnapshotSerializer.js', + 'jest-preset-angular/build/HTMLCommentSerializer.js' + ] }; diff --git a/apps/red-ui/ngsw-config.json b/apps/red-ui/ngsw-config.json index ea7898845..3e250575f 100644 --- a/apps/red-ui/ngsw-config.json +++ b/apps/red-ui/ngsw-config.json @@ -1,30 +1,21 @@ { - "$schema": "../../node_modules/@angular/service-worker/config/schema.json", - "index": "/index.html", - "assetGroups": [ - { - "name": "app", - "installMode": "prefetch", - "resources": { - "files": [ - "/favicon.ico", - "/index.html", - "/manifest.webmanifest", - "/*.css", - "/*.js" - ] - } - }, - { - "name": "assets", - "installMode": "lazy", - "updateMode": "prefetch", - "resources": { - "files": [ - "/assets/**", - "/*.(eot|svg|cur|jpg|png|webp|gif|otf|ttf|woff|woff2|ani)" - ] - } - } - ] + "$schema": "../../node_modules/@angular/service-worker/config/schema.json", + "index": "/index.html", + "assetGroups": [ + { + "name": "app", + "installMode": "prefetch", + "resources": { + "files": ["/favicon.ico", "/index.html", "/manifest.webmanifest", "/*.css", "/*.js"] + } + }, + { + "name": "assets", + "installMode": "lazy", + "updateMode": "prefetch", + "resources": { + "files": ["/assets/**", "/*.(eot|svg|cur|jpg|png|webp|gif|otf|ttf|woff|woff2|ani)"] + } + } + ] } diff --git a/apps/red-ui/proxy.conf.json b/apps/red-ui/proxy.conf.json index fdc083715..91033ed01 100644 --- a/apps/red-ui/proxy.conf.json +++ b/apps/red-ui/proxy.conf.json @@ -1,56 +1,56 @@ { - "/project": { - "target": "https://timo-redaction-dev.iqser.cloud/", - "secure": false, - "changeOrigin": true, - "logLevel": "debug" - }, - "/reanalyze": { - "target": "https://timo-redaction-dev.iqser.cloud/", - "secure": false, - "changeOrigin": true, - "logLevel": "debug" - }, - "/upload": { - "target": "https://timo-redaction-dev.iqser.cloud/", - "secure": false, - "changeOrigin": true, - "logLevel": "debug" - }, - "/user": { - "target": "https://timo-redaction-dev.iqser.cloud/", - "secure": false, - "changeOrigin": true, - "logLevel": "debug" - }, - "/download": { - "target": "https://timo-redaction-dev.iqser.cloud/", - "secure": false, - "changeOrigin": true, - "logLevel": "debug" - }, - "/delete": { - "target": "https://timo-redaction-dev.iqser.cloud/", - "secure": false, - "changeOrigin": true, - "logLevel": "debug" - }, - "/status": { - "target": "https://timo-redaction-dev.iqser.cloud/", - "secure": false, - "changeOrigin": true, - "logLevel": "debug" - }, - "/dictionary": { - "target": "https://timo-redaction-dev.iqser.cloud/", - "secure": false, - "changeOrigin": true, - "logLevel": "debug" - }, - "/manualRedaction": { - "target": "https://timo-redaction-dev.iqser.cloud/", - "secure": false, - "changeOrigin": true, - "logLevel": "debug" - } + "/project": { + "target": "https://timo-redaction-dev.iqser.cloud/", + "secure": false, + "changeOrigin": true, + "logLevel": "debug" + }, + "/reanalyze": { + "target": "https://timo-redaction-dev.iqser.cloud/", + "secure": false, + "changeOrigin": true, + "logLevel": "debug" + }, + "/upload": { + "target": "https://timo-redaction-dev.iqser.cloud/", + "secure": false, + "changeOrigin": true, + "logLevel": "debug" + }, + "/user": { + "target": "https://timo-redaction-dev.iqser.cloud/", + "secure": false, + "changeOrigin": true, + "logLevel": "debug" + }, + "/download": { + "target": "https://timo-redaction-dev.iqser.cloud/", + "secure": false, + "changeOrigin": true, + "logLevel": "debug" + }, + "/delete": { + "target": "https://timo-redaction-dev.iqser.cloud/", + "secure": false, + "changeOrigin": true, + "logLevel": "debug" + }, + "/status": { + "target": "https://timo-redaction-dev.iqser.cloud/", + "secure": false, + "changeOrigin": true, + "logLevel": "debug" + }, + "/dictionary": { + "target": "https://timo-redaction-dev.iqser.cloud/", + "secure": false, + "changeOrigin": true, + "logLevel": "debug" + }, + "/manualRedaction": { + "target": "https://timo-redaction-dev.iqser.cloud/", + "secure": false, + "changeOrigin": true, + "logLevel": "debug" + } } diff --git a/apps/red-ui/src/app/app-config/app-config.module.ts b/apps/red-ui/src/app/app-config/app-config.module.ts index dfbdb6fa0..c6efa828c 100644 --- a/apps/red-ui/src/app/app-config/app-config.module.ts +++ b/apps/red-ui/src/app/app-config/app-config.module.ts @@ -1,18 +1,11 @@ -import {NgModule} from "@angular/core"; -import {CommonModule} from "@angular/common"; -import {HttpClientModule} from "@angular/common/http"; -import {AppConfigService} from "./app-config.service"; +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { HttpClientModule } from '@angular/common/http'; +import { AppConfigService } from './app-config.service'; @NgModule({ - declarations: [], - imports: [ - CommonModule, - HttpClientModule, - ], - providers: [ - AppConfigService, - ], + declarations: [], + imports: [CommonModule, HttpClientModule], + providers: [AppConfigService] }) -export class AppConfigModule { - -} +export class AppConfigModule {} diff --git a/apps/red-ui/src/app/app-config/app-config.service.ts b/apps/red-ui/src/app/app-config/app-config.service.ts index f3c14b043..bf2eafc22 100644 --- a/apps/red-ui/src/app/app-config/app-config.service.ts +++ b/apps/red-ui/src/app/app-config/app-config.service.ts @@ -1,36 +1,34 @@ -import {Injectable} from "@angular/core"; -import {HttpClient} from "@angular/common/http"; -import {tap} from "rxjs/operators"; -import {Observable} from "rxjs"; - +import { Injectable } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; +import { tap } from 'rxjs/operators'; +import { Observable } from 'rxjs'; export enum AppConfigKey { - OAUTH_URL = "OAUTH_URL", - OAUTH_CLIENT_ID = "OAUTH_CLIENT_ID", - API_URL = "API_URL", - PDFTRON_LICENSE ="PDFTRON_LICENSE", - ADMIN_CONTACT_NAME="ADMIN_CONTACT_NAME", - ADMIN_CONTACT_URL="ADMIN_CONTACT_URL", + OAUTH_URL = 'OAUTH_URL', + OAUTH_CLIENT_ID = 'OAUTH_CLIENT_ID', + API_URL = 'API_URL', + PDFTRON_LICENSE = 'PDFTRON_LICENSE', + ADMIN_CONTACT_NAME = 'ADMIN_CONTACT_NAME', + ADMIN_CONTACT_URL = 'ADMIN_CONTACT_URL' } @Injectable({ - providedIn: 'root' + providedIn: 'root' }) export class AppConfigService { + private _config: { [key in AppConfigKey]?: any } = {}; - private _config: { [key in AppConfigKey]?: any } = {}; + constructor(private readonly _httpClient: HttpClient) {} - constructor(private readonly _httpClient: HttpClient) { - } - - loadAppConfig(): Observable { - return this._httpClient.get("/assets/config/config.json").pipe(tap(config => { - this._config = config; - })); - } - - getConfig(key: AppConfigKey, defaultValue?: any) { - return this._config[key] ? this._config[key] : defaultValue; - } + loadAppConfig(): Observable { + return this._httpClient.get('/assets/config/config.json').pipe( + tap((config) => { + this._config = config; + }) + ); + } + getConfig(key: AppConfigKey, defaultValue?: any) { + return this._config[key] ? this._config[key] : defaultValue; + } } diff --git a/apps/red-ui/src/app/app.component.html b/apps/red-ui/src/app/app.component.html index 80f9c88ad..7115e458f 100644 --- a/apps/red-ui/src/app/app.component.html +++ b/apps/red-ui/src/app/app.component.html @@ -1,2 +1,4 @@ - + diff --git a/apps/red-ui/src/app/app.component.ts b/apps/red-ui/src/app/app.component.ts index 5300be8bb..e8bfc9c8b 100644 --- a/apps/red-ui/src/app/app.component.ts +++ b/apps/red-ui/src/app/app.component.ts @@ -1,15 +1,11 @@ -import {Component} from '@angular/core'; -import {AppLoadStateService} from "./utils/app-load-state.service"; +import { Component } from '@angular/core'; +import { AppLoadStateService } from './utils/app-load-state.service'; @Component({ - selector: 'redaction-root', - templateUrl: './app.component.html', - styleUrls: ['./app.component.scss'], + selector: 'redaction-root', + templateUrl: './app.component.html', + styleUrls: ['./app.component.scss'] }) export class AppComponent { - - constructor(public appLoadStateService: AppLoadStateService){ - - } - + constructor(public appLoadStateService: AppLoadStateService) {} } diff --git a/apps/red-ui/src/app/app.module.ts b/apps/red-ui/src/app/app.module.ts index 93e591ad6..d68122dc0 100644 --- a/apps/red-ui/src/app/app.module.ts +++ b/apps/red-ui/src/app/app.module.ts @@ -57,146 +57,150 @@ import { AuthErrorComponent } from './screens/auth-error/auth-error.component'; import { RedRoleGuard } from './auth/red-role.guard'; import { MatListModule } from '@angular/material/list'; import { AssignOwnerDialogComponent } from './dialogs/assign-owner-dialog/assign-owner-dialog.component'; -import {MatDatepickerModule} from "@angular/material/datepicker"; -import {MatNativeDateModule} from "@angular/material/core"; -import {MatInputModule} from "@angular/material/input"; +import { MatDatepickerModule } from '@angular/material/datepicker'; +import { MatNativeDateModule } from '@angular/material/core'; +import { MatInputModule } from '@angular/material/input'; export function HttpLoaderFactory(httpClient: HttpClient) { - return new TranslateHttpLoader(httpClient, '/assets/i18n/', '.json'); + return new TranslateHttpLoader(httpClient, '/assets/i18n/', '.json'); } @NgModule({ - declarations: [ - AppComponent, - BaseScreenComponent, - ProjectListingScreenComponent, - ProjectOverviewScreenComponent, - AddEditProjectDialogComponent, - ConfirmationDialogComponent, - FilePreviewScreenComponent, - PdfViewerComponent, - FileDetailsDialogComponent, - ProjectDetailsDialogComponent, - AssignOwnerDialogComponent, - FullPageLoadingIndicatorComponent, - InitialsAvatarComponent, - StatusBarComponent, - LogoComponent, - SimpleDoughnutChartComponent, - ManualRedactionDialogComponent, - AnnotationIconComponent, - AuthErrorComponent - ], - imports: [ - BrowserModule, - BrowserAnimationsModule, - FormsModule, - ReactiveFormsModule, - HttpClientModule, - AuthModule, - IconsModule, - ApiModule, - MatDialogModule, - MatNativeDateModule, - TranslateModule.forRoot({ - loader: { - provide: TranslateLoader, - useFactory: HttpLoaderFactory, - deps: [HttpClient] - } - }), - RouterModule.forRoot([ - { - path: '', - redirectTo: 'ui/projects', - pathMatch: 'full' - }, - { - path: 'auth-error', - component: AuthErrorComponent, - canActivate: [AuthGuard] - }, - { - path: 'ui', - component: BaseScreenComponent, - children: [ - { - path: 'projects', - component: ProjectListingScreenComponent, - canActivate: [CompositeRouteGuard], - data: { - routeGuards: [AuthGuard, RedRoleGuard, AppStateGuard] + declarations: [ + AppComponent, + BaseScreenComponent, + ProjectListingScreenComponent, + ProjectOverviewScreenComponent, + AddEditProjectDialogComponent, + ConfirmationDialogComponent, + FilePreviewScreenComponent, + PdfViewerComponent, + FileDetailsDialogComponent, + ProjectDetailsDialogComponent, + AssignOwnerDialogComponent, + FullPageLoadingIndicatorComponent, + InitialsAvatarComponent, + StatusBarComponent, + LogoComponent, + SimpleDoughnutChartComponent, + ManualRedactionDialogComponent, + AnnotationIconComponent, + AuthErrorComponent + ], + imports: [ + BrowserModule, + BrowserAnimationsModule, + FormsModule, + ReactiveFormsModule, + HttpClientModule, + AuthModule, + IconsModule, + ApiModule, + MatDialogModule, + MatNativeDateModule, + TranslateModule.forRoot({ + loader: { + provide: TranslateLoader, + useFactory: HttpLoaderFactory, + deps: [HttpClient] } - }, - { - path: 'projects/:projectId', - component: ProjectOverviewScreenComponent, - canActivate: [CompositeRouteGuard], - data: { - routeGuards: [AuthGuard, RedRoleGuard, AppStateGuard] + }), + RouterModule.forRoot([ + { + path: '', + redirectTo: 'ui/projects', + pathMatch: 'full' + }, + { + path: 'auth-error', + component: AuthErrorComponent, + canActivate: [AuthGuard] + }, + { + path: 'ui', + component: BaseScreenComponent, + children: [ + { + path: 'projects', + component: ProjectListingScreenComponent, + canActivate: [CompositeRouteGuard], + data: { + routeGuards: [AuthGuard, RedRoleGuard, AppStateGuard] + } + }, + { + path: 'projects/:projectId', + component: ProjectOverviewScreenComponent, + canActivate: [CompositeRouteGuard], + data: { + routeGuards: [AuthGuard, RedRoleGuard, AppStateGuard] + } + }, + { + path: 'projects/:projectId/file/:fileId', + component: FilePreviewScreenComponent, + canActivate: [CompositeRouteGuard], + data: { + routeGuards: [AuthGuard, RedRoleGuard, AppStateGuard] + } + } + ] } - }, - { - path: 'projects/:projectId/file/:fileId', - component: FilePreviewScreenComponent, - canActivate: [CompositeRouteGuard], - data: { - routeGuards: [AuthGuard, RedRoleGuard, AppStateGuard] - } - } - ] - } - - ]), - NgpSortModule, - MatToolbarModule, - MatButtonModule, - MatSlideToggleModule, - MatMenuModule, - MatIconModule, - MatTooltipModule, - MatSnackBarModule, - MatTabsModule, - MatButtonToggleModule, - MatFormFieldModule, - ToastrModule.forRoot(), - MatSelectModule, - MatSidenavModule, - FileUploadModule, - ServiceWorkerModule.register('ngsw-worker.js', {enabled: environment.production}), - MatProgressSpinnerModule, - MatCheckboxModule, - MatListModule, - MatDatepickerModule, - MatInputModule - ], - providers: [{ - provide: HTTP_INTERCEPTORS, - multi: true, - useClass: ApiPathInterceptorService - }, { - provide: APP_INITIALIZER, - multi: true, - useFactory: languageInitializer, - deps: [LanguageService] - }], - bootstrap: [AppComponent] + ]), + NgpSortModule, + MatToolbarModule, + MatButtonModule, + MatSlideToggleModule, + MatMenuModule, + MatIconModule, + MatTooltipModule, + MatSnackBarModule, + MatTabsModule, + MatButtonToggleModule, + MatFormFieldModule, + ToastrModule.forRoot(), + MatSelectModule, + MatSidenavModule, + FileUploadModule, + ServiceWorkerModule.register('ngsw-worker.js', { enabled: environment.production }), + MatProgressSpinnerModule, + MatCheckboxModule, + MatListModule, + MatDatepickerModule, + MatInputModule + ], + providers: [ + { + provide: HTTP_INTERCEPTORS, + multi: true, + useClass: ApiPathInterceptorService + }, + { + provide: APP_INITIALIZER, + multi: true, + useFactory: languageInitializer, + deps: [LanguageService] + } + ], + bootstrap: [AppComponent] }) export class AppModule { - - constructor(private router: Router, private route: ActivatedRoute) { - route.queryParamMap.subscribe(queryParams => { - if (queryParams.has('code') || queryParams.has('state') || queryParams.has('session_state')) { - this.router.navigate([], { - queryParams: { - 'state': null, - 'session_state': null, - 'code': null - }, - queryParamsHandling: 'merge' + constructor(private router: Router, private route: ActivatedRoute) { + route.queryParamMap.subscribe((queryParams) => { + if ( + queryParams.has('code') || + queryParams.has('state') || + queryParams.has('session_state') + ) { + this.router.navigate([], { + queryParams: { + state: null, + session_state: null, + code: null + }, + queryParamsHandling: 'merge' + }); + } }); - } - }); - - } + } } diff --git a/apps/red-ui/src/app/auth/auth.guard.ts b/apps/red-ui/src/app/auth/auth.guard.ts index 4c773ce8b..48ec5ed83 100644 --- a/apps/red-ui/src/app/auth/auth.guard.ts +++ b/apps/red-ui/src/app/auth/auth.guard.ts @@ -1,30 +1,30 @@ -import {Injectable} from "@angular/core"; -import {ActivatedRouteSnapshot, Router, RouterStateSnapshot} from "@angular/router"; -import {KeycloakAuthGuard, KeycloakService} from "keycloak-angular"; -import {UserService} from "../user/user.service"; -import {AppLoadStateService} from "../utils/app-load-state.service"; +import { Injectable } from '@angular/core'; +import { ActivatedRouteSnapshot, Router, RouterStateSnapshot } from '@angular/router'; +import { KeycloakAuthGuard, KeycloakService } from 'keycloak-angular'; +import { UserService } from '../user/user.service'; +import { AppLoadStateService } from '../utils/app-load-state.service'; @Injectable({ - providedIn: 'root', + providedIn: 'root' }) export class AuthGuard extends KeycloakAuthGuard { - constructor( - protected readonly _router: Router, - protected readonly _keycloak: KeycloakService, - private readonly _appLoadStateService: AppLoadStateService, - private readonly _userService: UserService - ) { - super(_router, _keycloak); - } - - public async isAccessAllowed(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) { - if (!this.authenticated) { - await this._keycloak.login({ - redirectUri: window.location.origin + state.url, - }); + constructor( + protected readonly _router: Router, + protected readonly _keycloak: KeycloakService, + private readonly _appLoadStateService: AppLoadStateService, + private readonly _userService: UserService + ) { + super(_router, _keycloak); } - await this._userService.loadCurrentUser(); - return true; - } + public async isAccessAllowed(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) { + if (!this.authenticated) { + await this._keycloak.login({ + redirectUri: window.location.origin + state.url + }); + } + + await this._userService.loadCurrentUser(); + return true; + } } diff --git a/apps/red-ui/src/app/auth/auth.module.ts b/apps/red-ui/src/app/auth/auth.module.ts index 2b7055b35..45d443fe7 100644 --- a/apps/red-ui/src/app/auth/auth.module.ts +++ b/apps/red-ui/src/app/auth/auth.module.ts @@ -1,59 +1,50 @@ -import {APP_INITIALIZER, NgModule} from "@angular/core"; -import {CommonModule} from "@angular/common"; -import {HttpClientModule} from "@angular/common/http"; -import {AppConfigModule} from "../app-config/app-config.module"; - - -import {KeycloakAngularModule, KeycloakService} from "keycloak-angular"; -import {AppConfigKey, AppConfigService} from "../app-config/app-config.service"; +import { APP_INITIALIZER, NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { HttpClientModule } from '@angular/common/http'; +import { AppConfigModule } from '../app-config/app-config.module'; +import { KeycloakAngularModule, KeycloakService } from 'keycloak-angular'; +import { AppConfigKey, AppConfigService } from '../app-config/app-config.service'; export function keycloakInitializer(keycloak: KeycloakService, appConfigService: AppConfigService) { - return () => { - return appConfigService.loadAppConfig().toPromise().then(() => { - - let url = appConfigService.getConfig(AppConfigKey.OAUTH_URL); - url = url.replace(/\/$/, ""); // remove trailing slash - const realm = url.substring(url.lastIndexOf("/") + 1, url.length); - url = url.substr(0, url.lastIndexOf("/realms")); - return keycloak.init({ - config: { - url: url, - realm: realm, - clientId: appConfigService.getConfig(AppConfigKey.OAUTH_CLIENT_ID) - }, - initOptions: { - checkLoginIframe: false, - onLoad: 'check-sso', - silentCheckSsoRedirectUri: - window.location.origin + '/assets/oauth/silent-refresh.html', - flow: 'standard' - }, - enableBearerInterceptor: true, - }) - }); - } + return () => { + return appConfigService + .loadAppConfig() + .toPromise() + .then(() => { + let url = appConfigService.getConfig(AppConfigKey.OAUTH_URL); + url = url.replace(/\/$/, ''); // remove trailing slash + const realm = url.substring(url.lastIndexOf('/') + 1, url.length); + url = url.substr(0, url.lastIndexOf('/realms')); + return keycloak.init({ + config: { + url: url, + realm: realm, + clientId: appConfigService.getConfig(AppConfigKey.OAUTH_CLIENT_ID) + }, + initOptions: { + checkLoginIframe: false, + onLoad: 'check-sso', + silentCheckSsoRedirectUri: + window.location.origin + '/assets/oauth/silent-refresh.html', + flow: 'standard' + }, + enableBearerInterceptor: true + }); + }); + }; } - @NgModule({ - declarations: [], - imports: [ - CommonModule, - HttpClientModule, - KeycloakAngularModule, - AppConfigModule, - ], - providers: [ - { - provide: APP_INITIALIZER, - useFactory: keycloakInitializer, - multi: true, - deps: [KeycloakService, AppConfigService], - }, - ], + declarations: [], + imports: [CommonModule, HttpClientModule, KeycloakAngularModule, AppConfigModule], + providers: [ + { + provide: APP_INITIALIZER, + useFactory: keycloakInitializer, + multi: true, + deps: [KeycloakService, AppConfigService] + } + ] }) -export class AuthModule { - -} - +export class AuthModule {} diff --git a/apps/red-ui/src/app/auth/red-role.guard.ts b/apps/red-ui/src/app/auth/red-role.guard.ts index 8795075ca..bbd9fdcd8 100644 --- a/apps/red-ui/src/app/auth/red-role.guard.ts +++ b/apps/red-ui/src/app/auth/red-role.guard.ts @@ -1,37 +1,34 @@ -import {Injectable} from "@angular/core"; -import {ActivatedRouteSnapshot, CanActivate, Router, RouterStateSnapshot} from "@angular/router"; -import {KeycloakService} from "keycloak-angular"; -import {UserService} from "../user/user.service"; -import {AppLoadStateService} from "../utils/app-load-state.service"; -import {Observable} from "rxjs"; +import { Injectable } from '@angular/core'; +import { ActivatedRouteSnapshot, CanActivate, Router, RouterStateSnapshot } from '@angular/router'; +import { KeycloakService } from 'keycloak-angular'; +import { UserService } from '../user/user.service'; +import { AppLoadStateService } from '../utils/app-load-state.service'; +import { Observable } from 'rxjs'; -class UrlTree { -} +class UrlTree {} @Injectable({ - providedIn: 'root', + providedIn: 'root' }) export class RedRoleGuard implements CanActivate { - constructor( - protected readonly _router: Router, - protected readonly _keycloak: KeycloakService, - private readonly _appLoadStateService: AppLoadStateService, - private readonly _userService: UserService - ) { - } - - canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable { - return new Observable(obs => { - if (!this._userService.user.hasAnyREDRoles) { - this._router.navigate(['/auth-error']); - this._appLoadStateService.pushLoadingEvent(false); - obs.next(false); - obs.complete(); - } else { - obs.next(true); - obs.complete(); - } - }) - } + constructor( + protected readonly _router: Router, + protected readonly _keycloak: KeycloakService, + private readonly _appLoadStateService: AppLoadStateService, + private readonly _userService: UserService + ) {} + canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable { + return new Observable((obs) => { + if (!this._userService.user.hasAnyREDRoles) { + this._router.navigate(['/auth-error']); + this._appLoadStateService.pushLoadingEvent(false); + obs.next(false); + obs.complete(); + } else { + obs.next(true); + obs.complete(); + } + }); + } } diff --git a/apps/red-ui/src/app/common/confirmation-dialog/confirmation-dialog.component.html b/apps/red-ui/src/app/common/confirmation-dialog/confirmation-dialog.component.html index 6d4502695..a2c0d6dd9 100644 --- a/apps/red-ui/src/app/common/confirmation-dialog/confirmation-dialog.component.html +++ b/apps/red-ui/src/app/common/confirmation-dialog/confirmation-dialog.component.html @@ -1,19 +1,20 @@
-
-
+
-
-

-
+
+

+
-
- - -
+
+ + +
- +
diff --git a/apps/red-ui/src/app/common/confirmation-dialog/confirmation-dialog.component.ts b/apps/red-ui/src/app/common/confirmation-dialog/confirmation-dialog.component.ts index c7455768d..51804b6b2 100644 --- a/apps/red-ui/src/app/common/confirmation-dialog/confirmation-dialog.component.ts +++ b/apps/red-ui/src/app/common/confirmation-dialog/confirmation-dialog.component.ts @@ -1,56 +1,54 @@ -import {Component, Inject, OnInit} from '@angular/core'; -import {TranslateService} from "@ngx-translate/core"; -import {MAT_DIALOG_DATA, MatDialogRef} from "@angular/material/dialog"; - +import { Component, Inject, OnInit } from '@angular/core'; +import { TranslateService } from '@ngx-translate/core'; +import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; export class ConfirmationDialogInput { + public title?: string; + public question?: string; + public confirmationText?: string; + public denyText?: string; - public title?: string; - public question?: string; - public confirmationText?: string; - public denyText?: string; + constructor(options: ConfirmationDialogInput) { + this.title = options.title || ConfirmationDialogInput.default().title; + this.question = options.question || ConfirmationDialogInput.default().question; + this.confirmationText = + options.confirmationText || ConfirmationDialogInput.default().confirmationText; + this.denyText = options.denyText || ConfirmationDialogInput.default().denyText; + } - constructor(options: ConfirmationDialogInput) { - this.title = options.title || ConfirmationDialogInput.default().title; - this.question = options.question || ConfirmationDialogInput.default().question; - this.confirmationText = options.confirmationText || ConfirmationDialogInput.default().confirmationText; - this.denyText = options.denyText || ConfirmationDialogInput.default().denyText; - } - - static default() { - return new ConfirmationDialogInput({ - title: 'common.confirmation-dialog.title.label', - question: 'common.confirmation-dialog.description.label', - confirmationText: 'common.confirmation-dialog.confirm.label', - denyText: 'common.confirmation-dialog.deny.label' - }); - } + static default() { + return new ConfirmationDialogInput({ + title: 'common.confirmation-dialog.title.label', + question: 'common.confirmation-dialog.description.label', + confirmationText: 'common.confirmation-dialog.confirm.label', + denyText: 'common.confirmation-dialog.deny.label' + }); + } } @Component({ - selector: 'redaction-confirmation-dialog', - templateUrl: './confirmation-dialog.component.html', - styleUrls: ['./confirmation-dialog.component.scss'] + selector: 'redaction-confirmation-dialog', + templateUrl: './confirmation-dialog.component.html', + styleUrls: ['./confirmation-dialog.component.scss'] }) export class ConfirmationDialogComponent implements OnInit { - - constructor( - private readonly _translateService: TranslateService, - public dialogRef: MatDialogRef, - @Inject(MAT_DIALOG_DATA) public confirmationDialogInput: ConfirmationDialogInput) { - if (!confirmationDialogInput) { - this.confirmationDialogInput = ConfirmationDialogInput.default(); + constructor( + private readonly _translateService: TranslateService, + public dialogRef: MatDialogRef, + @Inject(MAT_DIALOG_DATA) public confirmationDialogInput: ConfirmationDialogInput + ) { + if (!confirmationDialogInput) { + this.confirmationDialogInput = ConfirmationDialogInput.default(); + } } - } - ngOnInit(): void { - } + ngOnInit(): void {} - deny() { - this.dialogRef.close(); - } + deny() { + this.dialogRef.close(); + } - confirm() { - this.dialogRef.close(true); - } + confirm() { + this.dialogRef.close(true); + } } diff --git a/apps/red-ui/src/app/common/initials-avatar/initials-avatar.component.scss b/apps/red-ui/src/app/common/initials-avatar/initials-avatar.component.scss index 3508353d3..070f2e800 100644 --- a/apps/red-ui/src/app/common/initials-avatar/initials-avatar.component.scss +++ b/apps/red-ui/src/app/common/initials-avatar/initials-avatar.component.scss @@ -1,6 +1,6 @@ -@import "../../../assets/styles/red-variables"; +@import '../../../assets/styles/red-variables'; .flex-row { - flex-wrap: wrap; - gap: 12px; + flex-wrap: wrap; + gap: 12px; } diff --git a/apps/red-ui/src/app/components/annotation-icon/annotation-icon.component.html b/apps/red-ui/src/app/components/annotation-icon/annotation-icon.component.html index 73d7131ff..f5fe7f12d 100644 --- a/apps/red-ui/src/app/components/annotation-icon/annotation-icon.component.html +++ b/apps/red-ui/src/app/components/annotation-icon/annotation-icon.component.html @@ -1,3 +1,3 @@
- {{ type[0] }} + {{ type[0] }}
diff --git a/apps/red-ui/src/app/components/annotation-icon/annotation-icon.component.scss b/apps/red-ui/src/app/components/annotation-icon/annotation-icon.component.scss index 21166dce4..360662073 100644 --- a/apps/red-ui/src/app/components/annotation-icon/annotation-icon.component.scss +++ b/apps/red-ui/src/app/components/annotation-icon/annotation-icon.component.scss @@ -1,68 +1,72 @@ -@import "../../../assets/styles/red-variables"; +@import '../../../assets/styles/red-variables'; .icon { - height: 16px; - width: 16px; - font-size: 11px; - line-height: 14px; - font-weight: 600; - display: flex; - justify-content: center; - align-items: center; - text-align: center; - text-transform: uppercase; - color: $white; + height: 16px; + width: 16px; + font-size: 11px; + line-height: 14px; + font-weight: 600; + display: flex; + justify-content: center; + align-items: center; + text-align: center; + text-transform: uppercase; + color: $white; } .suggestion { - width: 0; - height: 0; - border: 9px solid transparent; - border-bottom-color: $grey-1; - position: relative; - top: -9px; - - &:after { - content: ''; - position: absolute; - left: -9px; - top: 9px; width: 0; height: 0; border: 9px solid transparent; - border-top-color: $grey-1; - } + border-bottom-color: $grey-1; + position: relative; + top: -9px; - span { - transform: translateY(9px); - z-index: 2; - } + &:after { + content: ''; + position: absolute; + left: -9px; + top: 9px; + width: 0; + height: 0; + border: 9px solid transparent; + border-top-color: $grey-1; + } + + span { + transform: translateY(9px); + z-index: 2; + } } -.hint, .comment, .ignore { - border-radius: 50%; +.hint, +.comment, +.ignore { + border-radius: 50%; } -.hint, .redaction, .comment { - background-color: $grey-1; +.hint, +.redaction, +.comment { + background-color: $grey-1; } -.request{ - background-color: $blue-1; +.request { + background-color: $blue-1; } .ignore { - background-color: $grey-5; + background-color: $grey-5; } .hint_only { - background-color: $orange-1; + background-color: $orange-1; } .vertebrate { - background-color: $green-1; + background-color: $green-1; } .names { - background-color: $yellow-2; + background-color: $yellow-2; } diff --git a/apps/red-ui/src/app/components/annotation-icon/annotation-icon.component.ts b/apps/red-ui/src/app/components/annotation-icon/annotation-icon.component.ts index 0c50865e6..b317716b9 100644 --- a/apps/red-ui/src/app/components/annotation-icon/annotation-icon.component.ts +++ b/apps/red-ui/src/app/components/annotation-icon/annotation-icon.component.ts @@ -1,16 +1,14 @@ import { Component, Input, OnInit } from '@angular/core'; @Component({ - selector: 'redaction-annotation-icon', - templateUrl: './annotation-icon.component.html', - styleUrls: ['./annotation-icon.component.scss'] + selector: 'redaction-annotation-icon', + templateUrl: './annotation-icon.component.html', + styleUrls: ['./annotation-icon.component.scss'] }) export class AnnotationIconComponent implements OnInit { - @Input() public type: 'hint' | 'redaction' | 'suggestion' | 'ignore' | 'comment' | 'request'; + @Input() public type: 'hint' | 'redaction' | 'suggestion' | 'ignore' | 'comment' | 'request'; - constructor() { - } + constructor() {} - ngOnInit(): void { - } + ngOnInit(): void {} } diff --git a/apps/red-ui/src/app/components/simple-doughnut-chart/simple-doughnut-chart.component.html b/apps/red-ui/src/app/components/simple-doughnut-chart/simple-doughnut-chart.component.html index 16d61fd75..4e12d8435 100644 --- a/apps/red-ui/src/app/components/simple-doughnut-chart/simple-doughnut-chart.component.html +++ b/apps/red-ui/src/app/components/simple-doughnut-chart/simple-doughnut-chart.component.html @@ -1,30 +1,48 @@
- - - - - + + + + + -
-
{{ dataTotal }}
-
{{ subtitle | translate }}
-
- -
-
-
- - -
+
+
{{ dataTotal }}
+
{{ subtitle | translate }}
+
+ +
+
+
+ + +
+
-
diff --git a/apps/red-ui/src/app/components/simple-doughnut-chart/simple-doughnut-chart.component.scss b/apps/red-ui/src/app/components/simple-doughnut-chart/simple-doughnut-chart.component.scss index 0b06c637b..e3e8ddbac 100644 --- a/apps/red-ui/src/app/components/simple-doughnut-chart/simple-doughnut-chart.component.scss +++ b/apps/red-ui/src/app/components/simple-doughnut-chart/simple-doughnut-chart.component.scss @@ -1,40 +1,39 @@ -@import "../../../assets/styles/red-variables"; +@import '../../../assets/styles/red-variables'; .container { - position: relative; - display: flex; - align-items: center; - gap: 20px; + position: relative; + display: flex; + align-items: center; + gap: 20px; - &.column { - flex-direction: column; - } + &.column { + flex-direction: column; + } } .text-container { - position: absolute; - top: 0; - display: flex; - flex-direction: column; - justify-content: center; - align-items: center; - box-sizing: border-box; + position: absolute; + top: 0; + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + box-sizing: border-box; } .breakdown-container { - display: flex; - flex-direction: column; - align-items: center; - gap: 8px; - - div { - width: fit-content; display: flex; flex-direction: column; + align-items: center; gap: 8px; - } -} + div { + width: fit-content; + display: flex; + flex-direction: column; + gap: 8px; + } +} // 'UNPROCESSED' // | 'REPROCESS' @@ -46,43 +45,43 @@ // | 'APPROVED'; circle { - &.UNASSIGNED { - stroke: $grey-5; - } + &.UNASSIGNED { + stroke: $grey-5; + } - &.UNPROCESSED { - stroke: $grey-3; - } + &.UNPROCESSED { + stroke: $grey-3; + } - &.UNDER_REVIEW { - stroke: $yellow-1; - } + &.UNDER_REVIEW { + stroke: $yellow-1; + } - &.UNDER_APPROVAL { - stroke: $blue-4; - } + &.UNDER_APPROVAL { + stroke: $blue-4; + } - &.APPROVED { - stroke: $blue-3; - } + &.APPROVED { + stroke: $blue-3; + } - &.PROCESSING { - stroke: $green-2 - } + &.PROCESSING { + stroke: $green-2; + } - &.REPROCESS { - stroke: $green-1 - } + &.REPROCESS { + stroke: $green-1; + } - &.ERROR { - stroke: $red-1; - } + &.ERROR { + stroke: $red-1; + } - &.ACTIVE { - stroke: $primary; - } + &.ACTIVE { + stroke: $primary; + } - &.ARCHIVED { - stroke: rgba($red-1, 0.1); - } + &.ARCHIVED { + stroke: rgba($red-1, 0.1); + } } diff --git a/apps/red-ui/src/app/components/simple-doughnut-chart/simple-doughnut-chart.component.ts b/apps/red-ui/src/app/components/simple-doughnut-chart/simple-doughnut-chart.component.ts index c6fe21fb8..3b6d55b34 100644 --- a/apps/red-ui/src/app/components/simple-doughnut-chart/simple-doughnut-chart.component.ts +++ b/apps/red-ui/src/app/components/simple-doughnut-chart/simple-doughnut-chart.component.ts @@ -1,79 +1,75 @@ -import {Component, Input, OnChanges, OnInit, SimpleChanges} from '@angular/core'; +import { Component, Input, OnChanges, OnInit, SimpleChanges } from '@angular/core'; import { Color } from '../../utils/types'; export class DoughnutChartConfig { - value: number; - color: Color; - label: string; + value: number; + color: Color; + label: string; } @Component({ - selector: 'redaction-simple-doughnut-chart', - templateUrl: './simple-doughnut-chart.component.html', - styleUrls: ['./simple-doughnut-chart.component.scss'] + selector: 'redaction-simple-doughnut-chart', + templateUrl: './simple-doughnut-chart.component.html', + styleUrls: ['./simple-doughnut-chart.component.scss'] }) export class SimpleDoughnutChartComponent implements OnChanges { + @Input() subtitle: string; + @Input() config: DoughnutChartConfig[] = []; + @Input() radius = 85; + @Input() strokeWidth = 20; + @Input() direction: 'row' | 'column' = 'column'; - @Input() subtitle: string; - @Input() config: DoughnutChartConfig[] = []; - @Input() radius = 85; - @Input() strokeWidth = 20; - @Input() direction: 'row' | 'column' = 'column'; + public chartData: any[] = []; + public perimeter: number; + public cx = 0; + public cy = 0; + public size = 0; - public chartData: any[] = []; - public perimeter: number; - public cx = 0; - public cy = 0; - public size = 0; + constructor() {} - constructor() { - } + ngOnChanges(changes: SimpleChanges): void { + this.calculateChartData(); + this.cx = this.radius + this.strokeWidth / 2; + this.cy = this.radius + this.strokeWidth / 2; + this.size = this.strokeWidth + this.radius * 2; + } - ngOnChanges(changes: SimpleChanges): void { - this.calculateChartData(); - this.cx = this.radius + (this.strokeWidth / 2); - this.cy = this.radius + (this.strokeWidth / 2); - this.size = this.strokeWidth+(this.radius * 2) ; - } + get circumference() { + return 2 * Math.PI * this.radius; + } - get circumference() { - return 2 * Math.PI * this.radius; - }; + get dataTotal() { + return this.config.map((v) => v.value).reduce((acc, val) => acc + val, 0); + } - get dataTotal() { - return this.config.map(v => v.value).reduce((acc, val) => acc + val, 0); - }; + calculateChartData() { + const newData = []; + let angleOffset = -90; + this.config.forEach((dataVal) => { + const data = { + degrees: angleOffset + }; + newData.push(data); + angleOffset = this.dataPercentage(dataVal.value) * 360 + angleOffset; + }); + this.chartData = newData; + } - calculateChartData() { - const newData = []; - let angleOffset = -90; - this.config.forEach((dataVal) => { - const data = { - degrees: angleOffset, - } - newData.push(data) - angleOffset = this.dataPercentage(dataVal.value) * 360 + angleOffset; - }) - this.chartData = newData; - } + calculateStrokeDashOffset(dataVal) { + const strokeDiff = this.dataPercentage(dataVal) * this.circumference; + return this.circumference - strokeDiff; + } - calculateStrokeDashOffset(dataVal) { - const strokeDiff = this.dataPercentage(dataVal) * this.circumference - return this.circumference - strokeDiff; - } - - dataPercentage(dataVal) { - return dataVal / this.dataTotal; - } - - returnCircleTransformValue(index) { - return `rotate(${this.chartData[index].degrees}, ${this.cx}, ${this.cy})`; - } - - // Eliminate items with value = 0 - public get parsedConfig() { - return this.config.filter((el) => el.value); - } + dataPercentage(dataVal) { + return dataVal / this.dataTotal; + } + returnCircleTransformValue(index) { + return `rotate(${this.chartData[index].degrees}, ${this.cx}, ${this.cy})`; + } + // Eliminate items with value = 0 + public get parsedConfig() { + return this.config.filter((el) => el.value); + } } diff --git a/apps/red-ui/src/app/components/status-bar/status-bar.component.ts b/apps/red-ui/src/app/components/status-bar/status-bar.component.ts index 097e31299..187b78517 100644 --- a/apps/red-ui/src/app/components/status-bar/status-bar.component.ts +++ b/apps/red-ui/src/app/components/status-bar/status-bar.component.ts @@ -2,28 +2,26 @@ import { Component, Input, OnInit, ViewEncapsulation } from '@angular/core'; import { Color } from '../../utils/types'; @Component({ - selector: 'redaction-status-bar', - templateUrl: './status-bar.component.html', - styleUrls: ['./status-bar.component.scss'], - encapsulation: ViewEncapsulation.None, + selector: 'redaction-status-bar', + templateUrl: './status-bar.component.html', + styleUrls: ['./status-bar.component.scss'], + encapsulation: ViewEncapsulation.None }) export class StatusBarComponent implements OnInit { - @Input() - public config: { - length: number, - color: Color, - label?: string, - }[] = []; + @Input() + public config: { + length: number; + color: Color; + label?: string; + }[] = []; - @Input() - public small = false; + @Input() + public small = false; - @Input() - public labelClass = ''; + @Input() + public labelClass = ''; - constructor() { - } + constructor() {} - ngOnInit(): void { - } + ngOnInit(): void {} } diff --git a/apps/red-ui/src/app/dialogs/add-edit-project-dialog/add-edit-project-dialog.component.ts b/apps/red-ui/src/app/dialogs/add-edit-project-dialog/add-edit-project-dialog.component.ts index 8455027c2..35c4f57eb 100644 --- a/apps/red-ui/src/app/dialogs/add-edit-project-dialog/add-edit-project-dialog.component.ts +++ b/apps/red-ui/src/app/dialogs/add-edit-project-dialog/add-edit-project-dialog.component.ts @@ -1,46 +1,44 @@ -import {Component, Inject, OnInit} from '@angular/core'; -import {MAT_DIALOG_DATA, MatDialogRef} from "@angular/material/dialog"; -import {Project} from "@redaction/red-ui-http"; -import {FormBuilder, FormGroup, Validators} from "@angular/forms"; -import {AppStateService} from "../../state/app-state.service"; +import { Component, Inject, OnInit } from '@angular/core'; +import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; +import { Project } from '@redaction/red-ui-http'; +import { FormBuilder, FormGroup, Validators } from '@angular/forms'; +import { AppStateService } from '../../state/app-state.service'; @Component({ - selector: 'redaction-add-edit-project-dialog', - templateUrl: './add-edit-project-dialog.component.html', - styleUrls: ['./add-edit-project-dialog.component.scss'] + selector: 'redaction-add-edit-project-dialog', + templateUrl: './add-edit-project-dialog.component.html', + styleUrls: ['./add-edit-project-dialog.component.scss'] }) export class AddEditProjectDialogComponent implements OnInit { + projectForm: FormGroup; - projectForm: FormGroup; + constructor( + private readonly _appStateService: AppStateService, + private readonly _formBuilder: FormBuilder, + public dialogRef: MatDialogRef, + @Inject(MAT_DIALOG_DATA) public project: Project + ) {} - constructor( - private readonly _appStateService: AppStateService, - private readonly _formBuilder: FormBuilder, - public dialogRef: MatDialogRef, - @Inject(MAT_DIALOG_DATA) public project: Project) { - } - - ngOnInit(): void { - this.projectForm = this._formBuilder.group({ - projectName: [this.project?.projectName, Validators.required], - description: [this.project?.description], - dueDate: [this.project?.dueDate] - }); - - } - - async saveProject() { - const project: Project = this._formToObject(); - project.projectId = this.project?.projectId; - await this._appStateService.addOrUpdateProject(project); - this.dialogRef.close(true); - } - - private _formToObject(): Project { - return { - projectName: this.projectForm.get('projectName').value, - description: this.projectForm.get('description').value, - dueDate: this.projectForm.get('dueDate').value + ngOnInit(): void { + this.projectForm = this._formBuilder.group({ + projectName: [this.project?.projectName, Validators.required], + description: [this.project?.description], + dueDate: [this.project?.dueDate] + }); + } + + async saveProject() { + const project: Project = this._formToObject(); + project.projectId = this.project?.projectId; + await this._appStateService.addOrUpdateProject(project); + this.dialogRef.close(true); + } + + private _formToObject(): Project { + return { + projectName: this.projectForm.get('projectName').value, + description: this.projectForm.get('description').value, + dueDate: this.projectForm.get('dueDate').value + }; } - } } diff --git a/apps/red-ui/src/app/dialogs/assign-owner-dialog/assign-owner-dialog.component.html b/apps/red-ui/src/app/dialogs/assign-owner-dialog/assign-owner-dialog.component.html index e83760aef..ef9de5472 100644 --- a/apps/red-ui/src/app/dialogs/assign-owner-dialog/assign-owner-dialog.component.html +++ b/apps/red-ui/src/app/dialogs/assign-owner-dialog/assign-owner-dialog.component.html @@ -1,41 +1,48 @@
-
-
+
-
-
+ +
+
+ + {{ + 'assign-' + data.type + '-owner.dialog.single-user.label' | translate + }} + + + {{ userService.getNameForId(userId) }} + + + +
+
+ + {{ + 'assign-' + data.type + '-owner.dialog.multi-user.label' | translate + }} + + + {{ userService.getNameForId(userId) }} + + + +
+
-
- - {{'assign-' + data.type + '-owner.dialog.single-user.label' | translate}} - - - {{userService.getNameForId(userId)}} - - - -
-
- - {{'assign-' + data.type + '-owner.dialog.multi-user.label' | translate}} - - - {{userService.getNameForId(userId)}} - - - -
+
+ +
+ -
- -
- -
- - - +
diff --git a/apps/red-ui/src/app/dialogs/assign-owner-dialog/assign-owner-dialog.component.scss b/apps/red-ui/src/app/dialogs/assign-owner-dialog/assign-owner-dialog.component.scss index 22c4ab20b..f11829a84 100644 --- a/apps/red-ui/src/app/dialogs/assign-owner-dialog/assign-owner-dialog.component.scss +++ b/apps/red-ui/src/app/dialogs/assign-owner-dialog/assign-owner-dialog.component.scss @@ -1,4 +1,3 @@ - .red-input-group { - max-width: 200px; + max-width: 200px; } diff --git a/apps/red-ui/src/app/dialogs/assign-owner-dialog/assign-owner-dialog.component.ts b/apps/red-ui/src/app/dialogs/assign-owner-dialog/assign-owner-dialog.component.ts index a8c7f3c1d..792b92c0c 100644 --- a/apps/red-ui/src/app/dialogs/assign-owner-dialog/assign-owner-dialog.component.ts +++ b/apps/red-ui/src/app/dialogs/assign-owner-dialog/assign-owner-dialog.component.ts @@ -1,90 +1,113 @@ -import {Component, Inject} from '@angular/core'; -import {FileStatus, Project, ProjectControllerService, StatusControllerService} from '@redaction/red-ui-http'; -import {MAT_DIALOG_DATA, MatDialogRef} from '@angular/material/dialog'; -import {AppStateService} from '../../state/app-state.service'; -import {UserService} from '../../user/user.service'; -import {NotificationService, NotificationType} from '../../notification/notification.service'; -import {FormBuilder, FormGroup, Validators} from '@angular/forms'; +import { Component, Inject } from '@angular/core'; +import { + FileStatus, + Project, + ProjectControllerService, + StatusControllerService +} from '@redaction/red-ui-http'; +import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; +import { AppStateService } from '../../state/app-state.service'; +import { UserService } from '../../user/user.service'; +import { NotificationService, NotificationType } from '../../notification/notification.service'; +import { FormBuilder, FormGroup, Validators } from '@angular/forms'; class DialogData { - type: 'file' | 'project'; - project?: Project; - file?: FileStatus; + type: 'file' | 'project'; + project?: Project; + file?: FileStatus; } @Component({ - selector: 'redaction-project-details-dialog', - templateUrl: './assign-owner-dialog.component.html', - styleUrls: ['./assign-owner-dialog.component.scss'] + selector: 'redaction-project-details-dialog', + templateUrl: './assign-owner-dialog.component.html', + styleUrls: ['./assign-owner-dialog.component.scss'] }) export class AssignOwnerDialogComponent { + usersForm: FormGroup; - usersForm: FormGroup; - - constructor(public readonly userService: UserService, - private readonly _projectControllerService: ProjectControllerService, - private readonly _notificationService: NotificationService, - private readonly _formBuilder: FormBuilder, - private readonly _statusControllerService: StatusControllerService, - private readonly _appStateService: AppStateService, - public dialogRef: MatDialogRef, - @Inject(MAT_DIALOG_DATA) public data: DialogData) { - this._loadData(); - } - - - private _loadData() { - if (this.data.type === 'project') { - const project = this.data.project; - this.usersForm = this._formBuilder.group({ - singleUser: [project?.ownerId, Validators.required], - userList: [project?.memberIds] - }); + constructor( + public readonly userService: UserService, + private readonly _projectControllerService: ProjectControllerService, + private readonly _notificationService: NotificationService, + private readonly _formBuilder: FormBuilder, + private readonly _statusControllerService: StatusControllerService, + private readonly _appStateService: AppStateService, + public dialogRef: MatDialogRef, + @Inject(MAT_DIALOG_DATA) public data: DialogData + ) { + this._loadData(); } - if (this.data.type === 'file') { - const file = this.data.file; - this.usersForm = this._formBuilder.group({ - singleUser: [file?.currentReviewer] - }); - } - } + private _loadData() { + if (this.data.type === 'project') { + const project = this.data.project; + this.usersForm = this._formBuilder.group({ + singleUser: [project?.ownerId, Validators.required], + userList: [project?.memberIds] + }); + } - async saveUsers() { - try { - if (this.data.type === 'project') { - - const ownerId = this.usersForm.get('singleUser').value; - const memberIds = this.usersForm.get('userList').value; - const project = Object.assign({},this.data.project); - project.memberIds = memberIds; - project.ownerId = ownerId; - await this._appStateService.addOrUpdateProject(project); - this._notificationService.showToastNotification('Successfully assigned ' + this.userService.getNameForId(ownerId) + ' to project: ' + project.projectName); - } - - if (this.data.type === 'file') { - - const reviewerId = this.usersForm.get('singleUser').value; - - await this._statusControllerService.assignProjectOwner1(this._appStateService.activeProjectId, this.data.file.fileId, reviewerId).toPromise(); - this.data.file.currentReviewer = reviewerId; - this._notificationService.showToastNotification('Successfully assigned ' + this.userService.getNameForId(reviewerId) + ' to file: ' + this.data.file.filename); - - } - } catch (error) { - this._notificationService.showToastNotification('Failed: ' + error.error.message, null, NotificationType.ERROR); + if (this.data.type === 'file') { + const file = this.data.file; + this.usersForm = this._formBuilder.group({ + singleUser: [file?.currentReviewer] + }); + } } - this.dialogRef.close(); - } + async saveUsers() { + try { + if (this.data.type === 'project') { + const ownerId = this.usersForm.get('singleUser').value; + const memberIds = this.usersForm.get('userList').value; + const project = Object.assign({}, this.data.project); + project.memberIds = memberIds; + project.ownerId = ownerId; + await this._appStateService.addOrUpdateProject(project); + this._notificationService.showToastNotification( + 'Successfully assigned ' + + this.userService.getNameForId(ownerId) + + ' to project: ' + + project.projectName + ); + } + if (this.data.type === 'file') { + const reviewerId = this.usersForm.get('singleUser').value; - get singleUsersSelectOptions() { - return this.data.type === 'file' ? this._appStateService.activeProject.project.memberIds : this.userService.managerUsers.map(m => m.userId); - } + await this._statusControllerService + .assignProjectOwner1( + this._appStateService.activeProjectId, + this.data.file.fileId, + reviewerId + ) + .toPromise(); + this.data.file.currentReviewer = reviewerId; + this._notificationService.showToastNotification( + 'Successfully assigned ' + + this.userService.getNameForId(reviewerId) + + ' to file: ' + + this.data.file.filename + ); + } + } catch (error) { + this._notificationService.showToastNotification( + 'Failed: ' + error.error.message, + null, + NotificationType.ERROR + ); + } - get multiUsersSelectOptions() { - return this.userService.managerUsers.map(m => m.userId); - } + this.dialogRef.close(); + } + + get singleUsersSelectOptions() { + return this.data.type === 'file' + ? this._appStateService.activeProject.project.memberIds + : this.userService.managerUsers.map((m) => m.userId); + } + + get multiUsersSelectOptions() { + return this.userService.managerUsers.map((m) => m.userId); + } } diff --git a/apps/red-ui/src/app/dialogs/file-details-dialog/file-details-dialog.component.html b/apps/red-ui/src/app/dialogs/file-details-dialog/file-details-dialog.component.html index fee368750..dc2da2895 100644 --- a/apps/red-ui/src/app/dialogs/file-details-dialog/file-details-dialog.component.html +++ b/apps/red-ui/src/app/dialogs/file-details-dialog/file-details-dialog.component.html @@ -1,40 +1,53 @@
+
-
- -
- -
-
-
- {{fileStatus.filename}} -
-
- {{'project-overview.file-listing.file-entry.status.label'| translate:fileStatus}} -
-
- {{'project-overview.file-listing.file-entry.number-of-pages.label'| translate:fileStatus}} -
-
- {{'project-overview.file-listing.file-entry.number-of-analyses.label'| translate:fileStatus}} -
-
- {{'project-overview.file-listing.file-entry.added.label'| translate:{added: fileStatus.added | date:'short'} }} -
-
- {{'project-overview.file-listing.file-entry.last-updated.label'| translate:{lastUpdated: fileStatus.lastUpdated | date:'short'} }} -
+
+
+
+ {{ fileStatus.filename }} +
+
+ {{ + 'project-overview.file-listing.file-entry.status.label' | translate: fileStatus + }} +
+
+ {{ + 'project-overview.file-listing.file-entry.number-of-pages.label' + | translate: fileStatus + }} +
+
+ {{ + 'project-overview.file-listing.file-entry.number-of-analyses.label' + | translate: fileStatus + }} +
+
+ {{ + 'project-overview.file-listing.file-entry.added.label' + | translate: { added: fileStatus.added | date: 'short' } + }} +
+
+ {{ + 'project-overview.file-listing.file-entry.last-updated.label' + | translate: { lastUpdated: fileStatus.lastUpdated | date: 'short' } + }} +
+
-
-
- -
+
+ +
- - +
diff --git a/apps/red-ui/src/app/dialogs/file-details-dialog/file-details-dialog.component.scss b/apps/red-ui/src/app/dialogs/file-details-dialog/file-details-dialog.component.scss index 8f05b81de..93be7acbb 100644 --- a/apps/red-ui/src/app/dialogs/file-details-dialog/file-details-dialog.component.scss +++ b/apps/red-ui/src/app/dialogs/file-details-dialog/file-details-dialog.component.scss @@ -1,2 +1 @@ -@import "../../../assets/styles/red-variables"; - +@import '../../../assets/styles/red-variables'; diff --git a/apps/red-ui/src/app/dialogs/file-details-dialog/file-details-dialog.component.ts b/apps/red-ui/src/app/dialogs/file-details-dialog/file-details-dialog.component.ts index 2f0d6f49c..285c6f125 100644 --- a/apps/red-ui/src/app/dialogs/file-details-dialog/file-details-dialog.component.ts +++ b/apps/red-ui/src/app/dialogs/file-details-dialog/file-details-dialog.component.ts @@ -1,29 +1,27 @@ -import {Component, Inject, OnInit} from '@angular/core'; -import {FileStatus, FileUploadControllerService} from "@redaction/red-ui-http"; -import {MAT_DIALOG_DATA, MatDialogRef} from "@angular/material/dialog"; -import {download} from "../../utils/file-download-utils"; +import { Component, Inject, OnInit } from '@angular/core'; +import { FileStatus, FileUploadControllerService } from '@redaction/red-ui-http'; +import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; +import { download } from '../../utils/file-download-utils'; @Component({ - selector: 'redaction-file-details-dialog', - templateUrl: './file-details-dialog.component.html', - styleUrls: ['./file-details-dialog.component.scss'] + selector: 'redaction-file-details-dialog', + templateUrl: './file-details-dialog.component.html', + styleUrls: ['./file-details-dialog.component.scss'] }) export class FileDetailsDialogComponent implements OnInit { + constructor( + private readonly _fileUploadControllerService: FileUploadControllerService, + public dialogRef: MatDialogRef, + @Inject(MAT_DIALOG_DATA) public fileStatus: FileStatus + ) {} + ngOnInit(): void {} - constructor( - private readonly _fileUploadControllerService: FileUploadControllerService, - public dialogRef: MatDialogRef, - @Inject(MAT_DIALOG_DATA) public fileStatus: FileStatus) { - } - - - ngOnInit(): void { - } - - downloadRedactionReport() { - this._fileUploadControllerService.downloadRedactionReport({fileIds: [this.fileStatus.fileId]}, true, 'response').subscribe(data => { - download(data, 'redaction-report-' + this.fileStatus.filename + ".docx"); - }); - } + downloadRedactionReport() { + this._fileUploadControllerService + .downloadRedactionReport({ fileIds: [this.fileStatus.fileId] }, true, 'response') + .subscribe((data) => { + download(data, 'redaction-report-' + this.fileStatus.filename + '.docx'); + }); + } } diff --git a/apps/red-ui/src/app/dialogs/manual-redaction-dialog/manual-redaction-dialog.component.ts b/apps/red-ui/src/app/dialogs/manual-redaction-dialog/manual-redaction-dialog.component.ts index 09c4bf056..9fe639c75 100644 --- a/apps/red-ui/src/app/dialogs/manual-redaction-dialog/manual-redaction-dialog.component.ts +++ b/apps/red-ui/src/app/dialogs/manual-redaction-dialog/manual-redaction-dialog.component.ts @@ -1,94 +1,139 @@ -import {Component, Inject, OnInit} from '@angular/core'; -import {FormBuilder, FormGroup, Validators} from "@angular/forms"; -import {AppStateService} from "../../state/app-state.service"; -import {MAT_DIALOG_DATA, MatDialogRef} from "@angular/material/dialog"; +import { Component, Inject, OnInit } from '@angular/core'; +import { FormBuilder, FormGroup, Validators } from '@angular/forms'; +import { AppStateService } from '../../state/app-state.service'; +import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; import { - AddRedactionRequest, - DictionaryControllerService, - ManualRedactionControllerService, - TypeValue -} from "@redaction/red-ui-http"; -import {NotificationService, NotificationType} from "../../notification/notification.service"; -import {TranslateService} from "@ngx-translate/core"; -import {map} from "rxjs/operators"; -import {Observable} from "rxjs"; -import {UserService} from "../../user/user.service"; - + AddRedactionRequest, + DictionaryControllerService, + ManualRedactionControllerService, + TypeValue +} from '@redaction/red-ui-http'; +import { NotificationService, NotificationType } from '../../notification/notification.service'; +import { TranslateService } from '@ngx-translate/core'; +import { map } from 'rxjs/operators'; +import { Observable } from 'rxjs'; +import { UserService } from '../../user/user.service'; @Component({ - selector: 'redaction-manual-redaction-dialog', - templateUrl: './manual-redaction-dialog.component.html', - styleUrls: ['./manual-redaction-dialog.component.scss'] + selector: 'redaction-manual-redaction-dialog', + templateUrl: './manual-redaction-dialog.component.html', + styleUrls: ['./manual-redaction-dialog.component.scss'] }) export class ManualRedactionDialogComponent implements OnInit { + redactionForm: FormGroup; + dictionaries: Observable>; + isDocumentAdmin: boolean; - redactionForm: FormGroup; - dictionaries: Observable>; - isDocumentAdmin: boolean; + constructor( + private readonly _appStateService: AppStateService, + private readonly _userService: UserService, + private readonly _formBuilder: FormBuilder, + private readonly _notificationService: NotificationService, + private readonly _translateService: TranslateService, + private readonly _manualRedactionControllerService: ManualRedactionControllerService, + private readonly _dictionaryControllerService: DictionaryControllerService, + public dialogRef: MatDialogRef, + @Inject(MAT_DIALOG_DATA) public addRedactionRequest: AddRedactionRequest + ) {} - constructor( - private readonly _appStateService: AppStateService, - private readonly _userService: UserService, - private readonly _formBuilder: FormBuilder, - private readonly _notificationService: NotificationService, - private readonly _translateService: TranslateService, - private readonly _manualRedactionControllerService: ManualRedactionControllerService, - private readonly _dictionaryControllerService: DictionaryControllerService, - public dialogRef: MatDialogRef, - @Inject(MAT_DIALOG_DATA) public addRedactionRequest: AddRedactionRequest) { - } - - async ngOnInit() { - this.isDocumentAdmin = (this._appStateService.isActiveProjectOwner || this._appStateService.isActiveFileDocumentReviewer) && this._userService.user.isManager; - const commentField = this.isDocumentAdmin ? [null] : [null, Validators.required]; - this.redactionForm = this._formBuilder.group({ - addToDictionary: [false], - reason: [null, Validators.required], - dictionary: [null, Validators.required], - comment: commentField, - }); - this.dictionaries = this._dictionaryControllerService.getAllTypes().pipe(map(r => r.types)); - } - - - handleAddRedaction() { - if (this.isDocumentAdmin) { - this.addManualRedaction(); - } else { - this.suggestManualRedaction() + async ngOnInit() { + this.isDocumentAdmin = + (this._appStateService.isActiveProjectOwner || + this._appStateService.isActiveFileDocumentReviewer) && + this._userService.user.isManager; + const commentField = this.isDocumentAdmin ? [null] : [null, Validators.required]; + this.redactionForm = this._formBuilder.group({ + addToDictionary: [false], + reason: [null, Validators.required], + dictionary: [null, Validators.required], + comment: commentField + }); + this.dictionaries = this._dictionaryControllerService + .getAllTypes() + .pipe(map((r) => r.types)); } - } - suggestManualRedaction() { - const mre = Object.assign({}, this.addRedactionRequest); - this._enhanceManualRedaction(mre); - this._manualRedactionControllerService.requestAddRedaction(mre, this._appStateService.activeProject.project.projectId, this._appStateService.activeFile.fileId).subscribe(ok => { - this._appStateService.reanalyseActiveFile(); - this._notificationService.showToastNotification(this._translateService.instant('manual-redaction.dialog.add-redaction.success.label'), null, NotificationType.SUCCESS); - this.dialogRef.close(); - }, (err) => { - this._notificationService.showToastNotification(this._translateService.instant('manual-redaction.dialog.add-redaction.failed.label', err), null, NotificationType.ERROR); - }); - } + handleAddRedaction() { + if (this.isDocumentAdmin) { + this.addManualRedaction(); + } else { + this.suggestManualRedaction(); + } + } - addManualRedaction() { - const mre = Object.assign({}, this.addRedactionRequest); - this._enhanceManualRedaction(mre); - this._manualRedactionControllerService.addRedaction(mre, this._appStateService.activeProject.project.projectId, this._appStateService.activeFile.fileId).subscribe(ok => { - this._appStateService.reanalyseActiveFile(); - this._notificationService.showToastNotification(this._translateService.instant('manual-redaction.dialog.add-redaction.success.label'), null, NotificationType.SUCCESS); - this.dialogRef.close(); - }, (err) => { - this._notificationService.showToastNotification(this._translateService.instant('manual-redaction.dialog.add-redaction.failed.label', err), null, NotificationType.ERROR); - }); - } + suggestManualRedaction() { + const mre = Object.assign({}, this.addRedactionRequest); + this._enhanceManualRedaction(mre); + this._manualRedactionControllerService + .requestAddRedaction( + mre, + this._appStateService.activeProject.project.projectId, + this._appStateService.activeFile.fileId + ) + .subscribe( + (ok) => { + this._appStateService.reanalyseActiveFile(); + this._notificationService.showToastNotification( + this._translateService.instant( + 'manual-redaction.dialog.add-redaction.success.label' + ), + null, + NotificationType.SUCCESS + ); + this.dialogRef.close(); + }, + (err) => { + this._notificationService.showToastNotification( + this._translateService.instant( + 'manual-redaction.dialog.add-redaction.failed.label', + err + ), + null, + NotificationType.ERROR + ); + } + ); + } - private _enhanceManualRedaction(addRedactionRequest: AddRedactionRequest) { - addRedactionRequest.type = this.redactionForm.get('dictionary').value; - addRedactionRequest.addToDictionary = this.redactionForm.get('addToDictionary').value; - addRedactionRequest.reason = this.redactionForm.get('reason').value; - const commentValue = this.redactionForm.get('comment').value; - addRedactionRequest.comment = commentValue ? {text: commentValue} : null; - } + addManualRedaction() { + const mre = Object.assign({}, this.addRedactionRequest); + this._enhanceManualRedaction(mre); + this._manualRedactionControllerService + .addRedaction( + mre, + this._appStateService.activeProject.project.projectId, + this._appStateService.activeFile.fileId + ) + .subscribe( + (ok) => { + this._appStateService.reanalyseActiveFile(); + this._notificationService.showToastNotification( + this._translateService.instant( + 'manual-redaction.dialog.add-redaction.success.label' + ), + null, + NotificationType.SUCCESS + ); + this.dialogRef.close(); + }, + (err) => { + this._notificationService.showToastNotification( + this._translateService.instant( + 'manual-redaction.dialog.add-redaction.failed.label', + err + ), + null, + NotificationType.ERROR + ); + } + ); + } + private _enhanceManualRedaction(addRedactionRequest: AddRedactionRequest) { + addRedactionRequest.type = this.redactionForm.get('dictionary').value; + addRedactionRequest.addToDictionary = this.redactionForm.get('addToDictionary').value; + addRedactionRequest.reason = this.redactionForm.get('reason').value; + const commentValue = this.redactionForm.get('comment').value; + addRedactionRequest.comment = commentValue ? { text: commentValue } : null; + } } diff --git a/apps/red-ui/src/app/dialogs/project-details-dialog/project-details-dialog.component.html b/apps/red-ui/src/app/dialogs/project-details-dialog/project-details-dialog.component.html index c4c3e66ce..a70432e6a 100644 --- a/apps/red-ui/src/app/dialogs/project-details-dialog/project-details-dialog.component.html +++ b/apps/red-ui/src/app/dialogs/project-details-dialog/project-details-dialog.component.html @@ -1,36 +1,43 @@
+
-
- -
- -
-
-
- {{projectDetails.project.projectName}} -
-
- {{projectDetails.project.description}} -
-
- {{projectDetails.project.date | date:'short'}} -
-
- {{'project-details.dialog.info.file-count.label'| translate:{fileCount: projectDetails.files ? projectDetails.files.length : 0} }} -
+
+
+
+ {{ projectDetails.project.projectName }} +
+
+ {{ projectDetails.project.description }} +
+
+ {{ projectDetails.project.date | date: 'short' }} +
+
+ {{ + 'project-details.dialog.info.file-count.label' + | translate + : { fileCount: projectDetails.files ? projectDetails.files.length : 0 } + }} +
+
-
-
- - -
+
+ + +
- - +
diff --git a/apps/red-ui/src/app/dialogs/project-details-dialog/project-details-dialog.component.ts b/apps/red-ui/src/app/dialogs/project-details-dialog/project-details-dialog.component.ts index 8324c488b..42eb34408 100644 --- a/apps/red-ui/src/app/dialogs/project-details-dialog/project-details-dialog.component.ts +++ b/apps/red-ui/src/app/dialogs/project-details-dialog/project-details-dialog.component.ts @@ -1,35 +1,44 @@ -import {Component, Inject, OnInit} from '@angular/core'; -import {FileUploadControllerService, ReanalysisControllerService} from "@redaction/red-ui-http"; -import {MAT_DIALOG_DATA, MatDialogRef} from "@angular/material/dialog"; -import {download} from "../../utils/file-download-utils"; -import {ProjectWrapper} from "../../state/app-state.service"; +import { Component, Inject, OnInit } from '@angular/core'; +import { FileUploadControllerService, ReanalysisControllerService } from '@redaction/red-ui-http'; +import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; +import { download } from '../../utils/file-download-utils'; +import { ProjectWrapper } from '../../state/app-state.service'; @Component({ - selector: 'redaction-project-details-dialog', - templateUrl: './project-details-dialog.component.html', - styleUrls: ['./project-details-dialog.component.scss'] + selector: 'redaction-project-details-dialog', + templateUrl: './project-details-dialog.component.html', + styleUrls: ['./project-details-dialog.component.scss'] }) export class ProjectDetailsDialogComponent implements OnInit { + constructor( + private readonly _fileUploadControllerService: FileUploadControllerService, + private readonly _reanalysisControllerService: ReanalysisControllerService, + public dialogRef: MatDialogRef, + @Inject(MAT_DIALOG_DATA) public projectDetails: ProjectWrapper + ) {} - constructor( - private readonly _fileUploadControllerService: FileUploadControllerService, - private readonly _reanalysisControllerService: ReanalysisControllerService, - public dialogRef: MatDialogRef, - @Inject(MAT_DIALOG_DATA) public projectDetails: ProjectWrapper) { - } + ngOnInit(): void {} - ngOnInit(): void { - } + downloadRedactionReport() { + this._fileUploadControllerService + .downloadRedactionReportForProject( + this.projectDetails.project.projectId, + true, + 'response' + ) + .subscribe((data) => { + download( + data, + 'redaction-report-' + this.projectDetails.project.projectName + '.docx' + ); + }); + } - downloadRedactionReport() { - this._fileUploadControllerService.downloadRedactionReportForProject(this.projectDetails.project.projectId, true, 'response').subscribe(data => { - download(data, 'redaction-report-' + this.projectDetails.project.projectName + ".docx"); - }); - } - - reanalyseProject() { - this._reanalysisControllerService.reanalyzeProject(this.projectDetails.project.projectId).subscribe(() => { - this.dialogRef.close(); - }); - } + reanalyseProject() { + this._reanalysisControllerService + .reanalyzeProject(this.projectDetails.project.projectId) + .subscribe(() => { + this.dialogRef.close(); + }); + } } diff --git a/apps/red-ui/src/app/i18n/language.initializer.ts b/apps/red-ui/src/app/i18n/language.initializer.ts index 3f780e549..3fe418b84 100644 --- a/apps/red-ui/src/app/i18n/language.initializer.ts +++ b/apps/red-ui/src/app/i18n/language.initializer.ts @@ -1,5 +1,5 @@ -import {LanguageService} from "./language.service"; +import { LanguageService } from './language.service'; export function languageInitializer(languageService: LanguageService) { - return () => languageService.chooseAndSetInitialLanguage(); + return () => languageService.chooseAndSetInitialLanguage(); } diff --git a/apps/red-ui/src/app/i18n/language.service.ts b/apps/red-ui/src/app/i18n/language.service.ts index 03ee005b9..754811054 100644 --- a/apps/red-ui/src/app/i18n/language.service.ts +++ b/apps/red-ui/src/app/i18n/language.service.ts @@ -1,43 +1,39 @@ -import {Injectable} from '@angular/core'; -import {TranslateService} from '@ngx-translate/core'; +import { Injectable } from '@angular/core'; +import { TranslateService } from '@ngx-translate/core'; @Injectable({ - providedIn: "root" + providedIn: 'root' }) export class LanguageService { - constructor( - private translateService: TranslateService - ) { - translateService.addLangs(['en', 'de']); - } - - get currentLanguage() { - return this.translateService.currentLang; - } - - chooseAndSetInitialLanguage() { - let defaultLang: string; - const localStorageLang = localStorage.getItem('redaction.language'); - const browserLang = this.translateService.getBrowserLang(); - // @ts-ignore - if (this.translateService.getLangs().includes(localStorageLang)) { - defaultLang = localStorageLang; - // @ts-ignore - } else if (this.translateService.getLangs().includes(browserLang)) { - defaultLang = browserLang; - } else { - defaultLang = 'en'; + constructor(private translateService: TranslateService) { + translateService.addLangs(['en', 'de']); } - document.documentElement.lang = defaultLang; - this.translateService.setDefaultLang(defaultLang); - this.translateService.use(defaultLang).subscribe(() => { - }); - } - changeLanguage(language: string) { - localStorage.setItem('redaction.language', language); - document.documentElement.lang = language; - this.translateService.use(language).subscribe(() => { - }); - } + get currentLanguage() { + return this.translateService.currentLang; + } + + chooseAndSetInitialLanguage() { + let defaultLang: string; + const localStorageLang = localStorage.getItem('redaction.language'); + const browserLang = this.translateService.getBrowserLang(); + // @ts-ignore + if (this.translateService.getLangs().includes(localStorageLang)) { + defaultLang = localStorageLang; + // @ts-ignore + } else if (this.translateService.getLangs().includes(browserLang)) { + defaultLang = browserLang; + } else { + defaultLang = 'en'; + } + document.documentElement.lang = defaultLang; + this.translateService.setDefaultLang(defaultLang); + this.translateService.use(defaultLang).subscribe(() => {}); + } + + changeLanguage(language: string) { + localStorage.setItem('redaction.language', language); + document.documentElement.lang = language; + this.translateService.use(language).subscribe(() => {}); + } } diff --git a/apps/red-ui/src/app/interceptor/api-path-interceptor.service.ts b/apps/red-ui/src/app/interceptor/api-path-interceptor.service.ts index 3eb5e1b99..cfaf336ce 100644 --- a/apps/red-ui/src/app/interceptor/api-path-interceptor.service.ts +++ b/apps/red-ui/src/app/interceptor/api-path-interceptor.service.ts @@ -1,15 +1,13 @@ -import {HttpEvent, HttpHandler, HttpInterceptor, HttpRequest} from '@angular/common/http'; -import {Injectable} from '@angular/core'; -import {Observable} from 'rxjs'; -import {AppConfigService} from "../app-config/app-config.service"; +import { HttpEvent, HttpHandler, HttpInterceptor, HttpRequest } from '@angular/common/http'; +import { Injectable } from '@angular/core'; +import { Observable } from 'rxjs'; +import { AppConfigService } from '../app-config/app-config.service'; @Injectable() export class ApiPathInterceptorService implements HttpInterceptor { + constructor(private readonly _appConfigService: AppConfigService) {} - constructor(private readonly _appConfigService: AppConfigService) { - } - - intercept(req: HttpRequest, next: HttpHandler): Observable> { - return next.handle(req); - } + intercept(req: HttpRequest, next: HttpHandler): Observable> { + return next.handle(req); + } } diff --git a/apps/red-ui/src/app/logo/logo.component.html b/apps/red-ui/src/app/logo/logo.component.html index 2537c4456..212ed1b92 100644 --- a/apps/red-ui/src/app/logo/logo.component.html +++ b/apps/red-ui/src/app/logo/logo.component.html @@ -1,4 +1,4 @@ diff --git a/apps/red-ui/src/app/logo/logo.component.ts b/apps/red-ui/src/app/logo/logo.component.ts index bda159df5..0bc7217c9 100644 --- a/apps/red-ui/src/app/logo/logo.component.ts +++ b/apps/red-ui/src/app/logo/logo.component.ts @@ -1,15 +1,12 @@ import { Component, OnInit } from '@angular/core'; @Component({ - selector: 'redaction-logo', - templateUrl: './logo.component.html', - styleUrls: ['./logo.component.scss'] + selector: 'redaction-logo', + templateUrl: './logo.component.html', + styleUrls: ['./logo.component.scss'] }) export class LogoComponent implements OnInit { + constructor() {} - constructor() { } - - ngOnInit(): void { - } - + ngOnInit(): void {} } diff --git a/apps/red-ui/src/app/notification/notification.service.ts b/apps/red-ui/src/app/notification/notification.service.ts index aca34b4cd..0d2a7463b 100644 --- a/apps/red-ui/src/app/notification/notification.service.ts +++ b/apps/red-ui/src/app/notification/notification.service.ts @@ -1,36 +1,38 @@ -import {Injectable} from "@angular/core"; -import {MatSnackBar} from "@angular/material/snack-bar"; -import {ToastrService} from "ngx-toastr"; - +import { Injectable } from '@angular/core'; +import { MatSnackBar } from '@angular/material/snack-bar'; +import { ToastrService } from 'ngx-toastr'; export enum NotificationType { - SUCCESS = 'SUCCESS', WARNING = 'WARNING', ERROR = 'ERROR', INFO = 'INFO', + SUCCESS = 'SUCCESS', + WARNING = 'WARNING', + ERROR = 'ERROR', + INFO = 'INFO' } @Injectable({ - providedIn: 'root' + providedIn: 'root' }) export class NotificationService { + constructor(private readonly _snackBar: MatSnackBar, private readonly _toastr: ToastrService) {} - constructor(private readonly _snackBar: MatSnackBar, - private readonly _toastr: ToastrService) { - } - - showToastNotification(message: string, title?: string, notificationType: NotificationType = NotificationType.INFO) { - switch (notificationType) { - case NotificationType.ERROR: - this._toastr.error(message, title); - break; - case NotificationType.SUCCESS: - this._toastr.success(message, title); - break; - case NotificationType.WARNING: - this._toastr.warning(message, title); - break - case NotificationType.INFO: - this._toastr.info(message, title); - break + showToastNotification( + message: string, + title?: string, + notificationType: NotificationType = NotificationType.INFO + ) { + switch (notificationType) { + case NotificationType.ERROR: + this._toastr.error(message, title); + break; + case NotificationType.SUCCESS: + this._toastr.success(message, title); + break; + case NotificationType.WARNING: + this._toastr.warning(message, title); + break; + case NotificationType.INFO: + this._toastr.info(message, title); + break; + } } - } - } diff --git a/apps/red-ui/src/app/screens/auth-error/auth-error.component.html b/apps/red-ui/src/app/screens/auth-error/auth-error.component.html index 8a127631f..b673075f4 100644 --- a/apps/red-ui/src/app/screens/auth-error/auth-error.component.html +++ b/apps/red-ui/src/app/screens/auth-error/auth-error.component.html @@ -1,12 +1,30 @@
-

-

-

-

- +

+

+

+

+
diff --git a/apps/red-ui/src/app/screens/auth-error/auth-error.component.scss b/apps/red-ui/src/app/screens/auth-error/auth-error.component.scss index 500a55a0d..427b131fa 100644 --- a/apps/red-ui/src/app/screens/auth-error/auth-error.component.scss +++ b/apps/red-ui/src/app/screens/auth-error/auth-error.component.scss @@ -1,3 +1,3 @@ section { - padding: 24px; + padding: 24px; } diff --git a/apps/red-ui/src/app/screens/auth-error/auth-error.component.ts b/apps/red-ui/src/app/screens/auth-error/auth-error.component.ts index b737da561..f6caaf666 100644 --- a/apps/red-ui/src/app/screens/auth-error/auth-error.component.ts +++ b/apps/red-ui/src/app/screens/auth-error/auth-error.component.ts @@ -1,28 +1,29 @@ -import {Component, OnInit} from '@angular/core'; -import {UserService} from "../../user/user.service"; -import {AppConfigKey, AppConfigService} from "../../app-config/app-config.service"; +import { Component, OnInit } from '@angular/core'; +import { UserService } from '../../user/user.service'; +import { AppConfigKey, AppConfigService } from '../../app-config/app-config.service'; @Component({ - selector: 'redaction-auth-error', - templateUrl: './auth-error.component.html', - styleUrls: ['./auth-error.component.scss'] + selector: 'redaction-auth-error', + templateUrl: './auth-error.component.html', + styleUrls: ['./auth-error.component.scss'] }) export class AuthErrorComponent implements OnInit { + configuredAdminName: string; + configuredAdminUrl: string; - configuredAdminName: string; - configuredAdminUrl: string; + constructor( + private readonly _userService: UserService, + private readonly _appConfigService: AppConfigService + ) {} - constructor(private readonly _userService: UserService, private readonly _appConfigService: AppConfigService) { - } + ngOnInit(): void { + this.configuredAdminName = this._appConfigService.getConfig( + AppConfigKey.ADMIN_CONTACT_NAME + ); + this.configuredAdminUrl = this._appConfigService.getConfig(AppConfigKey.ADMIN_CONTACT_URL); + } - ngOnInit(): void { - - this.configuredAdminName = this._appConfigService.getConfig(AppConfigKey.ADMIN_CONTACT_NAME); - this.configuredAdminUrl = this._appConfigService.getConfig(AppConfigKey.ADMIN_CONTACT_URL); - - } - - logout() { - this._userService.logout(); - } + logout() { + this._userService.logout(); + } } diff --git a/apps/red-ui/src/app/screens/base-screen/base-screen.component.ts b/apps/red-ui/src/app/screens/base-screen/base-screen.component.ts index 68e2476bb..49dde720c 100644 --- a/apps/red-ui/src/app/screens/base-screen/base-screen.component.ts +++ b/apps/red-ui/src/app/screens/base-screen/base-screen.component.ts @@ -1,31 +1,29 @@ -import {Component} from '@angular/core'; -import {UserService} from "../../user/user.service"; -import {AppStateService} from "../../state/app-state.service"; -import {LanguageService} from "../../i18n/language.service"; +import { Component } from '@angular/core'; +import { UserService } from '../../user/user.service'; +import { AppStateService } from '../../state/app-state.service'; +import { LanguageService } from '../../i18n/language.service'; @Component({ - selector: 'redaction-base-screen', - templateUrl: './base-screen.component.html', - styleUrls: ['./base-screen.component.scss'] + selector: 'redaction-base-screen', + templateUrl: './base-screen.component.html', + styleUrls: ['./base-screen.component.scss'] }) export class BaseScreenComponent { + constructor( + public readonly appStateService: AppStateService, + private readonly _languageService: LanguageService, + private readonly _userService: UserService + ) {} - constructor( - public readonly appStateService: AppStateService, - private readonly _languageService: LanguageService, - private readonly _userService: UserService) { + get user() { + return this._userService.user; + } - } + logout() { + this._userService.logout(); + } - get user() { - return this._userService.user; - } - - logout() { - this._userService.logout(); - } - - changeLanguage(language: string) { - this._languageService.changeLanguage(language); - } + changeLanguage(language: string) { + this._languageService.changeLanguage(language); + } } diff --git a/apps/red-ui/src/app/screens/file/model/file-type.ts b/apps/red-ui/src/app/screens/file/model/file-type.ts index bcebca58b..32a858e32 100644 --- a/apps/red-ui/src/app/screens/file/model/file-type.ts +++ b/apps/red-ui/src/app/screens/file/model/file-type.ts @@ -1,5 +1,5 @@ export enum FileType { - ORIGINAL = 'ORIGINAL', - ANNOTATED = 'ANNOTATED', - REDACTED = 'REDACTED' + ORIGINAL = 'ORIGINAL', + ANNOTATED = 'ANNOTATED', + REDACTED = 'REDACTED' } diff --git a/apps/red-ui/src/app/screens/file/pdf-viewer/pdf-viewer.component.html b/apps/red-ui/src/app/screens/file/pdf-viewer/pdf-viewer.component.html index a1c96bfbe..af7ce7b13 100644 --- a/apps/red-ui/src/app/screens/file/pdf-viewer/pdf-viewer.component.html +++ b/apps/red-ui/src/app/screens/file/pdf-viewer/pdf-viewer.component.html @@ -1,3 +1,3 @@
-
+
diff --git a/apps/red-ui/src/app/screens/file/pdf-viewer/pdf-viewer.component.scss b/apps/red-ui/src/app/screens/file/pdf-viewer/pdf-viewer.component.scss index b422b059c..eefc57fcf 100644 --- a/apps/red-ui/src/app/screens/file/pdf-viewer/pdf-viewer.component.scss +++ b/apps/red-ui/src/app/screens/file/pdf-viewer/pdf-viewer.component.scss @@ -1,10 +1,10 @@ .page { - display: flex; - flex-direction: column; - width: 100%; - height: 100%; + display: flex; + flex-direction: column; + width: 100%; + height: 100%; } .viewer { - height: 100%; + height: 100%; } diff --git a/apps/red-ui/src/app/screens/file/service/file-download.service.ts b/apps/red-ui/src/app/screens/file/service/file-download.service.ts index daa443674..e5b923c8b 100644 --- a/apps/red-ui/src/app/screens/file/service/file-download.service.ts +++ b/apps/red-ui/src/app/screens/file/service/file-download.service.ts @@ -1,38 +1,58 @@ -import {Injectable} from '@angular/core'; -import {Observable, of} from "rxjs"; -import {tap} from "rxjs/operators"; -import {FileUploadControllerService} from '@redaction/red-ui-http'; -import {FileType} from "../model/file-type"; +import { Injectable } from '@angular/core'; +import { Observable, of } from 'rxjs'; +import { tap } from 'rxjs/operators'; +import { FileUploadControllerService } from '@redaction/red-ui-http'; +import { FileType } from '../model/file-type'; @Injectable({ - providedIn: 'root' + providedIn: 'root' }) export class FileDownloadService { - constructor(private readonly _fileUploadControllerService: FileUploadControllerService) { - } + constructor(private readonly _fileUploadControllerService: FileUploadControllerService) {} - - loadFile(fileType: FileType | string, fileId: string, saveTo: (fileData) => void = () => null, fetch: () => any = () => null): Observable { - let fileObs$: Observable; - switch (fileType) { - case FileType.ANNOTATED: - fileObs$ = fetch() ? of(fetch()) : this._fileUploadControllerService.downloadAnnotatedFile(fileId, true, 'body').pipe(tap(data => { - saveTo(data); - })); - break; - case FileType.REDACTED: - fileObs$ = fetch() ? of(fetch()) : this._fileUploadControllerService.downloadRedactedFile(fileId, true, 'body').pipe(tap(data => { - saveTo(data); - })); - break; - case FileType.ORIGINAL: - default: - fileObs$ = fetch() ? of(fetch()) : this._fileUploadControllerService.downloadOriginalFile(fileId, true, 'body') - .pipe(tap(data => { - saveTo(data); - })); - break; + loadFile( + fileType: FileType | string, + fileId: string, + saveTo: (fileData) => void = () => null, + fetch: () => any = () => null + ): Observable { + let fileObs$: Observable; + switch (fileType) { + case FileType.ANNOTATED: + fileObs$ = fetch() + ? of(fetch()) + : this._fileUploadControllerService + .downloadAnnotatedFile(fileId, true, 'body') + .pipe( + tap((data) => { + saveTo(data); + }) + ); + break; + case FileType.REDACTED: + fileObs$ = fetch() + ? of(fetch()) + : this._fileUploadControllerService + .downloadRedactedFile(fileId, true, 'body') + .pipe( + tap((data) => { + saveTo(data); + }) + ); + break; + case FileType.ORIGINAL: + default: + fileObs$ = fetch() + ? of(fetch()) + : this._fileUploadControllerService + .downloadOriginalFile(fileId, true, 'body') + .pipe( + tap((data) => { + saveTo(data); + }) + ); + break; + } + return fileObs$; } - return fileObs$; - } } diff --git a/apps/red-ui/src/app/screens/file/service/filters.service.ts b/apps/red-ui/src/app/screens/file/service/filters.service.ts index cb8cb7807..406d0f58c 100644 --- a/apps/red-ui/src/app/screens/file/service/filters.service.ts +++ b/apps/red-ui/src/app/screens/file/service/filters.service.ts @@ -2,25 +2,24 @@ import { Injectable } from '@angular/core'; import { AnnotationFilters } from '../../../utils/types'; @Injectable({ - providedIn: 'root' + providedIn: 'root' }) export class FiltersService { - constructor() { - } + constructor() {} - private _filters: AnnotationFilters = { - hint: { - hint_only: false, - vertebrate: false, - names: false, - }, - redaction: false, - comment: false, - suggestion: false, - ignore: false, - } + private _filters: AnnotationFilters = { + hint: { + hint_only: false, + vertebrate: false, + names: false + }, + redaction: false, + comment: false, + suggestion: false, + ignore: false + }; - public get filters(): AnnotationFilters { - return JSON.parse(JSON.stringify(this._filters)); - } + public get filters(): AnnotationFilters { + return JSON.parse(JSON.stringify(this._filters)); + } } diff --git a/apps/red-ui/src/app/state/app-state.guard.ts b/apps/red-ui/src/app/state/app-state.guard.ts index b49b9dd88..9ba4ff530 100644 --- a/apps/red-ui/src/app/state/app-state.guard.ts +++ b/apps/red-ui/src/app/state/app-state.guard.ts @@ -1,23 +1,21 @@ -import {Injectable} from "@angular/core"; -import {ActivatedRouteSnapshot, CanActivate, RouterStateSnapshot} from "@angular/router"; -import {AppStateService} from "./app-state.service"; -import {UserService} from "../user/user.service"; - +import { Injectable } from '@angular/core'; +import { ActivatedRouteSnapshot, CanActivate, RouterStateSnapshot } from '@angular/router'; +import { AppStateService } from './app-state.service'; +import { UserService } from '../user/user.service'; @Injectable({ - providedIn: 'root' + providedIn: 'root' }) export class AppStateGuard implements CanActivate { + constructor( + private readonly _appStateService: AppStateService, + private readonly _userService: UserService + ) {} - constructor(private readonly _appStateService: AppStateService, private readonly _userService: UserService) { - } - - async canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Promise { - - await this._userService.loadAllUsersIfNecessary() - await this._appStateService.loadAllProjectsIfNecessary(); - - return true; - } + async canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Promise { + await this._userService.loadAllUsersIfNecessary(); + await this._appStateService.loadAllProjectsIfNecessary(); + return true; + } } diff --git a/apps/red-ui/src/app/upload/file-drop/file-drop.component.html b/apps/red-ui/src/app/upload/file-drop/file-drop.component.html index 9b69a83bd..a9cb6e126 100644 --- a/apps/red-ui/src/app/upload/file-drop/file-drop.component.html +++ b/apps/red-ui/src/app/upload/file-drop/file-drop.component.html @@ -1,11 +1,12 @@
- - {{"project-overview.upload-files.label"| translate}} - - + + {{ + 'project-overview.upload-files.label' | translate + }} + + - +
diff --git a/apps/red-ui/src/app/upload/file-drop/file-drop.component.scss b/apps/red-ui/src/app/upload/file-drop/file-drop.component.scss index 8c5394302..b2942716c 100644 --- a/apps/red-ui/src/app/upload/file-drop/file-drop.component.scss +++ b/apps/red-ui/src/app/upload/file-drop/file-drop.component.scss @@ -1,26 +1,25 @@ section { - position: fixed; - top: 0; - bottom: 0; - right: 0; - left: 0; - width: 100vw; - height: 100vh; - z-index: 1000; - padding: 12px; - background: white; + position: fixed; + top: 0; + bottom: 0; + right: 0; + left: 0; + width: 100vw; + height: 100vh; + z-index: 1000; + padding: 12px; + background: white; } .file-drop-zone { - background: white; - height: calc(100% - 26px); - width: calc(100% - 26px); + background: white; + height: calc(100% - 26px); + width: calc(100% - 26px); } - .close-icon { - position: absolute; - z-index: 1100; - top: 20px; - right: 40px; + position: absolute; + z-index: 1100; + top: 20px; + right: 40px; } diff --git a/apps/red-ui/src/app/upload/file-drop/file-drop.component.ts b/apps/red-ui/src/app/upload/file-drop/file-drop.component.ts index 0aea912fe..fef8b4f6e 100644 --- a/apps/red-ui/src/app/upload/file-drop/file-drop.component.ts +++ b/apps/red-ui/src/app/upload/file-drop/file-drop.component.ts @@ -1,46 +1,46 @@ -import {Component, HostListener, OnInit} from '@angular/core'; -import {FileUploadService} from "../file-upload.service"; -import {FileUploadModel} from "../model/file-upload.model"; -import {OverlayRef} from "@angular/cdk/overlay"; -import {UploadStatusOverlayService} from "../upload-status-dialog/service/upload-status-overlay.service"; +import { Component, HostListener, OnInit } from '@angular/core'; +import { FileUploadService } from '../file-upload.service'; +import { FileUploadModel } from '../model/file-upload.model'; +import { OverlayRef } from '@angular/cdk/overlay'; +import { UploadStatusOverlayService } from '../upload-status-dialog/service/upload-status-overlay.service'; @Component({ - selector: 'redaction-file-drop', - templateUrl: './file-drop.component.html', - styleUrls: ['./file-drop.component.scss'] + selector: 'redaction-file-drop', + templateUrl: './file-drop.component.html', + styleUrls: ['./file-drop.component.scss'] }) export class FileDropComponent implements OnInit { + constructor( + private readonly _dialogRef: OverlayRef, + private readonly _fileUploadService: FileUploadService, + private _uploadStatusOverlayService: UploadStatusOverlayService + ) {} - constructor(private readonly _dialogRef: OverlayRef, private readonly _fileUploadService: FileUploadService, private _uploadStatusOverlayService: UploadStatusOverlayService) { - } + ngOnInit() {} - ngOnInit() { - } - - close() { - this._dialogRef.detach(); - } - - @HostListener('document:keydown.escape', ['$event']) - onKeydownHandler(evt: KeyboardEvent) { - this.close(); - } - - handleFileInput(files: FileList | File[]) { - - const uploadFiles: FileUploadModel[] = []; - for (let i = 0; i < files.length; i++) { - const file = files[i]; - uploadFiles.push({ - file: file, - progress: 0, - completed: false, - error: null - }) + close() { + this._dialogRef.detach(); } - this._fileUploadService.uploadFiles(uploadFiles); - this._uploadStatusOverlayService.openStatusOverlay(); - this._dialogRef.detach(); - } + @HostListener('document:keydown.escape', ['$event']) + onKeydownHandler(evt: KeyboardEvent) { + this.close(); + } + + handleFileInput(files: FileList | File[]) { + const uploadFiles: FileUploadModel[] = []; + for (let i = 0; i < files.length; i++) { + const file = files[i]; + uploadFiles.push({ + file: file, + progress: 0, + completed: false, + error: null + }); + } + + this._fileUploadService.uploadFiles(uploadFiles); + this._uploadStatusOverlayService.openStatusOverlay(); + this._dialogRef.detach(); + } } diff --git a/apps/red-ui/src/app/upload/file-drop/service/file-drop-overlay.service.ts b/apps/red-ui/src/app/upload/file-drop/service/file-drop-overlay.service.ts index 8bee1601c..c72466455 100644 --- a/apps/red-ui/src/app/upload/file-drop/service/file-drop-overlay.service.ts +++ b/apps/red-ui/src/app/upload/file-drop/service/file-drop-overlay.service.ts @@ -1,69 +1,64 @@ -import {Injectable, Injector} from "@angular/core"; -import {Overlay} from "@angular/cdk/overlay"; -import {FileDropComponent} from "../file-drop.component"; -import {ComponentPortal} from "@angular/cdk/portal"; -import {OverlayRef} from "@angular/cdk/overlay"; +import { Injectable, Injector } from '@angular/core'; +import { Overlay } from '@angular/cdk/overlay'; +import { FileDropComponent } from '../file-drop.component'; +import { ComponentPortal } from '@angular/cdk/portal'; +import { OverlayRef } from '@angular/cdk/overlay'; @Injectable({ - providedIn: 'root' + providedIn: 'root' }) export class FileDropOverlayService { + private readonly _dropOverlayRef: OverlayRef; - private readonly _dropOverlayRef: OverlayRef; - - constructor(private overlay: Overlay, private readonly _injector: Injector) { - this._dropOverlayRef = this.overlay.create({ - height: '100vh', - width: '100vw', - }); - } - - dragListener = () => { - this.openFileDropOverlay(); - }; - mouseOut = e => { - if (e.toElement == null && e.relatedTarget == null) { - this.closeFileDropOverlay(); + constructor(private overlay: Overlay, private readonly _injector: Injector) { + this._dropOverlayRef = this.overlay.create({ + height: '100vh', + width: '100vw' + }); } - }; - initFileDropHandling() { - document - .getElementsByTagName('body')[0] - .addEventListener('dragenter', this.dragListener, false); - document.getElementsByTagName('body')[0].addEventListener('mouseout', this.mouseOut, false); - } + dragListener = () => { + this.openFileDropOverlay(); + }; + mouseOut = (e) => { + if (e.toElement == null && e.relatedTarget == null) { + this.closeFileDropOverlay(); + } + }; - cleanupFileDropHandling() { - document - .getElementsByTagName('body')[0] - .removeEventListener('dragenter', this.dragListener, false); - document - .getElementsByTagName('body')[0] - .removeEventListener('mouseout', this.mouseOut, false); - } - - - private _createInjector() { - return Injector.create({ - providers: [{provide: OverlayRef, useValue: this._dropOverlayRef}], - parent: this._injector, - }) - } - - openFileDropOverlay() { - const component = new ComponentPortal(FileDropComponent, null, this._createInjector()); - if (!this._dropOverlayRef.hasAttached()) { - this._dropOverlayRef.attach(component); + initFileDropHandling() { + document + .getElementsByTagName('body')[0] + .addEventListener('dragenter', this.dragListener, false); + document.getElementsByTagName('body')[0].addEventListener('mouseout', this.mouseOut, false); } - } - closeFileDropOverlay() { - if (this._dropOverlayRef) { - this._dropOverlayRef.detach(); + cleanupFileDropHandling() { + document + .getElementsByTagName('body')[0] + .removeEventListener('dragenter', this.dragListener, false); + document + .getElementsByTagName('body')[0] + .removeEventListener('mouseout', this.mouseOut, false); } - } + private _createInjector() { + return Injector.create({ + providers: [{ provide: OverlayRef, useValue: this._dropOverlayRef }], + parent: this._injector + }); + } + openFileDropOverlay() { + const component = new ComponentPortal(FileDropComponent, null, this._createInjector()); + if (!this._dropOverlayRef.hasAttached()) { + this._dropOverlayRef.attach(component); + } + } + closeFileDropOverlay() { + if (this._dropOverlayRef) { + this._dropOverlayRef.detach(); + } + } } diff --git a/apps/red-ui/src/app/upload/file-upload.module.ts b/apps/red-ui/src/app/upload/file-upload.module.ts index 4d6171c8f..e3caf9215 100644 --- a/apps/red-ui/src/app/upload/file-upload.module.ts +++ b/apps/red-ui/src/app/upload/file-upload.module.ts @@ -1,32 +1,31 @@ -import {NgModule} from '@angular/core'; -import {CommonModule} from '@angular/common'; -import {MatIconModule} from '@angular/material/icon'; -import {MatListModule} from '@angular/material/list'; -import {MatProgressBarModule} from '@angular/material/progress-bar'; -import {MatTooltipModule} from '@angular/material/tooltip'; -import {FileDropComponent} from './file-drop/file-drop.component'; -import {OverlayModule} from '@angular/cdk/overlay'; -import {UploadStatusOverlay} from './upload-status-dialog/upload-status-overlay.component'; -import {NgxDropzoneModule} from "ngx-dropzone"; -import {TranslateModule} from "@ngx-translate/core"; -import {MatButtonModule} from "@angular/material/button"; +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { MatIconModule } from '@angular/material/icon'; +import { MatListModule } from '@angular/material/list'; +import { MatProgressBarModule } from '@angular/material/progress-bar'; +import { MatTooltipModule } from '@angular/material/tooltip'; +import { FileDropComponent } from './file-drop/file-drop.component'; +import { OverlayModule } from '@angular/cdk/overlay'; +import { UploadStatusOverlay } from './upload-status-dialog/upload-status-overlay.component'; +import { NgxDropzoneModule } from 'ngx-dropzone'; +import { TranslateModule } from '@ngx-translate/core'; +import { MatButtonModule } from '@angular/material/button'; @NgModule({ - imports: [ - CommonModule, - MatIconModule, - MatTooltipModule, - TranslateModule, - MatListModule, - NgxDropzoneModule, - MatProgressBarModule, - OverlayModule, - MatButtonModule, - ], - declarations: [FileDropComponent, UploadStatusOverlay], - providers: [], - entryComponents: [FileDropComponent, UploadStatusOverlay], - exports: [FileDropComponent, UploadStatusOverlay] + imports: [ + CommonModule, + MatIconModule, + MatTooltipModule, + TranslateModule, + MatListModule, + NgxDropzoneModule, + MatProgressBarModule, + OverlayModule, + MatButtonModule + ], + declarations: [FileDropComponent, UploadStatusOverlay], + providers: [], + entryComponents: [FileDropComponent, UploadStatusOverlay], + exports: [FileDropComponent, UploadStatusOverlay] }) -export class FileUploadModule { -} +export class FileUploadModule {} diff --git a/apps/red-ui/src/app/upload/file-upload.service.ts b/apps/red-ui/src/app/upload/file-upload.service.ts index a43d37e77..ffcd611a0 100644 --- a/apps/red-ui/src/app/upload/file-upload.service.ts +++ b/apps/red-ui/src/app/upload/file-upload.service.ts @@ -1,47 +1,56 @@ -import {Injectable} from "@angular/core"; -import {FileUploadModel} from "./model/file-upload.model"; -import {FileUploadControllerService} from "@redaction/red-ui-http"; -import {AppStateService} from "../state/app-state.service"; -import {HttpEventType} from "@angular/common/http"; +import { Injectable } from '@angular/core'; +import { FileUploadModel } from './model/file-upload.model'; +import { FileUploadControllerService } from '@redaction/red-ui-http'; +import { AppStateService } from '../state/app-state.service'; +import { HttpEventType } from '@angular/common/http'; @Injectable({ - providedIn: 'root' + providedIn: 'root' }) export class FileUploadService { + files: FileUploadModel[] = []; - files: FileUploadModel[] = []; + constructor( + private readonly _appStateService: AppStateService, + private readonly _fileUploadControllerService: FileUploadControllerService + ) {} - constructor( - private readonly _appStateService: AppStateService, - private readonly _fileUploadControllerService: FileUploadControllerService, - ) { - } + uploadFiles(files: FileUploadModel[]) { + this.files.push(...files); + files.forEach((newFile) => { + this._fileUploadControllerService + .uploadFileForm( + newFile.file, + this._appStateService.activeProject.project.projectId, + 'events', + true + ) + .subscribe( + (event) => { + if (event.type === HttpEventType.UploadProgress) { + newFile.progress = Math.round( + (event.loaded / (event.total || event.loaded)) * 100 + ); + } + if (event.type === HttpEventType.Response) { + if (event.status < 300) { + newFile.progress = 100; + newFile.completed = true; + } else { + newFile.completed = true; + newFile.error = event.body; + } + } + }, + (error) => { + newFile.completed = true; + newFile.error = error; + } + ); + }); + } - - uploadFiles(files: FileUploadModel[]) { - this.files.push(...files); - files.forEach(newFile => { - this._fileUploadControllerService.uploadFileForm(newFile.file, this._appStateService.activeProject.project.projectId, 'events', true).subscribe((event) => { - if (event.type === HttpEventType.UploadProgress) { - newFile.progress = Math.round((event.loaded / (event.total || event.loaded) * 100)); - } - if (event.type === HttpEventType.Response) { - if (event.status < 300) { - newFile.progress = 100; - newFile.completed = true; - } else { - newFile.completed = true; - newFile.error = event.body; - } - } - }, (error) => { - newFile.completed = true; - newFile.error = error; - }); - }); - } - - stopAllUploads() { - this.files = []; - } + stopAllUploads() { + this.files = []; + } } diff --git a/apps/red-ui/src/app/upload/model/file-upload.model.ts b/apps/red-ui/src/app/upload/model/file-upload.model.ts index da4775fc1..9bd8958c6 100644 --- a/apps/red-ui/src/app/upload/model/file-upload.model.ts +++ b/apps/red-ui/src/app/upload/model/file-upload.model.ts @@ -1,8 +1,6 @@ export interface FileUploadModel { - - file: File; - progress: number; - completed: boolean; - error: any; - + file: File; + progress: number; + completed: boolean; + error: any; } diff --git a/apps/red-ui/src/app/upload/upload-status-dialog/service/upload-status-overlay.service.ts b/apps/red-ui/src/app/upload/upload-status-dialog/service/upload-status-overlay.service.ts index 0c2f0455c..ea089e093 100644 --- a/apps/red-ui/src/app/upload/upload-status-dialog/service/upload-status-overlay.service.ts +++ b/apps/red-ui/src/app/upload/upload-status-dialog/service/upload-status-overlay.service.ts @@ -1,41 +1,38 @@ -import {Injectable, Injector} from "@angular/core"; -import {Overlay, OverlayRef} from "@angular/cdk/overlay"; -import {ComponentPortal} from "@angular/cdk/portal"; -import {UploadStatusOverlay} from "../upload-status-overlay.component"; +import { Injectable, Injector } from '@angular/core'; +import { Overlay, OverlayRef } from '@angular/cdk/overlay'; +import { ComponentPortal } from '@angular/cdk/portal'; +import { UploadStatusOverlay } from '../upload-status-overlay.component'; @Injectable({ - providedIn: 'root' + providedIn: 'root' }) export class UploadStatusOverlayService { + private readonly _statusOverlayRef: OverlayRef; - private readonly _statusOverlayRef: OverlayRef; - - constructor(private overlay: Overlay, private readonly _injector: Injector) { - this._statusOverlayRef = this.overlay.create({ - height: '500px', - width: '300px', - }); - } - - private _createInjector() { - return Injector.create({ - providers: [{provide: OverlayRef, useValue: this._statusOverlayRef}], - parent: this._injector, - }) - } - - openStatusOverlay() { - const component = new ComponentPortal(UploadStatusOverlay, null, this._createInjector()); - if (!this._statusOverlayRef.hasAttached()) { - this._statusOverlayRef.attach(component); + constructor(private overlay: Overlay, private readonly _injector: Injector) { + this._statusOverlayRef = this.overlay.create({ + height: '500px', + width: '300px' + }); } - } - closeStatusOverlay() { - if (this._statusOverlayRef) { - this._statusOverlayRef.detach(); + private _createInjector() { + return Injector.create({ + providers: [{ provide: OverlayRef, useValue: this._statusOverlayRef }], + parent: this._injector + }); } - } + openStatusOverlay() { + const component = new ComponentPortal(UploadStatusOverlay, null, this._createInjector()); + if (!this._statusOverlayRef.hasAttached()) { + this._statusOverlayRef.attach(component); + } + } + closeStatusOverlay() { + if (this._statusOverlayRef) { + this._statusOverlayRef.detach(); + } + } } diff --git a/apps/red-ui/src/app/upload/upload-status-dialog/upload-status-overlay.component.html b/apps/red-ui/src/app/upload/upload-status-dialog/upload-status-overlay.component.html index bafe332a3..fe8922229 100644 --- a/apps/red-ui/src/app/upload/upload-status-dialog/upload-status-overlay.component.html +++ b/apps/red-ui/src/app/upload/upload-status-dialog/upload-status-overlay.component.html @@ -1,77 +1,68 @@
-
-
- {{ 'upload-status.dialog.title.label' | translate: {p1: uploadService.files.length} }} -
-
- -
-
- -
-
- -
-
-
-
-
-
-
- {{ model.file?.name }} -
-
- {{ model.progress }}% -
-
- -
-
- -
+
+
+ {{ 'upload-status.dialog.title.label' | translate: { p1: uploadService.files.length } }}
-
-
- {{ model.error.message }} -
+
+ +
+
+ +
+
+ +
+
+
+
+
+
+
+ {{ model.file?.name }} +
+
+ {{ model.progress }}% +
+
+ +
+
+ +
+
+
+
+ {{ model.error.message }} +
-
- -
- key +
+
+ key +
+
+ +
+
+
+
+ +
-
- -
-
-
- -
-
-
- diff --git a/apps/red-ui/src/app/upload/upload-status-dialog/upload-status-overlay.component.scss b/apps/red-ui/src/app/upload/upload-status-dialog/upload-status-overlay.component.scss index 686cd4cde..50e8d134f 100644 --- a/apps/red-ui/src/app/upload/upload-status-dialog/upload-status-overlay.component.scss +++ b/apps/red-ui/src/app/upload/upload-status-dialog/upload-status-overlay.component.scss @@ -1,91 +1,89 @@ -@import "../../../assets/styles/red-variables"; +@import '../../../assets/styles/red-variables'; section { - background: white; - position: fixed; - bottom: 10px; - right: 10px; - border: 2px solid $grey-1; + background: white; + position: fixed; + bottom: 10px; + right: 10px; + border: 2px solid $grey-1; } - .upload-list { - max-height: 400px; - max-width: 400px; - overflow: auto; + max-height: 400px; + max-width: 400px; + overflow: auto; } .red-upload-header { - display: flex; - flex-direction: row; - align-items: center; - position: relative; - padding: 10px; - background: $grey-1; - color: $white; - width: 380px; - cursor: pointer; - - mat-icon { + display: flex; + flex-direction: row; + align-items: center; + position: relative; + padding: 10px; + background: $grey-1; color: $white; - } + width: 380px; + cursor: pointer; + + mat-icon { + color: $white; + } } .collapse-icon { - padding-left: 8px; + padding-left: 8px; - mat-icon { - width: 16px; - } + mat-icon { + width: 16px; + } } .close-icon { - position: absolute; - right: 10px; - color: $white; + position: absolute; + right: 10px; + color: $white; } .upload-list-item { - padding: 8px; + padding: 8px; - mat-icon { - width: 16px; - } - - .upload-line { - display: flex !important; - height: 20px; - position: relative; - justify-content: flex-start; - - .upload-file-name { - text-overflow: ellipsis; - overflow: hidden; - display: block; - white-space: nowrap; - padding-right: 50px; - - &.error { - color: $red-1; - padding-right: 60px; - } + mat-icon { + width: 16px; } - .upload-progress { - position: absolute; - right: 0; - width: 50px; - display: flex; - justify-content: space-evenly; + .upload-line { + display: flex !important; + height: 20px; + position: relative; + justify-content: flex-start; - &.error { - color: $red-1; - } + .upload-file-name { + text-overflow: ellipsis; + overflow: hidden; + display: block; + white-space: nowrap; + padding-right: 50px; - &.ok { - color: $blue-1; - } + &.error { + color: $red-1; + padding-right: 60px; + } + } + + .upload-progress { + position: absolute; + right: 0; + width: 50px; + display: flex; + justify-content: space-evenly; + + &.error { + color: $red-1; + } + + &.ok { + color: $blue-1; + } + } } - } - } diff --git a/apps/red-ui/src/app/upload/upload-status-dialog/upload-status-overlay.component.ts b/apps/red-ui/src/app/upload/upload-status-dialog/upload-status-overlay.component.ts index 9e12ba620..57756b506 100644 --- a/apps/red-ui/src/app/upload/upload-status-dialog/upload-status-overlay.component.ts +++ b/apps/red-ui/src/app/upload/upload-status-dialog/upload-status-overlay.component.ts @@ -1,39 +1,32 @@ -import {Component, OnInit} from '@angular/core'; -import {FileUploadModel} from "../model/file-upload.model"; -import {FileUploadService} from "../file-upload.service"; -import {OverlayRef} from "@angular/cdk/overlay"; +import { Component, OnInit } from '@angular/core'; +import { FileUploadModel } from '../model/file-upload.model'; +import { FileUploadService } from '../file-upload.service'; +import { OverlayRef } from '@angular/cdk/overlay'; @Component({ - selector: 'redaction-upload-status-overlay', - templateUrl: './upload-status-overlay.component.html', - styleUrls: ['./upload-status-overlay.component.scss'] + selector: 'redaction-upload-status-overlay', + templateUrl: './upload-status-overlay.component.html', + styleUrls: ['./upload-status-overlay.component.scss'] }) export class UploadStatusOverlay implements OnInit { + collapsed = false; - collapsed = false; + constructor( + public readonly uploadService: FileUploadService, + private readonly _overlayRef: OverlayRef + ) {} + ngOnInit() {} - constructor(public readonly uploadService: FileUploadService, private readonly _overlayRef: OverlayRef) { - } + cancelItem(item: FileUploadModel) {} + uploadItem(item: FileUploadModel) { + item.completed = false; + item.error = null; + } - ngOnInit() { - - } - - cancelItem(item: FileUploadModel) { - - } - - - uploadItem(item: FileUploadModel) { - item.completed = false; - item.error = null; - - } - - closeDialog() { - this.uploadService.stopAllUploads(); - this._overlayRef.detach(); - } + closeDialog() { + this.uploadService.stopAllUploads(); + this._overlayRef.detach(); + } } diff --git a/apps/red-ui/src/app/user/user.service.ts b/apps/red-ui/src/app/user/user.service.ts index ef6340385..04babb04d 100644 --- a/apps/red-ui/src/app/user/user.service.ts +++ b/apps/red-ui/src/app/user/user.service.ts @@ -1,111 +1,117 @@ -import {Injectable} from '@angular/core'; -import {KeycloakService} from 'keycloak-angular'; -import {KeycloakProfile} from 'keycloak-js'; +import { Injectable } from '@angular/core'; +import { KeycloakService } from 'keycloak-angular'; +import { KeycloakProfile } from 'keycloak-js'; import jwt_decode from 'jwt-decode'; -import {User, UserControllerService} from '@redaction/red-ui-http'; +import { User, UserControllerService } from '@redaction/red-ui-http'; export class UserWrapper { + constructor(private _currentUser: KeycloakProfile, public roles: string[], public id: string) {} - constructor(private _currentUser: KeycloakProfile, public roles: string[], public id: string) { - } + get name() { + return this._currentUser.firstName + ' ' + this._currentUser.lastName; + } - get name() { - return this._currentUser.firstName + ' ' + this._currentUser.lastName; - } + get isManager() { + return this.roles.indexOf('RED_MANAGER') >= 0; + } - get isManager() { - return this.roles.indexOf('RED_MANAGER') >= 0; - } + get isUser() { + return this.roles.indexOf('RED_USER') >= 0; + } + get isAdmin() { + return this.roles.indexOf('RED_ADMIN') >= 0; + } - get isUser() { - return this.roles.indexOf('RED_USER') >= 0; - } - - - get isAdmin() { - return this.roles.indexOf('RED_ADMIN') >= 0; - } - - get hasAnyREDRoles() { - return this.isUser || this.isManager || this.isAdmin; - } - + get hasAnyREDRoles() { + return this.isUser || this.isManager || this.isAdmin; + } } @Injectable({ - providedIn: 'root' + providedIn: 'root' }) export class UserService { - private _currentUser: UserWrapper; - private _allUsers: User[]; + private _currentUser: UserWrapper; + private _allUsers: User[]; - constructor(private readonly _keycloakService: KeycloakService, - private readonly _userControllerService: UserControllerService) { - } + constructor( + private readonly _keycloakService: KeycloakService, + private readonly _userControllerService: UserControllerService + ) {} - logout() { - this._keycloakService.logout(window.location.origin); - } - - get userId() { - return this._currentUser.id; - } - - get allUsers() { - return this._allUsers; - } - - get managerUsers() { - return this._allUsers.filter(u => u.roles.indexOf('RED_MANAGER') >= 0); - } - - async loadAllUsersIfNecessary() { - if (!this._allUsers) { - await this.loadAllUsers(); + logout() { + this._keycloakService.logout(window.location.origin); } - } - async loadAllUsers() { - const allUsers = await this._userControllerService.getUsers({}, 0, 100).toPromise(); - this._allUsers = allUsers.users.filter(u => this._hasAnyRedRole(u)); - return allUsers; - } + get userId() { + return this._currentUser.id; + } - async loadCurrentUser() { - const token = await this._keycloakService.getToken(); - const decoded = jwt_decode(token); - const userId = decoded.sub; - this._currentUser = new UserWrapper(await this._keycloakService.loadUserProfile(false), this._keycloakService.getUserRoles(true), userId); - } + get allUsers() { + return this._allUsers; + } - get user() { - return this._currentUser; - } + get managerUsers() { + return this._allUsers.filter((u) => u.roles.indexOf('RED_MANAGER') >= 0); + } - getUserById(id: string) { - return this._allUsers.find(u => u.userId === id); - } + async loadAllUsersIfNecessary() { + if (!this._allUsers) { + await this.loadAllUsers(); + } + } - getNameForId(userId: string) { - return this.getName(this.getUserById(userId)); - } + async loadAllUsers() { + const allUsers = await this._userControllerService.getUsers({}, 0, 100).toPromise(); + this._allUsers = allUsers.users.filter((u) => this._hasAnyRedRole(u)); + return allUsers; + } - getName(user?: User) { - return user ? - (user.firstName && user.lastName ? `${user.firstName} ${user.lastName}` : user.username) : - undefined; - } + async loadCurrentUser() { + const token = await this._keycloakService.getToken(); + const decoded = jwt_decode(token); + const userId = decoded.sub; + this._currentUser = new UserWrapper( + await this._keycloakService.loadUserProfile(false), + this._keycloakService.getUserRoles(true), + userId + ); + } - isManager(user: User) { - return user.roles.indexOf('RED_MANAGER') >= 0; - } + get user() { + return this._currentUser; + } - isUser(user: User) { - return user.roles.indexOf('RED_USER') >= 0; - } + getUserById(id: string) { + return this._allUsers.find((u) => u.userId === id); + } - private _hasAnyRedRole(u: User) { - return u.roles.indexOf('RED_USER') >= 0 || u.roles.indexOf('RED_MANAGER') >= 0 || u.roles.indexOf('RED_ADMIN') >= 0; - } + getNameForId(userId: string) { + return this.getName(this.getUserById(userId)); + } + + getName(user?: User) { + return user + ? user.firstName && user.lastName + ? `${user.firstName} ${user.lastName}` + : user.username + : undefined; + } + + isManager(user: User) { + return user.roles.indexOf('RED_MANAGER') >= 0; + } + + isUser(user: User) { + return user.roles.indexOf('RED_USER') >= 0; + } + + private _hasAnyRedRole(u: User) { + return ( + u.roles.indexOf('RED_USER') >= 0 || + u.roles.indexOf('RED_MANAGER') >= 0 || + u.roles.indexOf('RED_ADMIN') >= 0 + ); + } } diff --git a/apps/red-ui/src/app/utils/annotation-utils.ts b/apps/red-ui/src/app/utils/annotation-utils.ts index 1da9cf0c9..8ac39c182 100644 --- a/apps/red-ui/src/app/utils/annotation-utils.ts +++ b/apps/red-ui/src/app/utils/annotation-utils.ts @@ -1,107 +1,114 @@ -import {Annotations} from '@pdftron/webviewer'; -import {AnnotationFilters} from './types'; +import { Annotations } from '@pdftron/webviewer'; +import { AnnotationFilters } from './types'; export class AnnotationUtils { - public static sortAnnotations(annotations: Annotations.Annotation[]): Annotations.Annotation[] { - return annotations.sort((ann1, ann2) => { - if (ann1.getPageNumber() === ann2.getPageNumber()) { - if (ann1.getY() === ann2.getY()) { - if (ann1.getX() === ann2.getY()) { - return 0; - } - return ann1.getX() < ann2.getX() ? -1 : 1; - } - return ann1.getY() < ann2.getY() ? -1 : 1; - } - return ann1.getPageNumber() < ann2.getPageNumber() ? -1 : 1; - }); - } - - public static hasSubsections(filter: AnnotationFilters | boolean) { - return filter instanceof Object; - } - - public static checkedSubkeys(filter: AnnotationFilters | boolean) { - return Object.keys(filter).filter(subkey => this.isChecked(filter[subkey])).length; - } - - // Only some of the sub-items are selected - public static isIndeterminate(filter: AnnotationFilters | boolean): boolean { - return this.hasSubsections(filter) ? AnnotationUtils.checkedSubkeys(filter) > 0 && !this.isChecked(filter) : false; - } - - // All sub-items are selected - public static isChecked(filter: AnnotationFilters | boolean): boolean { - return this.hasSubsections(filter) ? - AnnotationUtils.checkedSubkeys(filter) === Object.keys(filter).length : - filter as boolean; - } - - public static hasActiveFilters(filter: AnnotationFilters): boolean { - const activeFilters = Object.keys(filter).filter(key => { - return this.isChecked(filter[key]) || this.isIndeterminate(filter[key]); - }); - return activeFilters.length > 0; - } - - public static parseAnnotations(annotations: Annotations.Annotation[], filters: AnnotationFilters): - { [key: number]: { annotations: Annotations.Annotation[] } } { - const obj = {}; - - for (const ann of annotations) { - const pageNumber = ann.getPageNumber(); - const type = this.getType(ann); - const dictionary = this.getDictionary(ann); - - if (this.hasActiveFilters(filters)) { - if (!this.hasSubsections(filters[type]) && !filters[type]) { - continue; - } - - if (this.hasSubsections(filters[type]) && !filters[type][dictionary]) { - continue; - } - } - - if (!obj[pageNumber]) { - obj[pageNumber] = { - annotations: [], - hint: 0, - redaction: 0, - comment: 0, - suggestion: 0, - ignore: 0 - }; - } - obj[pageNumber].annotations.push(ann); - obj[pageNumber][type]++; + public static sortAnnotations(annotations: Annotations.Annotation[]): Annotations.Annotation[] { + return annotations.sort((ann1, ann2) => { + if (ann1.getPageNumber() === ann2.getPageNumber()) { + if (ann1.getY() === ann2.getY()) { + if (ann1.getX() === ann2.getY()) { + return 0; + } + return ann1.getX() < ann2.getX() ? -1 : 1; + } + return ann1.getY() < ann2.getY() ? -1 : 1; + } + return ann1.getPageNumber() < ann2.getPageNumber() ? -1 : 1; + }); } - Object.keys(obj).map(page => { - obj[page].annotations = this.sortAnnotations(obj[page].annotations); - }); - - return obj; - } - - public static addAnnotations(initialAnnotations: Annotations.Annotation[], addedAnnotations: Annotations.Annotation[]) { - for (const annotation of addedAnnotations) { - if (annotation.Id.indexOf(':') > 0) { - const found = initialAnnotations.find(a => a.Id === annotation.Id); - if(!found) { - initialAnnotations.push(annotation); - } - } + public static hasSubsections(filter: AnnotationFilters | boolean) { + return filter instanceof Object; } - } - public static getType(annotation: Annotations.Annotation): string { - const parts = annotation.Id.split(':'); - return parts.length >= 1 ? parts[0] : 'n/a'; - } + public static checkedSubkeys(filter: AnnotationFilters | boolean) { + return Object.keys(filter).filter((subkey) => this.isChecked(filter[subkey])).length; + } - public static getDictionary(annotation: Annotations.Annotation): string { - const parts = annotation.Id.split(':'); - return parts.length >= 2 ? parts[1] : 'n/a'; - } + // Only some of the sub-items are selected + public static isIndeterminate(filter: AnnotationFilters | boolean): boolean { + return this.hasSubsections(filter) + ? AnnotationUtils.checkedSubkeys(filter) > 0 && !this.isChecked(filter) + : false; + } + + // All sub-items are selected + public static isChecked(filter: AnnotationFilters | boolean): boolean { + return this.hasSubsections(filter) + ? AnnotationUtils.checkedSubkeys(filter) === Object.keys(filter).length + : (filter as boolean); + } + + public static hasActiveFilters(filter: AnnotationFilters): boolean { + const activeFilters = Object.keys(filter).filter((key) => { + return this.isChecked(filter[key]) || this.isIndeterminate(filter[key]); + }); + return activeFilters.length > 0; + } + + public static parseAnnotations( + annotations: Annotations.Annotation[], + filters: AnnotationFilters + ): { [key: number]: { annotations: Annotations.Annotation[] } } { + const obj = {}; + + for (const ann of annotations) { + const pageNumber = ann.getPageNumber(); + const type = this.getType(ann); + const dictionary = this.getDictionary(ann); + + if (this.hasActiveFilters(filters)) { + if (!this.hasSubsections(filters[type]) && !filters[type]) { + continue; + } + + if (this.hasSubsections(filters[type]) && !filters[type][dictionary]) { + continue; + } + } + + if (!obj[pageNumber]) { + obj[pageNumber] = { + annotations: [], + hint: 0, + redaction: 0, + comment: 0, + suggestion: 0, + ignore: 0 + }; + } + obj[pageNumber].annotations.push(ann); + obj[pageNumber][type]++; + } + + Object.keys(obj).map((page) => { + obj[page].annotations = this.sortAnnotations(obj[page].annotations); + }); + + return obj; + } + + public static addAnnotations( + initialAnnotations: Annotations.Annotation[], + addedAnnotations: Annotations.Annotation[] + ) { + for (const annotation of addedAnnotations) { + if (annotation.Id.indexOf(':') > 0) { + const found = initialAnnotations.find((a) => a.Id === annotation.Id); + if (!found) { + initialAnnotations.push(annotation); + } + } + } + } + + public static getType(annotation: Annotations.Annotation): string { + const parts = annotation.Id.split(':'); + return parts.length >= 1 ? parts[0] : 'n/a'; + } + + public static getDictionary(annotation: Annotations.Annotation): string { + const parts = annotation.Id.split(':'); + return parts.length >= 2 ? parts[1] : 'n/a'; + } } diff --git a/apps/red-ui/src/app/utils/app-load-state.service.ts b/apps/red-ui/src/app/utils/app-load-state.service.ts index 66de6cc4a..2647e5699 100644 --- a/apps/red-ui/src/app/utils/app-load-state.service.ts +++ b/apps/red-ui/src/app/utils/app-load-state.service.ts @@ -2,7 +2,7 @@ import { EventEmitter, Injectable } from '@angular/core'; import { Observable } from 'rxjs'; @Injectable({ - providedIn: 'root' + providedIn: 'root' }) export class AppLoadStateService { private _loadingEvent = new EventEmitter(); diff --git a/apps/red-ui/src/app/utils/composite-route.guard.ts b/apps/red-ui/src/app/utils/composite-route.guard.ts index 4a1b1c77c..f0cfa3c5e 100644 --- a/apps/red-ui/src/app/utils/composite-route.guard.ts +++ b/apps/red-ui/src/app/utils/composite-route.guard.ts @@ -1,57 +1,69 @@ -import {ActivatedRouteSnapshot, CanActivate, Router, RouterStateSnapshot, UrlTree} from '@angular/router'; -import {Injectable, Injector} from '@angular/core'; -import {from, Observable, of} from 'rxjs'; -import {catchError, map, mergeMap, tap} from 'rxjs/operators'; -import {AppLoadStateService} from "./app-load-state.service"; +import { + ActivatedRouteSnapshot, + CanActivate, + Router, + RouterStateSnapshot, + UrlTree +} from '@angular/router'; +import { Injectable, Injector } from '@angular/core'; +import { from, Observable, of } from 'rxjs'; +import { catchError, map, mergeMap, tap } from 'rxjs/operators'; +import { AppLoadStateService } from './app-load-state.service'; @Injectable({ - providedIn: 'root' + providedIn: 'root' }) export class CompositeRouteGuard implements CanActivate { + constructor( + protected readonly _router: Router, + protected readonly _injector: Injector, + private readonly _appLoadStateService: AppLoadStateService + ) {} + canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable { + this._appLoadStateService.pushLoadingEvent(true); + let compositeCanActivateObservable: Observable = of(true); - constructor(protected readonly _router: Router, protected readonly _injector: Injector, private readonly _appLoadStateService: AppLoadStateService) { - } + const routeGuards = route.data.routeGuards; - canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable { - this._appLoadStateService.pushLoadingEvent(true); - let compositeCanActivateObservable: Observable = of(true); - - const routeGuards = route.data.routeGuards; - - if (routeGuards) { - for (let i = 0; i < routeGuards.length; i++) { - const routeGuard = this._injector.get(routeGuards[i]); - let canActivateResult = routeGuard.canActivate(route, state); - if (canActivateResult instanceof Promise) { - canActivateResult = from(canActivateResult); - } - if (typeof canActivateResult === 'boolean' || canActivateResult instanceof UrlTree) { - canActivateResult = of(canActivateResult); - } - const canActivatePipe: Observable = canActivateResult.pipe(map(m => !!m)); - compositeCanActivateObservable = compositeCanActivateObservable.pipe( - mergeMap(bool => { - if (!bool) { - return of(false); - } else { - return canActivatePipe; + if (routeGuards) { + for (let i = 0; i < routeGuards.length; i++) { + const routeGuard = this._injector.get(routeGuards[i]); + let canActivateResult = routeGuard.canActivate(route, state); + if (canActivateResult instanceof Promise) { + canActivateResult = from(canActivateResult); + } + if ( + typeof canActivateResult === 'boolean' || + canActivateResult instanceof UrlTree + ) { + canActivateResult = of(canActivateResult); + } + const canActivatePipe: Observable = canActivateResult.pipe( + map((m) => !!m) + ); + compositeCanActivateObservable = compositeCanActivateObservable.pipe( + mergeMap((bool) => { + if (!bool) { + return of(false); + } else { + return canActivatePipe; + } + }) + ); } - }) + } + + compositeCanActivateObservable = compositeCanActivateObservable.pipe( + tap(() => { + this._appLoadStateService.pushLoadingEvent(false); + }), + catchError(() => { + this._appLoadStateService.pushLoadingEvent(false); + return of(false); + }) ); - } + + return compositeCanActivateObservable; } - - compositeCanActivateObservable = compositeCanActivateObservable.pipe( - tap(() => { - this._appLoadStateService.pushLoadingEvent(false); - }), - catchError(() => { - this._appLoadStateService.pushLoadingEvent(false); - return of(false); - }) - ); - - return compositeCanActivateObservable; - } } diff --git a/apps/red-ui/src/app/utils/debounce.ts b/apps/red-ui/src/app/utils/debounce.ts index fcd631824..af56c8df1 100644 --- a/apps/red-ui/src/app/utils/debounce.ts +++ b/apps/red-ui/src/app/utils/debounce.ts @@ -1,10 +1,10 @@ export function debounce(delay: number = 300): MethodDecorator { - return function(target: any, propertyKey: string, descriptor: PropertyDescriptor) { + return function (target: any, propertyKey: string, descriptor: PropertyDescriptor) { let timeout = null; const original = descriptor.value; - descriptor.value = function(...args) { + descriptor.value = function (...args) { clearTimeout(timeout); timeout = setTimeout(() => original.apply(this, args), delay); }; diff --git a/apps/red-ui/src/app/utils/file-download-utils.ts b/apps/red-ui/src/app/utils/file-download-utils.ts index e5722d3ff..377fd2596 100644 --- a/apps/red-ui/src/app/utils/file-download-utils.ts +++ b/apps/red-ui/src/app/utils/file-download-utils.ts @@ -1,13 +1,15 @@ -import {HttpResponse} from '@angular/common/http'; -import {saveAs} from 'file-saver'; +import { HttpResponse } from '@angular/common/http'; +import { saveAs } from 'file-saver'; export function download(event: HttpResponse, altName?: string) { - const contentDisposition = event.headers.get('Content-Disposition'); - let fileName; - try { - fileName = contentDisposition ? contentDisposition.split('filename=')[1].replace(/"/g, '') : undefined; - } catch (e) { - console.log('failed to parse content-disposition: ', contentDisposition); - } - saveAs(event.body, fileName ? fileName : altName); + const contentDisposition = event.headers.get('Content-Disposition'); + let fileName; + try { + fileName = contentDisposition + ? contentDisposition.split('filename=')[1].replace(/"/g, '') + : undefined; + } catch (e) { + console.log('failed to parse content-disposition: ', contentDisposition); + } + saveAs(event.body, fileName ? fileName : altName); } diff --git a/apps/red-ui/src/app/utils/full-page-loading-indicator/full-page-loading-indicator.component.html b/apps/red-ui/src/app/utils/full-page-loading-indicator/full-page-loading-indicator.component.html index ff96130d4..f928bb8ba 100644 --- a/apps/red-ui/src/app/utils/full-page-loading-indicator/full-page-loading-indicator.component.html +++ b/apps/red-ui/src/app/utils/full-page-loading-indicator/full-page-loading-indicator.component.html @@ -1,5 +1,4 @@ -
-
+
- +
diff --git a/apps/red-ui/src/app/utils/full-page-loading-indicator/full-page-loading-indicator.component.scss b/apps/red-ui/src/app/utils/full-page-loading-indicator/full-page-loading-indicator.component.scss index f3039729c..3b2159b87 100644 --- a/apps/red-ui/src/app/utils/full-page-loading-indicator/full-page-loading-indicator.component.scss +++ b/apps/red-ui/src/app/utils/full-page-loading-indicator/full-page-loading-indicator.component.scss @@ -1,24 +1,23 @@ -@import "../../../assets/styles/red-variables"; +@import '../../../assets/styles/red-variables'; - -.full-page-load-section, .full-page-load-spinner { - position: fixed; - top: 0; - bottom: 0; - left: 0; - right: 0; +.full-page-load-section, +.full-page-load-spinner { + position: fixed; + top: 0; + bottom: 0; + left: 0; + right: 0; } .full-page-load-section { - opacity: 0.7; - background: $white; - z-index: 900; - + opacity: 0.7; + background: $white; + z-index: 900; } .full-page-load-spinner { - z-index: 1000; - justify-content: center; - align-items: center; - display: flex; + z-index: 1000; + justify-content: center; + align-items: center; + display: flex; } diff --git a/apps/red-ui/src/app/utils/full-page-loading-indicator/full-page-loading-indicator.component.ts b/apps/red-ui/src/app/utils/full-page-loading-indicator/full-page-loading-indicator.component.ts index e166a389b..63b267fd1 100644 --- a/apps/red-ui/src/app/utils/full-page-loading-indicator/full-page-loading-indicator.component.ts +++ b/apps/red-ui/src/app/utils/full-page-loading-indicator/full-page-loading-indicator.component.ts @@ -1,12 +1,10 @@ -import {Component, Input, OnInit} from '@angular/core'; +import { Component, Input, OnInit } from '@angular/core'; @Component({ - selector: 'redaction-full-page-loading-indicator', - templateUrl: './full-page-loading-indicator.component.html', - styleUrls: ['./full-page-loading-indicator.component.scss'] + selector: 'redaction-full-page-loading-indicator', + templateUrl: './full-page-loading-indicator.component.html', + styleUrls: ['./full-page-loading-indicator.component.scss'] }) -export class FullPageLoadingIndicatorComponent { - - @Input() displayed = false; - +export class FullPageLoadingIndicatorComponent { + @Input() displayed = false; } diff --git a/apps/red-ui/src/app/utils/functions.ts b/apps/red-ui/src/app/utils/functions.ts index 7b4b6f00d..1ce38d109 100644 --- a/apps/red-ui/src/app/utils/functions.ts +++ b/apps/red-ui/src/app/utils/functions.ts @@ -1,6 +1,6 @@ export function groupBy(xs: any[], key: string) { - return xs.reduce((rv, x) => { - (rv[x[key]] = rv[x[key]] || []).push(x); - return rv; - }, {}); + return xs.reduce((rv, x) => { + (rv[x[key]] = rv[x[key]] || []).push(x); + return rv; + }, {}); } diff --git a/apps/red-ui/src/app/utils/types.d.ts b/apps/red-ui/src/app/utils/types.d.ts index 6d82deec7..9c0ad57e7 100644 --- a/apps/red-ui/src/app/utils/types.d.ts +++ b/apps/red-ui/src/app/utils/types.d.ts @@ -1,20 +1,15 @@ -import {FileStatus} from "@redaction/red-ui-http"; +import { FileStatus } from '@redaction/red-ui-http'; export type Color = FileStatus.StatusEnum | ProjectStatus.StatusEnum; -export type AnnotationType = - 'hint' | - 'redaction' | - 'suggestion' | - 'comment' | - 'ignore' +export type AnnotationType = 'hint' | 'redaction' | 'suggestion' | 'comment' | 'ignore'; export class SortingOption { - label: string; - order: string; - column: string; + label: string; + order: string; + column: string; } export class AnnotationFilters { - [key: AnnotationType]: boolean + [key: AnnotationType]: boolean; } diff --git a/apps/red-ui/src/assets/config/config.json b/apps/red-ui/src/assets/config/config.json index 52b0e4aef..c634eaab5 100644 --- a/apps/red-ui/src/assets/config/config.json +++ b/apps/red-ui/src/assets/config/config.json @@ -1,6 +1,6 @@ { - "OAUTH_URL": "https://keycloak-dev.iqser.cloud/auth/realms/redaction", - "OAUTH_CLIENT_ID": "redaction", - "API_URL": "", - "PDFTRON_LICENSE": "" + "OAUTH_URL": "https://keycloak-dev.iqser.cloud/auth/realms/redaction", + "OAUTH_CLIENT_ID": "redaction", + "API_URL": "", + "PDFTRON_LICENSE": "" } diff --git a/apps/red-ui/src/assets/i18n/de.json b/apps/red-ui/src/assets/i18n/de.json index 1a3ee6af6..11c86d5ca 100644 --- a/apps/red-ui/src/assets/i18n/de.json +++ b/apps/red-ui/src/assets/i18n/de.json @@ -1,466 +1,466 @@ { - "auth-error": { - "heading": { - "label": "Ihr Benutzer verfügt nicht über die erforderlichen RED- * -Rollen, um auf diese Anwendung zuzugreifen. Bitte kontaktieren Sie Ihren Administrator für den Zugriff!" - }, - "heading-with-name-and-link": { - "label": "Ihr Benutzer verfügt nicht über die erforderlichen RED- * -Rollen, um auf diese Anwendung zuzugreifen. Bitte kontaktieren Sie {{adminName}} für den Zugriff!" - }, - "heading-with-name": { - "label": "Ihr Benutzer verfügt nicht über die erforderlichen RED- * -Rollen, um auf diese Anwendung zuzugreifen. Bitte kontaktieren Sie {{adminName}} für den Zugriff!" - }, - "heading-with-link": { - "label": "Ihr Benutzer verfügt nicht über die erforderlichen RED- * -Rollen, um auf diese Anwendung zuzugreifen. Bitte kontaktieren Sie Ihren Administrator für den Zugriff!" - }, - "logout": { - "label": "Ausloggen" - } - }, - "manual-redaction": { - "remove-annotation": { - "success": { - "label": "Anmerkung Zum Entfernen empfohlen!" - }, - "failed": { - "label": "Fehler beim Anfordern der Entfernung von Anmerkungen!" - } - }, - "dialog": { - "header": { - "label": "Manuelle Redaktion hinzufügen" - }, - "add-redaction": { - "success": { - "label": "Redaktionsvorschlag hinzugefügt!" + "auth-error": { + "heading": { + "label": "Ihr Benutzer verfügt nicht über die erforderlichen RED- * -Rollen, um auf diese Anwendung zuzugreifen. Bitte kontaktieren Sie Ihren Administrator für den Zugriff!" }, - "failed": { - "label": "Manuelle Redaktion konnte nicht hinzugefügt werden: {{message}}" - } - }, - "actions": { - "save": { - "label": "Manuelle Redaktion speichern" - } - }, - "content": { - "text": { - "label": "Ausgewählter Text: {{value}}" + "heading-with-name-and-link": { + "label": "Ihr Benutzer verfügt nicht über die erforderlichen RED- * -Rollen, um auf diese Anwendung zuzugreifen. Bitte kontaktieren Sie {{adminName}} für den Zugriff!" }, - "dictionary": { - "add": { - "label": "Zum Wörterbuch hinzufügen" - }, - "label": "Wörterbuch" + "heading-with-name": { + "label": "Ihr Benutzer verfügt nicht über die erforderlichen RED- * -Rollen, um auf diese Anwendung zuzugreifen. Bitte kontaktieren Sie {{adminName}} für den Zugriff!" }, - "reason": { - "label": "Grund" - } - } - } - }, - "app-name": { - "label": "Redacto" - }, - "upload-status": { - "dialog": { - "title": { - "label": "Datei-Upload" - }, - "actions": { - "re-upload": { - "label": "Wiederholen Sie den Upload" + "heading-with-link": { + "label": "Ihr Benutzer verfügt nicht über die erforderlichen RED- * -Rollen, um auf diese Anwendung zuzugreifen. Bitte kontaktieren Sie Ihren Administrator für den Zugriff!" }, - "cancel": { - "label": "Upload abbrechen" - } - } - } - }, - "pdf-viewer": { - "text-popup": { - "actions": { - "suggestion-redaction": { - "label": "Redaktion vorschlagen" - } - } - } - }, - "common": { - "dialog": { - "close": { - "label": "Dialog schließen" - } - }, - "confirmation-dialog": { - "title": { - "label": "Aktion bestätigen" - }, - "description": { - "label": "Diese Aktion muss bestätigt werden. Möchten Sie fortfahren?" - }, - "confirm": { - "label": "Ja" - }, - "deny": { - "label": "Nein" - } - } - }, - "top-bar": { - "navigation-items": { - "projects": { - "label": "Projekte" - }, - "my-account": { - "label": "Mein Konto", - "children": { - "language": { - "label": "Sprache", - "english": { - "label": "Englisch" - }, - "german": { - "label": "Deutsche" - } - }, - "logout": { + "logout": { "label": "Ausloggen" - } } - } - } - }, - "filters": { - "filter-by": { - "label": "Filtern nach:" }, - "status": { - "label": "Status" - }, - "people": { - "label": "Menschen" - }, - "due-date": { - "label": "Geburtstermin" - }, - "created-on": { - "label": "Erstellt am" - }, - "project": { - "label": "Projekt" - }, - "document": { - "label": "Dokument" - } - }, - "project-listing": { - "table-header": { - "title": { - "label": "{{length}} aktive Projekte" - }, - "bulk-select": { - "label": "Massenauswahl" - }, - "recent": { - "label": "Kürzlich" - } - }, - "stats": { - "analyzed-pages": { - "label": "Analysierte Seiten" - }, - "total-people": { - "label": "Insgesamt Menschen" - }, - "charts": { - "projects": { - "label": "Projekte" + "manual-redaction": { + "remove-annotation": { + "success": { + "label": "Anmerkung Zum Entfernen empfohlen!" + }, + "failed": { + "label": "Fehler beim Anfordern der Entfernung von Anmerkungen!" + } }, - "total-documents": { - "label": "Dokumente insgesamt" + "dialog": { + "header": { + "label": "Manuelle Redaktion hinzufügen" + }, + "add-redaction": { + "success": { + "label": "Redaktionsvorschlag hinzugefügt!" + }, + "failed": { + "label": "Manuelle Redaktion konnte nicht hinzugefügt werden: {{message}}" + } + }, + "actions": { + "save": { + "label": "Manuelle Redaktion speichern" + } + }, + "content": { + "text": { + "label": "Ausgewählter Text: {{value}}" + }, + "dictionary": { + "add": { + "label": "Zum Wörterbuch hinzufügen" + }, + "label": "Wörterbuch" + }, + "reason": { + "label": "Grund" + } + } } - } }, - "add-edit-dialog": { - "header-new": { - "label": "Neues Projekt" - }, - "header-edit": { - "label": "Projekt bearbeiten" - }, - "form": { - "description": { - "label": "Beschreibung" + "app-name": { + "label": "Redacto" + }, + "upload-status": { + "dialog": { + "title": { + "label": "Datei-Upload" + }, + "actions": { + "re-upload": { + "label": "Wiederholen Sie den Upload" + }, + "cancel": { + "label": "Upload abbrechen" + } + } + } + }, + "pdf-viewer": { + "text-popup": { + "actions": { + "suggestion-redaction": { + "label": "Redaktion vorschlagen" + } + } + } + }, + "common": { + "dialog": { + "close": { + "label": "Dialog schließen" + } }, - "name": { - "label": "Name" + "confirmation-dialog": { + "title": { + "label": "Aktion bestätigen" + }, + "description": { + "label": "Diese Aktion muss bestätigt werden. Möchten Sie fortfahren?" + }, + "confirm": { + "label": "Ja" + }, + "deny": { + "label": "Nein" + } } - }, - "actions": { - "save": { - "label": "Projekt speichern" + }, + "top-bar": { + "navigation-items": { + "projects": { + "label": "Projekte" + }, + "my-account": { + "label": "Mein Konto", + "children": { + "language": { + "label": "Sprache", + "english": { + "label": "Englisch" + }, + "german": { + "label": "Deutsche" + } + }, + "logout": { + "label": "Ausloggen" + } + } + } } - } }, - "header": { - "label": "Projekte" - }, - "edit": { - "action": { - "label": "Projekt bearbeiten" - } - }, - "delete": { - "action": { - "label": "Projekt löschen" - }, - "delete-failed": { - "label": "Projekt konnte nicht gelöscht werden: {{projectName}}" - } - }, - "add-new": { - "label": "Neues Projekt" - }, - "no-projects": { - "label": "Sie haben derzeit keine Projekte. Sie können Ihre Arbeit beginnen, indem Sie eine neue erstellen!" - }, - "sorting": { - "recent": { - "label": "Kürzlich" - }, - "alphabetically": { - "label": "Alphabetisch" - } - } - }, - "file-details": { - "dialog": { - "title": { - "label": "Dateidetails" - }, - "actions": { - "download-redaction-report": { - "label": "Redaktionsbericht herunterladen" - } - } - } - }, - "project-details": { - "dialog": { - "title": { - "label": "Projekt Details" - }, - "info": { - "file-count": { - "label": "Anzahl der Dateien: {{fileCount}}" - } - }, - "actions": { - "download-redaction-report": { - "label": "Redaktionsbericht herunterladen" + "filters": { + "filter-by": { + "label": "Filtern nach:" }, - "reanalyse-project": { - "label": "Projekt erneut analysieren" - } - } - } - }, - "project-overview": { - "table-header": { - "title": { - "label": "{{length}} Dokumente" - }, - "bulk-select": { - "label": "Massenauswahl" - }, - "recent": { - "label": "Kürzlich" - } - }, - "table-col-names": { - "name": { - "label": "Name" - }, - "added-on": { - "label": "Hinzugefügt zu" - }, - "needs-work": { - "label": "Braucht Arbeit" - }, - "assigned-to": { - "label": "Zugewiesen an" - }, - "status": { - "label": "Status" - } - }, - "sorting": { - "recent": { - "label": "Kürzlich" - }, - "alphabetically": { - "label": "Alphabetisch" - }, - "number-of-pages": { - "label": "Seitenzahl" - }, - "number-of-analyses": { - "label": "Anzahl der Analysen" - } - }, - "upload-error": { - "label": "Datei konnte nicht hochgeladen werden: {{name}}" - }, - "delete-file-error": { - "label": "Fehler beim Löschen der Datei: {{filename}}" - }, - "reanalyse": { - "action": { - "label": "Datei erneut analysieren" - } - }, - "delete": { - "action": { - "label": "Datei löschen" - } - }, - "file-listing": { - "file-entry": { "status": { - "label": "Status: {{status}}" + "label": "Status" }, - "number-of-pages": { - "label": "Anzahl der Seiten: {{numberOfPages}}" + "people": { + "label": "Menschen" }, - "number-of-analyses": { - "label": "Anzahl der Analysen: {{numberOfAnalyses}}" + "due-date": { + "label": "Geburtstermin" }, - "added": { - "label": "Datum hinzugefügt: {{added}}" + "created-on": { + "label": "Erstellt am" }, - "last-updated": { - "label": "Letzte Aktualisierung: {{lastUpdated}}" + "project": { + "label": "Projekt" + }, + "document": { + "label": "Dokument" + } + }, + "project-listing": { + "table-header": { + "title": { + "label": "{{length}} aktive Projekte" + }, + "bulk-select": { + "label": "Massenauswahl" + }, + "recent": { + "label": "Kürzlich" + } + }, + "stats": { + "analyzed-pages": { + "label": "Analysierte Seiten" + }, + "total-people": { + "label": "Insgesamt Menschen" + }, + "charts": { + "projects": { + "label": "Projekte" + }, + "total-documents": { + "label": "Dokumente insgesamt" + } + } + }, + "add-edit-dialog": { + "header-new": { + "label": "Neues Projekt" + }, + "header-edit": { + "label": "Projekt bearbeiten" + }, + "form": { + "description": { + "label": "Beschreibung" + }, + "name": { + "label": "Name" + } + }, + "actions": { + "save": { + "label": "Projekt speichern" + } + } + }, + "header": { + "label": "Projekte" + }, + "edit": { + "action": { + "label": "Projekt bearbeiten" + } + }, + "delete": { + "action": { + "label": "Projekt löschen" + }, + "delete-failed": { + "label": "Projekt konnte nicht gelöscht werden: {{projectName}}" + } + }, + "add-new": { + "label": "Neues Projekt" + }, + "no-projects": { + "label": "Sie haben derzeit keine Projekte. Sie können Ihre Arbeit beginnen, indem Sie eine neue erstellen!" + }, + "sorting": { + "recent": { + "label": "Kürzlich" + }, + "alphabetically": { + "label": "Alphabetisch" + } + } + }, + "file-details": { + "dialog": { + "title": { + "label": "Dateidetails" + }, + "actions": { + "download-redaction-report": { + "label": "Redaktionsbericht herunterladen" + } + } } - } }, "project-details": { - "project-team": { - "label": "Projektteam" - }, - "charts": { - "total-documents": { - "label": "Dokumente insgesamt" + "dialog": { + "title": { + "label": "Projekt Details" + }, + "info": { + "file-count": { + "label": "Anzahl der Dateien: {{fileCount}}" + } + }, + "actions": { + "download-redaction-report": { + "label": "Redaktionsbericht herunterladen" + }, + "reanalyse-project": { + "label": "Projekt erneut analysieren" + } + } } - } }, - "header": { - "label": "Projektübersicht" - }, - "upload-document": { - "label": "Dokument hochladen" - }, - "no-project": { - "label": "Angefordertes Projekt: {{projectId}} existiert nicht! Zurück zur Projektliste." - } - }, - "file-preview": { - "view-toggle": { - "label": "Redigierte Ansicht" - }, - "filter-menu": { - "label": "Filter", - "all": { - "label": "Alle" - }, - "none": { - "label": "Keiner" - }, - "filter-types": { - "label": "Filtertypen" - }, - "hint": { - "label": "Hinweis Anmerkung", - "hint_only": { - "label": "Nur Hinweis" + "project-overview": { + "table-header": { + "title": { + "label": "{{length}} Dokumente" + }, + "bulk-select": { + "label": "Massenauswahl" + }, + "recent": { + "label": "Kürzlich" + } }, - "vertebrate": { - "label": "Wirbeltier" + "table-col-names": { + "name": { + "label": "Name" + }, + "added-on": { + "label": "Hinzugefügt zu" + }, + "needs-work": { + "label": "Braucht Arbeit" + }, + "assigned-to": { + "label": "Zugewiesen an" + }, + "status": { + "label": "Status" + } }, - "names": { - "label": "Namen" + "sorting": { + "recent": { + "label": "Kürzlich" + }, + "alphabetically": { + "label": "Alphabetisch" + }, + "number-of-pages": { + "label": "Seitenzahl" + }, + "number-of-analyses": { + "label": "Anzahl der Analysen" + } + }, + "upload-error": { + "label": "Datei konnte nicht hochgeladen werden: {{name}}" + }, + "delete-file-error": { + "label": "Fehler beim Löschen der Datei: {{filename}}" + }, + "reanalyse": { + "action": { + "label": "Datei erneut analysieren" + } + }, + "delete": { + "action": { + "label": "Datei löschen" + } + }, + "file-listing": { + "file-entry": { + "status": { + "label": "Status: {{status}}" + }, + "number-of-pages": { + "label": "Anzahl der Seiten: {{numberOfPages}}" + }, + "number-of-analyses": { + "label": "Anzahl der Analysen: {{numberOfAnalyses}}" + }, + "added": { + "label": "Datum hinzugefügt: {{added}}" + }, + "last-updated": { + "label": "Letzte Aktualisierung: {{lastUpdated}}" + } + } + }, + "project-details": { + "project-team": { + "label": "Projektteam" + }, + "charts": { + "total-documents": { + "label": "Dokumente insgesamt" + } + } + }, + "header": { + "label": "Projektübersicht" + }, + "upload-document": { + "label": "Dokument hochladen" + }, + "no-project": { + "label": "Angefordertes Projekt: {{projectId}} existiert nicht! Zurück zur Projektliste." } - }, - "redaction": { - "label": "Redaktion" - }, - "comment": { - "label": "Kommentar Annotation" - }, - "suggestion": { - "label": "Vorgeschlagene Redaktion" - }, - "ignore": { - "label": "Redaktion ignoriert" - } }, - "tabs": { - "quick-navigation": { - "label": "Schnelle Navigation" - }, - "annotations": { - "label": "Anmerkungen" - }, - "info": { - "label": "Die Info", - "assign-reviewer": { - "label": "Prüfer zuweisen" + "file-preview": { + "view-toggle": { + "label": "Redigierte Ansicht" }, - "added-on": { - "label": "Hinzugefügt zu" + "filter-menu": { + "label": "Filter", + "all": { + "label": "Alle" + }, + "none": { + "label": "Keiner" + }, + "filter-types": { + "label": "Filtertypen" + }, + "hint": { + "label": "Hinweis Anmerkung", + "hint_only": { + "label": "Nur Hinweis" + }, + "vertebrate": { + "label": "Wirbeltier" + }, + "names": { + "label": "Namen" + } + }, + "redaction": { + "label": "Redaktion" + }, + "comment": { + "label": "Kommentar Annotation" + }, + "suggestion": { + "label": "Vorgeschlagene Redaktion" + }, + "ignore": { + "label": "Redaktion ignoriert" + } }, - "added-by": { - "label": "Hinzugefügt von" + "tabs": { + "quick-navigation": { + "label": "Schnelle Navigation" + }, + "annotations": { + "label": "Anmerkungen" + }, + "info": { + "label": "Die Info", + "assign-reviewer": { + "label": "Prüfer zuweisen" + }, + "added-on": { + "label": "Hinzugefügt zu" + }, + "added-by": { + "label": "Hinzugefügt von" + }, + "last-modified-on": { + "label": "Zuletzt geändert am" + } + } }, - "last-modified-on": { - "label": "Zuletzt geändert am" + "download": { + "label": "Herunterladen", + "dropdown": { + "original": { + "label": "Original" + }, + "annotated": { + "label": "Kommentiert" + }, + "redacted": { + "label": "Redigiert" + } + } } - } }, - "download": { - "label": "Herunterladen", - "dropdown": { - "original": { - "label": "Original" - }, - "annotated": { - "label": "Kommentiert" - }, - "redacted": { - "label": "Redigiert" + "initials-avatar": { + "unassigned": { + "label": "Nicht zugewiesen" } - } - } - }, - "initials-avatar": { - "unassigned": { - "label": "Nicht zugewiesen" - } - }, - "unassigned": "Nicht zugewiesen", - "under-review": "Wird überprüft", - "under-approval": "In Genehmigung", - "efsa": "EFSA-Zulassung", - "finished": "Fertig", - "approved": "Genehmigt", - "submitted": "Eingereicht", - "active": "Aktiv", - "archived": "Archiviert", - "hint": "Hinweis", - "ignore": "Ignorieren", - "redaction": "Redaktion", - "comment": "Kommentar", - "suggestion": "Redaktionsvorschlag", - "dictionary": "Wörterbuch", - "content": "Inhalt", - "page": "Seite" + }, + "unassigned": "Nicht zugewiesen", + "under-review": "Wird überprüft", + "under-approval": "In Genehmigung", + "efsa": "EFSA-Zulassung", + "finished": "Fertig", + "approved": "Genehmigt", + "submitted": "Eingereicht", + "active": "Aktiv", + "archived": "Archiviert", + "hint": "Hinweis", + "ignore": "Ignorieren", + "redaction": "Redaktion", + "comment": "Kommentar", + "suggestion": "Redaktionsvorschlag", + "dictionary": "Wörterbuch", + "content": "Inhalt", + "page": "Seite" } diff --git a/apps/red-ui/src/assets/oauth/silent-refresh.html b/apps/red-ui/src/assets/oauth/silent-refresh.html index 9de338b30..d16b2ffea 100644 --- a/apps/red-ui/src/assets/oauth/silent-refresh.html +++ b/apps/red-ui/src/assets/oauth/silent-refresh.html @@ -1,7 +1,7 @@ - - - + + + diff --git a/apps/red-ui/src/assets/styles/red-button.scss b/apps/red-ui/src/assets/styles/red-button.scss index 0c98d8078..b3ac2504f 100644 --- a/apps/red-ui/src/assets/styles/red-button.scss +++ b/apps/red-ui/src/assets/styles/red-button.scss @@ -1,41 +1,45 @@ -@import "red-variables"; +@import 'red-variables'; -.mat-button, .mat-flat-button { - font-family: Inter, sans-serif !important; - border-radius: 17px !important; - font-size: 13px !important; - height: 34px; - display: flex !important; - align-items: center; - - &.mat-primary { - font-weight: 500 !important; - } - - &:not(.mat-primary) { - font-weight: 400 !important; - } - - .mat-button-wrapper { - display: flex; +.mat-button, +.mat-flat-button { + font-family: Inter, sans-serif !important; + border-radius: 17px !important; + font-size: 13px !important; + height: 34px; + display: flex !important; align-items: center; + + &.mat-primary { + font-weight: 500 !important; + } + + &:not(.mat-primary) { + font-weight: 400 !important; + } + + .mat-button-wrapper { + display: flex; + align-items: center; + gap: 6px; + } +} + +.mat-button[aria-expanded='true'], +.mat-button.overlay { + background: rgba($primary, 0.1); +} + +.mat-button, +.mat-flat-button, +.mat-icon-button { gap: 6px; - } + + mat-icon { + width: 14px; + } } -.mat-button[aria-expanded="true"], .mat-button.overlay { - background: rgba($primary, 0.1); -} - -.mat-button, .mat-flat-button, .mat-icon-button { - gap: 6px; - - mat-icon { - width: 14px; - } -} - -.arrow-button mat-icon { +.arrow-button mat-icon { width: 9px; margin-left: 3px; } diff --git a/apps/red-ui/src/assets/styles/red-checkbox.scss b/apps/red-ui/src/assets/styles/red-checkbox.scss index febf4d51a..5ab0c4c63 100644 --- a/apps/red-ui/src/assets/styles/red-checkbox.scss +++ b/apps/red-ui/src/assets/styles/red-checkbox.scss @@ -1,14 +1,15 @@ -@import "red-variables"; +@import 'red-variables'; .mat-checkbox .mat-checkbox-frame { - border: 1px solid $grey-5; + border: 1px solid $grey-5; } -.mat-checkbox-indeterminate.mat-accent .mat-checkbox-background, .mat-checkbox-checked.mat-accent .mat-checkbox-background { - margin-top: 1px; - margin-left: 1px; - width: 18px; - height: 18px; +.mat-checkbox-indeterminate.mat-accent .mat-checkbox-background, +.mat-checkbox-checked.mat-accent .mat-checkbox-background { + margin-top: 1px; + margin-left: 1px; + width: 18px; + height: 18px; } .mat-checkbox-layout { diff --git a/apps/red-ui/src/assets/styles/red-components.scss b/apps/red-ui/src/assets/styles/red-components.scss index bfec999e1..f5f8828ba 100644 --- a/apps/red-ui/src/assets/styles/red-components.scss +++ b/apps/red-ui/src/assets/styles/red-components.scss @@ -1,70 +1,71 @@ -@import "red-variables"; +@import 'red-variables'; -.oval, .square { - font-weight: 600; - display: flex; - justify-content: center; - align-items: center; - height: 24px; - width: 24px; - font-size: 10px; - line-height: 12px; - text-align: center; - text-transform: uppercase; - border: none; - - &.large { - height: 32px; - width: 32px; - font-size: 13px; - } - - &.lightgray-dark { - background-color: $grey-4; - } - - &.lightgray-red { - background-color: $grey-4; - color: $red-1; - } - - &.darkgray-white { - background-color: $grey-1; - color: $white; - } - - &.lightgray-white { - background-color: $grey-5; - color: $white; - } - - &.red-white { - background-color: $red-1; - color: $white; - } - - &.white-dark { - border: 1px solid #E2E4E9; - } -} - -.oval { - border-radius: 50%; -} - -.stats-subtitle { - display: flex; - - > div { +.oval, +.square { + font-weight: 600; display: flex; justify-content: center; align-items: center; - } + height: 24px; + width: 24px; + font-size: 10px; + line-height: 12px; + text-align: center; + text-transform: uppercase; + border: none; - gap: 12px; + &.large { + height: 32px; + width: 32px; + font-size: 13px; + } - mat-icon { - width: 10px; - margin-right: 4px; - } + &.lightgray-dark { + background-color: $grey-4; + } + + &.lightgray-red { + background-color: $grey-4; + color: $red-1; + } + + &.darkgray-white { + background-color: $grey-1; + color: $white; + } + + &.lightgray-white { + background-color: $grey-5; + color: $white; + } + + &.red-white { + background-color: $red-1; + color: $white; + } + + &.white-dark { + border: 1px solid #e2e4e9; + } +} + +.oval { + border-radius: 50%; +} + +.stats-subtitle { + display: flex; + + > div { + display: flex; + justify-content: center; + align-items: center; + } + + gap: 12px; + + mat-icon { + width: 10px; + margin-right: 4px; + } } diff --git a/apps/red-ui/src/assets/styles/red-controls.scss b/apps/red-ui/src/assets/styles/red-controls.scss index 04cd25f12..f8ac880d9 100644 --- a/apps/red-ui/src/assets/styles/red-controls.scss +++ b/apps/red-ui/src/assets/styles/red-controls.scss @@ -1,40 +1,38 @@ -@import "red-variables"; - +@import 'red-variables'; .btn-group { - display: flex; - flex-direction: row; + display: flex; + flex-direction: row; - .btn-group-btn { - cursor: pointer; - color: $accent; - background: $white; - font-family: Inter, sans-serif; - font-size: 13px; - line-height: 14px; - padding: 10px 14px; - transition: color 0.25s ease-in-out; - outline: none; - border: none; + .btn-group-btn { + cursor: pointer; + color: $accent; + background: $white; + font-family: Inter, sans-serif; + font-size: 13px; + line-height: 14px; + padding: 10px 14px; + transition: color 0.25s ease-in-out; + outline: none; + border: none; - &:hover { - color: $black; + &:hover { + color: $black; + } + + &.active { + color: $light; + background: $primary; + border-radius: 17px; + } + + &.active:hover { + color: $grey-3; + } } - - &.active { - color: $light; - background: $primary; - border-radius: 17px; - } - - &.active:hover { - color: $grey-3; - } - - } } .icon-10 { - width: 10px; - height: 10px; + width: 10px; + height: 10px; } diff --git a/apps/red-ui/src/assets/styles/red-dialog.scss b/apps/red-ui/src/assets/styles/red-dialog.scss index 51388cc44..d9609a2f8 100644 --- a/apps/red-ui/src/assets/styles/red-dialog.scss +++ b/apps/red-ui/src/assets/styles/red-dialog.scss @@ -3,33 +3,33 @@ } .dialog { - position: relative; - min-height: 80px; + position: relative; + min-height: 80px; - .dialog-close { - position: absolute; - top: -15px; - right: -10px; + .dialog-close { + position: absolute; + top: -15px; + right: -10px; - mat-icon { - width: 12px; + mat-icon { + width: 12px; + } } - } - .dialog-header { - padding-bottom: 12px; - } - - .dialog-content { - padding-top: 12px; - padding-bottom: 12px; - } - - .dialog-actions { - padding-top: 12px; - display: flex; - > * { - margin-right: 16px + .dialog-header { + padding-bottom: 12px; + } + + .dialog-content { + padding-top: 12px; + padding-bottom: 12px; + } + + .dialog-actions { + padding-top: 12px; + display: flex; + > * { + margin-right: 16px; + } } - } } diff --git a/apps/red-ui/src/assets/styles/red-list.scss b/apps/red-ui/src/assets/styles/red-list.scss index c476f677c..3c2d24243 100644 --- a/apps/red-ui/src/assets/styles/red-list.scss +++ b/apps/red-ui/src/assets/styles/red-list.scss @@ -1,13 +1,13 @@ -@import "red-variables"; +@import 'red-variables'; .mat-list-item { - font-family: Inter, sans-serif; - color: $grey-1 !important; - font-size: 13px !important; - line-height: 16px !important; + font-family: Inter, sans-serif; + color: $grey-1 !important; + font-size: 13px !important; + line-height: 16px !important; } .list-50vh { - overflow-y: scroll; - max-height: 50vh; + overflow-y: scroll; + max-height: 50vh; } diff --git a/apps/red-ui/src/assets/styles/red-logo.scss b/apps/red-ui/src/assets/styles/red-logo.scss index 9629df19d..f6f529c00 100644 --- a/apps/red-ui/src/assets/styles/red-logo.scss +++ b/apps/red-ui/src/assets/styles/red-logo.scss @@ -1,24 +1,24 @@ -@import "red-variables"; +@import 'red-variables'; .redacto-logo { - height: 14px; - width: 22px; - display: flex; - justify-content: space-between; - align-items: flex-start; - flex-direction: column; - - .line-1 { - height: 6px; - width: 16px; - border-radius: 3px; - background-color: $primary; - } - - .line-2 { - height: 6px; + height: 14px; width: 22px; - border-radius: 6px; - background-color: $primary; - } + display: flex; + justify-content: space-between; + align-items: flex-start; + flex-direction: column; + + .line-1 { + height: 6px; + width: 16px; + border-radius: 3px; + background-color: $primary; + } + + .line-2 { + height: 6px; + width: 22px; + border-radius: 6px; + background-color: $primary; + } } diff --git a/apps/red-ui/src/assets/styles/red-material-theme.scss b/apps/red-ui/src/assets/styles/red-material-theme.scss index 73613e0de..fbee50daa 100644 --- a/apps/red-ui/src/assets/styles/red-material-theme.scss +++ b/apps/red-ui/src/assets/styles/red-material-theme.scss @@ -4,56 +4,57 @@ @include mat-core(); $primary-palette: ( - default: $red-1, - lighter: lighten($red-1, 30%), - darker: darken($red-1, 30%), - text: $red-1, - contrast: ( - default: $light, - lighter: $light, - darker: $light - ) + default: $red-1, + lighter: lighten($red-1, 30%), + darker: darken($red-1, 30%), + text: $red-1, + contrast: ( + default: $light, + lighter: $light, + darker: $light + ) ); $secondary-palette: ( - default: $grey-1, - lighter: lighten($grey-1, 30%), - darker: darken($grey-1, 30%), - text: $grey-1, - contrast: ( - default: $light, - lighter: $light, - darker: $light - ) + default: $grey-1, + lighter: lighten($grey-1, 30%), + darker: darken($grey-1, 30%), + text: $grey-1, + contrast: ( + default: $light, + lighter: $light, + darker: $light + ) ); $red-palette: ( - default: $red-1, - lighter: lighten($red-1, 30%), - darker: darken($red-1, 30%), - text: $red-1, - contrast: ( - default: $light, - lighter: $light, - darker: $light - ) + default: $red-1, + lighter: lighten($red-1, 30%), + darker: darken($red-1, 30%), + text: $red-1, + contrast: ( + default: $light, + lighter: $light, + darker: $light + ) ); $gn-next-primary: mat-palette($primary-palette, default, lighter, darker, text); $gn-next-secondary: mat-palette($secondary-palette, default, lighter, darker, text); $gn-next-warning: mat-palette($red-palette, default, lighter, darker, text); -$gn-next-mat-theme: mat-light-theme(( - color: ( - primary: $gn-next-primary, - accent: $gn-next-secondary, - warn: $gn-next-warning, - ) -)); +$gn-next-mat-theme: mat-light-theme( + ( + color: ( + primary: $gn-next-primary, + accent: $gn-next-secondary, + warn: $gn-next-warning + ) + ) +); @include angular-material-theme($gn-next-mat-theme); - .mat-flat-button { - min-width: unset !important; + min-width: unset !important; } diff --git a/apps/red-ui/src/assets/styles/red-media-queries.scss b/apps/red-ui/src/assets/styles/red-media-queries.scss index 630b77420..9f351ec92 100644 --- a/apps/red-ui/src/assets/styles/red-media-queries.scss +++ b/apps/red-ui/src/assets/styles/red-media-queries.scss @@ -1,17 +1,15 @@ @media only screen and (max-width: 800px) { - .visible-lg { - display: none !important; - } + .visible-lg { + display: none !important; + } } .visible-lt-lg { - display: none !important; + display: none !important; } @media only screen and (max-width: 800px) { - .visible-lt-lg { - display: flex !important; - } + .visible-lt-lg { + display: flex !important; + } } - - diff --git a/apps/red-ui/src/assets/styles/red-mixins.scss b/apps/red-ui/src/assets/styles/red-mixins.scss index fb3975951..4e6d5bc70 100644 --- a/apps/red-ui/src/assets/styles/red-mixins.scss +++ b/apps/red-ui/src/assets/styles/red-mixins.scss @@ -1,12 +1,12 @@ @import 'red-variables'; @mixin line-clamp($lines) { - display: -webkit-box; - -webkit-line-clamp: $lines; - -webkit-box-orient: vertical; - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; + display: -webkit-box; + -webkit-line-clamp: $lines; + -webkit-box-orient: vertical; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; } @mixin no-scroll-bar { diff --git a/apps/red-ui/src/assets/styles/red-select.scss b/apps/red-ui/src/assets/styles/red-select.scss index 5a97fd6e4..dcf32acbf 100644 --- a/apps/red-ui/src/assets/styles/red-select.scss +++ b/apps/red-ui/src/assets/styles/red-select.scss @@ -1,52 +1,52 @@ -@import "red-variables"; +@import 'red-variables'; .red-select { - .mat-select-value-text { - font-family: Inter, sans-serif; - color: $grey-1; - font-size: 13px; - line-height: 14px; - } - - .mat-form-field-wrapper { - padding-bottom: 0; - } - - .mat-form-field-infix { - padding: 0; - border: none; - width: fit-content; - } - - .mat-select-value { - max-width: none; - } - - .mat-select-arrow-wrapper { - padding-left: 5px; - - .mat-select-arrow { - color: $grey-1 !important; + .mat-select-value-text { + font-family: Inter, sans-serif; + color: $grey-1; + font-size: 13px; + line-height: 14px; + } + + .mat-form-field-wrapper { + padding-bottom: 0; + } + + .mat-form-field-infix { + padding: 0; + border: none; + width: fit-content; + } + + .mat-select-value { + max-width: none; + } + + .mat-select-arrow-wrapper { + padding-left: 5px; + + .mat-select-arrow { + color: $grey-1 !important; + } } - } } .red-select-panel { - border-radius: 0 !important; + border-radius: 0 !important; - .mat-option { - background: $white !important; - font-family: Inter, sans-serif; - color: $grey-1; - font-size: 13px; - line-height: 14px; + .mat-option { + background: $white !important; + font-family: Inter, sans-serif; + color: $grey-1; + font-size: 13px; + line-height: 14px; - &.mat-selected.mat-active { - color: $primary; + &.mat-selected.mat-active { + color: $primary; + } + + &:hover { + background: $grey-2 !important; + } } - - &:hover { - background: $grey-2 !important; - } - } } diff --git a/apps/red-ui/src/assets/styles/red-text-styles.scss b/apps/red-ui/src/assets/styles/red-text-styles.scss index bfe14535c..b34c0b7af 100644 --- a/apps/red-ui/src/assets/styles/red-text-styles.scss +++ b/apps/red-ui/src/assets/styles/red-text-styles.scss @@ -1,71 +1,71 @@ -@import "red-variables"; -@import "red-mixins"; +@import 'red-variables'; +@import 'red-mixins'; a { - color: $primary; + color: $primary; - &:hover { - color: lighten($primary, 10%) - } + &:hover { + color: lighten($primary, 10%); + } - cursor: pointer; + cursor: pointer; } .heading-xl { - font-size: 24px; - font-weight: 600; - line-height: 29px; + font-size: 24px; + font-weight: 600; + line-height: 29px; } .heading-l { - font-size: 18px; - font-weight: 600; - line-height: 22px; + font-size: 18px; + font-weight: 600; + line-height: 22px; } .heading { - font-size: 16px; - line-height: 20px; - font-weight: 600; + font-size: 16px; + line-height: 20px; + font-weight: 600; } .page-title { - font-size: 13px; - font-weight: 600; - line-height: 18px; - text-align: center; + font-size: 13px; + font-weight: 600; + line-height: 18px; + text-align: center; } .all-caps-label { - text-transform: uppercase; - opacity: 0.7; - font-size: 11px; - font-weight: 600; - letter-spacing: 0; - line-height: 14px; + text-transform: uppercase; + opacity: 0.7; + font-size: 11px; + font-weight: 600; + letter-spacing: 0; + line-height: 14px; } .small-label { - opacity: 0.7; - font-size: 11px; - line-height: 14px; + opacity: 0.7; + font-size: 11px; + line-height: 14px; } .medium-label { - font-size: 11px; - font-weight: 500; - line-height: 14px; + font-size: 11px; + font-weight: 500; + line-height: 14px; } .clamp-1 { - @include line-clamp(1); + @include line-clamp(1); } .clamp-2 { - @include line-clamp(2); + @include line-clamp(2); } .primary { - color: $primary; - opacity: 1; + color: $primary; + opacity: 1; } diff --git a/apps/red-ui/src/assets/styles/red-theme.scss b/apps/red-ui/src/assets/styles/red-theme.scss index 0ec469e00..871714bed 100644 --- a/apps/red-ui/src/assets/styles/red-theme.scss +++ b/apps/red-ui/src/assets/styles/red-theme.scss @@ -1,19 +1,19 @@ @import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap'); @import url('https://fonts.googleapis.com/css2?family=Inconsolata:wght@300;400;500;600;700&display=swap'); @import '~ngx-toastr/toastr'; -@import "red-material-theme"; -@import "red-page-layout"; -@import "red-text-styles"; -@import "red-dialog"; -@import "red-input"; -@import "red-button"; -@import "red-select"; -@import "red-list"; -@import "red-checkbox"; -@import "red-toggle"; -@import "red-menu"; -@import "red-media-queries"; -@import "red-tables"; -@import "red-components"; -@import "red-controls"; -@import "red-logo"; +@import 'red-material-theme'; +@import 'red-page-layout'; +@import 'red-text-styles'; +@import 'red-dialog'; +@import 'red-input'; +@import 'red-button'; +@import 'red-select'; +@import 'red-list'; +@import 'red-checkbox'; +@import 'red-toggle'; +@import 'red-menu'; +@import 'red-media-queries'; +@import 'red-tables'; +@import 'red-components'; +@import 'red-controls'; +@import 'red-logo'; diff --git a/apps/red-ui/src/assets/styles/red-toggle.scss b/apps/red-ui/src/assets/styles/red-toggle.scss index 0d2150395..812e1d7df 100644 --- a/apps/red-ui/src/assets/styles/red-toggle.scss +++ b/apps/red-ui/src/assets/styles/red-toggle.scss @@ -1,19 +1,19 @@ mat-slide-toggle { - .mat-slide-toggle-bar { - height: 16px !important; - width: 30px !important; - border-radius: 16px !important; - } + .mat-slide-toggle-bar { + height: 16px !important; + width: 30px !important; + border-radius: 16px !important; + } - .mat-slide-toggle-thumb-container { - top: 2px !important; - left: 2px !important; - height: 12px !important; - width: 12px !important; - } + .mat-slide-toggle-thumb-container { + top: 2px !important; + left: 2px !important; + height: 12px !important; + width: 12px !important; + } - .mat-slide-toggle-thumb { - height: 12px !important; - width: 12px !important; - } + .mat-slide-toggle-thumb { + height: 12px !important; + width: 12px !important; + } } diff --git a/apps/red-ui/src/assets/styles/red-variables.scss b/apps/red-ui/src/assets/styles/red-variables.scss index c2aedf111..eaddde42f 100644 --- a/apps/red-ui/src/assets/styles/red-variables.scss +++ b/apps/red-ui/src/assets/styles/red-variables.scss @@ -1,31 +1,33 @@ -$white: #FFF; +$white: #fff; $black: #000; $grey-1: #283241; -$grey-2: #F4F5F7; -$grey-3: #AAACB3; -$grey-4: #E2E4E9; -$grey-5: #D3D5DA; -$grey-6: #F0F1F4; +$grey-2: #f4f5f7; +$grey-3: #aaacb3; +$grey-4: #e2e4e9; +$grey-5: #d3d5da; +$grey-6: #f0f1f4; -$blue-1: #4875F7; -$blue-2: #48C9F7; -$blue-3: #5B97DB; -$blue-4: #374C81; -$red-1: #DD4D50; -$yellow-1: #FFB83B; -$yellow-2: #FFFF02; -$green-1: #00FF00; -$green-2: #5CE594; -$orange-1: #FF801A; +$blue-1: #4875f7; +$blue-2: #48c9f7; +$blue-3: #5b97db; +$blue-4: #374c81; +$red-1: #dd4d50; +$yellow-1: #ffb83b; +$yellow-2: #ffff02; +$green-1: #00ff00; +$green-2: #5ce594; +$orange-1: #ff801a; $primary: $red-1; $accent: $grey-1; $light: $white; $dark: $black; -$separator: rgba(226,228,233,0.9); +$separator: rgba(226, 228, 233, 0.9); $right-container-inside-width: 340px; $right-container-padding: 16px; -$right-container-width: calc(#{$right-container-inside-width} + 2*#{$right-container-padding} + 1px); +$right-container-width: calc( + #{$right-container-inside-width} + 2 *#{$right-container-padding} + 1px +); diff --git a/apps/red-ui/src/environments/environment.prod.ts b/apps/red-ui/src/environments/environment.prod.ts index c9669790b..5d0833162 100644 --- a/apps/red-ui/src/environments/environment.prod.ts +++ b/apps/red-ui/src/environments/environment.prod.ts @@ -1,3 +1,3 @@ export const environment = { - production: true, + production: true }; diff --git a/apps/red-ui/src/environments/environment.ts b/apps/red-ui/src/environments/environment.ts index 99c3763ca..6b323087c 100644 --- a/apps/red-ui/src/environments/environment.ts +++ b/apps/red-ui/src/environments/environment.ts @@ -3,7 +3,7 @@ // The list of file replacements can be found in `angular.json`. export const environment = { - production: false, + production: false }; /* diff --git a/apps/red-ui/src/index.html b/apps/red-ui/src/index.html index e21c9e6a7..1c594d43b 100644 --- a/apps/red-ui/src/index.html +++ b/apps/red-ui/src/index.html @@ -1,16 +1,16 @@ - - - Redacto - - - - - - - - - - + + + Redacto + + + + + + + + + + diff --git a/apps/red-ui/src/main.ts b/apps/red-ui/src/main.ts index c8a4ca736..207c6dde9 100644 --- a/apps/red-ui/src/main.ts +++ b/apps/red-ui/src/main.ts @@ -1,13 +1,13 @@ -import {enableProdMode} from '@angular/core'; -import {platformBrowserDynamic} from '@angular/platform-browser-dynamic'; +import { enableProdMode } from '@angular/core'; +import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; -import {AppModule} from './app/app.module'; -import {environment} from './environments/environment'; +import { AppModule } from './app/app.module'; +import { environment } from './environments/environment'; if (environment.production) { - enableProdMode(); + enableProdMode(); } platformBrowserDynamic() - .bootstrapModule(AppModule) - .catch((err) => console.error(err)); + .bootstrapModule(AppModule) + .catch((err) => console.error(err)); diff --git a/apps/red-ui/src/manifest.webmanifest b/apps/red-ui/src/manifest.webmanifest index 2eda3f437..0d635c12f 100644 --- a/apps/red-ui/src/manifest.webmanifest +++ b/apps/red-ui/src/manifest.webmanifest @@ -1,59 +1,59 @@ { - "name": "red-ui", - "short_name": "red-ui", - "theme_color": "#1976d2", - "background_color": "#fafafa", - "display": "standalone", - "scope": "./", - "start_url": "./", - "icons": [ - { - "src": "assets/icons/icon-72x72.png", - "sizes": "72x72", - "type": "image/png", - "purpose": "maskable any" - }, - { - "src": "assets/icons/icon-96x96.png", - "sizes": "96x96", - "type": "image/png", - "purpose": "maskable any" - }, - { - "src": "assets/icons/icon-128x128.png", - "sizes": "128x128", - "type": "image/png", - "purpose": "maskable any" - }, - { - "src": "assets/icons/icon-144x144.png", - "sizes": "144x144", - "type": "image/png", - "purpose": "maskable any" - }, - { - "src": "assets/icons/icon-152x152.png", - "sizes": "152x152", - "type": "image/png", - "purpose": "maskable any" - }, - { - "src": "assets/icons/icon-192x192.png", - "sizes": "192x192", - "type": "image/png", - "purpose": "maskable any" - }, - { - "src": "assets/icons/icon-384x384.png", - "sizes": "384x384", - "type": "image/png", - "purpose": "maskable any" - }, - { - "src": "assets/icons/icon-512x512.png", - "sizes": "512x512", - "type": "image/png", - "purpose": "maskable any" - } - ] + "name": "red-ui", + "short_name": "red-ui", + "theme_color": "#1976d2", + "background_color": "#fafafa", + "display": "standalone", + "scope": "./", + "start_url": "./", + "icons": [ + { + "src": "assets/icons/icon-72x72.png", + "sizes": "72x72", + "type": "image/png", + "purpose": "maskable any" + }, + { + "src": "assets/icons/icon-96x96.png", + "sizes": "96x96", + "type": "image/png", + "purpose": "maskable any" + }, + { + "src": "assets/icons/icon-128x128.png", + "sizes": "128x128", + "type": "image/png", + "purpose": "maskable any" + }, + { + "src": "assets/icons/icon-144x144.png", + "sizes": "144x144", + "type": "image/png", + "purpose": "maskable any" + }, + { + "src": "assets/icons/icon-152x152.png", + "sizes": "152x152", + "type": "image/png", + "purpose": "maskable any" + }, + { + "src": "assets/icons/icon-192x192.png", + "sizes": "192x192", + "type": "image/png", + "purpose": "maskable any" + }, + { + "src": "assets/icons/icon-384x384.png", + "sizes": "384x384", + "type": "image/png", + "purpose": "maskable any" + }, + { + "src": "assets/icons/icon-512x512.png", + "sizes": "512x512", + "type": "image/png", + "purpose": "maskable any" + } + ] } diff --git a/apps/red-ui/src/styles.scss b/apps/red-ui/src/styles.scss index 0ee6c12d6..f2cec9162 100644 --- a/apps/red-ui/src/styles.scss +++ b/apps/red-ui/src/styles.scss @@ -1,2 +1,2 @@ /* You can add global styles to this file, and also import other style files */ -@import "./assets/styles/red-theme"; +@import './assets/styles/red-theme'; diff --git a/apps/red-ui/tsconfig.app.json b/apps/red-ui/tsconfig.app.json index e9fa6dfd9..8289972bc 100644 --- a/apps/red-ui/tsconfig.app.json +++ b/apps/red-ui/tsconfig.app.json @@ -1,8 +1,8 @@ { - "extends": "./tsconfig.json", - "compilerOptions": { - "outDir": "../../dist/out-tsc", - "types": [] - }, - "files": ["src/main.ts", "src/polyfills.ts"] + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../dist/out-tsc", + "types": [] + }, + "files": ["src/main.ts", "src/polyfills.ts"] } diff --git a/apps/red-ui/tsconfig.json b/apps/red-ui/tsconfig.json index 63dbe35fb..e23d75a22 100644 --- a/apps/red-ui/tsconfig.json +++ b/apps/red-ui/tsconfig.json @@ -1,13 +1,13 @@ { - "extends": "../../tsconfig.base.json", - "files": [], - "include": [], - "references": [ - { - "path": "./tsconfig.app.json" - }, - { - "path": "./tsconfig.spec.json" - } - ] + "extends": "../../tsconfig.base.json", + "files": [], + "include": [], + "references": [ + { + "path": "./tsconfig.app.json" + }, + { + "path": "./tsconfig.spec.json" + } + ] } diff --git a/apps/red-ui/tsconfig.spec.json b/apps/red-ui/tsconfig.spec.json index cfff29a54..26a878ced 100644 --- a/apps/red-ui/tsconfig.spec.json +++ b/apps/red-ui/tsconfig.spec.json @@ -1,10 +1,10 @@ { - "extends": "./tsconfig.json", - "compilerOptions": { - "outDir": "../../dist/out-tsc", - "module": "commonjs", - "types": ["jest", "node"] - }, - "files": ["src/test-setup.ts"], - "include": ["**/*.spec.ts", "**/*.d.ts"] + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../dist/out-tsc", + "module": "commonjs", + "types": ["jest", "node"] + }, + "files": ["src/test-setup.ts"], + "include": ["**/*.spec.ts", "**/*.d.ts"] } diff --git a/apps/red-ui/tslint.json b/apps/red-ui/tslint.json index 3a82e7773..1ccb8df99 100644 --- a/apps/red-ui/tslint.json +++ b/apps/red-ui/tslint.json @@ -1,10 +1,10 @@ { - "extends": "../../tslint.json", - "rules": { - "directive-selector": [true, "attribute", "redaction", "camelCase"], - "component-selector": [true, "element", "redaction", "kebab-case"] - }, - "linterOptions": { - "exclude": ["!**/*"] - } + "extends": "../../tslint.json", + "rules": { + "directive-selector": [true, "attribute", "redaction", "camelCase"], + "component-selector": [true, "element", "redaction", "kebab-case"] + }, + "linterOptions": { + "exclude": ["!**/*"] + } } diff --git a/jest.config.js b/jest.config.js index 9090b4914..7924876d4 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,9 +1,9 @@ module.exports = { - testMatch: ['**/+(*.)+(spec|test).+(ts|js)?(x)'], - transform: { - '^.+\\.(ts|js|html)$': 'ts-jest', - }, - resolver: '@nrwl/jest/plugins/resolver', - moduleFileExtensions: ['ts', 'js', 'html'], - coverageReporters: ['html'], + testMatch: ['**/+(*.)+(spec|test).+(ts|js)?(x)'], + transform: { + '^.+\\.(ts|js|html)$': 'ts-jest' + }, + resolver: '@nrwl/jest/plugins/resolver', + moduleFileExtensions: ['ts', 'js', 'html'], + coverageReporters: ['html'] }; diff --git a/libs/red-ui-http/ng-package.json b/libs/red-ui-http/ng-package.json index f29047cf7..e5fbba5fa 100644 --- a/libs/red-ui-http/ng-package.json +++ b/libs/red-ui-http/ng-package.json @@ -1,7 +1,7 @@ { - "$schema": "../../node_modules/ng-packagr/ng-package.schema.json", - "dest": "../../dist/libs/red-ui-http", - "lib": { - "entryFile": "src/index.ts" - } + "$schema": "../../node_modules/ng-packagr/ng-package.schema.json", + "dest": "../../dist/libs/red-ui-http", + "lib": { + "entryFile": "src/index.ts" + } } diff --git a/libs/red-ui-http/package.json b/libs/red-ui-http/package.json index fe8f1348b..3f157248b 100644 --- a/libs/red-ui-http/package.json +++ b/libs/red-ui-http/package.json @@ -1,8 +1,8 @@ { - "name": "@redaction/red-ui-http", - "version": "1.1", - "peerDependencies": { - "@angular/common": "^7.2.0", - "@angular/core": "^7.2.0" - } + "name": "@redaction/red-ui-http", + "version": "1.1", + "peerDependencies": { + "@angular/common": "^7.2.0", + "@angular/core": "^7.2.0" + } } diff --git a/libs/red-ui-http/src/lib/api.module.ts b/libs/red-ui-http/src/lib/api.module.ts index 74e6d392d..915cdeaf3 100644 --- a/libs/red-ui-http/src/lib/api.module.ts +++ b/libs/red-ui-http/src/lib/api.module.ts @@ -1,55 +1,58 @@ -import {ModuleWithProviders, NgModule, Optional, SkipSelf} from '@angular/core'; -import {Configuration} from './configuration'; -import {HttpClient} from '@angular/common/http'; +import { ModuleWithProviders, NgModule, Optional, SkipSelf } from '@angular/core'; +import { Configuration } from './configuration'; +import { HttpClient } from '@angular/common/http'; - -import {DebugControllerService} from './api/debugController.service'; -import {DictionaryControllerService} from './api/dictionaryController.service'; -import {FileUploadControllerService} from './api/fileUploadController.service'; -import {LicenseReportControllerService} from './api/licenseReportController.service'; -import {ManualRedactionControllerService} from './api/manualRedactionController.service'; -import {PdfMetaDataConfigurationControllerService} from './api/pdfMetaDataConfigurationController.service'; -import {ProjectControllerService} from './api/projectController.service'; -import {ReanalysisControllerService} from './api/reanalysisController.service'; -import {RedactionLogControllerService} from './api/redactionLogController.service'; -import {RulesControllerService} from './api/rulesController.service'; -import {StatusControllerService} from './api/statusController.service'; -import {UserControllerService} from "./api/userController.service"; +import { DebugControllerService } from './api/debugController.service'; +import { DictionaryControllerService } from './api/dictionaryController.service'; +import { FileUploadControllerService } from './api/fileUploadController.service'; +import { LicenseReportControllerService } from './api/licenseReportController.service'; +import { ManualRedactionControllerService } from './api/manualRedactionController.service'; +import { PdfMetaDataConfigurationControllerService } from './api/pdfMetaDataConfigurationController.service'; +import { ProjectControllerService } from './api/projectController.service'; +import { ReanalysisControllerService } from './api/reanalysisController.service'; +import { RedactionLogControllerService } from './api/redactionLogController.service'; +import { RulesControllerService } from './api/rulesController.service'; +import { StatusControllerService } from './api/statusController.service'; +import { UserControllerService } from './api/userController.service'; @NgModule({ - imports: [], - declarations: [], - exports: [], - providers: [ - DebugControllerService, - DictionaryControllerService, - FileUploadControllerService, - LicenseReportControllerService, - ManualRedactionControllerService, - PdfMetaDataConfigurationControllerService, - ProjectControllerService, - ReanalysisControllerService, - RedactionLogControllerService, - RulesControllerService, - UserControllerService, - StatusControllerService] + imports: [], + declarations: [], + exports: [], + providers: [ + DebugControllerService, + DictionaryControllerService, + FileUploadControllerService, + LicenseReportControllerService, + ManualRedactionControllerService, + PdfMetaDataConfigurationControllerService, + ProjectControllerService, + ReanalysisControllerService, + RedactionLogControllerService, + RulesControllerService, + UserControllerService, + StatusControllerService + ] }) export class ApiModule { - constructor(@Optional() @SkipSelf() parentModule: ApiModule, - @Optional() http: HttpClient) { - if (parentModule) { - throw new Error('ApiModule is already loaded. Import in your base AppModule only.'); + constructor(@Optional() @SkipSelf() parentModule: ApiModule, @Optional() http: HttpClient) { + if (parentModule) { + throw new Error('ApiModule is already loaded. Import in your base AppModule only.'); + } + if (!http) { + throw new Error( + 'You need to import the HttpClientModule in your AppModule! \n' + + 'See also https://github.com/angular/angular/issues/20575' + ); + } } - if (!http) { - throw new Error('You need to import the HttpClientModule in your AppModule! \n' + - 'See also https://github.com/angular/angular/issues/20575'); - } - } - public static forRoot(configurationFactory: () => Configuration): ModuleWithProviders { - return { - ngModule: ApiModule, - providers: [{provide: Configuration, useFactory: configurationFactory}] - }; - } + public static forRoot( + configurationFactory: () => Configuration + ): ModuleWithProviders { + return { + ngModule: ApiModule, + providers: [{ provide: Configuration, useFactory: configurationFactory }] + }; + } } diff --git a/libs/red-ui-http/src/lib/api/api.ts b/libs/red-ui-http/src/lib/api/api.ts index af15cd256..f5658b654 100644 --- a/libs/red-ui-http/src/lib/api/api.ts +++ b/libs/red-ui-http/src/lib/api/api.ts @@ -1,16 +1,16 @@ export * from './debugController.service'; -import {DebugControllerService} from './debugController.service'; -import {DictionaryControllerService} from './dictionaryController.service'; -import {FileUploadControllerService} from './fileUploadController.service'; -import {LicenseReportControllerService} from './licenseReportController.service'; -import {ManualRedactionControllerService} from './manualRedactionController.service'; -import {PdfMetaDataConfigurationControllerService} from './pdfMetaDataConfigurationController.service'; -import {ProjectControllerService} from './projectController.service'; -import {ReanalysisControllerService} from './reanalysisController.service'; -import {RedactionLogControllerService} from './redactionLogController.service'; -import {RulesControllerService} from './rulesController.service'; -import {StatusControllerService} from './statusController.service'; -import {UserControllerService} from './userController.service'; +import { DebugControllerService } from './debugController.service'; +import { DictionaryControllerService } from './dictionaryController.service'; +import { FileUploadControllerService } from './fileUploadController.service'; +import { LicenseReportControllerService } from './licenseReportController.service'; +import { ManualRedactionControllerService } from './manualRedactionController.service'; +import { PdfMetaDataConfigurationControllerService } from './pdfMetaDataConfigurationController.service'; +import { ProjectControllerService } from './projectController.service'; +import { ReanalysisControllerService } from './reanalysisController.service'; +import { RedactionLogControllerService } from './redactionLogController.service'; +import { RulesControllerService } from './rulesController.service'; +import { StatusControllerService } from './statusController.service'; +import { UserControllerService } from './userController.service'; export * from './dictionaryController.service'; @@ -34,4 +34,17 @@ export * from './statusController.service'; export * from './userController.service'; -export const APIS = [DebugControllerService, DictionaryControllerService, FileUploadControllerService, LicenseReportControllerService, ManualRedactionControllerService, PdfMetaDataConfigurationControllerService, ProjectControllerService, ReanalysisControllerService, RedactionLogControllerService, RulesControllerService, StatusControllerService, UserControllerService]; +export const APIS = [ + DebugControllerService, + DictionaryControllerService, + FileUploadControllerService, + LicenseReportControllerService, + ManualRedactionControllerService, + PdfMetaDataConfigurationControllerService, + ProjectControllerService, + ReanalysisControllerService, + RedactionLogControllerService, + RulesControllerService, + StatusControllerService, + UserControllerService +]; diff --git a/libs/red-ui-http/src/lib/api/debugController.service.ts b/libs/red-ui-http/src/lib/api/debugController.service.ts index 01d990d1f..e7d363cea 100644 --- a/libs/red-ui-http/src/lib/api/debugController.service.ts +++ b/libs/red-ui-http/src/lib/api/debugController.service.ts @@ -8,372 +8,444 @@ * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. - *//* tslint:disable:no-unused-variable member-ordering */ + */ /* tslint:disable:no-unused-variable member-ordering */ -import {Inject, Injectable, Optional} from '@angular/core'; -import {HttpClient, HttpEvent, HttpHeaders, HttpParams, HttpResponse} from '@angular/common/http'; -import {CustomHttpUrlEncodingCodec} from '../encoder'; +import { Inject, Injectable, Optional } from '@angular/core'; +import { HttpClient, HttpEvent, HttpHeaders, HttpParams, HttpResponse } from '@angular/common/http'; +import { CustomHttpUrlEncodingCodec } from '../encoder'; -import {Observable} from 'rxjs'; - - -import {BASE_PATH} from '../variables'; -import {Configuration} from '../configuration'; +import { Observable } from 'rxjs'; +import { BASE_PATH } from '../variables'; +import { Configuration } from '../configuration'; @Injectable() export class DebugControllerService { + public defaultHeaders = new HttpHeaders(); + public configuration = new Configuration(); + protected basePath = ''; - public defaultHeaders = new HttpHeaders(); - public configuration = new Configuration(); - protected basePath = ''; - - constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { - if (basePath) { - this.basePath = basePath; - } - if (configuration) { - this.configuration = configuration; - this.basePath = basePath || configuration.basePath || this.basePath; - } - } - - /** - * Receives an uploaded file and returns it with its classified elements visualized for debugging. - * None - * @param file - * @param inline inline - * @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 debugClassificationsForm(file: Blob, inline?: boolean, observe?: 'body', reportProgress?: boolean): Observable; - - public debugClassificationsForm(file: Blob, inline?: boolean, observe?: 'response', reportProgress?: boolean): Observable>; - - public debugClassificationsForm(file: Blob, inline?: boolean, observe?: 'events', reportProgress?: boolean): Observable>; - - public debugClassificationsForm(file: Blob, inline?: boolean, observe: any = 'body', reportProgress: boolean = false): Observable { - - if (file === null || file === undefined) { - throw new Error('Required parameter file was null or undefined when calling debugClassifications.'); + constructor( + protected httpClient: HttpClient, + @Optional() @Inject(BASE_PATH) basePath: string, + @Optional() configuration: Configuration + ) { + if (basePath) { + this.basePath = basePath; + } + if (configuration) { + this.configuration = configuration; + this.basePath = basePath || configuration.basePath || this.basePath; + } } + /** + * Receives an uploaded file and returns it with its classified elements visualized for debugging. + * None + * @param file + * @param inline inline + * @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 debugClassificationsForm( + file: Blob, + inline?: boolean, + observe?: 'body', + reportProgress?: boolean + ): Observable; - let queryParameters = new HttpParams({encoder: new CustomHttpUrlEncodingCodec()}); - if (inline !== undefined && inline !== null) { - queryParameters = queryParameters.set('inline', inline); + public debugClassificationsForm( + file: Blob, + inline?: boolean, + observe?: 'response', + reportProgress?: boolean + ): Observable>; + + public debugClassificationsForm( + file: Blob, + inline?: boolean, + observe?: 'events', + reportProgress?: boolean + ): Observable>; + + public debugClassificationsForm( + file: Blob, + inline?: boolean, + observe: any = 'body', + reportProgress: boolean = false + ): Observable { + if (file === null || file === undefined) { + throw new Error( + 'Required parameter file was null or undefined when calling debugClassifications.' + ); + } + + let queryParameters = new HttpParams({ encoder: new CustomHttpUrlEncodingCodec() }); + if (inline !== undefined && inline !== null) { + queryParameters = queryParameters.set('inline', inline); + } + + let headers = this.defaultHeaders; + + // authentication (RED-OAUTH) required + if (this.configuration.accessToken) { + const 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/octet-stream']; + 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[] = ['multipart/form-data']; + + const canConsumeForm = this.canConsumeForm(consumes); + + let formParams: { append(param: string, value: any): void }; + let useForm = false; + const convertFormParamsToString = false; + // use FormData to transmit files using content-type "multipart/form-data" + // see https://stackoverflow.com/questions/4007969/application-x-www-form-urlencoded-or-multipart-form-data + useForm = canConsumeForm; + if (useForm) { + formParams = new FormData(); + } else { + formParams = new HttpParams({ encoder: new CustomHttpUrlEncodingCodec() }); + } + + if (file !== undefined) { + formParams = (formParams.append('file', file) as any) || formParams; + } + + return this.httpClient.request('post', `${this.basePath}/debug/classification`, { + body: convertFormParamsToString ? formParams.toString() : formParams, + params: queryParameters, + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + }); } - let headers = this.defaultHeaders; + /** + * Receives an uploaded file and returns a html file with its extracted tables for debugging. + * None + * @param file + * @param inline inline + * @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 debugHtmlTablesForm( + file: Blob, + inline?: boolean, + observe?: 'body', + reportProgress?: boolean + ): Observable; - // authentication (RED-OAUTH) required - if (this.configuration.accessToken) { - const accessToken = typeof this.configuration.accessToken === 'function' - ? this.configuration.accessToken() - : this.configuration.accessToken; - headers = headers.set('Authorization', 'Bearer ' + accessToken); + public debugHtmlTablesForm( + file: Blob, + inline?: boolean, + observe?: 'response', + reportProgress?: boolean + ): Observable>; + + public debugHtmlTablesForm( + file: Blob, + inline?: boolean, + observe?: 'events', + reportProgress?: boolean + ): Observable>; + + public debugHtmlTablesForm( + file: Blob, + inline?: boolean, + observe: any = 'body', + reportProgress: boolean = false + ): Observable { + if (file === null || file === undefined) { + throw new Error( + 'Required parameter file was null or undefined when calling debugHtmlTables.' + ); + } + + let queryParameters = new HttpParams({ encoder: new CustomHttpUrlEncodingCodec() }); + if (inline !== undefined && inline !== null) { + queryParameters = queryParameters.set('inline', inline); + } + + let headers = this.defaultHeaders; + + // authentication (RED-OAUTH) required + if (this.configuration.accessToken) { + const 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/octet-stream']; + 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[] = ['multipart/form-data']; + + const canConsumeForm = this.canConsumeForm(consumes); + + let formParams: { append(param: string, value: any): void }; + let useForm = false; + const convertFormParamsToString = false; + // use FormData to transmit files using content-type "multipart/form-data" + // see https://stackoverflow.com/questions/4007969/application-x-www-form-urlencoded-or-multipart-form-data + useForm = canConsumeForm; + if (useForm) { + formParams = new FormData(); + } else { + formParams = new HttpParams({ encoder: new CustomHttpUrlEncodingCodec() }); + } + + if (file !== undefined) { + formParams = (formParams.append('file', file) as any) || formParams; + } + + return this.httpClient.request('post', `${this.basePath}/debug/htmlTables`, { + body: convertFormParamsToString ? formParams.toString() : formParams, + params: queryParameters, + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + }); } - // to determine the Accept header - const httpHeaderAccepts: string[] = [ - 'application/octet-stream' - ]; - const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected !== undefined) { - headers = headers.set('Accept', httpHeaderAcceptSelected); + /** + * Receives an uploaded file and returns it with its sections visualized for debugging. + * None + * @param file + * @param inline inline + * @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 debugSectionsForm( + file: Blob, + inline?: boolean, + observe?: 'body', + reportProgress?: boolean + ): Observable; + + public debugSectionsForm( + file: Blob, + inline?: boolean, + observe?: 'response', + reportProgress?: boolean + ): Observable>; + + public debugSectionsForm( + file: Blob, + inline?: boolean, + observe?: 'events', + reportProgress?: boolean + ): Observable>; + + public debugSectionsForm( + file: Blob, + inline?: boolean, + observe: any = 'body', + reportProgress: boolean = false + ): Observable { + if (file === null || file === undefined) { + throw new Error( + 'Required parameter file was null or undefined when calling debugSections.' + ); + } + + let queryParameters = new HttpParams({ encoder: new CustomHttpUrlEncodingCodec() }); + if (inline !== undefined && inline !== null) { + queryParameters = queryParameters.set('inline', inline); + } + + let headers = this.defaultHeaders; + + // authentication (RED-OAUTH) required + if (this.configuration.accessToken) { + const 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/octet-stream']; + 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[] = ['multipart/form-data']; + + const canConsumeForm = this.canConsumeForm(consumes); + + let formParams: { append(param: string, value: any): void }; + let useForm = false; + const convertFormParamsToString = false; + // use FormData to transmit files using content-type "multipart/form-data" + // see https://stackoverflow.com/questions/4007969/application-x-www-form-urlencoded-or-multipart-form-data + useForm = canConsumeForm; + if (useForm) { + formParams = new FormData(); + } else { + formParams = new HttpParams({ encoder: new CustomHttpUrlEncodingCodec() }); + } + + if (file !== undefined) { + formParams = (formParams.append('file', file) as any) || formParams; + } + + return this.httpClient.request('post', `${this.basePath}/debug/sections`, { + body: convertFormParamsToString ? formParams.toString() : formParams, + params: queryParameters, + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + }); } - // to determine the Content-Type header - const consumes: string[] = [ - 'multipart/form-data' - ]; + /** + * Receives an uploaded file and returns it redacted. + * None + * @param file + * @param inline inline + * @param flatRedaction flatRedaction + * @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 redactionForm( + file: Blob, + inline?: boolean, + flatRedaction?: boolean, + observe?: 'body', + reportProgress?: boolean + ): Observable; - const canConsumeForm = this.canConsumeForm(consumes); + public redactionForm( + file: Blob, + inline?: boolean, + flatRedaction?: boolean, + observe?: 'response', + reportProgress?: boolean + ): Observable>; - let formParams: { append(param: string, value: any): void; }; - let useForm = false; - const convertFormParamsToString = false; - // use FormData to transmit files using content-type "multipart/form-data" - // see https://stackoverflow.com/questions/4007969/application-x-www-form-urlencoded-or-multipart-form-data - useForm = canConsumeForm; - if (useForm) { - formParams = new FormData(); - } else { - formParams = new HttpParams({encoder: new CustomHttpUrlEncodingCodec()}); + public redactionForm( + file: Blob, + inline?: boolean, + flatRedaction?: boolean, + observe?: 'events', + reportProgress?: boolean + ): Observable>; + + public redactionForm( + file: Blob, + inline?: boolean, + flatRedaction?: boolean, + observe: any = 'body', + reportProgress: boolean = false + ): Observable { + if (file === null || file === undefined) { + throw new Error( + 'Required parameter file was null or undefined when calling redaction.' + ); + } + + let queryParameters = new HttpParams({ encoder: new CustomHttpUrlEncodingCodec() }); + if (inline !== undefined && inline !== null) { + queryParameters = queryParameters.set('inline', inline); + } + if (flatRedaction !== undefined && flatRedaction !== null) { + queryParameters = queryParameters.set('flatRedaction', flatRedaction); + } + + let headers = this.defaultHeaders; + + // authentication (RED-OAUTH) required + if (this.configuration.accessToken) { + const 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/octet-stream']; + 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[] = ['multipart/form-data']; + + const canConsumeForm = this.canConsumeForm(consumes); + + let formParams: { append(param: string, value: any): void }; + let useForm = false; + const convertFormParamsToString = false; + // use FormData to transmit files using content-type "multipart/form-data" + // see https://stackoverflow.com/questions/4007969/application-x-www-form-urlencoded-or-multipart-form-data + useForm = canConsumeForm; + if (useForm) { + formParams = new FormData(); + } else { + formParams = new HttpParams({ encoder: new CustomHttpUrlEncodingCodec() }); + } + + if (file !== undefined) { + formParams = (formParams.append('file', file) as any) || formParams; + } + + return this.httpClient.request('post', `${this.basePath}/debug/redaction`, { + body: convertFormParamsToString ? formParams.toString() : formParams, + params: queryParameters, + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + }); } - if (file !== undefined) { - formParams = formParams.append('file', file) as any || formParams; + /** + * @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; } - - return this.httpClient.request('post', `${this.basePath}/debug/classification`, - { - body: convertFormParamsToString ? formParams.toString() : formParams, - params: queryParameters, - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * Receives an uploaded file and returns a html file with its extracted tables for debugging. - * None - * @param file - * @param inline inline - * @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 debugHtmlTablesForm(file: Blob, inline?: boolean, observe?: 'body', reportProgress?: boolean): Observable; - - public debugHtmlTablesForm(file: Blob, inline?: boolean, observe?: 'response', reportProgress?: boolean): Observable>; - - public debugHtmlTablesForm(file: Blob, inline?: boolean, observe?: 'events', reportProgress?: boolean): Observable>; - - public debugHtmlTablesForm(file: Blob, inline?: boolean, observe: any = 'body', reportProgress: boolean = false): Observable { - - if (file === null || file === undefined) { - throw new Error('Required parameter file was null or undefined when calling debugHtmlTables.'); - } - - - let queryParameters = new HttpParams({encoder: new CustomHttpUrlEncodingCodec()}); - if (inline !== undefined && inline !== null) { - queryParameters = queryParameters.set('inline', inline); - } - - let headers = this.defaultHeaders; - - // authentication (RED-OAUTH) required - if (this.configuration.accessToken) { - const 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/octet-stream' - ]; - 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[] = [ - 'multipart/form-data' - ]; - - const canConsumeForm = this.canConsumeForm(consumes); - - let formParams: { append(param: string, value: any): void; }; - let useForm = false; - const convertFormParamsToString = false; - // use FormData to transmit files using content-type "multipart/form-data" - // see https://stackoverflow.com/questions/4007969/application-x-www-form-urlencoded-or-multipart-form-data - useForm = canConsumeForm; - if (useForm) { - formParams = new FormData(); - } else { - formParams = new HttpParams({encoder: new CustomHttpUrlEncodingCodec()}); - } - - if (file !== undefined) { - formParams = formParams.append('file', file) as any || formParams; - } - - return this.httpClient.request('post', `${this.basePath}/debug/htmlTables`, - { - body: convertFormParamsToString ? formParams.toString() : formParams, - params: queryParameters, - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * Receives an uploaded file and returns it with its sections visualized for debugging. - * None - * @param file - * @param inline inline - * @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 debugSectionsForm(file: Blob, inline?: boolean, observe?: 'body', reportProgress?: boolean): Observable; - - public debugSectionsForm(file: Blob, inline?: boolean, observe?: 'response', reportProgress?: boolean): Observable>; - - public debugSectionsForm(file: Blob, inline?: boolean, observe?: 'events', reportProgress?: boolean): Observable>; - - public debugSectionsForm(file: Blob, inline?: boolean, observe: any = 'body', reportProgress: boolean = false): Observable { - - if (file === null || file === undefined) { - throw new Error('Required parameter file was null or undefined when calling debugSections.'); - } - - - let queryParameters = new HttpParams({encoder: new CustomHttpUrlEncodingCodec()}); - if (inline !== undefined && inline !== null) { - queryParameters = queryParameters.set('inline', inline); - } - - let headers = this.defaultHeaders; - - // authentication (RED-OAUTH) required - if (this.configuration.accessToken) { - const 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/octet-stream' - ]; - 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[] = [ - 'multipart/form-data' - ]; - - const canConsumeForm = this.canConsumeForm(consumes); - - let formParams: { append(param: string, value: any): void; }; - let useForm = false; - const convertFormParamsToString = false; - // use FormData to transmit files using content-type "multipart/form-data" - // see https://stackoverflow.com/questions/4007969/application-x-www-form-urlencoded-or-multipart-form-data - useForm = canConsumeForm; - if (useForm) { - formParams = new FormData(); - } else { - formParams = new HttpParams({encoder: new CustomHttpUrlEncodingCodec()}); - } - - if (file !== undefined) { - formParams = formParams.append('file', file) as any || formParams; - } - - return this.httpClient.request('post', `${this.basePath}/debug/sections`, - { - body: convertFormParamsToString ? formParams.toString() : formParams, - params: queryParameters, - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * Receives an uploaded file and returns it redacted. - * None - * @param file - * @param inline inline - * @param flatRedaction flatRedaction - * @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 redactionForm(file: Blob, inline?: boolean, flatRedaction?: boolean, observe?: 'body', reportProgress?: boolean): Observable; - - public redactionForm(file: Blob, inline?: boolean, flatRedaction?: boolean, observe?: 'response', reportProgress?: boolean): Observable>; - - public redactionForm(file: Blob, inline?: boolean, flatRedaction?: boolean, observe?: 'events', reportProgress?: boolean): Observable>; - - public redactionForm(file: Blob, inline?: boolean, flatRedaction?: boolean, observe: any = 'body', reportProgress: boolean = false): Observable { - - if (file === null || file === undefined) { - throw new Error('Required parameter file was null or undefined when calling redaction.'); - } - - - let queryParameters = new HttpParams({encoder: new CustomHttpUrlEncodingCodec()}); - if (inline !== undefined && inline !== null) { - queryParameters = queryParameters.set('inline', inline); - } - if (flatRedaction !== undefined && flatRedaction !== null) { - queryParameters = queryParameters.set('flatRedaction', flatRedaction); - } - - let headers = this.defaultHeaders; - - // authentication (RED-OAUTH) required - if (this.configuration.accessToken) { - const 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/octet-stream' - ]; - 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[] = [ - 'multipart/form-data' - ]; - - const canConsumeForm = this.canConsumeForm(consumes); - - let formParams: { append(param: string, value: any): void; }; - let useForm = false; - const convertFormParamsToString = false; - // use FormData to transmit files using content-type "multipart/form-data" - // see https://stackoverflow.com/questions/4007969/application-x-www-form-urlencoded-or-multipart-form-data - useForm = canConsumeForm; - if (useForm) { - formParams = new FormData(); - } else { - formParams = new HttpParams({encoder: new CustomHttpUrlEncodingCodec()}); - } - - if (file !== undefined) { - formParams = formParams.append('file', file) as any || formParams; - } - - return this.httpClient.request('post', `${this.basePath}/debug/redaction`, - { - body: convertFormParamsToString ? formParams.toString() : formParams, - params: queryParameters, - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * @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; - } - } diff --git a/libs/red-ui-http/src/lib/api/dictionaryController.service.ts b/libs/red-ui-http/src/lib/api/dictionaryController.service.ts index 566a766a1..d74399123 100644 --- a/libs/red-ui-http/src/lib/api/dictionaryController.service.ts +++ b/libs/red-ui-http/src/lib/api/dictionaryController.service.ts @@ -8,666 +8,862 @@ * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. - *//* tslint:disable:no-unused-variable member-ordering */ + */ /* tslint:disable:no-unused-variable member-ordering */ -import {Inject, Injectable, Optional} from '@angular/core'; -import {HttpClient, HttpEvent, HttpHeaders, HttpParams, HttpResponse} from '@angular/common/http'; -import {CustomHttpUrlEncodingCodec} from '../encoder'; +import { Inject, Injectable, Optional } from '@angular/core'; +import { HttpClient, HttpEvent, HttpHeaders, HttpParams, HttpResponse } from '@angular/common/http'; +import { CustomHttpUrlEncodingCodec } from '../encoder'; -import {Observable} from 'rxjs'; +import { Observable } from 'rxjs'; -import {Colors} from '../model/colors'; -import {Dictionary} from '../model/dictionary'; -import {TypeResponse} from '../model/typeResponse'; -import {TypeValue} from '../model/typeValue'; -import {UpdateTypeValue} from '../model/updateTypeValue'; - -import {BASE_PATH} from '../variables'; -import {Configuration} from '../configuration'; +import { Colors } from '../model/colors'; +import { Dictionary } from '../model/dictionary'; +import { TypeResponse } from '../model/typeResponse'; +import { TypeValue } from '../model/typeValue'; +import { UpdateTypeValue } from '../model/updateTypeValue'; +import { BASE_PATH } from '../variables'; +import { Configuration } from '../configuration'; @Injectable() export class DictionaryControllerService { + public defaultHeaders = new HttpHeaders(); + public configuration = new Configuration(); + protected basePath = ''; - public defaultHeaders = new HttpHeaders(); - public configuration = new Configuration(); - protected basePath = ''; - - constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { - if (basePath) { - this.basePath = basePath; - } - if (configuration) { - this.configuration = configuration; - this.basePath = basePath || configuration.basePath || this.basePath; - } - } - - /** - * Add dictionary entries with entry type. - * None - * @param body entries - * @param type type - * @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 addEntry(body: Array, type: string, observe?: 'body', reportProgress?: boolean): Observable; - - public addEntry(body: Array, type: string, observe?: 'response', reportProgress?: boolean): Observable>; - - public addEntry(body: Array, type: string, observe?: 'events', reportProgress?: boolean): Observable>; - - public addEntry(body: Array, type: string, observe: any = 'body', reportProgress: boolean = false): Observable { - - if (body === null || body === undefined) { - throw new Error('Required parameter body was null or undefined when calling addEntry.'); + constructor( + protected httpClient: HttpClient, + @Optional() @Inject(BASE_PATH) basePath: string, + @Optional() configuration: Configuration + ) { + if (basePath) { + this.basePath = basePath; + } + if (configuration) { + this.configuration = configuration; + this.basePath = basePath || configuration.basePath || this.basePath; + } } - if (type === null || type === undefined) { - throw new Error('Required parameter type was null or undefined when calling addEntry.'); + /** + * Add dictionary entries with entry type. + * None + * @param body entries + * @param type type + * @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 addEntry( + body: Array, + type: string, + observe?: 'body', + reportProgress?: boolean + ): Observable; + + public addEntry( + body: Array, + type: string, + observe?: 'response', + reportProgress?: boolean + ): Observable>; + + public addEntry( + body: Array, + type: string, + observe?: 'events', + reportProgress?: boolean + ): Observable>; + + public addEntry( + body: Array, + type: string, + observe: any = 'body', + reportProgress: boolean = false + ): Observable { + if (body === null || body === undefined) { + throw new Error('Required parameter body was null or undefined when calling addEntry.'); + } + + if (type === null || type === undefined) { + throw new Error('Required parameter type was null or undefined when calling addEntry.'); + } + + let headers = this.defaultHeaders; + + // authentication (RED-OAUTH) required + if (this.configuration.accessToken) { + const 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 + ); + 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( + 'post', + `${this.basePath}/dictionary/${encodeURIComponent(String(type))}`, + { + body: body, + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + } + ); } - let headers = this.defaultHeaders; + /** + * Creates entry type with colors, hint and caseInsensitive + * None + * @param body typeValue + * @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 addType(body: TypeValue, observe?: 'body', reportProgress?: boolean): Observable; - // authentication (RED-OAUTH) required - if (this.configuration.accessToken) { - const accessToken = typeof this.configuration.accessToken === 'function' - ? this.configuration.accessToken() - : this.configuration.accessToken; - headers = headers.set('Authorization', 'Bearer ' + accessToken); + public addType( + body: TypeValue, + observe?: 'response', + reportProgress?: boolean + ): Observable>; + + public addType( + body: TypeValue, + observe?: 'events', + reportProgress?: boolean + ): Observable>; + + public addType( + body: TypeValue, + observe: any = 'body', + reportProgress: boolean = false + ): Observable { + if (body === null || body === undefined) { + throw new Error('Required parameter body was null or undefined when calling addType.'); + } + + let headers = this.defaultHeaders; + + // authentication (RED-OAUTH) required + if (this.configuration.accessToken) { + const 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 + ); + 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('post', `${this.basePath}/dictionary/type`, { + body: body, + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + }); } - // to determine the Accept header - const httpHeaderAccepts: string[] = []; - const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected !== undefined) { - headers = headers.set('Accept', httpHeaderAcceptSelected); + /** + * Delete dictionary entries with entry type. + * None + * @param body entries + * @param type type + * @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 deleteEntry( + body: Array, + type: string, + observe?: 'body', + reportProgress?: boolean + ): Observable; + + public deleteEntry( + body: Array, + type: string, + observe?: 'response', + reportProgress?: boolean + ): Observable>; + + public deleteEntry( + body: Array, + type: string, + observe?: 'events', + reportProgress?: boolean + ): Observable>; + + public deleteEntry( + body: Array, + type: string, + observe: any = 'body', + reportProgress: boolean = false + ): Observable { + if (body === null || body === undefined) { + throw new Error( + 'Required parameter body was null or undefined when calling deleteEntry.' + ); + } + + if (type === null || type === undefined) { + throw new Error( + 'Required parameter type was null or undefined when calling deleteEntry.' + ); + } + + let headers = this.defaultHeaders; + + // authentication (RED-OAUTH) required + if (this.configuration.accessToken) { + const 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 + ); + if (httpHeaderAcceptSelected !== undefined) { + headers = headers.set('Accept', httpHeaderAcceptSelected); + } + + // to determine the Content-Type header + const consumes: string[] = ['*/*']; + const httpContentTypeSelected: + | string + | undefined = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected !== undefined) { + headers = headers.set('Content-Type', httpContentTypeSelected); + } + + return this.httpClient.request( + 'delete', + `${this.basePath}/dictionary/${encodeURIComponent(String(type))}`, + { + body: body, + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + } + ); } - // 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); + /** + * Deletes entry type + * None + * @param type type + * @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 deleteType(type: string, observe?: 'body', reportProgress?: boolean): Observable; + + public deleteType( + type: string, + observe?: 'response', + reportProgress?: boolean + ): Observable>; + + public deleteType( + type: string, + observe?: 'events', + reportProgress?: boolean + ): Observable>; + + public deleteType( + type: string, + observe: any = 'body', + reportProgress: boolean = false + ): Observable { + if (type === null || type === undefined) { + throw new Error( + 'Required parameter type was null or undefined when calling deleteType.' + ); + } + + let headers = this.defaultHeaders; + + // authentication (RED-OAUTH) required + if (this.configuration.accessToken) { + const 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 + ); + if (httpHeaderAcceptSelected !== undefined) { + headers = headers.set('Accept', httpHeaderAcceptSelected); + } + + // to determine the Content-Type header + const consumes: string[] = []; + + return this.httpClient.request( + 'delete', + `${this.basePath}/dictionary/type/${encodeURIComponent(String(type))}`, + { + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + } + ); } - return this.httpClient.request('post', `${this.basePath}/dictionary/${encodeURIComponent(String(type))}`, - { - body: body, - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } + /** + * Returns file containing the the dictionary entries for given type.. + * + * @param type type + * @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 downloadDictionaryFile( + type: string, + observe?: 'body', + reportProgress?: boolean + ): Observable; - /** - * Creates entry type with colors, hint and caseInsensitive - * None - * @param body typeValue - * @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 addType(body: TypeValue, observe?: 'body', reportProgress?: boolean): Observable; + public downloadDictionaryFile( + type: string, + observe?: 'response', + reportProgress?: boolean + ): Observable>; - public addType(body: TypeValue, observe?: 'response', reportProgress?: boolean): Observable>; + public downloadDictionaryFile( + type: string, + observe?: 'events', + reportProgress?: boolean + ): Observable>; - public addType(body: TypeValue, observe?: 'events', reportProgress?: boolean): Observable>; + public downloadDictionaryFile( + type: string, + observe: any = 'body', + reportProgress: boolean = false + ): Observable { + if (type === null || type === undefined) { + throw new Error( + 'Required parameter type was null or undefined when calling downloadDictionaryFile.' + ); + } - public addType(body: TypeValue, observe: any = 'body', reportProgress: boolean = false): Observable { + let headers = this.defaultHeaders; - if (body === null || body === undefined) { - throw new Error('Required parameter body was null or undefined when calling addType.'); + // authentication (RED-OAUTH) required + if (this.configuration.accessToken) { + const 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/octet-stream']; + 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[] = []; + + return this.httpClient.request( + 'get', + `${this.basePath}/dictionary/download/${encodeURIComponent(String(type))}`, + { + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + } + ); } - let headers = this.defaultHeaders; + /** + * Retrieve all entry types + * None + * @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 getAllTypes(observe?: 'body', reportProgress?: boolean): Observable; - // authentication (RED-OAUTH) required - if (this.configuration.accessToken) { - const accessToken = typeof this.configuration.accessToken === 'function' - ? this.configuration.accessToken() - : this.configuration.accessToken; - headers = headers.set('Authorization', 'Bearer ' + accessToken); + public getAllTypes( + observe?: 'response', + reportProgress?: boolean + ): Observable>; + + public getAllTypes( + observe?: 'events', + reportProgress?: boolean + ): Observable>; + + public getAllTypes(observe: any = 'body', reportProgress: boolean = false): Observable { + let headers = this.defaultHeaders; + + // authentication (RED-OAUTH) required + if (this.configuration.accessToken) { + const 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 + ); + if (httpHeaderAcceptSelected !== undefined) { + headers = headers.set('Accept', httpHeaderAcceptSelected); + } + + // to determine the Content-Type header + const consumes: string[] = []; + + return this.httpClient.request('get', `${this.basePath}/dictionary/type`, { + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + }); } - // to determine the Accept header - const httpHeaderAccepts: string[] = []; - const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected !== undefined) { - headers = headers.set('Accept', httpHeaderAcceptSelected); + /** + * Retrieves system colors for redaction. + * None + * @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 getColors(observe?: 'body', reportProgress?: boolean): Observable; + + public getColors( + observe?: 'response', + reportProgress?: boolean + ): Observable>; + + public getColors(observe?: 'events', reportProgress?: boolean): Observable>; + + public getColors(observe: any = 'body', reportProgress: boolean = false): Observable { + let headers = this.defaultHeaders; + + // authentication (RED-OAUTH) required + if (this.configuration.accessToken) { + const 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 + ); + if (httpHeaderAcceptSelected !== undefined) { + headers = headers.set('Accept', httpHeaderAcceptSelected); + } + + // to determine the Content-Type header + const consumes: string[] = []; + + return this.httpClient.request('get', `${this.basePath}/color`, { + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + }); } - // 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); + /** + * Retrieves all dictionary entries of an entry type + * None + * @param type type + * @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 getDictionaryForType( + type: string, + observe?: 'body', + reportProgress?: boolean + ): Observable; + + public getDictionaryForType( + type: string, + observe?: 'response', + reportProgress?: boolean + ): Observable>; + + public getDictionaryForType( + type: string, + observe?: 'events', + reportProgress?: boolean + ): Observable>; + + public getDictionaryForType( + type: string, + observe: any = 'body', + reportProgress: boolean = false + ): Observable { + if (type === null || type === undefined) { + throw new Error( + 'Required parameter type was null or undefined when calling getDictionaryForType.' + ); + } + + let headers = this.defaultHeaders; + + // authentication (RED-OAUTH) required + if (this.configuration.accessToken) { + const 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 + ); + if (httpHeaderAcceptSelected !== undefined) { + headers = headers.set('Accept', httpHeaderAcceptSelected); + } + + // to determine the Content-Type header + const consumes: string[] = []; + + return this.httpClient.request( + 'get', + `${this.basePath}/dictionary/${encodeURIComponent(String(type))}`, + { + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + } + ); } - return this.httpClient.request('post', `${this.basePath}/dictionary/type`, - { - body: body, - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } + /** + * Set system colors for redaction + * + * @param body colors + * @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 setColors(body: Colors, observe?: 'body', reportProgress?: boolean): Observable; - /** - * Delete dictionary entries with entry type. - * None - * @param body entries - * @param type type - * @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 deleteEntry(body: Array, type: string, observe?: 'body', reportProgress?: boolean): Observable; + public setColors( + body: Colors, + observe?: 'response', + reportProgress?: boolean + ): Observable>; - public deleteEntry(body: Array, type: string, observe?: 'response', reportProgress?: boolean): Observable>; + public setColors( + body: Colors, + observe?: 'events', + reportProgress?: boolean + ): Observable>; - public deleteEntry(body: Array, type: string, observe?: 'events', reportProgress?: boolean): Observable>; + public setColors( + body: Colors, + observe: any = 'body', + reportProgress: boolean = false + ): Observable { + if (body === null || body === undefined) { + throw new Error( + 'Required parameter body was null or undefined when calling setColors.' + ); + } - public deleteEntry(body: Array, type: string, observe: any = 'body', reportProgress: boolean = false): Observable { + let headers = this.defaultHeaders; - if (body === null || body === undefined) { - throw new Error('Required parameter body was null or undefined when calling deleteEntry.'); + // authentication (RED-OAUTH) required + if (this.configuration.accessToken) { + const 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 + ); + 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('post', `${this.basePath}/color`, { + body: body, + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + }); } - if (type === null || type === undefined) { - throw new Error('Required parameter type was null or undefined when calling deleteEntry.'); + /** + * Updates colors, hint and caseInsensitive of an entry type. + * None + * @param body typeValue + * @param type type + * @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 updateType( + body: UpdateTypeValue, + type: string, + observe?: 'body', + reportProgress?: boolean + ): Observable; + + public updateType( + body: UpdateTypeValue, + type: string, + observe?: 'response', + reportProgress?: boolean + ): Observable>; + + public updateType( + body: UpdateTypeValue, + type: string, + observe?: 'events', + reportProgress?: boolean + ): Observable>; + + public updateType( + body: UpdateTypeValue, + type: string, + observe: any = 'body', + reportProgress: boolean = false + ): Observable { + if (body === null || body === undefined) { + throw new Error( + 'Required parameter body was null or undefined when calling updateType.' + ); + } + + if (type === null || type === undefined) { + throw new Error( + 'Required parameter type was null or undefined when calling updateType.' + ); + } + + let headers = this.defaultHeaders; + + // authentication (RED-OAUTH) required + if (this.configuration.accessToken) { + const 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 + ); + 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( + 'post', + `${this.basePath}/dictionary/type/${encodeURIComponent(String(type))}`, + { + body: body, + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + } + ); } - let headers = this.defaultHeaders; + /** + * Takes object containing string or rules as argument, which will be used by the redaction service. + * + * @param file + * @param type type + * @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 uploadDictionaryFileForm( + file: Blob, + type: string, + observe?: 'body', + reportProgress?: boolean + ): Observable; - // authentication (RED-OAUTH) required - if (this.configuration.accessToken) { - const accessToken = typeof this.configuration.accessToken === 'function' - ? this.configuration.accessToken() - : this.configuration.accessToken; - headers = headers.set('Authorization', 'Bearer ' + accessToken); + public uploadDictionaryFileForm( + file: Blob, + type: string, + observe?: 'response', + reportProgress?: boolean + ): Observable>; + + public uploadDictionaryFileForm( + file: Blob, + type: string, + observe?: 'events', + reportProgress?: boolean + ): Observable>; + + public uploadDictionaryFileForm( + file: Blob, + type: string, + observe: any = 'body', + reportProgress: boolean = false + ): Observable { + if (file === null || file === undefined) { + throw new Error( + 'Required parameter file was null or undefined when calling uploadDictionaryFile.' + ); + } + + if (type === null || type === undefined) { + throw new Error( + 'Required parameter type was null or undefined when calling uploadDictionaryFile.' + ); + } + + let headers = this.defaultHeaders; + + // authentication (RED-OAUTH) required + if (this.configuration.accessToken) { + const 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 + ); + if (httpHeaderAcceptSelected !== undefined) { + headers = headers.set('Accept', httpHeaderAcceptSelected); + } + + // to determine the Content-Type header + const consumes: string[] = ['multipart/form-data']; + + const canConsumeForm = this.canConsumeForm(consumes); + + let formParams: { append(param: string, value: any): void }; + let useForm = false; + const convertFormParamsToString = false; + // use FormData to transmit files using content-type "multipart/form-data" + // see https://stackoverflow.com/questions/4007969/application-x-www-form-urlencoded-or-multipart-form-data + useForm = canConsumeForm; + if (useForm) { + formParams = new FormData(); + } else { + formParams = new HttpParams({ encoder: new CustomHttpUrlEncodingCodec() }); + } + + if (file !== undefined) { + formParams = (formParams.append('file', file) as any) || formParams; + } + + return this.httpClient.request( + 'post', + `${this.basePath}/dictionary/upload/${encodeURIComponent(String(type))}`, + { + body: convertFormParamsToString ? formParams.toString() : formParams, + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + } + ); } - // to determine the Accept header - const httpHeaderAccepts: string[] = []; - const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected !== undefined) { - headers = headers.set('Accept', httpHeaderAcceptSelected); + /** + * @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; } - - // to determine the Content-Type header - const consumes: string[] = [ - '*/*' - ]; - const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); - if (httpContentTypeSelected !== undefined) { - headers = headers.set('Content-Type', httpContentTypeSelected); - } - - return this.httpClient.request('delete', `${this.basePath}/dictionary/${encodeURIComponent(String(type))}`, - { - body: body, - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * Deletes entry type - * None - * @param type type - * @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 deleteType(type: string, observe?: 'body', reportProgress?: boolean): Observable; - - public deleteType(type: string, observe?: 'response', reportProgress?: boolean): Observable>; - - public deleteType(type: string, observe?: 'events', reportProgress?: boolean): Observable>; - - public deleteType(type: string, observe: any = 'body', reportProgress: boolean = false): Observable { - - if (type === null || type === undefined) { - throw new Error('Required parameter type was null or undefined when calling deleteType.'); - } - - let headers = this.defaultHeaders; - - // authentication (RED-OAUTH) required - if (this.configuration.accessToken) { - const 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); - if (httpHeaderAcceptSelected !== undefined) { - headers = headers.set('Accept', httpHeaderAcceptSelected); - } - - // to determine the Content-Type header - const consumes: string[] = []; - - return this.httpClient.request('delete', `${this.basePath}/dictionary/type/${encodeURIComponent(String(type))}`, - { - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * Returns file containing the the dictionary entries for given type.. - * - * @param type type - * @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 downloadDictionaryFile(type: string, observe?: 'body', reportProgress?: boolean): Observable; - - public downloadDictionaryFile(type: string, observe?: 'response', reportProgress?: boolean): Observable>; - - public downloadDictionaryFile(type: string, observe?: 'events', reportProgress?: boolean): Observable>; - - public downloadDictionaryFile(type: string, observe: any = 'body', reportProgress: boolean = false): Observable { - - if (type === null || type === undefined) { - throw new Error('Required parameter type was null or undefined when calling downloadDictionaryFile.'); - } - - let headers = this.defaultHeaders; - - // authentication (RED-OAUTH) required - if (this.configuration.accessToken) { - const 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/octet-stream' - ]; - 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[] = []; - - return this.httpClient.request('get', `${this.basePath}/dictionary/download/${encodeURIComponent(String(type))}`, - { - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * Retrieve all entry types - * None - * @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 getAllTypes(observe?: 'body', reportProgress?: boolean): Observable; - - public getAllTypes(observe?: 'response', reportProgress?: boolean): Observable>; - - public getAllTypes(observe?: 'events', reportProgress?: boolean): Observable>; - - public getAllTypes(observe: any = 'body', reportProgress: boolean = false): Observable { - - let headers = this.defaultHeaders; - - // authentication (RED-OAUTH) required - if (this.configuration.accessToken) { - const 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); - if (httpHeaderAcceptSelected !== undefined) { - headers = headers.set('Accept', httpHeaderAcceptSelected); - } - - // to determine the Content-Type header - const consumes: string[] = []; - - return this.httpClient.request('get', `${this.basePath}/dictionary/type`, - { - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * Retrieves system colors for redaction. - * None - * @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 getColors(observe?: 'body', reportProgress?: boolean): Observable; - - public getColors(observe?: 'response', reportProgress?: boolean): Observable>; - - public getColors(observe?: 'events', reportProgress?: boolean): Observable>; - - public getColors(observe: any = 'body', reportProgress: boolean = false): Observable { - - let headers = this.defaultHeaders; - - // authentication (RED-OAUTH) required - if (this.configuration.accessToken) { - const 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); - if (httpHeaderAcceptSelected !== undefined) { - headers = headers.set('Accept', httpHeaderAcceptSelected); - } - - // to determine the Content-Type header - const consumes: string[] = []; - - return this.httpClient.request('get', `${this.basePath}/color`, - { - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * Retrieves all dictionary entries of an entry type - * None - * @param type type - * @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 getDictionaryForType(type: string, observe?: 'body', reportProgress?: boolean): Observable; - - public getDictionaryForType(type: string, observe?: 'response', reportProgress?: boolean): Observable>; - - public getDictionaryForType(type: string, observe?: 'events', reportProgress?: boolean): Observable>; - - public getDictionaryForType(type: string, observe: any = 'body', reportProgress: boolean = false): Observable { - - if (type === null || type === undefined) { - throw new Error('Required parameter type was null or undefined when calling getDictionaryForType.'); - } - - let headers = this.defaultHeaders; - - // authentication (RED-OAUTH) required - if (this.configuration.accessToken) { - const 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); - if (httpHeaderAcceptSelected !== undefined) { - headers = headers.set('Accept', httpHeaderAcceptSelected); - } - - // to determine the Content-Type header - const consumes: string[] = []; - - return this.httpClient.request('get', `${this.basePath}/dictionary/${encodeURIComponent(String(type))}`, - { - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * Set system colors for redaction - * - * @param body colors - * @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 setColors(body: Colors, observe?: 'body', reportProgress?: boolean): Observable; - - public setColors(body: Colors, observe?: 'response', reportProgress?: boolean): Observable>; - - public setColors(body: Colors, observe?: 'events', reportProgress?: boolean): Observable>; - - public setColors(body: Colors, observe: any = 'body', reportProgress: boolean = false): Observable { - - if (body === null || body === undefined) { - throw new Error('Required parameter body was null or undefined when calling setColors.'); - } - - let headers = this.defaultHeaders; - - // authentication (RED-OAUTH) required - if (this.configuration.accessToken) { - const 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); - 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('post', `${this.basePath}/color`, - { - body: body, - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * Updates colors, hint and caseInsensitive of an entry type. - * None - * @param body typeValue - * @param type type - * @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 updateType(body: UpdateTypeValue, type: string, observe?: 'body', reportProgress?: boolean): Observable; - - public updateType(body: UpdateTypeValue, type: string, observe?: 'response', reportProgress?: boolean): Observable>; - - public updateType(body: UpdateTypeValue, type: string, observe?: 'events', reportProgress?: boolean): Observable>; - - public updateType(body: UpdateTypeValue, type: string, observe: any = 'body', reportProgress: boolean = false): Observable { - - if (body === null || body === undefined) { - throw new Error('Required parameter body was null or undefined when calling updateType.'); - } - - if (type === null || type === undefined) { - throw new Error('Required parameter type was null or undefined when calling updateType.'); - } - - let headers = this.defaultHeaders; - - // authentication (RED-OAUTH) required - if (this.configuration.accessToken) { - const 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); - 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('post', `${this.basePath}/dictionary/type/${encodeURIComponent(String(type))}`, - { - body: body, - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * Takes object containing string or rules as argument, which will be used by the redaction service. - * - * @param file - * @param type type - * @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 uploadDictionaryFileForm(file: Blob, type: string, observe?: 'body', reportProgress?: boolean): Observable; - - public uploadDictionaryFileForm(file: Blob, type: string, observe?: 'response', reportProgress?: boolean): Observable>; - - public uploadDictionaryFileForm(file: Blob, type: string, observe?: 'events', reportProgress?: boolean): Observable>; - - public uploadDictionaryFileForm(file: Blob, type: string, observe: any = 'body', reportProgress: boolean = false): Observable { - - if (file === null || file === undefined) { - throw new Error('Required parameter file was null or undefined when calling uploadDictionaryFile.'); - } - - if (type === null || type === undefined) { - throw new Error('Required parameter type was null or undefined when calling uploadDictionaryFile.'); - } - - let headers = this.defaultHeaders; - - // authentication (RED-OAUTH) required - if (this.configuration.accessToken) { - const 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); - if (httpHeaderAcceptSelected !== undefined) { - headers = headers.set('Accept', httpHeaderAcceptSelected); - } - - // to determine the Content-Type header - const consumes: string[] = [ - 'multipart/form-data' - ]; - - const canConsumeForm = this.canConsumeForm(consumes); - - let formParams: { append(param: string, value: any): void; }; - let useForm = false; - const convertFormParamsToString = false; - // use FormData to transmit files using content-type "multipart/form-data" - // see https://stackoverflow.com/questions/4007969/application-x-www-form-urlencoded-or-multipart-form-data - useForm = canConsumeForm; - if (useForm) { - formParams = new FormData(); - } else { - formParams = new HttpParams({encoder: new CustomHttpUrlEncodingCodec()}); - } - - if (file !== undefined) { - formParams = formParams.append('file', file) as any || formParams; - } - - return this.httpClient.request('post', `${this.basePath}/dictionary/upload/${encodeURIComponent(String(type))}`, - { - body: convertFormParamsToString ? formParams.toString() : formParams, - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * @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; - } - } diff --git a/libs/red-ui-http/src/lib/api/fileUploadController.service.ts b/libs/red-ui-http/src/lib/api/fileUploadController.service.ts index a056db34a..fe90c8ed1 100644 --- a/libs/red-ui-http/src/lib/api/fileUploadController.service.ts +++ b/libs/red-ui-http/src/lib/api/fileUploadController.service.ts @@ -8,488 +8,654 @@ * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. - *//* tslint:disable:no-unused-variable member-ordering */ + */ /* tslint:disable:no-unused-variable member-ordering */ -import {Inject, Injectable, Optional} from '@angular/core'; -import {HttpClient, HttpEvent, HttpHeaders, HttpParams, HttpResponse} from '@angular/common/http'; -import {CustomHttpUrlEncodingCodec} from '../encoder'; +import { Inject, Injectable, Optional } from '@angular/core'; +import { HttpClient, HttpEvent, HttpHeaders, HttpParams, HttpResponse } from '@angular/common/http'; +import { CustomHttpUrlEncodingCodec } from '../encoder'; -import {Observable} from 'rxjs'; +import { Observable } from 'rxjs'; -import {FileIds} from '../model/fileIds'; -import {FileUploadResult} from '../model/fileUploadResult'; - -import {BASE_PATH} from '../variables'; -import {Configuration} from '../configuration'; +import { FileIds } from '../model/fileIds'; +import { FileUploadResult } from '../model/fileUploadResult'; +import { BASE_PATH } from '../variables'; +import { Configuration } from '../configuration'; @Injectable() export class FileUploadControllerService { + public defaultHeaders = new HttpHeaders(); + public configuration = new Configuration(); + protected basePath = ''; - public defaultHeaders = new HttpHeaders(); - public configuration = new Configuration(); - protected basePath = ''; - - constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { - if (basePath) { - this.basePath = basePath; - } - if (configuration) { - this.configuration = configuration; - this.basePath = basePath || configuration.basePath || this.basePath; - } - } - - /** - * Deletes a file for a given projectId and FileId - * None - * @param projectId projectId - * @param fileId fileId - * @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 deleteFile(projectId: string, fileId: string, observe?: 'body', reportProgress?: boolean): Observable; - - public deleteFile(projectId: string, fileId: string, observe?: 'response', reportProgress?: boolean): Observable>; - - public deleteFile(projectId: string, fileId: string, observe?: 'events', reportProgress?: boolean): Observable>; - - public deleteFile(projectId: string, fileId: string, observe: any = 'body', reportProgress: boolean = false): Observable { - - if (projectId === null || projectId === undefined) { - throw new Error('Required parameter projectId was null or undefined when calling deleteFile.'); + constructor( + protected httpClient: HttpClient, + @Optional() @Inject(BASE_PATH) basePath: string, + @Optional() configuration: Configuration + ) { + if (basePath) { + this.basePath = basePath; + } + if (configuration) { + this.configuration = configuration; + this.basePath = basePath || configuration.basePath || this.basePath; + } } - if (fileId === null || fileId === undefined) { - throw new Error('Required parameter fileId was null or undefined when calling deleteFile.'); + /** + * Deletes a file for a given projectId and FileId + * None + * @param projectId projectId + * @param fileId fileId + * @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 deleteFile( + projectId: string, + fileId: string, + observe?: 'body', + reportProgress?: boolean + ): Observable; + + public deleteFile( + projectId: string, + fileId: string, + observe?: 'response', + reportProgress?: boolean + ): Observable>; + + public deleteFile( + projectId: string, + fileId: string, + observe?: 'events', + reportProgress?: boolean + ): Observable>; + + public deleteFile( + projectId: string, + fileId: string, + observe: any = 'body', + reportProgress: boolean = false + ): Observable { + if (projectId === null || projectId === undefined) { + throw new Error( + 'Required parameter projectId was null or undefined when calling deleteFile.' + ); + } + + if (fileId === null || fileId === undefined) { + throw new Error( + 'Required parameter fileId was null or undefined when calling deleteFile.' + ); + } + + let headers = this.defaultHeaders; + + // authentication (RED-OAUTH) required + if (this.configuration.accessToken) { + const 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 + ); + if (httpHeaderAcceptSelected !== undefined) { + headers = headers.set('Accept', httpHeaderAcceptSelected); + } + + // to determine the Content-Type header + const consumes: string[] = []; + + return this.httpClient.request( + 'delete', + `${this.basePath}/delete/${encodeURIComponent(String(projectId))}/${encodeURIComponent( + String(fileId) + )}`, + { + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + } + ); } - let headers = this.defaultHeaders; + /** + * Returns a downloadable byte stream of the annotated file with the specified fileId + * Use the optional \"inline\" request parameter to select, if this downloadAnnotated will be opened in the browser. + * @param fileId fileId + * @param inline inline + * @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 downloadAnnotatedFile( + fileId: string, + inline?: boolean, + observe?: 'body', + reportProgress?: boolean + ): Observable; - // authentication (RED-OAUTH) required - if (this.configuration.accessToken) { - const accessToken = typeof this.configuration.accessToken === 'function' - ? this.configuration.accessToken() - : this.configuration.accessToken; - headers = headers.set('Authorization', 'Bearer ' + accessToken); + public downloadAnnotatedFile( + fileId: string, + inline?: boolean, + observe?: 'response', + reportProgress?: boolean + ): Observable>; + + public downloadAnnotatedFile( + fileId: string, + inline?: boolean, + observe?: 'events', + reportProgress?: boolean + ): Observable>; + + public downloadAnnotatedFile( + fileId: string, + inline?: boolean, + observe: any = 'body', + reportProgress: boolean = false + ): Observable { + if (fileId === null || fileId === undefined) { + throw new Error( + 'Required parameter fileId was null or undefined when calling downloadAnnotatedFile.' + ); + } + + let queryParameters = new HttpParams({ encoder: new CustomHttpUrlEncodingCodec() }); + if (inline !== undefined && inline !== null) { + queryParameters = queryParameters.set('inline', inline); + } + + let headers = this.defaultHeaders; + + // authentication (RED-OAUTH) required + if (this.configuration.accessToken) { + const 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/octet-stream']; + 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[] = []; + + return this.httpClient.request( + 'get', + `${this.basePath}/download/annotated/${encodeURIComponent(String(fileId))}`, + { + responseType: 'blob', + params: queryParameters, + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + } + ); } - // to determine the Accept header - const httpHeaderAccepts: string[] = []; - const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected !== undefined) { - headers = headers.set('Accept', httpHeaderAcceptSelected); + /** + * Returns a downloadable byte stream of the original file with the specified fileId + * Use the optional \"inline\" request parameter to select, if this downloadAnnotated will be opened in the browser. + * @param fileId fileId + * @param inline inline + * @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 downloadOriginalFile( + fileId: string, + inline?: boolean, + observe?: 'body', + reportProgress?: boolean + ): Observable; + + public downloadOriginalFile( + fileId: string, + inline?: boolean, + observe?: 'response', + reportProgress?: boolean + ): Observable>; + + public downloadOriginalFile( + fileId: string, + inline?: boolean, + observe?: 'events', + reportProgress?: boolean + ): Observable>; + + public downloadOriginalFile( + fileId: string, + inline?: boolean, + observe: any = 'body', + reportProgress: boolean = false + ): Observable { + if (fileId === null || fileId === undefined) { + throw new Error( + 'Required parameter fileId was null or undefined when calling downloadOriginalFile.' + ); + } + + let queryParameters = new HttpParams({ encoder: new CustomHttpUrlEncodingCodec() }); + if (inline !== undefined && inline !== null) { + queryParameters = queryParameters.set('inline', inline); + } + + let headers = this.defaultHeaders; + + // authentication (RED-OAUTH) required + if (this.configuration.accessToken) { + const 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/octet-stream']; + 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[] = []; + + return this.httpClient.request( + 'get', + `${this.basePath}/download/original/${encodeURIComponent(String(fileId))}`, + { + responseType: 'blob', + params: queryParameters, + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + } + ); } - // to determine the Content-Type header - const consumes: string[] = []; + /** + * Returns a downloadable byte stream of the redacted file with the specified fileId + * Use the optional \"inline\" request parameter to select, if this downloadAnnotated will be opened in the browser. + * @param fileId fileId + * @param inline inline + * @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 downloadRedactedFile( + fileId: string, + inline?: boolean, + observe?: 'body', + reportProgress?: boolean + ): Observable; - return this.httpClient.request('delete', `${this.basePath}/delete/${encodeURIComponent(String(projectId))}/${encodeURIComponent(String(fileId))}`, - { - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } + public downloadRedactedFile( + fileId: string, + inline?: boolean, + observe?: 'response', + reportProgress?: boolean + ): Observable>; - /** - * Returns a downloadable byte stream of the annotated file with the specified fileId - * Use the optional \"inline\" request parameter to select, if this downloadAnnotated will be opened in the browser. - * @param fileId fileId - * @param inline inline - * @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 downloadAnnotatedFile(fileId: string, inline?: boolean, observe?: 'body', reportProgress?: boolean): Observable; + public downloadRedactedFile( + fileId: string, + inline?: boolean, + observe?: 'events', + reportProgress?: boolean + ): Observable>; - public downloadAnnotatedFile(fileId: string, inline?: boolean, observe?: 'response', reportProgress?: boolean): Observable>; + public downloadRedactedFile( + fileId: string, + inline?: boolean, + observe: any = 'body', + reportProgress: boolean = false + ): Observable { + if (fileId === null || fileId === undefined) { + throw new Error( + 'Required parameter fileId was null or undefined when calling downloadRedactedFile.' + ); + } - public downloadAnnotatedFile(fileId: string, inline?: boolean, observe?: 'events', reportProgress?: boolean): Observable>; + let queryParameters = new HttpParams({ encoder: new CustomHttpUrlEncodingCodec() }); + if (inline !== undefined && inline !== null) { + queryParameters = queryParameters.set('inline', inline); + } - public downloadAnnotatedFile(fileId: string, inline?: boolean, observe: any = 'body', reportProgress: boolean = false): Observable { + let headers = this.defaultHeaders; - if (fileId === null || fileId === undefined) { - throw new Error('Required parameter fileId was null or undefined when calling downloadAnnotatedFile.'); + // authentication (RED-OAUTH) required + if (this.configuration.accessToken) { + const 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/octet-stream']; + 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[] = []; + + return this.httpClient.request( + 'get', + `${this.basePath}/download/redacted/${encodeURIComponent(String(fileId))}`, + { + responseType: 'blob', + params: queryParameters, + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + } + ); } + /** + * Returns a downloadable byte stream of the redaction report file for the specified fileIds + * Use the optional \"inline\" request parameter to select, if this report will be opened in the browser. + * @param body fileIds + * @param inline inline + * @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 downloadRedactionReport( + body: FileIds, + inline?: boolean, + observe?: 'body', + reportProgress?: boolean + ): Observable; - let queryParameters = new HttpParams({encoder: new CustomHttpUrlEncodingCodec()}); - if (inline !== undefined && inline !== null) { - queryParameters = queryParameters.set('inline', inline); + public downloadRedactionReport( + body: FileIds, + inline?: boolean, + observe?: 'response', + reportProgress?: boolean + ): Observable>; + + public downloadRedactionReport( + body: FileIds, + inline?: boolean, + observe?: 'events', + reportProgress?: boolean + ): Observable>; + + public downloadRedactionReport( + body: FileIds, + inline?: boolean, + observe: any = 'body', + reportProgress: boolean = false + ): Observable { + if (body === null || body === undefined) { + throw new Error( + 'Required parameter body was null or undefined when calling downloadRedactionReport.' + ); + } + + let queryParameters = new HttpParams({ encoder: new CustomHttpUrlEncodingCodec() }); + if (inline !== undefined && inline !== null) { + queryParameters = queryParameters.set('inline', inline); + } + + let headers = this.defaultHeaders; + + // authentication (RED-OAUTH) required + if (this.configuration.accessToken) { + const 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/octet-stream']; + 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('post', `${this.basePath}/download/report`, { + responseType: 'blob', + body: body, + params: queryParameters, + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + }); } - let headers = this.defaultHeaders; + /** + * Returns a downloadable byte stream of the redaction report file for the specified project + * Use the optional \"inline\" request parameter to select, if this report will be opened in the browser. + * @param projectId The projectId + * @param inline inline + * @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 downloadRedactionReportForProject( + projectId: string, + inline?: boolean, + observe?: 'body', + reportProgress?: boolean + ): Observable; - // authentication (RED-OAUTH) required - if (this.configuration.accessToken) { - const accessToken = typeof this.configuration.accessToken === 'function' - ? this.configuration.accessToken() - : this.configuration.accessToken; - headers = headers.set('Authorization', 'Bearer ' + accessToken); + public downloadRedactionReportForProject( + projectId: string, + inline?: boolean, + observe?: 'response', + reportProgress?: boolean + ): Observable>; + + public downloadRedactionReportForProject( + projectId: string, + inline?: boolean, + observe?: 'events', + reportProgress?: boolean + ): Observable>; + + public downloadRedactionReportForProject( + projectId: string, + inline?: boolean, + observe: any = 'body', + reportProgress: boolean = false + ): Observable { + if (projectId === null || projectId === undefined) { + throw new Error( + 'Required parameter projectId was null or undefined when calling downloadRedactionReportForProject.' + ); + } + + let queryParameters = new HttpParams({ encoder: new CustomHttpUrlEncodingCodec() }); + if (inline !== undefined && inline !== null) { + queryParameters = queryParameters.set('inline', inline); + } + + let headers = this.defaultHeaders; + + // authentication (RED-OAUTH) required + if (this.configuration.accessToken) { + const 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/octet-stream']; + 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[] = []; + + return this.httpClient.request( + 'get', + `${this.basePath}/download/report/${encodeURIComponent(String(projectId))}`, + { + responseType: 'blob', + params: queryParameters, + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + } + ); } - // to determine the Accept header - const httpHeaderAccepts: string[] = [ - 'application/octet-stream' - ]; - const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected !== undefined) { - headers = headers.set('Accept', httpHeaderAcceptSelected); + /** + * Receives an uploaded file and returns its fileId. + * None + * @param file + * @param projectId The projectId, the file belongs to + * @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 uploadFileForm( + file: Blob, + projectId: string, + observe?: 'body', + reportProgress?: boolean + ): Observable; + + public uploadFileForm( + file: Blob, + projectId: string, + observe?: 'response', + reportProgress?: boolean + ): Observable>; + + public uploadFileForm( + file: Blob, + projectId: string, + observe?: 'events', + reportProgress?: boolean + ): Observable>; + + public uploadFileForm( + file: Blob, + projectId: string, + observe: any = 'body', + reportProgress: boolean = false + ): Observable { + if (file === null || file === undefined) { + throw new Error( + 'Required parameter file was null or undefined when calling uploadFile.' + ); + } + + if (projectId === null || projectId === undefined) { + throw new Error( + 'Required parameter projectId was null or undefined when calling uploadFile.' + ); + } + + let headers = this.defaultHeaders; + + // authentication (RED-OAUTH) required + if (this.configuration.accessToken) { + const 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 + ); + if (httpHeaderAcceptSelected !== undefined) { + headers = headers.set('Accept', httpHeaderAcceptSelected); + } + + // to determine the Content-Type header + const consumes: string[] = ['multipart/form-data']; + + const canConsumeForm = this.canConsumeForm(consumes); + + let formParams: { append(param: string, value: any): void }; + let useForm = false; + const convertFormParamsToString = false; + // use FormData to transmit files using content-type "multipart/form-data" + // see https://stackoverflow.com/questions/4007969/application-x-www-form-urlencoded-or-multipart-form-data + useForm = canConsumeForm; + if (useForm) { + formParams = new FormData(); + } else { + formParams = new HttpParams({ encoder: new CustomHttpUrlEncodingCodec() }); + } + + if (file !== undefined) { + formParams = (formParams.append('file', file) as any) || formParams; + } + + return this.httpClient.request( + 'post', + `${this.basePath}/upload/${encodeURIComponent(String(projectId))}`, + { + body: convertFormParamsToString ? formParams.toString() : formParams, + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + } + ); } - // to determine the Content-Type header - const consumes: string[] = []; - - return this.httpClient.request('get', `${this.basePath}/download/annotated/${encodeURIComponent(String(fileId))}`, - { - responseType: 'blob', - params: queryParameters, - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * Returns a downloadable byte stream of the original file with the specified fileId - * Use the optional \"inline\" request parameter to select, if this downloadAnnotated will be opened in the browser. - * @param fileId fileId - * @param inline inline - * @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 downloadOriginalFile(fileId: string, inline?: boolean, observe?: 'body', reportProgress?: boolean): Observable; - - public downloadOriginalFile(fileId: string, inline?: boolean, observe?: 'response', reportProgress?: boolean): Observable>; - - public downloadOriginalFile(fileId: string, inline?: boolean, observe?: 'events', reportProgress?: boolean): Observable>; - - public downloadOriginalFile(fileId: string, inline?: boolean, observe: any = 'body', reportProgress: boolean = false): Observable { - - if (fileId === null || fileId === undefined) { - throw new Error('Required parameter fileId was null or undefined when calling downloadOriginalFile.'); + /** + * @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; } - - - let queryParameters = new HttpParams({encoder: new CustomHttpUrlEncodingCodec()}); - if (inline !== undefined && inline !== null) { - queryParameters = queryParameters.set('inline', inline); - } - - let headers = this.defaultHeaders; - - // authentication (RED-OAUTH) required - if (this.configuration.accessToken) { - const 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/octet-stream' - ]; - 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[] = []; - - return this.httpClient.request('get', `${this.basePath}/download/original/${encodeURIComponent(String(fileId))}`, - { - responseType: 'blob', - params: queryParameters, - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * Returns a downloadable byte stream of the redacted file with the specified fileId - * Use the optional \"inline\" request parameter to select, if this downloadAnnotated will be opened in the browser. - * @param fileId fileId - * @param inline inline - * @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 downloadRedactedFile(fileId: string, inline?: boolean, observe?: 'body', reportProgress?: boolean): Observable; - - public downloadRedactedFile(fileId: string, inline?: boolean, observe?: 'response', reportProgress?: boolean): Observable>; - - public downloadRedactedFile(fileId: string, inline?: boolean, observe?: 'events', reportProgress?: boolean): Observable>; - - public downloadRedactedFile(fileId: string, inline?: boolean, observe: any = 'body', reportProgress: boolean = false): Observable { - - if (fileId === null || fileId === undefined) { - throw new Error('Required parameter fileId was null or undefined when calling downloadRedactedFile.'); - } - - - let queryParameters = new HttpParams({encoder: new CustomHttpUrlEncodingCodec()}); - if (inline !== undefined && inline !== null) { - queryParameters = queryParameters.set('inline', inline); - } - - let headers = this.defaultHeaders; - - // authentication (RED-OAUTH) required - if (this.configuration.accessToken) { - const 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/octet-stream' - ]; - 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[] = []; - - return this.httpClient.request('get', `${this.basePath}/download/redacted/${encodeURIComponent(String(fileId))}`, - { - responseType: 'blob', - params: queryParameters, - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * Returns a downloadable byte stream of the redaction report file for the specified fileIds - * Use the optional \"inline\" request parameter to select, if this report will be opened in the browser. - * @param body fileIds - * @param inline inline - * @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 downloadRedactionReport(body: FileIds, inline?: boolean, observe?: 'body', reportProgress?: boolean): Observable; - - public downloadRedactionReport(body: FileIds, inline?: boolean, observe?: 'response', reportProgress?: boolean): Observable>; - - public downloadRedactionReport(body: FileIds, inline?: boolean, observe?: 'events', reportProgress?: boolean): Observable>; - - public downloadRedactionReport(body: FileIds, inline?: boolean, observe: any = 'body', reportProgress: boolean = false): Observable { - - if (body === null || body === undefined) { - throw new Error('Required parameter body was null or undefined when calling downloadRedactionReport.'); - } - - - let queryParameters = new HttpParams({encoder: new CustomHttpUrlEncodingCodec()}); - if (inline !== undefined && inline !== null) { - queryParameters = queryParameters.set('inline', inline); - } - - let headers = this.defaultHeaders; - - // authentication (RED-OAUTH) required - if (this.configuration.accessToken) { - const 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/octet-stream' - ]; - 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('post', `${this.basePath}/download/report`, - { - responseType: 'blob', - body: body, - params: queryParameters, - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * Returns a downloadable byte stream of the redaction report file for the specified project - * Use the optional \"inline\" request parameter to select, if this report will be opened in the browser. - * @param projectId The projectId - * @param inline inline - * @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 downloadRedactionReportForProject(projectId: string, inline?: boolean, observe?: 'body', reportProgress?: boolean): Observable; - - public downloadRedactionReportForProject(projectId: string, inline?: boolean, observe?: 'response', reportProgress?: boolean): Observable>; - - public downloadRedactionReportForProject(projectId: string, inline?: boolean, observe?: 'events', reportProgress?: boolean): Observable>; - - public downloadRedactionReportForProject(projectId: string, inline?: boolean, observe: any = 'body', reportProgress: boolean = false): Observable { - - if (projectId === null || projectId === undefined) { - throw new Error('Required parameter projectId was null or undefined when calling downloadRedactionReportForProject.'); - } - - - let queryParameters = new HttpParams({encoder: new CustomHttpUrlEncodingCodec()}); - if (inline !== undefined && inline !== null) { - queryParameters = queryParameters.set('inline', inline); - } - - let headers = this.defaultHeaders; - - // authentication (RED-OAUTH) required - if (this.configuration.accessToken) { - const 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/octet-stream' - ]; - 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[] = []; - - return this.httpClient.request('get', `${this.basePath}/download/report/${encodeURIComponent(String(projectId))}`, - { - responseType: 'blob', - params: queryParameters, - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * Receives an uploaded file and returns its fileId. - * None - * @param file - * @param projectId The projectId, the file belongs to - * @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 uploadFileForm(file: Blob, projectId: string, observe?: 'body', reportProgress?: boolean): Observable; - - public uploadFileForm(file: Blob, projectId: string, observe?: 'response', reportProgress?: boolean): Observable>; - - public uploadFileForm(file: Blob, projectId: string, observe?: 'events', reportProgress?: boolean): Observable>; - - public uploadFileForm(file: Blob, projectId: string, observe: any = 'body', reportProgress: boolean = false): Observable { - - if (file === null || file === undefined) { - throw new Error('Required parameter file was null or undefined when calling uploadFile.'); - } - - if (projectId === null || projectId === undefined) { - throw new Error('Required parameter projectId was null or undefined when calling uploadFile.'); - } - - let headers = this.defaultHeaders; - - // authentication (RED-OAUTH) required - if (this.configuration.accessToken) { - const 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); - if (httpHeaderAcceptSelected !== undefined) { - headers = headers.set('Accept', httpHeaderAcceptSelected); - } - - // to determine the Content-Type header - const consumes: string[] = [ - 'multipart/form-data' - ]; - - const canConsumeForm = this.canConsumeForm(consumes); - - let formParams: { append(param: string, value: any): void; }; - let useForm = false; - const convertFormParamsToString = false; - // use FormData to transmit files using content-type "multipart/form-data" - // see https://stackoverflow.com/questions/4007969/application-x-www-form-urlencoded-or-multipart-form-data - useForm = canConsumeForm; - if (useForm) { - formParams = new FormData(); - } else { - formParams = new HttpParams({encoder: new CustomHttpUrlEncodingCodec()}); - } - - if (file !== undefined) { - formParams = formParams.append('file', file) as any || formParams; - } - - return this.httpClient.request('post', `${this.basePath}/upload/${encodeURIComponent(String(projectId))}`, - { - body: convertFormParamsToString ? formParams.toString() : formParams, - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * @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; - } - } diff --git a/libs/red-ui-http/src/lib/api/infoController.service.ts b/libs/red-ui-http/src/lib/api/infoController.service.ts index f0f91ce8e..b01a58263 100644 --- a/libs/red-ui-http/src/lib/api/infoController.service.ts +++ b/libs/red-ui-http/src/lib/api/infoController.service.ts @@ -8,94 +8,99 @@ * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. - *//* tslint:disable:no-unused-variable member-ordering */ + */ /* tslint:disable:no-unused-variable member-ordering */ -import {Inject, Injectable, Optional} from '@angular/core'; -import {HttpClient, HttpEvent, HttpHeaders, HttpResponse} from '@angular/common/http'; +import { Inject, Injectable, Optional } from '@angular/core'; +import { HttpClient, HttpEvent, HttpHeaders, HttpResponse } from '@angular/common/http'; -import {Observable} from 'rxjs'; +import { Observable } from 'rxjs'; -import {AuthInfo} from '../model/authInfo'; - -import {BASE_PATH} from '../variables'; -import {Configuration} from '../configuration'; +import { AuthInfo } from '../model/authInfo'; +import { BASE_PATH } from '../variables'; +import { Configuration } from '../configuration'; @Injectable() export class InfoControllerService { + public defaultHeaders = new HttpHeaders(); + public configuration = new Configuration(); + protected basePath = ''; - public defaultHeaders = new HttpHeaders(); - public configuration = new Configuration(); - protected basePath = ''; - - constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { - if (basePath) { - this.basePath = basePath; - } - if (configuration) { - this.configuration = configuration; - this.basePath = basePath || configuration.basePath || this.basePath; - } - } - - /** - * Gets the auth information. - * None - * @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 getAuthInfo(observe?: 'body', reportProgress?: boolean): Observable; - - public getAuthInfo(observe?: 'response', reportProgress?: boolean): Observable>; - - public getAuthInfo(observe?: 'events', reportProgress?: boolean): Observable>; - - public getAuthInfo(observe: any = 'body', reportProgress: boolean = false): Observable { - - let headers = this.defaultHeaders; - - // authentication (RED-OAUTH) required - if (this.configuration.accessToken) { - const accessToken = typeof this.configuration.accessToken === 'function' - ? this.configuration.accessToken() - : this.configuration.accessToken; - headers = headers.set('Authorization', 'Bearer ' + accessToken); + constructor( + protected httpClient: HttpClient, + @Optional() @Inject(BASE_PATH) basePath: string, + @Optional() configuration: Configuration + ) { + if (basePath) { + this.basePath = basePath; + } + if (configuration) { + this.configuration = configuration; + this.basePath = basePath || configuration.basePath || this.basePath; + } } - // to determine the Accept header - const httpHeaderAccepts: string[] = [ - 'application/json' - ]; - const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected !== undefined) { - headers = headers.set('Accept', httpHeaderAcceptSelected); + /** + * Gets the auth information. + * None + * @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 getAuthInfo(observe?: 'body', reportProgress?: boolean): Observable; + + public getAuthInfo( + observe?: 'response', + reportProgress?: boolean + ): Observable>; + + public getAuthInfo( + observe?: 'events', + reportProgress?: boolean + ): Observable>; + + public getAuthInfo(observe: any = 'body', reportProgress: boolean = false): Observable { + let headers = this.defaultHeaders; + + // authentication (RED-OAUTH) required + if (this.configuration.accessToken) { + const 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 + ); + if (httpHeaderAcceptSelected !== undefined) { + headers = headers.set('Accept', httpHeaderAcceptSelected); + } + + // to determine the Content-Type header + const consumes: string[] = []; + + return this.httpClient.request('get', `${this.basePath}/info`, { + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + }); } - // to determine the Content-Type header - const consumes: string[] = []; - - return this.httpClient.request('get', `${this.basePath}/info`, - { - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * @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; - } + /** + * @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; } - return false; - } - } diff --git a/libs/red-ui-http/src/lib/api/licenseReportController.service.ts b/libs/red-ui-http/src/lib/api/licenseReportController.service.ts index 2ed42b546..0b29c1c62 100644 --- a/libs/red-ui-http/src/lib/api/licenseReportController.service.ts +++ b/libs/red-ui-http/src/lib/api/licenseReportController.service.ts @@ -8,120 +8,144 @@ * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. - *//* tslint:disable:no-unused-variable member-ordering */ + */ /* tslint:disable:no-unused-variable member-ordering */ -import {Inject, Injectable, Optional} from '@angular/core'; -import {HttpClient, HttpEvent, HttpHeaders, HttpParams, HttpResponse} from '@angular/common/http'; -import {CustomHttpUrlEncodingCodec} from '../encoder'; +import { Inject, Injectable, Optional } from '@angular/core'; +import { HttpClient, HttpEvent, HttpHeaders, HttpParams, HttpResponse } from '@angular/common/http'; +import { CustomHttpUrlEncodingCodec } from '../encoder'; -import {Observable} from 'rxjs'; +import { Observable } from 'rxjs'; -import {LicenseReport} from '../model/licenseReport'; -import {LicenseReportRequest} from '../model/licenseReportRequest'; - -import {BASE_PATH} from '../variables'; -import {Configuration} from '../configuration'; +import { LicenseReport } from '../model/licenseReport'; +import { LicenseReportRequest } from '../model/licenseReportRequest'; +import { BASE_PATH } from '../variables'; +import { Configuration } from '../configuration'; @Injectable() export class LicenseReportControllerService { + public defaultHeaders = new HttpHeaders(); + public configuration = new Configuration(); + protected basePath = ''; - public defaultHeaders = new HttpHeaders(); - public configuration = new Configuration(); - protected basePath = ''; - - constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { - if (basePath) { - this.basePath = basePath; - } - if (configuration) { - this.configuration = configuration; - this.basePath = basePath || configuration.basePath || this.basePath; - } - } - - /** - * Creates and serves license report. - * None - * @param body reportRequest - * @param offset offset - * @param limit limit - * @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 licenseReport(body: LicenseReportRequest, offset?: number, limit?: number, observe?: 'body', reportProgress?: boolean): Observable; - - public licenseReport(body: LicenseReportRequest, offset?: number, limit?: number, observe?: 'response', reportProgress?: boolean): Observable>; - - public licenseReport(body: LicenseReportRequest, offset?: number, limit?: number, observe?: 'events', reportProgress?: boolean): Observable>; - - public licenseReport(body: LicenseReportRequest, offset?: number, limit?: number, observe: any = 'body', reportProgress: boolean = false): Observable { - - if (body === null || body === undefined) { - throw new Error('Required parameter body was null or undefined when calling licenseReport.'); + constructor( + protected httpClient: HttpClient, + @Optional() @Inject(BASE_PATH) basePath: string, + @Optional() configuration: Configuration + ) { + if (basePath) { + this.basePath = basePath; + } + if (configuration) { + this.configuration = configuration; + this.basePath = basePath || configuration.basePath || this.basePath; + } } + /** + * Creates and serves license report. + * None + * @param body reportRequest + * @param offset offset + * @param limit limit + * @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 licenseReport( + body: LicenseReportRequest, + offset?: number, + limit?: number, + observe?: 'body', + reportProgress?: boolean + ): Observable; - let queryParameters = new HttpParams({encoder: new CustomHttpUrlEncodingCodec()}); - if (offset !== undefined && offset !== null) { - queryParameters = queryParameters.set('offset', offset); - } - if (limit !== undefined && limit !== null) { - queryParameters = queryParameters.set('limit', limit); + public licenseReport( + body: LicenseReportRequest, + offset?: number, + limit?: number, + observe?: 'response', + reportProgress?: boolean + ): Observable>; + + public licenseReport( + body: LicenseReportRequest, + offset?: number, + limit?: number, + observe?: 'events', + reportProgress?: boolean + ): Observable>; + + public licenseReport( + body: LicenseReportRequest, + offset?: number, + limit?: number, + observe: any = 'body', + reportProgress: boolean = false + ): Observable { + if (body === null || body === undefined) { + throw new Error( + 'Required parameter body was null or undefined when calling licenseReport.' + ); + } + + let queryParameters = new HttpParams({ encoder: new CustomHttpUrlEncodingCodec() }); + if (offset !== undefined && offset !== null) { + queryParameters = queryParameters.set('offset', offset); + } + if (limit !== undefined && limit !== null) { + queryParameters = queryParameters.set('limit', limit); + } + + let headers = this.defaultHeaders; + + // authentication (RED-OAUTH) required + if (this.configuration.accessToken) { + const 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 + ); + 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('post', `${this.basePath}/report/license`, { + body: body, + params: queryParameters, + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + }); } - let headers = this.defaultHeaders; - - // authentication (RED-OAUTH) required - if (this.configuration.accessToken) { - const accessToken = typeof this.configuration.accessToken === 'function' - ? this.configuration.accessToken() - : this.configuration.accessToken; - headers = headers.set('Authorization', 'Bearer ' + accessToken); + /** + * @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; } - - // to determine the Accept header - const httpHeaderAccepts: string[] = [ - 'application/json' - ]; - 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('post', `${this.basePath}/report/license`, - { - body: body, - params: queryParameters, - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * @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; - } - } diff --git a/libs/red-ui-http/src/lib/api/manualRedactionController.service.ts b/libs/red-ui-http/src/lib/api/manualRedactionController.service.ts index 1b557580a..2de0ef5aa 100644 --- a/libs/red-ui-http/src/lib/api/manualRedactionController.service.ts +++ b/libs/red-ui-http/src/lib/api/manualRedactionController.service.ts @@ -8,695 +8,1050 @@ * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. - *//* tslint:disable:no-unused-variable member-ordering */ + */ /* tslint:disable:no-unused-variable member-ordering */ -import {Inject, Injectable, Optional} from '@angular/core'; -import {HttpClient, HttpEvent, HttpHeaders, HttpResponse} from '@angular/common/http'; +import { Inject, Injectable, Optional } from '@angular/core'; +import { HttpClient, HttpEvent, HttpHeaders, HttpResponse } from '@angular/common/http'; -import {Observable} from 'rxjs'; +import { Observable } from 'rxjs'; -import {AddCommentRequest} from '../model/addCommentRequest'; -import {AddRedactionRequest} from '../model/addRedactionRequest'; -import {CommentResponse} from '../model/commentResponse'; -import {ManualAddResponse} from '../model/manualAddResponse'; -import {ManualRedactions} from '../model/manualRedactions'; -import {RemoveRedactionRequest} from '../model/removeRedactionRequest'; - -import {BASE_PATH} from '../variables'; -import {Configuration} from '../configuration'; +import { AddCommentRequest } from '../model/addCommentRequest'; +import { AddRedactionRequest } from '../model/addRedactionRequest'; +import { CommentResponse } from '../model/commentResponse'; +import { ManualAddResponse } from '../model/manualAddResponse'; +import { ManualRedactions } from '../model/manualRedactions'; +import { RemoveRedactionRequest } from '../model/removeRedactionRequest'; +import { BASE_PATH } from '../variables'; +import { Configuration } from '../configuration'; @Injectable() export class ManualRedactionControllerService { + public defaultHeaders = new HttpHeaders(); + public configuration = new Configuration(); + protected basePath = ''; - public defaultHeaders = new HttpHeaders(); - public configuration = new Configuration(); - protected basePath = ''; - - constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { - if (basePath) { - this.basePath = basePath; - } - if (configuration) { - this.configuration = configuration; - this.basePath = basePath || configuration.basePath || this.basePath; - } - } - - /** - * Adds a comment to a redaction/redaction request - * None - * @param body addCommentRequest - * @param projectId projectId - * @param fileId fileId - * @param annotationId annotationId - * @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 addComment(body: AddCommentRequest, projectId: string, fileId: string, annotationId: string, observe?: 'body', reportProgress?: boolean): Observable; - - public addComment(body: AddCommentRequest, projectId: string, fileId: string, annotationId: string, observe?: 'response', reportProgress?: boolean): Observable>; - - public addComment(body: AddCommentRequest, projectId: string, fileId: string, annotationId: string, observe?: 'events', reportProgress?: boolean): Observable>; - - public addComment(body: AddCommentRequest, projectId: string, fileId: string, annotationId: string, observe: any = 'body', reportProgress: boolean = false): Observable { - - if (body === null || body === undefined) { - throw new Error('Required parameter body was null or undefined when calling addComment.'); + constructor( + protected httpClient: HttpClient, + @Optional() @Inject(BASE_PATH) basePath: string, + @Optional() configuration: Configuration + ) { + if (basePath) { + this.basePath = basePath; + } + if (configuration) { + this.configuration = configuration; + this.basePath = basePath || configuration.basePath || this.basePath; + } } - if (projectId === null || projectId === undefined) { - throw new Error('Required parameter projectId was null or undefined when calling addComment.'); + /** + * Adds a comment to a redaction/redaction request + * None + * @param body addCommentRequest + * @param projectId projectId + * @param fileId fileId + * @param annotationId annotationId + * @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 addComment( + body: AddCommentRequest, + projectId: string, + fileId: string, + annotationId: string, + observe?: 'body', + reportProgress?: boolean + ): Observable; + + public addComment( + body: AddCommentRequest, + projectId: string, + fileId: string, + annotationId: string, + observe?: 'response', + reportProgress?: boolean + ): Observable>; + + public addComment( + body: AddCommentRequest, + projectId: string, + fileId: string, + annotationId: string, + observe?: 'events', + reportProgress?: boolean + ): Observable>; + + public addComment( + body: AddCommentRequest, + projectId: string, + fileId: string, + annotationId: string, + observe: any = 'body', + reportProgress: boolean = false + ): Observable { + if (body === null || body === undefined) { + throw new Error( + 'Required parameter body was null or undefined when calling addComment.' + ); + } + + if (projectId === null || projectId === undefined) { + throw new Error( + 'Required parameter projectId was null or undefined when calling addComment.' + ); + } + + if (fileId === null || fileId === undefined) { + throw new Error( + 'Required parameter fileId was null or undefined when calling addComment.' + ); + } + + if (annotationId === null || annotationId === undefined) { + throw new Error( + 'Required parameter annotationId was null or undefined when calling addComment.' + ); + } + + let headers = this.defaultHeaders; + + // authentication (RED-OAUTH) required + if (this.configuration.accessToken) { + const 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 + ); + 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( + 'post', + `${this.basePath}/manualRedaction/comment/add/${encodeURIComponent( + String(projectId) + )}/${encodeURIComponent(String(fileId))}/${encodeURIComponent(String(annotationId))}`, + { + body: body, + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + } + ); } - if (fileId === null || fileId === undefined) { - throw new Error('Required parameter fileId was null or undefined when calling addComment.'); + /** + * Adds a manual redaction + * None + * @param body addRedactionRequest + * @param projectId projectId + * @param fileId fileId + * @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 addRedaction( + body: AddRedactionRequest, + projectId: string, + fileId: string, + observe?: 'body', + reportProgress?: boolean + ): Observable; + + public addRedaction( + body: AddRedactionRequest, + projectId: string, + fileId: string, + observe?: 'response', + reportProgress?: boolean + ): Observable>; + + public addRedaction( + body: AddRedactionRequest, + projectId: string, + fileId: string, + observe?: 'events', + reportProgress?: boolean + ): Observable>; + + public addRedaction( + body: AddRedactionRequest, + projectId: string, + fileId: string, + observe: any = 'body', + reportProgress: boolean = false + ): Observable { + if (body === null || body === undefined) { + throw new Error( + 'Required parameter body was null or undefined when calling addRedaction.' + ); + } + + if (projectId === null || projectId === undefined) { + throw new Error( + 'Required parameter projectId was null or undefined when calling addRedaction.' + ); + } + + if (fileId === null || fileId === undefined) { + throw new Error( + 'Required parameter fileId was null or undefined when calling addRedaction.' + ); + } + + let headers = this.defaultHeaders; + + // authentication (RED-OAUTH) required + if (this.configuration.accessToken) { + const 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 + ); + 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( + 'post', + `${this.basePath}/manualRedaction/redaction/add/${encodeURIComponent( + String(projectId) + )}/${encodeURIComponent(String(fileId))}`, + { + body: body, + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + } + ); } - if (annotationId === null || annotationId === undefined) { - throw new Error('Required parameter annotationId was null or undefined when calling addComment.'); + /** + * Approves a redaction request/ remove redaction request + * None + * @param projectId projectId + * @param fileId fileId + * @param annotationId annotationId + * @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 approveRequest( + projectId: string, + fileId: string, + annotationId: string, + observe?: 'body', + reportProgress?: boolean + ): Observable; + + public approveRequest( + projectId: string, + fileId: string, + annotationId: string, + observe?: 'response', + reportProgress?: boolean + ): Observable>; + + public approveRequest( + projectId: string, + fileId: string, + annotationId: string, + observe?: 'events', + reportProgress?: boolean + ): Observable>; + + public approveRequest( + projectId: string, + fileId: string, + annotationId: string, + observe: any = 'body', + reportProgress: boolean = false + ): Observable { + if (projectId === null || projectId === undefined) { + throw new Error( + 'Required parameter projectId was null or undefined when calling approveRequest.' + ); + } + + if (fileId === null || fileId === undefined) { + throw new Error( + 'Required parameter fileId was null or undefined when calling approveRequest.' + ); + } + + if (annotationId === null || annotationId === undefined) { + throw new Error( + 'Required parameter annotationId was null or undefined when calling approveRequest.' + ); + } + + let headers = this.defaultHeaders; + + // authentication (RED-OAUTH) required + if (this.configuration.accessToken) { + const 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 + ); + if (httpHeaderAcceptSelected !== undefined) { + headers = headers.set('Accept', httpHeaderAcceptSelected); + } + + // to determine the Content-Type header + const consumes: string[] = []; + + return this.httpClient.request( + 'post', + `${this.basePath}/manualRedaction/approve/${encodeURIComponent( + String(projectId) + )}/${encodeURIComponent(String(fileId))}/${encodeURIComponent(String(annotationId))}`, + { + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + } + ); } - let headers = this.defaultHeaders; + /** + * Declines a redaction request/ remove redaction request + * None + * @param projectId projectId + * @param fileId fileId + * @param annotationId annotationId + * @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 declineRequest( + projectId: string, + fileId: string, + annotationId: string, + observe?: 'body', + reportProgress?: boolean + ): Observable; - // authentication (RED-OAUTH) required - if (this.configuration.accessToken) { - const accessToken = typeof this.configuration.accessToken === 'function' - ? this.configuration.accessToken() - : this.configuration.accessToken; - headers = headers.set('Authorization', 'Bearer ' + accessToken); + public declineRequest( + projectId: string, + fileId: string, + annotationId: string, + observe?: 'response', + reportProgress?: boolean + ): Observable>; + + public declineRequest( + projectId: string, + fileId: string, + annotationId: string, + observe?: 'events', + reportProgress?: boolean + ): Observable>; + + public declineRequest( + projectId: string, + fileId: string, + annotationId: string, + observe: any = 'body', + reportProgress: boolean = false + ): Observable { + if (projectId === null || projectId === undefined) { + throw new Error( + 'Required parameter projectId was null or undefined when calling declineRequest.' + ); + } + + if (fileId === null || fileId === undefined) { + throw new Error( + 'Required parameter fileId was null or undefined when calling declineRequest.' + ); + } + + if (annotationId === null || annotationId === undefined) { + throw new Error( + 'Required parameter annotationId was null or undefined when calling declineRequest.' + ); + } + + let headers = this.defaultHeaders; + + // authentication (RED-OAUTH) required + if (this.configuration.accessToken) { + const 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 + ); + if (httpHeaderAcceptSelected !== undefined) { + headers = headers.set('Accept', httpHeaderAcceptSelected); + } + + // to determine the Content-Type header + const consumes: string[] = []; + + return this.httpClient.request( + 'post', + `${this.basePath}/manualRedaction/decline/${encodeURIComponent( + String(projectId) + )}/${encodeURIComponent(String(fileId))}/${encodeURIComponent(String(annotationId))}`, + { + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + } + ); } - // to determine the Accept header - const httpHeaderAccepts: string[] = [ - 'application/json' - ]; - const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected !== undefined) { - headers = headers.set('Accept', httpHeaderAcceptSelected); + /** + * Returns the manual redactions + * None + * @param projectId projectId + * @param fileId fileId + * @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 getManualRedaction( + projectId: string, + fileId: string, + observe?: 'body', + reportProgress?: boolean + ): Observable; + + public getManualRedaction( + projectId: string, + fileId: string, + observe?: 'response', + reportProgress?: boolean + ): Observable>; + + public getManualRedaction( + projectId: string, + fileId: string, + observe?: 'events', + reportProgress?: boolean + ): Observable>; + + public getManualRedaction( + projectId: string, + fileId: string, + observe: any = 'body', + reportProgress: boolean = false + ): Observable { + if (projectId === null || projectId === undefined) { + throw new Error( + 'Required parameter projectId was null or undefined when calling getManualRedaction.' + ); + } + + if (fileId === null || fileId === undefined) { + throw new Error( + 'Required parameter fileId was null or undefined when calling getManualRedaction.' + ); + } + + let headers = this.defaultHeaders; + + // authentication (RED-OAUTH) required + if (this.configuration.accessToken) { + const 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 + ); + if (httpHeaderAcceptSelected !== undefined) { + headers = headers.set('Accept', httpHeaderAcceptSelected); + } + + // to determine the Content-Type header + const consumes: string[] = []; + + return this.httpClient.request( + 'get', + `${this.basePath}/manualRedaction/${encodeURIComponent( + String(projectId) + )}/${encodeURIComponent(String(fileId))}`, + { + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + } + ); } - // 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); + /** + * Removes a redaction + * None + * @param body removeRedactionRequest + * @param projectId projectId + * @param fileId fileId + * @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 removeRedaction( + body: RemoveRedactionRequest, + projectId: string, + fileId: string, + observe?: 'body', + reportProgress?: boolean + ): Observable; + + public removeRedaction( + body: RemoveRedactionRequest, + projectId: string, + fileId: string, + observe?: 'response', + reportProgress?: boolean + ): Observable>; + + public removeRedaction( + body: RemoveRedactionRequest, + projectId: string, + fileId: string, + observe?: 'events', + reportProgress?: boolean + ): Observable>; + + public removeRedaction( + body: RemoveRedactionRequest, + projectId: string, + fileId: string, + observe: any = 'body', + reportProgress: boolean = false + ): Observable { + if (body === null || body === undefined) { + throw new Error( + 'Required parameter body was null or undefined when calling removeRedaction.' + ); + } + + if (projectId === null || projectId === undefined) { + throw new Error( + 'Required parameter projectId was null or undefined when calling removeRedaction.' + ); + } + + if (fileId === null || fileId === undefined) { + throw new Error( + 'Required parameter fileId was null or undefined when calling removeRedaction.' + ); + } + + let headers = this.defaultHeaders; + + // authentication (RED-OAUTH) required + if (this.configuration.accessToken) { + const 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 + ); + 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( + 'post', + `${this.basePath}/manualRedaction/redaction/remove/${encodeURIComponent( + String(projectId) + )}/${encodeURIComponent(String(fileId))}`, + { + body: body, + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + } + ); } - return this.httpClient.request('post', `${this.basePath}/manualRedaction/comment/add/${encodeURIComponent(String(projectId))}/${encodeURIComponent(String(fileId))}/${encodeURIComponent(String(annotationId))}`, - { - body: body, - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } + /** + * Adds a request for a redaction. + * None + * @param body addRedactionRequest + * @param projectId projectId + * @param fileId fileId + * @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 requestAddRedaction( + body: AddRedactionRequest, + projectId: string, + fileId: string, + observe?: 'body', + reportProgress?: boolean + ): Observable; - /** - * Adds a manual redaction - * None - * @param body addRedactionRequest - * @param projectId projectId - * @param fileId fileId - * @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 addRedaction(body: AddRedactionRequest, projectId: string, fileId: string, observe?: 'body', reportProgress?: boolean): Observable; + public requestAddRedaction( + body: AddRedactionRequest, + projectId: string, + fileId: string, + observe?: 'response', + reportProgress?: boolean + ): Observable>; - public addRedaction(body: AddRedactionRequest, projectId: string, fileId: string, observe?: 'response', reportProgress?: boolean): Observable>; + public requestAddRedaction( + body: AddRedactionRequest, + projectId: string, + fileId: string, + observe?: 'events', + reportProgress?: boolean + ): Observable>; - public addRedaction(body: AddRedactionRequest, projectId: string, fileId: string, observe?: 'events', reportProgress?: boolean): Observable>; + public requestAddRedaction( + body: AddRedactionRequest, + projectId: string, + fileId: string, + observe: any = 'body', + reportProgress: boolean = false + ): Observable { + if (body === null || body === undefined) { + throw new Error( + 'Required parameter body was null or undefined when calling requestAddRedaction.' + ); + } - public addRedaction(body: AddRedactionRequest, projectId: string, fileId: string, observe: any = 'body', reportProgress: boolean = false): Observable { + if (projectId === null || projectId === undefined) { + throw new Error( + 'Required parameter projectId was null or undefined when calling requestAddRedaction.' + ); + } - if (body === null || body === undefined) { - throw new Error('Required parameter body was null or undefined when calling addRedaction.'); + if (fileId === null || fileId === undefined) { + throw new Error( + 'Required parameter fileId was null or undefined when calling requestAddRedaction.' + ); + } + + let headers = this.defaultHeaders; + + // authentication (RED-OAUTH) required + if (this.configuration.accessToken) { + const 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 + ); + 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( + 'post', + `${this.basePath}/manualRedaction/request/add/${encodeURIComponent( + String(projectId) + )}/${encodeURIComponent(String(fileId))}`, + { + body: body, + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + } + ); } - if (projectId === null || projectId === undefined) { - throw new Error('Required parameter projectId was null or undefined when calling addRedaction.'); + /** + * Adds a request to remove a redaction. + * None + * @param body removeRedactionRequest + * @param projectId projectId + * @param fileId fileId + * @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 requestRemoveRedaction( + body: RemoveRedactionRequest, + projectId: string, + fileId: string, + observe?: 'body', + reportProgress?: boolean + ): Observable; + + public requestRemoveRedaction( + body: RemoveRedactionRequest, + projectId: string, + fileId: string, + observe?: 'response', + reportProgress?: boolean + ): Observable>; + + public requestRemoveRedaction( + body: RemoveRedactionRequest, + projectId: string, + fileId: string, + observe?: 'events', + reportProgress?: boolean + ): Observable>; + + public requestRemoveRedaction( + body: RemoveRedactionRequest, + projectId: string, + fileId: string, + observe: any = 'body', + reportProgress: boolean = false + ): Observable { + if (body === null || body === undefined) { + throw new Error( + 'Required parameter body was null or undefined when calling requestRemoveRedaction.' + ); + } + + if (projectId === null || projectId === undefined) { + throw new Error( + 'Required parameter projectId was null or undefined when calling requestRemoveRedaction.' + ); + } + + if (fileId === null || fileId === undefined) { + throw new Error( + 'Required parameter fileId was null or undefined when calling requestRemoveRedaction.' + ); + } + + let headers = this.defaultHeaders; + + // authentication (RED-OAUTH) required + if (this.configuration.accessToken) { + const 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 + ); + 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( + 'post', + `${this.basePath}/manualRedaction/request/remove/${encodeURIComponent( + String(projectId) + )}/${encodeURIComponent(String(fileId))}`, + { + body: body, + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + } + ); } - if (fileId === null || fileId === undefined) { - throw new Error('Required parameter fileId was null or undefined when calling addRedaction.'); + /** + * Undo a manual request or redaction + * Can only be done be the user who added the request/redaction. + * @param projectId projectId + * @param fileId fileId + * @param annotationId annotationId + * @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 undo( + projectId: string, + fileId: string, + annotationId: string, + observe?: 'body', + reportProgress?: boolean + ): Observable; + + public undo( + projectId: string, + fileId: string, + annotationId: string, + observe?: 'response', + reportProgress?: boolean + ): Observable>; + + public undo( + projectId: string, + fileId: string, + annotationId: string, + observe?: 'events', + reportProgress?: boolean + ): Observable>; + + public undo( + projectId: string, + fileId: string, + annotationId: string, + observe: any = 'body', + reportProgress: boolean = false + ): Observable { + if (projectId === null || projectId === undefined) { + throw new Error( + 'Required parameter projectId was null or undefined when calling undo.' + ); + } + + if (fileId === null || fileId === undefined) { + throw new Error('Required parameter fileId was null or undefined when calling undo.'); + } + + if (annotationId === null || annotationId === undefined) { + throw new Error( + 'Required parameter annotationId was null or undefined when calling undo.' + ); + } + + let headers = this.defaultHeaders; + + // authentication (RED-OAUTH) required + if (this.configuration.accessToken) { + const 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 + ); + if (httpHeaderAcceptSelected !== undefined) { + headers = headers.set('Accept', httpHeaderAcceptSelected); + } + + // to determine the Content-Type header + const consumes: string[] = []; + + return this.httpClient.request( + 'delete', + `${this.basePath}/manualRedaction/undo/${encodeURIComponent( + String(projectId) + )}/${encodeURIComponent(String(fileId))}/${encodeURIComponent(String(annotationId))}`, + { + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + } + ); } - let headers = this.defaultHeaders; + /** + * Undo a comment + * Can only be done be the user who added the comment. + * @param projectId projectId + * @param fileId fileId + * @param annotationId annotationId + * @param commentId commentId + * @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 undoComment( + projectId: string, + fileId: string, + annotationId: string, + commentId: string, + observe?: 'body', + reportProgress?: boolean + ): Observable; - // authentication (RED-OAUTH) required - if (this.configuration.accessToken) { - const accessToken = typeof this.configuration.accessToken === 'function' - ? this.configuration.accessToken() - : this.configuration.accessToken; - headers = headers.set('Authorization', 'Bearer ' + accessToken); + public undoComment( + projectId: string, + fileId: string, + annotationId: string, + commentId: string, + observe?: 'response', + reportProgress?: boolean + ): Observable>; + + public undoComment( + projectId: string, + fileId: string, + annotationId: string, + commentId: string, + observe?: 'events', + reportProgress?: boolean + ): Observable>; + + public undoComment( + projectId: string, + fileId: string, + annotationId: string, + commentId: string, + observe: any = 'body', + reportProgress: boolean = false + ): Observable { + if (projectId === null || projectId === undefined) { + throw new Error( + 'Required parameter projectId was null or undefined when calling undoComment.' + ); + } + + if (fileId === null || fileId === undefined) { + throw new Error( + 'Required parameter fileId was null or undefined when calling undoComment.' + ); + } + + if (annotationId === null || annotationId === undefined) { + throw new Error( + 'Required parameter annotationId was null or undefined when calling undoComment.' + ); + } + + if (commentId === null || commentId === undefined) { + throw new Error( + 'Required parameter commentId was null or undefined when calling undoComment.' + ); + } + + let headers = this.defaultHeaders; + + // authentication (RED-OAUTH) required + if (this.configuration.accessToken) { + const 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 + ); + if (httpHeaderAcceptSelected !== undefined) { + headers = headers.set('Accept', httpHeaderAcceptSelected); + } + + // to determine the Content-Type header + const consumes: string[] = []; + + return this.httpClient.request( + 'delete', + `${this.basePath}/manualRedaction/comment/undo/${encodeURIComponent( + String(projectId) + )}/${encodeURIComponent(String(fileId))}/${encodeURIComponent( + String(annotationId) + )}/${encodeURIComponent(String(commentId))}`, + { + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + } + ); } - // to determine the Accept header - const httpHeaderAccepts: string[] = [ - 'application/json' - ]; - const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected !== undefined) { - headers = headers.set('Accept', httpHeaderAcceptSelected); + /** + * @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; } - - // 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('post', `${this.basePath}/manualRedaction/redaction/add/${encodeURIComponent(String(projectId))}/${encodeURIComponent(String(fileId))}`, - { - body: body, - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * Approves a redaction request/ remove redaction request - * None - * @param projectId projectId - * @param fileId fileId - * @param annotationId annotationId - * @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 approveRequest(projectId: string, fileId: string, annotationId: string, observe?: 'body', reportProgress?: boolean): Observable; - - public approveRequest(projectId: string, fileId: string, annotationId: string, observe?: 'response', reportProgress?: boolean): Observable>; - - public approveRequest(projectId: string, fileId: string, annotationId: string, observe?: 'events', reportProgress?: boolean): Observable>; - - public approveRequest(projectId: string, fileId: string, annotationId: string, observe: any = 'body', reportProgress: boolean = false): Observable { - - if (projectId === null || projectId === undefined) { - throw new Error('Required parameter projectId was null or undefined when calling approveRequest.'); - } - - if (fileId === null || fileId === undefined) { - throw new Error('Required parameter fileId was null or undefined when calling approveRequest.'); - } - - if (annotationId === null || annotationId === undefined) { - throw new Error('Required parameter annotationId was null or undefined when calling approveRequest.'); - } - - let headers = this.defaultHeaders; - - // authentication (RED-OAUTH) required - if (this.configuration.accessToken) { - const 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); - if (httpHeaderAcceptSelected !== undefined) { - headers = headers.set('Accept', httpHeaderAcceptSelected); - } - - // to determine the Content-Type header - const consumes: string[] = []; - - return this.httpClient.request('post', `${this.basePath}/manualRedaction/approve/${encodeURIComponent(String(projectId))}/${encodeURIComponent(String(fileId))}/${encodeURIComponent(String(annotationId))}`, - { - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * Declines a redaction request/ remove redaction request - * None - * @param projectId projectId - * @param fileId fileId - * @param annotationId annotationId - * @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 declineRequest(projectId: string, fileId: string, annotationId: string, observe?: 'body', reportProgress?: boolean): Observable; - - public declineRequest(projectId: string, fileId: string, annotationId: string, observe?: 'response', reportProgress?: boolean): Observable>; - - public declineRequest(projectId: string, fileId: string, annotationId: string, observe?: 'events', reportProgress?: boolean): Observable>; - - public declineRequest(projectId: string, fileId: string, annotationId: string, observe: any = 'body', reportProgress: boolean = false): Observable { - - if (projectId === null || projectId === undefined) { - throw new Error('Required parameter projectId was null or undefined when calling declineRequest.'); - } - - if (fileId === null || fileId === undefined) { - throw new Error('Required parameter fileId was null or undefined when calling declineRequest.'); - } - - if (annotationId === null || annotationId === undefined) { - throw new Error('Required parameter annotationId was null or undefined when calling declineRequest.'); - } - - let headers = this.defaultHeaders; - - // authentication (RED-OAUTH) required - if (this.configuration.accessToken) { - const 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); - if (httpHeaderAcceptSelected !== undefined) { - headers = headers.set('Accept', httpHeaderAcceptSelected); - } - - // to determine the Content-Type header - const consumes: string[] = []; - - return this.httpClient.request('post', `${this.basePath}/manualRedaction/decline/${encodeURIComponent(String(projectId))}/${encodeURIComponent(String(fileId))}/${encodeURIComponent(String(annotationId))}`, - { - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * Returns the manual redactions - * None - * @param projectId projectId - * @param fileId fileId - * @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 getManualRedaction(projectId: string, fileId: string, observe?: 'body', reportProgress?: boolean): Observable; - - public getManualRedaction(projectId: string, fileId: string, observe?: 'response', reportProgress?: boolean): Observable>; - - public getManualRedaction(projectId: string, fileId: string, observe?: 'events', reportProgress?: boolean): Observable>; - - public getManualRedaction(projectId: string, fileId: string, observe: any = 'body', reportProgress: boolean = false): Observable { - - if (projectId === null || projectId === undefined) { - throw new Error('Required parameter projectId was null or undefined when calling getManualRedaction.'); - } - - if (fileId === null || fileId === undefined) { - throw new Error('Required parameter fileId was null or undefined when calling getManualRedaction.'); - } - - let headers = this.defaultHeaders; - - // authentication (RED-OAUTH) required - if (this.configuration.accessToken) { - const 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); - if (httpHeaderAcceptSelected !== undefined) { - headers = headers.set('Accept', httpHeaderAcceptSelected); - } - - // to determine the Content-Type header - const consumes: string[] = []; - - return this.httpClient.request('get', `${this.basePath}/manualRedaction/${encodeURIComponent(String(projectId))}/${encodeURIComponent(String(fileId))}`, - { - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * Removes a redaction - * None - * @param body removeRedactionRequest - * @param projectId projectId - * @param fileId fileId - * @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 removeRedaction(body: RemoveRedactionRequest, projectId: string, fileId: string, observe?: 'body', reportProgress?: boolean): Observable; - - public removeRedaction(body: RemoveRedactionRequest, projectId: string, fileId: string, observe?: 'response', reportProgress?: boolean): Observable>; - - public removeRedaction(body: RemoveRedactionRequest, projectId: string, fileId: string, observe?: 'events', reportProgress?: boolean): Observable>; - - public removeRedaction(body: RemoveRedactionRequest, projectId: string, fileId: string, observe: any = 'body', reportProgress: boolean = false): Observable { - - if (body === null || body === undefined) { - throw new Error('Required parameter body was null or undefined when calling removeRedaction.'); - } - - if (projectId === null || projectId === undefined) { - throw new Error('Required parameter projectId was null or undefined when calling removeRedaction.'); - } - - if (fileId === null || fileId === undefined) { - throw new Error('Required parameter fileId was null or undefined when calling removeRedaction.'); - } - - let headers = this.defaultHeaders; - - // authentication (RED-OAUTH) required - if (this.configuration.accessToken) { - const 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); - 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('post', `${this.basePath}/manualRedaction/redaction/remove/${encodeURIComponent(String(projectId))}/${encodeURIComponent(String(fileId))}`, - { - body: body, - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * Adds a request for a redaction. - * None - * @param body addRedactionRequest - * @param projectId projectId - * @param fileId fileId - * @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 requestAddRedaction(body: AddRedactionRequest, projectId: string, fileId: string, observe?: 'body', reportProgress?: boolean): Observable; - - public requestAddRedaction(body: AddRedactionRequest, projectId: string, fileId: string, observe?: 'response', reportProgress?: boolean): Observable>; - - public requestAddRedaction(body: AddRedactionRequest, projectId: string, fileId: string, observe?: 'events', reportProgress?: boolean): Observable>; - - public requestAddRedaction(body: AddRedactionRequest, projectId: string, fileId: string, observe: any = 'body', reportProgress: boolean = false): Observable { - - if (body === null || body === undefined) { - throw new Error('Required parameter body was null or undefined when calling requestAddRedaction.'); - } - - if (projectId === null || projectId === undefined) { - throw new Error('Required parameter projectId was null or undefined when calling requestAddRedaction.'); - } - - if (fileId === null || fileId === undefined) { - throw new Error('Required parameter fileId was null or undefined when calling requestAddRedaction.'); - } - - let headers = this.defaultHeaders; - - // authentication (RED-OAUTH) required - if (this.configuration.accessToken) { - const 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); - 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('post', `${this.basePath}/manualRedaction/request/add/${encodeURIComponent(String(projectId))}/${encodeURIComponent(String(fileId))}`, - { - body: body, - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * Adds a request to remove a redaction. - * None - * @param body removeRedactionRequest - * @param projectId projectId - * @param fileId fileId - * @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 requestRemoveRedaction(body: RemoveRedactionRequest, projectId: string, fileId: string, observe?: 'body', reportProgress?: boolean): Observable; - - public requestRemoveRedaction(body: RemoveRedactionRequest, projectId: string, fileId: string, observe?: 'response', reportProgress?: boolean): Observable>; - - public requestRemoveRedaction(body: RemoveRedactionRequest, projectId: string, fileId: string, observe?: 'events', reportProgress?: boolean): Observable>; - - public requestRemoveRedaction(body: RemoveRedactionRequest, projectId: string, fileId: string, observe: any = 'body', reportProgress: boolean = false): Observable { - - if (body === null || body === undefined) { - throw new Error('Required parameter body was null or undefined when calling requestRemoveRedaction.'); - } - - if (projectId === null || projectId === undefined) { - throw new Error('Required parameter projectId was null or undefined when calling requestRemoveRedaction.'); - } - - if (fileId === null || fileId === undefined) { - throw new Error('Required parameter fileId was null or undefined when calling requestRemoveRedaction.'); - } - - let headers = this.defaultHeaders; - - // authentication (RED-OAUTH) required - if (this.configuration.accessToken) { - const 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); - 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('post', `${this.basePath}/manualRedaction/request/remove/${encodeURIComponent(String(projectId))}/${encodeURIComponent(String(fileId))}`, - { - body: body, - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * Undo a manual request or redaction - * Can only be done be the user who added the request/redaction. - * @param projectId projectId - * @param fileId fileId - * @param annotationId annotationId - * @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 undo(projectId: string, fileId: string, annotationId: string, observe?: 'body', reportProgress?: boolean): Observable; - - public undo(projectId: string, fileId: string, annotationId: string, observe?: 'response', reportProgress?: boolean): Observable>; - - public undo(projectId: string, fileId: string, annotationId: string, observe?: 'events', reportProgress?: boolean): Observable>; - - public undo(projectId: string, fileId: string, annotationId: string, observe: any = 'body', reportProgress: boolean = false): Observable { - - if (projectId === null || projectId === undefined) { - throw new Error('Required parameter projectId was null or undefined when calling undo.'); - } - - if (fileId === null || fileId === undefined) { - throw new Error('Required parameter fileId was null or undefined when calling undo.'); - } - - if (annotationId === null || annotationId === undefined) { - throw new Error('Required parameter annotationId was null or undefined when calling undo.'); - } - - let headers = this.defaultHeaders; - - // authentication (RED-OAUTH) required - if (this.configuration.accessToken) { - const 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); - if (httpHeaderAcceptSelected !== undefined) { - headers = headers.set('Accept', httpHeaderAcceptSelected); - } - - // to determine the Content-Type header - const consumes: string[] = []; - - return this.httpClient.request('delete', `${this.basePath}/manualRedaction/undo/${encodeURIComponent(String(projectId))}/${encodeURIComponent(String(fileId))}/${encodeURIComponent(String(annotationId))}`, - { - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * Undo a comment - * Can only be done be the user who added the comment. - * @param projectId projectId - * @param fileId fileId - * @param annotationId annotationId - * @param commentId commentId - * @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 undoComment(projectId: string, fileId: string, annotationId: string, commentId: string, observe?: 'body', reportProgress?: boolean): Observable; - - public undoComment(projectId: string, fileId: string, annotationId: string, commentId: string, observe?: 'response', reportProgress?: boolean): Observable>; - - public undoComment(projectId: string, fileId: string, annotationId: string, commentId: string, observe?: 'events', reportProgress?: boolean): Observable>; - - public undoComment(projectId: string, fileId: string, annotationId: string, commentId: string, observe: any = 'body', reportProgress: boolean = false): Observable { - - if (projectId === null || projectId === undefined) { - throw new Error('Required parameter projectId was null or undefined when calling undoComment.'); - } - - if (fileId === null || fileId === undefined) { - throw new Error('Required parameter fileId was null or undefined when calling undoComment.'); - } - - if (annotationId === null || annotationId === undefined) { - throw new Error('Required parameter annotationId was null or undefined when calling undoComment.'); - } - - if (commentId === null || commentId === undefined) { - throw new Error('Required parameter commentId was null or undefined when calling undoComment.'); - } - - let headers = this.defaultHeaders; - - // authentication (RED-OAUTH) required - if (this.configuration.accessToken) { - const 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); - if (httpHeaderAcceptSelected !== undefined) { - headers = headers.set('Accept', httpHeaderAcceptSelected); - } - - // to determine the Content-Type header - const consumes: string[] = []; - - return this.httpClient.request('delete', `${this.basePath}/manualRedaction/comment/undo/${encodeURIComponent(String(projectId))}/${encodeURIComponent(String(fileId))}/${encodeURIComponent(String(annotationId))}/${encodeURIComponent(String(commentId))}`, - { - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * @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; - } - } diff --git a/libs/red-ui-http/src/lib/api/pdfMetaDataConfigurationController.service.ts b/libs/red-ui-http/src/lib/api/pdfMetaDataConfigurationController.service.ts index 6852c9223..833f16993 100644 --- a/libs/red-ui-http/src/lib/api/pdfMetaDataConfigurationController.service.ts +++ b/libs/red-ui-http/src/lib/api/pdfMetaDataConfigurationController.service.ts @@ -8,150 +8,173 @@ * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. - *//* tslint:disable:no-unused-variable member-ordering */ + */ /* tslint:disable:no-unused-variable member-ordering */ -import {Inject, Injectable, Optional} from '@angular/core'; -import {HttpClient, HttpEvent, HttpHeaders, HttpResponse} from '@angular/common/http'; +import { Inject, Injectable, Optional } from '@angular/core'; +import { HttpClient, HttpEvent, HttpHeaders, HttpResponse } from '@angular/common/http'; -import {Observable} from 'rxjs'; +import { Observable } from 'rxjs'; -import {PdfMetaData} from '../model/pdfMetaData'; - -import {BASE_PATH} from '../variables'; -import {Configuration} from '../configuration'; +import { PdfMetaData } from '../model/pdfMetaData'; +import { BASE_PATH } from '../variables'; +import { Configuration } from '../configuration'; @Injectable() export class PdfMetaDataConfigurationControllerService { + public defaultHeaders = new HttpHeaders(); + public configuration = new Configuration(); + protected basePath = ''; - public defaultHeaders = new HttpHeaders(); - public configuration = new Configuration(); - protected basePath = ''; - - constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { - if (basePath) { - this.basePath = basePath; - } - if (configuration) { - this.configuration = configuration; - this.basePath = basePath || configuration.basePath || this.basePath; - } - } - - /** - * Get the currently configured meta data that will be included in the redacted pdf. - * None - * @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 getPdfMetaData(observe?: 'body', reportProgress?: boolean): Observable; - - public getPdfMetaData(observe?: 'response', reportProgress?: boolean): Observable>; - - public getPdfMetaData(observe?: 'events', reportProgress?: boolean): Observable>; - - public getPdfMetaData(observe: any = 'body', reportProgress: boolean = false): Observable { - - let headers = this.defaultHeaders; - - // authentication (RED-OAUTH) required - if (this.configuration.accessToken) { - const accessToken = typeof this.configuration.accessToken === 'function' - ? this.configuration.accessToken() - : this.configuration.accessToken; - headers = headers.set('Authorization', 'Bearer ' + accessToken); + constructor( + protected httpClient: HttpClient, + @Optional() @Inject(BASE_PATH) basePath: string, + @Optional() configuration: Configuration + ) { + if (basePath) { + this.basePath = basePath; + } + if (configuration) { + this.configuration = configuration; + this.basePath = basePath || configuration.basePath || this.basePath; + } } - // to determine the Accept header - const httpHeaderAccepts: string[] = [ - 'application/json' - ]; - const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected !== undefined) { - headers = headers.set('Accept', httpHeaderAcceptSelected); + /** + * Get the currently configured meta data that will be included in the redacted pdf. + * None + * @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 getPdfMetaData(observe?: 'body', reportProgress?: boolean): Observable; + + public getPdfMetaData( + observe?: 'response', + reportProgress?: boolean + ): Observable>; + + public getPdfMetaData( + observe?: 'events', + reportProgress?: boolean + ): Observable>; + + public getPdfMetaData(observe: any = 'body', reportProgress: boolean = false): Observable { + let headers = this.defaultHeaders; + + // authentication (RED-OAUTH) required + if (this.configuration.accessToken) { + const 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 + ); + if (httpHeaderAcceptSelected !== undefined) { + headers = headers.set('Accept', httpHeaderAcceptSelected); + } + + // to determine the Content-Type header + const consumes: string[] = []; + + return this.httpClient.request('get', `${this.basePath}/metaData`, { + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + }); } - // to determine the Content-Type header - const consumes: string[] = []; + /** + * Configured which meta data will be included in the redacted pdf. + * None + * @param body pdfMetaData + * @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 setPdfMetaData( + body: PdfMetaData, + observe?: 'body', + reportProgress?: boolean + ): Observable; - return this.httpClient.request('get', `${this.basePath}/metaData`, - { - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } + public setPdfMetaData( + body: PdfMetaData, + observe?: 'response', + reportProgress?: boolean + ): Observable>; - /** - * Configured which meta data will be included in the redacted pdf. - * None - * @param body pdfMetaData - * @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 setPdfMetaData(body: PdfMetaData, observe?: 'body', reportProgress?: boolean): Observable; + public setPdfMetaData( + body: PdfMetaData, + observe?: 'events', + reportProgress?: boolean + ): Observable>; - public setPdfMetaData(body: PdfMetaData, observe?: 'response', reportProgress?: boolean): Observable>; + public setPdfMetaData( + body: PdfMetaData, + observe: any = 'body', + reportProgress: boolean = false + ): Observable { + if (body === null || body === undefined) { + throw new Error( + 'Required parameter body was null or undefined when calling setPdfMetaData.' + ); + } - public setPdfMetaData(body: PdfMetaData, observe?: 'events', reportProgress?: boolean): Observable>; + let headers = this.defaultHeaders; - public setPdfMetaData(body: PdfMetaData, observe: any = 'body', reportProgress: boolean = false): Observable { + // authentication (RED-OAUTH) required + if (this.configuration.accessToken) { + const accessToken = + typeof this.configuration.accessToken === 'function' + ? this.configuration.accessToken() + : this.configuration.accessToken; + headers = headers.set('Authorization', 'Bearer ' + accessToken); + } - if (body === null || body === undefined) { - throw new Error('Required parameter body was null or undefined when calling setPdfMetaData.'); + // to determine the Accept header + const httpHeaderAccepts: string[] = []; + 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('post', `${this.basePath}/metaData`, { + body: body, + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + }); } - let headers = this.defaultHeaders; - - // authentication (RED-OAUTH) required - if (this.configuration.accessToken) { - const accessToken = typeof this.configuration.accessToken === 'function' - ? this.configuration.accessToken() - : this.configuration.accessToken; - headers = headers.set('Authorization', 'Bearer ' + accessToken); + /** + * @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; } - - // to determine the Accept header - const httpHeaderAccepts: string[] = []; - 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('post', `${this.basePath}/metaData`, - { - body: body, - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * @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; - } - } diff --git a/libs/red-ui-http/src/lib/api/projectController.service.ts b/libs/red-ui-http/src/lib/api/projectController.service.ts index 20ca8b7cb..302a311bb 100644 --- a/libs/red-ui-http/src/lib/api/projectController.service.ts +++ b/libs/red-ui-http/src/lib/api/projectController.service.ts @@ -8,242 +8,304 @@ * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. - *//* tslint:disable:no-unused-variable member-ordering */ + */ /* tslint:disable:no-unused-variable member-ordering */ -import {Inject, Injectable, Optional} from '@angular/core'; -import {HttpClient, HttpEvent, HttpHeaders, HttpResponse} from '@angular/common/http'; +import { Inject, Injectable, Optional } from '@angular/core'; +import { HttpClient, HttpEvent, HttpHeaders, HttpResponse } from '@angular/common/http'; -import {Observable} from 'rxjs'; +import { Observable } from 'rxjs'; -import {Project} from '../model/project'; -import {ProjectRequest} from '../model/projectRequest'; - -import {BASE_PATH} from '../variables'; -import {Configuration} from '../configuration'; +import { Project } from '../model/project'; +import { ProjectRequest } from '../model/projectRequest'; +import { BASE_PATH } from '../variables'; +import { Configuration } from '../configuration'; @Injectable() export class ProjectControllerService { + protected basePath = ''; + public defaultHeaders = new HttpHeaders(); + public configuration = new Configuration(); - protected basePath = ''; - public defaultHeaders = new HttpHeaders(); - public configuration = new Configuration(); - - constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { - if (basePath) { - this.basePath = basePath; - } - if (configuration) { - this.configuration = configuration; - this.basePath = basePath || configuration.basePath || this.basePath; - } - } - - /** - * @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; - } - - - /** - * Creates or update a project. - * None - * @param body project - * @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 createProjectOrUpdateProject(body: ProjectRequest, observe?: 'body', reportProgress?: boolean): Observable; - public createProjectOrUpdateProject(body: ProjectRequest, observe?: 'response', reportProgress?: boolean): Observable>; - public createProjectOrUpdateProject(body: ProjectRequest, observe?: 'events', reportProgress?: boolean): Observable>; - public createProjectOrUpdateProject(body: ProjectRequest, observe: any = 'body', reportProgress: boolean = false): Observable { - - if (body === null || body === undefined) { - throw new Error('Required parameter body was null or undefined when calling createProjectOrUpdateProject.'); + constructor( + protected httpClient: HttpClient, + @Optional() @Inject(BASE_PATH) basePath: string, + @Optional() configuration: Configuration + ) { + if (basePath) { + this.basePath = basePath; + } + if (configuration) { + this.configuration = configuration; + this.basePath = basePath || configuration.basePath || this.basePath; + } } - let headers = this.defaultHeaders; - - // authentication (RED-OAUTH) required - if (this.configuration.accessToken) { - const accessToken = typeof this.configuration.accessToken === 'function' - ? this.configuration.accessToken() - : this.configuration.accessToken; - headers = headers.set('Authorization', 'Bearer ' + accessToken); + /** + * @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; } - // to determine the Accept header - const httpHeaderAccepts: string[] = [ - 'application/json' - ]; - const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected !== undefined) { - headers = headers.set('Accept', httpHeaderAcceptSelected); + /** + * Creates or update a project. + * None + * @param body project + * @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 createProjectOrUpdateProject( + body: ProjectRequest, + observe?: 'body', + reportProgress?: boolean + ): Observable; + public createProjectOrUpdateProject( + body: ProjectRequest, + observe?: 'response', + reportProgress?: boolean + ): Observable>; + public createProjectOrUpdateProject( + body: ProjectRequest, + observe?: 'events', + reportProgress?: boolean + ): Observable>; + public createProjectOrUpdateProject( + body: ProjectRequest, + observe: any = 'body', + reportProgress: boolean = false + ): Observable { + if (body === null || body === undefined) { + throw new Error( + 'Required parameter body was null or undefined when calling createProjectOrUpdateProject.' + ); + } + + let headers = this.defaultHeaders; + + // authentication (RED-OAUTH) required + if (this.configuration.accessToken) { + const 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 + ); + 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('post', `${this.basePath}/project`, { + body: body, + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + }); } - // 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); + /** + * Deletes an existing project. + * None + * @param projectId projectId + * @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 deleteProject( + projectId: string, + observe?: 'body', + reportProgress?: boolean + ): Observable; + public deleteProject( + projectId: string, + observe?: 'response', + reportProgress?: boolean + ): Observable>; + public deleteProject( + projectId: string, + observe?: 'events', + reportProgress?: boolean + ): Observable>; + public deleteProject( + projectId: string, + observe: any = 'body', + reportProgress: boolean = false + ): Observable { + if (projectId === null || projectId === undefined) { + throw new Error( + 'Required parameter projectId was null or undefined when calling deleteProject.' + ); + } + + let headers = this.defaultHeaders; + + // authentication (RED-OAUTH) required + if (this.configuration.accessToken) { + const 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 + ); + if (httpHeaderAcceptSelected !== undefined) { + headers = headers.set('Accept', httpHeaderAcceptSelected); + } + + // to determine the Content-Type header + const consumes: string[] = []; + + return this.httpClient.request( + 'delete', + `${this.basePath}/project/${encodeURIComponent(String(projectId))}`, + { + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + } + ); } - return this.httpClient.request('post', `${this.basePath}/project`, - { - body: body, - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } + /** + * Gets an existing project. + * None + * @param projectId projectId + * @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 getProject( + projectId: string, + observe?: 'body', + reportProgress?: boolean + ): Observable; + public getProject( + projectId: string, + observe?: 'response', + reportProgress?: boolean + ): Observable>; + public getProject( + projectId: string, + observe?: 'events', + reportProgress?: boolean + ): Observable>; + public getProject( + projectId: string, + observe: any = 'body', + reportProgress: boolean = false + ): Observable { + if (projectId === null || projectId === undefined) { + throw new Error( + 'Required parameter projectId was null or undefined when calling getProject.' + ); + } - /** - * Deletes an existing project. - * None - * @param projectId projectId - * @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 deleteProject(projectId: string, observe?: 'body', reportProgress?: boolean): Observable; - public deleteProject(projectId: string, observe?: 'response', reportProgress?: boolean): Observable>; - public deleteProject(projectId: string, observe?: 'events', reportProgress?: boolean): Observable>; - public deleteProject(projectId: string, observe: any = 'body', reportProgress: boolean = false): Observable { + let headers = this.defaultHeaders; - if (projectId === null || projectId === undefined) { - throw new Error('Required parameter projectId was null or undefined when calling deleteProject.'); + // authentication (RED-OAUTH) required + if (this.configuration.accessToken) { + const 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 + ); + if (httpHeaderAcceptSelected !== undefined) { + headers = headers.set('Accept', httpHeaderAcceptSelected); + } + + // to determine the Content-Type header + const consumes: string[] = []; + + return this.httpClient.request( + 'get', + `${this.basePath}/project/${encodeURIComponent(String(projectId))}`, + { + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + } + ); } - let headers = this.defaultHeaders; + /** + * Gets all existing projects. + * None + * @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 getProjects(observe?: 'body', reportProgress?: boolean): Observable>; + public getProjects( + observe?: 'response', + reportProgress?: boolean + ): Observable>>; + public getProjects( + observe?: 'events', + reportProgress?: boolean + ): Observable>>; + public getProjects(observe: any = 'body', reportProgress: boolean = false): Observable { + let headers = this.defaultHeaders; - // authentication (RED-OAUTH) required - if (this.configuration.accessToken) { - const accessToken = typeof this.configuration.accessToken === 'function' - ? this.configuration.accessToken() - : this.configuration.accessToken; - headers = headers.set('Authorization', 'Bearer ' + accessToken); + // authentication (RED-OAUTH) required + if (this.configuration.accessToken) { + const 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 + ); + if (httpHeaderAcceptSelected !== undefined) { + headers = headers.set('Accept', httpHeaderAcceptSelected); + } + + // to determine the Content-Type header + const consumes: string[] = []; + + return this.httpClient.request>('get', `${this.basePath}/project`, { + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + }); } - - // to determine the Accept header - const httpHeaderAccepts: string[] = []; - 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[] = []; - - return this.httpClient.request('delete', `${this.basePath}/project/${encodeURIComponent(String(projectId))}`, - { - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * Gets an existing project. - * None - * @param projectId projectId - * @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 getProject(projectId: string, observe?: 'body', reportProgress?: boolean): Observable; - public getProject(projectId: string, observe?: 'response', reportProgress?: boolean): Observable>; - public getProject(projectId: string, observe?: 'events', reportProgress?: boolean): Observable>; - public getProject(projectId: string, observe: any = 'body', reportProgress: boolean = false): Observable { - - if (projectId === null || projectId === undefined) { - throw new Error('Required parameter projectId was null or undefined when calling getProject.'); - } - - let headers = this.defaultHeaders; - - // authentication (RED-OAUTH) required - if (this.configuration.accessToken) { - const 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); - if (httpHeaderAcceptSelected !== undefined) { - headers = headers.set('Accept', httpHeaderAcceptSelected); - } - - // to determine the Content-Type header - const consumes: string[] = []; - - return this.httpClient.request('get', `${this.basePath}/project/${encodeURIComponent(String(projectId))}`, - { - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * Gets all existing projects. - * None - * @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 getProjects(observe?: 'body', reportProgress?: boolean): Observable>; - public getProjects(observe?: 'response', reportProgress?: boolean): Observable>>; - public getProjects(observe?: 'events', reportProgress?: boolean): Observable>>; - public getProjects(observe: any = 'body', reportProgress: boolean = false): Observable { - - let headers = this.defaultHeaders; - - // authentication (RED-OAUTH) required - if (this.configuration.accessToken) { - const 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); - if (httpHeaderAcceptSelected !== undefined) { - headers = headers.set('Accept', httpHeaderAcceptSelected); - } - - // to determine the Content-Type header - const consumes: string[] = []; - - return this.httpClient.request>('get', `${this.basePath}/project`, - { - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } - } diff --git a/libs/red-ui-http/src/lib/api/reanalysisController.service.ts b/libs/red-ui-http/src/lib/api/reanalysisController.service.ts index 2f4f47807..91bc8f812 100644 --- a/libs/red-ui-http/src/lib/api/reanalysisController.service.ts +++ b/libs/red-ui-http/src/lib/api/reanalysisController.service.ts @@ -8,150 +8,202 @@ * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. - *//* tslint:disable:no-unused-variable member-ordering */ + */ /* tslint:disable:no-unused-variable member-ordering */ -import {Inject, Injectable, Optional} from '@angular/core'; -import {HttpClient, HttpEvent, HttpHeaders, HttpResponse} from '@angular/common/http'; +import { Inject, Injectable, Optional } from '@angular/core'; +import { HttpClient, HttpEvent, HttpHeaders, HttpResponse } from '@angular/common/http'; -import {Observable} from 'rxjs'; - - -import {BASE_PATH} from '../variables'; -import {Configuration} from '../configuration'; +import { Observable } from 'rxjs'; +import { BASE_PATH } from '../variables'; +import { Configuration } from '../configuration'; @Injectable() export class ReanalysisControllerService { + public defaultHeaders = new HttpHeaders(); + public configuration = new Configuration(); + protected basePath = ''; - public defaultHeaders = new HttpHeaders(); - public configuration = new Configuration(); - protected basePath = ''; - - constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { - if (basePath) { - this.basePath = basePath; - } - if (configuration) { - this.configuration = configuration; - this.basePath = basePath || configuration.basePath || this.basePath; - } - } - - /** - * Reanalyze a file - * None - * @param projectId projectId - * @param fileId fileId - * @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 reanalyzeFile(projectId: string, fileId: string, observe?: 'body', reportProgress?: boolean): Observable; - - public reanalyzeFile(projectId: string, fileId: string, observe?: 'response', reportProgress?: boolean): Observable>; - - public reanalyzeFile(projectId: string, fileId: string, observe?: 'events', reportProgress?: boolean): Observable>; - - public reanalyzeFile(projectId: string, fileId: string, observe: any = 'body', reportProgress: boolean = false): Observable { - - if (projectId === null || projectId === undefined) { - throw new Error('Required parameter projectId was null or undefined when calling reanalyzeFile.'); + constructor( + protected httpClient: HttpClient, + @Optional() @Inject(BASE_PATH) basePath: string, + @Optional() configuration: Configuration + ) { + if (basePath) { + this.basePath = basePath; + } + if (configuration) { + this.configuration = configuration; + this.basePath = basePath || configuration.basePath || this.basePath; + } } - if (fileId === null || fileId === undefined) { - throw new Error('Required parameter fileId was null or undefined when calling reanalyzeFile.'); + /** + * Reanalyze a file + * None + * @param projectId projectId + * @param fileId fileId + * @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 reanalyzeFile( + projectId: string, + fileId: string, + observe?: 'body', + reportProgress?: boolean + ): Observable; + + public reanalyzeFile( + projectId: string, + fileId: string, + observe?: 'response', + reportProgress?: boolean + ): Observable>; + + public reanalyzeFile( + projectId: string, + fileId: string, + observe?: 'events', + reportProgress?: boolean + ): Observable>; + + public reanalyzeFile( + projectId: string, + fileId: string, + observe: any = 'body', + reportProgress: boolean = false + ): Observable { + if (projectId === null || projectId === undefined) { + throw new Error( + 'Required parameter projectId was null or undefined when calling reanalyzeFile.' + ); + } + + if (fileId === null || fileId === undefined) { + throw new Error( + 'Required parameter fileId was null or undefined when calling reanalyzeFile.' + ); + } + + let headers = this.defaultHeaders; + + // authentication (RED-OAUTH) required + if (this.configuration.accessToken) { + const 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 + ); + if (httpHeaderAcceptSelected !== undefined) { + headers = headers.set('Accept', httpHeaderAcceptSelected); + } + + // to determine the Content-Type header + const consumes: string[] = []; + + return this.httpClient.request( + 'post', + `${this.basePath}/reanalyze/${encodeURIComponent( + String(projectId) + )}/${encodeURIComponent(String(fileId))}`, + { + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + } + ); } - let headers = this.defaultHeaders; + /** + * Reanalyze all files of the project. + * None + * @param projectId projectId + * @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 reanalyzeProject( + projectId: string, + observe?: 'body', + reportProgress?: boolean + ): Observable; - // authentication (RED-OAUTH) required - if (this.configuration.accessToken) { - const accessToken = typeof this.configuration.accessToken === 'function' - ? this.configuration.accessToken() - : this.configuration.accessToken; - headers = headers.set('Authorization', 'Bearer ' + accessToken); + public reanalyzeProject( + projectId: string, + observe?: 'response', + reportProgress?: boolean + ): Observable>; + + public reanalyzeProject( + projectId: string, + observe?: 'events', + reportProgress?: boolean + ): Observable>; + + public reanalyzeProject( + projectId: string, + observe: any = 'body', + reportProgress: boolean = false + ): Observable { + if (projectId === null || projectId === undefined) { + throw new Error( + 'Required parameter projectId was null or undefined when calling reanalyzeProject.' + ); + } + + let headers = this.defaultHeaders; + + // authentication (RED-OAUTH) required + if (this.configuration.accessToken) { + const 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 + ); + if (httpHeaderAcceptSelected !== undefined) { + headers = headers.set('Accept', httpHeaderAcceptSelected); + } + + // to determine the Content-Type header + const consumes: string[] = []; + + return this.httpClient.request( + 'post', + `${this.basePath}/reanalyze/${encodeURIComponent(String(projectId))}`, + { + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + } + ); } - // to determine the Accept header - const httpHeaderAccepts: string[] = []; - const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected !== undefined) { - headers = headers.set('Accept', httpHeaderAcceptSelected); + /** + * @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; } - - // to determine the Content-Type header - const consumes: string[] = []; - - return this.httpClient.request('post', `${this.basePath}/reanalyze/${encodeURIComponent(String(projectId))}/${encodeURIComponent(String(fileId))}`, - { - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * Reanalyze all files of the project. - * None - * @param projectId projectId - * @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 reanalyzeProject(projectId: string, observe?: 'body', reportProgress?: boolean): Observable; - - public reanalyzeProject(projectId: string, observe?: 'response', reportProgress?: boolean): Observable>; - - public reanalyzeProject(projectId: string, observe?: 'events', reportProgress?: boolean): Observable>; - - public reanalyzeProject(projectId: string, observe: any = 'body', reportProgress: boolean = false): Observable { - - if (projectId === null || projectId === undefined) { - throw new Error('Required parameter projectId was null or undefined when calling reanalyzeProject.'); - } - - let headers = this.defaultHeaders; - - // authentication (RED-OAUTH) required - if (this.configuration.accessToken) { - const 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); - if (httpHeaderAcceptSelected !== undefined) { - headers = headers.set('Accept', httpHeaderAcceptSelected); - } - - // to determine the Content-Type header - const consumes: string[] = []; - - return this.httpClient.request('post', `${this.basePath}/reanalyze/${encodeURIComponent(String(projectId))}`, - { - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * @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; - } - } diff --git a/libs/red-ui-http/src/lib/api/redactionLogController.service.ts b/libs/red-ui-http/src/lib/api/redactionLogController.service.ts index b2ffaf57b..018520a15 100644 --- a/libs/red-ui-http/src/lib/api/redactionLogController.service.ts +++ b/libs/red-ui-http/src/lib/api/redactionLogController.service.ts @@ -8,99 +8,120 @@ * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. - *//* tslint:disable:no-unused-variable member-ordering */ + */ /* tslint:disable:no-unused-variable member-ordering */ -import {Inject, Injectable, Optional} from '@angular/core'; -import {HttpClient, HttpEvent, HttpHeaders, HttpResponse} from '@angular/common/http'; +import { Inject, Injectable, Optional } from '@angular/core'; +import { HttpClient, HttpEvent, HttpHeaders, HttpResponse } from '@angular/common/http'; -import {Observable} from 'rxjs'; +import { Observable } from 'rxjs'; -import {RedactionLog} from '../model/redactionLog'; - -import {BASE_PATH} from '../variables'; -import {Configuration} from '../configuration'; +import { RedactionLog } from '../model/redactionLog'; +import { BASE_PATH } from '../variables'; +import { Configuration } from '../configuration'; @Injectable() export class RedactionLogControllerService { + public defaultHeaders = new HttpHeaders(); + public configuration = new Configuration(); + protected basePath = ''; - public defaultHeaders = new HttpHeaders(); - public configuration = new Configuration(); - protected basePath = ''; - - constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { - if (basePath) { - this.basePath = basePath; - } - if (configuration) { - this.configuration = configuration; - this.basePath = basePath || configuration.basePath || this.basePath; - } - } - - /** - * Gets the redaction log for a fileId - * None - * @param fileId fileId - * @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 getRedactionLog(fileId: string, observe?: 'body', reportProgress?: boolean): Observable; - - public getRedactionLog(fileId: string, observe?: 'response', reportProgress?: boolean): Observable>; - - public getRedactionLog(fileId: string, observe?: 'events', reportProgress?: boolean): Observable>; - - public getRedactionLog(fileId: string, observe: any = 'body', reportProgress: boolean = false): Observable { - - if (fileId === null || fileId === undefined) { - throw new Error('Required parameter fileId was null or undefined when calling getRedactionLog.'); + constructor( + protected httpClient: HttpClient, + @Optional() @Inject(BASE_PATH) basePath: string, + @Optional() configuration: Configuration + ) { + if (basePath) { + this.basePath = basePath; + } + if (configuration) { + this.configuration = configuration; + this.basePath = basePath || configuration.basePath || this.basePath; + } } - let headers = this.defaultHeaders; + /** + * Gets the redaction log for a fileId + * None + * @param fileId fileId + * @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 getRedactionLog( + fileId: string, + observe?: 'body', + reportProgress?: boolean + ): Observable; - // authentication (RED-OAUTH) required - if (this.configuration.accessToken) { - const accessToken = typeof this.configuration.accessToken === 'function' - ? this.configuration.accessToken() - : this.configuration.accessToken; - headers = headers.set('Authorization', 'Bearer ' + accessToken); + public getRedactionLog( + fileId: string, + observe?: 'response', + reportProgress?: boolean + ): Observable>; + + public getRedactionLog( + fileId: string, + observe?: 'events', + reportProgress?: boolean + ): Observable>; + + public getRedactionLog( + fileId: string, + observe: any = 'body', + reportProgress: boolean = false + ): Observable { + if (fileId === null || fileId === undefined) { + throw new Error( + 'Required parameter fileId was null or undefined when calling getRedactionLog.' + ); + } + + let headers = this.defaultHeaders; + + // authentication (RED-OAUTH) required + if (this.configuration.accessToken) { + const 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 + ); + if (httpHeaderAcceptSelected !== undefined) { + headers = headers.set('Accept', httpHeaderAcceptSelected); + } + + // to determine the Content-Type header + const consumes: string[] = []; + + return this.httpClient.request( + 'get', + `${this.basePath}/redactionLog/${encodeURIComponent(String(fileId))}`, + { + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + } + ); } - // to determine the Accept header - const httpHeaderAccepts: string[] = [ - 'application/json' - ]; - const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected !== undefined) { - headers = headers.set('Accept', httpHeaderAcceptSelected); + /** + * @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; } - - // to determine the Content-Type header - const consumes: string[] = []; - - return this.httpClient.request('get', `${this.basePath}/redactionLog/${encodeURIComponent(String(fileId))}`, - { - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * @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; - } - } diff --git a/libs/red-ui-http/src/lib/api/rulesController.service.ts b/libs/red-ui-http/src/lib/api/rulesController.service.ts index 076f74e9d..9a651b498 100644 --- a/libs/red-ui-http/src/lib/api/rulesController.service.ts +++ b/libs/red-ui-http/src/lib/api/rulesController.service.ts @@ -8,267 +8,309 @@ * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. - *//* tslint:disable:no-unused-variable member-ordering */ + */ /* tslint:disable:no-unused-variable member-ordering */ -import {Inject, Injectable, Optional} from '@angular/core'; -import {HttpClient, HttpEvent, HttpHeaders, HttpParams, HttpResponse} from '@angular/common/http'; -import {CustomHttpUrlEncodingCodec} from '../encoder'; +import { Inject, Injectable, Optional } from '@angular/core'; +import { HttpClient, HttpEvent, HttpHeaders, HttpParams, HttpResponse } from '@angular/common/http'; +import { CustomHttpUrlEncodingCodec } from '../encoder'; -import {Observable} from 'rxjs'; +import { Observable } from 'rxjs'; -import {Rules} from '../model/rules'; - -import {BASE_PATH} from '../variables'; -import {Configuration} from '../configuration'; +import { Rules } from '../model/rules'; +import { BASE_PATH } from '../variables'; +import { Configuration } from '../configuration'; @Injectable() export class RulesControllerService { + public defaultHeaders = new HttpHeaders(); + public configuration = new Configuration(); + protected basePath = ''; - public defaultHeaders = new HttpHeaders(); - public configuration = new Configuration(); - protected basePath = ''; - - constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { - if (basePath) { - this.basePath = basePath; - } - if (configuration) { - this.configuration = configuration; - this.basePath = basePath || configuration.basePath || this.basePath; - } - } - - /** - * Returns object containing the currently used Drools rules. - * - * @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 downloadRules(observe?: 'body', reportProgress?: boolean): Observable; - - public downloadRules(observe?: 'response', reportProgress?: boolean): Observable>; - - public downloadRules(observe?: 'events', reportProgress?: boolean): Observable>; - - public downloadRules(observe: any = 'body', reportProgress: boolean = false): Observable { - - let headers = this.defaultHeaders; - - // authentication (RED-OAUTH) required - if (this.configuration.accessToken) { - const accessToken = typeof this.configuration.accessToken === 'function' - ? this.configuration.accessToken() - : this.configuration.accessToken; - headers = headers.set('Authorization', 'Bearer ' + accessToken); + constructor( + protected httpClient: HttpClient, + @Optional() @Inject(BASE_PATH) basePath: string, + @Optional() configuration: Configuration + ) { + if (basePath) { + this.basePath = basePath; + } + if (configuration) { + this.configuration = configuration; + this.basePath = basePath || configuration.basePath || this.basePath; + } } - // to determine the Accept header - const httpHeaderAccepts: string[] = [ - 'application/json' - ]; - const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected !== undefined) { - headers = headers.set('Accept', httpHeaderAcceptSelected); + /** + * Returns object containing the currently used Drools rules. + * + * @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 downloadRules(observe?: 'body', reportProgress?: boolean): Observable; + + public downloadRules( + observe?: 'response', + reportProgress?: boolean + ): Observable>; + + public downloadRules( + observe?: 'events', + reportProgress?: boolean + ): Observable>; + + public downloadRules(observe: any = 'body', reportProgress: boolean = false): Observable { + let headers = this.defaultHeaders; + + // authentication (RED-OAUTH) required + if (this.configuration.accessToken) { + const 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 + ); + if (httpHeaderAcceptSelected !== undefined) { + headers = headers.set('Accept', httpHeaderAcceptSelected); + } + + // to determine the Content-Type header + const consumes: string[] = []; + + return this.httpClient.request('get', `${this.basePath}/rules`, { + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + }); } - // to determine the Content-Type header - const consumes: string[] = []; + /** + * Returns file containing the currently used Drools rules. + * + * @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 downloadRulesFile(observe?: 'body', reportProgress?: boolean): Observable; - return this.httpClient.request('get', `${this.basePath}/rules`, - { - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } + public downloadRulesFile( + observe?: 'response', + reportProgress?: boolean + ): Observable>; - /** - * Returns file containing the currently used Drools rules. - * - * @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 downloadRulesFile(observe?: 'body', reportProgress?: boolean): Observable; + public downloadRulesFile( + observe?: 'events', + reportProgress?: boolean + ): Observable>; - public downloadRulesFile(observe?: 'response', reportProgress?: boolean): Observable>; + public downloadRulesFile( + observe: any = 'body', + reportProgress: boolean = false + ): Observable { + let headers = this.defaultHeaders; - public downloadRulesFile(observe?: 'events', reportProgress?: boolean): Observable>; + // authentication (RED-OAUTH) required + if (this.configuration.accessToken) { + const accessToken = + typeof this.configuration.accessToken === 'function' + ? this.configuration.accessToken() + : this.configuration.accessToken; + headers = headers.set('Authorization', 'Bearer ' + accessToken); + } - public downloadRulesFile(observe: any = 'body', reportProgress: boolean = false): Observable { + // to determine the Accept header + const httpHeaderAccepts: string[] = ['application/octet-stream']; + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept( + httpHeaderAccepts + ); + if (httpHeaderAcceptSelected !== undefined) { + headers = headers.set('Accept', httpHeaderAcceptSelected); + } - let headers = this.defaultHeaders; + // to determine the Content-Type header + const consumes: string[] = []; - // authentication (RED-OAUTH) required - if (this.configuration.accessToken) { - const accessToken = typeof this.configuration.accessToken === 'function' - ? this.configuration.accessToken() - : this.configuration.accessToken; - headers = headers.set('Authorization', 'Bearer ' + accessToken); + return this.httpClient.request('get', `${this.basePath}/rules/download`, { + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + }); } - // to determine the Accept header - const httpHeaderAccepts: string[] = [ - 'application/octet-stream' - ]; - const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected !== undefined) { - headers = headers.set('Accept', httpHeaderAcceptSelected); + /** + * Takes object containing string or rules as argument, which will be used by the redaction service. + * + * @param body rules + * @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 uploadRules(body: Rules, observe?: 'body', reportProgress?: boolean): Observable; + + public uploadRules( + body: Rules, + observe?: 'response', + reportProgress?: boolean + ): Observable>; + + public uploadRules( + body: Rules, + observe?: 'events', + reportProgress?: boolean + ): Observable>; + + public uploadRules( + body: Rules, + observe: any = 'body', + reportProgress: boolean = false + ): Observable { + if (body === null || body === undefined) { + throw new Error( + 'Required parameter body was null or undefined when calling uploadRules.' + ); + } + + let headers = this.defaultHeaders; + + // authentication (RED-OAUTH) required + if (this.configuration.accessToken) { + const 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 + ); + 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('post', `${this.basePath}/rules`, { + body: body, + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + }); } - // to determine the Content-Type header - const consumes: string[] = []; + /** + * Takes object containing string or rules as argument, which will be used by the redaction service. + * + * @param file + * @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 uploadRulesFileForm( + file: Blob, + observe?: 'body', + reportProgress?: boolean + ): Observable; - return this.httpClient.request('get', `${this.basePath}/rules/download`, - { - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } + public uploadRulesFileForm( + file: Blob, + observe?: 'response', + reportProgress?: boolean + ): Observable>; - /** - * Takes object containing string or rules as argument, which will be used by the redaction service. - * - * @param body rules - * @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 uploadRules(body: Rules, observe?: 'body', reportProgress?: boolean): Observable; + public uploadRulesFileForm( + file: Blob, + observe?: 'events', + reportProgress?: boolean + ): Observable>; - public uploadRules(body: Rules, observe?: 'response', reportProgress?: boolean): Observable>; + public uploadRulesFileForm( + file: Blob, + observe: any = 'body', + reportProgress: boolean = false + ): Observable { + if (file === null || file === undefined) { + throw new Error( + 'Required parameter file was null or undefined when calling uploadRulesFile.' + ); + } - public uploadRules(body: Rules, observe?: 'events', reportProgress?: boolean): Observable>; + let headers = this.defaultHeaders; - public uploadRules(body: Rules, observe: any = 'body', reportProgress: boolean = false): Observable { + // authentication (RED-OAUTH) required + if (this.configuration.accessToken) { + const accessToken = + typeof this.configuration.accessToken === 'function' + ? this.configuration.accessToken() + : this.configuration.accessToken; + headers = headers.set('Authorization', 'Bearer ' + accessToken); + } - if (body === null || body === undefined) { - throw new Error('Required parameter body was null or undefined when calling uploadRules.'); + // to determine the Accept header + const httpHeaderAccepts: string[] = []; + 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[] = ['multipart/form-data']; + + const canConsumeForm = this.canConsumeForm(consumes); + + let formParams: { append(param: string, value: any): void }; + let useForm = false; + const convertFormParamsToString = false; + // use FormData to transmit files using content-type "multipart/form-data" + // see https://stackoverflow.com/questions/4007969/application-x-www-form-urlencoded-or-multipart-form-data + useForm = canConsumeForm; + if (useForm) { + formParams = new FormData(); + } else { + formParams = new HttpParams({ encoder: new CustomHttpUrlEncodingCodec() }); + } + + if (file !== undefined) { + formParams = (formParams.append('file', file) as any) || formParams; + } + + return this.httpClient.request('post', `${this.basePath}/rules/upload`, { + body: convertFormParamsToString ? formParams.toString() : formParams, + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + }); } - let headers = this.defaultHeaders; - - // authentication (RED-OAUTH) required - if (this.configuration.accessToken) { - const accessToken = typeof this.configuration.accessToken === 'function' - ? this.configuration.accessToken() - : this.configuration.accessToken; - headers = headers.set('Authorization', 'Bearer ' + accessToken); + /** + * @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; } - - // to determine the Accept header - const httpHeaderAccepts: string[] = []; - 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('post', `${this.basePath}/rules`, - { - body: body, - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * Takes object containing string or rules as argument, which will be used by the redaction service. - * - * @param file - * @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 uploadRulesFileForm(file: Blob, observe?: 'body', reportProgress?: boolean): Observable; - - public uploadRulesFileForm(file: Blob, observe?: 'response', reportProgress?: boolean): Observable>; - - public uploadRulesFileForm(file: Blob, observe?: 'events', reportProgress?: boolean): Observable>; - - public uploadRulesFileForm(file: Blob, observe: any = 'body', reportProgress: boolean = false): Observable { - - if (file === null || file === undefined) { - throw new Error('Required parameter file was null or undefined when calling uploadRulesFile.'); - } - - let headers = this.defaultHeaders; - - // authentication (RED-OAUTH) required - if (this.configuration.accessToken) { - const 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); - if (httpHeaderAcceptSelected !== undefined) { - headers = headers.set('Accept', httpHeaderAcceptSelected); - } - - // to determine the Content-Type header - const consumes: string[] = [ - 'multipart/form-data' - ]; - - const canConsumeForm = this.canConsumeForm(consumes); - - let formParams: { append(param: string, value: any): void; }; - let useForm = false; - const convertFormParamsToString = false; - // use FormData to transmit files using content-type "multipart/form-data" - // see https://stackoverflow.com/questions/4007969/application-x-www-form-urlencoded-or-multipart-form-data - useForm = canConsumeForm; - if (useForm) { - formParams = new FormData(); - } else { - formParams = new HttpParams({encoder: new CustomHttpUrlEncodingCodec()}); - } - - if (file !== undefined) { - formParams = formParams.append('file', file) as any || formParams; - } - - return this.httpClient.request('post', `${this.basePath}/rules/upload`, - { - body: convertFormParamsToString ? formParams.toString() : formParams, - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * @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; - } - } diff --git a/libs/red-ui-http/src/lib/api/statusController.service.ts b/libs/red-ui-http/src/lib/api/statusController.service.ts index 284265f37..633074567 100644 --- a/libs/red-ui-http/src/lib/api/statusController.service.ts +++ b/libs/red-ui-http/src/lib/api/statusController.service.ts @@ -8,255 +8,371 @@ * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. - *//* tslint:disable:no-unused-variable member-ordering */ + */ /* tslint:disable:no-unused-variable member-ordering */ -import {Inject, Injectable, Optional} from '@angular/core'; -import {HttpClient, HttpEvent, HttpHeaders, HttpResponse} from '@angular/common/http'; +import { Inject, Injectable, Optional } from '@angular/core'; +import { HttpClient, HttpEvent, HttpHeaders, HttpResponse } from '@angular/common/http'; -import {Observable} from 'rxjs'; +import { Observable } from 'rxjs'; -import {FileStatus} from '../model/fileStatus'; - -import {BASE_PATH} from '../variables'; -import {Configuration} from '../configuration'; +import { FileStatus } from '../model/fileStatus'; +import { BASE_PATH } from '../variables'; +import { Configuration } from '../configuration'; @Injectable() export class StatusControllerService { + protected basePath = ''; + public defaultHeaders = new HttpHeaders(); + public configuration = new Configuration(); - protected basePath = ''; - public defaultHeaders = new HttpHeaders(); - public configuration = new Configuration(); - - constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { - if (basePath) { - this.basePath = basePath; - } - if (configuration) { - this.configuration = configuration; - this.basePath = basePath || configuration.basePath || this.basePath; - } - } - - /** - * @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; - } - - - /** - * Assigns new owner to project. - * None - * @param projectId projectId - * @param fileId fileId - * @param reviewerId reviewerId - * @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 assignProjectOwner1(projectId: string, fileId: string, reviewerId: string, observe?: 'body', reportProgress?: boolean): Observable; - public assignProjectOwner1(projectId: string, fileId: string, reviewerId: string, observe?: 'response', reportProgress?: boolean): Observable>; - public assignProjectOwner1(projectId: string, fileId: string, reviewerId: string, observe?: 'events', reportProgress?: boolean): Observable>; - public assignProjectOwner1(projectId: string, fileId: string, reviewerId: string, observe: any = 'body', reportProgress: boolean = false): Observable { - - if (projectId === null || projectId === undefined) { - throw new Error('Required parameter projectId was null or undefined when calling assignProjectOwner1.'); + constructor( + protected httpClient: HttpClient, + @Optional() @Inject(BASE_PATH) basePath: string, + @Optional() configuration: Configuration + ) { + if (basePath) { + this.basePath = basePath; + } + if (configuration) { + this.configuration = configuration; + this.basePath = basePath || configuration.basePath || this.basePath; + } } - if (fileId === null || fileId === undefined) { - throw new Error('Required parameter fileId was null or undefined when calling assignProjectOwner1.'); + /** + * @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; } - if (reviewerId === null || reviewerId === undefined) { - throw new Error('Required parameter reviewerId was null or undefined when calling assignProjectOwner1.'); + /** + * Assigns new owner to project. + * None + * @param projectId projectId + * @param fileId fileId + * @param reviewerId reviewerId + * @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 assignProjectOwner1( + projectId: string, + fileId: string, + reviewerId: string, + observe?: 'body', + reportProgress?: boolean + ): Observable; + public assignProjectOwner1( + projectId: string, + fileId: string, + reviewerId: string, + observe?: 'response', + reportProgress?: boolean + ): Observable>; + public assignProjectOwner1( + projectId: string, + fileId: string, + reviewerId: string, + observe?: 'events', + reportProgress?: boolean + ): Observable>; + public assignProjectOwner1( + projectId: string, + fileId: string, + reviewerId: string, + observe: any = 'body', + reportProgress: boolean = false + ): Observable { + if (projectId === null || projectId === undefined) { + throw new Error( + 'Required parameter projectId was null or undefined when calling assignProjectOwner1.' + ); + } + + if (fileId === null || fileId === undefined) { + throw new Error( + 'Required parameter fileId was null or undefined when calling assignProjectOwner1.' + ); + } + + if (reviewerId === null || reviewerId === undefined) { + throw new Error( + 'Required parameter reviewerId was null or undefined when calling assignProjectOwner1.' + ); + } + + let headers = this.defaultHeaders; + + // authentication (RED-OAUTH) required + if (this.configuration.accessToken) { + const 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 + ); + if (httpHeaderAcceptSelected !== undefined) { + headers = headers.set('Accept', httpHeaderAcceptSelected); + } + + // to determine the Content-Type header + const consumes: string[] = []; + + return this.httpClient.request( + 'post', + `${this.basePath}/status/${encodeURIComponent(String(projectId))}/${encodeURIComponent( + String(fileId) + )}/${encodeURIComponent(String(reviewerId))}`, + { + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + } + ); } - let headers = this.defaultHeaders; + /** + * Gets the status for all files in a project. + * None + * @param projectId The id of the project you want the status for. + * @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 getProjectStatus( + projectId: string, + observe?: 'body', + reportProgress?: boolean + ): Observable>; + public getProjectStatus( + projectId: string, + observe?: 'response', + reportProgress?: boolean + ): Observable>>; + public getProjectStatus( + projectId: string, + observe?: 'events', + reportProgress?: boolean + ): Observable>>; + public getProjectStatus( + projectId: string, + observe: any = 'body', + reportProgress: boolean = false + ): Observable { + if (projectId === null || projectId === undefined) { + throw new Error( + 'Required parameter projectId was null or undefined when calling getProjectStatus.' + ); + } - // authentication (RED-OAUTH) required - if (this.configuration.accessToken) { - const accessToken = typeof this.configuration.accessToken === 'function' - ? this.configuration.accessToken() - : this.configuration.accessToken; - headers = headers.set('Authorization', 'Bearer ' + accessToken); + let headers = this.defaultHeaders; + + // authentication (RED-OAUTH) required + if (this.configuration.accessToken) { + const 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 + ); + if (httpHeaderAcceptSelected !== undefined) { + headers = headers.set('Accept', httpHeaderAcceptSelected); + } + + // to determine the Content-Type header + const consumes: string[] = []; + + return this.httpClient.request>( + 'get', + `${this.basePath}/status/${encodeURIComponent(String(projectId))}`, + { + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + } + ); } - // to determine the Accept header - const httpHeaderAccepts: string[] = []; - const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected !== undefined) { - headers = headers.set('Accept', httpHeaderAcceptSelected); + /** + * Sets the status APPROVED for a file. + * None + * @param projectId projectId + * @param fileId fileId + * @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 setStatusApproved( + projectId: string, + fileId: string, + observe?: 'body', + reportProgress?: boolean + ): Observable; + public setStatusApproved( + projectId: string, + fileId: string, + observe?: 'response', + reportProgress?: boolean + ): Observable>; + public setStatusApproved( + projectId: string, + fileId: string, + observe?: 'events', + reportProgress?: boolean + ): Observable>; + public setStatusApproved( + projectId: string, + fileId: string, + observe: any = 'body', + reportProgress: boolean = false + ): Observable { + if (projectId === null || projectId === undefined) { + throw new Error( + 'Required parameter projectId was null or undefined when calling setStatusApproved.' + ); + } + + if (fileId === null || fileId === undefined) { + throw new Error( + 'Required parameter fileId was null or undefined when calling setStatusApproved.' + ); + } + + let headers = this.defaultHeaders; + + // authentication (RED-OAUTH) required + if (this.configuration.accessToken) { + const 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 + ); + if (httpHeaderAcceptSelected !== undefined) { + headers = headers.set('Accept', httpHeaderAcceptSelected); + } + + // to determine the Content-Type header + const consumes: string[] = []; + + return this.httpClient.request( + 'post', + `${this.basePath}/status/approved/${encodeURIComponent( + String(projectId) + )}/${encodeURIComponent(String(fileId))}`, + { + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + } + ); } - // to determine the Content-Type header - const consumes: string[] = []; + /** + * Sets the status UNDER_APPROVAL for a file. + * None + * @param projectId projectId + * @param fileId fileId + * @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 setStatusUnderApproval( + projectId: string, + fileId: string, + observe?: 'body', + reportProgress?: boolean + ): Observable; + public setStatusUnderApproval( + projectId: string, + fileId: string, + observe?: 'response', + reportProgress?: boolean + ): Observable>; + public setStatusUnderApproval( + projectId: string, + fileId: string, + observe?: 'events', + reportProgress?: boolean + ): Observable>; + public setStatusUnderApproval( + projectId: string, + fileId: string, + observe: any = 'body', + reportProgress: boolean = false + ): Observable { + if (projectId === null || projectId === undefined) { + throw new Error( + 'Required parameter projectId was null or undefined when calling setStatusUnderApproval.' + ); + } - return this.httpClient.request('post', `${this.basePath}/status/${encodeURIComponent(String(projectId))}/${encodeURIComponent(String(fileId))}/${encodeURIComponent(String(reviewerId))}`, - { - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } + if (fileId === null || fileId === undefined) { + throw new Error( + 'Required parameter fileId was null or undefined when calling setStatusUnderApproval.' + ); + } - /** - * Gets the status for all files in a project. - * None - * @param projectId The id of the project you want the status for. - * @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 getProjectStatus(projectId: string, observe?: 'body', reportProgress?: boolean): Observable>; - public getProjectStatus(projectId: string, observe?: 'response', reportProgress?: boolean): Observable>>; - public getProjectStatus(projectId: string, observe?: 'events', reportProgress?: boolean): Observable>>; - public getProjectStatus(projectId: string, observe: any = 'body', reportProgress: boolean = false): Observable { + let headers = this.defaultHeaders; - if (projectId === null || projectId === undefined) { - throw new Error('Required parameter projectId was null or undefined when calling getProjectStatus.'); + // authentication (RED-OAUTH) required + if (this.configuration.accessToken) { + const 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 + ); + if (httpHeaderAcceptSelected !== undefined) { + headers = headers.set('Accept', httpHeaderAcceptSelected); + } + + // to determine the Content-Type header + const consumes: string[] = []; + + return this.httpClient.request( + 'post', + `${this.basePath}/status/underapproval/${encodeURIComponent( + String(projectId) + )}/${encodeURIComponent(String(fileId))}`, + { + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + } + ); } - - let headers = this.defaultHeaders; - - // authentication (RED-OAUTH) required - if (this.configuration.accessToken) { - const 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); - if (httpHeaderAcceptSelected !== undefined) { - headers = headers.set('Accept', httpHeaderAcceptSelected); - } - - // to determine the Content-Type header - const consumes: string[] = []; - - return this.httpClient.request>('get', `${this.basePath}/status/${encodeURIComponent(String(projectId))}`, - { - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * Sets the status APPROVED for a file. - * None - * @param projectId projectId - * @param fileId fileId - * @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 setStatusApproved(projectId: string, fileId: string, observe?: 'body', reportProgress?: boolean): Observable; - public setStatusApproved(projectId: string, fileId: string, observe?: 'response', reportProgress?: boolean): Observable>; - public setStatusApproved(projectId: string, fileId: string, observe?: 'events', reportProgress?: boolean): Observable>; - public setStatusApproved(projectId: string, fileId: string, observe: any = 'body', reportProgress: boolean = false): Observable { - - if (projectId === null || projectId === undefined) { - throw new Error('Required parameter projectId was null or undefined when calling setStatusApproved.'); - } - - if (fileId === null || fileId === undefined) { - throw new Error('Required parameter fileId was null or undefined when calling setStatusApproved.'); - } - - let headers = this.defaultHeaders; - - // authentication (RED-OAUTH) required - if (this.configuration.accessToken) { - const 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); - if (httpHeaderAcceptSelected !== undefined) { - headers = headers.set('Accept', httpHeaderAcceptSelected); - } - - // to determine the Content-Type header - const consumes: string[] = []; - - return this.httpClient.request('post', `${this.basePath}/status/approved/${encodeURIComponent(String(projectId))}/${encodeURIComponent(String(fileId))}`, - { - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * Sets the status UNDER_APPROVAL for a file. - * None - * @param projectId projectId - * @param fileId fileId - * @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 setStatusUnderApproval(projectId: string, fileId: string, observe?: 'body', reportProgress?: boolean): Observable; - public setStatusUnderApproval(projectId: string, fileId: string, observe?: 'response', reportProgress?: boolean): Observable>; - public setStatusUnderApproval(projectId: string, fileId: string, observe?: 'events', reportProgress?: boolean): Observable>; - public setStatusUnderApproval(projectId: string, fileId: string, observe: any = 'body', reportProgress: boolean = false): Observable { - - if (projectId === null || projectId === undefined) { - throw new Error('Required parameter projectId was null or undefined when calling setStatusUnderApproval.'); - } - - if (fileId === null || fileId === undefined) { - throw new Error('Required parameter fileId was null or undefined when calling setStatusUnderApproval.'); - } - - let headers = this.defaultHeaders; - - // authentication (RED-OAUTH) required - if (this.configuration.accessToken) { - const 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); - if (httpHeaderAcceptSelected !== undefined) { - headers = headers.set('Accept', httpHeaderAcceptSelected); - } - - // to determine the Content-Type header - const consumes: string[] = []; - - return this.httpClient.request('post', `${this.basePath}/status/underapproval/${encodeURIComponent(String(projectId))}/${encodeURIComponent(String(fileId))}`, - { - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } - } diff --git a/libs/red-ui-http/src/lib/api/userController.service.ts b/libs/red-ui-http/src/lib/api/userController.service.ts index 034b7223f..2347b77a6 100644 --- a/libs/red-ui-http/src/lib/api/userController.service.ts +++ b/libs/red-ui-http/src/lib/api/userController.service.ts @@ -8,424 +8,561 @@ * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. - *//* tslint:disable:no-unused-variable member-ordering */ + */ /* tslint:disable:no-unused-variable member-ordering */ -import {Inject, Injectable, Optional} from '@angular/core'; -import {HttpClient, HttpEvent, HttpHeaders, HttpParams, HttpResponse} from '@angular/common/http'; -import {CustomHttpUrlEncodingCodec} from '../encoder'; +import { Inject, Injectable, Optional } from '@angular/core'; +import { HttpClient, HttpEvent, HttpHeaders, HttpParams, HttpResponse } from '@angular/common/http'; +import { CustomHttpUrlEncodingCodec } from '../encoder'; -import {Observable} from 'rxjs'; +import { Observable } from 'rxjs'; -import {UserRequest} from '../model/userRequest'; -import {UserResponse} from '../model/userResponse'; - -import {BASE_PATH} from '../variables'; -import {Configuration} from '../configuration'; +import { UserRequest } from '../model/userRequest'; +import { UserResponse } from '../model/userResponse'; +import { BASE_PATH } from '../variables'; +import { Configuration } from '../configuration'; @Injectable() export class UserControllerService { + public defaultHeaders = new HttpHeaders(); + public configuration = new Configuration(); + protected basePath = ''; - public defaultHeaders = new HttpHeaders(); - public configuration = new Configuration(); - protected basePath = ''; - - constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { - if (basePath) { - this.basePath = basePath; - } - if (configuration) { - this.configuration = configuration; - this.basePath = basePath || configuration.basePath || this.basePath; - } - } - - /** - * Add admin role to users - * None - * @param body userIds - * @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 addAdminRoleToUsers(body: Array, observe?: 'body', reportProgress?: boolean): Observable; - - public addAdminRoleToUsers(body: Array, observe?: 'response', reportProgress?: boolean): Observable>; - - public addAdminRoleToUsers(body: Array, observe?: 'events', reportProgress?: boolean): Observable>; - - public addAdminRoleToUsers(body: Array, observe: any = 'body', reportProgress: boolean = false): Observable { - - if (body === null || body === undefined) { - throw new Error('Required parameter body was null or undefined when calling addAdminRoleToUsers.'); + constructor( + protected httpClient: HttpClient, + @Optional() @Inject(BASE_PATH) basePath: string, + @Optional() configuration: Configuration + ) { + if (basePath) { + this.basePath = basePath; + } + if (configuration) { + this.configuration = configuration; + this.basePath = basePath || configuration.basePath || this.basePath; + } } - let headers = this.defaultHeaders; + /** + * Add admin role to users + * None + * @param body userIds + * @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 addAdminRoleToUsers( + body: Array, + observe?: 'body', + reportProgress?: boolean + ): Observable; - // authentication (RED-OAUTH) required - if (this.configuration.accessToken) { - const accessToken = typeof this.configuration.accessToken === 'function' - ? this.configuration.accessToken() - : this.configuration.accessToken; - headers = headers.set('Authorization', 'Bearer ' + accessToken); + public addAdminRoleToUsers( + body: Array, + observe?: 'response', + reportProgress?: boolean + ): Observable>; + + public addAdminRoleToUsers( + body: Array, + observe?: 'events', + reportProgress?: boolean + ): Observable>; + + public addAdminRoleToUsers( + body: Array, + observe: any = 'body', + reportProgress: boolean = false + ): Observable { + if (body === null || body === undefined) { + throw new Error( + 'Required parameter body was null or undefined when calling addAdminRoleToUsers.' + ); + } + + let headers = this.defaultHeaders; + + // authentication (RED-OAUTH) required + if (this.configuration.accessToken) { + const 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 + ); + 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('post', `${this.basePath}/user/admin`, { + body: body, + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + }); } - // to determine the Accept header - const httpHeaderAccepts: string[] = []; - const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected !== undefined) { - headers = headers.set('Accept', httpHeaderAcceptSelected); + /** + * Add a role to users + * None + * @param body userIds + * @param role role + * @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 addRoleToUsers( + body: Array, + role: string, + observe?: 'body', + reportProgress?: boolean + ): Observable; + + public addRoleToUsers( + body: Array, + role: string, + observe?: 'response', + reportProgress?: boolean + ): Observable>; + + public addRoleToUsers( + body: Array, + role: string, + observe?: 'events', + reportProgress?: boolean + ): Observable>; + + public addRoleToUsers( + body: Array, + role: string, + observe: any = 'body', + reportProgress: boolean = false + ): Observable { + if (body === null || body === undefined) { + throw new Error( + 'Required parameter body was null or undefined when calling addRoleToUsers.' + ); + } + + if (role === null || role === undefined) { + throw new Error( + 'Required parameter role was null or undefined when calling addRoleToUsers.' + ); + } + + let headers = this.defaultHeaders; + + // authentication (RED-OAUTH) required + if (this.configuration.accessToken) { + const 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 + ); + 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( + 'post', + `${this.basePath}/user/role/${encodeURIComponent(String(role))}`, + { + body: body, + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + } + ); } - // 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); + /** + * Delete admin role from users + * None + * @param body userIds + * @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 deleteAdminRoleFromUsers( + body: Array, + observe?: 'body', + reportProgress?: boolean + ): Observable; + + public deleteAdminRoleFromUsers( + body: Array, + observe?: 'response', + reportProgress?: boolean + ): Observable>; + + public deleteAdminRoleFromUsers( + body: Array, + observe?: 'events', + reportProgress?: boolean + ): Observable>; + + public deleteAdminRoleFromUsers( + body: Array, + observe: any = 'body', + reportProgress: boolean = false + ): Observable { + if (body === null || body === undefined) { + throw new Error( + 'Required parameter body was null or undefined when calling deleteAdminRoleFromUsers.' + ); + } + + let headers = this.defaultHeaders; + + // authentication (RED-OAUTH) required + if (this.configuration.accessToken) { + const 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 + ); + if (httpHeaderAcceptSelected !== undefined) { + headers = headers.set('Accept', httpHeaderAcceptSelected); + } + + // to determine the Content-Type header + const consumes: string[] = ['*/*']; + const httpContentTypeSelected: + | string + | undefined = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected !== undefined) { + headers = headers.set('Content-Type', httpContentTypeSelected); + } + + return this.httpClient.request('delete', `${this.basePath}/user/admin`, { + body: body, + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + }); } - return this.httpClient.request('post', `${this.basePath}/user/admin`, - { - body: body, - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } + /** + * Delete a role from users + * None + * @param body userIds + * @param role role + * @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 deleteRoleFromUsers( + body: Array, + role: string, + observe?: 'body', + reportProgress?: boolean + ): Observable; - /** - * Add a role to users - * None - * @param body userIds - * @param role role - * @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 addRoleToUsers(body: Array, role: string, observe?: 'body', reportProgress?: boolean): Observable; + public deleteRoleFromUsers( + body: Array, + role: string, + observe?: 'response', + reportProgress?: boolean + ): Observable>; - public addRoleToUsers(body: Array, role: string, observe?: 'response', reportProgress?: boolean): Observable>; + public deleteRoleFromUsers( + body: Array, + role: string, + observe?: 'events', + reportProgress?: boolean + ): Observable>; - public addRoleToUsers(body: Array, role: string, observe?: 'events', reportProgress?: boolean): Observable>; + public deleteRoleFromUsers( + body: Array, + role: string, + observe: any = 'body', + reportProgress: boolean = false + ): Observable { + if (body === null || body === undefined) { + throw new Error( + 'Required parameter body was null or undefined when calling deleteRoleFromUsers.' + ); + } - public addRoleToUsers(body: Array, role: string, observe: any = 'body', reportProgress: boolean = false): Observable { + if (role === null || role === undefined) { + throw new Error( + 'Required parameter role was null or undefined when calling deleteRoleFromUsers.' + ); + } - if (body === null || body === undefined) { - throw new Error('Required parameter body was null or undefined when calling addRoleToUsers.'); + let headers = this.defaultHeaders; + + // authentication (RED-OAUTH) required + if (this.configuration.accessToken) { + const 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 + ); + if (httpHeaderAcceptSelected !== undefined) { + headers = headers.set('Accept', httpHeaderAcceptSelected); + } + + // to determine the Content-Type header + const consumes: string[] = ['*/*']; + const httpContentTypeSelected: + | string + | undefined = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected !== undefined) { + headers = headers.set('Content-Type', httpContentTypeSelected); + } + + return this.httpClient.request( + 'delete', + `${this.basePath}/user/role/${encodeURIComponent(String(role))}`, + { + body: body, + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + } + ); } - if (role === null || role === undefined) { - throw new Error('Required parameter role was null or undefined when calling addRoleToUsers.'); + /** + * Gets all the users in realm with information of roles. + * None + * @param body userRequest + * @param offset offset + * @param limit limit + * @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 getAllUsers( + body: UserRequest, + offset?: number, + limit?: number, + observe?: 'body', + reportProgress?: boolean + ): Observable; + + public getAllUsers( + body: UserRequest, + offset?: number, + limit?: number, + observe?: 'response', + reportProgress?: boolean + ): Observable>; + + public getAllUsers( + body: UserRequest, + offset?: number, + limit?: number, + observe?: 'events', + reportProgress?: boolean + ): Observable>; + + public getAllUsers( + body: UserRequest, + offset?: number, + limit?: number, + observe: any = 'body', + reportProgress: boolean = false + ): Observable { + if (body === null || body === undefined) { + throw new Error( + 'Required parameter body was null or undefined when calling getAllUsers.' + ); + } + + let queryParameters = new HttpParams({ encoder: new CustomHttpUrlEncodingCodec() }); + if (offset !== undefined && offset !== null) { + queryParameters = queryParameters.set('offset', offset); + } + if (limit !== undefined && limit !== null) { + queryParameters = queryParameters.set('limit', limit); + } + + let headers = this.defaultHeaders; + + // authentication (RED-OAUTH) required + if (this.configuration.accessToken) { + const 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 + ); + 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('post', `${this.basePath}/user/all`, { + body: body, + params: queryParameters, + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + }); } - let headers = this.defaultHeaders; + /** + * Gets the users who contain redaction roles. + * None + * @param body userRequest + * @param offset offset + * @param limit limit + * @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 getUsers( + body: UserRequest, + offset?: number, + limit?: number, + observe?: 'body', + reportProgress?: boolean + ): Observable; - // authentication (RED-OAUTH) required - if (this.configuration.accessToken) { - const accessToken = typeof this.configuration.accessToken === 'function' - ? this.configuration.accessToken() - : this.configuration.accessToken; - headers = headers.set('Authorization', 'Bearer ' + accessToken); + public getUsers( + body: UserRequest, + offset?: number, + limit?: number, + observe?: 'response', + reportProgress?: boolean + ): Observable>; + + public getUsers( + body: UserRequest, + offset?: number, + limit?: number, + observe?: 'events', + reportProgress?: boolean + ): Observable>; + + public getUsers( + body: UserRequest, + offset?: number, + limit?: number, + observe: any = 'body', + reportProgress: boolean = false + ): Observable { + if (body === null || body === undefined) { + throw new Error('Required parameter body was null or undefined when calling getUsers.'); + } + + let queryParameters = new HttpParams({ encoder: new CustomHttpUrlEncodingCodec() }); + if (offset !== undefined && offset !== null) { + queryParameters = queryParameters.set('offset', offset); + } + if (limit !== undefined && limit !== null) { + queryParameters = queryParameters.set('limit', limit); + } + + let headers = this.defaultHeaders; + + // authentication (RED-OAUTH) required + if (this.configuration.accessToken) { + const 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 + ); + 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('post', `${this.basePath}/user`, { + body: body, + params: queryParameters, + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + }); } - // to determine the Accept header - const httpHeaderAccepts: string[] = []; - const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected !== undefined) { - headers = headers.set('Accept', httpHeaderAcceptSelected); + /** + * @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; } - - // 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('post', `${this.basePath}/user/role/${encodeURIComponent(String(role))}`, - { - body: body, - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * Delete admin role from users - * None - * @param body userIds - * @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 deleteAdminRoleFromUsers(body: Array, observe?: 'body', reportProgress?: boolean): Observable; - - public deleteAdminRoleFromUsers(body: Array, observe?: 'response', reportProgress?: boolean): Observable>; - - public deleteAdminRoleFromUsers(body: Array, observe?: 'events', reportProgress?: boolean): Observable>; - - public deleteAdminRoleFromUsers(body: Array, observe: any = 'body', reportProgress: boolean = false): Observable { - - if (body === null || body === undefined) { - throw new Error('Required parameter body was null or undefined when calling deleteAdminRoleFromUsers.'); - } - - let headers = this.defaultHeaders; - - // authentication (RED-OAUTH) required - if (this.configuration.accessToken) { - const 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); - if (httpHeaderAcceptSelected !== undefined) { - headers = headers.set('Accept', httpHeaderAcceptSelected); - } - - // to determine the Content-Type header - const consumes: string[] = [ - '*/*' - ]; - const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); - if (httpContentTypeSelected !== undefined) { - headers = headers.set('Content-Type', httpContentTypeSelected); - } - - return this.httpClient.request('delete', `${this.basePath}/user/admin`, - { - body: body, - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * Delete a role from users - * None - * @param body userIds - * @param role role - * @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 deleteRoleFromUsers(body: Array, role: string, observe?: 'body', reportProgress?: boolean): Observable; - - public deleteRoleFromUsers(body: Array, role: string, observe?: 'response', reportProgress?: boolean): Observable>; - - public deleteRoleFromUsers(body: Array, role: string, observe?: 'events', reportProgress?: boolean): Observable>; - - public deleteRoleFromUsers(body: Array, role: string, observe: any = 'body', reportProgress: boolean = false): Observable { - - if (body === null || body === undefined) { - throw new Error('Required parameter body was null or undefined when calling deleteRoleFromUsers.'); - } - - if (role === null || role === undefined) { - throw new Error('Required parameter role was null or undefined when calling deleteRoleFromUsers.'); - } - - let headers = this.defaultHeaders; - - // authentication (RED-OAUTH) required - if (this.configuration.accessToken) { - const 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); - if (httpHeaderAcceptSelected !== undefined) { - headers = headers.set('Accept', httpHeaderAcceptSelected); - } - - // to determine the Content-Type header - const consumes: string[] = [ - '*/*' - ]; - const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); - if (httpContentTypeSelected !== undefined) { - headers = headers.set('Content-Type', httpContentTypeSelected); - } - - return this.httpClient.request('delete', `${this.basePath}/user/role/${encodeURIComponent(String(role))}`, - { - body: body, - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * Gets all the users in realm with information of roles. - * None - * @param body userRequest - * @param offset offset - * @param limit limit - * @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 getAllUsers(body: UserRequest, offset?: number, limit?: number, observe?: 'body', reportProgress?: boolean): Observable; - - public getAllUsers(body: UserRequest, offset?: number, limit?: number, observe?: 'response', reportProgress?: boolean): Observable>; - - public getAllUsers(body: UserRequest, offset?: number, limit?: number, observe?: 'events', reportProgress?: boolean): Observable>; - - public getAllUsers(body: UserRequest, offset?: number, limit?: number, observe: any = 'body', reportProgress: boolean = false): Observable { - - if (body === null || body === undefined) { - throw new Error('Required parameter body was null or undefined when calling getAllUsers.'); - } - - - let queryParameters = new HttpParams({encoder: new CustomHttpUrlEncodingCodec()}); - if (offset !== undefined && offset !== null) { - queryParameters = queryParameters.set('offset', offset); - } - if (limit !== undefined && limit !== null) { - queryParameters = queryParameters.set('limit', limit); - } - - let headers = this.defaultHeaders; - - // authentication (RED-OAUTH) required - if (this.configuration.accessToken) { - const 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); - 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('post', `${this.basePath}/user/all`, - { - body: body, - params: queryParameters, - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * Gets the users who contain redaction roles. - * None - * @param body userRequest - * @param offset offset - * @param limit limit - * @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 getUsers(body: UserRequest, offset?: number, limit?: number, observe?: 'body', reportProgress?: boolean): Observable; - - public getUsers(body: UserRequest, offset?: number, limit?: number, observe?: 'response', reportProgress?: boolean): Observable>; - - public getUsers(body: UserRequest, offset?: number, limit?: number, observe?: 'events', reportProgress?: boolean): Observable>; - - public getUsers(body: UserRequest, offset?: number, limit?: number, observe: any = 'body', reportProgress: boolean = false): Observable { - - if (body === null || body === undefined) { - throw new Error('Required parameter body was null or undefined when calling getUsers.'); - } - - - let queryParameters = new HttpParams({encoder: new CustomHttpUrlEncodingCodec()}); - if (offset !== undefined && offset !== null) { - queryParameters = queryParameters.set('offset', offset); - } - if (limit !== undefined && limit !== null) { - queryParameters = queryParameters.set('limit', limit); - } - - let headers = this.defaultHeaders; - - // authentication (RED-OAUTH) required - if (this.configuration.accessToken) { - const 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); - 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('post', `${this.basePath}/user`, - { - body: body, - params: queryParameters, - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * @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; - } - } diff --git a/libs/red-ui-http/src/lib/configuration.ts b/libs/red-ui-http/src/lib/configuration.ts index bdd6eee52..60a47cdb6 100644 --- a/libs/red-ui-http/src/lib/configuration.ts +++ b/libs/red-ui-http/src/lib/configuration.ts @@ -1,79 +1,85 @@ export interface ConfigurationParameters { - apiKeys?: { [key: string]: string }; - username?: string; - password?: string; - accessToken?: string | (() => string); - basePath?: string; - withCredentials?: boolean; + apiKeys?: { [key: string]: string }; + username?: string; + password?: string; + accessToken?: string | (() => string); + basePath?: string; + withCredentials?: boolean; } export class Configuration { - apiKeys?: { [key: string]: string }; - username?: string; - password?: string; - accessToken?: string | (() => string); - basePath?: string; - withCredentials?: boolean; + apiKeys?: { [key: string]: string }; + username?: string; + password?: string; + accessToken?: string | (() => string); + basePath?: string; + withCredentials?: boolean; - constructor(configurationParameters: ConfigurationParameters = {}) { - this.apiKeys = configurationParameters.apiKeys; - this.username = configurationParameters.username; - this.password = configurationParameters.password; - this.accessToken = configurationParameters.accessToken; - this.basePath = configurationParameters.basePath; - this.withCredentials = configurationParameters.withCredentials; - } - - /** - * Select the correct content-type to use for a request. - * Uses {@link Configuration#isJsonMime} to determine the correct content-type. - * If no content type is found return the first found type if the contentTypes is not empty - * @param contentTypes - the array of content types that are available for selection - * @returns the selected content-type or undefined if no selection could be made. - */ - public selectHeaderContentType(contentTypes: string[]): string | undefined { - if (contentTypes.length === 0) { - return undefined; + constructor(configurationParameters: ConfigurationParameters = {}) { + this.apiKeys = configurationParameters.apiKeys; + this.username = configurationParameters.username; + this.password = configurationParameters.password; + this.accessToken = configurationParameters.accessToken; + this.basePath = configurationParameters.basePath; + this.withCredentials = configurationParameters.withCredentials; } - const type = contentTypes.find(x => this.isJsonMime(x)); - if (type === undefined) { - return contentTypes[0]; - } - return type; - } + /** + * Select the correct content-type to use for a request. + * Uses {@link Configuration#isJsonMime} to determine the correct content-type. + * If no content type is found return the first found type if the contentTypes is not empty + * @param contentTypes - the array of content types that are available for selection + * @returns the selected content-type or undefined if no selection could be made. + */ + public selectHeaderContentType(contentTypes: string[]): string | undefined { + if (contentTypes.length === 0) { + return undefined; + } - /** - * Select the correct accept content-type to use for a request. - * Uses {@link Configuration#isJsonMime} to determine the correct accept content-type. - * If no content type is found return the first found type if the contentTypes is not empty - * @param accepts - the array of content types that are available for selection. - * @returns the selected content-type or undefined if no selection could be made. - */ - public selectHeaderAccept(accepts: string[]): string | undefined { - if (accepts.length === 0) { - return undefined; + const type = contentTypes.find((x) => this.isJsonMime(x)); + if (type === undefined) { + return contentTypes[0]; + } + return type; } - const type = accepts.find(x => this.isJsonMime(x)); - if (type === undefined) { - return accepts[0]; - } - return type; - } + /** + * Select the correct accept content-type to use for a request. + * Uses {@link Configuration#isJsonMime} to determine the correct accept content-type. + * If no content type is found return the first found type if the contentTypes is not empty + * @param accepts - the array of content types that are available for selection. + * @returns the selected content-type or undefined if no selection could be made. + */ + public selectHeaderAccept(accepts: string[]): string | undefined { + if (accepts.length === 0) { + return undefined; + } - /** - * Check if the given MIME is a JSON MIME. - * JSON MIME examples: - * application/json - * application/json; charset=UTF8 - * APPLICATION/JSON - * application/vnd.company+json - * @param mime - MIME (Multipurpose Internet Mail Extensions) - * @return True if the given MIME is JSON, false otherwise. - */ - public isJsonMime(mime: string): boolean { - const jsonMime: RegExp = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i'); - return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json'); - } + const type = accepts.find((x) => this.isJsonMime(x)); + if (type === undefined) { + return accepts[0]; + } + return type; + } + + /** + * Check if the given MIME is a JSON MIME. + * JSON MIME examples: + * application/json + * application/json; charset=UTF8 + * APPLICATION/JSON + * application/vnd.company+json + * @param mime - MIME (Multipurpose Internet Mail Extensions) + * @return True if the given MIME is JSON, false otherwise. + */ + public isJsonMime(mime: string): boolean { + const jsonMime: RegExp = new RegExp( + '^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$', + 'i' + ); + return ( + mime !== null && + (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json') + ); + } } diff --git a/libs/red-ui-http/src/lib/encoder.ts b/libs/red-ui-http/src/lib/encoder.ts index 9123be151..8e5a1fd28 100644 --- a/libs/red-ui-http/src/lib/encoder.ts +++ b/libs/red-ui-http/src/lib/encoder.ts @@ -1,4 +1,4 @@ -import {HttpUrlEncodingCodec} from '@angular/common/http'; +import { HttpUrlEncodingCodec } from '@angular/common/http'; /** * CustomHttpUrlEncodingCodec @@ -6,14 +6,13 @@ import {HttpUrlEncodingCodec} from '@angular/common/http'; * See: https://github.com/angular/angular/issues/11058#issuecomment-247367318 */ export class CustomHttpUrlEncodingCodec extends HttpUrlEncodingCodec { - encodeKey(k: string): string { - k = super.encodeKey(k); - return k.replace(/\+/gi, '%2B'); - } + encodeKey(k: string): string { + k = super.encodeKey(k); + return k.replace(/\+/gi, '%2B'); + } - encodeValue(v: string): string { - v = super.encodeValue(v); - return v.replace(/\+/gi, '%2B'); - } + encodeValue(v: string): string { + v = super.encodeValue(v); + return v.replace(/\+/gi, '%2B'); + } } - diff --git a/libs/red-ui-http/src/lib/index.ts b/libs/red-ui-http/src/lib/index.ts index c312b70fa..410623f1c 100644 --- a/libs/red-ui-http/src/lib/index.ts +++ b/libs/red-ui-http/src/lib/index.ts @@ -2,4 +2,4 @@ export * from './api/api'; export * from './model/models'; export * from './variables'; export * from './configuration'; -export * from './api.module'; \ No newline at end of file +export * from './api.module'; diff --git a/libs/red-ui-http/src/lib/model/addCommentRequest.ts b/libs/red-ui-http/src/lib/model/addCommentRequest.ts index d8e6a21b5..40e15beff 100644 --- a/libs/red-ui-http/src/lib/model/addCommentRequest.ts +++ b/libs/red-ui-http/src/lib/model/addCommentRequest.ts @@ -11,5 +11,5 @@ */ export interface AddCommentRequest { - text?: string; + text?: string; } diff --git a/libs/red-ui-http/src/lib/model/addRedactionRequest.ts b/libs/red-ui-http/src/lib/model/addRedactionRequest.ts index f1d529c2f..d86aec693 100644 --- a/libs/red-ui-http/src/lib/model/addRedactionRequest.ts +++ b/libs/red-ui-http/src/lib/model/addRedactionRequest.ts @@ -9,14 +9,14 @@ * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ -import {AddCommentRequest} from './addCommentRequest'; -import {Rectangle} from './rectangle'; +import { AddCommentRequest } from './addCommentRequest'; +import { Rectangle } from './rectangle'; export interface AddRedactionRequest { - type?: string; - value?: string; - reason?: string; - addToDictionary?: boolean; - positions?: Array; - comment?: AddCommentRequest; + type?: string; + value?: string; + reason?: string; + addToDictionary?: boolean; + positions?: Array; + comment?: AddCommentRequest; } diff --git a/libs/red-ui-http/src/lib/model/authInfo.ts b/libs/red-ui-http/src/lib/model/authInfo.ts index 08fdb59c7..55363a4d0 100644 --- a/libs/red-ui-http/src/lib/model/authInfo.ts +++ b/libs/red-ui-http/src/lib/model/authInfo.ts @@ -14,12 +14,12 @@ * Object containing information about authorization. */ export interface AuthInfo { - /** - * The authorization url to get access token. - */ - authorizationUrl?: string; - /** - * The token url to get the refresh token. - */ - tokenUrl?: string; + /** + * The authorization url to get access token. + */ + authorizationUrl?: string; + /** + * The token url to get the refresh token. + */ + tokenUrl?: string; } diff --git a/libs/red-ui-http/src/lib/model/colors.ts b/libs/red-ui-http/src/lib/model/colors.ts index 905f5424f..a5f85fd39 100644 --- a/libs/red-ui-http/src/lib/model/colors.ts +++ b/libs/red-ui-http/src/lib/model/colors.ts @@ -11,8 +11,8 @@ */ export interface Colors { - defaultColor?: string; - notRedacted?: string; - requestAdd?: string; - requestRemove?: string; + defaultColor?: string; + notRedacted?: string; + requestAdd?: string; + requestRemove?: string; } diff --git a/libs/red-ui-http/src/lib/model/comment.ts b/libs/red-ui-http/src/lib/model/comment.ts index 29336fa03..6755e4750 100644 --- a/libs/red-ui-http/src/lib/model/comment.ts +++ b/libs/red-ui-http/src/lib/model/comment.ts @@ -11,8 +11,8 @@ */ export interface Comment { - date?: string; - id?: string; - text?: string; - user?: string; + date?: string; + id?: string; + text?: string; + user?: string; } diff --git a/libs/red-ui-http/src/lib/model/commentResponse.ts b/libs/red-ui-http/src/lib/model/commentResponse.ts index 1334ec87e..041903ed9 100644 --- a/libs/red-ui-http/src/lib/model/commentResponse.ts +++ b/libs/red-ui-http/src/lib/model/commentResponse.ts @@ -11,5 +11,5 @@ */ export interface CommentResponse { - commentId?: string; + commentId?: string; } diff --git a/libs/red-ui-http/src/lib/model/defaultColor.ts b/libs/red-ui-http/src/lib/model/defaultColor.ts index 7ca90930c..f09d585fb 100644 --- a/libs/red-ui-http/src/lib/model/defaultColor.ts +++ b/libs/red-ui-http/src/lib/model/defaultColor.ts @@ -11,5 +11,5 @@ */ export interface DefaultColor { - color?: Array; + color?: Array; } diff --git a/libs/red-ui-http/src/lib/model/dictionary.ts b/libs/red-ui-http/src/lib/model/dictionary.ts index 277268c49..618944b56 100644 --- a/libs/red-ui-http/src/lib/model/dictionary.ts +++ b/libs/red-ui-http/src/lib/model/dictionary.ts @@ -14,20 +14,20 @@ * Object containing a list of dictionary entries and colors of an entry type. */ export interface Dictionary { - /** - * True if the entries in this type should be matched case insensitively, default is false. - */ - caseInsensitive?: boolean; - /** - * The list of dictionary entries of an entry type. - */ - entries?: Array; - /** - * The value of color must be a correct hex color - */ - hexColor?: string; - /** - * True if the type just for hint, not for redaction, default is false. - */ - hint?: boolean; + /** + * True if the entries in this type should be matched case insensitively, default is false. + */ + caseInsensitive?: boolean; + /** + * The list of dictionary entries of an entry type. + */ + entries?: Array; + /** + * The value of color must be a correct hex color + */ + hexColor?: string; + /** + * True if the type just for hint, not for redaction, default is false. + */ + hint?: boolean; } diff --git a/libs/red-ui-http/src/lib/model/fileIds.ts b/libs/red-ui-http/src/lib/model/fileIds.ts index 0b41f6d94..0e90f76d2 100644 --- a/libs/red-ui-http/src/lib/model/fileIds.ts +++ b/libs/red-ui-http/src/lib/model/fileIds.ts @@ -11,5 +11,5 @@ */ export interface FileIds { - fileIds?: Array; + fileIds?: Array; } diff --git a/libs/red-ui-http/src/lib/model/fileStatus.ts b/libs/red-ui-http/src/lib/model/fileStatus.ts index 0a5deaa26..e7688476f 100644 --- a/libs/red-ui-http/src/lib/model/fileStatus.ts +++ b/libs/red-ui-http/src/lib/model/fileStatus.ts @@ -14,62 +14,62 @@ * Object containing information on a specific file. */ export interface FileStatus { - /** - * Date and time when the file was added to the system. - */ - added?: string; - /** - * The current reviewer's (if any) user id. - */ - currentReviewer?: string; - /** - * The ID of the file. - */ - fileId?: string; - /** - * The file's name. - */ - filename?: string; - /** - * Date and time when the file was last updated. - */ - lastUpdated?: string; - /** - * The number of times the file has been analyzed. - */ - numberOfAnalyses?: number; - /** - * The number of pages of the file. - */ - numberOfPages?: number; - /** - * The ID of the project the file belongs to. - */ - projectId?: string; - /** - * The status of the file with regard to its analysis an review processes. - */ - status?: FileStatus.StatusEnum; + /** + * Date and time when the file was added to the system. + */ + added?: string; + /** + * The current reviewer's (if any) user id. + */ + currentReviewer?: string; + /** + * The ID of the file. + */ + fileId?: string; + /** + * The file's name. + */ + filename?: string; + /** + * Date and time when the file was last updated. + */ + lastUpdated?: string; + /** + * The number of times the file has been analyzed. + */ + numberOfAnalyses?: number; + /** + * The number of pages of the file. + */ + numberOfPages?: number; + /** + * The ID of the project the file belongs to. + */ + projectId?: string; + /** + * The status of the file with regard to its analysis an review processes. + */ + status?: FileStatus.StatusEnum; } export namespace FileStatus { - export type StatusEnum = - 'UNPROCESSED' - | 'REPROCESS' - | 'PROCESSING' - | 'ERROR' - | 'UNASSIGNED' - | 'UNDER_REVIEW' - | 'UNDER_APPROVAL' - | 'APPROVED'; - export const StatusEnum = { - UNPROCESSED: 'UNPROCESSED' as StatusEnum, - REPROCESS: 'REPROCESS' as StatusEnum, - PROCESSING: 'PROCESSING' as StatusEnum, - ERROR: 'ERROR' as StatusEnum, - UNASSIGNED: 'UNASSIGNED' as StatusEnum, - UNDERREVIEW: 'UNDER_REVIEW' as StatusEnum, - UNDERAPPROVAL: 'UNDER_APPROVAL' as StatusEnum, - APPROVED: 'APPROVED' as StatusEnum - }; + export type StatusEnum = + | 'UNPROCESSED' + | 'REPROCESS' + | 'PROCESSING' + | 'ERROR' + | 'UNASSIGNED' + | 'UNDER_REVIEW' + | 'UNDER_APPROVAL' + | 'APPROVED'; + export const StatusEnum = { + UNPROCESSED: 'UNPROCESSED' as StatusEnum, + REPROCESS: 'REPROCESS' as StatusEnum, + PROCESSING: 'PROCESSING' as StatusEnum, + ERROR: 'ERROR' as StatusEnum, + UNASSIGNED: 'UNASSIGNED' as StatusEnum, + UNDERREVIEW: 'UNDER_REVIEW' as StatusEnum, + UNDERAPPROVAL: 'UNDER_APPROVAL' as StatusEnum, + APPROVED: 'APPROVED' as StatusEnum + }; } diff --git a/libs/red-ui-http/src/lib/model/fileUploadResult.ts b/libs/red-ui-http/src/lib/model/fileUploadResult.ts index b5a871216..27bc208bb 100644 --- a/libs/red-ui-http/src/lib/model/fileUploadResult.ts +++ b/libs/red-ui-http/src/lib/model/fileUploadResult.ts @@ -14,8 +14,8 @@ * Object containing information about a successfully uploaded file. */ export interface FileUploadResult { - /** - * The non-null file ID. - */ - fileId?: string; + /** + * The non-null file ID. + */ + fileId?: string; } diff --git a/libs/red-ui-http/src/lib/model/idRemoval.ts b/libs/red-ui-http/src/lib/model/idRemoval.ts index 59953475b..2c599eacd 100644 --- a/libs/red-ui-http/src/lib/model/idRemoval.ts +++ b/libs/red-ui-http/src/lib/model/idRemoval.ts @@ -9,21 +9,21 @@ * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ -import {Comment} from './comment'; +import { Comment } from './comment'; export interface IdRemoval { - comments?: Array; - id?: string; - removeFromDictionary?: boolean; - status?: IdRemoval.StatusEnum; - user?: string; + comments?: Array; + id?: string; + removeFromDictionary?: boolean; + status?: IdRemoval.StatusEnum; + user?: string; } export namespace IdRemoval { - export type StatusEnum = 'REQUESTED' | 'APPROVED' | 'DECLINED'; - export const StatusEnum = { - REQUESTED: 'REQUESTED' as StatusEnum, - APPROVED: 'APPROVED' as StatusEnum, - DECLINED: 'DECLINED' as StatusEnum - }; + export type StatusEnum = 'REQUESTED' | 'APPROVED' | 'DECLINED'; + export const StatusEnum = { + REQUESTED: 'REQUESTED' as StatusEnum, + APPROVED: 'APPROVED' as StatusEnum, + DECLINED: 'DECLINED' as StatusEnum + }; } diff --git a/libs/red-ui-http/src/lib/model/licenseReport.ts b/libs/red-ui-http/src/lib/model/licenseReport.ts index 86d3c5ba5..a4e02a519 100644 --- a/libs/red-ui-http/src/lib/model/licenseReport.ts +++ b/libs/red-ui-http/src/lib/model/licenseReport.ts @@ -9,17 +9,17 @@ * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ -import {ReportData} from './reportData'; +import { ReportData } from './reportData'; export interface LicenseReport { - data?: Array; - endDate?: Date; - limit?: number; - numberOfAnalyses?: number; - numberOfAnalyzedFiles?: number; - numberOfAnalyzedPages?: number; - numberOfProjects?: number; - offset?: number; - requestId?: string; - startDate?: Date; + data?: Array; + endDate?: Date; + limit?: number; + numberOfAnalyses?: number; + numberOfAnalyzedFiles?: number; + numberOfAnalyzedPages?: number; + numberOfProjects?: number; + offset?: number; + requestId?: string; + startDate?: Date; } diff --git a/libs/red-ui-http/src/lib/model/licenseReportRequest.ts b/libs/red-ui-http/src/lib/model/licenseReportRequest.ts index b365a6ec6..a46f6c3b6 100644 --- a/libs/red-ui-http/src/lib/model/licenseReportRequest.ts +++ b/libs/red-ui-http/src/lib/model/licenseReportRequest.ts @@ -11,8 +11,8 @@ */ export interface LicenseReportRequest { - requestId?: string; - startDate?: Date; - endDate?: Date; - projectIds?: Array; + requestId?: string; + startDate?: Date; + endDate?: Date; + projectIds?: Array; } diff --git a/libs/red-ui-http/src/lib/model/manualAddResponse.ts b/libs/red-ui-http/src/lib/model/manualAddResponse.ts index 1695ec702..74db9ace3 100644 --- a/libs/red-ui-http/src/lib/model/manualAddResponse.ts +++ b/libs/red-ui-http/src/lib/model/manualAddResponse.ts @@ -11,6 +11,6 @@ */ export interface ManualAddResponse { - annotationId?: string; - commentId?: string; + annotationId?: string; + commentId?: string; } diff --git a/libs/red-ui-http/src/lib/model/manualRedactionEntry.ts b/libs/red-ui-http/src/lib/model/manualRedactionEntry.ts index 1f395e504..c77c8a6f9 100644 --- a/libs/red-ui-http/src/lib/model/manualRedactionEntry.ts +++ b/libs/red-ui-http/src/lib/model/manualRedactionEntry.ts @@ -9,26 +9,26 @@ * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ -import {Comment} from './comment'; -import {Rectangle} from './rectangle'; +import { Comment } from './comment'; +import { Rectangle } from './rectangle'; export interface ManualRedactionEntry { - addToDictionary?: boolean; - comments?: Array; - id?: string; - positions?: Array; - reason?: string; - status?: ManualRedactionEntry.StatusEnum; - type?: string; - user?: string; - value?: string; + addToDictionary?: boolean; + comments?: Array; + id?: string; + positions?: Array; + reason?: string; + status?: ManualRedactionEntry.StatusEnum; + type?: string; + user?: string; + value?: string; } export namespace ManualRedactionEntry { - export type StatusEnum = 'REQUESTED' | 'APPROVED' | 'DECLINED'; - export const StatusEnum = { - REQUESTED: 'REQUESTED' as StatusEnum, - APPROVED: 'APPROVED' as StatusEnum, - DECLINED: 'DECLINED' as StatusEnum - }; + export type StatusEnum = 'REQUESTED' | 'APPROVED' | 'DECLINED'; + export const StatusEnum = { + REQUESTED: 'REQUESTED' as StatusEnum, + APPROVED: 'APPROVED' as StatusEnum, + DECLINED: 'DECLINED' as StatusEnum + }; } diff --git a/libs/red-ui-http/src/lib/model/manualRedactions.ts b/libs/red-ui-http/src/lib/model/manualRedactions.ts index 77e4ca0a0..edc96ca2c 100644 --- a/libs/red-ui-http/src/lib/model/manualRedactions.ts +++ b/libs/red-ui-http/src/lib/model/manualRedactions.ts @@ -9,10 +9,10 @@ * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ -import {IdRemoval} from './idRemoval'; -import {ManualRedactionEntry} from './manualRedactionEntry'; +import { IdRemoval } from './idRemoval'; +import { ManualRedactionEntry } from './manualRedactionEntry'; export interface ManualRedactions { - entriesToAdd?: Array; - idsToRemove?: Array; + entriesToAdd?: Array; + idsToRemove?: Array; } diff --git a/libs/red-ui-http/src/lib/model/modelFile.ts b/libs/red-ui-http/src/lib/model/modelFile.ts index 7a4e7d9e1..74d52133a 100644 --- a/libs/red-ui-http/src/lib/model/modelFile.ts +++ b/libs/red-ui-http/src/lib/model/modelFile.ts @@ -11,23 +11,23 @@ */ export interface ModelFile { - absolute?: boolean; - absoluteFile?: any; - absolutePath?: string; - canonicalFile?: any; - canonicalPath?: string; - directory?: boolean; - executable?: boolean; - file?: boolean; - freeSpace?: number; - hidden?: boolean; - lastModified?: number; - name?: string; - parent?: string; - parentFile?: any; - path?: string; - readable?: boolean; - totalSpace?: number; - usableSpace?: number; - writable?: boolean; + absolute?: boolean; + absoluteFile?: any; + absolutePath?: string; + canonicalFile?: any; + canonicalPath?: string; + directory?: boolean; + executable?: boolean; + file?: boolean; + freeSpace?: number; + hidden?: boolean; + lastModified?: number; + name?: string; + parent?: string; + parentFile?: any; + path?: string; + readable?: boolean; + totalSpace?: number; + usableSpace?: number; + writable?: boolean; } diff --git a/libs/red-ui-http/src/lib/model/pdfMetaData.ts b/libs/red-ui-http/src/lib/model/pdfMetaData.ts index 14fea82c0..2d1be2bbd 100644 --- a/libs/red-ui-http/src/lib/model/pdfMetaData.ts +++ b/libs/red-ui-http/src/lib/model/pdfMetaData.ts @@ -11,12 +11,12 @@ */ export interface PdfMetaData { - author?: boolean; - creationDate?: boolean; - creator?: boolean; - keywords?: boolean; - modDate?: boolean; - producer?: boolean; - subject?: boolean; - title?: boolean; + author?: boolean; + creationDate?: boolean; + creator?: boolean; + keywords?: boolean; + modDate?: boolean; + producer?: boolean; + subject?: boolean; + title?: boolean; } diff --git a/libs/red-ui-http/src/lib/model/point.ts b/libs/red-ui-http/src/lib/model/point.ts index 23d04769c..f04e7f73b 100644 --- a/libs/red-ui-http/src/lib/model/point.ts +++ b/libs/red-ui-http/src/lib/model/point.ts @@ -11,6 +11,6 @@ */ export interface Point { - x?: number; - y?: number; + x?: number; + y?: number; } diff --git a/libs/red-ui-http/src/lib/model/project.ts b/libs/red-ui-http/src/lib/model/project.ts index 4bb07a061..030c6ebcf 100644 --- a/libs/red-ui-http/src/lib/model/project.ts +++ b/libs/red-ui-http/src/lib/model/project.ts @@ -11,20 +11,20 @@ */ export interface Project { - date?: string; - description?: string; - memberIds?: Array; - ownerId?: string; - projectId?: string; - dueDate?: string; - projectName?: string; - status?: Project.StatusEnum; + date?: string; + description?: string; + memberIds?: Array; + ownerId?: string; + projectId?: string; + dueDate?: string; + projectName?: string; + status?: Project.StatusEnum; } export namespace Project { - export type StatusEnum = 'ACTIVE' | 'DELETED'; - export const StatusEnum = { - ACTIVE: 'ACTIVE' as StatusEnum, - DELETED: 'DELETED' as StatusEnum - }; + export type StatusEnum = 'ACTIVE' | 'DELETED'; + export const StatusEnum = { + ACTIVE: 'ACTIVE' as StatusEnum, + DELETED: 'DELETED' as StatusEnum + }; } diff --git a/libs/red-ui-http/src/lib/model/projectRequest.ts b/libs/red-ui-http/src/lib/model/projectRequest.ts index 5c600f183..8ffdbeb60 100644 --- a/libs/red-ui-http/src/lib/model/projectRequest.ts +++ b/libs/red-ui-http/src/lib/model/projectRequest.ts @@ -3,7 +3,7 @@ * Description for redaction * * OpenAPI spec version: 1.0 - * + * * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git @@ -13,7 +13,7 @@ /** * Object containing information about a project. */ -export interface ProjectRequest { +export interface ProjectRequest { /** * The project's description (optional). */ @@ -38,4 +38,4 @@ export interface ProjectRequest { * The name of the project. Must be unique. */ projectName?: string; -} \ No newline at end of file +} diff --git a/libs/red-ui-http/src/lib/model/rectangle.ts b/libs/red-ui-http/src/lib/model/rectangle.ts index ab5e3b0ea..8d319f2a1 100644 --- a/libs/red-ui-http/src/lib/model/rectangle.ts +++ b/libs/red-ui-http/src/lib/model/rectangle.ts @@ -9,11 +9,11 @@ * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ -import {Point} from './point'; +import { Point } from './point'; export interface Rectangle { - height?: number; - page?: number; - topLeft?: Point; - width?: number; + height?: number; + page?: number; + topLeft?: Point; + width?: number; } diff --git a/libs/red-ui-http/src/lib/model/redactionLog.ts b/libs/red-ui-http/src/lib/model/redactionLog.ts index 841e05975..fa177e171 100644 --- a/libs/red-ui-http/src/lib/model/redactionLog.ts +++ b/libs/red-ui-http/src/lib/model/redactionLog.ts @@ -9,11 +9,11 @@ * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ -import {RedactionLogEntry} from './redactionLogEntry'; +import { RedactionLogEntry } from './redactionLogEntry'; export interface RedactionLog { - dictionaryVersion?: number; - filename?: string; - redactionLogEntry?: Array; - rulesVersion?: number; + dictionaryVersion?: number; + filename?: string; + redactionLogEntry?: Array; + rulesVersion?: number; } diff --git a/libs/red-ui-http/src/lib/model/redactionLogEntry.ts b/libs/red-ui-http/src/lib/model/redactionLogEntry.ts index c90f2dd5a..4c8328346 100644 --- a/libs/red-ui-http/src/lib/model/redactionLogEntry.ts +++ b/libs/red-ui-http/src/lib/model/redactionLogEntry.ts @@ -9,28 +9,28 @@ * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ -import {Rectangle} from './rectangle'; +import { Rectangle } from './rectangle'; export interface RedactionLogEntry { - color?: Array; - hint?: boolean; - id?: string; - manual?: boolean; - positions?: Array; - reason?: string; - redacted?: boolean; - section?: string; - sectionNumber?: number; - status?: RedactionLogEntry.StatusEnum; - type?: string; - value?: string; + color?: Array; + hint?: boolean; + id?: string; + manual?: boolean; + positions?: Array; + reason?: string; + redacted?: boolean; + section?: string; + sectionNumber?: number; + status?: RedactionLogEntry.StatusEnum; + type?: string; + value?: string; } export namespace RedactionLogEntry { - export type StatusEnum = 'REQUESTED' | 'APPROVED' | 'DECLINED'; - export const StatusEnum = { - REQUESTED: 'REQUESTED' as StatusEnum, - APPROVED: 'APPROVED' as StatusEnum, - DECLINED: 'DECLINED' as StatusEnum - }; + export type StatusEnum = 'REQUESTED' | 'APPROVED' | 'DECLINED'; + export const StatusEnum = { + REQUESTED: 'REQUESTED' as StatusEnum, + APPROVED: 'APPROVED' as StatusEnum, + DECLINED: 'DECLINED' as StatusEnum + }; } diff --git a/libs/red-ui-http/src/lib/model/removeRedactionRequest.ts b/libs/red-ui-http/src/lib/model/removeRedactionRequest.ts index 023b96c03..13e685037 100644 --- a/libs/red-ui-http/src/lib/model/removeRedactionRequest.ts +++ b/libs/red-ui-http/src/lib/model/removeRedactionRequest.ts @@ -9,10 +9,10 @@ * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ -import {AddCommentRequest} from './addCommentRequest'; +import { AddCommentRequest } from './addCommentRequest'; export interface RemoveRedactionRequest { - annotationId?: string; - removeFromDictionary?: boolean; - comment?: AddCommentRequest; + annotationId?: string; + removeFromDictionary?: boolean; + comment?: AddCommentRequest; } diff --git a/libs/red-ui-http/src/lib/model/reportData.ts b/libs/red-ui-http/src/lib/model/reportData.ts index c249dc0b6..6521f0cac 100644 --- a/libs/red-ui-http/src/lib/model/reportData.ts +++ b/libs/red-ui-http/src/lib/model/reportData.ts @@ -11,36 +11,36 @@ */ export interface ReportData { - addedDate?: Date; - analysisCount?: number; - deletedDate?: Date; - fileName?: string; - lastUpdatedDate?: Date; - numberOfAnalyzedPages?: number; - project?: string; - status?: ReportData.StatusEnum; + addedDate?: Date; + analysisCount?: number; + deletedDate?: Date; + fileName?: string; + lastUpdatedDate?: Date; + numberOfAnalyzedPages?: number; + project?: string; + status?: ReportData.StatusEnum; } export namespace ReportData { - export type StatusEnum = - 'UNPROCESSED' - | 'REPROCESS' - | 'PROCESSING' - | 'ERROR' - | 'DELETED' - | 'UNASSIGNED' - | 'UNDER_REVIEW' - | 'UNDER_APPROVAL' - | 'APPROVED'; - export const StatusEnum = { - UNPROCESSED: 'UNPROCESSED' as StatusEnum, - REPROCESS: 'REPROCESS' as StatusEnum, - PROCESSING: 'PROCESSING' as StatusEnum, - ERROR: 'ERROR' as StatusEnum, - DELETED: 'DELETED' as StatusEnum, - UNASSIGNED: 'UNASSIGNED' as StatusEnum, - UNDERREVIEW: 'UNDER_REVIEW' as StatusEnum, - UNDERAPPROVAL: 'UNDER_APPROVAL' as StatusEnum, - APPROVED: 'APPROVED' as StatusEnum - }; + export type StatusEnum = + | 'UNPROCESSED' + | 'REPROCESS' + | 'PROCESSING' + | 'ERROR' + | 'DELETED' + | 'UNASSIGNED' + | 'UNDER_REVIEW' + | 'UNDER_APPROVAL' + | 'APPROVED'; + export const StatusEnum = { + UNPROCESSED: 'UNPROCESSED' as StatusEnum, + REPROCESS: 'REPROCESS' as StatusEnum, + PROCESSING: 'PROCESSING' as StatusEnum, + ERROR: 'ERROR' as StatusEnum, + DELETED: 'DELETED' as StatusEnum, + UNASSIGNED: 'UNASSIGNED' as StatusEnum, + UNDERREVIEW: 'UNDER_REVIEW' as StatusEnum, + UNDERAPPROVAL: 'UNDER_APPROVAL' as StatusEnum, + APPROVED: 'APPROVED' as StatusEnum + }; } diff --git a/libs/red-ui-http/src/lib/model/rules.ts b/libs/red-ui-http/src/lib/model/rules.ts index 546ca4ee6..cd673e28a 100644 --- a/libs/red-ui-http/src/lib/model/rules.ts +++ b/libs/red-ui-http/src/lib/model/rules.ts @@ -14,8 +14,8 @@ * Object containing a string of Drools rules. */ export interface Rules { - /** - * The actual string of rules. - */ - rules?: string; + /** + * The actual string of rules. + */ + rules?: string; } diff --git a/libs/red-ui-http/src/lib/model/typeResponse.ts b/libs/red-ui-http/src/lib/model/typeResponse.ts index b30ad663d..59e88f092 100644 --- a/libs/red-ui-http/src/lib/model/typeResponse.ts +++ b/libs/red-ui-http/src/lib/model/typeResponse.ts @@ -9,14 +9,14 @@ * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ -import {TypeValue} from './typeValue'; +import { TypeValue } from './typeValue'; /** * Object containing a list of values of an entry type. */ export interface TypeResponse { - /** - * The list of values of an entry type, which include colors, hint and caseInsensitive. - */ - types?: Array; + /** + * The list of values of an entry type, which include colors, hint and caseInsensitive. + */ + types?: Array; } diff --git a/libs/red-ui-http/src/lib/model/typeValue.ts b/libs/red-ui-http/src/lib/model/typeValue.ts index be20d927d..3375e2f61 100644 --- a/libs/red-ui-http/src/lib/model/typeValue.ts +++ b/libs/red-ui-http/src/lib/model/typeValue.ts @@ -14,20 +14,20 @@ * Object containing entry type with an array of r-g-b colors. */ export interface TypeValue { - /** - * True if the entries in this type should be matched case insensitively, default is false. - */ - caseInsensitive?: boolean; - /** - * The value of color must be a correct hex color - */ - hexColor?: string; - /** - * True if the type just for hint, not for redaction, default is false. - */ - hint?: boolean; - /** - * The nonnull entry type. - */ - type?: string; + /** + * True if the entries in this type should be matched case insensitively, default is false. + */ + caseInsensitive?: boolean; + /** + * The value of color must be a correct hex color + */ + hexColor?: string; + /** + * True if the type just for hint, not for redaction, default is false. + */ + hint?: boolean; + /** + * The nonnull entry type. + */ + type?: string; } diff --git a/libs/red-ui-http/src/lib/model/updateTypeValue.ts b/libs/red-ui-http/src/lib/model/updateTypeValue.ts index 027de6ffb..3ac0845a8 100644 --- a/libs/red-ui-http/src/lib/model/updateTypeValue.ts +++ b/libs/red-ui-http/src/lib/model/updateTypeValue.ts @@ -14,16 +14,16 @@ * Object containing information of type to be updated. */ export interface UpdateTypeValue { - /** - * True if the entries in this type should be matched case insensitively, default is false. - */ - caseInsensitive?: boolean; - /** - * The value of color must be a correct hex color - */ - hexColor?: string; - /** - * True if the type just for hint, not for redaction, default is false. - */ - hint?: boolean; + /** + * True if the entries in this type should be matched case insensitively, default is false. + */ + caseInsensitive?: boolean; + /** + * The value of color must be a correct hex color + */ + hexColor?: string; + /** + * True if the type just for hint, not for redaction, default is false. + */ + hint?: boolean; } diff --git a/libs/red-ui-http/src/lib/model/user.ts b/libs/red-ui-http/src/lib/model/user.ts index 02b271f04..338f08774 100644 --- a/libs/red-ui-http/src/lib/model/user.ts +++ b/libs/red-ui-http/src/lib/model/user.ts @@ -14,28 +14,28 @@ * Object containing information of user and roles. */ export interface User { - /** - * Email of user. - */ - email?: string; - /** - * First name of user. - */ - firstName?: string; - /** - * Last name of user. - */ - lastName?: string; - /** - * The list of RED_* roles. - */ - roles?: Array; - /** - * Id of user. - */ - userId?: string; - /** - * Username for login. - */ - username?: string; + /** + * Email of user. + */ + email?: string; + /** + * First name of user. + */ + firstName?: string; + /** + * Last name of user. + */ + lastName?: string; + /** + * The list of RED_* roles. + */ + roles?: Array; + /** + * Id of user. + */ + userId?: string; + /** + * Username for login. + */ + username?: string; } diff --git a/libs/red-ui-http/src/lib/model/userRequest.ts b/libs/red-ui-http/src/lib/model/userRequest.ts index f9520bfbc..1e32876d6 100644 --- a/libs/red-ui-http/src/lib/model/userRequest.ts +++ b/libs/red-ui-http/src/lib/model/userRequest.ts @@ -11,6 +11,6 @@ */ export interface UserRequest { - search?: string; - requestId?: string; + search?: string; + requestId?: string; } diff --git a/libs/red-ui-http/src/lib/model/userResponse.ts b/libs/red-ui-http/src/lib/model/userResponse.ts index c4fbb86c2..c7ed565b3 100644 --- a/libs/red-ui-http/src/lib/model/userResponse.ts +++ b/libs/red-ui-http/src/lib/model/userResponse.ts @@ -9,26 +9,26 @@ * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ -import {User} from './user'; +import { User } from './user'; /** * Object containing a list of values of user. */ export interface UserResponse { - /** - * True if there is next page. - */ - hasNextPage?: boolean; - /** - * The requestId generated by server. - */ - requestId?: string; - /** - * Total number of available users. - */ - total?: number; - /** - * The list of user, which includes all the important information about a user. - */ - users?: Array; + /** + * True if there is next page. + */ + hasNextPage?: boolean; + /** + * The requestId generated by server. + */ + requestId?: string; + /** + * Total number of available users. + */ + total?: number; + /** + * The list of user, which includes all the important information about a user. + */ + users?: Array; } diff --git a/libs/red-ui-http/src/lib/variables.ts b/libs/red-ui-http/src/lib/variables.ts index d797b2656..0763faba7 100644 --- a/libs/red-ui-http/src/lib/variables.ts +++ b/libs/red-ui-http/src/lib/variables.ts @@ -1,9 +1,9 @@ -import {InjectionToken} from '@angular/core'; +import { InjectionToken } from '@angular/core'; export const BASE_PATH = new InjectionToken('basePath'); export const COLLECTION_FORMATS = { - 'csv': ',', - 'tsv': ' ', - 'ssv': ' ', - 'pipes': '|' -} + csv: ',', + tsv: ' ', + ssv: ' ', + pipes: '|' +}; diff --git a/libs/red-ui-http/tsconfig.json b/libs/red-ui-http/tsconfig.json index 62ebbd946..1e5701a22 100644 --- a/libs/red-ui-http/tsconfig.json +++ b/libs/red-ui-http/tsconfig.json @@ -1,13 +1,13 @@ { - "extends": "../../tsconfig.base.json", - "files": [], - "include": [], - "references": [ - { - "path": "./tsconfig.lib.json" - }, - { - "path": "./tsconfig.spec.json" - } - ] + "extends": "../../tsconfig.base.json", + "files": [], + "include": [], + "references": [ + { + "path": "./tsconfig.lib.json" + }, + { + "path": "./tsconfig.spec.json" + } + ] } diff --git a/libs/red-ui-http/tsconfig.lib.json b/libs/red-ui-http/tsconfig.lib.json index f5d3f5eac..68536f23b 100644 --- a/libs/red-ui-http/tsconfig.lib.json +++ b/libs/red-ui-http/tsconfig.lib.json @@ -1,26 +1,18 @@ { - "extends": "./tsconfig.json", - "compilerOptions": { - "outDir": "../../dist/out-tsc", - "target": "es2015", - "declaration": true, - "inlineSources": true, - "types": [], - "lib": [ - "dom", - "es2018" - ] - }, - "angularCompilerOptions": { - "skipTemplateCodegen": true, - "strictMetadataEmit": true, - "enableResourceInlining": true - }, - "exclude": [ - "src/test-setup.ts", - "**/*.spec.ts" - ], - "include": [ - "**/*.ts" - ] + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../dist/out-tsc", + "target": "es2015", + "declaration": true, + "inlineSources": true, + "types": [], + "lib": ["dom", "es2018"] + }, + "angularCompilerOptions": { + "skipTemplateCodegen": true, + "strictMetadataEmit": true, + "enableResourceInlining": true + }, + "exclude": ["src/test-setup.ts", "**/*.spec.ts"], + "include": ["**/*.ts"] } diff --git a/libs/red-ui-http/tslint.json b/libs/red-ui-http/tslint.json index 7de4c2b70..1ccb8df99 100644 --- a/libs/red-ui-http/tslint.json +++ b/libs/red-ui-http/tslint.json @@ -1,22 +1,10 @@ { - "extends": "../../tslint.json", - "rules": { - "directive-selector": [ - true, - "attribute", - "redaction", - "camelCase" - ], - "component-selector": [ - true, - "element", - "redaction", - "kebab-case" - ] - }, - "linterOptions": { - "exclude": [ - "!**/*" - ] - } + "extends": "../../tslint.json", + "rules": { + "directive-selector": [true, "attribute", "redaction", "camelCase"], + "component-selector": [true, "element", "redaction", "kebab-case"] + }, + "linterOptions": { + "exclude": ["!**/*"] + } } diff --git a/nx.json b/nx.json index daa79060c..766e96c38 100644 --- a/nx.json +++ b/nx.json @@ -1,32 +1,32 @@ { - "npmScope": "redaction", - "affected": { - "defaultBase": "master" - }, - "implicitDependencies": { - "workspace.json": "*", - "package.json": { - "dependencies": "*", - "devDependencies": "*" + "npmScope": "redaction", + "affected": { + "defaultBase": "master" }, - "tsconfig.base.json": "*", - "tslint.json": "*", - "nx.json": "*" - }, - "tasksRunnerOptions": { - "default": { - "runner": "@nrwl/workspace/tasks-runners/default", - "options": { - "cacheableOperations": ["build", "lint", "test", "e2e"] - } - } - }, - "projects": { - "red-ui": { - "tags": [] + "implicitDependencies": { + "workspace.json": "*", + "package.json": { + "dependencies": "*", + "devDependencies": "*" + }, + "tsconfig.base.json": "*", + "tslint.json": "*", + "nx.json": "*" }, - "red-ui-http": { - "tags": [] + "tasksRunnerOptions": { + "default": { + "runner": "@nrwl/workspace/tasks-runners/default", + "options": { + "cacheableOperations": ["build", "lint", "test", "e2e"] + } + } + }, + "projects": { + "red-ui": { + "tags": [] + }, + "red-ui-http": { + "tags": [] + } } - } } diff --git a/package.json b/package.json index 9f1889ca8..79547702e 100644 --- a/package.json +++ b/package.json @@ -1,88 +1,96 @@ { - "name": "redaction", - "version": "0.0.81", - "license": "MIT", - "scripts": { - "build-lint-all": "ng lint --project=red-ui-http --fix && ng build --project=red-ui-http && ng lint --project=red-ui --fix && ng build --project=red-ui --prod", - "nx": "nx", - "start": "nx serve", - "build": "nx build", - "test": "nx test", - "lint": "nx workspace-lint && nx lint", - "e2e": "nx e2e", - "affected:apps": "nx affected:apps", - "affected:libs": "nx affected:libs", - "affected:build": "nx affected:build", - "affected:e2e": "nx affected:e2e", - "affected:test": "nx affected:test", - "affected:lint": "nx affected:lint", - "affected:dep-graph": "nx affected:dep-graph", - "affected": "nx affected", - "format": "nx format:write", - "format:write": "nx format:write", - "format:check": "nx format:check", - "update": "nx migrate latest", - "workspace-schematic": "nx workspace-schematic", - "dep-graph": "nx dep-graph", - "help": "nx help", - "postinstall": "ngcc --properties es2015 browser module main --first-only --create-ivy-entry-points" - }, - "private": true, - "dependencies": { - "@angular/animations": "^10.0.0", - "@angular/cdk": "^10.2.3", - "@angular/common": "^10.0.0", - "@angular/core": "^10.0.0", - "@angular/forms": "^10.0.0", - "@angular/material": "^10.2.1", - "@angular/platform-browser": "^10.0.0", - "@angular/platform-browser-dynamic": "^10.0.0", - "@angular/router": "^10.0.0", - "@angular/service-worker": "^10.0.0", - "@ngx-translate/core": "^13.0.0", - "@ngx-translate/http-loader": "^6.0.0", - "@nrwl/angular": "^10.2.0", - "@pdftron/webviewer": "^7.0.1", - "file-saver": "^2.0.2", - "jwt-decode": "^3.0.0", - "keycloak-angular": "^8.0.1", - "keycloak-js": "10.0.2", - "ng2-file-upload": "^1.4.0", - "ngp-sort-pipe": "^0.0.4", - "ngx-dropzone": "^2.2.2", - "ngx-toastr": "^13.0.0", - "rxjs": "~6.5.5", - "scroll-into-view-if-needed": "^2.2.26", - "zone.js": "^0.10.2" - }, - "devDependencies": { - "@angular-devkit/build-angular": "~0.1000.0", - "@angular-devkit/build-ng-packagr": "^0.1001.3", - "@angular/cli": "^10.1.2", - "@angular/compiler": "^10.0.0", - "@angular/compiler-cli": "^10.0.0", - "@angular/language-service": "^10.0.0", - "@nrwl/cypress": "10.2.0", - "@nrwl/jest": "10.2.0", - "@nrwl/workspace": "10.2.0", - "@types/jest": "26.0.8", - "@types/node": "~8.9.4", - "codelyzer": "~5.0.1", - "cypress": "^4.1.0", - "dotenv": "6.2.0", - "eslint": "6.8.0", - "google-translate-api-browser": "^1.1.71", - "jest": "26.2.2", - "jest-preset-angular": "8.2.1", - "lodash": "^4.17.20", - "moment": "^2.28.0", - "ng-packagr": "^10.1.2", - "prettier": "2.0.4", - "superagent": "^6.1.0", - "superagent-promise": "^1.1.0", - "ts-jest": "26.1.4", - "ts-node": "~7.0.0", - "tslint": "~6.0.0", - "typescript": "~3.9.3" - } + "name": "redaction", + "version": "0.0.82", + "license": "MIT", + "husky": { + "hooks": { + "pre-commit": "pretty-quick --staged" + } + }, + "scripts": { + "build-lint-all": "ng lint --project=red-ui-http --fix && ng build --project=red-ui-http && ng lint --project=red-ui --fix && ng build --project=red-ui --prod", + "nx": "nx", + "start": "nx serve", + "build": "nx build", + "test": "nx test", + "lint": "nx workspace-lint && nx lint", + "e2e": "nx e2e", + "affected:apps": "nx affected:apps", + "affected:libs": "nx affected:libs", + "affected:build": "nx affected:build", + "affected:e2e": "nx affected:e2e", + "affected:test": "nx affected:test", + "affected:lint": "nx affected:lint", + "affected:dep-graph": "nx affected:dep-graph", + "affected": "nx affected", + "format": "nx format:write", + "format:write": "nx format:write", + "format:check": "nx format:check", + "update": "nx migrate latest", + "workspace-schematic": "nx workspace-schematic", + "dep-graph": "nx dep-graph", + "help": "nx help", + "postinstall": "ngcc --properties es2015 browser module main --first-only --create-ivy-entry-points" + }, + "private": true, + "dependencies": { + "@angular/animations": "^10.0.0", + "@angular/cdk": "^10.2.3", + "@angular/common": "^10.0.0", + "@angular/core": "^10.0.0", + "@angular/forms": "^10.0.0", + "@angular/material": "^10.2.1", + "@angular/platform-browser": "^10.0.0", + "@angular/platform-browser-dynamic": "^10.0.0", + "@angular/router": "^10.0.0", + "@angular/service-worker": "^10.0.0", + "@ngx-translate/core": "^13.0.0", + "@ngx-translate/http-loader": "^6.0.0", + "@nrwl/angular": "^10.2.0", + "@pdftron/webviewer": "^7.0.1", + "file-saver": "^2.0.2", + "jwt-decode": "^3.0.0", + "keycloak-angular": "^8.0.1", + "keycloak-js": "10.0.2", + "lint-staged": "^10.5.0", + "ng2-file-upload": "^1.4.0", + "ngp-sort-pipe": "^0.0.4", + "ngx-dropzone": "^2.2.2", + "ngx-toastr": "^13.0.0", + "rxjs": "~6.5.5", + "scroll-into-view-if-needed": "^2.2.26", + "zone.js": "^0.10.2" + }, + "devDependencies": { + "@angular-devkit/build-angular": "~0.1000.0", + "@angular-devkit/build-ng-packagr": "^0.1001.3", + "@angular/cli": "^10.1.2", + "@angular/compiler": "^10.0.0", + "@angular/compiler-cli": "^10.0.0", + "@angular/language-service": "^10.0.0", + "@nrwl/cypress": "10.2.0", + "@nrwl/jest": "10.2.0", + "@nrwl/workspace": "10.2.0", + "@types/jest": "26.0.8", + "@types/node": "~8.9.4", + "codelyzer": "~5.0.1", + "cypress": "^4.1.0", + "dotenv": "6.2.0", + "eslint": "6.8.0", + "google-translate-api-browser": "^1.1.71", + "husky": "^4.3.0", + "jest": "26.2.2", + "jest-preset-angular": "8.2.1", + "lodash": "^4.17.20", + "moment": "^2.28.0", + "ng-packagr": "^10.1.2", + "prettier": "2.0.4", + "pretty-quick": "^3.1.0", + "superagent": "^6.1.0", + "superagent-promise": "^1.1.0", + "ts-jest": "26.1.4", + "ts-node": "~7.0.0", + "tslint": "~6.0.0", + "typescript": "~3.9.3" + } } diff --git a/tools/auto-i18n/README.md b/tools/auto-i18n/README.md index 302d6633f..58d8a7e2e 100644 --- a/tools/auto-i18n/README.md +++ b/tools/auto-i18n/README.md @@ -1,5 +1,7 @@ # Run Example -node translate.js ./../../apps/red-ui/src/assets/i18n/en.json de -# API KEY -AIzaSyC2fOUHLV6nhmCSwKcacaNqumn20k8Ic_M +node translate.js ./../../apps/red-ui/src/assets/i18n/en.json de + +# API KEY + +AIzaSyC2fOUHLV6nhmCSwKcacaNqumn20k8Ic_M diff --git a/tools/auto-i18n/translate.js b/tools/auto-i18n/translate.js index 10c02b172..e1b805bd3 100644 --- a/tools/auto-i18n/translate.js +++ b/tools/auto-i18n/translate.js @@ -5,111 +5,148 @@ const moment = require('moment'); const _ = require('lodash'); const path = require('path'); const agent = require('superagent-promise')(require('superagent'), Promise); -const { translate } = require("google-translate-api-browser"); +const { translate } = require('google-translate-api-browser'); let dicc = {}; //Lang Codes https://ctrlq.org/code/19899-google-translate-languages if (process.argv.length >= 4) { + //Args + const inputFile = process.argv[2]; + const destinationCodes = process.argv[3].split(','); + const apiKey = process.argv.length > 4 && process.argv[4]; - //Args - const inputFile = process.argv[2]; - const destinationCodes = process.argv[3].split(','); - const apiKey = process.argv.length > 4 && process.argv[4]; + const apiUrl = _.template( + 'https://www.googleapis.com/language/translate/v2?key=<%= apiKey %>&q=<%= value %>&source=en&target=<%= languageKey %>' + ); - const apiUrl = _.template('https://www.googleapis.com/language/translate/v2?key=<%= apiKey %>&q=<%= value %>&source=en&target=<%= languageKey %>'); + const transformResponse = (res) => { + return _.get(JSON.parse(res.text), ['data', 'translations', 0, 'translatedText'], ''); + }; - const transformResponse = (res) => { - return _.get(JSON.parse(res.text), ['data', 'translations', 0, 'translatedText'], ''); - } - - const getCache = (languageKey) => { - try { - dicc[languageKey] = {}; - let fileContent = fs.readFileSync(`./translateCache-${languageKey}.txt`, 'utf-8').split('\n'); - fileContent.map((line)=> { - let cached = line.split('|'); - if(cached[0]) dicc[languageKey][cached[0]] = cached[1]; - }); - } catch (error) { - - } - } - const cachedIndex = (key, value, languageKey) => { - const line = key + '|' + value + '\n'; - dicc[languageKey][key] = value; - fs.appendFileSync(`./translateCache-${languageKey}.txt`, line); - return value; - } - - function iterLeaves(value, keyChain, accumulator, languageKey) { - accumulator = accumulator || {}; - keyChain = keyChain || []; - if (_.isObject(value)) { - return _.chain(value).reduce((handlers, v, k) => { - return handlers.concat(iterLeaves(v, keyChain.concat(k), accumulator, languageKey)); - }, []).flattenDeep().value(); - } else { - if(typeof value !== 'string') - return value; - - return function () { - if(!(value in dicc[languageKey])) { - console.log(_.template('Translating <%= value %> to <%= languageKey %>')({value, languageKey})); - - let prom; - //Translates individual string to language code - if(apiKey != '') { - //using apiKey - prom = agent('GET', apiUrl({ - value: encodeURI(value), - languageKey, - apiKey - })).then(transformResponse) - } - else { - //using free api key - prom = translate(value, { to: languageKey }) - } - - return prom.then((res) => cachedIndex(value, res, languageKey)) - .catch((err) => console.log(err)) - .then((text) => { - //Sets the value in the accumulator - _.set(accumulator, keyChain, text); - - //This needs to be returned to it's eventually written to json - return accumulator; + const getCache = (languageKey) => { + try { + dicc[languageKey] = {}; + let fileContent = fs + .readFileSync(`./translateCache-${languageKey}.txt`, 'utf-8') + .split('\n'); + fileContent.map((line) => { + let cached = line.split('|'); + if (cached[0]) dicc[languageKey][cached[0]] = cached[1]; }); + } catch (error) {} + }; + const cachedIndex = (key, value, languageKey) => { + const line = key + '|' + value + '\n'; + dicc[languageKey][key] = value; + fs.appendFileSync(`./translateCache-${languageKey}.txt`, line); + return value; + }; + + function iterLeaves(value, keyChain, accumulator, languageKey) { + accumulator = accumulator || {}; + keyChain = keyChain || []; + if (_.isObject(value)) { + return _.chain(value) + .reduce((handlers, v, k) => { + return handlers.concat( + iterLeaves(v, keyChain.concat(k), accumulator, languageKey) + ); + }, []) + .flattenDeep() + .value(); + } else { + if (typeof value !== 'string') return value; + + return function () { + if (!(value in dicc[languageKey])) { + console.log( + _.template('Translating <%= value %> to <%= languageKey %>')({ + value, + languageKey + }) + ); + + let prom; + //Translates individual string to language code + if (apiKey != '') { + //using apiKey + prom = agent( + 'GET', + apiUrl({ + value: encodeURI(value), + languageKey, + apiKey + }) + ).then(transformResponse); + } else { + //using free api key + prom = translate(value, { to: languageKey }); + } + + return prom + .then((res) => cachedIndex(value, res, languageKey)) + .catch((err) => console.log(err)) + .then((text) => { + //Sets the value in the accumulator + _.set(accumulator, keyChain, text); + + //This needs to be returned to it's eventually written to json + return accumulator; + }); + } else { + console.log(value + ' cached: ' + dicc[languageKey][value]); + _.set(accumulator, keyChain, dicc[languageKey][value]); + return accumulator; + } + }; } - else { - console.log(value + ' cached: ' + dicc[languageKey][value]); - _.set(accumulator, keyChain, dicc[languageKey][value]); - return accumulator; - } - }; } - } - Promise.all(_.reduce(destinationCodes, (sum, languageKey) => { - const fileName = _.template('./<%= languageKey %>-<%= timeStamp %>.json')({ - languageKey, - timeStamp: moment().unix() + Promise.all( + _.reduce( + destinationCodes, + (sum, languageKey) => { + const fileName = _.template('./<%= languageKey %>-<%= timeStamp %>.json')({ + languageKey, + timeStamp: moment().unix() + }); + + //read languageKey Cache. + getCache(languageKey); + + //Starts with the top level strings + return sum.concat( + _.reduce( + iterLeaves( + JSON.parse(fs.readFileSync(path.resolve(inputFile), 'utf-8')), + undefined, + undefined, + languageKey + ), + (promiseChain, fn) => { + return promiseChain.then(fn); + }, + Promise.resolve() + ) + .then((payload) => { + fs.writeFileSync(fileName, JSON.stringify(payload)); + }) + .then( + _.partial( + console.log, + 'Successfully translated all nodes, file output at ' + fileName + ) + ) + ); + }, + [] + ) + ).then(() => { + process.exit(); }); - - //read languageKey Cache. - getCache(languageKey); - - //Starts with the top level strings - return sum.concat(_.reduce(iterLeaves(JSON.parse(fs.readFileSync(path.resolve(inputFile), 'utf-8')), undefined, undefined, languageKey), (promiseChain, fn) => { - return promiseChain.then(fn); - }, Promise.resolve()).then((payload) => { - fs.writeFileSync(fileName, JSON.stringify(payload)); - }).then(_.partial(console.log, 'Successfully translated all nodes, file output at ' + fileName))); - }, [])).then(() => { - process.exit(); - }); - } else { - console.error('You must provide an input json file and a comma-separated list of destination language codes.'); + console.error( + 'You must provide an input json file and a comma-separated list of destination language codes.' + ); } diff --git a/tools/tsconfig.tools.json b/tools/tsconfig.tools.json index 5f6f15d74..4412e0b53 100644 --- a/tools/tsconfig.tools.json +++ b/tools/tsconfig.tools.json @@ -1,11 +1,11 @@ { - "extends": "../tsconfig.base.json", - "compilerOptions": { - "outDir": "../dist/out-tsc/tools", - "rootDir": ".", - "module": "commonjs", - "target": "es5", - "types": ["node"] - }, - "include": ["**/*.ts"] + "extends": "../tsconfig.base.json", + "compilerOptions": { + "outDir": "../dist/out-tsc/tools", + "rootDir": ".", + "module": "commonjs", + "target": "es5", + "types": ["node"] + }, + "include": ["**/*.ts"] } diff --git a/tsconfig.base.json b/tsconfig.base.json index 90c06d318..721d287f0 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -1,23 +1,23 @@ { - "compileOnSave": false, - "compilerOptions": { - "rootDir": ".", - "sourceMap": true, - "declaration": false, - "moduleResolution": "node", - "emitDecoratorMetadata": true, - "experimentalDecorators": true, - "importHelpers": true, - "target": "es2015", - "module": "esnext", - "typeRoots": ["node_modules/@types"], - "lib": ["es2019", "dom"], - "skipLibCheck": true, - "skipDefaultLibCheck": true, - "baseUrl": ".", - "paths": { - "@redaction/red-ui-http": ["libs/red-ui-http/src/index.ts"] - } - }, - "exclude": ["node_modules", "tmp"] + "compileOnSave": false, + "compilerOptions": { + "rootDir": ".", + "sourceMap": true, + "declaration": false, + "moduleResolution": "node", + "emitDecoratorMetadata": true, + "experimentalDecorators": true, + "importHelpers": true, + "target": "es2015", + "module": "esnext", + "typeRoots": ["node_modules/@types"], + "lib": ["es2019", "dom"], + "skipLibCheck": true, + "skipDefaultLibCheck": true, + "baseUrl": ".", + "paths": { + "@redaction/red-ui-http": ["libs/red-ui-http/src/index.ts"] + } + }, + "exclude": ["node_modules", "tmp"] } diff --git a/tslint.json b/tslint.json index 877eaca37..5c7122449 100644 --- a/tslint.json +++ b/tslint.json @@ -1,84 +1,76 @@ { - "rulesDirectory": [ - "node_modules/@nrwl/workspace/src/tslint", - "node_modules/codelyzer" - ], - "linterOptions": { - "exclude": ["**/*"] - }, - "rules": { - "arrow-return-shorthand": true, - "callable-types": true, - "class-name": true, - "deprecation": { - "severity": "warn" + "rulesDirectory": ["node_modules/@nrwl/workspace/src/tslint", "node_modules/codelyzer"], + "linterOptions": { + "exclude": ["**/*"] }, - "forin": true, - "import-blacklist": [true, "rxjs/Rx"], - "interface-over-type-literal": true, - "member-access": false, - "member-ordering": [ - true, - { - "order": [ - "static-field", - "instance-field", - "static-method", - "instance-method" - ] - } - ], - "no-arg": true, - "no-bitwise": true, - "no-console": [true, "debug", "info", "time", "timeEnd", "trace"], - "no-construct": true, - "no-debugger": true, - "no-duplicate-super": true, - "no-empty": false, - "no-empty-interface": true, - "no-eval": true, - "no-inferrable-types": [true, "ignore-params"], - "no-misused-new": true, - "no-non-null-assertion": true, - "no-shadowed-variable": true, - "no-string-literal": false, - "no-string-throw": true, - "no-switch-case-fall-through": true, - "no-unnecessary-initializer": true, - "no-unused-expression": true, - "no-var-keyword": true, - "object-literal-sort-keys": false, - "prefer-const": true, - "radix": true, - "triple-equals": [true, "allow-null-check"], - "unified-signatures": true, - "variable-name": false, - "nx-enforce-module-boundaries": [ - true, - { - "enforceBuildableLibDependency": true, - "allow": [], - "depConstraints": [ - { - "sourceTag": "*", - "onlyDependOnLibsWithTags": ["*"] - } - ] - } - ], - "directive-selector": [true, "attribute", "app", "camelCase"], - "component-selector": [true, "element", "app", "kebab-case"], - "no-conflicting-lifecycle": true, - "no-host-metadata-property": true, - "no-input-rename": true, - "no-inputs-metadata-property": true, - "no-output-native": true, - "no-output-on-prefix": true, - "no-output-rename": true, - "no-outputs-metadata-property": true, - "template-banana-in-box": true, - "template-no-negated-async": true, - "use-lifecycle-interface": true, - "use-pipe-transform-interface": true - } + "rules": { + "arrow-return-shorthand": true, + "callable-types": true, + "class-name": true, + "deprecation": { + "severity": "warn" + }, + "forin": true, + "import-blacklist": [true, "rxjs/Rx"], + "interface-over-type-literal": true, + "member-access": false, + "member-ordering": [ + true, + { + "order": ["static-field", "instance-field", "static-method", "instance-method"] + } + ], + "no-arg": true, + "no-bitwise": true, + "no-console": [true, "debug", "info", "time", "timeEnd", "trace"], + "no-construct": true, + "no-debugger": true, + "no-duplicate-super": true, + "no-empty": false, + "no-empty-interface": true, + "no-eval": true, + "no-inferrable-types": [true, "ignore-params"], + "no-misused-new": true, + "no-non-null-assertion": true, + "no-shadowed-variable": true, + "no-string-literal": false, + "no-string-throw": true, + "no-switch-case-fall-through": true, + "no-unnecessary-initializer": true, + "no-unused-expression": true, + "no-var-keyword": true, + "object-literal-sort-keys": false, + "prefer-const": true, + "radix": true, + "triple-equals": [true, "allow-null-check"], + "unified-signatures": true, + "variable-name": false, + "nx-enforce-module-boundaries": [ + true, + { + "enforceBuildableLibDependency": true, + "allow": [], + "depConstraints": [ + { + "sourceTag": "*", + "onlyDependOnLibsWithTags": ["*"] + } + ] + } + ], + "directive-selector": [true, "attribute", "app", "camelCase"], + "component-selector": [true, "element", "app", "kebab-case"], + "no-conflicting-lifecycle": true, + "no-host-metadata-property": true, + "no-input-rename": true, + "no-inputs-metadata-property": true, + "no-output-native": true, + "no-output-on-prefix": true, + "no-output-rename": true, + "no-outputs-metadata-property": true, + "template-banana-in-box": true, + "template-no-negated-async": true, + "use-lifecycle-interface": true, + "use-pipe-transform-interface": true + } } diff --git a/yarn.lock b/yarn.lock index ec03fda9b..5a226b447 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1891,7 +1891,7 @@ resolved "https://registry.yarnpkg.com/@types/json5/-/json5-0.0.29.tgz#ee28707ae94e11d2b827bcbe5270bcea7f3e71ee" integrity sha1-7ihweulOEdK4J7y+UnC86n8+ce4= -"@types/minimatch@*": +"@types/minimatch@*", "@types/minimatch@^3.0.3": version "3.0.3" resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.3.tgz#3dca0e3f33b200fc7d1139c0cd96c1268cadfd9d" integrity sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA== @@ -1911,6 +1911,11 @@ resolved "https://registry.yarnpkg.com/@types/normalize-package-data/-/normalize-package-data-2.4.0.tgz#e486d0d97396d79beedd0a6e33f4534ff6b4973e" integrity sha512-f5j5b/Gf71L+dbqxIpQ4Z2WlmI/mPJ0fOkGGmFgtb6sAu97EPczzbS3/tJKxmcYDj55OX6ssqwDAWOHIYDRDGA== +"@types/parse-json@^4.0.0": + version "4.0.0" + resolved "https://registry.yarnpkg.com/@types/parse-json/-/parse-json-4.0.0.tgz#2f8bb441434d163b35fb8ffdccd7138927ffb8c0" + integrity sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA== + "@types/prettier@^2.0.0": version "2.1.1" resolved "https://registry.yarnpkg.com/@types/prettier/-/prettier-2.1.1.tgz#be148756d5480a84cde100324c03a86ae5739fb5" @@ -2278,7 +2283,7 @@ ansi-escapes@^3.0.0, ansi-escapes@^3.2.0: resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-3.2.0.tgz#8780b98ff9dbf5638152d1f1fe5c1d7b4442976b" integrity sha512-cBhpre4ma+U0T1oM5fXg7Dy1Jw7zzwv7lt/GoCpr+hDQJoYnKVPLL4dCvSEFMmQurOQvSrwT7SL/DAlhBI97RQ== -ansi-escapes@^4.2.1: +ansi-escapes@^4.2.1, ansi-escapes@^4.3.0: version "4.3.1" resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-4.3.1.tgz#a5c47cc43181f1f38ffd7076837700d395522a61" integrity sha512-JWF7ocqNrp8u9oqpgV+wH5ftbt+cfvv+PTjOvKLT3AdYly/LmORARfEVT1iyjwN+4MqE5UmVKoAdIBqeoCHgLA== @@ -2401,6 +2406,11 @@ arr-union@^3.1.0: resolved "https://registry.yarnpkg.com/arr-union/-/arr-union-3.1.0.tgz#e39b09aea9def866a8f206e288af63919bae39c4" integrity sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ= +array-differ@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/array-differ/-/array-differ-3.0.0.tgz#3cbb3d0f316810eafcc47624734237d6aee4ae6b" + integrity sha512-THtfYS6KtME/yIAhKjZ2ul7XI96lQGHRputJQHO80LAWQnuGP4iCIN8vdMRboGbIEYBwU33q8Tch1os2+X0kMg== + array-flatten@1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/array-flatten/-/array-flatten-1.1.1.tgz#9a5f699051b1e7073328f2a008968b64ea2955d2" @@ -2438,6 +2448,11 @@ arrify@^1.0.0: resolved "https://registry.yarnpkg.com/arrify/-/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d" integrity sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0= +arrify@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/arrify/-/arrify-2.0.1.tgz#c9655e9331e0abcd588d2a7cad7e9956f66701fa" + integrity sha512-3duEwti880xqi4eAMN8AyR4a0ByT90zoYdLlevfrvU43vb0YZwZVfxOgxWrLXXXpyugL0hNZc9G6BiB5B3nUug== + asap@^2.0.0: version "2.0.6" resolved "https://registry.yarnpkg.com/asap/-/asap-2.0.6.tgz#e50347611d7e690943208bbdafebcbc2fb866d46" @@ -2495,6 +2510,11 @@ astral-regex@^1.0.0: resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-1.0.0.tgz#6c8c3fb827dd43ee3918f27b82782ab7658a6fd9" integrity sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg== +astral-regex@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-2.0.0.tgz#483143c567aeed4785759c0865786dc77d7d2e31" + integrity sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ== + async-each@^1.0.1: version "1.0.3" resolved "https://registry.yarnpkg.com/async-each/-/async-each-1.0.3.tgz#b727dbf87d7651602f06f4d4ac387f47d91b0cbf" @@ -3322,6 +3342,14 @@ cli-truncate@^0.2.1: slice-ansi "0.0.4" string-width "^1.0.1" +cli-truncate@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/cli-truncate/-/cli-truncate-2.1.0.tgz#c39e28bf05edcde5be3b98992a22deed5a2b93c7" + integrity sha512-n8fOixwDD6b/ObinzTrp1ZKFzbgvKZvuz/TvejnLn1aQfC6r52XEx85FmuC+3HI+JM7coBRXUvNqEU2PHVrHpg== + dependencies: + slice-ansi "^3.0.0" + string-width "^4.2.0" + cli-width@^2.0.0: version "2.2.1" resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-2.2.1.tgz#b0433d0b4e9c847ef18868a4ef16fd5fc8271c48" @@ -3498,6 +3526,11 @@ commondir@^1.0.1: resolved "https://registry.yarnpkg.com/commondir/-/commondir-1.0.1.tgz#ddd800da0c66127393cca5950ea968a3aaf1253b" integrity sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs= +compare-versions@^3.6.0: + version "3.6.0" + resolved "https://registry.yarnpkg.com/compare-versions/-/compare-versions-3.6.0.tgz#1a5689913685e5a87637b8d3ffca75514ec41d62" + integrity sha512-W6Af2Iw1z4CB7q4uU4hv646dW9GQuBM+YpC0UvUCWSD8w90SJjp+ujJuXaEMtAXBtSqGfMPuFOVn4/+FlaqfBA== + component-emitter@^1.2.1, component-emitter@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/component-emitter/-/component-emitter-1.3.0.tgz#16e4070fba8ae29b679f2215853ee181ab2eabc0" @@ -3676,6 +3709,17 @@ cosmiconfig@^5.0.0: js-yaml "^3.13.1" parse-json "^4.0.0" +cosmiconfig@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-7.0.0.tgz#ef9b44d773959cae63ddecd122de23853b60f8d3" + integrity sha512-pondGvTuVYDk++upghXJabWzL6Kxu6f26ljFw64Swq9v6sQPUL3EUlVDV56diOjpCayKihL6hVe8exIACU4XcA== + dependencies: + "@types/parse-json" "^4.0.0" + import-fresh "^3.2.1" + parse-json "^5.0.0" + path-type "^4.0.0" + yaml "^1.10.0" + create-ecdh@^4.0.0: version "4.0.4" resolved "https://registry.yarnpkg.com/create-ecdh/-/create-ecdh-4.0.4.tgz#d6e7f4bffa66736085a0762fd3a632684dabcc4e" @@ -4076,6 +4120,11 @@ decode-uri-component@^0.2.0: resolved "https://registry.yarnpkg.com/decode-uri-component/-/decode-uri-component-0.2.0.tgz#eb3913333458775cb84cd1a1fae062106bb87545" integrity sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU= +dedent@^0.7.0: + version "0.7.0" + resolved "https://registry.yarnpkg.com/dedent/-/dedent-0.7.0.tgz#2495ddbaf6eb874abb0e1be9df22d2e5a544326c" + integrity sha1-JJXduvbrh0q7Dhvp3yLS5aVEMmw= + deep-equal@^1.0.1: version "1.1.1" resolved "https://registry.yarnpkg.com/deep-equal/-/deep-equal-1.1.1.tgz#b5c98c942ceffaf7cb051e24e1434a25a2e6076a" @@ -4432,6 +4481,13 @@ enhanced-resolve@^4.0.0, enhanced-resolve@^4.1.0: memory-fs "^0.5.0" tapable "^1.0.0" +enquirer@^2.3.6: + version "2.3.6" + resolved "https://registry.yarnpkg.com/enquirer/-/enquirer-2.3.6.tgz#2a7fe5dd634a1e4125a975ec994ff5456dc3734d" + integrity sha512-yjNnPr315/FjS4zIsUxYguYUPP2e1NK4d7E7ZOLiyYCcbFBiTMyID+2wvm2w6+pZ/odMA7cRkjhsPbltwBOrLg== + dependencies: + ansi-colors "^4.1.1" + entities@^2.0.0: version "2.0.3" resolved "https://registry.yarnpkg.com/entities/-/entities-2.0.3.tgz#5c487e5742ab93c15abb5da22759b8590ec03b7f" @@ -4747,7 +4803,7 @@ execa@^1.0.0: signal-exit "^3.0.0" strip-eof "^1.0.0" -execa@^4.0.0: +execa@^4.0.0, execa@^4.0.3: version "4.0.3" resolved "https://registry.yarnpkg.com/execa/-/execa-4.0.3.tgz#0a34dabbad6d66100bd6f2c576c8669403f317f2" integrity sha512-WFDXGHckXPWZX19t1kCsXzOpqX9LWYNqn4C+HqZlk/V0imTkzJZqf87ZBhvpHaftERYknpk0fjSylnXVlVgI0A== @@ -5002,7 +5058,7 @@ figures@^2.0.0: dependencies: escape-string-regexp "^1.0.5" -figures@^3.0.0: +figures@^3.0.0, figures@^3.2.0: version "3.2.0" resolved "https://registry.yarnpkg.com/figures/-/figures-3.2.0.tgz#625c18bd293c604dc4a8ddb2febf0c88341746af" integrity sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg== @@ -5102,6 +5158,13 @@ find-up@^4.0.0, find-up@^4.1.0: locate-path "^5.0.0" path-exists "^4.0.0" +find-versions@^3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/find-versions/-/find-versions-3.2.0.tgz#10297f98030a786829681690545ef659ed1d254e" + integrity sha512-P8WRou2S+oe222TOCHitLy8zj+SIsVJh52VP4lvXkaFVnOFFdoWv1H1Jjvel1aI6NCFOAaeAVm8qrI0odiLcww== + dependencies: + semver-regex "^2.0.0" + flat-cache@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-2.0.1.tgz#5d296d6f04bda44a4630a301413bdbc2ec085ec0" @@ -5317,6 +5380,11 @@ get-caller-file@^2.0.1: resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== +get-own-enumerable-property-symbols@^3.0.0: + version "3.0.2" + resolved "https://registry.yarnpkg.com/get-own-enumerable-property-symbols/-/get-own-enumerable-property-symbols-3.0.2.tgz#b5fde77f22cbe35f390b4e089922c50bce6ef664" + integrity sha512-I0UBV/XOz1XkIJHEUDMZAbzCThU/H8DxmSfmdGcKPnVhu2VfFqr34jr9777IyaTYvxjedWhqVIilEDsCdP5G6g== + get-package-type@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/get-package-type/-/get-package-type-0.1.0.tgz#8de2d803cff44df3bc6c456e6668b36c3926e11a" @@ -5713,6 +5781,22 @@ humanize-ms@^1.2.1: dependencies: ms "^2.0.0" +husky@^4.3.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/husky/-/husky-4.3.0.tgz#0b2ec1d66424e9219d359e26a51c58ec5278f0de" + integrity sha512-tTMeLCLqSBqnflBZnlVDhpaIMucSGaYyX6855jM4AguGeWCeSzNdb1mfyWduTZ3pe3SJVvVWGL0jO1iKZVPfTA== + dependencies: + chalk "^4.0.0" + ci-info "^2.0.0" + compare-versions "^3.6.0" + cosmiconfig "^7.0.0" + find-versions "^3.2.0" + opencollective-postinstall "^2.0.2" + pkg-dir "^4.2.0" + please-upgrade-node "^3.2.0" + slash "^3.0.0" + which-pm-runs "^1.0.0" + iconv-lite@0.4.24, iconv-lite@^0.4.24: version "0.4.24" resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" @@ -5793,7 +5877,7 @@ import-fresh@^2.0.0: caller-path "^2.0.0" resolve-from "^3.0.0" -import-fresh@^3.0.0: +import-fresh@^3.0.0, import-fresh@^3.2.1: version "3.2.1" resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-3.2.1.tgz#633ff618506e793af5ac91bf48b72677e15cbe66" integrity sha512-6e1q1cnWP2RXD9/keSkxHScg508CdXqXWgWBaETNhyuBFz+kUZlKboh+ISK+bU++DmbHimVBrOz/zzPe0sZ3sQ== @@ -6174,6 +6258,11 @@ is-number@^7.0.0: resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b" integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng== +is-obj@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/is-obj/-/is-obj-1.0.1.tgz#3e4729ac1f5fde025cd7d83a896dab9f4f67db0f" + integrity sha1-PkcprB9f3gJc19g6iW2rn09n2w8= + is-obj@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/is-obj/-/is-obj-2.0.0.tgz#473fb05d973705e3fd9620545018ca8e22ef4982" @@ -6246,6 +6335,11 @@ is-regex@^1.0.4, is-regex@^1.1.0, is-regex@^1.1.1: dependencies: has-symbols "^1.0.1" +is-regexp@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-regexp/-/is-regexp-1.0.0.tgz#fd2d883545c46bac5a633e7b9a09e87fa2cb5069" + integrity sha1-/S2INUXEa6xaYz57mgnof6LLUGk= + is-resolvable@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/is-resolvable/-/is-resolvable-1.1.0.tgz#fb18f87ce1feb925169c9a407c19318a3206ed88" @@ -7052,6 +7146,27 @@ lines-and-columns@^1.1.6: resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.1.6.tgz#1c00c743b433cd0a4e80758f7b64a57440d9ff00" integrity sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA= +lint-staged@^10.5.0: + version "10.5.0" + resolved "https://registry.yarnpkg.com/lint-staged/-/lint-staged-10.5.0.tgz#c923c2447a84c595874f3de696778736227e7a7a" + integrity sha512-gjC9+HGkBubOF+Yyoj9pd52Qfm/kYB+dRX1UOgWjHKvSDYl+VHkZXlBMlqSZa2cH3Kp5/uNL480sV6e2dTgXSg== + dependencies: + chalk "^4.1.0" + cli-truncate "^2.1.0" + commander "^6.0.0" + cosmiconfig "^7.0.0" + debug "^4.1.1" + dedent "^0.7.0" + enquirer "^2.3.6" + execa "^4.0.3" + listr2 "^2.6.0" + log-symbols "^4.0.0" + micromatch "^4.0.2" + normalize-path "^3.0.0" + please-upgrade-node "^3.2.0" + string-argv "0.3.1" + stringify-object "^3.3.0" + listr-silent-renderer@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/listr-silent-renderer/-/listr-silent-renderer-1.1.1.tgz#924b5a3757153770bf1a8e3fbf74b8bbf3f9242e" @@ -7081,6 +7196,20 @@ listr-verbose-renderer@^0.5.0: date-fns "^1.27.2" figures "^2.0.0" +listr2@^2.6.0: + version "2.6.2" + resolved "https://registry.yarnpkg.com/listr2/-/listr2-2.6.2.tgz#4912eb01e1e2dd72ec37f3895a56bf2622d6f36a" + integrity sha512-6x6pKEMs8DSIpA/tixiYY2m/GcbgMplMVmhQAaLFxEtNSKLeWTGjtmU57xvv6QCm2XcqzyNXL/cTSVf4IChCRA== + dependencies: + chalk "^4.1.0" + cli-truncate "^2.1.0" + figures "^3.2.0" + indent-string "^4.0.0" + log-update "^4.0.0" + p-map "^4.0.0" + rxjs "^6.6.2" + through "^2.3.8" + listr@^0.14.3: version "0.14.3" resolved "https://registry.yarnpkg.com/listr/-/listr-0.14.3.tgz#2fea909604e434be464c50bddba0d496928fa586" @@ -7213,6 +7342,16 @@ log-update@^2.3.0: cli-cursor "^2.0.0" wrap-ansi "^3.0.1" +log-update@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/log-update/-/log-update-4.0.0.tgz#589ecd352471f2a1c0c570287543a64dfd20e0a1" + integrity sha512-9fkkDevMefjg0mmzWFBW8YkFP91OrizzkW3diF7CpG+S2EYdy4+TVfGwz1zeF8x7hCx1ovSPTOE9Ngib74qqUg== + dependencies: + ansi-escapes "^4.3.0" + cli-cursor "^3.1.0" + slice-ansi "^4.0.0" + wrap-ansi "^6.2.0" + loglevel@^1.6.8: version "1.7.0" resolved "https://registry.yarnpkg.com/loglevel/-/loglevel-1.7.0.tgz#728166855a740d59d38db01cf46f042caa041bb0" @@ -7589,6 +7728,11 @@ move-file@^2.0.0: dependencies: path-exists "^4.0.0" +mri@^1.1.5: + version "1.1.6" + resolved "https://registry.yarnpkg.com/mri/-/mri-1.1.6.tgz#49952e1044db21dbf90f6cd92bc9c9a777d415a6" + integrity sha512-oi1b3MfbyGa7FJMP9GmLTttni5JoICpYBRlq+x5V16fZbLsnL9N3wFqqIm/nIG43FjUFkFh9Epzp/kzUGUnJxQ== + ms@2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" @@ -7617,6 +7761,17 @@ multicast-dns@^6.0.1: dns-packet "^1.3.1" thunky "^1.0.2" +multimatch@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/multimatch/-/multimatch-4.0.0.tgz#8c3c0f6e3e8449ada0af3dd29efb491a375191b3" + integrity sha512-lDmx79y1z6i7RNx0ZGCPq1bzJ6ZoDDKbvh7jxr9SJcWLkShMzXrHbYVpTdnhNM5MXpDUxCQ4DgqVttVXlBgiBQ== + dependencies: + "@types/minimatch" "^3.0.3" + array-differ "^3.0.0" + array-union "^2.1.0" + arrify "^2.0.1" + minimatch "^3.0.4" + mute-stream@0.0.7: version "0.0.7" resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.7.tgz#3075ce93bc21b8fab43e1bc4da7e8115ed1e7bab" @@ -8127,6 +8282,11 @@ open@7.2.0: is-docker "^2.0.0" is-wsl "^2.1.1" +opencollective-postinstall@^2.0.2: + version "2.0.3" + resolved "https://registry.yarnpkg.com/opencollective-postinstall/-/opencollective-postinstall-2.0.3.tgz#7a0fff978f6dbfa4d006238fbac98ed4198c3259" + integrity sha512-8AV/sCtuzUeTo8gQK5qDZzARrulB3egtLzFgteqB2tcT4Mw7B8Kt7JcDHmltjz6FOAHsvTevk70gZEbhM4ZS9Q== + opn@^5.3.0, opn@^5.5.0: version "5.5.0" resolved "https://registry.yarnpkg.com/opn/-/opn-5.5.0.tgz#fc7164fab56d235904c51c3b27da6758ca3b9bfc" @@ -8518,6 +8678,13 @@ pkg-dir@^4.1.0, pkg-dir@^4.2.0: dependencies: find-up "^4.0.0" +please-upgrade-node@^3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/please-upgrade-node/-/please-upgrade-node-3.2.0.tgz#aeddd3f994c933e4ad98b99d9a556efa0e2fe942" + integrity sha512-gQR3WpIgNIKwBMVLkpMUeR3e1/E1y42bqDQZfql+kDeXd8COYfM8PQA4X6y7a8u9Ua9FHmsrrmirW2vHs45hWg== + dependencies: + semver-compare "^1.0.0" + pnp-webpack-plugin@1.6.4: version "1.6.4" resolved "https://registry.yarnpkg.com/pnp-webpack-plugin/-/pnp-webpack-plugin-1.6.4.tgz#c9711ac4dc48a685dabafc86f8b6dd9f8df84149" @@ -8962,6 +9129,18 @@ pretty-format@^26.0.0, pretty-format@^26.4.2: ansi-styles "^4.0.0" react-is "^16.12.0" +pretty-quick@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/pretty-quick/-/pretty-quick-3.1.0.tgz#cb172e9086deb57455dea7c7e8f136cd0a4aef6c" + integrity sha512-DtxIxksaUWCgPFN7E1ZZk4+Aav3CCuRdhrDSFZENb404sYMtuo9Zka823F+Mgeyt8Zt3bUiCjFzzWYE9LYqkmQ== + dependencies: + chalk "^3.0.0" + execa "^4.0.0" + find-up "^4.1.0" + ignore "^5.1.4" + mri "^1.1.5" + multimatch "^4.0.0" + process-nextick-args@~2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz#7820d9b16120cc55ca9ae7792680ae7dba6d7fe2" @@ -9655,7 +9834,7 @@ rxjs@6.6.2: dependencies: tslib "^1.9.0" -rxjs@^6.3.3, rxjs@^6.4.0, rxjs@^6.5.0, rxjs@^6.5.4, rxjs@^6.6.0: +rxjs@^6.3.3, rxjs@^6.4.0, rxjs@^6.5.0, rxjs@^6.5.4, rxjs@^6.6.0, rxjs@^6.6.2: version "6.6.3" resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.6.3.tgz#8ca84635c4daa900c0d3967a6ee7ac60271ee552" integrity sha512-trsQc+xYYXZ3urjOiJOuCOa5N3jAZ3eiSpQB5hIT8zGlL2QfnHLJ2r7GMkBGuIausdJN1OneaI6gQlsqNHHmZQ== @@ -9773,6 +9952,11 @@ selfsigned@^1.10.7: dependencies: node-forge "^0.10.0" +semver-compare@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/semver-compare/-/semver-compare-1.0.0.tgz#0dee216a1c941ab37e9efb1788f6afc5ff5537fc" + integrity sha1-De4hahyUGrN+nvsXiPavxf9VN/w= + semver-dsl@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/semver-dsl/-/semver-dsl-1.0.1.tgz#d3678de5555e8a61f629eed025366ae5f27340a0" @@ -9787,6 +9971,11 @@ semver-intersect@1.4.0: dependencies: semver "^5.0.0" +semver-regex@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/semver-regex/-/semver-regex-2.0.0.tgz#a93c2c5844539a770233379107b38c7b4ac9d338" + integrity sha512-mUdIBBvdn0PLOeP3TEkMH7HHeUP3GjsXCwKarjv/kGmUFOYg1VqEemKhoQpWMu6X2I8kHeuVdGibLGkVK+/5Qw== + "semver@2 || 3 || 4 || 5", semver@^5.0.0, semver@^5.0.1, semver@^5.3.0, semver@^5.4.1, semver@^5.5.0, semver@^5.5.1, semver@^5.6.0: version "5.7.1" resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7" @@ -9983,6 +10172,24 @@ slice-ansi@^2.1.0: astral-regex "^1.0.0" is-fullwidth-code-point "^2.0.0" +slice-ansi@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-3.0.0.tgz#31ddc10930a1b7e0b67b08c96c2f49b77a789787" + integrity sha512-pSyv7bSTC7ig9Dcgbw9AuRNUb5k5V6oDudjZoMBSr13qpLBG7tB+zgCkARjq7xIUgdz5P1Qe8u+rSGdouOOIyQ== + dependencies: + ansi-styles "^4.0.0" + astral-regex "^2.0.0" + is-fullwidth-code-point "^3.0.0" + +slice-ansi@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-4.0.0.tgz#500e8dd0fd55b05815086255b3195adf2a45fe6b" + integrity sha512-qMCMfhY040cVHT43K9BFygqYbUPFZKHOg7K73mtTWJRb8pyP3fzf4Ixd5SzdEJQ6MRUg/WBnOLxghZtKKurENQ== + dependencies: + ansi-styles "^4.0.0" + astral-regex "^2.0.0" + is-fullwidth-code-point "^3.0.0" + smart-buffer@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/smart-buffer/-/smart-buffer-4.1.0.tgz#91605c25d91652f4661ea69ccf45f1b331ca21ba" @@ -10299,6 +10506,11 @@ strict-uri-encode@^1.0.0: resolved "https://registry.yarnpkg.com/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz#279b225df1d582b1f54e65addd4352e18faa0713" integrity sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM= +string-argv@0.3.1: + version "0.3.1" + resolved "https://registry.yarnpkg.com/string-argv/-/string-argv-0.3.1.tgz#95e2fbec0427ae19184935f816d74aaa4c5c19da" + integrity sha512-a1uQGz7IyVy9YwhqjZIZu1c8JO8dNIe20xBmSS6qu9kv++k3JGzCVmprbNN5Kn+BgzD5E7YYwg1CcjuJMRNsvg== + string-length@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/string-length/-/string-length-4.0.1.tgz#4a973bf31ef77c4edbceadd6af2611996985f8a1" @@ -10380,6 +10592,15 @@ string_decoder@~1.1.1: dependencies: safe-buffer "~5.1.0" +stringify-object@^3.3.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/stringify-object/-/stringify-object-3.3.0.tgz#703065aefca19300d3ce88af4f5b3956d7556629" + integrity sha512-rHqiFh1elqCQ9WPLIC8I0Q/g/wj5J1eMkyoiD6eoQApWHP0FtlK7rqnhmabL5VUY9JQCcqwwvlOaSuutekgyrw== + dependencies: + get-own-enumerable-property-symbols "^3.0.0" + is-obj "^1.0.1" + is-regexp "^1.0.0" + strip-ansi@^3.0.0, strip-ansi@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf" @@ -10714,7 +10935,7 @@ through2@^2.0.0: readable-stream "~2.3.6" xtend "~4.0.1" -"through@>=2.2.7 <3", through@X.X.X, through@^2.3.6: +"through@>=2.2.7 <3", through@X.X.X, through@^2.3.6, through@^2.3.8: version "2.3.8" resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" integrity sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU= @@ -11503,6 +11724,11 @@ which-module@^2.0.0: resolved "https://registry.yarnpkg.com/which-module/-/which-module-2.0.0.tgz#d9ef07dce77b9902b8a3a8fa4b31c3e3f7e6e87a" integrity sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho= +which-pm-runs@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/which-pm-runs/-/which-pm-runs-1.0.0.tgz#670b3afbc552e0b55df6b7780ca74615f23ad1cb" + integrity sha1-Zws6+8VS4LVd9rd4DKdGFfI60cs= + which@^1.2.9, which@^1.3.1: version "1.3.1" resolved "https://registry.yarnpkg.com/which/-/which-1.3.1.tgz#a45043d54f5805316da8d62f9f50918d3da70b0a" @@ -11640,6 +11866,11 @@ yallist@^4.0.0: resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72" integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A== +yaml@^1.10.0: + version "1.10.0" + resolved "https://registry.yarnpkg.com/yaml/-/yaml-1.10.0.tgz#3b593add944876077d4d683fee01081bd9fff31e" + integrity sha512-yr2icI4glYaNG+KWONODapy2/jDdMSDnrONSjblABjD9B4Z5LgiircSt8m8sRZFNi08kG9Sm0uSHtEmP3zaEGg== + yargs-parser@18.x, yargs-parser@^18.1.0, yargs-parser@^18.1.2: version "18.1.3" resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-18.1.3.tgz#be68c4975c6b2abf469236b0c870362fab09a7b0"