From 70450fc8745bd21079d4a43b8c0fd41e3875301d Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Fri, 19 May 2023 16:07:08 +0300 Subject: [PATCH] UI: Improved notification version --- ui-ngx/src/app/core/http/entity.service.ts | 2 +- ui-ngx/src/app/core/http/notification.service.ts | 4 ++-- .../vc/entity-types-version-create.component.html | 4 ++-- .../vc/entity-types-version-create.component.ts | 4 ++-- .../vc/entity-types-version-load.component.html | 4 ++-- .../vc/entity-types-version-load.component.ts | 13 ++++++------- ui-ngx/src/app/shared/models/vc.models.ts | 4 ++-- 7 files changed, 17 insertions(+), 18 deletions(-) diff --git a/ui-ngx/src/app/core/http/entity.service.ts b/ui-ngx/src/app/core/http/entity.service.ts index 5bdbacd1c5..ee3e232bba 100644 --- a/ui-ngx/src/app/core/http/entity.service.ts +++ b/ui-ngx/src/app/core/http/entity.service.ts @@ -424,7 +424,7 @@ export class EntityService { break; case EntityType.NOTIFICATION_TEMPLATE: pageLink.sortOrder.property = 'name'; - entitiesObservable = this.notificationService.getNotificationTemplates(pageLink, null, config); + entitiesObservable = this.notificationService.getNotificationTemplates(pageLink, subType as NotificationType, config); break; case EntityType.NOTIFICATION_RULE: pageLink.sortOrder.property = 'name'; diff --git a/ui-ngx/src/app/core/http/notification.service.ts b/ui-ngx/src/app/core/http/notification.service.ts index a92007643a..ec64621aeb 100644 --- a/ui-ngx/src/app/core/http/notification.service.ts +++ b/ui-ngx/src/app/core/http/notification.service.ts @@ -35,7 +35,7 @@ import { SlackConversation } from '@shared/models/notification.models'; import { User } from '@shared/models/user.model'; -import { isDefinedAndNotNull, isNotEmptyStr } from '@core/utils'; +import { isNotEmptyStr } from '@core/utils'; @Injectable({ providedIn: 'root' @@ -169,7 +169,7 @@ export class NotificationService { public getNotificationTemplates(pageLink: PageLink, notificationTypes?: NotificationType, config?: RequestConfig): Observable> { let url = `/api/notification/templates${pageLink.toQuery()}`; - if (isDefinedAndNotNull(notificationTypes)) { + if (isNotEmptyStr(notificationTypes)) { url += `¬ificationTypes=${notificationTypes}`; } return this.http.get>(url, defaultHttpOptionsFromConfig(config)); diff --git a/ui-ngx/src/app/modules/home/components/vc/entity-types-version-create.component.html b/ui-ngx/src/app/modules/home/components/vc/entity-types-version-create.component.html index 519e87fb97..ef09a2b382 100644 --- a/ui-ngx/src/app/modules/home/components/vc/entity-types-version-create.component.html +++ b/ui-ngx/src/app/modules/home/components/vc/entity-types-version-create.component.html @@ -66,10 +66,10 @@ {{ 'version-control.export-credentials' | translate }} - + {{ 'version-control.export-attributes' | translate }} - + {{ 'version-control.export-relations' | translate }} diff --git a/ui-ngx/src/app/modules/home/components/vc/entity-types-version-create.component.ts b/ui-ngx/src/app/modules/home/components/vc/entity-types-version-create.component.ts index ac50042887..b6a394982c 100644 --- a/ui-ngx/src/app/modules/home/components/vc/entity-types-version-create.component.ts +++ b/ui-ngx/src/app/modules/home/components/vc/entity-types-version-create.component.ts @@ -29,9 +29,9 @@ import { } from '@angular/forms'; import { PageComponent } from '@shared/components/page.component'; import { + entityTypesWithoutRelatedData, EntityTypeVersionCreateConfig, exportableEntityTypes, - entityTypesWithNoRelatedData, SyncStrategy, syncStrategyTranslationMap } from '@shared/models/vc.models'; @@ -74,7 +74,7 @@ export class EntityTypesVersionCreateComponent extends PageComponent implements syncStrategyTranslations = syncStrategyTranslationMap; entityTypes = EntityType; - entityTypesWithNoRelatedData = entityTypesWithNoRelatedData + entityTypesWithoutRelatedData = entityTypesWithoutRelatedData; loading = true; diff --git a/ui-ngx/src/app/modules/home/components/vc/entity-types-version-load.component.html b/ui-ngx/src/app/modules/home/components/vc/entity-types-version-load.component.html index b508320ad7..d179855a1a 100644 --- a/ui-ngx/src/app/modules/home/components/vc/entity-types-version-load.component.html +++ b/ui-ngx/src/app/modules/home/components/vc/entity-types-version-load.component.html @@ -66,10 +66,10 @@ {{ 'version-control.load-credentials' | translate }} - + {{ 'version-control.load-attributes' | translate }} - + {{ 'version-control.load-relations' | translate }} diff --git a/ui-ngx/src/app/modules/home/components/vc/entity-types-version-load.component.ts b/ui-ngx/src/app/modules/home/components/vc/entity-types-version-load.component.ts index 2fd891df23..5405436f35 100644 --- a/ui-ngx/src/app/modules/home/components/vc/entity-types-version-load.component.ts +++ b/ui-ngx/src/app/modules/home/components/vc/entity-types-version-load.component.ts @@ -18,27 +18,26 @@ import { Component, forwardRef, Input, OnInit, Renderer2, ViewContainerRef } fro import { AbstractControl, ControlValueAccessor, + NG_VALIDATORS, + NG_VALUE_ACCESSOR, UntypedFormArray, UntypedFormBuilder, UntypedFormControl, UntypedFormGroup, - NG_VALIDATORS, - NG_VALUE_ACCESSOR, Validator, Validators } from '@angular/forms'; import { PageComponent } from '@shared/components/page.component'; import { + entityTypesWithoutRelatedData, EntityTypeVersionLoadConfig, - exportableEntityTypes, - entityTypesWithNoRelatedData, - VersionCreationResult + exportableEntityTypes } from '@shared/models/vc.models'; import { Store } from '@ngrx/store'; import { AppState } from '@core/core.state'; import { TranslateService } from '@ngx-translate/core'; import { EntityType, entityTypeTranslations } from '@shared/models/entity-type.models'; -import { MatCheckbox, MatCheckboxChange } from '@angular/material/checkbox'; +import { MatCheckbox } from '@angular/material/checkbox'; import { TbPopoverService } from '@shared/components/popover.service'; import { RemoveOtherEntitiesConfirmComponent } from '@home/components/vc/remove-other-entities-confirm.component'; @@ -71,7 +70,7 @@ export class EntityTypesVersionLoadComponent extends PageComponent implements On public entityTypesVersionLoadFormGroup: UntypedFormGroup; entityTypes = EntityType; - entityTypesWithNoRelatedData = entityTypesWithNoRelatedData + entityTypesWithoutRelatedData = entityTypesWithoutRelatedData; loading = true; diff --git a/ui-ngx/src/app/shared/models/vc.models.ts b/ui-ngx/src/app/shared/models/vc.models.ts index 32c86900ba..d1886fb1aa 100644 --- a/ui-ngx/src/app/shared/models/vc.models.ts +++ b/ui-ngx/src/app/shared/models/vc.models.ts @@ -36,11 +36,11 @@ export const exportableEntityTypes: Array = [ EntityType.NOTIFICATION_RULE ]; -export const entityTypesWithNoRelatedData: Array = [ +export const entityTypesWithoutRelatedData: Set = new Set([ EntityType.NOTIFICATION_TEMPLATE, EntityType.NOTIFICATION_TARGET, EntityType.NOTIFICATION_RULE -] +]); export interface VersionCreateConfig { saveRelations: boolean;