|
diff --git a/ui-ngx/src/app/modules/home/pages/notification/sent/sent-error-dialog.component.ts b/ui-ngx/src/app/modules/home/pages/notification/sent/sent-error-dialog.component.ts
index ef5bb27610..312dd5a6fc 100644
--- a/ui-ngx/src/app/modules/home/pages/notification/sent/sent-error-dialog.component.ts
+++ b/ui-ngx/src/app/modules/home/pages/notification/sent/sent-error-dialog.component.ts
@@ -22,7 +22,7 @@ import { Router } from '@angular/router';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
import {
NotificationDeliveryMethod,
- NotificationDeliveryMethodTranslateMap,
+ NotificationDeliveryMethodInfoMap,
NotificationRequest
} from '@shared/models/notification.models';
@@ -39,7 +39,7 @@ export class SentErrorDialogComponent extends DialogComponent
-
+
@@ -61,7 +60,7 @@
-
- notification.at-least-one-should-be-selected
+ notification.at-least-one-should-be-selected
- {{ 'notification.input-fields-support-templatization' | translate}}
-
-
-
-
-
-
-
-
- {{ 'notification.input-fields-support-templatization' | translate}}
-
-
-
- {{ 'notification.input-field-support-templatization' | translate}}
-
-
-
- {{ 'notification.input-field-support-templatization' | translate}}
-
-
-
- {{ 'notification.input-fields-support-templatization' | translate}}
-
-
-
-
+
-
-
- notification.theme-color
-
-
+
diff --git a/ui-ngx/src/app/modules/home/pages/notification/settings/notification-settings.component.ts b/ui-ngx/src/app/modules/home/pages/notification/settings/notification-settings.component.ts
index 4d839541c8..c2d3afe890 100644
--- a/ui-ngx/src/app/modules/home/pages/notification/settings/notification-settings.component.ts
+++ b/ui-ngx/src/app/modules/home/pages/notification/settings/notification-settings.component.ts
@@ -25,7 +25,7 @@ import { ActivatedRoute } from '@angular/router';
import { deepClone, isDefinedAndNotNull } from '@core/utils';
import {
NotificationDeliveryMethod,
- NotificationDeliveryMethodTranslateMap,
+ NotificationDeliveryMethodInfoMap,
NotificationUserSettings
} from '@shared/models/notification.models';
import { NotificationService } from '@core/http/notification.service';
@@ -41,7 +41,7 @@ export class NotificationSettingsComponent extends PageComponent implements OnIn
notificationSettings: UntypedFormGroup;
notificationDeliveryMethods: NotificationDeliveryMethod[];
- notificationDeliveryMethodTranslateMap = NotificationDeliveryMethodTranslateMap;
+ notificationDeliveryMethodInfoMap = NotificationDeliveryMethodInfoMap;
private deliveryMethods = new Set([
NotificationDeliveryMethod.SLACK,
diff --git a/ui-ngx/src/app/modules/home/pages/notification/template/configuration/notification-action-button-configuration.component.html b/ui-ngx/src/app/modules/home/pages/notification/template/configuration/notification-action-button-configuration.component.html
new file mode 100644
index 0000000000..b195775d48
--- /dev/null
+++ b/ui-ngx/src/app/modules/home/pages/notification/template/configuration/notification-action-button-configuration.component.html
@@ -0,0 +1,83 @@
+
+
diff --git a/ui-ngx/src/app/modules/home/pages/notification/template/configuration/notification-action-button-configuration.component.ts b/ui-ngx/src/app/modules/home/pages/notification/template/configuration/notification-action-button-configuration.component.ts
new file mode 100644
index 0000000000..af7e0a997b
--- /dev/null
+++ b/ui-ngx/src/app/modules/home/pages/notification/template/configuration/notification-action-button-configuration.component.ts
@@ -0,0 +1,168 @@
+///
+/// Copyright © 2016-2024 The Thingsboard Authors
+///
+/// Licensed under the Apache License, Version 2.0 (the "License");
+/// you may not use this file except in compliance with the License.
+/// You may obtain a copy of the License at
+///
+/// http://www.apache.org/licenses/LICENSE-2.0
+///
+/// Unless required by applicable law or agreed to in writing, software
+/// distributed under the License is distributed on an "AS IS" BASIS,
+/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+/// See the License for the specific language governing permissions and
+/// limitations under the License.
+///
+
+import { Component, forwardRef, Input, OnDestroy, OnInit } from '@angular/core';
+import {
+ ControlValueAccessor,
+ FormBuilder,
+ FormGroup,
+ NG_VALIDATORS,
+ NG_VALUE_ACCESSOR,
+ ValidationErrors,
+ Validator,
+ Validators
+} from '@angular/forms';
+import { ActionButtonLinkType, ActionButtonLinkTypeTranslateMap } from '@shared/models/notification.models';
+import { takeUntil } from 'rxjs/operators';
+import { Subject } from 'rxjs';
+import { isDefinedAndNotNull } from '@core/utils';
+import { coerceBoolean } from '@shared/decorators/coercion';
+
+@Component({
+ selector: 'tb-notification-action-button-configuration',
+ templateUrl: './notification-action-button-configuration.component.html',
+ providers: [
+ {
+ provide: NG_VALUE_ACCESSOR,
+ useExisting: forwardRef(() => NotificationActionButtonConfigurationComponent),
+ multi: true
+ },
+ {
+ provide: NG_VALIDATORS,
+ useExisting: forwardRef(() => NotificationActionButtonConfigurationComponent),
+ multi: true,
+ }
+ ]
+})
+export class NotificationActionButtonConfigurationComponent implements ControlValueAccessor, Validator, OnInit, OnDestroy {
+
+ @Input()
+ actionTitle: string;
+
+ private hideButtonTextValue = false;
+
+ get hideButtonText(): boolean {
+ return this.hideButtonTextValue;
+ }
+
+ @Input()
+ @coerceBoolean()
+ set hideButtonText(hideButtonText: boolean) {
+ this.hideButtonTextValue = hideButtonText;
+ if (this.hideButtonTextValue) {
+ this.actionButtonConfigForm.removeControl('text');
+ }
+ }
+
+ actionButtonConfigForm: FormGroup;
+
+ readonly actionButtonLinkType = ActionButtonLinkType;
+ readonly actionButtonLinkTypes = Object.keys(ActionButtonLinkType) as ActionButtonLinkType[];
+ readonly actionButtonLinkTypeTranslateMap = ActionButtonLinkTypeTranslateMap;
+
+ private propagateChange = (v: any) => { };
+ private readonly destroy$ = new Subject
-
+ notification.delivery-method.web-preview
+ {{ 'notification.recipients-count' | translate : {count: preview.totalRecipientsCount} }}
+ 1">
+
+
+ {{ detail.value }}{{ detail.key }}
+
+
+
notification.delivery-method.web-preview
-
notification.delivery-method.email-preview
+ notification.delivery-method.mobile-app-preview
-
{{ preview.processedTemplates.EMAIL.subject }}
- {{ preview.processedTemplates.MOBILE_APP.subject }}
+ {{ preview.processedTemplates.MOBILE_APP.body }}
-
notification.delivery-method.sms-preview
+ notification.delivery-method.sms-preview
{{ preview.processedTemplates.SMS.body }}
-
notification.delivery-method.slack-preview
+ notification.delivery-method.email-preview
- {{ preview.processedTemplates.SLACK.body }}
+
{{ preview.processedTemplates.EMAIL.subject }}
+
-
- notification.delivery-method.microsoft-teams-preview
+ notification.delivery-method.slack-preview
-
{{ preview.processedTemplates.MICROSOFT_TEAMS.subject }}
- {{ preview.processedTemplates.MICROSOFT_TEAMS.body }}
+
+ {{ preview.processedTemplates.SLACK.body }}
-
-
- {{ 'notification.recipients-count' | translate : {count: preview.totalRecipientsCount} }}
+ notification.delivery-method.microsoft-teams-preview
1">
-
diff --git a/ui-ngx/src/app/modules/home/pages/notification/sent/sent-notification-dialog.component.scss b/ui-ngx/src/app/modules/home/pages/notification/sent/sent-notification-dialog.component.scss
index b048687712..ee0c8aeedc 100644
--- a/ui-ngx/src/app/modules/home/pages/notification/sent/sent-notification-dialog.component.scss
+++ b/ui-ngx/src/app/modules/home/pages/notification/sent/sent-notification-dialog.component.scss
@@ -16,7 +16,7 @@
@import "../../../../../../scss/constants";
:host {
- width: 820px;
+ width: 780px;
height: 100%;
max-width: 100%;
max-height: 100vh;
@@ -64,7 +64,7 @@
font-size: 13px;
}
- .tb-hint {
+ .tb-form-hint {
padding: 0 0 8px;
}
@@ -88,20 +88,14 @@
.delivery-methods-container {
margin-bottom: 20px;
- display: flex;
- flex-wrap: wrap;
+ display: grid;
+ grid-template-columns: repeat(auto-fit, minmax(200px, auto));
gap: 8px;
.delivery-method-container {
- display: inline-flex;
- flex: 1 1 calc(50% - 8px);
- max-width: calc(50% - 8px);
- padding: 16px 12px;
- border: 1px solid rgba(0, 0, 0, 0.1);
- border-radius: 6px;
+ flex-direction: row;
&.interact {
- cursor: pointer;
color: inherit;
}
@@ -112,32 +106,17 @@
}
}
- .additional-config-group {
- padding: 16px 16px 0;
- margin-bottom: 12px;
- border: 1px solid rgba(0, 0, 0, 0.1);
- border-radius: 6px;
- width: 100%;
- height: 100%;
-
- .toggle {
- margin-bottom: 16px;
- }
+ .toggle {
+ margin-bottom: 16px;
}
.preview-group {
- padding: 16px;
- margin-bottom: 10px;
- border: 1px groove rgba(0, 0, 0, .12);
- border-radius: 4px;
-
&.notification {
background-color: #F3F6FA;
- }
- .group-title {
- font-weight: 500;
- font-size: 14px;
+ tb-icon, .tb-form-panel-title {
+ color: rgba(0, 0, 0, .38);
+ }
}
&> div:not(:last-child) {
@@ -212,7 +191,7 @@
}
}
- .tb-notification-use-template-toggle-group {
+ tb-toggle-select {
margin-bottom: 24px;
width: 320px;
}
@@ -227,6 +206,7 @@
.mat-horizontal-stepper-wrapper {
flex: 1 1 100%;
+ width: 100%;
}
.mat-horizontal-content-container {
@@ -240,14 +220,6 @@
}
}
}
-
- .tb-form-panel .mat-expansion-panel.tb-settings {
- padding: 11px 16px;
-
- & > .mat-expansion-panel-content > .mat-expansion-panel-body {
- gap: 0;
- }
- }
}
.preview-group {
diff --git a/ui-ngx/src/app/modules/home/pages/notification/sent/sent-notification-dialog.componet.ts b/ui-ngx/src/app/modules/home/pages/notification/sent/sent-notification-dialog.componet.ts
index 3223331705..4d2d184dbd 100644
--- a/ui-ngx/src/app/modules/home/pages/notification/sent/sent-notification-dialog.componet.ts
+++ b/ui-ngx/src/app/modules/home/pages/notification/sent/sent-notification-dialog.componet.ts
@@ -24,7 +24,6 @@ import {
import { Component, Inject, OnDestroy, ViewChild } from '@angular/core';
import { Store } from '@ngrx/store';
import { AppState } from '@core/core.state';
-import { Router } from '@angular/router';
import { MAT_DIALOG_DATA, MatDialog, MatDialogRef } from '@angular/material/dialog';
import { AbstractControl, FormBuilder, FormGroup, Validators } from '@angular/forms';
import { NotificationService } from '@core/http/notification.service';
@@ -47,6 +46,7 @@ import { Authority } from '@shared/models/authority.enum';
import { AuthUser } from '@shared/models/user.model';
import { getCurrentAuthUser } from '@core/auth/auth.selectors';
import { TranslateService } from '@ngx-translate/core';
+import { Router } from '@angular/router';
export interface RequestNotificationDialogData {
request?: NotificationRequest;
@@ -150,11 +150,9 @@ export class SentNotificationDialogComponent extends
let useTemplate = true;
if (isDefinedAndNotNull(this.data.request.template)) {
useTemplate = false;
- // eslint-disable-next-line guard-for-in
- for (const method in this.data.request.template.configuration.deliveryMethodsTemplates) {
- this.deliveryMethodFormsMap.get(NotificationDeliveryMethod[method])
- .patchValue(this.data.request.template.configuration.deliveryMethodsTemplates[method]);
- }
+ this.notificationTemplateConfigurationForm.patchValue({
+ deliveryMethodsTemplates: this.data.request.template.configuration.deliveryMethodsTemplates
+ }, {emitEvent: false});
}
this.notificationRequestForm.get('useTemplate').setValue(useTemplate, {onlySelf : true});
}
@@ -178,6 +176,9 @@ export class SentNotificationDialogComponent extends
changeStep($event: StepperSelectionEvent) {
this.selectedIndex = $event.selectedIndex;
+ if ($event.previouslySelectedIndex > $event.selectedIndex) {
+ $event.previouslySelectedStep.interacted = false;
+ }
if (this.selectedIndex === this.maxStepperIndex) {
this.getPreview();
}
@@ -304,13 +305,16 @@ export class SentNotificationDialogComponent extends
}
allowConfigureDeliveryMethod(deliveryMethod: NotificationDeliveryMethod): boolean {
+ const tenantAllowConfigureDeliveryMethod = new Set([
+ NotificationDeliveryMethod.SLACK
+ ]);
if (deliveryMethod === NotificationDeliveryMethod.WEB) {
return false;
}
if(this.isSysAdmin()) {
return true;
} else if (this.isTenantAdmin()) {
- return deliveryMethod === NotificationDeliveryMethod.SLACK;
+ return tenantAllowConfigureDeliveryMethod.has(deliveryMethod);
}
return false;
}
@@ -325,6 +329,7 @@ export class SentNotificationDialogComponent extends
return '/settings/outgoing-mail';
case NotificationDeliveryMethod.SMS:
case NotificationDeliveryMethod.SLACK:
+ case NotificationDeliveryMethod.MOBILE_APP:
return '/settings/notifications';
}
}
diff --git a/ui-ngx/src/app/modules/home/pages/notification/sent/sent-table-config.resolver.ts b/ui-ngx/src/app/modules/home/pages/notification/sent/sent-table-config.resolver.ts
index e4395cdb72..97b353555a 100644
--- a/ui-ngx/src/app/modules/home/pages/notification/sent/sent-table-config.resolver.ts
+++ b/ui-ngx/src/app/modules/home/pages/notification/sent/sent-table-config.resolver.ts
@@ -21,7 +21,7 @@ import {
EntityTableConfig
} from '@home/models/entity/entities-table-config.models';
import {
- NotificationDeliveryMethodTranslateMap,
+ NotificationDeliveryMethodInfoMap,
NotificationRequest,
NotificationRequestInfo,
NotificationRequestStats,
@@ -94,7 +94,7 @@ export class SentTableConfigResolver implements Resolve
- {{ detail.value }}{{ detail.key }}
-
+
+
- {{ preview.processedTemplates.MICROSOFT_TEAMS.subject }}
+ {{ preview.processedTemplates.MICROSOFT_TEAMS.body }}
notification.customize-messages
+
+ {{ 'notification.input-fields-support-templatization' | translate}}
+
+
+notification.at-least-one-should-be-selected
- {{ 'notification.input-fields-support-templatization' | translate}}
-
-
-
-
-
-
-
-
- {{ 'notification.input-fields-support-templatization' | translate}}
-
-
-
- {{ 'notification.input-field-support-templatization' | translate}}
-
-
-
- {{ 'notification.input-field-support-templatization' | translate}}
-
-
-
- {{ 'notification.input-fields-support-templatization' | translate}}
-
-
-
-
+
-
-
- notification.theme-color
- |