UI: Improved notification version

This commit is contained in:
Vladyslav_Prykhodko 2023-05-19 16:07:08 +03:00
parent 97141efd5d
commit 70450fc874
7 changed files with 17 additions and 18 deletions

View File

@ -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';

View File

@ -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<PageData<NotificationTemplate>> {
let url = `/api/notification/templates${pageLink.toQuery()}`;
if (isDefinedAndNotNull(notificationTypes)) {
if (isNotEmptyStr(notificationTypes)) {
url += `&notificationTypes=${notificationTypes}`;
}
return this.http.get<PageData<NotificationTemplate>>(url, defaultHttpOptionsFromConfig(config));

View File

@ -66,10 +66,10 @@
<mat-checkbox *ngIf="entityTypeFormGroup.get('entityType').value === entityTypes.DEVICE" formControlName="saveCredentials">
{{ 'version-control.export-credentials' | translate }}
</mat-checkbox>
<mat-checkbox *ngIf="!entityTypesWithNoRelatedData.includes(entityTypeFormGroup.get('entityType').value)" formControlName="saveAttributes">
<mat-checkbox *ngIf="!entityTypesWithoutRelatedData.has(entityTypeFormGroup.get('entityType').value)" formControlName="saveAttributes">
{{ 'version-control.export-attributes' | translate }}
</mat-checkbox>
<mat-checkbox *ngIf="!entityTypesWithNoRelatedData.includes(entityTypeFormGroup.get('entityType').value)" formControlName="saveRelations">
<mat-checkbox *ngIf="!entityTypesWithoutRelatedData.has(entityTypeFormGroup.get('entityType').value)" formControlName="saveRelations">
{{ 'version-control.export-relations' | translate }}
</mat-checkbox>
</div>

View File

@ -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;

View File

@ -66,10 +66,10 @@
<mat-checkbox *ngIf="entityTypeFormGroup.get('entityType').value === entityTypes.DEVICE" formControlName="loadCredentials">
{{ 'version-control.load-credentials' | translate }}
</mat-checkbox>
<mat-checkbox *ngIf="!entityTypesWithNoRelatedData.includes(entityTypeFormGroup.get('entityType').value)" formControlName="loadAttributes">
<mat-checkbox *ngIf="!entityTypesWithoutRelatedData.has(entityTypeFormGroup.get('entityType').value)" formControlName="loadAttributes">
{{ 'version-control.load-attributes' | translate }}
</mat-checkbox>
<mat-checkbox *ngIf="!entityTypesWithNoRelatedData.includes(entityTypeFormGroup.get('entityType').value)" formControlName="loadRelations">
<mat-checkbox *ngIf="!entityTypesWithoutRelatedData.has(entityTypeFormGroup.get('entityType').value)" formControlName="loadRelations">
{{ 'version-control.load-relations' | translate }}
</mat-checkbox>
</div>

View File

@ -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;

View File

@ -36,11 +36,11 @@ export const exportableEntityTypes: Array<EntityType> = [
EntityType.NOTIFICATION_RULE
];
export const entityTypesWithNoRelatedData: Array<EntityType> = [
export const entityTypesWithoutRelatedData: Set<EntityType> = new Set([
EntityType.NOTIFICATION_TEMPLATE,
EntityType.NOTIFICATION_TARGET,
EntityType.NOTIFICATION_RULE
]
]);
export interface VersionCreateConfig {
saveRelations: boolean;