From 11d6df96d1bce52024dae6043ebe237a44686635 Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Wed, 5 Apr 2023 15:36:36 +0300 Subject: [PATCH] UI: Fixed slack autocomplete and refactroing code --- .../components/slack-conversation-autocomplete.component.ts | 6 +++++- ui-ngx/src/app/shared/models/notification.models.ts | 2 +- .../en_US/notification/{rule-engine.md => rule_engine.md} | 0 3 files changed, 6 insertions(+), 2 deletions(-) rename ui-ngx/src/assets/help/en_US/notification/{rule-engine.md => rule_engine.md} (100%) diff --git a/ui-ngx/src/app/shared/components/slack-conversation-autocomplete.component.ts b/ui-ngx/src/app/shared/components/slack-conversation-autocomplete.component.ts index 001631360a..31c61511a2 100644 --- a/ui-ngx/src/app/shared/components/slack-conversation-autocomplete.component.ts +++ b/ui-ngx/src/app/shared/components/slack-conversation-autocomplete.component.ts @@ -134,6 +134,7 @@ export class SlackConversationAutocompleteComponent implements ControlValueAcces if (!change.firstChange && change.currentValue !== change.previousValue) { if (propName === 'slackChanelType' || propName === 'token') { this.clearSlackCache(); + this.dirty = true; this.conversationSlackFormGroup.get('conversation').patchValue(''); } } @@ -167,8 +168,8 @@ export class SlackConversationAutocompleteComponent implements ControlValueAcces onFocus() { if (this.dirty) { - this.conversationSlackFormGroup.get('conversation').updateValueAndValidity({onlySelf: true, emitEvent: true}); this.dirty = false; + this.conversationSlackFormGroup.get('conversation').updateValueAndValidity({onlySelf: true, emitEvent: true}); } } @@ -184,6 +185,9 @@ export class SlackConversationAutocompleteComponent implements ControlValueAcces } private fetchSlackConversation(searchText?: string): Observable> { + if (this.dirty) { + return of([]); + } if (this.slackSearchText !== searchText || this.latestSearchConversetionResult === null) { this.slackSearchText = searchText; const slackConversationFilter = this.createSlackConversationFilter(this.slackSearchText); diff --git a/ui-ngx/src/app/shared/models/notification.models.ts b/ui-ngx/src/app/shared/models/notification.models.ts index c77373922e..0969af78d4 100644 --- a/ui-ngx/src/app/shared/models/notification.models.ts +++ b/ui-ngx/src/app/shared/models/notification.models.ts @@ -539,7 +539,7 @@ export const NotificationTemplateTypeTranslateMap = new Map