Modular logistics and supply chain operating system (LSOS)
JavaScript driver-appfleet-managementfreight-managementinfrastructureinventory-managementlast-mile-deliverylogisticsondemandopen-sourceorder-managementroute-optimizationsupply-chain-managementtracking-and-monitoringtransport-management-systemtransportationwarehouse-management
updated notificaiton setting structure to be more robust
Ronald A. Richardsone7b5282aa346
diff --git a/console/app/controllers/console/admin/notifications.js b/console/app/controllers/console/admin/notifications.jsindex b822fb49..a56dfb32 100644--- a/console/app/controllers/console/admin/notifications.js+++ b/console/app/controllers/console/admin/notifications.js@@ -5,17 +5,60 @@ import { inject as service } from '@ember/service';import createNotificationKey from '../../../utils/create-notification-key';export default class ConsoleAdminNotificationsController extends Controller {+ /**+ * Inject the notifications service.+ *+ * @memberof ConsoleAdminNotificationsController+ */@service notifications;++ /**+ * Inject the fetch service.+ *+ * @memberof ConsoleAdminNotificationsController+ */@service fetch;++ /**+ * The notification settings value JSON.+ *+ * @memberof ConsoleAdminNotificationsController+ * @var {Object}+ */@tracked notificationSettings = {};++ /**+ * Notification transport methods enabled.+ *+ * @memberof ConsoleAdminNotificationsController+ * @var {Array}+ */@tracked notificationTransportMethods = ['email', 'sms'];++ /**+ * Tracked property for the loading state+ *+ * @memberof ConsoleAdminNotificationsController+ * @var {Boolean}+ */@tracked isLoading = false;+ /**+ * Creates an instance of ConsoleAdminNotificationsController.+ * @memberof ConsoleAdminNotificationsController+ */constructor() {super(...arguments);this.getSettings();}+ /**+ * Selectes notifiables for settings.+ *+ * @param {Object} notification+ * @param {Array} notifiables+ * @memberof ConsoleAdminNotificationsController+ */@action onSelectNotifiable(notification, notifiables) {const notificationKey = createNotificationKey(notification.definition);const _notificationSettings = { ...this.notificationSettings };@@ -24,7 +67,7 @@ export default class ConsoleAdminNotificationsController extends Controller {_notificationSettings[notificationKey] = {};}- _notificationSettings[notificationKey].recipients = notifiables;+ _notificationSettings[notificationKey].notifiables = notifiables;_notificationSettings[notificationKey].definition = notification.definition;_notificationSettings[notificationKey].via = notifiables.map((notifiable) => {return {@@ -36,6 +79,12 @@ export default class ConsoleAdminNotificationsController extends Controller {this.mutateNotificationSettings(_notificationSettings);}+ /**+ * Mutates the notification settings property.+ *+ * @param {Object} [_notificationSettings={}]+ * @memberof ConsoleAdminNotificationsController+ */mutateNotificationSettings(_notificationSettings = {}) {this.notificationSettings = {...this.notificationSettings,@@ -46,7 +95,6 @@ export default class ConsoleAdminNotificationsController extends Controller {/*** Save notification settings to the server.*- ** @action* @method saveSettings* @returns {Promise}@@ -73,7 +121,6 @@ export default class ConsoleAdminNotificationsController extends Controller {/*** Fetches and updates notification settings asynchronously.*- ** @returns {Promise<void>} A promise for successful retrieval and update, or an error on failure.*/getSettings() {diff --git a/console/app/templates/console/admin/notifications.hbs b/console/app/templates/console/admin/notifications.hbsindex 26b8dd8e..cde2c420 100644--- a/console/app/templates/console/admin/notifications.hbs+++ b/console/app/templates/console/admin/notifications.hbs@@ -14,7 +14,7 @@<PowerSelectMultiple@searchEnabled={{true}}@options={{this.notifiables}}- @selected={{get this.notificationSettings (concat (get-notification-key notification.definition) ".recipients")}}+ @selected={{get this.notificationSettings (concat (get-notification-key notification.definition) ".notifiables")}}@onChange={{fn this.onSelectNotifiable notification}}@placeholder="Select notifiables..."@triggerClass="form-select form-input form-input-sm flex-1"