From 47700a817046b21a5f5ca72f40c8f14df69bb7da Mon Sep 17 00:00:00 2001 From: Timo Date: Wed, 6 Jan 2021 20:34:11 +0200 Subject: [PATCH] fixed ruleset issues --- .../add-edit-dictionary-dialog.component.ts | 3 ++- .../admin/rules-screen/rules-screen.component.ts | 2 +- .../src/lib/api/dictionaryController.service.ts | 14 +++++--------- .../src/lib/api/rulesController.service.ts | 14 +++++--------- 4 files changed, 13 insertions(+), 20 deletions(-) diff --git a/apps/red-ui/src/app/screens/admin/dictionary-listing-screen/add-edit-dictionary-dialog/add-edit-dictionary-dialog.component.ts b/apps/red-ui/src/app/screens/admin/dictionary-listing-screen/add-edit-dictionary-dialog/add-edit-dictionary-dialog.component.ts index b7bb110f7..c30163e83 100644 --- a/apps/red-ui/src/app/screens/admin/dictionary-listing-screen/add-edit-dictionary-dialog/add-edit-dictionary-dialog.component.ts +++ b/apps/red-ui/src/app/screens/admin/dictionary-listing-screen/add-edit-dictionary-dialog/add-edit-dictionary-dialog.component.ts @@ -63,7 +63,8 @@ export class AddEditDictionaryDialogComponent { observable = this._dictionaryControllerService.updateType(typeValue, typeValue.type, DEFAULT_RUL_SET_UUID); } else { // create mode - observable = this._dictionaryControllerService.addType(typeValue, DEFAULT_RUL_SET_UUID); + typeValue.ruleSetId = DEFAULT_RUL_SET_UUID; + observable = this._dictionaryControllerService.addType(typeValue); } // diff --git a/apps/red-ui/src/app/screens/admin/rules-screen/rules-screen.component.ts b/apps/red-ui/src/app/screens/admin/rules-screen/rules-screen.component.ts index 603030f33..abdf9ec64 100644 --- a/apps/red-ui/src/app/screens/admin/rules-screen/rules-screen.component.ts +++ b/apps/red-ui/src/app/screens/admin/rules-screen/rules-screen.component.ts @@ -90,7 +90,7 @@ export class RulesScreenComponent extends ComponentHasChanges { public async save(): Promise { this.processing = true; - this._rulesControllerService.uploadRules({ rules: this.editorComponent.getEditor().getValue() }, DEFAULT_RUL_SET_UUID).subscribe( + this._rulesControllerService.uploadRules({ rules: this.editorComponent.getEditor().getValue(), ruleSetId: DEFAULT_RUL_SET_UUID }).subscribe( () => { this._initialize(); this._notificationService.showToastNotification(this._translateService.instant('rules-screen.success.generic'), null, NotificationType.SUCCESS); 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 e4320abd6..1335e0ce5 100644 --- a/libs/red-ui-http/src/lib/api/dictionaryController.service.ts +++ b/libs/red-ui-http/src/lib/api/dictionaryController.service.ts @@ -140,21 +140,17 @@ export class DictionaryControllerService { * @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, ruleSetId: string, observe?: 'body', reportProgress?: boolean): Observable; + public addType(body: TypeValue, observe?: 'body', reportProgress?: boolean): Observable; - public addType(body: TypeValue, ruleSetId: string, observe?: 'response', reportProgress?: boolean): Observable>; + public addType(body: TypeValue, observe?: 'response', reportProgress?: boolean): Observable>; - public addType(body: TypeValue, ruleSetId: string, observe?: 'events', reportProgress?: boolean): Observable>; + public addType(body: TypeValue, observe?: 'events', reportProgress?: boolean): Observable>; - public addType(body: TypeValue, ruleSetId: string, observe: any = 'body', reportProgress: boolean = false): 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.'); } - if (ruleSetId === null || ruleSetId === undefined) { - throw new Error('Required parameter ruleSetId was null or undefined when calling addType.'); - } - let headers = this.defaultHeaders; // authentication (RED-OAUTH) required @@ -177,7 +173,7 @@ export class DictionaryControllerService { headers = headers.set('Content-Type', httpContentTypeSelected); } - return this.httpClient.request('post', `${this.basePath}/dictionary/type/${encodeURIComponent(String(ruleSetId))}`, { + return this.httpClient.request('post', `${this.basePath}/dictionary/type`, { body: body, withCredentials: this.configuration.withCredentials, headers: headers, 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 1463c66ce..eee09f4af 100644 --- a/libs/red-ui-http/src/lib/api/rulesController.service.ts +++ b/libs/red-ui-http/src/lib/api/rulesController.service.ts @@ -133,21 +133,17 @@ export class RulesControllerService { * @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, ruleSetId: string, observe?: 'body', reportProgress?: boolean): Observable; + public uploadRules(body: Rules, observe?: 'body', reportProgress?: boolean): Observable; - public uploadRules(body: Rules, ruleSetId: string, observe?: 'response', reportProgress?: boolean): Observable>; + public uploadRules(body: Rules, observe?: 'response', reportProgress?: boolean): Observable>; - public uploadRules(body: Rules, ruleSetId: string, observe?: 'events', reportProgress?: boolean): Observable>; + public uploadRules(body: Rules, bserve?: 'events', reportProgress?: boolean): Observable>; - public uploadRules(body: Rules, ruleSetId: string, observe: any = 'body', reportProgress: boolean = false): 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.'); } - if (ruleSetId === null || ruleSetId === undefined) { - throw new Error('Required parameter ruleSetId was null or undefined when calling uploadRules.'); - } - let headers = this.defaultHeaders; // authentication (RED-OAUTH) required @@ -170,7 +166,7 @@ export class RulesControllerService { headers = headers.set('Content-Type', httpContentTypeSelected); } - return this.httpClient.request('post', `${this.basePath}/rules/${encodeURIComponent(String(ruleSetId))}`, { + return this.httpClient.request('post', `${this.basePath}/rules`, { body: body, withCredentials: this.configuration.withCredentials, headers: headers,