@digital-realty/ix-notifications 1.0.15 → 1.0.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -26,6 +26,7 @@ export declare class IxNotifications extends MobxLitElement {
26
26
  firstUpdated(): Promise<void>;
27
27
  connectedCallback(): void;
28
28
  disconnectedCallback(): void;
29
+ handleOnbeforeunload(event: any): void;
29
30
  toggleDrawer(): void;
30
31
  renderUnReadCountText(): import("lit").TemplateResult<1>;
31
32
  markAllread(): void;
@@ -36,10 +36,16 @@ export class IxNotifications extends MobxLitElement {
36
36
  connectedCallback() {
37
37
  super.connectedCallback();
38
38
  window.addEventListener('account-switched', NotificationsState.NewApiClient);
39
+ window.addEventListener('beforeunload', this.handleOnbeforeunload);
39
40
  }
40
41
  disconnectedCallback() {
41
- super.disconnectedCallback();
42
42
  window.removeEventListener('account-switched', NotificationsState.NewApiClient);
43
+ window.removeEventListener('beforeunload', this.handleOnbeforeunload);
44
+ super.disconnectedCallback();
45
+ }
46
+ //Handle browser refresh event
47
+ handleOnbeforeunload(event) {
48
+ NotificationsState.clearStoredNotificationsData();
43
49
  }
44
50
  toggleDrawer() {
45
51
  this.showDrawer = !this.showDrawer;
@@ -83,7 +89,7 @@ export class IxNotifications extends MobxLitElement {
83
89
  });
84
90
  });
85
91
  const apiResult = { State: allResultSuccesful === true ? ApiCallState.SUCCESS : ApiCallState.ERROR,
86
- Message: allResultSuccesful === true ? "Successfully marked all the notificaions as read" : "Error while marking the notifications read, Please try again"
92
+ Message: allResultSuccesful === true ? "Successfully marked all the notifications as read" : "Error occurred while marking the notifications as read, Please try again"
87
93
  };
88
94
  this.showResultMessage(apiResult, unreadItems[0].id);
89
95
  this.renderUnReadCountText();
@@ -1 +1 @@
1
- {"version":3,"file":"IxNotifications.js","sourceRoot":"","sources":["../src/IxNotifications.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAC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sB","sourcesContent":["import { html, nothing } from 'lit';\nimport { property, query, state } from 'lit/decorators.js';\nimport { MobxLitElement } from '@adobe/lit-mobx';\nimport { differenceInDays, differenceInHours } from 'date-fns';\nimport { TWStyles } from './tw.js';\nimport '@digital-realty/ix-button/ix-button.js';\nimport '@digital-realty/ix-drawer/ix-drawer.js';\nimport '@digital-realty/ix-icon';\nimport '@material/web/icon/icon.js';\nimport { NotificationsState } from './state/NotificationState.js';\nimport { ApiCallResult, Notification } from './models/notification.js';\nimport {\n ConfirmationDialogEventDetail,\n FilterDialogEventDetail,\n} from './constants/notification-types.js';\nimport {\n ApiCallState,\n NotificationGroups,\n NotificationStatus,\n} from './constants/notifications.js';\nimport './components/notifications/notification-item.js';\nimport './components/notifications/grouped-item.js';\nimport './components/notifications/group-filters.js';\nimport './components/notifications/date-filters.js';\nimport './components/notifications/confirmation-dialog.js';\nimport { NotificationsStyle } from './styles/notifications-style.js';\n\nexport class IxNotifications extends MobxLitElement {\n static styles = [TWStyles, NotificationsStyle];\n\n @query('group-filters') groupFilters!: HTMLElement;\n\n @query('ix-icon-button#group-filter-button') groupFiltersButton!: HTMLElement;\n\n @query('date-filters') dateFilters!: HTMLElement;\n\n @query('ix-icon-button#date-filters-button') dateFiltersButton!: HTMLElement;\n\n @state() private showDrawer = false;\n\n @state() private showGroupedView = false;\n\n @state() private showFilters = false;\n\n @state() private showDateFilters = false;\n\n @state() private showMarkAllReadConfirmation = false;\n\n @property({ type: String }) baseApiUrl = '';\n\n @property({ type: String }) localStorageKey = '';\n\n async firstUpdated() {\n // Construct ApiClient form baseApiUrl and localStorageKey\n NotificationsState.baseApiUrl = this.baseApiUrl;\n NotificationsState.localStorageKey = this.localStorageKey;\n NotificationsState.ConstructApiClient();\n }\n\n connectedCallback() {\n super.connectedCallback();\n window.addEventListener(\n 'account-switched',\n NotificationsState.NewApiClient\n );\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n window.removeEventListener(\n 'account-switched',\n NotificationsState.NewApiClient\n );\n }\n\n toggleDrawer() {\n this.showDrawer = !this.showDrawer;\n if (!this.showDrawer) {\n this.showFilters = false;\n this.showDateFilters = false;\n }\n }\n\n /* eslint-disable-next-line */\n renderUnReadCountText() {\n if (NotificationsState.unreadNotificationCount <= 0) {\n return html`${nothing}`;\n }\n\n let unreadCountText = '';\n if (NotificationsState.unreadNotificationCount > 99) {\n unreadCountText = '99+';\n } else {\n unreadCountText = NotificationsState.unreadNotificationCount.toString();\n }\n\n return html` <div\n class=\"unread rounded-full text-center text-white text-sm absolute icon-position -start-0\"\n >\n ${unreadCountText}\n </div>`;\n }\n\n markAllread() {\n this.showMarkAllReadConfirmation = true;\n }\n\n private confirmedMarkAllRead(e: CustomEvent<ConfirmationDialogEventDetail>) {\n // Mark All read if Confirmed True\n if (e.detail.returnValue) {\n const filterNotification = this.applyNotificationFilters();\n const unreadItems = filterNotification?.filter(item => item.status === NotificationStatus.UNREAD);\n\n if(unreadItems.length > 0) {\n let allResultSuccesful = true;\n\n filterNotification?.forEach(item => {\n NotificationsState.setNotificationReadStatus(item.id).then((result : any) => \n { \n if(allResultSuccesful)\n allResultSuccesful = result;\n });\n });\n\n const apiResult = { State : allResultSuccesful === true? ApiCallState.SUCCESS : ApiCallState.ERROR,\n Message : allResultSuccesful === true? \"Successfully marked all the notificaions as read\" : \"Error while marking the notifications read, Please try again\"\n } as ApiCallResult;\n\n this.showResultMessage(apiResult,unreadItems[0].id);\n\n this.renderUnReadCountText();\n\n this.requestUpdate();\n }\n }\n\n this.showMarkAllReadConfirmation = false;\n }\n\n private showResultMessage(result: ApiCallResult, id: string )\n { \n window.dispatchEvent(\n new CustomEvent(\"add-toast\", { detail: {\n id,\n content: html`\n <ix-message-toast toastId=${id} .TMessageToast=${result.State.toLowerCase()} forceClose> \n ${result.Message}\n </ix-message-toast>`,\n autoClose: 3000,\n durationOut: 3000,\n vertical: 'bottom',\n horizontal: 'center',\n animated: true, \n above: false,\n } })\n );\n }\n\n toggleGroupView() {\n this.showGroupedView = !this.showGroupedView;\n }\n\n displayFilters() {\n this.showFilters = !this.showFilters;\n }\n\n /* eslint-disable-next-line */\n applyNotificationFilters() {\n const filterredNotifications = NotificationsState.notifications?.filter(\n (x: Notification) =>\n (x.resourceType === NotificationGroups.PLANNED_MAINTENANCE &&\n NotificationsState.notificationFilters.SHOW_PLANNED_MAINTENANCE ===\n true) ||\n (x.resourceType === NotificationGroups.SERVICE_TICKETS &&\n NotificationsState.notificationFilters.SHOW_SERVICE_TICKETS ===\n true) ||\n (x.resourceType === NotificationGroups.DCIM_ALERTS &&\n NotificationsState.notificationFilters.SHOW_DCIM_ALERTS === true) ||\n x.resourceType === NotificationGroups.INCIDENTS\n ); // Always display incidents\n\n if (\n NotificationsState.dateFilters.FROM_DATE === undefined &&\n NotificationsState.dateFilters.TO_DATE === undefined\n )\n return filterredNotifications;\n\n if ( NotificationsState.dateFilters.FROM_DATE === undefined)\n return filterredNotifications.filter(\n x => differenceInDays(\n new Date(x.createdAt),\n NotificationsState.dateFilters.TO_DATE!\n ) <= 0\n );\n \n if ( NotificationsState.dateFilters.TO_DATE === undefined)\n return filterredNotifications.filter(\n x =>\n differenceInHours(\n new Date(x.createdAt),\n NotificationsState.dateFilters.FROM_DATE!\n ) >= 0); \n\n return filterredNotifications.filter(\n x =>\n differenceInHours(\n new Date(x.createdAt),\n NotificationsState.dateFilters.FROM_DATE!\n ) >= 0 &&\n differenceInDays(\n new Date(x.createdAt),\n NotificationsState.dateFilters.TO_DATE!\n ) <= 0\n );\n }\n\n displayDateFilters() {\n this.showDateFilters = !this.showDateFilters;\n }\n\n renderGroupedView() {\n const filteredNotifications = this.applyNotificationFilters();\n\n return html`<div style=\"margin:0px\">\n <grouped-item\n groupTitle=${NotificationGroups.PLANNED_MAINTENANCE}\n iconName=\"lab_profile\"\n .childItems=${filteredNotifications?.filter(\n item => item.resourceType === NotificationGroups.PLANNED_MAINTENANCE\n )}\n ></grouped-item>\n <grouped-item\n groupTitle=${NotificationGroups.INCIDENTS}\n iconName=\"emergency_home\"\n .childItems=${filteredNotifications?.filter(\n item => item.resourceType === NotificationGroups.INCIDENTS\n )}\n ></grouped-item>\n <grouped-item\n groupTitle=${NotificationGroups.SERVICE_TICKETS}\n iconName=\"dvr\"\n .childItems=${filteredNotifications?.filter(\n item => item.resourceType === NotificationGroups.SERVICE_TICKETS\n )}\n ></grouped-item>\n <grouped-item\n groupTitle=${NotificationGroups.DCIM_ALERTS}\n iconName=\"public\"\n .childItems=${filteredNotifications?.filter(\n item => item.resourceType === NotificationGroups.DCIM_ALERTS\n )}\n ></grouped-item> \n </div>`;\n }\n\n renderDefaultView() {\n const filterNotification = this.applyNotificationFilters();\n const filterTodayItems = filterNotification.filter(\n x => differenceInDays(x.createdAt, new Date()) === 0\n );\n const filterEarlierItems = filterNotification.filter(\n x => differenceInDays(x.createdAt, new Date()) !== 0\n );\n\n if (filterNotification?.length! > 0) {\n return html` <h3 class=\"grow\">Latest</h3>\n <div class=\"m-0 p-0\">\n ${filterTodayItems.length > 0\n ? filterTodayItems?.map(\n item => html`<notification-item\n .notificaiton=${item}\n ?disabled=${item.resourceType ===\n NotificationGroups.INCIDENTS}\n >\n </notification-item> `\n )\n : this.renderNoResult()}\n </div>\n <h3 class=\"grow\">Earlier</h3>\n <div>\n ${filterEarlierItems.length > 0\n ? filterEarlierItems?.map(\n item => html`<notification-item\n .notificaiton=${item}\n ?disabled=${item.resourceType ===\n NotificationGroups.INCIDENTS}\n >\n </notification-item> `\n )\n : this.renderNoResult()}\n </div>`;\n }\n\n return html`<p class=\"empty\">No notifications yet.</p>`;\n }\n\n /* eslint-disable-next-line */\n renderNoResult() {\n return html`<p class=\"empty\">No notifications yet.</p>`;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n handleCloseClick(_e: CustomEvent<FilterDialogEventDetail>) {\n this.showDateFilters = false;\n this.showFilters = false;\n }\n\n // eslint-disable-next-line\n handleContentScroll(e: CustomEvent) {\n // when scrollbar at the end, retrieve next page\n if (\n e !== null &&\n e.detail.scrollTop + e.detail.clientHeight >= e.detail.scrollHeight\n ) {\n NotificationsState.getNotifications();\n }\n }\n\n manageFilterVisibility(e: Event) {\n const path = e.composedPath();\n if (\n this.showFilters &&\n !path.includes(this.groupFilters) &&\n !path.includes(this.groupFiltersButton)\n ) {\n this.showFilters = false;\n }\n if (\n this.showDateFilters &&\n !path.includes(this.dateFilters) &&\n !path.includes(this.dateFiltersButton)\n ) {\n this.showDateFilters = false;\n }\n }\n\n render() {\n return html`\n <div class=\"relative\">\n <ix-icon-button class=\"blue-icon\" @click=${() => this.toggleDrawer()}>\n <slot name=\"icon\" slot=\"default\"></slot>\n </ix-icon-button>\n ${this.renderUnReadCountText()}\n </div>\n <confirmation-dialog\n ?open=${this.showMarkAllReadConfirmation}\n @confirm-dialog-closed=${() => {\n this.showMarkAllReadConfirmation = false;\n }}\n @on-confirm-selection=${this.confirmedMarkAllRead}\n textMessage=\"Are you sure you want to mark all notifications as read?\"\n >\n </confirmation-dialog>\n <ix-drawer\n ?isVisible=${this.showDrawer}\n .onClosed=${() => this.toggleDrawer()}\n animate-vertical\n hide-close\n @on-content-scroll=${this.handleContentScroll}\n @click=${this.manageFilterVisibility}\n >\n <div class=\"flex flex-row justify-between grow py-2\" slot=\"header\">\n <h2 class=\"grow items-center notification-header\">Notifications</h2>\n <div class=\"flex flex-row justify-end grow items-center options\">\n <ix-icon-button\n @click=${this.markAllread}\n icon=\"markunread_mailbox\"\n class=\"blue-icon\"\n ></ix-icon-button>\n <ix-icon-button\n @click=${this.toggleGroupView}\n icon=\"sort\"\n class=\"blue-icon\"\n ></ix-icon-button>\n <ix-icon-button\n @click=${this.displayFilters}\n icon=\"list\"\n class=\"blue-icon\"\n id=\"group-filter-button\"\n ></ix-icon-button>\n <div\n class=\"filter-dropdown-content ${this.showFilters\n ? 'active z-50'\n : ''}\"\n >\n <group-filters></group-filters>\n </div>\n <ix-icon-button\n @click=${this.displayDateFilters}\n icon=\"calendar_month\"\n class=\"blue-icon\"\n id=\"date-filters-button\"\n ></ix-icon-button>\n <div\n class=\"datefilter-dropdown-content ${this.showDateFilters\n ? 'active z-50'\n : ''}\"\n @on-selection=${this.handleCloseClick}\n >\n <date-filters></date-filters>\n </div>\n </div>\n </div>\n <div slot=\"content\">\n ${this.showGroupedView\n ? this.renderGroupedView()\n : this.renderDefaultView()}\n </div> \n </ix-drawer>\n `;\n }\n}\n"]}
1
+ {"version":3,"file":"IxNotifications.js","sourceRoot":"","sources":["../src/IxNotifications.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,wCAAwC,CAAC;AAChD,OAAO,wCAAwC,CAAC;AAChD,OAAO,yBAAyB,CAAC;AACjC,OAAO,4BAA4B,CAAC;AACpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAMlE,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,8BAA8B,CAAC;AACtC,OAAO,iDAAiD,CAAC;AACzD,OAAO,4CAA4C,CAAC;AACpD,OAAO,6CAA6C,CAAC;AACrD,OAAO,4CAA4C,CAAC;AACpD,OAAO,mDAAmD,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAErE,MAAM,OAAO,eAAgB,SAAQ,cAAc;IAAnD;;QAWmB,eAAU,GAAG,KAAK,CAAC;QAEnB,oBAAe,GAAG,KAAK,CAAC;QAExB,gBAAW,GAAG,KAAK,CAAC;QAEpB,oBAAe,GAAG,KAAK,CA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,EAAE;YAC1B,CAAC,CAAC,IAAI,CAAC,iBAAiB,EAAE;;;KAGjC,CAAC;IACJ,CAAC;;AArYM,sBAAM,GAAG,CAAC,QAAQ,EAAE,kBAAkB,CAAC,CAAC;AAEvB;IAAvB,KAAK,CAAC,eAAe,CAAC;qDAA4B;AAEN;IAA5C,KAAK,CAAC,oCAAoC,CAAC;2DAAkC;AAEvD;IAAtB,KAAK,CAAC,cAAc,CAAC;oDAA2B;AAEJ;IAA5C,KAAK,CAAC,oCAAoC,CAAC;0DAAiC;AAEpE;IAAR,KAAK,EAAE;mDAA4B;AAE3B;IAAR,KAAK,EAAE;wDAAiC;AAEhC;IAAR,KAAK,EAAE;oDAA6B;AAE5B;IAAR,KAAK,EAAE;wDAAiC;AAEhC;IAAR,KAAK,EAAE;oEAA6C;AAEzB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;mDAAiB;AAEhB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wDAAsB","sourcesContent":["import { html, nothing } from 'lit';\nimport { property, query, state } from 'lit/decorators.js';\nimport { MobxLitElement } from '@adobe/lit-mobx';\nimport { differenceInDays, differenceInHours } from 'date-fns';\nimport { TWStyles } from './tw.js';\nimport '@digital-realty/ix-button/ix-button.js';\nimport '@digital-realty/ix-drawer/ix-drawer.js';\nimport '@digital-realty/ix-icon';\nimport '@material/web/icon/icon.js';\nimport { NotificationsState } from './state/NotificationState.js';\nimport { ApiCallResult, Notification } from './models/notification.js';\nimport {\n ConfirmationDialogEventDetail,\n FilterDialogEventDetail,\n} from './constants/notification-types.js';\nimport {\n ApiCallState,\n NotificationGroups,\n NotificationStatus,\n} from './constants/notifications.js';\nimport './components/notifications/notification-item.js';\nimport './components/notifications/grouped-item.js';\nimport './components/notifications/group-filters.js';\nimport './components/notifications/date-filters.js';\nimport './components/notifications/confirmation-dialog.js';\nimport { NotificationsStyle } from './styles/notifications-style.js';\n\nexport class IxNotifications extends MobxLitElement {\n static styles = [TWStyles, NotificationsStyle];\n\n @query('group-filters') groupFilters!: HTMLElement;\n\n @query('ix-icon-button#group-filter-button') groupFiltersButton!: HTMLElement;\n\n @query('date-filters') dateFilters!: HTMLElement;\n\n @query('ix-icon-button#date-filters-button') dateFiltersButton!: HTMLElement;\n\n @state() private showDrawer = false;\n\n @state() private showGroupedView = false;\n\n @state() private showFilters = false;\n\n @state() private showDateFilters = false;\n\n @state() private showMarkAllReadConfirmation = false;\n\n @property({ type: String }) baseApiUrl = '';\n\n @property({ type: String }) localStorageKey = '';\n\n async firstUpdated() { \n // Construct ApiClient form baseApiUrl and localStorageKey\n NotificationsState.baseApiUrl = this.baseApiUrl;\n NotificationsState.localStorageKey = this.localStorageKey;\n NotificationsState.ConstructApiClient();\n }\n\n connectedCallback() {\n super.connectedCallback();\n window.addEventListener(\n 'account-switched',\n NotificationsState.NewApiClient\n );\n window.addEventListener('beforeunload', this.handleOnbeforeunload);\n }\n\n disconnectedCallback() {\n window.removeEventListener(\n 'account-switched',\n NotificationsState.NewApiClient\n );\n window.removeEventListener('beforeunload', this.handleOnbeforeunload);\n super.disconnectedCallback();\n }\n\n //Handle browser refresh event\n handleOnbeforeunload(event : any){ \n NotificationsState.clearStoredNotificationsData();\n }\n\n toggleDrawer() {\n this.showDrawer = !this.showDrawer;\n if (!this.showDrawer) {\n this.showFilters = false;\n this.showDateFilters = false;\n }\n }\n\n /* eslint-disable-next-line */\n renderUnReadCountText() {\n if (NotificationsState.unreadNotificationCount <= 0) {\n return html`${nothing}`;\n }\n\n let unreadCountText = '';\n if (NotificationsState.unreadNotificationCount > 99) {\n unreadCountText = '99+';\n } else {\n unreadCountText = NotificationsState.unreadNotificationCount.toString();\n }\n\n return html` <div\n class=\"unread rounded-full text-center text-white text-sm absolute icon-position -start-0\"\n >\n ${unreadCountText}\n </div>`;\n }\n\n markAllread() {\n this.showMarkAllReadConfirmation = true;\n }\n\n private confirmedMarkAllRead(e: CustomEvent<ConfirmationDialogEventDetail>) {\n // Mark All read if Confirmed True\n if (e.detail.returnValue) {\n const filterNotification = this.applyNotificationFilters();\n const unreadItems = filterNotification?.filter(item => item.status === NotificationStatus.UNREAD);\n\n if(unreadItems.length > 0) {\n let allResultSuccesful = true;\n\n filterNotification?.forEach(item => {\n NotificationsState.setNotificationReadStatus(item.id).then((result : any) => \n { \n if(allResultSuccesful)\n allResultSuccesful = result;\n });\n });\n\n const apiResult = { State : allResultSuccesful === true? ApiCallState.SUCCESS : ApiCallState.ERROR,\n Message : allResultSuccesful === true? \"Successfully marked all the notifications as read\" : \"Error occurred while marking the notifications as read, Please try again\"\n } as ApiCallResult;\n\n this.showResultMessage(apiResult,unreadItems[0].id);\n\n this.renderUnReadCountText();\n\n this.requestUpdate();\n }\n }\n\n this.showMarkAllReadConfirmation = false;\n }\n\n private showResultMessage(result: ApiCallResult, id: string )\n { \n window.dispatchEvent(\n new CustomEvent(\"add-toast\", { detail: {\n id,\n content: html`\n <ix-message-toast toastId=${id} .TMessageToast=${result.State.toLowerCase()} forceClose> \n ${result.Message}\n </ix-message-toast>`,\n autoClose: 3000,\n durationOut: 3000,\n vertical: 'bottom',\n horizontal: 'center',\n animated: true, \n above: false,\n } })\n );\n }\n\n toggleGroupView() {\n this.showGroupedView = !this.showGroupedView;\n }\n\n displayFilters() {\n this.showFilters = !this.showFilters;\n }\n\n /* eslint-disable-next-line */\n applyNotificationFilters() {\n const filterredNotifications = NotificationsState.notifications?.filter(\n (x: Notification) =>\n (x.resourceType === NotificationGroups.PLANNED_MAINTENANCE &&\n NotificationsState.notificationFilters.SHOW_PLANNED_MAINTENANCE ===\n true) ||\n (x.resourceType === NotificationGroups.SERVICE_TICKETS &&\n NotificationsState.notificationFilters.SHOW_SERVICE_TICKETS ===\n true) ||\n (x.resourceType === NotificationGroups.DCIM_ALERTS &&\n NotificationsState.notificationFilters.SHOW_DCIM_ALERTS === true) ||\n x.resourceType === NotificationGroups.INCIDENTS\n ); // Always display incidents\n\n if (\n NotificationsState.dateFilters.FROM_DATE === undefined &&\n NotificationsState.dateFilters.TO_DATE === undefined\n )\n return filterredNotifications;\n\n if ( NotificationsState.dateFilters.FROM_DATE === undefined)\n return filterredNotifications.filter(\n x => differenceInDays(\n new Date(x.createdAt),\n NotificationsState.dateFilters.TO_DATE!\n ) <= 0\n );\n \n if ( NotificationsState.dateFilters.TO_DATE === undefined)\n return filterredNotifications.filter(\n x =>\n differenceInHours(\n new Date(x.createdAt),\n NotificationsState.dateFilters.FROM_DATE!\n ) >= 0); \n\n return filterredNotifications.filter(\n x =>\n differenceInHours(\n new Date(x.createdAt),\n NotificationsState.dateFilters.FROM_DATE!\n ) >= 0 &&\n differenceInDays(\n new Date(x.createdAt),\n NotificationsState.dateFilters.TO_DATE!\n ) <= 0\n );\n }\n\n displayDateFilters() {\n this.showDateFilters = !this.showDateFilters;\n }\n\n renderGroupedView() {\n const filteredNotifications = this.applyNotificationFilters();\n\n return html`<div style=\"margin:0px\">\n <grouped-item\n groupTitle=${NotificationGroups.PLANNED_MAINTENANCE}\n iconName=\"lab_profile\"\n .childItems=${filteredNotifications?.filter(\n item => item.resourceType === NotificationGroups.PLANNED_MAINTENANCE\n )}\n ></grouped-item>\n <grouped-item\n groupTitle=${NotificationGroups.INCIDENTS}\n iconName=\"emergency_home\"\n .childItems=${filteredNotifications?.filter(\n item => item.resourceType === NotificationGroups.INCIDENTS\n )}\n ></grouped-item>\n <grouped-item\n groupTitle=${NotificationGroups.SERVICE_TICKETS}\n iconName=\"dvr\"\n .childItems=${filteredNotifications?.filter(\n item => item.resourceType === NotificationGroups.SERVICE_TICKETS\n )}\n ></grouped-item>\n <grouped-item\n groupTitle=${NotificationGroups.DCIM_ALERTS}\n iconName=\"public\"\n .childItems=${filteredNotifications?.filter(\n item => item.resourceType === NotificationGroups.DCIM_ALERTS\n )}\n ></grouped-item> \n </div>`;\n }\n\n renderDefaultView() {\n const filterNotification = this.applyNotificationFilters();\n const filterTodayItems = filterNotification.filter(\n x => differenceInDays(x.createdAt, new Date()) === 0\n );\n const filterEarlierItems = filterNotification.filter(\n x => differenceInDays(x.createdAt, new Date()) !== 0\n );\n\n if (filterNotification?.length! > 0) {\n return html` <h3 class=\"grow\">Latest</h3>\n <div class=\"m-0 p-0\">\n ${filterTodayItems.length > 0\n ? filterTodayItems?.map(\n item => html`<notification-item\n .notificaiton=${item}\n ?disabled=${item.resourceType ===\n NotificationGroups.INCIDENTS}\n >\n </notification-item> `\n )\n : this.renderNoResult()}\n </div>\n <h3 class=\"grow\">Earlier</h3>\n <div>\n ${filterEarlierItems.length > 0\n ? filterEarlierItems?.map(\n item => html`<notification-item\n .notificaiton=${item}\n ?disabled=${item.resourceType ===\n NotificationGroups.INCIDENTS}\n >\n </notification-item> `\n )\n : this.renderNoResult()}\n </div>`;\n }\n\n return html`<p class=\"empty\">No notifications yet.</p>`;\n }\n\n /* eslint-disable-next-line */\n renderNoResult() {\n return html`<p class=\"empty\">No notifications yet.</p>`;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n handleCloseClick(_e: CustomEvent<FilterDialogEventDetail>) {\n this.showDateFilters = false;\n this.showFilters = false;\n }\n\n // eslint-disable-next-line\n handleContentScroll(e: CustomEvent) {\n // when scrollbar at the end, retrieve next page\n if (\n e !== null &&\n e.detail.scrollTop + e.detail.clientHeight >= e.detail.scrollHeight\n ) {\n NotificationsState.getNotifications();\n }\n }\n\n manageFilterVisibility(e: Event) {\n const path = e.composedPath();\n if (\n this.showFilters &&\n !path.includes(this.groupFilters) &&\n !path.includes(this.groupFiltersButton)\n ) {\n this.showFilters = false;\n }\n if (\n this.showDateFilters &&\n !path.includes(this.dateFilters) &&\n !path.includes(this.dateFiltersButton)\n ) {\n this.showDateFilters = false;\n }\n }\n\n render() {\n return html`\n <div class=\"relative\">\n <ix-icon-button class=\"blue-icon\" @click=${() => this.toggleDrawer()}>\n <slot name=\"icon\" slot=\"default\"></slot>\n </ix-icon-button>\n ${this.renderUnReadCountText()}\n </div>\n <confirmation-dialog\n ?open=${this.showMarkAllReadConfirmation}\n @confirm-dialog-closed=${() => {\n this.showMarkAllReadConfirmation = false;\n }}\n @on-confirm-selection=${this.confirmedMarkAllRead}\n textMessage=\"Are you sure you want to mark all notifications as read?\"\n >\n </confirmation-dialog>\n <ix-drawer\n ?isVisible=${this.showDrawer}\n .onClosed=${() => this.toggleDrawer()}\n animate-vertical\n hide-close\n @on-content-scroll=${this.handleContentScroll}\n @click=${this.manageFilterVisibility}\n >\n <div class=\"flex flex-row justify-between grow py-2\" slot=\"header\">\n <h2 class=\"grow items-center notification-header\">Notifications</h2>\n <div class=\"flex flex-row justify-end grow items-center options\">\n <ix-icon-button\n @click=${this.markAllread}\n icon=\"markunread_mailbox\"\n class=\"blue-icon\"\n ></ix-icon-button>\n <ix-icon-button\n @click=${this.toggleGroupView}\n icon=\"sort\"\n class=\"blue-icon\"\n ></ix-icon-button>\n <ix-icon-button\n @click=${this.displayFilters}\n icon=\"list\"\n class=\"blue-icon\"\n id=\"group-filter-button\"\n ></ix-icon-button>\n <div\n class=\"filter-dropdown-content ${this.showFilters\n ? 'active z-50'\n : ''}\"\n >\n <group-filters></group-filters>\n </div>\n <ix-icon-button\n @click=${this.displayDateFilters}\n icon=\"calendar_month\"\n class=\"blue-icon\"\n id=\"date-filters-button\"\n ></ix-icon-button>\n <div\n class=\"datefilter-dropdown-content ${this.showDateFilters\n ? 'active z-50'\n : ''}\"\n @on-selection=${this.handleCloseClick}\n >\n <date-filters></date-filters>\n </div>\n </div>\n </div>\n <div slot=\"content\">\n ${this.showGroupedView\n ? this.renderGroupedView()\n : this.renderDefaultView()}\n </div> \n </ix-drawer>\n `;\n }\n}\n"]}
@@ -13,13 +13,14 @@ import { TWStyles } from '../../tw.js';
13
13
  import { NotificationsState } from '../../state/NotificationState.js';
14
14
  import { NotificationsStyle } from '../../styles/notifications-style.js';
15
15
  import { DefaultDateFormat } from '../../constants/notifications.js';
16
+ import { isNullOrUndefinedOrEmpty } from '../../helper/common.js';
16
17
  let DateFilters = class DateFilters extends MobxLitElement {
17
18
  constructor() {
18
19
  super(...arguments);
19
- this.fromDate = format(NotificationsState.dateFilters.FROM_DATE, DefaultDateFormat) ||
20
- undefined;
21
- this.toDate = format(NotificationsState.dateFilters.TO_DATE, DefaultDateFormat) ||
22
- undefined;
20
+ this.fromDate = !isNullOrUndefinedOrEmpty(NotificationsState.dateFilters.FROM_DATE) ?
21
+ format(NotificationsState.dateFilters.FROM_DATE, DefaultDateFormat) : undefined;
22
+ this.toDate = !isNullOrUndefinedOrEmpty(NotificationsState.dateFilters.TO_DATE) ?
23
+ format(NotificationsState.dateFilters.TO_DATE, DefaultDateFormat) : undefined;
23
24
  this.maxDate = format(new Date(), DefaultDateFormat);
24
25
  this.fromDateErrorText = '';
25
26
  this.toDateErrorText = '';
@@ -106,7 +107,7 @@ let DateFilters = class DateFilters extends MobxLitElement {
106
107
  @click=${this.clearDateFilters}
107
108
  >
108
109
  <label class="grow text-sm text-right pr-1 cursor-pointer"
109
- >Cleare Filter</label
110
+ >Clear Filter</label
110
111
  >
111
112
  <ix-icon-button
112
113
  appearance="default"
@@ -1 +1 @@
1
- {"version":3,"file":"date-filters.js","sourceRoot":"","sources":["../../../src/components/notifications/date-filters.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3B,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,kDAAkD,CAAC;AAC1D,OAAO,oCAAoC,CAAC;AAC5C,OAAO,0CAA0C,CAAC;AAClD,OAAO,yBAAyB,CAAC;AACjC,OAAO,4BAA4B,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM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MobxLitElement } from '@adobe/lit-mobx';\nimport { customElement, state } from 'lit/decorators.js';\nimport { baseTheme, elementTheme } from '@digital-realty/theme';\nimport '@digital-realty/ix-icon-button/ix-icon-button.js';\nimport '@digital-realty/ix-date/ix-date.js';\nimport '@digital-realty/ix-divider/ix-divider.js';\nimport '@digital-realty/ix-icon';\nimport '@material/web/icon/icon.js';\nimport { format } from 'date-fns';\nimport { TWStyles } from '../../tw.js';\nimport { NotificationsState } from '../../state/NotificationState.js';\nimport { NotificationsStyle } from '../../styles/notifications-style.js';\nimport { DefaultDateFormat } from '../../constants/notifications.js';\nimport { FilterDialogEventDetail } from '../../constants/notification-types.js';\n\n@customElement('date-filters')\nexport class DateFilters extends MobxLitElement {\n static get styles() {\n return [NotificationsStyle, baseTheme, elementTheme, TWStyles];\n }\n\n @state() private fromDate? =\n format(NotificationsState.dateFilters.FROM_DATE!, DefaultDateFormat) ||\n undefined;\n\n @state() private toDate? =\n format(NotificationsState.dateFilters.TO_DATE!, DefaultDateFormat) ||\n undefined;\n\n @state() private maxDate = format(new Date(), DefaultDateFormat);\n\n @state() private fromDateErrorText? = '';\n\n @state() private toDateErrorText? = '';\n\n onFromDateChange(fromDate: string) {\n \n //handling of clear date event of calender\n if(fromDate === null || fromDate === \"\")\n this.fromDate = undefined;\n else\n {\n this.fromDate = fromDate; \n //clear error message \n if(this.fromDate !== undefined)\n this.fromDateErrorText = undefined;\n }\n \n }\n\n onToDateChange(toDate: string) {\n \n //handling of clear date event of calender\n if(toDate === null || toDate === \"\")\n this.toDate = undefined;\n else\n {\n this.toDate = toDate;\n //clear error message \n if(this.toDate !== undefined)\n this.toDateErrorText = undefined;\n }\n }\n\n onApplyDateFilter(selectedvalue: Boolean) { \n if(selectedvalue)\n {\n if (this.toDate === undefined && this.fromDate !== undefined) {\n this.toDateErrorText = \"Please select to date\";\n return;\n }\n\n if (this.fromDate === undefined && this.toDate !== undefined) {\n this.fromDateErrorText = \"Please select from date\";\n return;\n }\n\n if (this.fromDate! > this.toDate!) {\n this.fromDateErrorText = 'From date cannot be later than To date.';\n this.fromDate = undefined;\n return;\n } else {\n this.fromDateErrorText = undefined;\n }\n \n if (this.toDate! < this.fromDate!) {\n this.toDateErrorText = 'To date cannot be earlier than From date.';\n this.toDate = undefined;\n return;\n } else {\n this.toDateErrorText = undefined;\n }\n }\n\n const datesChanged = selectedvalue && this.toDateErrorText === undefined && this.fromDateErrorText === undefined; \n if (datesChanged) {\n NotificationsState.setNotificationDateFilter(this.fromDate, this.toDate);\n this.requestUpdate();\n }\n\n const event = new CustomEvent<FilterDialogEventDetail>('on-selection', {\n detail: { returnValue: datesChanged },\n bubbles: true,\n composed: true,\n });\n this.dispatchEvent(event);\n }\n\n clearDateFilters() {\n this.fromDate = undefined;\n this.toDate = undefined;\n this.fromDateErrorText = undefined;\n this.toDateErrorText = undefined;\n }\n\n /* eslint-disable lit-a11y/click-events-have-key-events */\n render() {\n return html` <div class=\"flex flex-col p-2\">\n <div class=\"flex flex-row text-justify\">\n <div class=\"grow items-center text-xl font-bold text-left p-2\">\n Filter by Date\n </div>\n <div\n class=\"flex flex-row items-center p-2\"\n @click=${this.clearDateFilters}\n >\n <label class=\"grow text-sm text-right pr-1 cursor-pointer\"\n >Cleare Filter</label\n >\n <ix-icon-button\n appearance=\"default\"\n icon=\"domain_verification_off\"\n class=\"blue-icon\"\n ></ix-icon-button>\n </div>\n </div>\n <ix-divider class=\"px-2\"></ix-divider>\n <div\n class=\"flex xl:flex-row lg:flex-col md:flex-col sm:flex-col justify-between item-center p-2\"\n >\n <div class=\"p-2\">\n <ix-date\n .value=${this.fromDate}\n max=${this.maxDate}\n label=\"From\"\n name=\"FromDate\"\n .errorText=${this.fromDateErrorText}\n .onChanged=${(e: any) => this.onFromDateChange(e)}\n >\n </ix-date>\n </div>\n <div class=\"p-2\">\n <ix-date\n .value=${this.toDate}\n max=${this.maxDate}\n label=\"To\"\n name=\"ToDate\"\n .errorText=${this.toDateErrorText}\n .onChanged=${(e: any) => this.onToDateChange(e)}\n ></ix-date>\n </div>\n </div>\n <div class=\"flex flex-row justify-between p-2\">\n <ix-button\n type=\"\"\n target=\"\"\n appearance=\"text\"\n @click=\"${() => this.onApplyDateFilter(false)}\"\n >Cancel</ix-button\n >\n <ix-button\n type=\"\"\n target=\"\"\n appearance=\"text\"\n @click=\"${() => this.onApplyDateFilter(true)}\"\n >Filter List</ix-button\n >\n </div>\n </div>`;\n }\n}\n"]}
1
+ {"version":3,"file":"date-filters.js","sourceRoot":"","sources":["../../../src/components/notifications/date-filters.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3B,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,kDAAkD,CAAC;AAC1D,OAAO,oCAAoC,CAAC;AAC5C,OAAO,0CAA0C,CAAC;AAClD,OAAO,yBAAyB,CAAC;AACjC,OAAO,4BAA4B,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AACzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAErE,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAG3D,IAAM,WAAW,GAAjB,MAAM,WAAY,SAAQ,cAAc;IAAxC;;QAKY,aAAQ,GAAI,CAAC,wBAAwB,CAAC,kBAAkB,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC,CAAC;YAChG,MAAM,CAAC,kBAAkB,CAAC,WAAW,CAAC,SAAU,EAAE,iB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G,SAAS,CAAC;QAC1B,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC;QACxB,IAAI,CAAC,iBAAiB,GAAG,SAAS,CAAC;QACnC,IAAI,CAAC,eAAe,GAAG,SAAS,CAAC;IACnC,CAAC;IAED,0DAA0D;IAC1D,MAAM;QACJ,OAAO,IAAI,CAAA;;;;;;;mBAOI,IAAI,CAAC,gBAAgB;;;;;;;;;;;;;;;;;;qBAkBnB,IAAI,CAAC,QAAQ;kBAChB,IAAI,CAAC,OAAO;;;yBAGL,IAAI,CAAC,iBAAiB;yBACtB,CAAC,CAAM,EAAE,EAAE,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC;;;;;;qBAMxC,IAAI,CAAC,MAAM;kBACd,IAAI,CAAC,OAAO;;;yBAGL,IAAI,CAAC,eAAe;yBACpB,CAAC,CAAM,EAAE,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC;;;;;;;;;oBASvC,GAAG,EAAE,CAAC,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC;;;;;;;oBAOnC,GAAG,EAAE,CAAC,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC;;;;WAI3C,CAAC;IACV,CAAC;CACF,CAAA;AA7JU;IAAR,KAAK,EAAE;6CAC0E;AAEzE;IAAR,KAAK,EAAE;2CACwE;AAEvE;IAAR,KAAK,EAAE;4CAAyD;AAExD;IAAR,KAAK,EAAE;sDAAiC;AAEhC;IAAR,KAAK,EAAE;oDAA+B;AAf5B,WAAW;IADvB,aAAa,CAAC,cAAc,CAAC;GACjB,WAAW,CAkKvB;SAlKY,WAAW","sourcesContent":["import { html } from 'lit';\nimport { MobxLitElement } from '@adobe/lit-mobx';\nimport { customElement, state } from 'lit/decorators.js';\nimport { baseTheme, elementTheme } from '@digital-realty/theme';\nimport '@digital-realty/ix-icon-button/ix-icon-button.js';\nimport '@digital-realty/ix-date/ix-date.js';\nimport '@digital-realty/ix-divider/ix-divider.js';\nimport '@digital-realty/ix-icon';\nimport '@material/web/icon/icon.js';\nimport { format } from 'date-fns';\nimport { TWStyles } from '../../tw.js';\nimport { NotificationsState } from '../../state/NotificationState.js';\nimport { NotificationsStyle } from '../../styles/notifications-style.js';\nimport { DefaultDateFormat } from '../../constants/notifications.js';\nimport { FilterDialogEventDetail } from '../../constants/notification-types.js';\nimport { isNullOrUndefinedOrEmpty } from '../../helper/common.js';\n\n@customElement('date-filters')\nexport class DateFilters extends MobxLitElement {\n static get styles() {\n return [NotificationsStyle, baseTheme, elementTheme, TWStyles];\n }\n\n @state() private fromDate? = !isNullOrUndefinedOrEmpty(NotificationsState.dateFilters.FROM_DATE) ?\n format(NotificationsState.dateFilters.FROM_DATE!, DefaultDateFormat) :undefined;\n\n @state() private toDate? = !isNullOrUndefinedOrEmpty(NotificationsState.dateFilters.TO_DATE) ?\n format(NotificationsState.dateFilters.TO_DATE!, DefaultDateFormat) :undefined;\n\n @state() private maxDate = format(new Date(), DefaultDateFormat);\n\n @state() private fromDateErrorText? = '';\n\n @state() private toDateErrorText? = '';\n\n onFromDateChange(fromDate: string) {\n \n //handling of clear date event of calender\n if(fromDate === null || fromDate === \"\")\n this.fromDate = undefined;\n else\n {\n this.fromDate = fromDate; \n //clear error message \n if(this.fromDate !== undefined)\n this.fromDateErrorText = undefined;\n }\n \n }\n\n onToDateChange(toDate: string) {\n \n //handling of clear date event of calender\n if(toDate === null || toDate === \"\")\n this.toDate = undefined;\n else\n {\n this.toDate = toDate;\n //clear error message \n if(this.toDate !== undefined)\n this.toDateErrorText = undefined;\n }\n }\n\n onApplyDateFilter(selectedvalue: Boolean) { \n if(selectedvalue)\n {\n if (this.toDate === undefined && this.fromDate !== undefined) {\n this.toDateErrorText = \"Please select to date\";\n return;\n }\n\n if (this.fromDate === undefined && this.toDate !== undefined) {\n this.fromDateErrorText = \"Please select from date\";\n return;\n }\n\n if (this.fromDate! > this.toDate!) {\n this.fromDateErrorText = 'From date cannot be later than To date.';\n this.fromDate = undefined;\n return;\n } else {\n this.fromDateErrorText = undefined;\n }\n \n if (this.toDate! < this.fromDate!) {\n this.toDateErrorText = 'To date cannot be earlier than From date.';\n this.toDate = undefined;\n return;\n } else {\n this.toDateErrorText = undefined;\n }\n }\n\n const datesChanged = selectedvalue && this.toDateErrorText === undefined && this.fromDateErrorText === undefined; \n if (datesChanged) {\n NotificationsState.setNotificationDateFilter(this.fromDate, this.toDate);\n this.requestUpdate();\n }\n\n const event = new CustomEvent<FilterDialogEventDetail>('on-selection', {\n detail: { returnValue: datesChanged },\n bubbles: true,\n composed: true,\n });\n this.dispatchEvent(event);\n }\n\n clearDateFilters() {\n this.fromDate = undefined;\n this.toDate = undefined;\n this.fromDateErrorText = undefined;\n this.toDateErrorText = undefined;\n }\n\n /* eslint-disable lit-a11y/click-events-have-key-events */\n render() {\n return html` <div class=\"flex flex-col p-2\">\n <div class=\"flex flex-row text-justify\">\n <div class=\"grow items-center text-xl font-bold text-left p-2\">\n Filter by Date\n </div>\n <div\n class=\"flex flex-row items-center p-2\"\n @click=${this.clearDateFilters}\n >\n <label class=\"grow text-sm text-right pr-1 cursor-pointer\"\n >Clear Filter</label\n >\n <ix-icon-button\n appearance=\"default\"\n icon=\"domain_verification_off\"\n class=\"blue-icon\"\n ></ix-icon-button>\n </div>\n </div>\n <ix-divider class=\"px-2\"></ix-divider>\n <div\n class=\"flex xl:flex-row lg:flex-col md:flex-col sm:flex-col justify-between item-center p-2\"\n >\n <div class=\"p-2\">\n <ix-date\n .value=${this.fromDate}\n max=${this.maxDate}\n label=\"From\"\n name=\"FromDate\"\n .errorText=${this.fromDateErrorText}\n .onChanged=${(e: any) => this.onFromDateChange(e)}\n >\n </ix-date>\n </div>\n <div class=\"p-2\">\n <ix-date\n .value=${this.toDate}\n max=${this.maxDate}\n label=\"To\"\n name=\"ToDate\"\n .errorText=${this.toDateErrorText}\n .onChanged=${(e: any) => this.onToDateChange(e)}\n ></ix-date>\n </div>\n </div>\n <div class=\"flex flex-row justify-between p-2\">\n <ix-button\n type=\"\"\n target=\"\"\n appearance=\"text\"\n @click=\"${() => this.onApplyDateFilter(false)}\"\n >Cancel</ix-button\n >\n <ix-button\n type=\"\"\n target=\"\"\n appearance=\"text\"\n @click=\"${() => this.onApplyDateFilter(true)}\"\n >Filter List</ix-button\n >\n </div>\n </div>`;\n }\n}\n"]}
@@ -42,7 +42,7 @@ let GroupFilters = class GroupFilters extends MobxLitElement {
42
42
  <div class="ix-switch-wrapper">
43
43
  <ix-switch
44
44
  name=${NotificationGroups.PLANNED_MAINTENANCE}
45
- selected=${NotificationsState.notificationFilters
45
+ .selected=${NotificationsState.notificationFilters
46
46
  .SHOW_PLANNED_MAINTENANCE}
47
47
  @change=${this.onSwitchChange}
48
48
  ></ix-switch>
@@ -51,7 +51,7 @@ let GroupFilters = class GroupFilters extends MobxLitElement {
51
51
  <div class="ix-switch-wrapper">
52
52
  <ix-switch
53
53
  name=${NotificationGroups.SERVICE_TICKETS}
54
- selected=${NotificationsState.notificationFilters
54
+ .selected=${NotificationsState.notificationFilters
55
55
  .SHOW_SERVICE_TICKETS}
56
56
  @change=${this.onSwitchChange}
57
57
  ></ix-switch>
@@ -60,7 +60,7 @@ let GroupFilters = class GroupFilters extends MobxLitElement {
60
60
  <div class="ix-switch-wrapper">
61
61
  <ix-switch
62
62
  name=${NotificationGroups.DCIM_ALERTS}
63
- selected=${NotificationsState.notificationFilters.SHOW_DCIM_ALERTS}
63
+ .selected=${NotificationsState.notificationFilters.SHOW_DCIM_ALERTS}
64
64
  @change=${this.onSwitchChange}
65
65
  ></ix-switch>
66
66
  <label class="pl-1">${NotificationGroups.DCIM_ALERTS}</label>
@@ -1 +1 @@
1
- {"version":3,"file":"group-filters.js","sourceRoot":"","sources":["../../../src/components/notifications/group-filters.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAA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CAAA;AA7DY,YAAY;IADxB,aAAa,CAAC,eAAe,CAAC;GAClB,YAAY,CA6DxB;SA7DY,YAAY","sourcesContent":["import { html, css } from 'lit';\nimport { MobxLitElement } from '@adobe/lit-mobx';\nimport { customElement } from 'lit/decorators.js';\nimport '@digital-realty/ix-icon-button/ix-icon-button.js';\nimport '@digital-realty/ix-switch/ix-switch.js';\nimport { TWStyles } from '../../tw.js';\nimport { NotificationsState } from '../../state/NotificationState.js';\nimport { NotificationGroups } from '../../constants/notifications.js';\nimport { NotificationsStyle } from '../../styles/notifications-style.js';\n\n@customElement('group-filters')\nexport class GroupFilters extends MobxLitElement {\n static get styles() {\n return [\n NotificationsStyle,\n TWStyles,\n css`\n :host {\n --md-switch-state-layer-size: 1rem;\n --md-switch-hover-handle-width: 1rem;\n --md-switch-hover-handle-height: 1rem;\n --md-switch-pressed-handle-width: 1rem;\n --md-switch-pressed-handle-height: 1rem;\n --md-switch-selected-handle-width: 1.3rem;\n --md-switch-selected-handle-height: 1.3rem;\n --md-switch-handle-width: 0.5rem;\n --md-switch-handle-height: 0.5rem;\n --md-switch-track-width: 2.5rem;\n --md-switch-track-height: 1rem;\n }\n `,\n ];\n }\n\n onSwitchChange(e: Event) {\n const target = e.target as any;\n const groupName = target.attributes.getNamedItem('name')?.value;\n\n NotificationsState.setNotificationFilter(groupName, target.selected);\n this.requestUpdate();\n }\n\n render() {\n return html` <div class=\"flex flex-col items-start p-2\">\n <div class=\"ix-switch-wrapper\">\n <ix-switch\n name=${NotificationGroups.PLANNED_MAINTENANCE}\n selected=${NotificationsState.notificationFilters\n .SHOW_PLANNED_MAINTENANCE}\n @change=${this.onSwitchChange}\n ></ix-switch>\n <label class=\"pl-1\">${NotificationGroups.PLANNED_MAINTENANCE}</label>\n </div>\n <div class=\"ix-switch-wrapper\">\n <ix-switch\n name=${NotificationGroups.SERVICE_TICKETS}\n selected=${NotificationsState.notificationFilters\n .SHOW_SERVICE_TICKETS}\n @change=${this.onSwitchChange}\n ></ix-switch>\n <label class=\"pl-1\">${NotificationGroups.SERVICE_TICKETS}</label>\n </div>\n <div class=\"ix-switch-wrapper\">\n <ix-switch\n name=${NotificationGroups.DCIM_ALERTS}\n selected=${NotificationsState.notificationFilters.SHOW_DCIM_ALERTS}\n @change=${this.onSwitchChange}\n ></ix-switch>\n <label class=\"pl-1\">${NotificationGroups.DCIM_ALERTS}</label>\n </div>\n </div>`;\n }\n}\n"]}
1
+ {"version":3,"file":"group-filters.js","sourceRoot":"","sources":["../../../src/components/notifications/group-filters.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,kDAAkD,CAAC;AAC1D,OAAO,wCAAwC,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AAGlE,IAAM,YAAY,GAAlB,MAAM,YAAa,SAAQ,cAAc;IAC9C,MAAM,KAAK,MAAM;QACf,OAAO;YACL,kBAAkB;YAClB,QAAQ;YACR,GAAG,CAAA;;;;;;;;;;;;;;OAcF;SACF,CAAC;IACJ,CAAC;IAED,cAAc,CAAC,CAAQ;;QACrB,MAAM,MAAM,GAAG,CAAC,CAAC,MAAa,CAAC;QAC/B,MAAM,SAAS,GAAG,MAAA,MAAM,CAAC,UAAU,CAAC,YAAY,CAAC,MAAM,CAAC,0CAAE,KAAK,CAAC;QAEhE,kBAAkB,CAAC,qBAAqB,CAAC,SAAS,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC;QACrE,IAAI,CAAC,aAAa,EAAE,CAAC;IACvB,CAAC;IAED,MAAM;QACJ,OAAO,IAAI,CAAA;;;iBAGE,kBAAkB,CAAC,mBAAmB;sBACjC,kBAAkB,CAAC,mBAAmB;aAC/C,wBAAwB;oBACjB,IAAI,CAAC,cAAc;;8BAET,kBAAkB,CAAC,mBAAmB;;;;iBAInD,kBAAkB,CAAC,eAAe;sBAC7B,kBAAkB,CAAC,mBAAmB;aAC/C,oBAAoB;oBACb,IAAI,CAAC,cAAc;;8BAET,kBAAkB,CAAC,eAAe;;;;iBAI/C,kBAAkB,CAAC,WAAW;sBACzB,kBAAkB,CAAC,mBAAmB,CAAC,gBAAgB;oBACzD,IAAI,CAAC,cAAc;;8BAET,kBAAkB,CAAC,WAAW;;WAEjD,CAAC;IACV,CAAC;CACF,CAAA;AA7DY,YAAY;IADxB,aAAa,CAAC,eAAe,CAAC;GAClB,YAAY,CA6DxB;SA7DY,YAAY","sourcesContent":["import { html, css } from 'lit';\nimport { MobxLitElement } from '@adobe/lit-mobx';\nimport { customElement } from 'lit/decorators.js';\nimport '@digital-realty/ix-icon-button/ix-icon-button.js';\nimport '@digital-realty/ix-switch/ix-switch.js';\nimport { TWStyles } from '../../tw.js';\nimport { NotificationsState } from '../../state/NotificationState.js';\nimport { NotificationGroups } from '../../constants/notifications.js';\nimport { NotificationsStyle } from '../../styles/notifications-style.js';\n\n@customElement('group-filters')\nexport class GroupFilters extends MobxLitElement {\n static get styles() {\n return [\n NotificationsStyle,\n TWStyles,\n css`\n :host {\n --md-switch-state-layer-size: 1rem;\n --md-switch-hover-handle-width: 1rem;\n --md-switch-hover-handle-height: 1rem;\n --md-switch-pressed-handle-width: 1rem;\n --md-switch-pressed-handle-height: 1rem;\n --md-switch-selected-handle-width: 1.3rem;\n --md-switch-selected-handle-height: 1.3rem;\n --md-switch-handle-width: 0.5rem;\n --md-switch-handle-height: 0.5rem;\n --md-switch-track-width: 2.5rem;\n --md-switch-track-height: 1rem;\n }\n `,\n ];\n }\n\n onSwitchChange(e: Event) {\n const target = e.target as any;\n const groupName = target.attributes.getNamedItem('name')?.value;\n\n NotificationsState.setNotificationFilter(groupName, target.selected);\n this.requestUpdate();\n }\n\n render() {\n return html` <div class=\"flex flex-col items-start p-2\">\n <div class=\"ix-switch-wrapper\">\n <ix-switch\n name=${NotificationGroups.PLANNED_MAINTENANCE}\n .selected=${NotificationsState.notificationFilters\n .SHOW_PLANNED_MAINTENANCE}\n @change=${this.onSwitchChange}\n ></ix-switch>\n <label class=\"pl-1\">${NotificationGroups.PLANNED_MAINTENANCE}</label>\n </div>\n <div class=\"ix-switch-wrapper\">\n <ix-switch\n name=${NotificationGroups.SERVICE_TICKETS}\n .selected=${NotificationsState.notificationFilters\n .SHOW_SERVICE_TICKETS}\n @change=${this.onSwitchChange}\n ></ix-switch>\n <label class=\"pl-1\">${NotificationGroups.SERVICE_TICKETS}</label>\n </div>\n <div class=\"ix-switch-wrapper\">\n <ix-switch\n name=${NotificationGroups.DCIM_ALERTS}\n .selected=${NotificationsState.notificationFilters.SHOW_DCIM_ALERTS}\n @change=${this.onSwitchChange}\n ></ix-switch>\n <label class=\"pl-1\">${NotificationGroups.DCIM_ALERTS}</label>\n </div>\n </div>`;\n }\n}\n"]}
@@ -48,41 +48,43 @@ let ViewItemDialog = class ViewItemDialog extends MobxLitElement {
48
48
  render() {
49
49
  return html ` <ix-dialog
50
50
  ?open=${this.open}
51
- class="w-[480px]"
51
+ class="w-[420px]"
52
52
  @closed=${this.dialogClosed}
53
53
  >
54
- <div class="flex flex-col px-16" slot="headline">
55
- <label class="text-xl font-bold w-[480px] py-2">
56
- ${this.notificaiton.resourceType}
57
- </label>
58
- <label class="text-sm font-bold w-[480px] py-2">
59
- ${this.notificaiton.subGroup}
60
- </label>
54
+ <div slot="headline" class="px-8">
55
+ <div class="flex flex-col flex-start">
56
+ <div class="text-xl font-bold py-2 text-balance">
57
+ ${this.notificaiton.resourceType}
58
+ </div>
59
+ <div class="text-sm font-bold py-2 text-balance">
60
+ ${this.notificaiton.subGroup}
61
+ </div>
62
+ </div>
61
63
  </div>
62
64
  <form
63
- class="w-[480px] px-16"
65
+ class="px-8"
64
66
  slot="content"
65
67
  id="form-id"
66
68
  method="dialog"
67
69
  >
68
70
  <div class="flex flex-row py-1">
69
- <div class="py-1 w-[100px]">Subject</div>
70
- <div class="grow py-1 pl-11 font-semibold">
71
+ <div class="w-[100px] block">Subject</div>
72
+ <div class="w-[280px] font-semibold text-wrap flex flex-start">
71
73
  ${this.notificaiton.subject}
72
74
  </div>
73
75
  </div>
74
76
  <div class="flex flex-row py-1">
75
- <div class="py-1 w-[100px]">Create Date</div>
76
- <div class="grow py-1 pl-11 font-semibold">
77
+ <div class="w-[100px] block">Create Date</div>
78
+ <div class="w-[280px] font-semibold flex">
77
79
  ${format(this.notificaiton.createdAt, 'dd/MM/yyyy HH:mm:ss')}
78
80
  </div>
79
81
  </div>
80
82
  <div class="flex flex-row py-1">
81
- <div class="py-1 w-[100px]">Site</div>
82
- <div class="grow py-1 pl-11 font-semibold">${this.getLocation()}</div>
83
+ <div class="w-[100px] block">Site</div>
84
+ <div class="font-semibold">${this.getLocation()}</div>
83
85
  </div>
84
86
  </form>
85
- <div slot="actions" class="flex flex-row flex-end px-16 py-8">
87
+ <div slot="actions" class="flex flex-row flex-end px-8 py-8">
86
88
  <button form="form-id" class="modal-text-blue">CLOSE</button>
87
89
  <a href=${this.getUrl()} class="modal-text-blue">VIEW RECORD</a>
88
90
  </div>
@@ -1 +1 @@
1
- {"version":3,"file":"view-item-dialog.js","sourceRoot":"","sources":["../../../src/components/notifications/view-item-dialog.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3B,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,kDAAkD,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC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AS,CAAC,MAAM,GAAG,CAAC,EAAE;YAC1C,OAAO,oBAAoB,CAAC;SAC7B;QACD,OAAO,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;IACxC,CAAC;IAMD,MAAM;QACJ,OAAO,IAAI,CAAA;cACD,IAAI,CAAC,IAAI;;gBAEP,IAAI,CAAC,YAAY;;;;YAIrB,IAAI,CAAC,YAAY,CAAC,YAAY;;;YAG9B,IAAI,CAAC,YAAY,CAAC,QAAQ;;;;;;;;;;;;cAYxB,IAAI,CAAC,YAAY,CAAC,OAAO;;;;;;cAMzB,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,SAAS,EAAE,qBAAqB,CAAC;;;;;uDAKjB,IAAI,CAAC,WAAW,EAAE;;;;;kBAKvD,IAAI,CAAC,MAAM,EAAE;;iBAEd,CAAC;IAChB,CAAC;CACF,CAAA;AAlF+C;IAA7C,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;oDACxB;AAEyB;IAA7C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;4CAAc;AARhD,cAAc;IAD1B,aAAa,CAAC,kBAAkB,CAAC;GACrB,cAAc,CAuF1B;SAvFY,cAAc","sourcesContent":["import { html } from 'lit';\nimport { MobxLitElement } from '@adobe/lit-mobx';\nimport { customElement, property } from 'lit/decorators.js';\nimport '@digital-realty/ix-icon-button/ix-icon-button.js';\nimport { elementTheme } from '@digital-realty/theme';\nimport { format } from 'date-fns';\nimport { TWStyles } from '../../tw.js';\nimport { Notification } from '../../models/notification.js';\nimport { NotificationGroups } from '../../constants/notifications.js';\nimport { NotificationsStyle } from '../../styles/notifications-style.js';\n\n@customElement('view-item-dialog')\nexport class ViewItemDialog extends MobxLitElement {\n static get styles() {\n return [NotificationsStyle, elementTheme, TWStyles];\n }\n\n @property({ type: Object, attribute: false }) notificaiton =\n {} as Notification;\n\n @property({ type: Boolean, attribute: true }) open = false;\n\n getUrl(): string {\n const ticketid = this.notificaiton.id;\n\n switch (this.notificaiton.resourceType) {\n case NotificationGroups.PLANNED_MAINTENANCE:\n return `/service-management/planned-maintenance/${ticketid}`;\n case NotificationGroups.SERVICE_TICKETS:\n return `/service-management/service-tickets/${ticketid}`;\n case NotificationGroups.INCIDENTS:\n return `/service-management/incidents/${ticketid}`;\n case NotificationGroups.DCIM_ALERTS:\n return `/dcim/${ticketid}`;\n default:\n return '';\n }\n }\n\n getLocation() {\n if (\n this.notificaiton.locations === undefined ||\n this.notificaiton.locations.length < 1\n ) {\n return '';\n }\n if (this.notificaiton.locations.length > 1) {\n return 'Multiple Locations';\n }\n return this.notificaiton.locations[0];\n }\n\n dialogClosed = () => {\n this.dispatchEvent(new CustomEvent('view-item-dialog-closed'));\n };\n\n render() {\n return html` <ix-dialog\n ?open=${this.open}\n class=\"w-[480px]\"\n @closed=${this.dialogClosed}\n >\n <div class=\"flex flex-col px-16\" slot=\"headline\">\n <label class=\"text-xl font-bold w-[480px] py-2\">\n ${this.notificaiton.resourceType}\n </label>\n <label class=\"text-sm font-bold w-[480px] py-2\">\n ${this.notificaiton.subGroup}\n </label>\n </div>\n <form\n class=\"w-[480px] px-16\"\n slot=\"content\"\n id=\"form-id\"\n method=\"dialog\"\n >\n <div class=\"flex flex-row py-1\">\n <div class=\"py-1 w-[100px]\">Subject</div>\n <div class=\"grow py-1 pl-11 font-semibold\">\n ${this.notificaiton.subject}\n </div>\n </div>\n <div class=\"flex flex-row py-1\">\n <div class=\"py-1 w-[100px]\">Create Date</div>\n <div class=\"grow py-1 pl-11 font-semibold\">\n ${format(this.notificaiton.createdAt, 'dd/MM/yyyy HH:mm:ss')}\n </div>\n </div>\n <div class=\"flex flex-row py-1\">\n <div class=\"py-1 w-[100px]\">Site</div>\n <div class=\"grow py-1 pl-11 font-semibold\">${this.getLocation()}</div>\n </div>\n </form>\n <div slot=\"actions\" class=\"flex flex-row flex-end px-16 py-8\">\n <button form=\"form-id\" class=\"modal-text-blue\">CLOSE</button>\n <a href=${this.getUrl()} class=\"modal-text-blue\">VIEW RECORD</a>\n </div>\n </ix-dialog>`;\n }\n}\n"]}
1
+ {"version":3,"file":"view-item-dialog.js","sourceRoot":"","sources":["../../../src/components/notifications/view-item-dialog.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3B,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,kDAAkD,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AAGlE,IAAM,cAAc,GAApB,MAAM,cAAe,SAAQ,cAAc;IAA3C;;QAKyC,iBAAY,GACxD,EAAkB,CAAC;QAEyB,SAAI,GAAG,KAAK,CAAC;QAgC3D,iBAAY,GAAG,GAAG,EAAE;YAClB,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,yBAAyB,CAAC,CAAC,CAAC;QACjE,CAAC,CAAC;IA+CJ,CAAC;IAxFC,MAAM,KAAK,MAAM;QACf,OAAO,CAAC,kBAAkB,EAAE,YAAY,EAAE,QAAQ,CAAC,CAAC;IACtD,CAAC;IAOD,MAAM;QACJ,MAAM,QAAQ,GAAG,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC;QAEtC,QAAQ,IAAI,CAAC,YAAY,CAAC,YAAY,EAAE;YACtC,KAAK,kBAAkB,CAAC,mBAAmB;gBACzC,OAAO,2CAA2C,QAAQ,EAAE,CAAC;Y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AC,kBAAkB,CAAC;GACrB,cAAc,CAyF1B;SAzFY,cAAc","sourcesContent":["import { html } from 'lit';\nimport { MobxLitElement } from '@adobe/lit-mobx';\nimport { customElement, property } from 'lit/decorators.js';\nimport '@digital-realty/ix-icon-button/ix-icon-button.js';\nimport { elementTheme } from '@digital-realty/theme';\nimport { format } from 'date-fns';\nimport { TWStyles } from '../../tw.js';\nimport { Notification } from '../../models/notification.js';\nimport { NotificationGroups } from '../../constants/notifications.js';\nimport { NotificationsStyle } from '../../styles/notifications-style.js';\n\n@customElement('view-item-dialog')\nexport class ViewItemDialog extends MobxLitElement {\n static get styles() {\n return [NotificationsStyle, elementTheme, TWStyles];\n }\n\n @property({ type: Object, attribute: false }) notificaiton =\n {} as Notification;\n\n @property({ type: Boolean, attribute: true }) open = false;\n\n getUrl(): string {\n const ticketid = this.notificaiton.id;\n\n switch (this.notificaiton.resourceType) {\n case NotificationGroups.PLANNED_MAINTENANCE:\n return `/service-management/planned-maintenance/${ticketid}`;\n case NotificationGroups.SERVICE_TICKETS:\n return `/service-management/service-tickets/${ticketid}`;\n case NotificationGroups.INCIDENTS:\n return `/service-management/incidents/${ticketid}`;\n case NotificationGroups.DCIM_ALERTS:\n return `/dcim/${ticketid}`;\n default:\n return '';\n }\n }\n\n getLocation() {\n if (\n this.notificaiton.locations === undefined ||\n this.notificaiton.locations.length < 1\n ) {\n return '';\n }\n if (this.notificaiton.locations.length > 1) {\n return 'Multiple Locations';\n }\n return this.notificaiton.locations[0];\n }\n\n dialogClosed = () => {\n this.dispatchEvent(new CustomEvent('view-item-dialog-closed'));\n };\n\n render() {\n return html` <ix-dialog\n ?open=${this.open}\n class=\"w-[420px]\"\n @closed=${this.dialogClosed}\n >\n <div slot=\"headline\" class=\"px-8\">\n <div class=\"flex flex-col flex-start\">\n <div class=\"text-xl font-bold py-2 text-balance\">\n ${this.notificaiton.resourceType}\n </div>\n <div class=\"text-sm font-bold py-2 text-balance\">\n ${this.notificaiton.subGroup}\n </div>\n </div>\n </div>\n <form\n class=\"px-8\"\n slot=\"content\"\n id=\"form-id\"\n method=\"dialog\"\n >\n <div class=\"flex flex-row py-1\">\n <div class=\"w-[100px] block\">Subject</div>\n <div class=\"w-[280px] font-semibold text-wrap flex flex-start\">\n ${this.notificaiton.subject}\n </div>\n </div>\n <div class=\"flex flex-row py-1\">\n <div class=\"w-[100px] block\">Create Date</div>\n <div class=\"w-[280px] font-semibold flex\">\n ${format(this.notificaiton.createdAt, 'dd/MM/yyyy HH:mm:ss')}\n </div>\n </div>\n <div class=\"flex flex-row py-1\">\n <div class=\"w-[100px] block\">Site</div>\n <div class=\"font-semibold\">${this.getLocation()}</div>\n </div>\n </form>\n <div slot=\"actions\" class=\"flex flex-row flex-end px-8 py-8\">\n <button form=\"form-id\" class=\"modal-text-blue\">CLOSE</button>\n <a href=${this.getUrl()} class=\"modal-text-blue\">VIEW RECORD</a>\n </div>\n </ix-dialog>`;\n }\n}\n"]}
@@ -0,0 +1 @@
1
+ export declare const isNullOrUndefinedOrEmpty: (value: string | Date | undefined | null) => Boolean;
@@ -0,0 +1,11 @@
1
+ export const isNullOrUndefinedOrEmpty = (value) => {
2
+ if (value === null)
3
+ return true;
4
+ else if (value === undefined)
5
+ return true;
6
+ else if (value === "")
7
+ return true;
8
+ else
9
+ return false;
10
+ };
11
+ //# sourceMappingURL=common.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/helper/common.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,KAAwC,EAAY,EAAE;IAC3F,IAAG,KAAK,KAAK,IAAI;QACb,OAAO,IAAI,CAAC;SACX,IAAG,KAAK,KAAK,SAAS;QACvB,OAAO,IAAI,CAAC;SACX,IAAG,KAAM,KAAK,EAAE;QACjB,OAAO,IAAI,CAAC;;QAEZ,OAAO,KAAK,CAAC;AACnB,CAAC,CAAC","sourcesContent":["export const isNullOrUndefinedOrEmpty = (value : string | Date | undefined | null) : Boolean => {\n if(value === null)\n return true;\n else if(value === undefined)\n return true;\n else if(value! === \"\")\n return true;\n else\n return false;\n };"]}