File Attributes Updates
This commit is contained in:
parent
757e0d33a1
commit
b5006c10dc
@ -7,7 +7,7 @@ To re-generate http rune swagger
|
|||||||
YOu need swagger-codegen installed `brew install swagger-codegen`
|
YOu need swagger-codegen installed `brew install swagger-codegen`
|
||||||
|
|
||||||
```
|
```
|
||||||
BASE=http://redaction.redaction-timo-12027.178.63.47.73.xip.io/
|
BASE=http://redaction.redaction-timo-latest.178.63.47.73.xip.io/
|
||||||
URL="$BASE"v2/api-docs?group=redaction-gateway-v1
|
URL="$BASE"v2/api-docs?group=redaction-gateway-v1
|
||||||
mkdir -p /tmp/swagger
|
mkdir -p /tmp/swagger
|
||||||
swagger-codegen generate -i "$URL" -l typescript-angular -o /tmp/swagger
|
swagger-codegen generate -i "$URL" -l typescript-angular -o /tmp/swagger
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
<redaction-search-input [form]="searchForm" [placeholder]="'project-templates-listing.search'"></redaction-search-input>
|
<redaction-search-input [form]="searchForm" [placeholder]="'project-templates-listing.search'"></redaction-search-input>
|
||||||
|
|
||||||
<redaction-icon-button
|
<redaction-icon-button
|
||||||
*ngIf="permissionsService.isAdmin()"
|
*ngIf="permissionsService.isAdmin() && userPreferenceService.areDevFeaturesEnabled"
|
||||||
icon="red:plus"
|
icon="red:plus"
|
||||||
(action)="openAddRuleSetDialog()"
|
(action)="openAddRuleSetDialog()"
|
||||||
text="project-templates-listing.add-new"
|
text="project-templates-listing.add-new"
|
||||||
|
|||||||
@ -6,6 +6,7 @@ import { PermissionsService } from '../../../common/service/permissions.service'
|
|||||||
import { FormBuilder, FormGroup } from '@angular/forms';
|
import { FormBuilder, FormGroup } from '@angular/forms';
|
||||||
import { debounce } from '../../../utils/debounce';
|
import { debounce } from '../../../utils/debounce';
|
||||||
import { RuleSetModel } from '@redaction/red-ui-http';
|
import { RuleSetModel } from '@redaction/red-ui-http';
|
||||||
|
import { UserPreferenceService } from '../../../common/service/user-preference.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'redaction-rule-sets-listing-screen',
|
selector: 'redaction-rule-sets-listing-screen',
|
||||||
@ -23,7 +24,8 @@ export class RuleSetsListingScreenComponent implements OnInit {
|
|||||||
private readonly _sortingService: SortingService,
|
private readonly _sortingService: SortingService,
|
||||||
private readonly _formBuilder: FormBuilder,
|
private readonly _formBuilder: FormBuilder,
|
||||||
private readonly _appStateService: AppStateService,
|
private readonly _appStateService: AppStateService,
|
||||||
public readonly permissionsService: PermissionsService
|
public readonly permissionsService: PermissionsService,
|
||||||
|
public readonly userPreferenceService: UserPreferenceService
|
||||||
) {
|
) {
|
||||||
this.searchForm = this._formBuilder.group({
|
this.searchForm = this._formBuilder.group({
|
||||||
query: ['']
|
query: ['']
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"OAUTH_URL": "https://redkc-staging.iqser.cloud/auth/realms/redaction",
|
"OAUTH_URL": "https://keycloak-dev.iqser.cloud/auth/realms/redaction",
|
||||||
"OAUTH_CLIENT_ID": "redaction",
|
"OAUTH_CLIENT_ID": "redaction",
|
||||||
"API_URL": "https://redapi-staging.iqser.cloud",
|
"API_URL": "http://redaction.redaction-timo-latest.178.63.47.73.xip.io",
|
||||||
"BACKEND_APP_VERSION": "4.4.40",
|
"BACKEND_APP_VERSION": "4.4.40",
|
||||||
"FRONTEND_APP_VERSION": "1.0",
|
"FRONTEND_APP_VERSION": "1.0",
|
||||||
"EULA_URL": "EULA_URL",
|
"EULA_URL": "EULA_URL",
|
||||||
|
|||||||
@ -11,13 +11,15 @@
|
|||||||
*/ /* tslint:disable:no-unused-variable member-ordering */
|
*/ /* tslint:disable:no-unused-variable member-ordering */
|
||||||
|
|
||||||
import { Inject, Injectable, Optional } from '@angular/core';
|
import { Inject, Injectable, Optional } from '@angular/core';
|
||||||
import { HttpClient, HttpEvent, HttpHeaders, HttpResponse } from '@angular/common/http';
|
import { HttpClient, HttpEvent, HttpHeaders, HttpParams, HttpResponse } from '@angular/common/http';
|
||||||
|
import { CustomHttpUrlEncodingCodec } from '../encoder';
|
||||||
|
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
|
|
||||||
|
import { FileAttributeConfig } from '../model/fileAttributeConfig';
|
||||||
import { FileAttributes } from '../model/fileAttributes';
|
import { FileAttributes } from '../model/fileAttributes';
|
||||||
|
import { FileAttributesBaseConfigRequest } from '../model/fileAttributesBaseConfigRequest';
|
||||||
import { FileAttributesConfig } from '../model/fileAttributesConfig';
|
import { FileAttributesConfig } from '../model/fileAttributesConfig';
|
||||||
import { ImportCsvRequest } from '../model/importCsvRequest';
|
|
||||||
import { ImportCsvResponse } from '../model/importCsvResponse';
|
import { ImportCsvResponse } from '../model/importCsvResponse';
|
||||||
|
|
||||||
import { BASE_PATH } from '../variables';
|
import { BASE_PATH } from '../variables';
|
||||||
@ -53,6 +55,81 @@ export class FileAttributesControllerService {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds or updates file attributes base configuration
|
||||||
|
* None
|
||||||
|
* @param body fileAttributesBaseConfigRequest
|
||||||
|
* @param ruleSetId ruleSetId
|
||||||
|
* @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 addOrUpdateFileAttributesBaseConfig(
|
||||||
|
body: FileAttributesBaseConfigRequest,
|
||||||
|
ruleSetId: string,
|
||||||
|
observe?: 'body',
|
||||||
|
reportProgress?: boolean
|
||||||
|
): Observable<FileAttributesConfig>;
|
||||||
|
public addOrUpdateFileAttributesBaseConfig(
|
||||||
|
body: FileAttributesBaseConfigRequest,
|
||||||
|
ruleSetId: string,
|
||||||
|
observe?: 'response',
|
||||||
|
reportProgress?: boolean
|
||||||
|
): Observable<HttpResponse<FileAttributesConfig>>;
|
||||||
|
public addOrUpdateFileAttributesBaseConfig(
|
||||||
|
body: FileAttributesBaseConfigRequest,
|
||||||
|
ruleSetId: string,
|
||||||
|
observe?: 'events',
|
||||||
|
reportProgress?: boolean
|
||||||
|
): Observable<HttpEvent<FileAttributesConfig>>;
|
||||||
|
public addOrUpdateFileAttributesBaseConfig(
|
||||||
|
body: FileAttributesBaseConfigRequest,
|
||||||
|
ruleSetId: string,
|
||||||
|
observe: any = 'body',
|
||||||
|
reportProgress: boolean = false
|
||||||
|
): Observable<any> {
|
||||||
|
if (body === null || body === undefined) {
|
||||||
|
throw new Error('Required parameter body was null or undefined when calling addOrUpdateFileAttributesBaseConfig.');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ruleSetId === null || ruleSetId === undefined) {
|
||||||
|
throw new Error('Required parameter ruleSetId was null or undefined when calling addOrUpdateFileAttributesBaseConfig.');
|
||||||
|
}
|
||||||
|
|
||||||
|
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<FileAttributesConfig>(
|
||||||
|
'post',
|
||||||
|
`${this.basePath}/fileAttributes/config/baseConfig/${encodeURIComponent(String(ruleSetId))}`,
|
||||||
|
{
|
||||||
|
body: body,
|
||||||
|
withCredentials: this.configuration.withCredentials,
|
||||||
|
headers: headers,
|
||||||
|
observe: observe,
|
||||||
|
reportProgress: reportProgress
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the file attributes that can be used at importing csv.
|
* Get the file attributes that can be used at importing csv.
|
||||||
* None
|
* None
|
||||||
@ -97,17 +174,17 @@ export class FileAttributesControllerService {
|
|||||||
/**
|
/**
|
||||||
* Import a csv file to set file attributes
|
* Import a csv file to set file attributes
|
||||||
* None
|
* None
|
||||||
* @param body importCsvRequest
|
* @param file
|
||||||
* @param projectId projectId
|
* @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 observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||||
* @param reportProgress flag to report request and response progress.
|
* @param reportProgress flag to report request and response progress.
|
||||||
*/
|
*/
|
||||||
public importCsv(body: ImportCsvRequest, projectId: string, observe?: 'body', reportProgress?: boolean): Observable<ImportCsvResponse>;
|
public importCsvForm(file: Blob, projectId: string, observe?: 'body', reportProgress?: boolean): Observable<ImportCsvResponse>;
|
||||||
public importCsv(body: ImportCsvRequest, projectId: string, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<ImportCsvResponse>>;
|
public importCsvForm(file: Blob, projectId: string, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<ImportCsvResponse>>;
|
||||||
public importCsv(body: ImportCsvRequest, projectId: string, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<ImportCsvResponse>>;
|
public importCsvForm(file: Blob, projectId: string, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<ImportCsvResponse>>;
|
||||||
public importCsv(body: ImportCsvRequest, projectId: string, observe: any = 'body', reportProgress: boolean = false): Observable<any> {
|
public importCsvForm(file: Blob, projectId: string, observe: any = 'body', reportProgress: boolean = false): Observable<any> {
|
||||||
if (body === null || body === undefined) {
|
if (file === null || file === undefined) {
|
||||||
throw new Error('Required parameter body was null or undefined when calling importCsv.');
|
throw new Error('Required parameter file was null or undefined when calling importCsv.');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (projectId === null || projectId === undefined) {
|
if (projectId === null || projectId === undefined) {
|
||||||
@ -130,14 +207,28 @@ export class FileAttributesControllerService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
const consumes: string[] = ['application/json'];
|
const consumes: string[] = ['multipart/form-data'];
|
||||||
const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes);
|
|
||||||
if (httpContentTypeSelected !== undefined) {
|
const canConsumeForm = this.canConsumeForm(consumes);
|
||||||
headers = headers.set('Content-Type', httpContentTypeSelected);
|
|
||||||
|
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', <any>file) as any) || formParams;
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.httpClient.request<ImportCsvResponse>('post', `${this.basePath}/fileAttributes/csvImport/${encodeURIComponent(String(projectId))}`, {
|
return this.httpClient.request<ImportCsvResponse>('post', `${this.basePath}/fileAttributes/csvImport/${encodeURIComponent(String(projectId))}`, {
|
||||||
body: body,
|
body: convertFormParamsToString ? formParams.toString() : formParams,
|
||||||
withCredentials: this.configuration.withCredentials,
|
withCredentials: this.configuration.withCredentials,
|
||||||
headers: headers,
|
headers: headers,
|
||||||
observe: observe,
|
observe: observe,
|
||||||
@ -212,33 +303,33 @@ export class FileAttributesControllerService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the file attributes that can be used at importing csv.
|
* Add or update a file attribute that can be used at importing csv.
|
||||||
* None
|
* None
|
||||||
* @param body fileAttributes
|
* @param body fileAttribute
|
||||||
* @param ruleSetId ruleSetId
|
* @param ruleSetId ruleSetId
|
||||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||||
* @param reportProgress flag to report request and response progress.
|
* @param reportProgress flag to report request and response progress.
|
||||||
*/
|
*/
|
||||||
public setFileAttributesConfiguration(
|
public setFileAttributesConfiguration(
|
||||||
body: FileAttributesConfig,
|
body: FileAttributeConfig,
|
||||||
ruleSetId: string,
|
ruleSetId: string,
|
||||||
observe?: 'body',
|
observe?: 'body',
|
||||||
reportProgress?: boolean
|
reportProgress?: boolean
|
||||||
): Observable<FileAttributesConfig>;
|
): Observable<FileAttributeConfig>;
|
||||||
public setFileAttributesConfiguration(
|
public setFileAttributesConfiguration(
|
||||||
body: FileAttributesConfig,
|
body: FileAttributeConfig,
|
||||||
ruleSetId: string,
|
ruleSetId: string,
|
||||||
observe?: 'response',
|
observe?: 'response',
|
||||||
reportProgress?: boolean
|
reportProgress?: boolean
|
||||||
): Observable<HttpResponse<FileAttributesConfig>>;
|
): Observable<HttpResponse<FileAttributeConfig>>;
|
||||||
public setFileAttributesConfiguration(
|
public setFileAttributesConfiguration(
|
||||||
body: FileAttributesConfig,
|
body: FileAttributeConfig,
|
||||||
ruleSetId: string,
|
ruleSetId: string,
|
||||||
observe?: 'events',
|
observe?: 'events',
|
||||||
reportProgress?: boolean
|
reportProgress?: boolean
|
||||||
): Observable<HttpEvent<FileAttributesConfig>>;
|
): Observable<HttpEvent<FileAttributeConfig>>;
|
||||||
public setFileAttributesConfiguration(
|
public setFileAttributesConfiguration(
|
||||||
body: FileAttributesConfig,
|
body: FileAttributeConfig,
|
||||||
ruleSetId: string,
|
ruleSetId: string,
|
||||||
observe: any = 'body',
|
observe: any = 'body',
|
||||||
reportProgress: boolean = false
|
reportProgress: boolean = false
|
||||||
@ -273,12 +364,81 @@ export class FileAttributesControllerService {
|
|||||||
headers = headers.set('Content-Type', httpContentTypeSelected);
|
headers = headers.set('Content-Type', httpContentTypeSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.httpClient.request<FileAttributesConfig>('post', `${this.basePath}/fileAttributes/config/${encodeURIComponent(String(ruleSetId))}`, {
|
return this.httpClient.request<FileAttributeConfig>(
|
||||||
body: body,
|
'post',
|
||||||
withCredentials: this.configuration.withCredentials,
|
`${this.basePath}/fileAttributes/config/fileAttribute/${encodeURIComponent(String(ruleSetId))}`,
|
||||||
headers: headers,
|
{
|
||||||
observe: observe,
|
body: body,
|
||||||
reportProgress: reportProgress
|
withCredentials: this.configuration.withCredentials,
|
||||||
});
|
headers: headers,
|
||||||
|
observe: observe,
|
||||||
|
reportProgress: reportProgress
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete a specific file attribute.
|
||||||
|
* None
|
||||||
|
* @param ruleSetId ruleSetId
|
||||||
|
* @param ruleSetId ruleSetId
|
||||||
|
* @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 setFileAttributesConfiguration1(ruleSetId: string, fileAttributeId: string, observe?: 'body', reportProgress?: boolean): Observable<any>;
|
||||||
|
public setFileAttributesConfiguration1(
|
||||||
|
ruleSetId: string,
|
||||||
|
fileAttributeId: string,
|
||||||
|
observe?: 'response',
|
||||||
|
reportProgress?: boolean
|
||||||
|
): Observable<HttpResponse<any>>;
|
||||||
|
public setFileAttributesConfiguration1(
|
||||||
|
ruleSetId: string,
|
||||||
|
fileAttributeId: string,
|
||||||
|
observe?: 'events',
|
||||||
|
reportProgress?: boolean
|
||||||
|
): Observable<HttpEvent<any>>;
|
||||||
|
public setFileAttributesConfiguration1(
|
||||||
|
ruleSetId: string,
|
||||||
|
fileAttributeId: string,
|
||||||
|
observe: any = 'body',
|
||||||
|
reportProgress: boolean = false
|
||||||
|
): Observable<any> {
|
||||||
|
if (ruleSetId === null || ruleSetId === undefined) {
|
||||||
|
throw new Error('Required parameter ruleSetId was null or undefined when calling setFileAttributesConfiguration1.');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ruleSetId === null || ruleSetId === undefined) {
|
||||||
|
throw new Error('Required parameter ruleSetId was null or undefined when calling setFileAttributesConfiguration1.');
|
||||||
|
}
|
||||||
|
|
||||||
|
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<any>(
|
||||||
|
'delete',
|
||||||
|
`${this.basePath}/fileAttributes/config/fileAttribute/${encodeURIComponent(String(ruleSetId))}/${encodeURIComponent(String(ruleSetId))}`,
|
||||||
|
{
|
||||||
|
withCredentials: this.configuration.withCredentials,
|
||||||
|
headers: headers,
|
||||||
|
observe: observe,
|
||||||
|
reportProgress: reportProgress
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
19
libs/red-ui-http/src/lib/model/fileAttributeConfig.ts
Normal file
19
libs/red-ui-http/src/lib/model/fileAttributeConfig.ts
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
/**
|
||||||
|
* API Documentation for Redaction Gateway
|
||||||
|
* 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
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
export interface FileAttributeConfig {
|
||||||
|
csvColumnHeader?: string;
|
||||||
|
editable?: boolean;
|
||||||
|
id?: string;
|
||||||
|
label?: string;
|
||||||
|
visible?: boolean;
|
||||||
|
}
|
||||||
@ -0,0 +1,16 @@
|
|||||||
|
/**
|
||||||
|
* API Documentation for Redaction Gateway
|
||||||
|
* 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
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
export interface FileAttributesBaseConfigRequest {
|
||||||
|
delimiter?: string;
|
||||||
|
filenameMappingColumnHeaderName?: string;
|
||||||
|
}
|
||||||
@ -63,3 +63,5 @@ export * from './fileAttributes';
|
|||||||
export * from './fileAttributesConfig';
|
export * from './fileAttributesConfig';
|
||||||
export * from './importCsvRequest';
|
export * from './importCsvRequest';
|
||||||
export * from './importCsvResponse';
|
export * from './importCsvResponse';
|
||||||
|
export * from './fileAttributeConfig';
|
||||||
|
export * from './fileAttributesBaseConfigRequest';
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user