@oicl/openbridge-webcomponents-full-bundle 2.0.0-next.63 → 2.0.0-next.65
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/bundle/openbridge-webcomponents.bundle.js +392 -381
- package/bundle/openbridge-webcomponents.bundle.js.map +1 -1
- package/custom-elements.json +57 -199
- package/dist/alert-severity.d.ts.map +1 -1
- package/dist/alert-severity.js +37 -35
- package/dist/alert-severity.js.map +1 -1
- package/dist/ar/building-blocks/poi-header/poi-header.css.js +15 -15
- package/dist/ar/building-blocks/poi-header/poi-header.d.ts +6 -6
- package/dist/ar/building-blocks/poi-header/poi-header.d.ts.map +1 -1
- package/dist/ar/building-blocks/poi-header/poi-header.js +5 -5
- package/dist/ar/building-blocks/poi-header/poi-header.js.map +1 -1
- package/dist/ar/poi-button/poi-button.css.js +31 -30
- package/dist/ar/poi-button/poi-button.css.js.map +1 -1
- package/dist/ar/poi-button/poi-button.d.ts +6 -6
- package/dist/ar/poi-button/poi-button.d.ts.map +1 -1
- package/dist/ar/poi-button/poi-button.js +15 -15
- package/dist/ar/poi-button/poi-button.js.map +1 -1
- package/dist/ar/types.d.ts +5 -5
- package/dist/ar/types.d.ts.map +1 -1
- package/dist/ar/types.js +5 -5
- package/dist/ar/types.js.map +1 -1
- package/dist/automation/automation-badge/automation-badge.d.ts +7 -7
- package/dist/automation/automation-badge/automation-badge.d.ts.map +1 -1
- package/dist/automation/automation-badge/automation-badge.js +29 -29
- package/dist/automation/automation-badge/automation-badge.js.map +1 -1
- package/dist/automation/automation-button/abstract-automation-button.d.ts +5 -5
- package/dist/automation/automation-button/abstract-automation-button.d.ts.map +1 -1
- package/dist/automation/automation-button/abstract-automation-button.js +15 -15
- package/dist/automation/automation-button/abstract-automation-button.js.map +1 -1
- package/dist/automation/automation-tank/automation-tank.js +10 -10
- package/dist/automation/automation-tank/automation-tank.js.map +1 -1
- package/dist/components/accordion-card/accordion-card.css.js +5 -5
- package/dist/components/alert-button/alert-button.css.js +128 -128
- package/dist/components/alert-frame/alert-frame.css.js +6 -6
- package/dist/components/alert-frame/alert-frame.d.ts +4 -4
- package/dist/components/alert-frame/alert-frame.js.map +1 -1
- package/dist/components/alert-icon/alert-icon.js +4 -4
- package/dist/components/alert-icon/alert-icon.js.map +1 -1
- package/dist/components/badge/badge.css.js +10 -10
- package/dist/components/badge/badge.d.ts +13 -13
- package/dist/components/badge/badge.d.ts.map +1 -1
- package/dist/components/badge/badge.js +10 -10
- package/dist/components/badge/badge.js.map +1 -1
- package/dist/components/navigation-item/navigation-item.d.ts +7 -7
- package/dist/components/navigation-item/navigation-item.d.ts.map +1 -1
- package/dist/components/navigation-item/navigation-item.js +3 -15
- package/dist/components/navigation-item/navigation-item.js.map +1 -1
- package/dist/components/navigation-item-group/navigation-item-group.d.ts +8 -7
- package/dist/components/navigation-item-group/navigation-item-group.d.ts.map +1 -1
- package/dist/components/navigation-item-group/navigation-item-group.js +3 -15
- package/dist/components/navigation-item-group/navigation-item-group.js.map +1 -1
- package/dist/components/navigation-menu/navigation-menu.d.ts +2 -2
- package/dist/components/navigation-menu/navigation-menu.js.map +1 -1
- package/dist/components/tree-navigation-group/tree-navigation-group.d.ts +10 -10
- package/dist/components/tree-navigation-group/tree-navigation-group.d.ts.map +1 -1
- package/dist/components/tree-navigation-group/tree-navigation-group.js +3 -15
- package/dist/components/tree-navigation-group/tree-navigation-group.js.map +1 -1
- package/dist/components/tree-navigation-item/tree-navigation-item.css.js +13 -0
- package/dist/components/tree-navigation-item/tree-navigation-item.css.js.map +1 -1
- package/dist/components/tree-navigation-item/tree-navigation-item.d.ts +59 -8
- package/dist/components/tree-navigation-item/tree-navigation-item.d.ts.map +1 -1
- package/dist/components/tree-navigation-item/tree-navigation-item.js +46 -17
- package/dist/components/tree-navigation-item/tree-navigation-item.js.map +1 -1
- package/dist/manual-icon/icon-alerts-critical-twotone.d.ts +1 -1
- package/dist/manual-icon/icon-alerts-critical-twotone.js.map +1 -1
- package/dist/manual-icon/icon-alerts-diagnostic-twotone.d.ts +1 -1
- package/dist/manual-icon/icon-alerts-diagnostic-twotone.js.map +1 -1
- package/dist/types.d.ts +5 -5
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +11 -11
- package/dist/types.js.map +1 -1
- package/package.json +1 -1
- package/src/alert-severity.ts +43 -41
- package/src/ar/building-blocks/poi-header/poi-header.css +15 -15
- package/src/ar/building-blocks/poi-header/poi-header.ts +6 -6
- package/src/ar/poi-button/poi-button.css +31 -30
- package/src/ar/poi-button/poi-button.ts +16 -16
- package/src/ar/types.ts +5 -5
- package/src/automation/automation-badge/automation-badge.ts +22 -22
- package/src/automation/automation-button/abstract-automation-button.ts +15 -15
- package/src/automation/automation-tank/automation-tank.stories.ts +6 -6
- package/src/automation/automation-tank/automation-tank.ts +10 -10
- package/src/components/accordion-card/accordion-card.css +5 -5
- package/src/components/alert-button/alert-button.css +14 -14
- package/src/components/alert-button/alert-button.stories.ts +10 -10
- package/src/components/alert-frame/alert-frame.css +6 -6
- package/src/components/alert-frame/alert-frame.stories.ts +10 -10
- package/src/components/alert-frame/alert-frame.ts +4 -4
- package/src/components/alert-icon/alert-icon.stories.ts +10 -10
- package/src/components/alert-icon/alert-icon.ts +4 -4
- package/src/components/alert-list-details/alert-list-details.stories.ts +11 -11
- package/src/components/badge/badge.css +10 -10
- package/src/components/badge/badge.stories.ts +10 -10
- package/src/components/badge/badge.ts +18 -18
- package/src/components/navigation-item/navigation-item.ts +8 -12
- package/src/components/navigation-item-group/navigation-item-group.ts +9 -12
- package/src/components/navigation-menu/navigation-menu.stories.ts +34 -6
- package/src/components/navigation-menu/navigation-menu.ts +2 -2
- package/src/components/tree-navigation/tree-navigation.stories.ts +154 -9
- package/src/components/tree-navigation-group/tree-navigation-group.ts +11 -15
- package/src/components/tree-navigation-item/tree-navigation-item.css +12 -0
- package/src/components/tree-navigation-item/tree-navigation-item.stories.ts +38 -15
- package/src/components/tree-navigation-item/tree-navigation-item.ts +98 -17
- package/src/manual-icon/icon-alerts-critical-twotone.ts +1 -1
- package/src/manual-icon/icon-alerts-diagnostic-twotone.ts +1 -1
- package/src/navigation-instruments/readout/readout.stories.ts +2 -2
- package/src/navigation-instruments/readout-list-item/readout-list-item.stories.ts +4 -4
- package/src/types.ts +10 -10
|
@@ -7,8 +7,8 @@ import {
|
|
|
7
7
|
TreeBranchType,
|
|
8
8
|
TreeTerminalType,
|
|
9
9
|
} from '../tree-navigation-item/tree-navigation-item.js';
|
|
10
|
+
import type {TreeNavigationItemAlerts} from '../tree-navigation-item/tree-navigation-item.js';
|
|
10
11
|
import '../tree-navigation-item/tree-navigation-item.js';
|
|
11
|
-
import {BadgeType} from '../badge/badge.js';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* `<obc-tree-navigation-group>` – An expandable parent row in a tree-navigation
|
|
@@ -16,7 +16,7 @@ import {BadgeType} from '../badge/badge.js';
|
|
|
16
16
|
* child rows it discloses.
|
|
17
17
|
*
|
|
18
18
|
* A group renders an `<obc-tree-navigation-item>` header (carrying its own label,
|
|
19
|
-
* icon, terminal type, and alert
|
|
19
|
+
* icon, terminal type, and alert badges) followed by its slotted children. When
|
|
20
20
|
* placed inside `<obc-tree-navigation>`, the container computes and assigns the
|
|
21
21
|
* `branches` guide lines for every row automatically from each row's position —
|
|
22
22
|
* a group does not need its depth configured by hand.
|
|
@@ -29,8 +29,7 @@ import {BadgeType} from '../badge/badge.js';
|
|
|
29
29
|
* - **Disclosure:** A chevron in the header toggles the slotted children. The open
|
|
30
30
|
* state is held in `expanded` and reflected so the container and CSS can react.
|
|
31
31
|
* - **Header presentation:** `label`, the `icon` slot, `terminalType`, and the
|
|
32
|
-
*
|
|
33
|
-
* header row.
|
|
32
|
+
* `alerts` count map are forwarded to the header row.
|
|
34
33
|
* - **Selection:** `checked` marks the group's header as the current item.
|
|
35
34
|
* - **Automatic guides:** Inside `<obc-tree-navigation>`, the header's `branches`
|
|
36
35
|
* are assigned by the container; nested groups continue the guide columns down.
|
|
@@ -83,14 +82,13 @@ export class ObcTreeNavigationGroup extends LitElement {
|
|
|
83
82
|
*/
|
|
84
83
|
@property({type: String}) terminalType: string = TreeTerminalType.regular;
|
|
85
84
|
|
|
86
|
-
/**
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
@property({type: String}) alertType: string = BadgeType.alarm;
|
|
85
|
+
/**
|
|
86
|
+
* Per-severity alert counts shown as trailing badge(s) on the header row.
|
|
87
|
+
* Forwarded verbatim to the header `<obc-tree-navigation-item>` — typically a
|
|
88
|
+
* group sets `{aggregate: true, ...}` so its header shows one badge totalling
|
|
89
|
+
* the alerts of the rows beneath it. See {@link TreeNavigationItemAlerts}.
|
|
90
|
+
*/
|
|
91
|
+
@property({type: Object}) alerts?: TreeNavigationItemAlerts;
|
|
94
92
|
|
|
95
93
|
/**
|
|
96
94
|
* The URL to navigate to when the header is activated. If set, the header row
|
|
@@ -131,9 +129,7 @@ export class ObcTreeNavigationGroup extends LitElement {
|
|
|
131
129
|
?disabled=${this.disabled}
|
|
132
130
|
.hasLeadingIcon=${this.hasIcon}
|
|
133
131
|
.terminalType=${this.terminalType}
|
|
134
|
-
|
|
135
|
-
.alertCount=${this.alertCount}
|
|
136
|
-
.alertType=${this.alertType}
|
|
132
|
+
.alerts=${this.expanded ? undefined : this.alerts}
|
|
137
133
|
.href=${this.href}
|
|
138
134
|
@expand-toggle=${this.onHeaderToggle}
|
|
139
135
|
>
|
|
@@ -253,6 +253,18 @@
|
|
|
253
253
|
min-width: 0;
|
|
254
254
|
}
|
|
255
255
|
|
|
256
|
+
/*
|
|
257
|
+
* Trailing badge area. A row can carry more than one alert badge (e.g. a
|
|
258
|
+
* critical count beside a warning count); they sit in a flex row spaced by the
|
|
259
|
+
* shared alert-counter spacing token.
|
|
260
|
+
*/
|
|
261
|
+
.alert-badges {
|
|
262
|
+
flex-shrink: 0;
|
|
263
|
+
display: flex;
|
|
264
|
+
align-items: center;
|
|
265
|
+
gap: var(--app-components-alert-counter-item-badge-spacing);
|
|
266
|
+
}
|
|
267
|
+
|
|
256
268
|
.alert-badge {
|
|
257
269
|
flex-shrink: 0;
|
|
258
270
|
}
|
|
@@ -7,7 +7,6 @@ import {
|
|
|
7
7
|
import './tree-navigation-item.js';
|
|
8
8
|
import {iconIds, iconIdToIconHtml} from '../../storybook-util.js';
|
|
9
9
|
import {html} from 'lit';
|
|
10
|
-
import {BadgeType} from '../badge/badge.js';
|
|
11
10
|
|
|
12
11
|
const meta: Meta<typeof ObcTreeNavigationItem> = {
|
|
13
12
|
title: 'UI Components/Menus and Navigation/Tree Navigation Item',
|
|
@@ -23,9 +22,7 @@ const meta: Meta<typeof ObcTreeNavigationItem> = {
|
|
|
23
22
|
disabled: false,
|
|
24
23
|
hasLeadingIcon: true,
|
|
25
24
|
terminalType: TreeTerminalType.regular,
|
|
26
|
-
|
|
27
|
-
alertCount: 9,
|
|
28
|
-
alertType: BadgeType.alarm,
|
|
25
|
+
alerts: undefined,
|
|
29
26
|
},
|
|
30
27
|
argTypes: {
|
|
31
28
|
icon: {
|
|
@@ -43,13 +40,7 @@ const meta: Meta<typeof ObcTreeNavigationItem> = {
|
|
|
43
40
|
control: {type: 'select'},
|
|
44
41
|
options: Object.values(TreeTerminalType),
|
|
45
42
|
},
|
|
46
|
-
|
|
47
|
-
alertCount: {control: {type: 'number'}},
|
|
48
|
-
alertType: {
|
|
49
|
-
control: {type: 'select'},
|
|
50
|
-
options: Object.values(BadgeType),
|
|
51
|
-
if: {arg: 'hasAlertBadge'},
|
|
52
|
-
},
|
|
43
|
+
alerts: {control: {type: 'object'}},
|
|
53
44
|
},
|
|
54
45
|
render: (args) => {
|
|
55
46
|
return html`<obc-tree-navigation-item
|
|
@@ -61,9 +52,7 @@ const meta: Meta<typeof ObcTreeNavigationItem> = {
|
|
|
61
52
|
?disabled=${args.disabled}
|
|
62
53
|
.hasLeadingIcon=${args.hasLeadingIcon}
|
|
63
54
|
.terminalType=${args.terminalType}
|
|
64
|
-
.
|
|
65
|
-
.alertCount=${args.alertCount}
|
|
66
|
-
.alertType=${args.alertType}
|
|
55
|
+
.alerts=${args.alerts}
|
|
67
56
|
@expand-toggle=${(e: CustomEvent<boolean>) => {
|
|
68
57
|
(e.currentTarget as ObcTreeNavigationItem).expanded = e.detail;
|
|
69
58
|
}}
|
|
@@ -106,8 +95,42 @@ export const IndentedNoConnectors: Story = {
|
|
|
106
95
|
args: {branches: [TreeBranchType.blank, TreeBranchType.blank]},
|
|
107
96
|
};
|
|
108
97
|
|
|
98
|
+
/** A single alert badge from one non-zero count in the `alerts` map. */
|
|
109
99
|
export const WithAlertBadge: Story = {
|
|
110
|
-
args: {
|
|
100
|
+
args: {alerts: {countLevelHigh: 9}},
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Several severities at once. With `aggregate` unset, each non-zero count
|
|
105
|
+
* renders its own badge, ordered most to least severe and spaced by
|
|
106
|
+
* `var(--app-components-alert-counter-item-badge-spacing)`.
|
|
107
|
+
*/
|
|
108
|
+
export const MultipleAlertBadges: Story = {
|
|
109
|
+
args: {
|
|
110
|
+
alerts: {
|
|
111
|
+
countLevelCritical: 1,
|
|
112
|
+
countLevelHigh: 3,
|
|
113
|
+
countLevelMedium: 12,
|
|
114
|
+
countLevelLow: 2,
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* The same counts as `MultipleAlertBadges`, but `aggregate: true` collapses them
|
|
121
|
+
* into one badge: the number is the combined total (18) and the style is the
|
|
122
|
+
* highest category present (level-critical).
|
|
123
|
+
*/
|
|
124
|
+
export const AggregatedAlertBadge: Story = {
|
|
125
|
+
args: {
|
|
126
|
+
alerts: {
|
|
127
|
+
aggregate: true,
|
|
128
|
+
countLevelCritical: 1,
|
|
129
|
+
countLevelHigh: 3,
|
|
130
|
+
countLevelMedium: 12,
|
|
131
|
+
countLevelLow: 2,
|
|
132
|
+
},
|
|
133
|
+
},
|
|
111
134
|
};
|
|
112
135
|
|
|
113
136
|
export const AggregatedHeader: Story = {
|
|
@@ -8,7 +8,7 @@ import '../../icons/icon-chevron-right-google.js';
|
|
|
8
8
|
import '../../icons/icon-alert-header-aggregated-iec.js';
|
|
9
9
|
import '../../icons/icon-alert-header-group-iec.js';
|
|
10
10
|
import '../badge/badge.js';
|
|
11
|
-
import {
|
|
11
|
+
import {AlertType, ALERT_SEVERITY_PRIORITY} from '../../types.js';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Guide line drawn for one indentation column. Normally computed by
|
|
@@ -42,6 +42,39 @@ export enum TreeTerminalType {
|
|
|
42
42
|
groupHeader = 'group-header',
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
+
/**
|
|
46
|
+
* Per-severity alert counts for a tree row's trailing badge(s). Each `count*`
|
|
47
|
+
* is the number of active alerts of that severity at or beneath the row — the
|
|
48
|
+
* level severities `level-critical`, `level-high`, `level-medium`, `level-low`,
|
|
49
|
+
* and `level-diagnostic`, plus the IEC severities `alarm`, `warning`, and
|
|
50
|
+
* `caution`. Badges are ordered and aggregated by the shared
|
|
51
|
+
* `ALERT_SEVERITY_PRIORITY` ranking, most to least severe.
|
|
52
|
+
*
|
|
53
|
+
* Set `aggregate` to collapse the counts into a single badge showing the total,
|
|
54
|
+
* styled as the highest category present; otherwise one badge is rendered per
|
|
55
|
+
* non-zero count.
|
|
56
|
+
*/
|
|
57
|
+
export interface TreeNavigationItemAlerts {
|
|
58
|
+
/** Collapse all counts into one badge: total count, highest-severity style. */
|
|
59
|
+
aggregate?: boolean;
|
|
60
|
+
/** Number of level-critical alerts. */
|
|
61
|
+
countLevelCritical?: number;
|
|
62
|
+
/** Number of alarm alerts. */
|
|
63
|
+
countAlarm?: number;
|
|
64
|
+
/** Number of level-high alerts. */
|
|
65
|
+
countLevelHigh?: number;
|
|
66
|
+
/** Number of warning alerts. */
|
|
67
|
+
countWarning?: number;
|
|
68
|
+
/** Number of level-medium alerts. */
|
|
69
|
+
countLevelMedium?: number;
|
|
70
|
+
/** Number of caution alerts. */
|
|
71
|
+
countCaution?: number;
|
|
72
|
+
/** Number of level-low alerts. */
|
|
73
|
+
countLevelLow?: number;
|
|
74
|
+
/** Number of level-diagnostic alerts. */
|
|
75
|
+
countLevelDiagnostic?: number;
|
|
76
|
+
}
|
|
77
|
+
|
|
45
78
|
/**
|
|
46
79
|
* `<obc-tree-navigation-item>` – A single row in a tree- or file-explorer-style
|
|
47
80
|
* navigation list, with indentation guide lines, an optional expand/collapse
|
|
@@ -66,8 +99,12 @@ export enum TreeTerminalType {
|
|
|
66
99
|
* aggregated or grouped alerts.
|
|
67
100
|
* - **Leading icon:** Provide an icon via the `icon` slot (shown when
|
|
68
101
|
* `hasLeadingIcon`).
|
|
69
|
-
* - **Alert
|
|
70
|
-
*
|
|
102
|
+
* - **Alert badges:** Trailing counter badges driven by the `alerts` object — a
|
|
103
|
+
* per-severity count map with one field per level severity (critical, high,
|
|
104
|
+
* medium, low, diagnostic). By default each non-zero count renders its own
|
|
105
|
+
* badge, ordered most to least severe by `ALERT_SEVERITY_PRIORITY`; set
|
|
106
|
+
* `alerts.aggregate` to instead show a single badge with the combined total,
|
|
107
|
+
* styled as the highest category present.
|
|
71
108
|
* - **Checked state:** `checked` highlights the current selection using the
|
|
72
109
|
* amplified elevation style. A checked row is the current item and is not
|
|
73
110
|
* re-selectable — it shows no hover/pressed feedback and fires no `click` or
|
|
@@ -142,14 +179,17 @@ export class ObcTreeNavigationItem extends LitElement {
|
|
|
142
179
|
*/
|
|
143
180
|
@property({type: String}) terminalType: string = TreeTerminalType.regular;
|
|
144
181
|
|
|
145
|
-
/**
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
182
|
+
/**
|
|
183
|
+
* Per-severity alert counts for the row's trailing badge(s). Omit (or leave
|
|
184
|
+
* every count at 0) for a row with no alerts. See {@link TreeNavigationItemAlerts}.
|
|
185
|
+
*
|
|
186
|
+
* - When `aggregate` is true, a single badge is shown: its number is the sum
|
|
187
|
+
* of all counts and its severity is the highest category present
|
|
188
|
+
* (critical → alarm → warning → caution).
|
|
189
|
+
* - Otherwise one badge is shown per count greater than 0, ordered most to
|
|
190
|
+
* least severe and spaced by the alert-counter spacing token.
|
|
191
|
+
*/
|
|
192
|
+
@property({type: Object}) alerts?: TreeNavigationItemAlerts;
|
|
153
193
|
|
|
154
194
|
/**
|
|
155
195
|
* The URL to navigate to when the row is activated. If set, the row renders as
|
|
@@ -164,6 +204,42 @@ export class ObcTreeNavigationItem extends LitElement {
|
|
|
164
204
|
this.wrapperElement?.focus(options);
|
|
165
205
|
}
|
|
166
206
|
|
|
207
|
+
/**
|
|
208
|
+
* The badge(s) to render from `alerts`, as `{type, count}` pairs already in
|
|
209
|
+
* severity order, ranked by `ALERT_SEVERITY_PRIORITY`.
|
|
210
|
+
*
|
|
211
|
+
* - No `alerts`, or every count 0 → no badges.
|
|
212
|
+
* - `aggregate` → a single pair: the summed count typed as the highest
|
|
213
|
+
* category that has any alerts.
|
|
214
|
+
* - Otherwise → one pair per count greater than 0.
|
|
215
|
+
*/
|
|
216
|
+
private get alertBadges(): {type: AlertType; count: number}[] {
|
|
217
|
+
const alerts = this.alerts;
|
|
218
|
+
if (!alerts) return [];
|
|
219
|
+
const countByType: Partial<Record<AlertType, number>> = {
|
|
220
|
+
[AlertType.LevelCritical]: alerts.countLevelCritical ?? 0,
|
|
221
|
+
[AlertType.Alarm]: alerts.countAlarm ?? 0,
|
|
222
|
+
[AlertType.LevelHigh]: alerts.countLevelHigh ?? 0,
|
|
223
|
+
[AlertType.Warning]: alerts.countWarning ?? 0,
|
|
224
|
+
[AlertType.LevelMedium]: alerts.countLevelMedium ?? 0,
|
|
225
|
+
[AlertType.Caution]: alerts.countCaution ?? 0,
|
|
226
|
+
[AlertType.LevelLow]: alerts.countLevelLow ?? 0,
|
|
227
|
+
[AlertType.LevelDiagnostic]: alerts.countLevelDiagnostic ?? 0,
|
|
228
|
+
};
|
|
229
|
+
// Order (and, when aggregating, rank) by the shared severity priority,
|
|
230
|
+
// keeping only the severities this component exposes.
|
|
231
|
+
const ranked = ALERT_SEVERITY_PRIORITY.filter(
|
|
232
|
+
(type) => type in countByType
|
|
233
|
+
).map((type) => ({type, count: countByType[type] ?? 0}));
|
|
234
|
+
if (alerts.aggregate) {
|
|
235
|
+
const total = ranked.reduce((sum, b) => sum + b.count, 0);
|
|
236
|
+
const highest = ranked.find((b) => b.count > 0);
|
|
237
|
+
if (!highest) return [];
|
|
238
|
+
return [{type: highest.type, count: total}];
|
|
239
|
+
}
|
|
240
|
+
return ranked.filter((b) => b.count > 0);
|
|
241
|
+
}
|
|
242
|
+
|
|
167
243
|
/** A root-level row has no ancestor columns, so it draws no connector lines. */
|
|
168
244
|
private get isRoot(): boolean {
|
|
169
245
|
return this.branches.length === 0;
|
|
@@ -283,12 +359,17 @@ export class ObcTreeNavigationItem extends LitElement {
|
|
|
283
359
|
: nothing}
|
|
284
360
|
<span part="label" class="label">${this.label}</span>
|
|
285
361
|
</div>
|
|
286
|
-
${this.
|
|
287
|
-
? html`<
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
362
|
+
${this.alertBadges.length > 0
|
|
363
|
+
? html`<div class="alert-badges">
|
|
364
|
+
${this.alertBadges.map(
|
|
365
|
+
(badge) =>
|
|
366
|
+
html`<obc-badge
|
|
367
|
+
class="alert-badge"
|
|
368
|
+
.type=${badge.type}
|
|
369
|
+
.number=${badge.count}
|
|
370
|
+
></obc-badge>`
|
|
371
|
+
)}
|
|
372
|
+
</div>`
|
|
292
373
|
: nothing}
|
|
293
374
|
</div>
|
|
294
375
|
</div>
|
|
@@ -3,7 +3,7 @@ import {property} from 'lit/decorators.js';
|
|
|
3
3
|
import {customElement} from '../decorator.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* `<obi-alerts-critical-twotone>` – Two-tone bell icon for the
|
|
6
|
+
* `<obi-alerts-critical-twotone>` – Two-tone bell icon for the level "critical" alert severity.
|
|
7
7
|
*
|
|
8
8
|
* Renders the alert (bell) glyph as a layered two-tone shape so the silhouette and
|
|
9
9
|
* fill can be tinted independently. Used wherever a critical-severity alert needs an
|
|
@@ -3,7 +3,7 @@ import {property} from 'lit/decorators.js';
|
|
|
3
3
|
import {customElement} from '../decorator.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* `<obi-alerts-diagnostic-twotone>` – Two-tone bell icon for the
|
|
6
|
+
* `<obi-alerts-diagnostic-twotone>` – Two-tone bell icon for the level "diagnostic" alert severity.
|
|
7
7
|
*
|
|
8
8
|
* Renders the alert (bell) glyph as a layered two-tone shape so the silhouette and
|
|
9
9
|
* fill can be tinted independently. Used wherever a diagnostic-severity alert needs an
|
|
@@ -293,13 +293,13 @@ export const Alarm: Story = {
|
|
|
293
293
|
render: (args) => renderComponent(args as ObcReadout),
|
|
294
294
|
};
|
|
295
295
|
|
|
296
|
-
export const
|
|
296
|
+
export const LevelCritical: Story = {
|
|
297
297
|
args: {
|
|
298
298
|
value: 42,
|
|
299
299
|
label: 'RPM',
|
|
300
300
|
unit: 'rpm',
|
|
301
301
|
alert: {
|
|
302
|
-
status: '
|
|
302
|
+
status: 'level-critical',
|
|
303
303
|
mode: 'unacked-active',
|
|
304
304
|
},
|
|
305
305
|
},
|
|
@@ -468,22 +468,22 @@ export const Alarm: Story = {
|
|
|
468
468
|
},
|
|
469
469
|
};
|
|
470
470
|
|
|
471
|
-
export const
|
|
471
|
+
export const LevelCritical: Story = {
|
|
472
472
|
args: {
|
|
473
473
|
value: 123,
|
|
474
474
|
alert: {
|
|
475
|
-
status: AlertType.
|
|
475
|
+
status: AlertType.LevelCritical,
|
|
476
476
|
mode: ObcAlertFrameMode.unackedActive,
|
|
477
477
|
type: ObcAlertFrameType.Regular,
|
|
478
478
|
},
|
|
479
479
|
},
|
|
480
480
|
};
|
|
481
481
|
|
|
482
|
-
export const
|
|
482
|
+
export const LevelLowUnackedRectified: Story = {
|
|
483
483
|
args: {
|
|
484
484
|
value: 123,
|
|
485
485
|
alert: {
|
|
486
|
-
status: AlertType.
|
|
486
|
+
status: AlertType.LevelLow,
|
|
487
487
|
mode: ObcAlertFrameMode.unackedRectified,
|
|
488
488
|
type: ObcAlertFrameType.Regular,
|
|
489
489
|
},
|
package/src/types.ts
CHANGED
|
@@ -9,22 +9,22 @@ export enum AlertType {
|
|
|
9
9
|
Alarm = 'alarm',
|
|
10
10
|
Warning = 'warning',
|
|
11
11
|
Caution = 'caution',
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
LevelCritical = 'level-critical',
|
|
13
|
+
LevelHigh = 'level-high',
|
|
14
|
+
LevelMedium = 'level-medium',
|
|
15
|
+
LevelLow = 'level-low',
|
|
16
|
+
LevelDiagnostic = 'level-diagnostic',
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
export const ALERT_SEVERITY_PRIORITY = [
|
|
20
|
-
AlertType.
|
|
20
|
+
AlertType.LevelCritical,
|
|
21
21
|
AlertType.Alarm,
|
|
22
|
-
AlertType.
|
|
22
|
+
AlertType.LevelHigh,
|
|
23
23
|
AlertType.Warning,
|
|
24
|
-
AlertType.
|
|
24
|
+
AlertType.LevelMedium,
|
|
25
25
|
AlertType.Caution,
|
|
26
|
-
AlertType.
|
|
27
|
-
AlertType.
|
|
26
|
+
AlertType.LevelLow,
|
|
27
|
+
AlertType.LevelDiagnostic,
|
|
28
28
|
];
|
|
29
29
|
|
|
30
30
|
export enum AlertCategory {
|