@oicl/openbridge-webcomponents-full-bundle 2.1.0-next.1 → 2.1.0-next.3
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.
- package/.storybook/main.ts +2 -0
- package/bundle/openbridge-webcomponents.bundle.js +390 -301
- package/bundle/openbridge-webcomponents.bundle.js.map +1 -1
- package/custom-elements.json +1066 -102
- package/dist/automation/valve-analoge-two-way-icon/valve-analog-two-way-icon.d.ts +21 -0
- package/dist/automation/valve-analoge-two-way-icon/valve-analog-two-way-icon.d.ts.map +1 -1
- package/dist/automation/valve-analoge-two-way-icon/valve-analog-two-way-icon.js +39 -58
- package/dist/automation/valve-analoge-two-way-icon/valve-analog-two-way-icon.js.map +1 -1
- package/dist/building-blocks/alert-list/alert-list-base.d.ts +60 -0
- package/dist/building-blocks/alert-list/alert-list-base.d.ts.map +1 -0
- package/dist/building-blocks/alert-list/alert-list-base.js +191 -0
- package/dist/building-blocks/alert-list/alert-list-base.js.map +1 -0
- package/dist/building-blocks/alert-list/alert-list.css.js.map +1 -1
- package/dist/building-blocks/alert-list/alert-list.d.ts +13 -26
- package/dist/building-blocks/alert-list/alert-list.d.ts.map +1 -1
- package/dist/building-blocks/alert-list/alert-list.js +7 -142
- package/dist/building-blocks/alert-list/alert-list.js.map +1 -1
- package/dist/components/alert-icon/alert-icon.d.ts.map +1 -1
- package/dist/components/alert-icon/alert-icon.js +6 -5
- package/dist/components/alert-icon/alert-icon.js.map +1 -1
- package/dist/components/alert-list-details/alert-list-details.css.js +4 -1
- package/dist/components/alert-list-details/alert-list-details.css.js.map +1 -1
- package/dist/components/alert-menu/alert-menu.css.js +3 -42
- package/dist/components/alert-menu/alert-menu.css.js.map +1 -1
- package/dist/components/alert-menu/alert-menu.d.ts +28 -6
- package/dist/components/alert-menu/alert-menu.d.ts.map +1 -1
- package/dist/components/alert-menu/alert-menu.js +81 -60
- package/dist/components/alert-menu/alert-menu.js.map +1 -1
- package/dist/components/alert-menu-item/alert-menu-item.d.ts +16 -6
- package/dist/components/alert-menu-item/alert-menu-item.d.ts.map +1 -1
- package/dist/components/alert-menu-item/alert-menu-item.js +11 -2
- package/dist/components/alert-menu-item/alert-menu-item.js.map +1 -1
- package/dist/components/number-input-field/number-input-field.css.js +8 -2
- package/dist/components/number-input-field/number-input-field.css.js.map +1 -1
- package/dist/components/number-input-field/number-input-field.d.ts +15 -1
- package/dist/components/number-input-field/number-input-field.d.ts.map +1 -1
- package/dist/components/number-input-field/number-input-field.js +38 -44
- package/dist/components/number-input-field/number-input-field.js.map +1 -1
- package/dist/components/textbox/textbox.css.js +3 -9
- package/dist/components/textbox/textbox.css.js.map +1 -1
- package/dist/components/textbox/textbox.d.ts +3 -0
- package/dist/components/textbox/textbox.d.ts.map +1 -1
- package/dist/components/textbox/textbox.js.map +1 -1
- package/dist/generated/locales/es-419.d.ts +1 -1
- package/dist/generated/locales/es-419.js +1 -1
- package/dist/generated/locales/es-419.js.map +1 -1
- package/dist/navigation-instruments/readout-list-item/readout-list-item.css.js +2 -1
- package/dist/navigation-instruments/readout-list-item/readout-list-item.css.js.map +1 -1
- package/dist/pages/alert-detail-page/alert-detail-page.js +1 -1
- package/dist/pages/alert-detail-page/alert-detail-page.js.map +1 -1
- package/dist/pages/alert-list-page-small/alert-list-page-small-base.d.ts +59 -0
- package/dist/pages/alert-list-page-small/alert-list-page-small-base.d.ts.map +1 -0
- package/dist/pages/alert-list-page-small/alert-list-page-small-base.js +126 -0
- package/dist/pages/alert-list-page-small/alert-list-page-small-base.js.map +1 -0
- package/dist/pages/alert-list-page-small/alert-list-page-small.d.ts +12 -15
- package/dist/pages/alert-list-page-small/alert-list-page-small.d.ts.map +1 -1
- package/dist/pages/alert-list-page-small/alert-list-page-small.js +41 -92
- package/dist/pages/alert-list-page-small/alert-list-page-small.js.map +1 -1
- package/docs/GettingStarted.mdx +1 -0
- package/docs/MigrationGuide.mdx +2 -0
- package/package.json +1 -1
- package/src/automation/valve-analoge-two-way-icon/valve-analog-two-way-icon.stories.ts +63 -0
- package/src/automation/valve-analoge-two-way-icon/valve-analog-two-way-icon.ts +58 -60
- package/src/building-blocks/alert-list/alert-list-base.ts +266 -0
- package/src/building-blocks/alert-list/alert-list.css +1 -23
- package/src/building-blocks/alert-list/alert-list.spec.ts +22 -0
- package/src/building-blocks/alert-list/alert-list.ts +15 -207
- package/src/components/alert-icon/alert-icon.spec.ts +39 -0
- package/src/components/alert-icon/alert-icon.ts +11 -7
- package/src/components/alert-list-details/alert-list-details.css +1 -20
- package/src/components/alert-menu/alert-menu.css +5 -28
- package/src/components/alert-menu/alert-menu.spec.ts +113 -0
- package/src/components/alert-menu/alert-menu.ts +142 -79
- package/src/components/alert-menu-item/alert-menu-item.spec.ts +39 -0
- package/src/components/alert-menu-item/alert-menu-item.stories.ts +22 -0
- package/src/components/alert-menu-item/alert-menu-item.ts +22 -6
- package/src/components/number-input-field/number-input-field.css +8 -2
- package/src/components/number-input-field/number-input-field.spec.ts +260 -2
- package/src/components/number-input-field/number-input-field.stories.ts +74 -0
- package/src/components/number-input-field/number-input-field.ts +45 -74
- package/src/components/textbox/textbox.css +3 -9
- package/src/components/textbox/textbox.stories.ts +24 -0
- package/src/components/textbox/textbox.ts +3 -0
- package/src/generated/locales/es-419.ts +1 -1
- package/src/mixins/alert-list-empty.css +32 -0
- package/src/navigation-instruments/readout-list-item/readout-list-item.css +2 -1
- package/src/pages/alert-detail-page/alert-detail-page.spec.ts +41 -0
- package/src/pages/alert-detail-page/alert-detail-page.ts +1 -1
- package/src/pages/alert-list-page-small/alert-list-page-small-base.ts +152 -0
- package/src/pages/alert-list-page-small/alert-list-page-small.spec.ts +84 -0
- package/src/pages/alert-list-page-small/alert-list-page-small.ts +43 -112
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
CSSResultGroup,
|
|
3
|
+
LitElement,
|
|
4
|
+
PropertyValues,
|
|
5
|
+
TemplateResult,
|
|
6
|
+
html,
|
|
7
|
+
nothing,
|
|
8
|
+
unsafeCSS,
|
|
9
|
+
} from 'lit';
|
|
2
10
|
import {property, query, state} from 'lit/decorators.js';
|
|
3
11
|
import compentStyle from './alert-menu.css?inline';
|
|
4
12
|
import '../button/button.js';
|
|
@@ -12,7 +20,7 @@ import '../tabbed-card/tabbed-card.js';
|
|
|
12
20
|
import {localized, msg} from '@lit/localize';
|
|
13
21
|
import {customElement} from '../../decorator.js';
|
|
14
22
|
import '../../building-blocks/alert-list/alert-list.js';
|
|
15
|
-
import {
|
|
23
|
+
import type {ObcAlertListBase} from '../../building-blocks/alert-list/alert-list-base.js';
|
|
16
24
|
import {ObcTabbedCardChangeEvent} from '../tabbed-card/tabbed-card.js';
|
|
17
25
|
import {ObcAlertMenuItemStatus} from '../alert-menu-item/alert-menu-item.js';
|
|
18
26
|
import {PopoverController} from '../../internal/popover-controller.js';
|
|
@@ -22,6 +30,20 @@ export type ObcAckAllVisibleClickEvent = CustomEvent<{
|
|
|
22
30
|
tabName: 'shelved' | 'unacked' | 'all';
|
|
23
31
|
}>;
|
|
24
32
|
|
|
33
|
+
/** One tab of an alert menu: its name, its label and its empty state. */
|
|
34
|
+
export interface AlertMenuTab {
|
|
35
|
+
/** Names the tab in `ack-all-visible-click` and in the `empty-<tab>-*` slots. */
|
|
36
|
+
name: string;
|
|
37
|
+
title: string;
|
|
38
|
+
emptyTitle: string;
|
|
39
|
+
emptyIcon: TemplateResult;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const WAITING_FOR_ACK: string[] = [
|
|
43
|
+
ObcAlertMenuItemStatus.Unacknowledged,
|
|
44
|
+
ObcAlertMenuItemStatus.RectifiedUnacknowledged,
|
|
45
|
+
];
|
|
46
|
+
|
|
25
47
|
/**
|
|
26
48
|
* `<obc-alert-menu>` – A tabbed alert summary panel for displaying, acknowledging, and managing active alerts.
|
|
27
49
|
*
|
|
@@ -29,7 +51,7 @@ export type ObcAckAllVisibleClickEvent = CustomEvent<{
|
|
|
29
51
|
*
|
|
30
52
|
* ### Features
|
|
31
53
|
* - **Tabbed organization:** Switch between "Unacked", "Active", and (optionally) "Shelved" tabs for focused alert review.
|
|
32
|
-
* - **Alert filtering:** Each tab displays only relevant alerts
|
|
54
|
+
* - **Alert filtering:** Each tab displays only relevant alerts: "Unacked" shows the non-shelved items still waiting for acknowledgment (`unacknowledged` or `rectified-unacknowledged`), "Active" every non-shelved item except the `rectified-unacknowledged` ones. A subclass changes the tabs and the list through the `tabs` and `renderList` hooks.
|
|
33
55
|
* - **Bulk actions:** "ACK visible" button allows acknowledging all currently visible (filtered) alerts at once.
|
|
34
56
|
* - **Silence and navigation:** Dedicated buttons to silence alerts or jump to the full alert list.
|
|
35
57
|
* - **Dynamic content:** Supports any number of `<obc-alert-menu-item>` children, with automatic empty-state messaging and icons per tab.
|
|
@@ -127,10 +149,11 @@ export class ObcAlertMenu extends LitElement {
|
|
|
127
149
|
@property({type: Boolean, attribute: false}) showAlertListButton: boolean =
|
|
128
150
|
true;
|
|
129
151
|
|
|
130
|
-
|
|
152
|
+
/** The `name` of the tab the user picked; the second tab shows until then. */
|
|
153
|
+
@state() private _selectedTabName?: string;
|
|
131
154
|
|
|
132
|
-
@query('
|
|
133
|
-
private alertList!:
|
|
155
|
+
@query('.alert-list')
|
|
156
|
+
private alertList!: ObcAlertListBase;
|
|
134
157
|
|
|
135
158
|
private handleAckAllVisibleClick() {
|
|
136
159
|
const panel = this.alertList;
|
|
@@ -139,106 +162,146 @@ export class ObcAlertMenu extends LitElement {
|
|
|
139
162
|
new CustomEvent('ack-all-visible-click', {
|
|
140
163
|
detail: {
|
|
141
164
|
visibleElements: visibleElements,
|
|
142
|
-
tabName: this.
|
|
165
|
+
tabName: this.selectedTab.name,
|
|
143
166
|
},
|
|
144
167
|
})
|
|
145
168
|
);
|
|
146
169
|
}
|
|
147
170
|
|
|
148
171
|
private onTabChange(e: ObcTabbedCardChangeEvent) {
|
|
149
|
-
this.
|
|
172
|
+
this._selectedTabName = this.tabs[e.detail.tab]?.name;
|
|
150
173
|
}
|
|
151
174
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
175
|
+
protected override willUpdate(changedProperties: PropertyValues<this>) {
|
|
176
|
+
super.willUpdate(changedProperties);
|
|
177
|
+
// A picked tab that goes away, as Shelved does when `hasShelved` turns
|
|
178
|
+
// off, gives way to the second tab, which stays when the tab returns.
|
|
179
|
+
if (!this.tabs.some((tab) => tab.name === this._selectedTabName)) {
|
|
180
|
+
this._selectedTabName = undefined;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/** Whether the menu offers "ACK visible" at all; `canAckAll` enables it. */
|
|
185
|
+
protected get offersAckAll(): boolean {
|
|
186
|
+
return true;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/** The tabs in display order; the menu opens on the second one. */
|
|
190
|
+
protected get tabs(): AlertMenuTab[] {
|
|
191
|
+
const tabs = [
|
|
192
|
+
{
|
|
155
193
|
name: 'unacked',
|
|
194
|
+
title: msg('Unacked'),
|
|
156
195
|
emptyTitle: msg('No unacknowledged alerts'),
|
|
157
|
-
emptyDescription: msg(
|
|
158
|
-
"Go to the 'Alert list' for more details or to manage existing alerts."
|
|
159
|
-
),
|
|
160
196
|
emptyIcon: html`<obi-unacknowledged></obi-unacknowledged>`,
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
return (
|
|
164
|
-
item.getAttribute('status') ===
|
|
165
|
-
ObcAlertMenuItemStatus.Unacknowledged &&
|
|
166
|
-
!item.hasAttribute('shelved')
|
|
167
|
-
);
|
|
168
|
-
},
|
|
169
|
-
};
|
|
170
|
-
} else if (this._selectedTabIndex === 2) {
|
|
171
|
-
return {
|
|
172
|
-
name: 'shelved',
|
|
173
|
-
emptyTitle: msg('No shelved alerts'),
|
|
174
|
-
emptyDescription: msg(
|
|
175
|
-
"Go to the 'Alert list' for more details or to manage existing alerts."
|
|
176
|
-
),
|
|
177
|
-
emptyIcon: html`<obi-alerts-shelf></obi-alerts-shelf>`,
|
|
178
|
-
class: 'shelved',
|
|
179
|
-
filter: (item: HTMLElement) => {
|
|
180
|
-
return item.hasAttribute('shelved');
|
|
181
|
-
},
|
|
182
|
-
};
|
|
183
|
-
} else {
|
|
184
|
-
return {
|
|
197
|
+
},
|
|
198
|
+
{
|
|
185
199
|
name: 'all',
|
|
200
|
+
title: msg('Active'),
|
|
186
201
|
emptyTitle: msg('No active alerts'),
|
|
187
|
-
emptyDescription: msg(
|
|
188
|
-
"Go to the 'Alert list' for more details or to manage existing alerts."
|
|
189
|
-
),
|
|
190
202
|
emptyIcon: html`<obi-alerts></obi-alerts>`,
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
203
|
+
},
|
|
204
|
+
];
|
|
205
|
+
if (this.hasShelved) {
|
|
206
|
+
tabs.push({
|
|
207
|
+
name: 'shelved',
|
|
208
|
+
title: msg('Shelved'),
|
|
209
|
+
emptyTitle: msg('No shelved alerts'),
|
|
210
|
+
emptyIcon: html`<obi-alerts-shelf></obi-alerts-shelf>`,
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
return tabs;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/** Where the selected tab sits in `tabs`: the one the user picked, else the second. */
|
|
217
|
+
private selectedTabIndex(tabs: AlertMenuTab[]): number {
|
|
218
|
+
const index = tabs.findIndex((tab) => tab.name === this._selectedTabName);
|
|
219
|
+
return index === -1 ? 1 : index;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
private get selectedTab(): AlertMenuTab {
|
|
223
|
+
const tabs = this.tabs;
|
|
224
|
+
return tabs[this.selectedTabIndex(tabs)];
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* The list that shows the selected tab's items. The CSS hides the items the
|
|
229
|
+
* tab leaves out; the filter tells the list which ones those are.
|
|
230
|
+
*/
|
|
231
|
+
protected renderList(
|
|
232
|
+
tab: AlertMenuTab,
|
|
233
|
+
content: TemplateResult
|
|
234
|
+
): TemplateResult {
|
|
235
|
+
return html`<obc-alert-list
|
|
236
|
+
class="alert-list ${tab.name}"
|
|
237
|
+
.filter=${(item: HTMLElement) => this.tabFilter(tab.name, item)}
|
|
238
|
+
>${content}</obc-alert-list
|
|
239
|
+
>`;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
private tabFilter(name: string, item: HTMLElement): boolean {
|
|
243
|
+
const status = item.getAttribute('status') ?? '';
|
|
244
|
+
if (name === 'unacked') {
|
|
245
|
+
return WAITING_FOR_ACK.includes(status) && !item.hasAttribute('shelved');
|
|
246
|
+
}
|
|
247
|
+
if (name === 'shelved') {
|
|
248
|
+
return item.hasAttribute('shelved');
|
|
196
249
|
}
|
|
250
|
+
return (
|
|
251
|
+
!item.hasAttribute('shelved') &&
|
|
252
|
+
status !== ObcAlertMenuItemStatus.RectifiedUnacknowledged
|
|
253
|
+
);
|
|
197
254
|
}
|
|
198
255
|
|
|
199
256
|
override render() {
|
|
200
|
-
const
|
|
257
|
+
const tabs = this.tabs;
|
|
258
|
+
const selectedIndex = this.selectedTabIndex(tabs);
|
|
259
|
+
const t = tabs[selectedIndex];
|
|
201
260
|
|
|
202
261
|
return html`
|
|
203
262
|
<obc-tabbed-card
|
|
204
|
-
.nTabs=${
|
|
263
|
+
.nTabs=${tabs.length}
|
|
205
264
|
class="wrapper"
|
|
206
265
|
part="wrapper"
|
|
207
|
-
.selectedTab=${
|
|
266
|
+
.selectedTab=${selectedIndex}
|
|
208
267
|
hasDefaultSlotOnly
|
|
209
268
|
@tab-change=${this.onTabChange}
|
|
210
269
|
>
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
? html`<span slot="tab-title-2">${msg('Shelved')}</span>`
|
|
216
|
-
: nothing
|
|
217
|
-
}
|
|
270
|
+
${tabs.map(
|
|
271
|
+
(tab, index) =>
|
|
272
|
+
html`<span slot="tab-title-${index}">${tab.title}</span>`
|
|
273
|
+
)}
|
|
218
274
|
<div class="container">
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
275
|
+
${this.renderList(
|
|
276
|
+
t,
|
|
277
|
+
html`<slot></slot>
|
|
278
|
+
<slot name="empty-${t.name}-title" slot="empty-title"
|
|
279
|
+
>${t.emptyTitle}</slot
|
|
280
|
+
>
|
|
281
|
+
<slot name="empty-${t.name}-description" slot="empty-description"
|
|
282
|
+
>${msg(
|
|
283
|
+
"Go to the 'Alert list' for more details or to manage existing alerts."
|
|
284
|
+
)}</slot
|
|
285
|
+
>
|
|
286
|
+
<slot name="empty-${t.name}-icon" slot="empty-icon"
|
|
287
|
+
>${t.emptyIcon}</slot
|
|
288
|
+
>`
|
|
289
|
+
)}
|
|
231
290
|
<div class="action">
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
291
|
+
${
|
|
292
|
+
this.offersAckAll
|
|
293
|
+
? html`<obc-button
|
|
294
|
+
variant="raised"
|
|
295
|
+
.disabled=${!this.canAckAll}
|
|
296
|
+
fullWidth
|
|
297
|
+
class="btn"
|
|
298
|
+
data-testid="ack-all-visible-button"
|
|
299
|
+
@click=${this.handleAckAllVisibleClick}
|
|
300
|
+
>
|
|
301
|
+
${msg('ACK visible')}
|
|
302
|
+
</obc-button>`
|
|
303
|
+
: nothing
|
|
304
|
+
}
|
|
242
305
|
${
|
|
243
306
|
this.showSilenceButton
|
|
244
307
|
? html`<obc-button
|
|
@@ -281,7 +344,7 @@ export class ObcAlertMenu extends LitElement {
|
|
|
281
344
|
`;
|
|
282
345
|
}
|
|
283
346
|
|
|
284
|
-
static override styles = unsafeCSS(compentStyle);
|
|
347
|
+
static override styles: CSSResultGroup = unsafeCSS(compentStyle);
|
|
285
348
|
}
|
|
286
349
|
|
|
287
350
|
declare global {
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import {describe, expect, it} from 'vitest';
|
|
2
|
+
import './alert-menu-item.js';
|
|
3
|
+
import {ObcAlertMenuItem, ObcAlertMenuItemStatus} from './alert-menu-item.js';
|
|
4
|
+
import type {ObcMessageMenuItem} from '../message-menu-item/message-menu-item.js';
|
|
5
|
+
|
|
6
|
+
async function renderItem(configure: (item: ObcAlertMenuItem) => void) {
|
|
7
|
+
const item = document.createElement('obc-alert-menu-item');
|
|
8
|
+
configure(item);
|
|
9
|
+
document.body.append(item);
|
|
10
|
+
await item.updateComplete;
|
|
11
|
+
const message = item.shadowRoot!.querySelector(
|
|
12
|
+
'obc-message-menu-item'
|
|
13
|
+
) as ObcMessageMenuItem;
|
|
14
|
+
return {item, message};
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
describe('obc-alert-menu-item', () => {
|
|
18
|
+
it.each([
|
|
19
|
+
[ObcAlertMenuItemStatus.Unacknowledged, 'ACK'],
|
|
20
|
+
[ObcAlertMenuItemStatus.RectifiedUnacknowledged, 'ACK'],
|
|
21
|
+
[ObcAlertMenuItemStatus.Acknowledged, ''],
|
|
22
|
+
[ObcAlertMenuItemStatus.Rectified, ''],
|
|
23
|
+
[ObcAlertMenuItemStatus.NoAckAlarm, ''],
|
|
24
|
+
])('status %s shows the ACK action %j', async (status, label) => {
|
|
25
|
+
const {item, message} = await renderItem((el) => (el.status = status));
|
|
26
|
+
expect(message.primaryActionLabel).toBe(label);
|
|
27
|
+
expect(message.hasTrailingIcon).toBe(label === '');
|
|
28
|
+
item.remove();
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it('reflects blocked, for menus that list blocked alerts apart', async () => {
|
|
32
|
+
const {item} = await renderItem((el) => (el.blocked = true));
|
|
33
|
+
expect(item.hasAttribute('blocked')).toBe(true);
|
|
34
|
+
item.blocked = false;
|
|
35
|
+
await item.updateComplete;
|
|
36
|
+
expect(item.hasAttribute('blocked')).toBe(false);
|
|
37
|
+
item.remove();
|
|
38
|
+
});
|
|
39
|
+
});
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
ObcAlertMenuItemActionState,
|
|
9
9
|
ObcAlertMenuItemStatus,
|
|
10
10
|
} from './alert-menu-item.js';
|
|
11
|
+
import {AlertType} from '../../types.js';
|
|
11
12
|
|
|
12
13
|
const meta: Meta<ObcAlertMenuItem> = {
|
|
13
14
|
title: 'Application Components/Alerts/Alert Menu Item',
|
|
@@ -127,6 +128,27 @@ export const NoAckWarning: Story = {
|
|
|
127
128
|
},
|
|
128
129
|
};
|
|
129
130
|
|
|
131
|
+
export const RectifiedUnacknowledged: Story = {
|
|
132
|
+
args: {
|
|
133
|
+
status: ObcAlertMenuItemStatus.RectifiedUnacknowledged,
|
|
134
|
+
},
|
|
135
|
+
render: (args) => html`
|
|
136
|
+
<obc-alert-menu-item
|
|
137
|
+
.title=${args.title}
|
|
138
|
+
.description=${args.description}
|
|
139
|
+
.time=${args.time}
|
|
140
|
+
.status=${args.status}
|
|
141
|
+
.primaryActionState=${args.primaryActionState}
|
|
142
|
+
>
|
|
143
|
+
<obc-alert-icon
|
|
144
|
+
slot="alert-icon"
|
|
145
|
+
.alertType=${AlertType.Alarm}
|
|
146
|
+
.active=${false}
|
|
147
|
+
></obc-alert-icon>
|
|
148
|
+
</obc-alert-menu-item>
|
|
149
|
+
`,
|
|
150
|
+
};
|
|
151
|
+
|
|
130
152
|
export const WithSecondaryAction: Story = {
|
|
131
153
|
args: {
|
|
132
154
|
secondaryActionLabel: 'Mute',
|
|
@@ -18,6 +18,7 @@ export enum ObcAlertMenuItemStatus {
|
|
|
18
18
|
NoAckAlarm = 'no-ack-alarm',
|
|
19
19
|
NoAckWarning = 'no-ack-warning',
|
|
20
20
|
Rectified = 'rectified',
|
|
21
|
+
RectifiedUnacknowledged = 'rectified-unacknowledged',
|
|
21
22
|
}
|
|
22
23
|
|
|
23
24
|
/**
|
|
@@ -40,12 +41,13 @@ export enum ObcAlertMenuItemActionState {
|
|
|
40
41
|
* ### Features
|
|
41
42
|
* - **Status Variants:** Supports multiple alert states via the `status` property:
|
|
42
43
|
* - **Unacknowledged:** Shows an action button (ACK) for user acknowledgment.
|
|
44
|
+
* - **RectifiedUnacknowledged:** The situation that raised the alert has cleared, but the alert still waits for acknowledgment, so the ACK action stays.
|
|
43
45
|
* - **Caution, Acknowledged, Rectified:** Display different visual cues for alert progression.
|
|
44
46
|
* - **NoAckAlarm / NoAckWarning:** Show special icons indicating unacknowledged alarms or warnings.
|
|
45
47
|
* - **Icon Support:** Optional secondary icon (e.g., system or source) and a primary alert icon. Tertiary "shelved" icon appears if the alert is shelved.
|
|
46
48
|
* - **Time and Day Display:** Optionally shows day and/or time for the alert occurrence.
|
|
47
49
|
* - **Expandable:** Can be toggled open/closed for additional details (via click).
|
|
48
|
-
* - **Action Buttons:** Displays an "ACK" button for unacknowledged
|
|
50
|
+
* - **Action Buttons:** Displays an "ACK" button for the statuses that still wait for acknowledgment (`unacknowledged` and `rectified-unacknowledged`) and an optional secondary action (label set via `secondaryActionLabel`); each triggers an event when clicked.
|
|
49
51
|
* - Each action's appearance is controlled independently via `primaryActionState` / `secondaryActionState` (`enabled`, `disabled`, or `none`).
|
|
50
52
|
* - **Animated Intro:** Optional animation when the item appears.
|
|
51
53
|
* - **Size Options:** Supports single-line or multi-line layouts (see `size` property).
|
|
@@ -59,7 +61,9 @@ export enum ObcAlertMenuItemActionState {
|
|
|
59
61
|
* - Only show the "ACK" action for alerts that require acknowledgment.
|
|
60
62
|
* - Provide `secondaryActionLabel` to add a second action alongside ACK.
|
|
61
63
|
* - Use `primaryActionState` / `secondaryActionState` to temporarily disable an action (`disabled`) or remove it without leaving a gap (`none`).
|
|
62
|
-
* - Use the `shelved` property to indicate alerts that are temporarily deferred.
|
|
64
|
+
* - Use the `shelved` property to indicate alerts that are temporarily deferred, and `blocked` for alerts another system has set aside. The alert menus sort items into their tabs by `status` and `shelved`; `blocked` is there for menus that list blocked alerts apart.
|
|
65
|
+
*
|
|
66
|
+
* **TODO(designer):** Should a blocked alert show a marker, as a shelved one shows the shelf icon?
|
|
63
67
|
*
|
|
64
68
|
* ### Slots
|
|
65
69
|
* | Slot Name | Renders When... | Purpose |
|
|
@@ -99,13 +103,16 @@ export enum ObcAlertMenuItemActionState {
|
|
|
99
103
|
* When true, the `icon` slot is rendered.
|
|
100
104
|
* @property shelved - Indicates if the alert is shelved (temporarily deferred).
|
|
101
105
|
* When true, a tertiary icon is shown to represent the shelved state.
|
|
106
|
+
* @property blocked - Indicates that another system has blocked the alert as not relevant here.
|
|
107
|
+
* For menus that list blocked alerts apart; the item itself shows no marker for it yet.
|
|
102
108
|
* @property title - The title of the alert.
|
|
103
109
|
* @property description - The description of the alert.
|
|
104
110
|
* @property day - The day label for the alert (e.g., "Yesterday").
|
|
105
111
|
* @property time - The time label for the alert (e.g., "14:30").
|
|
106
112
|
* @property status - The current status of the alert item.
|
|
107
113
|
* Determines visual style, icon, and action button visibility.
|
|
108
|
-
* Possible values: 'unacknowledged', 'caution', 'acknowledged', 'no-ack-alarm', 'no-ack-warning', 'rectified'.
|
|
114
|
+
* Possible values: 'unacknowledged', 'caution', 'acknowledged', 'no-ack-alarm', 'no-ack-warning', 'rectified', 'rectified-unacknowledged'.
|
|
115
|
+
* 'unacknowledged' and 'rectified-unacknowledged' show the ACK action; the other values show a trailing icon instead.
|
|
109
116
|
* Default is 'unacknowledged'.
|
|
110
117
|
* @property open - Whether the item is expanded/open to show additional details.
|
|
111
118
|
* Toggled by clicking the item.
|
|
@@ -139,6 +146,8 @@ export class ObcAlertMenuItem extends LitElement {
|
|
|
139
146
|
|
|
140
147
|
@property({type: Boolean, reflect: true}) shelved = false;
|
|
141
148
|
|
|
149
|
+
@property({type: Boolean, reflect: true}) blocked = false;
|
|
150
|
+
|
|
142
151
|
@property({type: String}) override title = '';
|
|
143
152
|
|
|
144
153
|
@property({type: String}) description = '';
|
|
@@ -165,11 +174,18 @@ export class ObcAlertMenuItem extends LitElement {
|
|
|
165
174
|
@property({type: String}) secondaryActionState: ObcAlertMenuItemActionState =
|
|
166
175
|
ObcAlertMenuItemActionState.None;
|
|
167
176
|
|
|
177
|
+
private get canAck() {
|
|
178
|
+
return (
|
|
179
|
+
this.status === ObcAlertMenuItemStatus.Unacknowledged ||
|
|
180
|
+
this.status === ObcAlertMenuItemStatus.RectifiedUnacknowledged
|
|
181
|
+
);
|
|
182
|
+
}
|
|
183
|
+
|
|
168
184
|
private get primaryActionLabel() {
|
|
169
185
|
if (this.primaryActionState === ObcAlertMenuItemActionState.None) {
|
|
170
186
|
return '';
|
|
171
187
|
}
|
|
172
|
-
return this.
|
|
188
|
+
return this.canAck ? 'ACK' : '';
|
|
173
189
|
}
|
|
174
190
|
|
|
175
191
|
private get secondaryActionLabelToShow() {
|
|
@@ -189,7 +205,7 @@ export class ObcAlertMenuItem extends LitElement {
|
|
|
189
205
|
|
|
190
206
|
private get hasTrailingIcon() {
|
|
191
207
|
// True when we need the action container but don't have an ACK button
|
|
192
|
-
return this.
|
|
208
|
+
return !this.canAck;
|
|
193
209
|
}
|
|
194
210
|
|
|
195
211
|
private handleMessageClick(event: Event) {
|
|
@@ -265,6 +281,6 @@ export class ObcAlertMenuItem extends LitElement {
|
|
|
265
281
|
|
|
266
282
|
declare global {
|
|
267
283
|
interface HTMLElementTagNameMap {
|
|
268
|
-
'
|
|
284
|
+
'obc-alert-menu-item': ObcAlertMenuItem;
|
|
269
285
|
}
|
|
270
286
|
}
|
|
@@ -59,12 +59,18 @@
|
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
.wrapper.align-center .value-input {
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
field-sizing: content; /* the unit hugs the value */
|
|
63
|
+
width: auto;
|
|
64
64
|
text-align: right;
|
|
65
65
|
flex: 0 0 auto;
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
+
@supports not (field-sizing: content) {
|
|
69
|
+
.wrapper.align-center .value-input {
|
|
70
|
+
flex: 1 1 auto; /* the 20-character default width would push the value out of a narrow field */
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
68
74
|
.wrapper.align-right .label-container,
|
|
69
75
|
.wrapper.align-right-unit-outside .label-container {
|
|
70
76
|
justify-content: flex-end;
|