@digital-realty/ix-notifications 1.0.12 → 1.0.13

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.
@@ -30,6 +30,7 @@ export declare class IxNotifications extends MobxLitElement {
30
30
  renderUnReadCountText(): import("lit").TemplateResult<1>;
31
31
  markAllread(): void;
32
32
  private confirmedMarkAllRead;
33
+ private showResultMessage;
33
34
  toggleGroupView(): void;
34
35
  displayFilters(): void;
35
36
  applyNotificationFilters(): Notification[];
@@ -9,7 +9,7 @@ import '@digital-realty/ix-drawer/ix-drawer.js';
9
9
  import '@digital-realty/ix-icon';
10
10
  import '@material/web/icon/icon.js';
11
11
  import { NotificationsState } from './state/NotificationState.js';
12
- import { NotificationGroups, NotificationStatus, } from './constants/notifications.js';
12
+ import { ApiCallState, NotificationGroups, NotificationStatus, } from './constants/notifications.js';
13
13
  import './components/notifications/notification-item.js';
14
14
  import './components/notifications/grouped-item.js';
15
15
  import './components/notifications/group-filters.js';
@@ -73,14 +73,40 @@ export class IxNotifications extends MobxLitElement {
73
73
  // Mark All read if Confirmed True
74
74
  if (e.detail.returnValue) {
75
75
  const filterNotification = this.applyNotificationFilters();
76
- filterNotification === null || filterNotification === void 0 ? void 0 : filterNotification.forEach(item => {
77
- if (item.status === NotificationStatus.UNREAD)
78
- NotificationsState.setNotificationReadStatus(item.id);
79
- });
80
- this.renderUnReadCountText();
76
+ const unreadItems = filterNotification === null || filterNotification === void 0 ? void 0 : filterNotification.filter(item => item.status === NotificationStatus.UNREAD);
77
+ if (unreadItems.length > 0) {
78
+ let allResultSuccesful = true;
79
+ filterNotification === null || filterNotification === void 0 ? void 0 : filterNotification.forEach(item => {
80
+ NotificationsState.setNotificationReadStatus(item.id).then((result) => {
81
+ if (allResultSuccesful)
82
+ allResultSuccesful = result;
83
+ });
84
+ });
85
+ 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"
87
+ };
88
+ this.showResultMessage(apiResult, unreadItems[0].id);
89
+ this.renderUnReadCountText();
90
+ this.requestUpdate();
91
+ }
81
92
  }
82
93
  this.showMarkAllReadConfirmation = false;
83
94
  }
95
+ showResultMessage(result, id) {
96
+ window.dispatchEvent(new CustomEvent("add-toast", { detail: {
97
+ id,
98
+ content: html `
99
+ <ix-message-toast toastId=${id} .TMessageToast=${result.State.toLowerCase()} forceClose>
100
+ ${result.Message}
101
+ </ix-message-toast>`,
102
+ autoClose: 3000,
103
+ durationOut: 3000,
104
+ vertical: 'bottom',
105
+ horizontal: 'center',
106
+ animated: true,
107
+ above: false,
108
+ } }));
109
+ }
84
110
  toggleGroupView() {
85
111
  this.showGroupedView = !this.showGroupedView;
86
112
  }
@@ -99,9 +125,13 @@ export class IxNotifications extends MobxLitElement {
99
125
  (x.resourceType === NotificationGroups.DCIM_ALERTS &&
100
126
  NotificationsState.notificationFilters.SHOW_DCIM_ALERTS === true) ||
101
127
  x.resourceType === NotificationGroups.INCIDENTS); // Always display incidents
102
- if (NotificationsState.dateFilters.FROM_DATE === undefined ||
128
+ if (NotificationsState.dateFilters.FROM_DATE === undefined &&
103
129
  NotificationsState.dateFilters.TO_DATE === undefined)
104
130
  return filterredNotifications;
131
+ if (NotificationsState.dateFilters.FROM_DATE === undefined)
132
+ return filterredNotifications.filter(x => differenceInDays(new Date(x.createdAt), NotificationsState.dateFilters.TO_DATE) <= 0);
133
+ if (NotificationsState.dateFilters.TO_DATE === undefined)
134
+ return filterredNotifications.filter(x => differenceInHours(new Date(x.createdAt), NotificationsState.dateFilters.FROM_DATE) >= 0);
105
135
  return filterredNotifications.filter(x => differenceInHours(new Date(x.createdAt), NotificationsState.dateFilters.FROM_DATE) >= 0 &&
106
136
  differenceInDays(new Date(x.createdAt), NotificationsState.dateFilters.TO_DATE) <= 0);
107
137
  }
@@ -110,7 +140,7 @@ export class IxNotifications extends MobxLitElement {
110
140
  }
111
141
  renderGroupedView() {
112
142
  const filteredNotifications = this.applyNotificationFilters();
113
- return html `<div>
143
+ return html `<div style="margin:0px">
114
144
  <grouped-item
115
145
  groupTitle=${NotificationGroups.PLANNED_MAINTENANCE}
116
146
  iconName="lab_profile"
@@ -130,7 +160,7 @@ export class IxNotifications extends MobxLitElement {
130
160
  groupTitle=${NotificationGroups.DCIM_ALERTS}
131
161
  iconName="public"
132
162
  .childItems=${filteredNotifications === null || filteredNotifications === void 0 ? void 0 : filteredNotifications.filter(item => item.resourceType === NotificationGroups.DCIM_ALERTS)}
133
- ></grouped-item>
163
+ ></grouped-item>
134
164
  </div>`;
135
165
  }
136
166
  renderDefaultView() {
@@ -264,7 +294,7 @@ export class IxNotifications extends MobxLitElement {
264
294
  ${this.showGroupedView
265
295
  ? this.renderGroupedView()
266
296
  : this.renderDefaultView()}
267
- </div>
297
+ </div>
268
298
  </ix-drawer>
269
299
  `;
270
300
  }
@@ -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;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,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,8BAA8B,CAAC;AACtC,OAAO,iDAAiD,CAAC;AACzD,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;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 { Notification } from './models/notification.js';\nimport {\n ConfirmationDialogEventDetail,\n FilterDialogEventDetail,\n} from './constants/notification-types.js';\nimport {\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\n filterNotification?.forEach(item => {\n if (item.status === NotificationStatus.UNREAD)\n NotificationsState.setNotificationReadStatus(item.id);\n });\n\n this.renderUnReadCountText();\n }\n\n this.showMarkAllReadConfirmation = false;\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 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>\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,iBA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EAAE,CAAC,IAAI,CAAC,YAAY,EAAE;;;6BAGhB,IAAI,CAAC,mBAAmB;iBACpC,IAAI,CAAC,sBAAsB;;;;;;uBAMrB,IAAI,CAAC,WAAW;;;;;uBAKhB,IAAI,CAAC,eAAe;;;;;uBAKpB,IAAI,CAAC,cAAc;;;;;;gDAMM,IAAI,CAAC,WAAW;YAChD,CAAC,CAAC,aAAa;YACf,CAAC,CAAC,EAAE;;;;;uBAKG,IAAI,CAAC,kBAAkB;;;;;;mDAMK,IAAI,CAAC,eAAe;YACvD,CAAC,CAAC,aAAa;YACf,CAAC,CAAC,EAAE;8BACU,IAAI,CAAC,gBAAgB;;;;;;;YAOvC,IAAI,CAAC,eAAe;YACpB,CAAC,CAAC,IAAI,CAAC,iBAAiB,EAAE;YAC1B,CAAC,CAAC,IAAI,CAAC,iBAAiB,EAAE;;;KAGjC,CAAC;IACJ,CAAC;;AA9XM,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 }\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"]}
@@ -10,7 +10,7 @@
10
10
  * Do not edit the class manually.
11
11
  */
12
12
  import * as runtime from '../runtime';
13
- import type { GetNotifications200Response, Notification, NotificationDelete, NotificationPatch, NotificationRequest, Status } from '../models/index';
13
+ import type { GetNotifications200Response, Notification, NotificationPatch, NotificationRequest, Status } from '../models/index';
14
14
  export interface CreateNotificationRequest {
15
15
  notificationRequest?: NotificationRequest;
16
16
  }
@@ -51,11 +51,11 @@ export declare class NotificationsApi extends runtime.BaseAPI {
51
51
  /**
52
52
  * Delete a notification by id
53
53
  */
54
- deleteNotificationsByIdRaw(requestParameters: DeleteNotificationsByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<NotificationDelete>>;
54
+ deleteNotificationsByIdRaw(requestParameters: DeleteNotificationsByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>>;
55
55
  /**
56
56
  * Delete a notification by id
57
57
  */
58
- deleteNotificationsById(requestParameters: DeleteNotificationsByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<NotificationDelete>;
58
+ deleteNotificationsById(requestParameters: DeleteNotificationsByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void>;
59
59
  /**
60
60
  * Get all notifications
61
61
  */
@@ -12,7 +12,7 @@
12
12
  * Do not edit the class manually.
13
13
  */
14
14
  import * as runtime from '../runtime';
15
- import { GetNotifications200ResponseFromJSON, NotificationFromJSON, NotificationDeleteFromJSON, NotificationPatchFromJSON, NotificationPatchToJSON, NotificationRequestToJSON, } from '../models/index';
15
+ import { GetNotifications200ResponseFromJSON, NotificationFromJSON, NotificationPatchFromJSON, NotificationPatchToJSON, NotificationRequestToJSON, } from '../models/index';
16
16
  /**
17
17
  *
18
18
  */
@@ -69,14 +69,13 @@ export class NotificationsApi extends runtime.BaseAPI {
69
69
  headers: headerParameters,
70
70
  query: queryParameters,
71
71
  }, initOverrides);
72
- return new runtime.JSONApiResponse(response, (jsonValue) => NotificationDeleteFromJSON(jsonValue));
72
+ return new runtime.VoidApiResponse(response);
73
73
  }
74
74
  /**
75
75
  * Delete a notification by id
76
76
  */
77
77
  async deleteNotificationsById(requestParameters, initOverrides) {
78
- const response = await this.deleteNotificationsByIdRaw(requestParameters, initOverrides);
79
- return await response.value();
78
+ await this.deleteNotificationsByIdRaw(requestParameters, initOverrides);
80
79
  }
81
80
  /**
82
81
  * Get all notifications
@@ -1 +1 @@
1
- {"version":3,"file":"NotificationsApi.js","sourceRoot":"","sources":["../../../../src/api/notifications-api/apis/NotificationsApi.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB,oBAAoB;AACpB;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,OAAO,MAAM,YAAY,CAAC;AAUtC,OAAO,EAGH,mCAAmC,EAEnC,oBAAoB,EAEpB,0BAA0B,EAE1B,yBAAyB,EACzB,uBAAuB,EAEvB,yBAAyB,GAG5B,MAAM,iBAAiB,CAAC;AAgCzB;;GAEG;AACH,MAAM,OAAO,gBAAiB,SAAQ,OAAO,CAAC,OAAO;IAEjD;;OAEG;IACH,KAAK,CAAC,qBAAqB,CAAC,iBAA4C,EAAE,aAA0D;QAChI,MAAM,eAAe,GAAQ,EAAE,CAAC;QAEhC,MAAM,gBAAgB,GAAwB,EAAE,CAAC;QAEjD,gBAAgB,CAAC,cAAc,CAAC,GAAG,kBAAkB,CAAC;QAEtD,IAAI,IAAI,CAAC,aAAa,IAAI,IAAI,CAAC,aAAa,CAAC,WAAW,EAAE;YACtD,MAAM,KAAK,GAAG,IAAI,CAAC,aAAa,CAAC,WAAW,CAAC;YAC7C,MAAM,WAAW,GAAG,MAAM,KAAK,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC;YAEnD,IA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,WAAW,EAAE,CAAC;aAC/D;SACJ;QACD,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC;YAChC,IAAI,EAAE,qBAAqB,CAAC,OAAO,CAAC,IAAI,IAAI,GAAG,EAAE,kBAAkB,CAAC,MAAM,CAAC,iBAAiB,CAAC,EAAE,CAAC,CAAC,CAAC;YAClG,MAAM,EAAE,OAAO;YACf,OAAO,EAAE,gBAAgB;YACzB,KAAK,EAAE,eAAe;YACtB,IAAI,EAAE,uBAAuB,CAAC,iBAAiB,CAAC,iBAAiB,CAAC;SACrE,EAAE,aAAa,CAAC,CAAC;QAElB,OAAO,IAAI,OAAO,CAAC,eAAe,CAAC,QAAQ,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC,yBAAyB,CAAC,SAAS,CAAC,CAAC,CAAC;IACtG,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,sBAAsB,CAAC,iBAAgD,EAAE,aAA0D;QACrI,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,yBAAyB,CAAC,iBAAiB,EAAE,aAAa,CAAC,CAAC;QACxF,OAAO,MAAM,QAAQ,CAAC,KAAK,EAAE,CAAC;IAClC,CAAC;CAEJ","sourcesContent":["/* tslint:disable */\n/* eslint-disable */\n/**\n * Notifications API\n * An API to create and read notifications\n *\n * The version of the OpenAPI document: 1.0.0\n * Contact: DevTeamProduct@digitalrealty.com\n *\n * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).\n * https://openapi-generator.tech\n * Do not edit the class manually.\n */\n\n\nimport * as runtime from '../runtime';\nimport type {\n ErrorResponse,\n GetNotifications200Response,\n Notification,\n NotificationDelete,\n NotificationPatch,\n NotificationRequest,\n Status,\n} from '../models/index';\nimport {\n ErrorResponseFromJSON,\n ErrorResponseToJSON,\n GetNotifications200ResponseFromJSON,\n GetNotifications200ResponseToJSON,\n NotificationFromJSON,\n NotificationToJSON,\n NotificationDeleteFromJSON,\n NotificationDeleteToJSON,\n NotificationPatchFromJSON,\n NotificationPatchToJSON,\n NotificationRequestFromJSON,\n NotificationRequestToJSON,\n StatusFromJSON,\n StatusToJSON,\n} from '../models/index';\n\nexport interface CreateNotificationRequest {\n notificationRequest?: NotificationRequest;\n}\n\nexport interface DeleteNotificationsByIdRequest {\n id: string;\n}\n\nexport interface GetNotificationsRequest {\n sort?: string;\n cursor?: string;\n resourceType?: string;\n accountNumber?: string;\n createdAfter?: Date;\n createdBefore?: Date;\n locationId?: string;\n subGroup?: string;\n status?: Status;\n prefer?: Array<string>;\n}\n\nexport interface GetNotificationsByIdRequest {\n id: string;\n}\n\nexport interface PatchNotificationsByIdRequest {\n id: string;\n notificationPatch?: NotificationPatch;\n}\n\n/**\n * \n */\nexport class NotificationsApi extends runtime.BaseAPI {\n\n /**\n * Submit notification to be sent to user\n */\n async createNotificationRaw(requestParameters: CreateNotificationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Notification>> {\n const queryParameters: any = {};\n\n const headerParameters: runtime.HTTPHeaders = {};\n\n headerParameters['Content-Type'] = 'application/json';\n\n if (this.configuration && this.configuration.accessToken) {\n const token = this.configuration.accessToken;\n const tokenString = await token(\"bearerToken\", []);\n\n if (tokenString) {\n headerParameters[\"Authorization\"] = `Bearer ${tokenString}`;\n }\n }\n const response = await this.request({\n path: `/notifications`,\n method: 'POST',\n headers: headerParameters,\n query: queryParameters,\n body: NotificationRequestToJSON(requestParameters.notificationRequest),\n }, initOverrides);\n\n return new runtime.JSONApiResponse(response, (jsonValue) => NotificationFromJSON(jsonValue));\n }\n\n /**\n * Submit notification to be sent to user\n */\n async createNotification(requestParameters: CreateNotificationRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Notification> {\n const response = await this.createNotificationRaw(requestParameters, initOverrides);\n return await response.value();\n }\n\n /**\n * Delete a notification by id\n */\n async deleteNotificationsByIdRaw(requestParameters: DeleteNotificationsByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<NotificationDelete>> {\n if (requestParameters.id === null || requestParameters.id === undefined) {\n throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling deleteNotificationsById.');\n }\n\n const queryParameters: any = {};\n\n const headerParameters: runtime.HTTPHeaders = {};\n\n if (this.configuration && this.configuration.accessToken) {\n const token = this.configuration.accessToken;\n const tokenString = await token(\"bearerToken\", []);\n\n if (tokenString) {\n headerParameters[\"Authorization\"] = `Bearer ${tokenString}`;\n }\n }\n const response = await this.request({\n path: `/notifications/{id}`.replace(`{${\"id\"}}`, encodeURIComponent(String(requestParameters.id))),\n method: 'DELETE',\n headers: headerParameters,\n query: queryParameters,\n }, initOverrides);\n\n return new runtime.JSONApiResponse(response, (jsonValue) => NotificationDeleteFromJSON(jsonValue));\n }\n\n /**\n * Delete a notification by id\n */\n async deleteNotificationsById(requestParameters: DeleteNotificationsByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<NotificationDelete> {\n const response = await this.deleteNotificationsByIdRaw(requestParameters, initOverrides);\n return await response.value();\n }\n\n /**\n * Get all notifications\n */\n async getNotificationsRaw(requestParameters: GetNotificationsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<GetNotifications200Response>> {\n const queryParameters: any = {};\n\n if (requestParameters.sort !== undefined) {\n queryParameters['sort'] = requestParameters.sort;\n }\n\n if (requestParameters.cursor !== undefined) {\n queryParameters['cursor'] = requestParameters.cursor;\n }\n\n if (requestParameters.resourceType !== undefined) {\n queryParameters['resource_type'] = requestParameters.resourceType;\n }\n\n if (requestParameters.accountNumber !== undefined) {\n queryParameters['account_number'] = requestParameters.accountNumber;\n }\n\n if (requestParameters.createdAfter !== undefined) {\n queryParameters['created_after'] = (requestParameters.createdAfter as any).toISOString();\n }\n\n if (requestParameters.createdBefore !== undefined) {\n queryParameters['created_before'] = (requestParameters.createdBefore as any).toISOString();\n }\n\n if (requestParameters.locationId !== undefined) {\n queryParameters['location_id'] = requestParameters.locationId;\n }\n\n if (requestParameters.subGroup !== undefined) {\n queryParameters['sub_group'] = requestParameters.subGroup;\n }\n\n if (requestParameters.status !== undefined) {\n queryParameters['status'] = requestParameters.status;\n }\n\n const headerParameters: runtime.HTTPHeaders = {};\n\n if (requestParameters.prefer) {\n headerParameters['Prefer'] = requestParameters.prefer.join(runtime.COLLECTION_FORMATS[\"csv\"]);\n }\n\n if (this.configuration && this.configuration.accessToken) {\n const token = this.configuration.accessToken;\n const tokenString = await token(\"bearerToken\", []);\n\n if (tokenString) {\n headerParameters[\"Authorization\"] = `Bearer ${tokenString}`;\n }\n }\n const response = await this.request({\n path: `/notifications`,\n method: 'GET',\n headers: headerParameters,\n query: queryParameters,\n }, initOverrides);\n\n return new runtime.JSONApiResponse(response, (jsonValue) => GetNotifications200ResponseFromJSON(jsonValue));\n }\n\n /**\n * Get all notifications\n */\n async getNotifications(requestParameters: GetNotificationsRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<GetNotifications200Response> {\n const response = await this.getNotificationsRaw(requestParameters, initOverrides);\n return await response.value();\n }\n\n /**\n * Get an notification by id\n */\n async getNotificationsByIdRaw(requestParameters: GetNotificationsByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Notification>> {\n if (requestParameters.id === null || requestParameters.id === undefined) {\n throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling getNotificationsById.');\n }\n\n const queryParameters: any = {};\n\n const headerParameters: runtime.HTTPHeaders = {};\n\n if (this.configuration && this.configuration.accessToken) {\n const token = this.configuration.accessToken;\n const tokenString = await token(\"bearerToken\", []);\n\n if (tokenString) {\n headerParameters[\"Authorization\"] = `Bearer ${tokenString}`;\n }\n }\n const response = await this.request({\n path: `/notifications/{id}`.replace(`{${\"id\"}}`, encodeURIComponent(String(requestParameters.id))),\n method: 'GET',\n headers: headerParameters,\n query: queryParameters,\n }, initOverrides);\n\n return new runtime.JSONApiResponse(response, (jsonValue) => NotificationFromJSON(jsonValue));\n }\n\n /**\n * Get an notification by id\n */\n async getNotificationsById(requestParameters: GetNotificationsByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Notification> {\n const response = await this.getNotificationsByIdRaw(requestParameters, initOverrides);\n return await response.value();\n }\n\n /**\n * Update specific fields on a notification by id\n */\n async patchNotificationsByIdRaw(requestParameters: PatchNotificationsByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<NotificationPatch>> {\n if (requestParameters.id === null || requestParameters.id === undefined) {\n throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling patchNotificationsById.');\n }\n\n const queryParameters: any = {};\n\n const headerParameters: runtime.HTTPHeaders = {};\n\n headerParameters['Content-Type'] = 'application/json';\n\n if (this.configuration && this.configuration.accessToken) {\n const token = this.configuration.accessToken;\n const tokenString = await token(\"bearerToken\", []);\n\n if (tokenString) {\n headerParameters[\"Authorization\"] = `Bearer ${tokenString}`;\n }\n }\n const response = await this.request({\n path: `/notifications/{id}`.replace(`{${\"id\"}}`, encodeURIComponent(String(requestParameters.id))),\n method: 'PATCH',\n headers: headerParameters,\n query: queryParameters,\n body: NotificationPatchToJSON(requestParameters.notificationPatch),\n }, initOverrides);\n\n return new runtime.JSONApiResponse(response, (jsonValue) => NotificationPatchFromJSON(jsonValue));\n }\n\n /**\n * Update specific fields on a notification by id\n */\n async patchNotificationsById(requestParameters: PatchNotificationsByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<NotificationPatch> {\n const response = await this.patchNotificationsByIdRaw(requestParameters, initOverrides);\n return await response.value();\n }\n\n}\n"]}
1
+ {"version":3,"file":"NotificationsApi.js","sourceRoot":"","sources":["../../../../src/api/notifications-api/apis/NotificationsApi.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB,oBAAoB;AACpB;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,OAAO,MAAM,YAAY,CAAC;AAStC,OAAO,EAGH,m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\n * Notifications API\n * An API to create and read notifications\n *\n * The version of the OpenAPI document: 1.0.0\n * Contact: DevTeamProduct@digitalrealty.com\n *\n * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).\n * https://openapi-generator.tech\n * Do not edit the class manually.\n */\n\n\nimport * as runtime from '../runtime';\nimport type {\n ErrorResponse,\n GetNotifications200Response,\n Notification,\n NotificationPatch,\n NotificationRequest,\n Status,\n} from '../models/index';\nimport {\n ErrorResponseFromJSON,\n ErrorResponseToJSON,\n GetNotifications200ResponseFromJSON,\n GetNotifications200ResponseToJSON,\n NotificationFromJSON,\n NotificationToJSON,\n NotificationPatchFromJSON,\n NotificationPatchToJSON,\n NotificationRequestFromJSON,\n NotificationRequestToJSON,\n StatusFromJSON,\n StatusToJSON,\n} from '../models/index';\n\nexport interface CreateNotificationRequest {\n notificationRequest?: NotificationRequest;\n}\n\nexport interface DeleteNotificationsByIdRequest {\n id: string;\n}\n\nexport interface GetNotificationsRequest {\n sort?: string;\n cursor?: string;\n resourceType?: string;\n accountNumber?: string;\n createdAfter?: Date;\n createdBefore?: Date;\n locationId?: string;\n subGroup?: string;\n status?: Status;\n prefer?: Array<string>;\n}\n\nexport interface GetNotificationsByIdRequest {\n id: string;\n}\n\nexport interface PatchNotificationsByIdRequest {\n id: string;\n notificationPatch?: NotificationPatch;\n}\n\n/**\n * \n */\nexport class NotificationsApi extends runtime.BaseAPI {\n\n /**\n * Submit notification to be sent to user\n */\n async createNotificationRaw(requestParameters: CreateNotificationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Notification>> {\n const queryParameters: any = {};\n\n const headerParameters: runtime.HTTPHeaders = {};\n\n headerParameters['Content-Type'] = 'application/json';\n\n if (this.configuration && this.configuration.accessToken) {\n const token = this.configuration.accessToken;\n const tokenString = await token(\"bearerToken\", []);\n\n if (tokenString) {\n headerParameters[\"Authorization\"] = `Bearer ${tokenString}`;\n }\n }\n const response = await this.request({\n path: `/notifications`,\n method: 'POST',\n headers: headerParameters,\n query: queryParameters,\n body: NotificationRequestToJSON(requestParameters.notificationRequest),\n }, initOverrides);\n\n return new runtime.JSONApiResponse(response, (jsonValue) => NotificationFromJSON(jsonValue));\n }\n\n /**\n * Submit notification to be sent to user\n */\n async createNotification(requestParameters: CreateNotificationRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Notification> {\n const response = await this.createNotificationRaw(requestParameters, initOverrides);\n return await response.value();\n }\n\n /**\n * Delete a notification by id\n */\n async deleteNotificationsByIdRaw(requestParameters: DeleteNotificationsByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {\n if (requestParameters.id === null || requestParameters.id === undefined) {\n throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling deleteNotificationsById.');\n }\n\n const queryParameters: any = {};\n\n const headerParameters: runtime.HTTPHeaders = {};\n\n if (this.configuration && this.configuration.accessToken) {\n const token = this.configuration.accessToken;\n const tokenString = await token(\"bearerToken\", []);\n\n if (tokenString) {\n headerParameters[\"Authorization\"] = `Bearer ${tokenString}`;\n }\n }\n const response = await this.request({\n path: `/notifications/{id}`.replace(`{${\"id\"}}`, encodeURIComponent(String(requestParameters.id))),\n method: 'DELETE',\n headers: headerParameters,\n query: queryParameters,\n }, initOverrides);\n\n return new runtime.VoidApiResponse(response);\n }\n\n /**\n * Delete a notification by id\n */\n async deleteNotificationsById(requestParameters: DeleteNotificationsByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {\n await this.deleteNotificationsByIdRaw(requestParameters, initOverrides);\n }\n\n /**\n * Get all notifications\n */\n async getNotificationsRaw(requestParameters: GetNotificationsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<GetNotifications200Response>> {\n const queryParameters: any = {};\n\n if (requestParameters.sort !== undefined) {\n queryParameters['sort'] = requestParameters.sort;\n }\n\n if (requestParameters.cursor !== undefined) {\n queryParameters['cursor'] = requestParameters.cursor;\n }\n\n if (requestParameters.resourceType !== undefined) {\n queryParameters['resource_type'] = requestParameters.resourceType;\n }\n\n if (requestParameters.accountNumber !== undefined) {\n queryParameters['account_number'] = requestParameters.accountNumber;\n }\n\n if (requestParameters.createdAfter !== undefined) {\n queryParameters['created_after'] = (requestParameters.createdAfter as any).toISOString();\n }\n\n if (requestParameters.createdBefore !== undefined) {\n queryParameters['created_before'] = (requestParameters.createdBefore as any).toISOString();\n }\n\n if (requestParameters.locationId !== undefined) {\n queryParameters['location_id'] = requestParameters.locationId;\n }\n\n if (requestParameters.subGroup !== undefined) {\n queryParameters['sub_group'] = requestParameters.subGroup;\n }\n\n if (requestParameters.status !== undefined) {\n queryParameters['status'] = requestParameters.status;\n }\n\n const headerParameters: runtime.HTTPHeaders = {};\n\n if (requestParameters.prefer) {\n headerParameters['Prefer'] = requestParameters.prefer.join(runtime.COLLECTION_FORMATS[\"csv\"]);\n }\n\n if (this.configuration && this.configuration.accessToken) {\n const token = this.configuration.accessToken;\n const tokenString = await token(\"bearerToken\", []);\n\n if (tokenString) {\n headerParameters[\"Authorization\"] = `Bearer ${tokenString}`;\n }\n }\n const response = await this.request({\n path: `/notifications`,\n method: 'GET',\n headers: headerParameters,\n query: queryParameters,\n }, initOverrides);\n\n return new runtime.JSONApiResponse(response, (jsonValue) => GetNotifications200ResponseFromJSON(jsonValue));\n }\n\n /**\n * Get all notifications\n */\n async getNotifications(requestParameters: GetNotificationsRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<GetNotifications200Response> {\n const response = await this.getNotificationsRaw(requestParameters, initOverrides);\n return await response.value();\n }\n\n /**\n * Get an notification by id\n */\n async getNotificationsByIdRaw(requestParameters: GetNotificationsByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Notification>> {\n if (requestParameters.id === null || requestParameters.id === undefined) {\n throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling getNotificationsById.');\n }\n\n const queryParameters: any = {};\n\n const headerParameters: runtime.HTTPHeaders = {};\n\n if (this.configuration && this.configuration.accessToken) {\n const token = this.configuration.accessToken;\n const tokenString = await token(\"bearerToken\", []);\n\n if (tokenString) {\n headerParameters[\"Authorization\"] = `Bearer ${tokenString}`;\n }\n }\n const response = await this.request({\n path: `/notifications/{id}`.replace(`{${\"id\"}}`, encodeURIComponent(String(requestParameters.id))),\n method: 'GET',\n headers: headerParameters,\n query: queryParameters,\n }, initOverrides);\n\n return new runtime.JSONApiResponse(response, (jsonValue) => NotificationFromJSON(jsonValue));\n }\n\n /**\n * Get an notification by id\n */\n async getNotificationsById(requestParameters: GetNotificationsByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Notification> {\n const response = await this.getNotificationsByIdRaw(requestParameters, initOverrides);\n return await response.value();\n }\n\n /**\n * Update specific fields on a notification by id\n */\n async patchNotificationsByIdRaw(requestParameters: PatchNotificationsByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<NotificationPatch>> {\n if (requestParameters.id === null || requestParameters.id === undefined) {\n throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling patchNotificationsById.');\n }\n\n const queryParameters: any = {};\n\n const headerParameters: runtime.HTTPHeaders = {};\n\n headerParameters['Content-Type'] = 'application/json';\n\n if (this.configuration && this.configuration.accessToken) {\n const token = this.configuration.accessToken;\n const tokenString = await token(\"bearerToken\", []);\n\n if (tokenString) {\n headerParameters[\"Authorization\"] = `Bearer ${tokenString}`;\n }\n }\n const response = await this.request({\n path: `/notifications/{id}`.replace(`{${\"id\"}}`, encodeURIComponent(String(requestParameters.id))),\n method: 'PATCH',\n headers: headerParameters,\n query: queryParameters,\n body: NotificationPatchToJSON(requestParameters.notificationPatch),\n }, initOverrides);\n\n return new runtime.JSONApiResponse(response, (jsonValue) => NotificationPatchFromJSON(jsonValue));\n }\n\n /**\n * Update specific fields on a notification by id\n */\n async patchNotificationsById(requestParameters: PatchNotificationsByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<NotificationPatch> {\n const response = await this.patchNotificationsByIdRaw(requestParameters, initOverrides);\n return await response.value();\n }\n\n}\n"]}
@@ -36,6 +36,13 @@ let DateFilters = class DateFilters extends MobxLitElement {
36
36
  else {
37
37
  this.fromDateErrorText = undefined;
38
38
  }
39
+ if (this.toDate < this.fromDate) {
40
+ this.toDateErrorText = 'To date cannot be earlier than From date.';
41
+ this.toDate = undefined;
42
+ }
43
+ else {
44
+ this.toDateErrorText = undefined;
45
+ }
39
46
  }
40
47
  onToDateChange(toDate) {
41
48
  this.toDate = toDate;
@@ -46,14 +53,22 @@ let DateFilters = class DateFilters extends MobxLitElement {
46
53
  else {
47
54
  this.toDateErrorText = undefined;
48
55
  }
56
+ if (this.fromDate > this.toDate) {
57
+ this.fromDateErrorText = 'From date cannot be later than To date.';
58
+ this.fromDate = undefined;
59
+ }
60
+ else {
61
+ this.fromDateErrorText = undefined;
62
+ }
49
63
  }
50
64
  onApplyDateFilter(selectedvalue) {
51
- if (selectedvalue) {
65
+ const datesChanged = selectedvalue && this.toDateErrorText === undefined && this.fromDateErrorText === undefined;
66
+ if (datesChanged) {
52
67
  NotificationsState.setNotificationDateFilter(this.fromDate, this.toDate);
53
68
  this.requestUpdate();
54
69
  }
55
70
  const event = new CustomEvent('on-selection', {
56
- detail: { returnValue: selectedvalue },
71
+ detail: { returnValue: datesChanged },
57
72
  bubbles: true,
58
73
  composed: true,
59
74
  });
@@ -62,7 +77,8 @@ let DateFilters = class DateFilters extends MobxLitElement {
62
77
  clearDateFilters() {
63
78
  this.fromDate = undefined;
64
79
  this.toDate = undefined;
65
- this.requestUpdate();
80
+ this.fromDateErrorText = undefined;
81
+ this.toDateErrorText = undefined;
66
82
  }
67
83
  /* eslint-disable lit-a11y/click-events-have-key-events */
68
84
  render() {
@@ -1 +1 @@
1
- {"version":3,"file":"date-filters.js","sourceRoot":"","sources":["../../../src/components/notifications/date-filters.ts"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BAGL,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;AAvHU;IAAR,KAAK,EAAE;6CAEI;AAEH;IAAR,KAAK,EAAE;2CAEI;AAEH;IAAR,KAAK,EAAE;4CAA6D;AAE5D;IAAR,KAAK,EAAE;sDAAiC;AAEhC;IAAR,KAAK,EAAE;oDAA+B;AAjB5B,WAAW;IADvB,aAAa,CAAC,cAAc,CAAC;GACjB,WAAW,CA4HvB;SA5HY,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 { formatDate } 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 formatDate(NotificationsState.dateFilters.FROM_DATE!, DefaultDateFormat) ||\n undefined;\n\n @state() private toDate? =\n formatDate(NotificationsState.dateFilters.TO_DATE!, DefaultDateFormat) ||\n undefined;\n\n @state() private maxDate = formatDate(new Date(), DefaultDateFormat);\n\n @state() private fromDateErrorText? = '';\n\n @state() private toDateErrorText? = '';\n\n onFromDateChange(fromDate: string) {\n this.fromDate = fromDate;\n if (this.fromDate > this.toDate!) {\n this.fromDateErrorText = 'From date cannot be later than To date.';\n this.fromDate = undefined;\n } else {\n this.fromDateErrorText = undefined;\n }\n }\n\n onToDateChange(toDate: string) {\n this.toDate = toDate;\n if (this.toDate < this.fromDate!) {\n this.toDateErrorText = 'To date cannot be earlier than From date.';\n this.toDate = undefined;\n } else {\n this.toDateErrorText = undefined;\n }\n }\n\n onApplyDateFilter(selectedvalue: Boolean) {\n if (selectedvalue) {\n NotificationsState.setNotificationDateFilter(this.fromDate, this.toDate);\n this.requestUpdate();\n }\n\n const event = new CustomEvent<FilterDialogEventDetail>('on-selection', {\n detail: { returnValue: selectedvalue },\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.requestUpdate();\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,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,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;AAI9D,IAAM,WAAW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AAC,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;AAzIU;IAAR,KAAK,EAAE;6CAEI;AAEH;IAAR,KAAK,EAAE;2CAEI;AAEH;IAAR,KAAK,EAAE;4CAA6D;AAE5D;IAAR,KAAK,EAAE;sDAAiC;AAEhC;IAAR,KAAK,EAAE;oDAA+B;AAjB5B,WAAW;IADvB,aAAa,CAAC,cAAc,CAAC;GACjB,WAAW,CA8IvB;SA9IY,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 { formatDate } 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 formatDate(NotificationsState.dateFilters.FROM_DATE!, DefaultDateFormat) ||\n undefined;\n\n @state() private toDate? =\n formatDate(NotificationsState.dateFilters.TO_DATE!, DefaultDateFormat) ||\n undefined;\n\n @state() private maxDate = formatDate(new Date(), DefaultDateFormat);\n\n @state() private fromDateErrorText? = '';\n\n @state() private toDateErrorText? = '';\n\n onFromDateChange(fromDate: string) {\n this.fromDate = fromDate;\n \n if (this.fromDate! > this.toDate!) {\n this.fromDateErrorText = 'From date cannot be later than To date.';\n this.fromDate = undefined;\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 } else {\n this.toDateErrorText = undefined;\n }\n }\n\n onToDateChange(toDate: string) {\n this.toDate = toDate;\n \n if (this.toDate! < this.fromDate!) {\n this.toDateErrorText = 'To date cannot be earlier than From date.';\n this.toDate = undefined;\n } else {\n this.toDateErrorText = undefined;\n }\n\n if (this.fromDate! > this.toDate!) {\n this.fromDateErrorText = 'From date cannot be later than To date.';\n this.fromDate = undefined;\n } else {\n this.fromDateErrorText = undefined;\n }\n }\n\n onApplyDateFilter(selectedvalue: Boolean) {\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"]}
@@ -4,6 +4,7 @@ import '@digital-realty/ix-icon/ix-icon.js';
4
4
  import { Notification } from '../../models/notification.js';
5
5
  import './confirmation-dialog.js';
6
6
  import './view-item-dialog.js';
7
+ import '@digital-realty/ix-toast/ix-message-toast.js';
7
8
  export declare class NotificationItem extends MobxLitElement {
8
9
  disabled: boolean;
9
10
  notificaiton: Notification;
@@ -13,6 +14,7 @@ export declare class NotificationItem extends MobxLitElement {
13
14
  displayItem(): void;
14
15
  deleteItem(): void;
15
16
  private confirmedDelete;
17
+ private showDeleteResultMessage;
16
18
  calculateDuration(): string;
17
19
  GetNotificationIcon(): "lab_profile" | "dvr" | "emergency_home" | "public" | "sync_saved_locally";
18
20
  render(): import("lit").TemplateResult<1>;
@@ -12,6 +12,7 @@ import { NotificationStatus, DefaultDateTimeFormat, NotificationGroups, } from '
12
12
  import { NotificationsStyle } from '../../styles/notifications-style.js';
13
13
  import './confirmation-dialog.js';
14
14
  import './view-item-dialog.js';
15
+ import '@digital-realty/ix-toast/ix-message-toast.js';
15
16
  let NotificationItem = class NotificationItem extends MobxLitElement {
16
17
  constructor() {
17
18
  super(...arguments);
@@ -26,7 +27,7 @@ let NotificationItem = class NotificationItem extends MobxLitElement {
26
27
  elementTheme,
27
28
  TWStyles,
28
29
  css `
29
- h2 {
30
+ .notification-item-read h2 {
30
31
  font-family: 'Open Sans', sans-serif;
31
32
  font-size: 12px;
32
33
  font-weight: 400;
@@ -34,6 +35,14 @@ let NotificationItem = class NotificationItem extends MobxLitElement {
34
35
  letter-spacing: 0.4px;
35
36
  text-align: left;
36
37
  }
38
+ .notification-item-unread h2 {
39
+ font-family: 'Open Sans', sans-serif;
40
+ font-size: 12px;
41
+ font-weight: 700;
42
+ line-height: 16px;
43
+ letter-spacing: 0.4px;
44
+ text-align: left;
45
+ }
37
46
  h3 {
38
47
  font-family: 'Open Sans', sans-serif;
39
48
  font-size: 12px;
@@ -49,7 +58,12 @@ let NotificationItem = class NotificationItem extends MobxLitElement {
49
58
  --ix-icon-line-height: 24px;
50
59
  color: var(--md-sys-text-color-primary);
51
60
  }
52
- .notification-item ix-icon {
61
+ .notification-item-read ix-icon {
62
+ margin-right: 12px;
63
+ color: rgba(9, 34, 65);
64
+ }
65
+
66
+ .notification-item-unread ix-icon {
53
67
  margin-right: 12px;
54
68
  color: rgb(20, 86, 224);
55
69
  }
@@ -69,10 +83,28 @@ let NotificationItem = class NotificationItem extends MobxLitElement {
69
83
  }
70
84
  confirmedDelete(e) {
71
85
  // DELETE IF CONFIRMED TRUE
72
- if (e.detail.returnValue)
73
- NotificationsState.setNotificationDeleted(this.notificaiton.id);
86
+ if (e.detail.returnValue) {
87
+ NotificationsState.setNotificationDeleted(this.notificaiton.id).then((result) => {
88
+ this.showDeleteResultMessage(result, this.notificaiton.id);
89
+ });
90
+ }
74
91
  this.showDeleteConfirmation = false;
75
92
  }
93
+ showDeleteResultMessage(result, id) {
94
+ window.dispatchEvent(new CustomEvent("add-toast", { detail: {
95
+ id,
96
+ content: html `
97
+ <ix-message-toast toastId=${id} .TMessageToast=${result.State.toLowerCase()} forceClose>
98
+ ${result.Message}
99
+ </ix-message-toast>`,
100
+ autoClose: 2000,
101
+ durationOut: 2000,
102
+ vertical: 'bottom',
103
+ horizontal: 'center',
104
+ animated: true,
105
+ above: false,
106
+ } }));
107
+ }
76
108
  calculateDuration() {
77
109
  if (this.notificaiton.createdAt !== undefined) {
78
110
  if (differenceInHours(new Date(), this.notificaiton.createdAt) < 24)
@@ -100,7 +132,7 @@ let NotificationItem = class NotificationItem extends MobxLitElement {
100
132
  /* eslint-disable lit-a11y/click-events-have-key-events */
101
133
  render() {
102
134
  var _a, _b, _c;
103
- return html `
135
+ return html `
104
136
  <div class="relative bg-white-gp notification-item">
105
137
  <div
106
138
  class=${((_a = this.notificaiton) === null || _a === void 0 ? void 0 : _a.status) === 'unread'
@@ -1 +1 @@
1
- {"version":3,"file":"notification-item.js","sourceRoot":"","sources":["../../../src/components/notifications/notification-item.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,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,kDAAkD,CAAC;AAC1D,OAAO,oCAAoC,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AACrE,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAEtE,OAAO,EACL,k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ACzB,CAAC;;;;sBAIO,IAAI,CAAC,sBAAsB;sCACX,IAAI,CAAC,eAAe;uCACnB,GAAG,EAAE;YAC5B,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;QACzB,CAAC;;;;;;qBAMM,IAAI,CAAC,UAAU;;oBAEhB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,WAAW;;;;KAIxD,CAAC;IACJ,CAAC;CACF,CAAA;AAlJ8B;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;kDAAkB;AAEA;IAA7C,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;sDACxB;AAEZ;IAAR,KAAK,EAAE;mDAA2B;AAE1B;IAAR,KAAK,EAAE;gEAAwC;AARrC,gBAAgB;IAD5B,aAAa,CAAC,mBAAmB,CAAC;GACtB,gBAAgB,CAmJ5B;SAnJY,gBAAgB","sourcesContent":["import { html, css } from 'lit';\nimport { MobxLitElement } from '@adobe/lit-mobx';\nimport { customElement, property, state } from 'lit/decorators.js';\nimport '@digital-realty/ix-icon-button/ix-icon-button.js';\nimport '@digital-realty/ix-icon/ix-icon.js';\nimport { elementTheme } from '@digital-realty/theme';\nimport { format, formatDistance, differenceInHours } from 'date-fns';\nimport { TWStyles } from '../../tw.js';\nimport { NotificationsState } from '../../state/NotificationState.js';\nimport { Notification } from '../../models/notification.js';\nimport {\n NotificationStatus,\n DefaultDateTimeFormat,\n NotificationGroups,\n} from '../../constants/notifications.js';\nimport { ConfirmationDialogEventDetail } from '../../constants/notification-types.js';\nimport { NotificationsStyle } from '../../styles/notifications-style.js';\nimport './confirmation-dialog.js';\nimport './view-item-dialog.js';\n\n@customElement('notification-item')\nexport class NotificationItem extends MobxLitElement {\n @property({ type: Boolean }) disabled = false;\n\n @property({ type: Object, attribute: false }) notificaiton =\n {} as Notification;\n\n @state() private showModal = false;\n\n @state() private showDeleteConfirmation = false;\n\n static get styles() {\n return [\n NotificationsStyle,\n elementTheme,\n TWStyles,\n css`\n h2 {\n font-family: 'Open Sans', sans-serif;\n font-size: 12px;\n font-weight: 400;\n line-height: 16px;\n letter-spacing: 0.4px;\n text-align: left;\n }\n h3 {\n font-family: 'Open Sans', sans-serif;\n font-size: 12px;\n font-weight: 400;\n line-height: 16px;\n letter-spacing: 0.4px;\n text-align: left;\n color: rgba(9, 34, 65, 0.6);\n padding: 0;\n }\n ix-icon {\n --ix-icon-font-size: 24px;\n --ix-icon-line-height: 24px;\n color: var(--md-sys-text-color-primary);\n }\n .notification-item ix-icon {\n margin-right: 12px;\n color: rgb(20, 86, 224);\n }\n `,\n ];\n }\n\n displayItem() {\n if (this.notificaiton.status === NotificationStatus.UNREAD) {\n NotificationsState.setNotificationReadStatus(this.notificaiton.id);\n }\n this.showModal = true;\n }\n\n deleteItem() {\n if (!this.disabled) {\n this.showDeleteConfirmation = true;\n }\n }\n\n private confirmedDelete(e: CustomEvent<ConfirmationDialogEventDetail>) {\n // DELETE IF CONFIRMED TRUE\n if (e.detail.returnValue)\n NotificationsState.setNotificationDeleted(this.notificaiton.id);\n\n this.showDeleteConfirmation = false;\n }\n\n calculateDuration() {\n if (this.notificaiton.createdAt !== undefined) {\n if (differenceInHours(new Date(), this.notificaiton.createdAt) < 24)\n return formatDistance(this.notificaiton.createdAt, new Date(), {\n addSuffix: true,\n });\n return format(this.notificaiton.createdAt, DefaultDateTimeFormat);\n }\n return 'NA';\n }\n\n GetNotificationIcon() {\n switch (this.notificaiton.resourceType) {\n case NotificationGroups.PLANNED_MAINTENANCE:\n return 'lab_profile';\n case NotificationGroups.SERVICE_TICKETS:\n return 'dvr';\n case NotificationGroups.INCIDENTS:\n return 'emergency_home';\n case NotificationGroups.DCIM_ALERTS:\n return 'public';\n default:\n return 'sync_saved_locally';\n }\n }\n\n /* eslint-disable lit-a11y/click-events-have-key-events */\n render() {\n return html`\n <div class=\"relative bg-white-gp notification-item\">\n <div\n class=${this.notificaiton?.status === 'unread'\n ? 'notification-item-unread'\n : 'notification-item-read'}\n >\n <ix-icon\n icon=${this.GetNotificationIcon()}\n class=${this.notificaiton?.status === 'unread'\n ? 'blue-icon'\n : 'grey-icon'}\n @click=${this.displayItem}\n >${this.GetNotificationIcon()}\n </ix-icon>\n <div class=\"flex flex-col grow\" @click=${this.displayItem}>\n <div class=\"grow text-base\">\n <h2>${this.notificaiton?.resourceType}</h2>\n </div>\n <div class=\"grow text-xs\">\n <h3>${this.calculateDuration()}</h3>\n </div>\n </div>\n <div>\n <view-item-dialog\n ?open=${this.showModal}\n .notificaiton=${this.notificaiton}\n @view-item-dialog-closed=${() => {\n this.showModal = false;\n }}\n >\n </view-item-dialog>\n <confirmation-dialog\n ?open=${this.showDeleteConfirmation}\n @on-confirm-selection=${this.confirmedDelete}\n @confirm-dialog-closed=${() => {\n this.showModal = false;\n }}\n textMessage=\"Are you sure you want to delete this notification?\"\n >\n </confirmation-dialog>\n </div>\n <ix-icon-button\n @click=${this.deleteItem}\n icon=\"delete\"\n class=${!this.disabled ? 'red-icon' : 'grey-icon'}\n ></ix-icon-button>\n </div>\n </div>\n `;\n }\n}\n"]}
1
+ {"version":3,"file":"notification-item.js","sourceRoot":"","sources":["../../../src/components/notifications/notification-item.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,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,kDAAkD,CAAC;AAC1D,OAAO,oCAAoC,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AACrE,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;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KAAK,EAAE;gEAAwC;AARrC,gBAAgB;IAD5B,aAAa,CAAC,mBAAmB,CAAC;GACtB,gBAAgB,CAuL5B;SAvLY,gBAAgB","sourcesContent":["import { html, css } from 'lit';\nimport { MobxLitElement } from '@adobe/lit-mobx';\nimport { customElement, property, state } from 'lit/decorators.js';\nimport '@digital-realty/ix-icon-button/ix-icon-button.js';\nimport '@digital-realty/ix-icon/ix-icon.js';\nimport { elementTheme } from '@digital-realty/theme';\nimport { format, formatDistance, differenceInHours } from 'date-fns';\nimport { TWStyles } from '../../tw.js';\nimport { NotificationsState } from '../../state/NotificationState.js';\nimport { ApiCallResult, Notification } from '../../models/notification.js';\nimport {\n NotificationStatus,\n DefaultDateTimeFormat,\n NotificationGroups,\n} from '../../constants/notifications.js';\nimport { ConfirmationDialogEventDetail } from '../../constants/notification-types.js';\nimport { NotificationsStyle } from '../../styles/notifications-style.js';\nimport './confirmation-dialog.js';\nimport './view-item-dialog.js';\nimport '@digital-realty/ix-toast/ix-message-toast.js';\n\n@customElement('notification-item')\nexport class NotificationItem extends MobxLitElement {\n @property({ type: Boolean }) disabled = false;\n\n @property({ type: Object, attribute: false }) notificaiton =\n {} as Notification;\n\n @state() private showModal = false;\n\n @state() private showDeleteConfirmation = false;\n\n static get styles() {\n return [\n NotificationsStyle,\n elementTheme,\n TWStyles,\n css`\n .notification-item-read h2 {\n font-family: 'Open Sans', sans-serif;\n font-size: 12px;\n font-weight: 400;\n line-height: 16px;\n letter-spacing: 0.4px;\n text-align: left;\n }\n .notification-item-unread h2 {\n font-family: 'Open Sans', sans-serif;\n font-size: 12px;\n font-weight: 700;\n line-height: 16px;\n letter-spacing: 0.4px;\n text-align: left;\n }\n h3 {\n font-family: 'Open Sans', sans-serif;\n font-size: 12px;\n font-weight: 400;\n line-height: 16px;\n letter-spacing: 0.4px;\n text-align: left;\n color: rgba(9, 34, 65, 0.6);\n padding: 0;\n }\n ix-icon {\n --ix-icon-font-size: 24px;\n --ix-icon-line-height: 24px;\n color: var(--md-sys-text-color-primary);\n }\n .notification-item-read ix-icon {\n margin-right: 12px;\n color: rgba(9, 34, 65);\n }\n\n .notification-item-unread ix-icon {\n margin-right: 12px;\n color: rgb(20, 86, 224);\n }\n `,\n ];\n }\n\n displayItem() {\n if (this.notificaiton.status === NotificationStatus.UNREAD) {\n NotificationsState.setNotificationReadStatus(this.notificaiton.id);\n }\n this.showModal = true;\n }\n\n deleteItem() {\n if (!this.disabled) {\n this.showDeleteConfirmation = true;\n }\n }\n\n private confirmedDelete(e: CustomEvent<ConfirmationDialogEventDetail>) {\n // DELETE IF CONFIRMED TRUE\n if (e.detail.returnValue)\n {\n NotificationsState.setNotificationDeleted(this.notificaiton.id).then((result: ApiCallResult) => { \n this.showDeleteResultMessage(result,this.notificaiton.id);\n });\n }\n this.showDeleteConfirmation = false;\n }\n\n private showDeleteResultMessage(result: ApiCallResult, id: string )\n {\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: 2000,\n durationOut: 2000,\n vertical: 'bottom',\n horizontal: 'center',\n animated: true, \n above: false,\n } })\n );\n }\n\n calculateDuration() {\n if (this.notificaiton.createdAt !== undefined) {\n if (differenceInHours(new Date(), this.notificaiton.createdAt) < 24)\n return formatDistance(this.notificaiton.createdAt, new Date(), {\n addSuffix: true,\n });\n return format(this.notificaiton.createdAt, DefaultDateTimeFormat);\n }\n return 'NA';\n }\n\n GetNotificationIcon() {\n switch (this.notificaiton.resourceType) {\n case NotificationGroups.PLANNED_MAINTENANCE:\n return 'lab_profile';\n case NotificationGroups.SERVICE_TICKETS:\n return 'dvr';\n case NotificationGroups.INCIDENTS:\n return 'emergency_home';\n case NotificationGroups.DCIM_ALERTS:\n return 'public';\n default:\n return 'sync_saved_locally';\n }\n }\n\n /* eslint-disable lit-a11y/click-events-have-key-events */\n render() {\n return html` \n <div class=\"relative bg-white-gp notification-item\">\n <div\n class=${this.notificaiton?.status === 'unread'\n ? 'notification-item-unread'\n : 'notification-item-read'}\n >\n <ix-icon\n icon=${this.GetNotificationIcon()}\n class=${this.notificaiton?.status === 'unread'\n ? 'blue-icon'\n : 'grey-icon'}\n @click=${this.displayItem}\n >${this.GetNotificationIcon()}\n </ix-icon>\n <div class=\"flex flex-col grow\" @click=${this.displayItem}>\n <div class=\"grow text-base\">\n <h2>${this.notificaiton?.resourceType}</h2>\n </div>\n <div class=\"grow text-xs\">\n <h3>${this.calculateDuration()}</h3>\n </div>\n </div>\n <div>\n <view-item-dialog\n ?open=${this.showModal}\n .notificaiton=${this.notificaiton}\n @view-item-dialog-closed=${() => {\n this.showModal = false;\n }}\n >\n </view-item-dialog>\n <confirmation-dialog\n ?open=${this.showDeleteConfirmation}\n @on-confirm-selection=${this.confirmedDelete}\n @confirm-dialog-closed=${() => {\n this.showModal = false;\n }}\n textMessage=\"Are you sure you want to delete this notification?\"\n >\n </confirmation-dialog>\n </div>\n <ix-icon-button\n @click=${this.deleteItem}\n icon=\"delete\"\n class=${!this.disabled ? 'red-icon' : 'grey-icon'}\n ></ix-icon-button>\n </div>\n </div>\n `;\n }\n}\n"]}
@@ -8,6 +8,11 @@ export declare enum NotificationGroups {
8
8
  DCIM_ALERTS = "DCIM Alerts",
9
9
  SERVICE_TICKETS = "Service Tickets"
10
10
  }
11
+ export declare enum ApiCallState {
12
+ LOADING = "Loading",
13
+ ERROR = "Error",
14
+ SUCCESS = "Success"
15
+ }
11
16
  export declare const DefaultDateFormat = "yyyy-MM-dd";
12
17
  export declare const DefaultTimeFormat = "HH:mm:ss";
13
18
  export declare const DefaultDisplayDays = 30;