UI: Improved notification version
This commit is contained in:
parent
97141efd5d
commit
70450fc874
@ -424,7 +424,7 @@ export class EntityService {
|
|||||||
break;
|
break;
|
||||||
case EntityType.NOTIFICATION_TEMPLATE:
|
case EntityType.NOTIFICATION_TEMPLATE:
|
||||||
pageLink.sortOrder.property = 'name';
|
pageLink.sortOrder.property = 'name';
|
||||||
entitiesObservable = this.notificationService.getNotificationTemplates(pageLink, null, config);
|
entitiesObservable = this.notificationService.getNotificationTemplates(pageLink, subType as NotificationType, config);
|
||||||
break;
|
break;
|
||||||
case EntityType.NOTIFICATION_RULE:
|
case EntityType.NOTIFICATION_RULE:
|
||||||
pageLink.sortOrder.property = 'name';
|
pageLink.sortOrder.property = 'name';
|
||||||
|
|||||||
@ -35,7 +35,7 @@ import {
|
|||||||
SlackConversation
|
SlackConversation
|
||||||
} from '@shared/models/notification.models';
|
} from '@shared/models/notification.models';
|
||||||
import { User } from '@shared/models/user.model';
|
import { User } from '@shared/models/user.model';
|
||||||
import { isDefinedAndNotNull, isNotEmptyStr } from '@core/utils';
|
import { isNotEmptyStr } from '@core/utils';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
@ -169,7 +169,7 @@ export class NotificationService {
|
|||||||
public getNotificationTemplates(pageLink: PageLink, notificationTypes?: NotificationType,
|
public getNotificationTemplates(pageLink: PageLink, notificationTypes?: NotificationType,
|
||||||
config?: RequestConfig): Observable<PageData<NotificationTemplate>> {
|
config?: RequestConfig): Observable<PageData<NotificationTemplate>> {
|
||||||
let url = `/api/notification/templates${pageLink.toQuery()}`;
|
let url = `/api/notification/templates${pageLink.toQuery()}`;
|
||||||
if (isDefinedAndNotNull(notificationTypes)) {
|
if (isNotEmptyStr(notificationTypes)) {
|
||||||
url += `¬ificationTypes=${notificationTypes}`;
|
url += `¬ificationTypes=${notificationTypes}`;
|
||||||
}
|
}
|
||||||
return this.http.get<PageData<NotificationTemplate>>(url, defaultHttpOptionsFromConfig(config));
|
return this.http.get<PageData<NotificationTemplate>>(url, defaultHttpOptionsFromConfig(config));
|
||||||
|
|||||||
@ -66,10 +66,10 @@
|
|||||||
<mat-checkbox *ngIf="entityTypeFormGroup.get('entityType').value === entityTypes.DEVICE" formControlName="saveCredentials">
|
<mat-checkbox *ngIf="entityTypeFormGroup.get('entityType').value === entityTypes.DEVICE" formControlName="saveCredentials">
|
||||||
{{ 'version-control.export-credentials' | translate }}
|
{{ 'version-control.export-credentials' | translate }}
|
||||||
</mat-checkbox>
|
</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 }}
|
{{ 'version-control.export-attributes' | translate }}
|
||||||
</mat-checkbox>
|
</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 }}
|
{{ 'version-control.export-relations' | translate }}
|
||||||
</mat-checkbox>
|
</mat-checkbox>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -29,9 +29,9 @@ import {
|
|||||||
} from '@angular/forms';
|
} from '@angular/forms';
|
||||||
import { PageComponent } from '@shared/components/page.component';
|
import { PageComponent } from '@shared/components/page.component';
|
||||||
import {
|
import {
|
||||||
|
entityTypesWithoutRelatedData,
|
||||||
EntityTypeVersionCreateConfig,
|
EntityTypeVersionCreateConfig,
|
||||||
exportableEntityTypes,
|
exportableEntityTypes,
|
||||||
entityTypesWithNoRelatedData,
|
|
||||||
SyncStrategy,
|
SyncStrategy,
|
||||||
syncStrategyTranslationMap
|
syncStrategyTranslationMap
|
||||||
} from '@shared/models/vc.models';
|
} from '@shared/models/vc.models';
|
||||||
@ -74,7 +74,7 @@ export class EntityTypesVersionCreateComponent extends PageComponent implements
|
|||||||
syncStrategyTranslations = syncStrategyTranslationMap;
|
syncStrategyTranslations = syncStrategyTranslationMap;
|
||||||
|
|
||||||
entityTypes = EntityType;
|
entityTypes = EntityType;
|
||||||
entityTypesWithNoRelatedData = entityTypesWithNoRelatedData
|
entityTypesWithoutRelatedData = entityTypesWithoutRelatedData;
|
||||||
|
|
||||||
loading = true;
|
loading = true;
|
||||||
|
|
||||||
|
|||||||
@ -66,10 +66,10 @@
|
|||||||
<mat-checkbox *ngIf="entityTypeFormGroup.get('entityType').value === entityTypes.DEVICE" formControlName="loadCredentials">
|
<mat-checkbox *ngIf="entityTypeFormGroup.get('entityType').value === entityTypes.DEVICE" formControlName="loadCredentials">
|
||||||
{{ 'version-control.load-credentials' | translate }}
|
{{ 'version-control.load-credentials' | translate }}
|
||||||
</mat-checkbox>
|
</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 }}
|
{{ 'version-control.load-attributes' | translate }}
|
||||||
</mat-checkbox>
|
</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 }}
|
{{ 'version-control.load-relations' | translate }}
|
||||||
</mat-checkbox>
|
</mat-checkbox>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -18,27 +18,26 @@ import { Component, forwardRef, Input, OnInit, Renderer2, ViewContainerRef } fro
|
|||||||
import {
|
import {
|
||||||
AbstractControl,
|
AbstractControl,
|
||||||
ControlValueAccessor,
|
ControlValueAccessor,
|
||||||
|
NG_VALIDATORS,
|
||||||
|
NG_VALUE_ACCESSOR,
|
||||||
UntypedFormArray,
|
UntypedFormArray,
|
||||||
UntypedFormBuilder,
|
UntypedFormBuilder,
|
||||||
UntypedFormControl,
|
UntypedFormControl,
|
||||||
UntypedFormGroup,
|
UntypedFormGroup,
|
||||||
NG_VALIDATORS,
|
|
||||||
NG_VALUE_ACCESSOR,
|
|
||||||
Validator,
|
Validator,
|
||||||
Validators
|
Validators
|
||||||
} from '@angular/forms';
|
} from '@angular/forms';
|
||||||
import { PageComponent } from '@shared/components/page.component';
|
import { PageComponent } from '@shared/components/page.component';
|
||||||
import {
|
import {
|
||||||
|
entityTypesWithoutRelatedData,
|
||||||
EntityTypeVersionLoadConfig,
|
EntityTypeVersionLoadConfig,
|
||||||
exportableEntityTypes,
|
exportableEntityTypes
|
||||||
entityTypesWithNoRelatedData,
|
|
||||||
VersionCreationResult
|
|
||||||
} from '@shared/models/vc.models';
|
} from '@shared/models/vc.models';
|
||||||
import { Store } from '@ngrx/store';
|
import { Store } from '@ngrx/store';
|
||||||
import { AppState } from '@core/core.state';
|
import { AppState } from '@core/core.state';
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
import { EntityType, entityTypeTranslations } from '@shared/models/entity-type.models';
|
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 { TbPopoverService } from '@shared/components/popover.service';
|
||||||
import { RemoveOtherEntitiesConfirmComponent } from '@home/components/vc/remove-other-entities-confirm.component';
|
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;
|
public entityTypesVersionLoadFormGroup: UntypedFormGroup;
|
||||||
|
|
||||||
entityTypes = EntityType;
|
entityTypes = EntityType;
|
||||||
entityTypesWithNoRelatedData = entityTypesWithNoRelatedData
|
entityTypesWithoutRelatedData = entityTypesWithoutRelatedData;
|
||||||
|
|
||||||
loading = true;
|
loading = true;
|
||||||
|
|
||||||
|
|||||||
@ -36,11 +36,11 @@ export const exportableEntityTypes: Array<EntityType> = [
|
|||||||
EntityType.NOTIFICATION_RULE
|
EntityType.NOTIFICATION_RULE
|
||||||
];
|
];
|
||||||
|
|
||||||
export const entityTypesWithNoRelatedData: Array<EntityType> = [
|
export const entityTypesWithoutRelatedData: Set<EntityType> = new Set([
|
||||||
EntityType.NOTIFICATION_TEMPLATE,
|
EntityType.NOTIFICATION_TEMPLATE,
|
||||||
EntityType.NOTIFICATION_TARGET,
|
EntityType.NOTIFICATION_TARGET,
|
||||||
EntityType.NOTIFICATION_RULE
|
EntityType.NOTIFICATION_RULE
|
||||||
]
|
]);
|
||||||
|
|
||||||
export interface VersionCreateConfig {
|
export interface VersionCreateConfig {
|
||||||
saveRelations: boolean;
|
saveRelations: boolean;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user