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`
|
||||
|
||||
```
|
||||
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
|
||||
mkdir -p /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-icon-button
|
||||
*ngIf="permissionsService.isAdmin()"
|
||||
*ngIf="permissionsService.isAdmin() && userPreferenceService.areDevFeaturesEnabled"
|
||||
icon="red:plus"
|
||||
(action)="openAddRuleSetDialog()"
|
||||
text="project-templates-listing.add-new"
|
||||
|
||||
@ -6,6 +6,7 @@ import { PermissionsService } from '../../../common/service/permissions.service'
|
||||
import { FormBuilder, FormGroup } from '@angular/forms';
|
||||
import { debounce } from '../../../utils/debounce';
|
||||
import { RuleSetModel } from '@redaction/red-ui-http';
|
||||
import { UserPreferenceService } from '../../../common/service/user-preference.service';
|
||||
|
||||
@Component({
|
||||
selector: 'redaction-rule-sets-listing-screen',
|
||||
@ -23,7 +24,8 @@ export class RuleSetsListingScreenComponent implements OnInit {
|
||||
private readonly _sortingService: SortingService,
|
||||
private readonly _formBuilder: FormBuilder,
|
||||
private readonly _appStateService: AppStateService,
|
||||
public readonly permissionsService: PermissionsService
|
||||
public readonly permissionsService: PermissionsService,
|
||||
public readonly userPreferenceService: UserPreferenceService
|
||||
) {
|
||||
this.searchForm = this._formBuilder.group({
|
||||
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",
|
||||
"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",
|
||||
"FRONTEND_APP_VERSION": "1.0",
|
||||
"EULA_URL": "EULA_URL",
|
||||
|
||||
@ -11,13 +11,15 @@
|
||||
*/ /* tslint:disable:no-unused-variable member-ordering */
|
||||
|
||||
import { Inject, Injectable, Optional } from '@angular/core';
|
||||
import { HttpClient, HttpEvent, HttpHeaders, HttpResponse } from '@angular/common/http';
|
||||
import { HttpClient, HttpEvent, HttpHeaders, HttpParams, HttpResponse } from '@angular/common/http';
|
||||
import { CustomHttpUrlEncodingCodec } from '../encoder';
|
||||
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
import { FileAttributeConfig } from '../model/fileAttributeConfig';
|
||||
import { FileAttributes } from '../model/fileAttributes';
|
||||
import { FileAttributesBaseConfigRequest } from '../model/fileAttributesBaseConfigRequest';
|
||||
import { FileAttributesConfig } from '../model/fileAttributesConfig';
|
||||
import { ImportCsvRequest } from '../model/importCsvRequest';
|
||||
import { ImportCsvResponse } from '../model/importCsvResponse';
|
||||
|
||||
import { BASE_PATH } from '../variables';
|
||||
@ -53,6 +55,81 @@ export class FileAttributesControllerService {
|
||||
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.
|
||||
* None
|
||||
@ -97,17 +174,17 @@ export class FileAttributesControllerService {
|
||||
/**
|
||||
* Import a csv file to set file attributes
|
||||
* None
|
||||
* @param body importCsvRequest
|
||||
* @param file
|
||||
* @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 importCsv(body: ImportCsvRequest, projectId: string, observe?: 'body', reportProgress?: boolean): Observable<ImportCsvResponse>;
|
||||
public importCsv(body: ImportCsvRequest, projectId: string, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<ImportCsvResponse>>;
|
||||
public importCsv(body: ImportCsvRequest, projectId: string, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<ImportCsvResponse>>;
|
||||
public importCsv(body: ImportCsvRequest, projectId: 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 importCsv.');
|
||||
public importCsvForm(file: Blob, projectId: string, observe?: 'body', reportProgress?: boolean): Observable<ImportCsvResponse>;
|
||||
public importCsvForm(file: Blob, projectId: string, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<ImportCsvResponse>>;
|
||||
public importCsvForm(file: Blob, projectId: string, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<ImportCsvResponse>>;
|
||||
public importCsvForm(file: Blob, projectId: string, observe: any = 'body', reportProgress: boolean = false): Observable<any> {
|
||||
if (file === null || file === undefined) {
|
||||
throw new Error('Required parameter file was null or undefined when calling importCsv.');
|
||||
}
|
||||
|
||||
if (projectId === null || projectId === undefined) {
|
||||
@ -130,14 +207,28 @@ export class FileAttributesControllerService {
|
||||
}
|
||||
|
||||
// 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);
|
||||
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', <any>file) as any) || formParams;
|
||||
}
|
||||
|
||||
return this.httpClient.request<ImportCsvResponse>('post', `${this.basePath}/fileAttributes/csvImport/${encodeURIComponent(String(projectId))}`, {
|
||||
body: body,
|
||||
body: convertFormParamsToString ? formParams.toString() : formParams,
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers,
|
||||
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
|
||||
* @param body fileAttributes
|
||||
* @param body fileAttribute
|
||||
* @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 setFileAttributesConfiguration(
|
||||
body: FileAttributesConfig,
|
||||
body: FileAttributeConfig,
|
||||
ruleSetId: string,
|
||||
observe?: 'body',
|
||||
reportProgress?: boolean
|
||||
): Observable<FileAttributesConfig>;
|
||||
): Observable<FileAttributeConfig>;
|
||||
public setFileAttributesConfiguration(
|
||||
body: FileAttributesConfig,
|
||||
body: FileAttributeConfig,
|
||||
ruleSetId: string,
|
||||
observe?: 'response',
|
||||
reportProgress?: boolean
|
||||
): Observable<HttpResponse<FileAttributesConfig>>;
|
||||
): Observable<HttpResponse<FileAttributeConfig>>;
|
||||
public setFileAttributesConfiguration(
|
||||
body: FileAttributesConfig,
|
||||
body: FileAttributeConfig,
|
||||
ruleSetId: string,
|
||||
observe?: 'events',
|
||||
reportProgress?: boolean
|
||||
): Observable<HttpEvent<FileAttributesConfig>>;
|
||||
): Observable<HttpEvent<FileAttributeConfig>>;
|
||||
public setFileAttributesConfiguration(
|
||||
body: FileAttributesConfig,
|
||||
body: FileAttributeConfig,
|
||||
ruleSetId: string,
|
||||
observe: any = 'body',
|
||||
reportProgress: boolean = false
|
||||
@ -273,12 +364,81 @@ export class FileAttributesControllerService {
|
||||
headers = headers.set('Content-Type', httpContentTypeSelected);
|
||||
}
|
||||
|
||||
return this.httpClient.request<FileAttributesConfig>('post', `${this.basePath}/fileAttributes/config/${encodeURIComponent(String(ruleSetId))}`, {
|
||||
body: body,
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers,
|
||||
observe: observe,
|
||||
reportProgress: reportProgress
|
||||
});
|
||||
return this.httpClient.request<FileAttributeConfig>(
|
||||
'post',
|
||||
`${this.basePath}/fileAttributes/config/fileAttribute/${encodeURIComponent(String(ruleSetId))}`,
|
||||
{
|
||||
body: body,
|
||||
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 './importCsvRequest';
|
||||
export * from './importCsvResponse';
|
||||
export * from './fileAttributeConfig';
|
||||
export * from './fileAttributesBaseConfigRequest';
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user