@molecule/app-status-summary-angular 0.0.0-stage → 1.1.0
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/LICENSE +202 -0
- package/README.md +362 -2
- package/dist/index.d.ts +62 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +62 -0
- package/dist/index.js.map +1 -0
- package/dist/status-summary.component.d.ts +106 -0
- package/dist/status-summary.component.d.ts.map +1 -0
- package/dist/status-summary.component.js +336 -0
- package/dist/status-summary.component.js.map +1 -0
- package/dist/types.d.ts +56 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +8 -0
- package/dist/types.js.map +1 -0
- package/package.json +69 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,3 +1,363 @@
|
|
|
1
|
-
|
|
1
|
+
<!--
|
|
2
|
+
AUTO-GENERATED — DO NOT EDIT THIS FILE.
|
|
3
|
+
Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
|
|
4
|
+
Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
|
|
5
|
+
To change this document, edit the module-level JSDoc in src/index.ts.
|
|
6
|
+
Generated: 2026-11-15T09:57:03.218Z
|
|
7
|
+
-->
|
|
2
8
|
|
|
3
|
-
|
|
9
|
+
# @molecule/app-status-summary-angular
|
|
10
|
+
|
|
11
|
+
Angular status-page summary — the counterpart of
|
|
12
|
+
`@molecule/app-status-summary-react`: the same props and the same DOM for
|
|
13
|
+
the same input.
|
|
14
|
+
|
|
15
|
+
Exports `<StatusSummary>` — a grouped component list with colored
|
|
16
|
+
operational / degraded / outage badges and an overall banner derived from
|
|
17
|
+
the worst child status — plus the `ComponentStatus`, `StatusComponent`,
|
|
18
|
+
`StatusGroup` and `StatusSummaryProps` types.
|
|
19
|
+
|
|
20
|
+
> **Auto-generated, AI-first package reference** for the [molecule.dev](https://molecule.dev) ecosystem.
|
|
21
|
+
> It is written to be read by coding agents as much as by people, and is generated from this
|
|
22
|
+
> package's source — edit `src/index.ts` JSDoc, not this file.
|
|
23
|
+
|
|
24
|
+
## Quick Start
|
|
25
|
+
|
|
26
|
+
```ts
|
|
27
|
+
import { Component } from '@angular/core'
|
|
28
|
+
import { StatusSummary } from '@molecule/app-status-summary-angular'
|
|
29
|
+
|
|
30
|
+
@Component({
|
|
31
|
+
selector: 'app-status-page',
|
|
32
|
+
standalone: true,
|
|
33
|
+
imports: [StatusSummary],
|
|
34
|
+
template: `
|
|
35
|
+
<div
|
|
36
|
+
mol-status-summary
|
|
37
|
+
[groups]="[
|
|
38
|
+
{
|
|
39
|
+
id: 'api',
|
|
40
|
+
name: 'API',
|
|
41
|
+
components: [
|
|
42
|
+
{ id: 'rest', name: 'REST API', status: 'operational' },
|
|
43
|
+
{ id: 'ws', name: 'WebSockets', status: 'degraded' },
|
|
44
|
+
],
|
|
45
|
+
},
|
|
46
|
+
]"
|
|
47
|
+
>
|
|
48
|
+
<span slot="header">Last updated: 2 min ago</span>
|
|
49
|
+
</div>
|
|
50
|
+
`,
|
|
51
|
+
})
|
|
52
|
+
export class StatusPage {}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Type
|
|
56
|
+
|
|
57
|
+
`feature`
|
|
58
|
+
|
|
59
|
+
## Installation
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
npm install @molecule/app-status-summary-angular @angular/common @angular/core @angular/platform-browser @molecule/app-angular @molecule/app-ui @molecule/app-ui-angular
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## API
|
|
66
|
+
|
|
67
|
+
### Interfaces
|
|
68
|
+
|
|
69
|
+
#### `StatusComponent`
|
|
70
|
+
|
|
71
|
+
A single monitored component with its current health status.
|
|
72
|
+
|
|
73
|
+
```typescript
|
|
74
|
+
interface StatusComponent {
|
|
75
|
+
/** Stable identifier, used as the rendered list key. */
|
|
76
|
+
id: string
|
|
77
|
+
/** Component name — text or an `ng-template` reference. */
|
|
78
|
+
name: StatusSummaryNode
|
|
79
|
+
/** Current health status. */
|
|
80
|
+
status: ComponentStatus
|
|
81
|
+
/** Optional sub-label (SLA %, region, etc.) — text or an `ng-template` reference. */
|
|
82
|
+
subtitle?: StatusSummaryNode
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
#### `StatusGroup`
|
|
87
|
+
|
|
88
|
+
A named group of related StatusComponent entries.
|
|
89
|
+
|
|
90
|
+
```typescript
|
|
91
|
+
interface StatusGroup {
|
|
92
|
+
/** Stable identifier, used as the rendered section key. */
|
|
93
|
+
id: string
|
|
94
|
+
/** Group name — text or an `ng-template` reference. */
|
|
95
|
+
name: StatusSummaryNode
|
|
96
|
+
/** The components in this group. */
|
|
97
|
+
components: StatusComponent[]
|
|
98
|
+
}
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
#### `StatusSummaryProps`
|
|
102
|
+
|
|
103
|
+
Props accepted by {@link StatusSummary} — the same props
|
|
104
|
+
`@molecule/app-status-summary-react` accepts. The node props (`header`,
|
|
105
|
+
`footer`) are projected content in Angular (an input cannot carry a node),
|
|
106
|
+
so they are typed `unknown`: pass them in the host template
|
|
107
|
+
(`[slot=header]` / `[slot=footer]`), not as values.
|
|
108
|
+
|
|
109
|
+
```typescript
|
|
110
|
+
interface StatusSummaryProps {
|
|
111
|
+
/** Grouped components. */
|
|
112
|
+
groups: StatusGroup[]
|
|
113
|
+
/** Overall summary label (auto-derived if omitted). */
|
|
114
|
+
overallStatus?: ComponentStatus
|
|
115
|
+
/** Header content (last updated time, subscribe button), projected as `[slot=header]`. */
|
|
116
|
+
header?: unknown
|
|
117
|
+
/** Below-the-grid content (incident list), projected as `[slot=footer]`. */
|
|
118
|
+
footer?: unknown
|
|
119
|
+
/** Extra classes. */
|
|
120
|
+
className?: string
|
|
121
|
+
}
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### Types
|
|
125
|
+
|
|
126
|
+
#### `ComponentStatus`
|
|
127
|
+
|
|
128
|
+
Union of possible component health states.
|
|
129
|
+
|
|
130
|
+
```typescript
|
|
131
|
+
type ComponentStatus =
|
|
132
|
+
'operational' | 'degraded' | 'partial-outage' | 'major-outage' | 'maintenance'
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### Classes
|
|
136
|
+
|
|
137
|
+
#### `StatusSummary`
|
|
138
|
+
|
|
139
|
+
StatusSummary component.
|
|
140
|
+
|
|
141
|
+
Status-page summary — grouped component list with colored badges and an
|
|
142
|
+
overall banner derived from the worst child status. The host IS the outer
|
|
143
|
+
`<div>` (`div[mol-status-summary]`), matching React's root exactly. The
|
|
144
|
+
header and footer are projected content (`[slot=header]`, `[slot=footer]`)
|
|
145
|
+
so consumers retain full control over the banner stamp and the incident
|
|
146
|
+
list. Node-valued group / component names are `ng-template` references
|
|
147
|
+
rendered through `NgTemplateOutlet`; text fields render as text.
|
|
148
|
+
|
|
149
|
+
```typescript
|
|
150
|
+
@Component({
|
|
151
|
+
selector: 'div[mol-status-summary]',
|
|
152
|
+
standalone: true,
|
|
153
|
+
imports: [NgTemplateOutlet],
|
|
154
|
+
inputs: ['groups', 'overallStatus', 'className'],
|
|
155
|
+
host: {
|
|
156
|
+
'[class]': 'classes()',
|
|
157
|
+
},
|
|
158
|
+
// prettier-ignore
|
|
159
|
+
template: `<div [class]="bannerClasses()" [style]="bannerStyle()"><span [class]="labelClasses()">{{ overallLabel() }}</span><ng-content select="[slot=header]"></ng-content></div>@for (group of groups; track group.id) {<section [class]="sectionClasses()"><h3 [class]="groupNameClasses()">@if (isNode(group.name)) {<ng-container [ngTemplateOutlet]="group.name" />}@else {<ng-container>{{ textOf(group.name) }}</ng-container>}</h3><ul [class]="listClasses()">@for (component of group.components; track component.id) {<li [class]="rowClasses()"><div><span [class]="componentNameClasses()">@if (isNode(component.name)) {<ng-container [ngTemplateOutlet]="component.name" />}@else {<ng-container>{{ textOf(component.name) }}</ng-container>}</span>@if (component.subtitle) {<span [class]="subtitleClasses()">@if (isNode(component.subtitle)) {<ng-container [ngTemplateOutlet]="component.subtitle" />}@else {<ng-container>{{ textOf(component.subtitle) }}</ng-container>}</span>}</div><span [class]="badgeClasses()" [style]="badgeStyle(component.status)">{{ statusLabel(component.status) }}</span></li>}</ul></section>}<ng-content select="[slot=footer]"></ng-content>`,
|
|
160
|
+
})
|
|
161
|
+
export class StatusSummary {
|
|
162
|
+
/** Grouped components. */
|
|
163
|
+
groups: StatusGroup[] = []
|
|
164
|
+
/** Overall summary label (auto-derived at read time when omitted). */
|
|
165
|
+
overallStatus?: ComponentStatus
|
|
166
|
+
/** Extra classes on the outer `<div>`. */
|
|
167
|
+
className?: string
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Reactive translation, read in the injection context. Its `t` reads the
|
|
171
|
+
* locale, so every label re-renders on a locale switch.
|
|
172
|
+
*/
|
|
173
|
+
private readonly i18n = useTranslation()
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* The current class map.
|
|
177
|
+
* @returns The UIClassMap.
|
|
178
|
+
*/
|
|
179
|
+
cm(): UIClassMap {
|
|
180
|
+
return getClassMap()
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* The wrapper's class list (`cm.stack(4)` + `className`).
|
|
185
|
+
* @returns The class string.
|
|
186
|
+
*/
|
|
187
|
+
classes(): string {
|
|
188
|
+
const cm = this.cm()
|
|
189
|
+
return cm.cn(cm.stack(4), this.className)
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* The banner's class list (flex row + padding).
|
|
194
|
+
* @returns The class string.
|
|
195
|
+
*/
|
|
196
|
+
bannerClasses(): string {
|
|
197
|
+
const cm = this.cm()
|
|
198
|
+
return cm.cn(cm.flex({ align: 'center', justify: 'between', gap: 'md' }), cm.sp('p', 3))
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/** The banner label's class list. */
|
|
202
|
+
labelClasses(): string {
|
|
203
|
+
const cm = this.cm()
|
|
204
|
+
return cm.cn(cm.textSize('lg'), cm.fontWeight('bold'))
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/** One group section's class list (`cm.stack(2)`). */
|
|
208
|
+
sectionClasses(): string {
|
|
209
|
+
return this.cm().stack(2)
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/** One group heading's class list. */
|
|
213
|
+
groupNameClasses(): string {
|
|
214
|
+
const cm = this.cm()
|
|
215
|
+
return cm.cn(cm.textSize('sm'), cm.fontWeight('semibold'))
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/** The component list's class list (`cm.stack(1)`). */
|
|
219
|
+
listClasses(): string {
|
|
220
|
+
return this.cm().stack(1)
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/** One component row's class list (flex row, space between). */
|
|
224
|
+
rowClasses(): string {
|
|
225
|
+
const cm = this.cm()
|
|
226
|
+
return cm.flex({ align: 'center', justify: 'between', gap: 'sm' })
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/** One component name's class list. */
|
|
230
|
+
componentNameClasses(): string {
|
|
231
|
+
const cm = this.cm()
|
|
232
|
+
return cm.cn(cm.textSize('sm'), cm.fontWeight('medium'))
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
/** One component subtitle's class list. */
|
|
236
|
+
subtitleClasses(): string {
|
|
237
|
+
const cm = this.cm()
|
|
238
|
+
return cm.cn(cm.sp('ml', 2), cm.textSize('xs'))
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
/** One status badge's class list. */
|
|
242
|
+
badgeClasses(): string {
|
|
243
|
+
const cm = this.cm()
|
|
244
|
+
return cm.cn(cm.sp('px', 2), cm.textSize('xs'), cm.fontWeight('semibold'))
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* Every component status in the summary, in render order.
|
|
249
|
+
* @returns The statuses.
|
|
250
|
+
*/
|
|
251
|
+
allStatuses(): ComponentStatus[] {
|
|
252
|
+
return this.groups.flatMap((group) => group.components.map((component) => component.status))
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* The banner's status: React's `overallStatus ?? worst(allStatuses)`.
|
|
257
|
+
* @returns The overall status.
|
|
258
|
+
*/
|
|
259
|
+
overall(): ComponentStatus {
|
|
260
|
+
if (this.overallStatus) return this.overallStatus
|
|
261
|
+
const statuses = this.allStatuses()
|
|
262
|
+
for (const status of SEVERITY_ORDER) {
|
|
263
|
+
if (statuses.includes(status)) return status
|
|
264
|
+
}
|
|
265
|
+
return 'operational'
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* The banner label, translated through the status key with React's fallback.
|
|
270
|
+
* @returns The label text.
|
|
271
|
+
*/
|
|
272
|
+
overallLabel(): string {
|
|
273
|
+
const status = this.overall()
|
|
274
|
+
return this.i18n.t(`status.${status}`, {}, { defaultValue: STATUS_LABEL[status] })
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* One badge's label, translated through the status key with React's fallback.
|
|
279
|
+
* @param status - The component's status.
|
|
280
|
+
* @returns The label text.
|
|
281
|
+
*/
|
|
282
|
+
statusLabel(status: ComponentStatus): string {
|
|
283
|
+
return this.i18n.t(`status.${status}`, {}, { defaultValue: STATUS_LABEL[status] })
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* The banner's inline style, in React's declaration order.
|
|
288
|
+
* @returns The style declarations.
|
|
289
|
+
*/
|
|
290
|
+
bannerStyle(): Record<string, string> {
|
|
291
|
+
return {
|
|
292
|
+
background: STATUS_COLOR[this.overall()],
|
|
293
|
+
color: '#fff',
|
|
294
|
+
borderRadius: '8px',
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* One badge's inline style, in React's declaration order.
|
|
300
|
+
* @param status - The component's status.
|
|
301
|
+
* @returns The style declarations.
|
|
302
|
+
*/
|
|
303
|
+
badgeStyle(status: ComponentStatus): Record<string, string> {
|
|
304
|
+
return { borderRadius: '4px', background: STATUS_COLOR[status], color: '#fff' }
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
/**
|
|
308
|
+
* Whether a field holds a node (an `ng-template` reference) rather than text.
|
|
309
|
+
* @param value - The group or component field.
|
|
310
|
+
* @returns True when it renders through a template outlet.
|
|
311
|
+
*/
|
|
312
|
+
isNode(value: unknown): value is TemplateRef<unknown> {
|
|
313
|
+
return value instanceof TemplateRef
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
/**
|
|
317
|
+
* The text a field renders (React renders strings and numbers as text).
|
|
318
|
+
* @param value - The group or component field.
|
|
319
|
+
* @returns The text, or `''` for a node field.
|
|
320
|
+
*/
|
|
321
|
+
textOf(value: unknown): string {
|
|
322
|
+
return typeof value === 'string' || typeof value === 'number' ? String(value) : ''
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
## Injection Notes
|
|
328
|
+
|
|
329
|
+
### Requirements
|
|
330
|
+
|
|
331
|
+
Peer dependencies:
|
|
332
|
+
|
|
333
|
+
- `@angular/common` ^22.0.0
|
|
334
|
+
- `@angular/core` ^22.0.0
|
|
335
|
+
- `@angular/platform-browser` ^22.0.0
|
|
336
|
+
- `@molecule/app-angular` ^3.5.0
|
|
337
|
+
- `@molecule/app-ui` ^1.0.1
|
|
338
|
+
- `@molecule/app-ui-angular` ^1.1.0
|
|
339
|
+
|
|
340
|
+
### Runtime Dependencies
|
|
341
|
+
|
|
342
|
+
- `@angular/common`
|
|
343
|
+
- `@angular/core`
|
|
344
|
+
- `@angular/platform-browser`
|
|
345
|
+
- `@molecule/app-angular`
|
|
346
|
+
- `@molecule/app-ui`
|
|
347
|
+
- `@molecule/app-ui-angular`
|
|
348
|
+
|
|
349
|
+
- Must render inside the app's i18n provider and with a ClassMap bond
|
|
350
|
+
wired (`useTranslation()` / `getClassMap()` throw otherwise).
|
|
351
|
+
- When `overallStatus` is omitted the banner shows the WORST status
|
|
352
|
+
found across all components (major-outage > partial-outage >
|
|
353
|
+
degraded > maintenance > operational).
|
|
354
|
+
- Status colors are a fixed hex palette applied via inline styles
|
|
355
|
+
(green/yellow/orange/red/blue with white text) — they ignore the
|
|
356
|
+
app theme and cannot be restyled via ClassMap; acceptable for
|
|
357
|
+
status pages, but know they will not follow a rebrand.
|
|
358
|
+
- Status labels use `status.operational` … `status.maintenance` i18n
|
|
359
|
+
keys with English fallbacks; no locale bond currently ships these
|
|
360
|
+
keys, so register your own translations if the app is multilingual.
|
|
361
|
+
- Node props are projected content: `header` and `footer` are selected
|
|
362
|
+
by `[slot=header]` / `[slot=footer]`. Group and component names may be
|
|
363
|
+
`ng-template` references or plain text.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Angular status-page summary — the counterpart of
|
|
3
|
+
* `@molecule/app-status-summary-react`: the same props and the same DOM for
|
|
4
|
+
* the same input.
|
|
5
|
+
*
|
|
6
|
+
* Exports `<StatusSummary>` — a grouped component list with colored
|
|
7
|
+
* operational / degraded / outage badges and an overall banner derived from
|
|
8
|
+
* the worst child status — plus the `ComponentStatus`, `StatusComponent`,
|
|
9
|
+
* `StatusGroup` and `StatusSummaryProps` types.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* import { Component } from '@angular/core'
|
|
14
|
+
* import { StatusSummary } from '@molecule/app-status-summary-angular'
|
|
15
|
+
*
|
|
16
|
+
* @Component({
|
|
17
|
+
* selector: 'app-status-page',
|
|
18
|
+
* standalone: true,
|
|
19
|
+
* imports: [StatusSummary],
|
|
20
|
+
* template: `
|
|
21
|
+
* <div
|
|
22
|
+
* mol-status-summary
|
|
23
|
+
* [groups]="[
|
|
24
|
+
* {
|
|
25
|
+
* id: 'api',
|
|
26
|
+
* name: 'API',
|
|
27
|
+
* components: [
|
|
28
|
+
* { id: 'rest', name: 'REST API', status: 'operational' },
|
|
29
|
+
* { id: 'ws', name: 'WebSockets', status: 'degraded' }
|
|
30
|
+
* ]
|
|
31
|
+
* }
|
|
32
|
+
* ]"
|
|
33
|
+
* >
|
|
34
|
+
* <span slot="header">Last updated: 2 min ago</span>
|
|
35
|
+
* </div>
|
|
36
|
+
* `,
|
|
37
|
+
* })
|
|
38
|
+
* export class StatusPage {}
|
|
39
|
+
* ```
|
|
40
|
+
*
|
|
41
|
+
* @remarks
|
|
42
|
+
* - Must render inside the app's i18n provider and with a ClassMap bond
|
|
43
|
+
* wired (`useTranslation()` / `getClassMap()` throw otherwise).
|
|
44
|
+
* - When `overallStatus` is omitted the banner shows the WORST status
|
|
45
|
+
* found across all components (major-outage > partial-outage >
|
|
46
|
+
* degraded > maintenance > operational).
|
|
47
|
+
* - Status colors are a fixed hex palette applied via inline styles
|
|
48
|
+
* (green/yellow/orange/red/blue with white text) — they ignore the
|
|
49
|
+
* app theme and cannot be restyled via ClassMap; acceptable for
|
|
50
|
+
* status pages, but know they will not follow a rebrand.
|
|
51
|
+
* - Status labels use `status.operational` … `status.maintenance` i18n
|
|
52
|
+
* keys with English fallbacks; no locale bond currently ships these
|
|
53
|
+
* keys, so register your own translations if the app is multilingual.
|
|
54
|
+
* - Node props are projected content: `header` and `footer` are selected
|
|
55
|
+
* by `[slot=header]` / `[slot=footer]`. Group and component names may be
|
|
56
|
+
* `ng-template` references or plain text.
|
|
57
|
+
*
|
|
58
|
+
* @module
|
|
59
|
+
*/
|
|
60
|
+
export * from './status-summary.component.js';
|
|
61
|
+
export * from './types.js';
|
|
62
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0DG;AAEH,cAAc,+BAA+B,CAAA;AAC7C,cAAc,YAAY,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Angular status-page summary — the counterpart of
|
|
3
|
+
* `@molecule/app-status-summary-react`: the same props and the same DOM for
|
|
4
|
+
* the same input.
|
|
5
|
+
*
|
|
6
|
+
* Exports `<StatusSummary>` — a grouped component list with colored
|
|
7
|
+
* operational / degraded / outage badges and an overall banner derived from
|
|
8
|
+
* the worst child status — plus the `ComponentStatus`, `StatusComponent`,
|
|
9
|
+
* `StatusGroup` and `StatusSummaryProps` types.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* import { Component } from '@angular/core'
|
|
14
|
+
* import { StatusSummary } from '@molecule/app-status-summary-angular'
|
|
15
|
+
*
|
|
16
|
+
* @Component({
|
|
17
|
+
* selector: 'app-status-page',
|
|
18
|
+
* standalone: true,
|
|
19
|
+
* imports: [StatusSummary],
|
|
20
|
+
* template: `
|
|
21
|
+
* <div
|
|
22
|
+
* mol-status-summary
|
|
23
|
+
* [groups]="[
|
|
24
|
+
* {
|
|
25
|
+
* id: 'api',
|
|
26
|
+
* name: 'API',
|
|
27
|
+
* components: [
|
|
28
|
+
* { id: 'rest', name: 'REST API', status: 'operational' },
|
|
29
|
+
* { id: 'ws', name: 'WebSockets', status: 'degraded' }
|
|
30
|
+
* ]
|
|
31
|
+
* }
|
|
32
|
+
* ]"
|
|
33
|
+
* >
|
|
34
|
+
* <span slot="header">Last updated: 2 min ago</span>
|
|
35
|
+
* </div>
|
|
36
|
+
* `,
|
|
37
|
+
* })
|
|
38
|
+
* export class StatusPage {}
|
|
39
|
+
* ```
|
|
40
|
+
*
|
|
41
|
+
* @remarks
|
|
42
|
+
* - Must render inside the app's i18n provider and with a ClassMap bond
|
|
43
|
+
* wired (`useTranslation()` / `getClassMap()` throw otherwise).
|
|
44
|
+
* - When `overallStatus` is omitted the banner shows the WORST status
|
|
45
|
+
* found across all components (major-outage > partial-outage >
|
|
46
|
+
* degraded > maintenance > operational).
|
|
47
|
+
* - Status colors are a fixed hex palette applied via inline styles
|
|
48
|
+
* (green/yellow/orange/red/blue with white text) — they ignore the
|
|
49
|
+
* app theme and cannot be restyled via ClassMap; acceptable for
|
|
50
|
+
* status pages, but know they will not follow a rebrand.
|
|
51
|
+
* - Status labels use `status.operational` … `status.maintenance` i18n
|
|
52
|
+
* keys with English fallbacks; no locale bond currently ships these
|
|
53
|
+
* keys, so register your own translations if the app is multilingual.
|
|
54
|
+
* - Node props are projected content: `header` and `footer` are selected
|
|
55
|
+
* by `[slot=header]` / `[slot=footer]`. Group and component names may be
|
|
56
|
+
* `ng-template` references or plain text.
|
|
57
|
+
*
|
|
58
|
+
* @module
|
|
59
|
+
*/
|
|
60
|
+
export * from './status-summary.component.js';
|
|
61
|
+
export * from './types.js';
|
|
62
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0DG;AAEH,cAAc,+BAA+B,CAAA;AAC7C,cAAc,YAAY,CAAA"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { TemplateRef } from '@angular/core';
|
|
2
|
+
import type { UIClassMap } from '@molecule/app-ui';
|
|
3
|
+
import type { ComponentStatus, StatusGroup } from './types.js';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
/**
|
|
6
|
+
* StatusSummary component.
|
|
7
|
+
*
|
|
8
|
+
* Status-page summary — grouped component list with colored badges and an
|
|
9
|
+
* overall banner derived from the worst child status. The host IS the outer
|
|
10
|
+
* `<div>` (`div[mol-status-summary]`), matching React's root exactly. The
|
|
11
|
+
* header and footer are projected content (`[slot=header]`, `[slot=footer]`)
|
|
12
|
+
* so consumers retain full control over the banner stamp and the incident
|
|
13
|
+
* list. Node-valued group / component names are `ng-template` references
|
|
14
|
+
* rendered through `NgTemplateOutlet`; text fields render as text.
|
|
15
|
+
*/
|
|
16
|
+
export declare class StatusSummary {
|
|
17
|
+
/** Grouped components. */
|
|
18
|
+
groups: StatusGroup[];
|
|
19
|
+
/** Overall summary label (auto-derived at read time when omitted). */
|
|
20
|
+
overallStatus?: ComponentStatus;
|
|
21
|
+
/** Extra classes on the outer `<div>`. */
|
|
22
|
+
className?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Reactive translation, read in the injection context. Its `t` reads the
|
|
25
|
+
* locale, so every label re-renders on a locale switch.
|
|
26
|
+
*/
|
|
27
|
+
private readonly i18n;
|
|
28
|
+
/**
|
|
29
|
+
* The current class map.
|
|
30
|
+
* @returns The UIClassMap.
|
|
31
|
+
*/
|
|
32
|
+
cm(): UIClassMap;
|
|
33
|
+
/**
|
|
34
|
+
* The wrapper's class list (`cm.stack(4)` + `className`).
|
|
35
|
+
* @returns The class string.
|
|
36
|
+
*/
|
|
37
|
+
classes(): string;
|
|
38
|
+
/**
|
|
39
|
+
* The banner's class list (flex row + padding).
|
|
40
|
+
* @returns The class string.
|
|
41
|
+
*/
|
|
42
|
+
bannerClasses(): string;
|
|
43
|
+
/** The banner label's class list. */
|
|
44
|
+
labelClasses(): string;
|
|
45
|
+
/** One group section's class list (`cm.stack(2)`). */
|
|
46
|
+
sectionClasses(): string;
|
|
47
|
+
/** One group heading's class list. */
|
|
48
|
+
groupNameClasses(): string;
|
|
49
|
+
/** The component list's class list (`cm.stack(1)`). */
|
|
50
|
+
listClasses(): string;
|
|
51
|
+
/** One component row's class list (flex row, space between). */
|
|
52
|
+
rowClasses(): string;
|
|
53
|
+
/** One component name's class list. */
|
|
54
|
+
componentNameClasses(): string;
|
|
55
|
+
/** One component subtitle's class list. */
|
|
56
|
+
subtitleClasses(): string;
|
|
57
|
+
/** One status badge's class list. */
|
|
58
|
+
badgeClasses(): string;
|
|
59
|
+
/**
|
|
60
|
+
* Every component status in the summary, in render order.
|
|
61
|
+
* @returns The statuses.
|
|
62
|
+
*/
|
|
63
|
+
allStatuses(): ComponentStatus[];
|
|
64
|
+
/**
|
|
65
|
+
* The banner's status: React's `overallStatus ?? worst(allStatuses)`.
|
|
66
|
+
* @returns The overall status.
|
|
67
|
+
*/
|
|
68
|
+
overall(): ComponentStatus;
|
|
69
|
+
/**
|
|
70
|
+
* The banner label, translated through the status key with React's fallback.
|
|
71
|
+
* @returns The label text.
|
|
72
|
+
*/
|
|
73
|
+
overallLabel(): string;
|
|
74
|
+
/**
|
|
75
|
+
* One badge's label, translated through the status key with React's fallback.
|
|
76
|
+
* @param status - The component's status.
|
|
77
|
+
* @returns The label text.
|
|
78
|
+
*/
|
|
79
|
+
statusLabel(status: ComponentStatus): string;
|
|
80
|
+
/**
|
|
81
|
+
* The banner's inline style, in React's declaration order.
|
|
82
|
+
* @returns The style declarations.
|
|
83
|
+
*/
|
|
84
|
+
bannerStyle(): Record<string, string>;
|
|
85
|
+
/**
|
|
86
|
+
* One badge's inline style, in React's declaration order.
|
|
87
|
+
* @param status - The component's status.
|
|
88
|
+
* @returns The style declarations.
|
|
89
|
+
*/
|
|
90
|
+
badgeStyle(status: ComponentStatus): Record<string, string>;
|
|
91
|
+
/**
|
|
92
|
+
* Whether a field holds a node (an `ng-template` reference) rather than text.
|
|
93
|
+
* @param value - The group or component field.
|
|
94
|
+
* @returns True when it renders through a template outlet.
|
|
95
|
+
*/
|
|
96
|
+
isNode(value: unknown): value is TemplateRef<unknown>;
|
|
97
|
+
/**
|
|
98
|
+
* The text a field renders (React renders strings and numbers as text).
|
|
99
|
+
* @param value - The group or component field.
|
|
100
|
+
* @returns The text, or `''` for a node field.
|
|
101
|
+
*/
|
|
102
|
+
textOf(value: unknown): string;
|
|
103
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<StatusSummary, never>;
|
|
104
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<StatusSummary, "div[mol-status-summary]", never, { "groups": { "alias": "groups"; "required": false; }; "overallStatus": { "alias": "overallStatus"; "required": false; }; "className": { "alias": "className"; "required": false; }; }, {}, never, ["[slot=header]", "[slot=footer]"], true, never>;
|
|
105
|
+
}
|
|
106
|
+
//# sourceMappingURL=status-summary.component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status-summary.component.d.ts","sourceRoot":"","sources":["../src/status-summary.component.ts"],"names":[],"mappings":"AAOA,OAAO,EAAa,WAAW,EAAE,MAAM,eAAe,CAAA;AAGtD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAGlD,OAAO,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;;AA6B9D;;;;;;;;;;GAUG;AACH,qBAWa,aAAa;IACxB,0BAA0B;IAC1B,MAAM,EAAE,WAAW,EAAE,CAAK;IAC1B,sEAAsE;IACtE,aAAa,CAAC,EAAE,eAAe,CAAA;IAC/B,0CAA0C;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAA;IAElB;;;OAGG;IACH,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAmB;IAExC;;;OAGG;IACH,EAAE,IAAI,UAAU;IAIhB;;;OAGG;IACH,OAAO,IAAI,MAAM;IAKjB;;;OAGG;IACH,aAAa,IAAI,MAAM;IAKvB,qCAAqC;IACrC,YAAY,IAAI,MAAM;IAKtB,sDAAsD;IACtD,cAAc,IAAI,MAAM;IAIxB,sCAAsC;IACtC,gBAAgB,IAAI,MAAM;IAK1B,uDAAuD;IACvD,WAAW,IAAI,MAAM;IAIrB,gEAAgE;IAChE,UAAU,IAAI,MAAM;IAKpB,uCAAuC;IACvC,oBAAoB,IAAI,MAAM;IAK9B,2CAA2C;IAC3C,eAAe,IAAI,MAAM;IAKzB,qCAAqC;IACrC,YAAY,IAAI,MAAM;IAKtB;;;OAGG;IACH,WAAW,IAAI,eAAe,EAAE;IAIhC;;;OAGG;IACH,OAAO,IAAI,eAAe;IAS1B;;;OAGG;IACH,YAAY,IAAI,MAAM;IAKtB;;;;OAIG;IACH,WAAW,CAAC,MAAM,EAAE,eAAe,GAAG,MAAM;IAI5C;;;OAGG;IACH,WAAW,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAQrC;;;;OAIG;IACH,UAAU,CAAC,MAAM,EAAE,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAI3D;;;;OAIG;IACH,MAAM,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,WAAW,CAAC,OAAO,CAAC;IAIrD;;;;OAIG;IACH,MAAM,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM;yCAhKnB,aAAa;2CAAb,aAAa;CAmKzB"}
|
|
@@ -0,0 +1,336 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* StatusSummary component (React parity).
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import { NgTemplateOutlet } from '@angular/common';
|
|
7
|
+
import { Component, TemplateRef } from '@angular/core';
|
|
8
|
+
import { useTranslation } from '@molecule/app-angular';
|
|
9
|
+
import { getClassMap } from '@molecule/app-ui';
|
|
10
|
+
import * as i0 from "@angular/core";
|
|
11
|
+
const _c0 = [[["", "slot", "header"]], [["", "slot", "footer"]]];
|
|
12
|
+
const _c1 = ["[slot=header]", "[slot=footer]"];
|
|
13
|
+
const _forTrack0 = ($index, $item) => $item.id;
|
|
14
|
+
function StatusSummary_For_5_Conditional_2_Template(rf, ctx) { if (rf & 1) {
|
|
15
|
+
i0.ɵɵelementContainer(0, 1);
|
|
16
|
+
} if (rf & 2) {
|
|
17
|
+
const group_r1 = i0.ɵɵnextContext().$implicit;
|
|
18
|
+
i0.ɵɵproperty("ngTemplateOutlet", group_r1.name);
|
|
19
|
+
} }
|
|
20
|
+
function StatusSummary_For_5_Conditional_3_Template(rf, ctx) { if (rf & 1) {
|
|
21
|
+
i0.ɵɵelementContainerStart(0);
|
|
22
|
+
i0.ɵɵtext(1);
|
|
23
|
+
i0.ɵɵelementContainerEnd();
|
|
24
|
+
} if (rf & 2) {
|
|
25
|
+
const group_r1 = i0.ɵɵnextContext().$implicit;
|
|
26
|
+
const ctx_r1 = i0.ɵɵnextContext();
|
|
27
|
+
i0.ɵɵadvance();
|
|
28
|
+
i0.ɵɵtextInterpolate(ctx_r1.textOf(group_r1.name));
|
|
29
|
+
} }
|
|
30
|
+
function StatusSummary_For_5_For_6_Conditional_3_Template(rf, ctx) { if (rf & 1) {
|
|
31
|
+
i0.ɵɵelementContainer(0, 1);
|
|
32
|
+
} if (rf & 2) {
|
|
33
|
+
const component_r3 = i0.ɵɵnextContext().$implicit;
|
|
34
|
+
i0.ɵɵproperty("ngTemplateOutlet", component_r3.name);
|
|
35
|
+
} }
|
|
36
|
+
function StatusSummary_For_5_For_6_Conditional_4_Template(rf, ctx) { if (rf & 1) {
|
|
37
|
+
i0.ɵɵelementContainerStart(0);
|
|
38
|
+
i0.ɵɵtext(1);
|
|
39
|
+
i0.ɵɵelementContainerEnd();
|
|
40
|
+
} if (rf & 2) {
|
|
41
|
+
const component_r3 = i0.ɵɵnextContext().$implicit;
|
|
42
|
+
const ctx_r1 = i0.ɵɵnextContext(2);
|
|
43
|
+
i0.ɵɵadvance();
|
|
44
|
+
i0.ɵɵtextInterpolate(ctx_r1.textOf(component_r3.name));
|
|
45
|
+
} }
|
|
46
|
+
function StatusSummary_For_5_For_6_Conditional_5_Conditional_1_Template(rf, ctx) { if (rf & 1) {
|
|
47
|
+
i0.ɵɵelementContainer(0, 1);
|
|
48
|
+
} if (rf & 2) {
|
|
49
|
+
const component_r3 = i0.ɵɵnextContext(2).$implicit;
|
|
50
|
+
i0.ɵɵproperty("ngTemplateOutlet", component_r3.subtitle);
|
|
51
|
+
} }
|
|
52
|
+
function StatusSummary_For_5_For_6_Conditional_5_Conditional_2_Template(rf, ctx) { if (rf & 1) {
|
|
53
|
+
i0.ɵɵelementContainerStart(0);
|
|
54
|
+
i0.ɵɵtext(1);
|
|
55
|
+
i0.ɵɵelementContainerEnd();
|
|
56
|
+
} if (rf & 2) {
|
|
57
|
+
const component_r3 = i0.ɵɵnextContext(2).$implicit;
|
|
58
|
+
const ctx_r1 = i0.ɵɵnextContext(2);
|
|
59
|
+
i0.ɵɵadvance();
|
|
60
|
+
i0.ɵɵtextInterpolate(ctx_r1.textOf(component_r3.subtitle));
|
|
61
|
+
} }
|
|
62
|
+
function StatusSummary_For_5_For_6_Conditional_5_Template(rf, ctx) { if (rf & 1) {
|
|
63
|
+
i0.ɵɵelementStart(0, "span");
|
|
64
|
+
i0.ɵɵconditionalCreate(1, StatusSummary_For_5_For_6_Conditional_5_Conditional_1_Template, 1, 1, "ng-container", 1)(2, StatusSummary_For_5_For_6_Conditional_5_Conditional_2_Template, 2, 1, "ng-container");
|
|
65
|
+
i0.ɵɵelementEnd();
|
|
66
|
+
} if (rf & 2) {
|
|
67
|
+
const component_r3 = i0.ɵɵnextContext().$implicit;
|
|
68
|
+
const ctx_r1 = i0.ɵɵnextContext(2);
|
|
69
|
+
i0.ɵɵclassMap(ctx_r1.subtitleClasses());
|
|
70
|
+
i0.ɵɵadvance();
|
|
71
|
+
i0.ɵɵconditional(ctx_r1.isNode(component_r3.subtitle) ? 1 : 2);
|
|
72
|
+
} }
|
|
73
|
+
function StatusSummary_For_5_For_6_Template(rf, ctx) { if (rf & 1) {
|
|
74
|
+
i0.ɵɵelementStart(0, "li")(1, "div")(2, "span");
|
|
75
|
+
i0.ɵɵconditionalCreate(3, StatusSummary_For_5_For_6_Conditional_3_Template, 1, 1, "ng-container", 1)(4, StatusSummary_For_5_For_6_Conditional_4_Template, 2, 1, "ng-container");
|
|
76
|
+
i0.ɵɵelementEnd();
|
|
77
|
+
i0.ɵɵconditionalCreate(5, StatusSummary_For_5_For_6_Conditional_5_Template, 3, 3, "span", 0);
|
|
78
|
+
i0.ɵɵelementEnd();
|
|
79
|
+
i0.ɵɵelementStart(6, "span");
|
|
80
|
+
i0.ɵɵtext(7);
|
|
81
|
+
i0.ɵɵelementEnd()();
|
|
82
|
+
} if (rf & 2) {
|
|
83
|
+
const component_r3 = ctx.$implicit;
|
|
84
|
+
const ctx_r1 = i0.ɵɵnextContext(2);
|
|
85
|
+
i0.ɵɵclassMap(ctx_r1.rowClasses());
|
|
86
|
+
i0.ɵɵadvance(2);
|
|
87
|
+
i0.ɵɵclassMap(ctx_r1.componentNameClasses());
|
|
88
|
+
i0.ɵɵadvance();
|
|
89
|
+
i0.ɵɵconditional(ctx_r1.isNode(component_r3.name) ? 3 : 4);
|
|
90
|
+
i0.ɵɵadvance(2);
|
|
91
|
+
i0.ɵɵconditional(component_r3.subtitle ? 5 : -1);
|
|
92
|
+
i0.ɵɵadvance();
|
|
93
|
+
i0.ɵɵstyleMap(ctx_r1.badgeStyle(component_r3.status));
|
|
94
|
+
i0.ɵɵclassMap(ctx_r1.badgeClasses());
|
|
95
|
+
i0.ɵɵadvance();
|
|
96
|
+
i0.ɵɵtextInterpolate(ctx_r1.statusLabel(component_r3.status));
|
|
97
|
+
} }
|
|
98
|
+
function StatusSummary_For_5_Template(rf, ctx) { if (rf & 1) {
|
|
99
|
+
i0.ɵɵelementStart(0, "section")(1, "h3");
|
|
100
|
+
i0.ɵɵconditionalCreate(2, StatusSummary_For_5_Conditional_2_Template, 1, 1, "ng-container", 1)(3, StatusSummary_For_5_Conditional_3_Template, 2, 1, "ng-container");
|
|
101
|
+
i0.ɵɵelementEnd();
|
|
102
|
+
i0.ɵɵelementStart(4, "ul");
|
|
103
|
+
i0.ɵɵrepeaterCreate(5, StatusSummary_For_5_For_6_Template, 8, 11, "li", 0, _forTrack0);
|
|
104
|
+
i0.ɵɵelementEnd()();
|
|
105
|
+
} if (rf & 2) {
|
|
106
|
+
const group_r1 = ctx.$implicit;
|
|
107
|
+
const ctx_r1 = i0.ɵɵnextContext();
|
|
108
|
+
i0.ɵɵclassMap(ctx_r1.sectionClasses());
|
|
109
|
+
i0.ɵɵadvance();
|
|
110
|
+
i0.ɵɵclassMap(ctx_r1.groupNameClasses());
|
|
111
|
+
i0.ɵɵadvance();
|
|
112
|
+
i0.ɵɵconditional(ctx_r1.isNode(group_r1.name) ? 2 : 3);
|
|
113
|
+
i0.ɵɵadvance(2);
|
|
114
|
+
i0.ɵɵclassMap(ctx_r1.listClasses());
|
|
115
|
+
i0.ɵɵadvance();
|
|
116
|
+
i0.ɵɵrepeater(group_r1.components);
|
|
117
|
+
} }
|
|
118
|
+
/** English label rendered for each status when no locale bond supplies the key. */
|
|
119
|
+
const STATUS_LABEL = {
|
|
120
|
+
operational: 'Operational',
|
|
121
|
+
degraded: 'Degraded performance',
|
|
122
|
+
'partial-outage': 'Partial outage',
|
|
123
|
+
'major-outage': 'Major outage',
|
|
124
|
+
maintenance: 'Under maintenance',
|
|
125
|
+
};
|
|
126
|
+
/** The fixed semantic hue of each status (React's inline-style palette). */
|
|
127
|
+
const STATUS_COLOR = {
|
|
128
|
+
operational: '#22c55e',
|
|
129
|
+
degraded: '#eab308',
|
|
130
|
+
'partial-outage': '#f97316',
|
|
131
|
+
'major-outage': '#ef4444',
|
|
132
|
+
maintenance: '#60a5fa',
|
|
133
|
+
};
|
|
134
|
+
/** The statuses from most to least severe (React's `worst` order). */
|
|
135
|
+
const SEVERITY_ORDER = [
|
|
136
|
+
'major-outage',
|
|
137
|
+
'partial-outage',
|
|
138
|
+
'degraded',
|
|
139
|
+
'maintenance',
|
|
140
|
+
'operational',
|
|
141
|
+
];
|
|
142
|
+
/**
|
|
143
|
+
* StatusSummary component.
|
|
144
|
+
*
|
|
145
|
+
* Status-page summary — grouped component list with colored badges and an
|
|
146
|
+
* overall banner derived from the worst child status. The host IS the outer
|
|
147
|
+
* `<div>` (`div[mol-status-summary]`), matching React's root exactly. The
|
|
148
|
+
* header and footer are projected content (`[slot=header]`, `[slot=footer]`)
|
|
149
|
+
* so consumers retain full control over the banner stamp and the incident
|
|
150
|
+
* list. Node-valued group / component names are `ng-template` references
|
|
151
|
+
* rendered through `NgTemplateOutlet`; text fields render as text.
|
|
152
|
+
*/
|
|
153
|
+
export class StatusSummary {
|
|
154
|
+
/** Grouped components. */
|
|
155
|
+
groups = [];
|
|
156
|
+
/** Overall summary label (auto-derived at read time when omitted). */
|
|
157
|
+
overallStatus;
|
|
158
|
+
/** Extra classes on the outer `<div>`. */
|
|
159
|
+
className;
|
|
160
|
+
/**
|
|
161
|
+
* Reactive translation, read in the injection context. Its `t` reads the
|
|
162
|
+
* locale, so every label re-renders on a locale switch.
|
|
163
|
+
*/
|
|
164
|
+
i18n = useTranslation();
|
|
165
|
+
/**
|
|
166
|
+
* The current class map.
|
|
167
|
+
* @returns The UIClassMap.
|
|
168
|
+
*/
|
|
169
|
+
cm() {
|
|
170
|
+
return getClassMap();
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* The wrapper's class list (`cm.stack(4)` + `className`).
|
|
174
|
+
* @returns The class string.
|
|
175
|
+
*/
|
|
176
|
+
classes() {
|
|
177
|
+
const cm = this.cm();
|
|
178
|
+
return cm.cn(cm.stack(4), this.className);
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* The banner's class list (flex row + padding).
|
|
182
|
+
* @returns The class string.
|
|
183
|
+
*/
|
|
184
|
+
bannerClasses() {
|
|
185
|
+
const cm = this.cm();
|
|
186
|
+
return cm.cn(cm.flex({ align: 'center', justify: 'between', gap: 'md' }), cm.sp('p', 3));
|
|
187
|
+
}
|
|
188
|
+
/** The banner label's class list. */
|
|
189
|
+
labelClasses() {
|
|
190
|
+
const cm = this.cm();
|
|
191
|
+
return cm.cn(cm.textSize('lg'), cm.fontWeight('bold'));
|
|
192
|
+
}
|
|
193
|
+
/** One group section's class list (`cm.stack(2)`). */
|
|
194
|
+
sectionClasses() {
|
|
195
|
+
return this.cm().stack(2);
|
|
196
|
+
}
|
|
197
|
+
/** One group heading's class list. */
|
|
198
|
+
groupNameClasses() {
|
|
199
|
+
const cm = this.cm();
|
|
200
|
+
return cm.cn(cm.textSize('sm'), cm.fontWeight('semibold'));
|
|
201
|
+
}
|
|
202
|
+
/** The component list's class list (`cm.stack(1)`). */
|
|
203
|
+
listClasses() {
|
|
204
|
+
return this.cm().stack(1);
|
|
205
|
+
}
|
|
206
|
+
/** One component row's class list (flex row, space between). */
|
|
207
|
+
rowClasses() {
|
|
208
|
+
const cm = this.cm();
|
|
209
|
+
return cm.flex({ align: 'center', justify: 'between', gap: 'sm' });
|
|
210
|
+
}
|
|
211
|
+
/** One component name's class list. */
|
|
212
|
+
componentNameClasses() {
|
|
213
|
+
const cm = this.cm();
|
|
214
|
+
return cm.cn(cm.textSize('sm'), cm.fontWeight('medium'));
|
|
215
|
+
}
|
|
216
|
+
/** One component subtitle's class list. */
|
|
217
|
+
subtitleClasses() {
|
|
218
|
+
const cm = this.cm();
|
|
219
|
+
return cm.cn(cm.sp('ml', 2), cm.textSize('xs'));
|
|
220
|
+
}
|
|
221
|
+
/** One status badge's class list. */
|
|
222
|
+
badgeClasses() {
|
|
223
|
+
const cm = this.cm();
|
|
224
|
+
return cm.cn(cm.sp('px', 2), cm.textSize('xs'), cm.fontWeight('semibold'));
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Every component status in the summary, in render order.
|
|
228
|
+
* @returns The statuses.
|
|
229
|
+
*/
|
|
230
|
+
allStatuses() {
|
|
231
|
+
return this.groups.flatMap((group) => group.components.map((component) => component.status));
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* The banner's status: React's `overallStatus ?? worst(allStatuses)`.
|
|
235
|
+
* @returns The overall status.
|
|
236
|
+
*/
|
|
237
|
+
overall() {
|
|
238
|
+
if (this.overallStatus)
|
|
239
|
+
return this.overallStatus;
|
|
240
|
+
const statuses = this.allStatuses();
|
|
241
|
+
for (const status of SEVERITY_ORDER) {
|
|
242
|
+
if (statuses.includes(status))
|
|
243
|
+
return status;
|
|
244
|
+
}
|
|
245
|
+
return 'operational';
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* The banner label, translated through the status key with React's fallback.
|
|
249
|
+
* @returns The label text.
|
|
250
|
+
*/
|
|
251
|
+
overallLabel() {
|
|
252
|
+
const status = this.overall();
|
|
253
|
+
return this.i18n.t(`status.${status}`, {}, { defaultValue: STATUS_LABEL[status] });
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* One badge's label, translated through the status key with React's fallback.
|
|
257
|
+
* @param status - The component's status.
|
|
258
|
+
* @returns The label text.
|
|
259
|
+
*/
|
|
260
|
+
statusLabel(status) {
|
|
261
|
+
return this.i18n.t(`status.${status}`, {}, { defaultValue: STATUS_LABEL[status] });
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* The banner's inline style, in React's declaration order.
|
|
265
|
+
* @returns The style declarations.
|
|
266
|
+
*/
|
|
267
|
+
bannerStyle() {
|
|
268
|
+
return {
|
|
269
|
+
background: STATUS_COLOR[this.overall()],
|
|
270
|
+
color: '#fff',
|
|
271
|
+
borderRadius: '8px',
|
|
272
|
+
};
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* One badge's inline style, in React's declaration order.
|
|
276
|
+
* @param status - The component's status.
|
|
277
|
+
* @returns The style declarations.
|
|
278
|
+
*/
|
|
279
|
+
badgeStyle(status) {
|
|
280
|
+
return { borderRadius: '4px', background: STATUS_COLOR[status], color: '#fff' };
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* Whether a field holds a node (an `ng-template` reference) rather than text.
|
|
284
|
+
* @param value - The group or component field.
|
|
285
|
+
* @returns True when it renders through a template outlet.
|
|
286
|
+
*/
|
|
287
|
+
isNode(value) {
|
|
288
|
+
return value instanceof TemplateRef;
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* The text a field renders (React renders strings and numbers as text).
|
|
292
|
+
* @param value - The group or component field.
|
|
293
|
+
* @returns The text, or `''` for a node field.
|
|
294
|
+
*/
|
|
295
|
+
textOf(value) {
|
|
296
|
+
return typeof value === 'string' || typeof value === 'number' ? String(value) : '';
|
|
297
|
+
}
|
|
298
|
+
static ɵfac = function StatusSummary_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || StatusSummary)(); };
|
|
299
|
+
static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: StatusSummary, selectors: [["div", "mol-status-summary", ""]], hostVars: 2, hostBindings: function StatusSummary_HostBindings(rf, ctx) { if (rf & 2) {
|
|
300
|
+
i0.ɵɵclassMap(ctx.classes());
|
|
301
|
+
} }, inputs: { groups: "groups", overallStatus: "overallStatus", className: "className" }, ngContentSelectors: _c1, decls: 7, vars: 7, consts: [[3, "class"], [3, "ngTemplateOutlet"]], template: function StatusSummary_Template(rf, ctx) { if (rf & 1) {
|
|
302
|
+
i0.ɵɵprojectionDef(_c0);
|
|
303
|
+
i0.ɵɵelementStart(0, "div")(1, "span");
|
|
304
|
+
i0.ɵɵtext(2);
|
|
305
|
+
i0.ɵɵelementEnd();
|
|
306
|
+
i0.ɵɵprojection(3);
|
|
307
|
+
i0.ɵɵelementEnd();
|
|
308
|
+
i0.ɵɵrepeaterCreate(4, StatusSummary_For_5_Template, 7, 7, "section", 0, _forTrack0);
|
|
309
|
+
i0.ɵɵprojection(6, 1);
|
|
310
|
+
} if (rf & 2) {
|
|
311
|
+
i0.ɵɵstyleMap(ctx.bannerStyle());
|
|
312
|
+
i0.ɵɵclassMap(ctx.bannerClasses());
|
|
313
|
+
i0.ɵɵadvance();
|
|
314
|
+
i0.ɵɵclassMap(ctx.labelClasses());
|
|
315
|
+
i0.ɵɵadvance();
|
|
316
|
+
i0.ɵɵtextInterpolate(ctx.overallLabel());
|
|
317
|
+
i0.ɵɵadvance(2);
|
|
318
|
+
i0.ɵɵrepeater(ctx.groups);
|
|
319
|
+
} }, dependencies: [NgTemplateOutlet], encapsulation: 2 });
|
|
320
|
+
}
|
|
321
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(StatusSummary, [{
|
|
322
|
+
type: Component,
|
|
323
|
+
args: [{
|
|
324
|
+
selector: 'div[mol-status-summary]',
|
|
325
|
+
standalone: true,
|
|
326
|
+
imports: [NgTemplateOutlet],
|
|
327
|
+
inputs: ['groups', 'overallStatus', 'className'],
|
|
328
|
+
host: {
|
|
329
|
+
'[class]': 'classes()',
|
|
330
|
+
},
|
|
331
|
+
// prettier-ignore
|
|
332
|
+
template: `<div [class]="bannerClasses()" [style]="bannerStyle()"><span [class]="labelClasses()">{{ overallLabel() }}</span><ng-content select="[slot=header]"></ng-content></div>@for (group of groups; track group.id) {<section [class]="sectionClasses()"><h3 [class]="groupNameClasses()">@if (isNode(group.name)) {<ng-container [ngTemplateOutlet]="group.name" />}@else {<ng-container>{{ textOf(group.name) }}</ng-container>}</h3><ul [class]="listClasses()">@for (component of group.components; track component.id) {<li [class]="rowClasses()"><div><span [class]="componentNameClasses()">@if (isNode(component.name)) {<ng-container [ngTemplateOutlet]="component.name" />}@else {<ng-container>{{ textOf(component.name) }}</ng-container>}</span>@if (component.subtitle) {<span [class]="subtitleClasses()">@if (isNode(component.subtitle)) {<ng-container [ngTemplateOutlet]="component.subtitle" />}@else {<ng-container>{{ textOf(component.subtitle) }}</ng-container>}</span>}</div><span [class]="badgeClasses()" [style]="badgeStyle(component.status)">{{ statusLabel(component.status) }}</span></li>}</ul></section>}<ng-content select="[slot=footer]"></ng-content>`,
|
|
333
|
+
}]
|
|
334
|
+
}], null, null); })();
|
|
335
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(StatusSummary, { className: "StatusSummary", filePath: "status-summary.component.ts", lineNumber: 65 }); })();
|
|
336
|
+
//# sourceMappingURL=status-summary.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status-summary.component.js","sourceRoot":"","sources":["../src/status-summary.component.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAClD,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAEtD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAEtD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;;;;;;IAmD6Q,2BAAgD;;;IAAlC,gDAA+B;;;IAAW,6BAAc;IAAA,YAAwB;;;;;IAAxB,cAAwB;IAAxB,kDAAwB;;;IAAgN,2BAAoD;;;IAAtC,oDAAmC;;;IAAW,6BAAc;IAAA,YAA4B;;;;;IAA5B,cAA4B;IAA5B,sDAA4B;;;IAAqH,2BAAwD;;;IAA1C,wDAAuC;;;IAAW,6BAAc;IAAA,YAAgC;;;;;IAAhC,cAAgC;IAAhC,0DAAgC;;;IAAlL,4BAAkC;IAA2F,AAA3F,kHAAkC,yFAAgE;IAA8D,iBAAO;;;;IAAnM,uCAA2B;IAAC,cAAgK;IAAhK,8DAAgK;;;IAA9Z,AAAL,AAA3B,0BAA2B,UAAK,WAAuC;IAAmF,AAAnF,oGAA8B,2EAA4D;IAA0D,iBAAO;IAAA,4FAA0B;IAA0M,iBAAM;IAAA,4BAAsE;IAAA,YAAmC;IAAO,AAAP,iBAAO,EAAK;;;;IAA7jB,kCAAsB;IAAY,eAAgC;IAAhC,4CAAgC;IAAC,cAAoJ;IAApJ,0DAAoJ;IAAO,eAAoO;IAApO,gDAAoO;IAAqC,cAAsC;IAAtC,qDAAsC;IAA/D,oCAAwB;IAAwC,cAAmC;IAAnC,6DAAmC;;;IAAzzB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AAoB;YAApB,wCAAoB;YAA6D,eAAk6B;YAAl6B,yBAAk6B;4BAN1kC,gBAAgB;;iFAQf,aAAa;cAXzB,SAAS;eAAC;gBACT,QAAQ,EAAE,yBAAyB;gBACnC,UAAU,EAAE,IAAI;gBAChB,OAAO,EAAE,CAAC,gBAAgB,CAAC;gBAC3B,MAAM,EAAE,CAAC,QAAQ,EAAE,eAAe,EAAE,WAAW,CAAC;gBAChD,IAAI,EAAE;oBACJ,SAAS,EAAE,WAAW;iBACvB;gBACD,kBAAkB;gBAClB,QAAQ,EAAE,2nCAA2nC;aACtoC;;kFACY,aAAa"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types of `@molecule/app-status-summary-angular` — the Angular counterpart of
|
|
3
|
+
* `@molecule/app-status-summary-react`, same props and DOM.
|
|
4
|
+
*
|
|
5
|
+
* @module
|
|
6
|
+
*/
|
|
7
|
+
import type { TemplateRef } from '@angular/core';
|
|
8
|
+
/**
|
|
9
|
+
* A node-valued field (React's `ReactNode`): in Angular a field is text (a
|
|
10
|
+
* string or number) or an `ng-template` reference rendered through
|
|
11
|
+
* `NgTemplateOutlet` where the node would render.
|
|
12
|
+
*/
|
|
13
|
+
type StatusSummaryNode = TemplateRef<unknown> | string | number;
|
|
14
|
+
/** Union of possible component health states. */
|
|
15
|
+
export type ComponentStatus = 'operational' | 'degraded' | 'partial-outage' | 'major-outage' | 'maintenance';
|
|
16
|
+
/** A single monitored component with its current health status. */
|
|
17
|
+
export interface StatusComponent {
|
|
18
|
+
/** Stable identifier, used as the rendered list key. */
|
|
19
|
+
id: string;
|
|
20
|
+
/** Component name — text or an `ng-template` reference. */
|
|
21
|
+
name: StatusSummaryNode;
|
|
22
|
+
/** Current health status. */
|
|
23
|
+
status: ComponentStatus;
|
|
24
|
+
/** Optional sub-label (SLA %, region, etc.) — text or an `ng-template` reference. */
|
|
25
|
+
subtitle?: StatusSummaryNode;
|
|
26
|
+
}
|
|
27
|
+
/** A named group of related StatusComponent entries. */
|
|
28
|
+
export interface StatusGroup {
|
|
29
|
+
/** Stable identifier, used as the rendered section key. */
|
|
30
|
+
id: string;
|
|
31
|
+
/** Group name — text or an `ng-template` reference. */
|
|
32
|
+
name: StatusSummaryNode;
|
|
33
|
+
/** The components in this group. */
|
|
34
|
+
components: StatusComponent[];
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Props accepted by {@link StatusSummary} — the same props
|
|
38
|
+
* `@molecule/app-status-summary-react` accepts. The node props (`header`,
|
|
39
|
+
* `footer`) are projected content in Angular (an input cannot carry a node),
|
|
40
|
+
* so they are typed `unknown`: pass them in the host template
|
|
41
|
+
* (`[slot=header]` / `[slot=footer]`), not as values.
|
|
42
|
+
*/
|
|
43
|
+
export interface StatusSummaryProps {
|
|
44
|
+
/** Grouped components. */
|
|
45
|
+
groups: StatusGroup[];
|
|
46
|
+
/** Overall summary label (auto-derived if omitted). */
|
|
47
|
+
overallStatus?: ComponentStatus;
|
|
48
|
+
/** Header content (last updated time, subscribe button), projected as `[slot=header]`. */
|
|
49
|
+
header?: unknown;
|
|
50
|
+
/** Below-the-grid content (incident list), projected as `[slot=footer]`. */
|
|
51
|
+
footer?: unknown;
|
|
52
|
+
/** Extra classes. */
|
|
53
|
+
className?: string;
|
|
54
|
+
}
|
|
55
|
+
export {};
|
|
56
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAEhD;;;;GAIG;AACH,KAAK,iBAAiB,GAAG,WAAW,CAAC,OAAO,CAAC,GAAG,MAAM,GAAG,MAAM,CAAA;AAE/D,iDAAiD;AACjD,MAAM,MAAM,eAAe,GACzB,aAAa,GAAG,UAAU,GAAG,gBAAgB,GAAG,cAAc,GAAG,aAAa,CAAA;AAEhF,mEAAmE;AACnE,MAAM,WAAW,eAAe;IAC9B,wDAAwD;IACxD,EAAE,EAAE,MAAM,CAAA;IACV,2DAA2D;IAC3D,IAAI,EAAE,iBAAiB,CAAA;IACvB,6BAA6B;IAC7B,MAAM,EAAE,eAAe,CAAA;IACvB,qFAAqF;IACrF,QAAQ,CAAC,EAAE,iBAAiB,CAAA;CAC7B;AAED,wDAAwD;AACxD,MAAM,WAAW,WAAW;IAC1B,2DAA2D;IAC3D,EAAE,EAAE,MAAM,CAAA;IACV,uDAAuD;IACvD,IAAI,EAAE,iBAAiB,CAAA;IACvB,oCAAoC;IACpC,UAAU,EAAE,eAAe,EAAE,CAAA;CAC9B;AAED;;;;;;GAMG;AACH,MAAM,WAAW,kBAAkB;IACjC,0BAA0B;IAC1B,MAAM,EAAE,WAAW,EAAE,CAAA;IACrB,uDAAuD;IACvD,aAAa,CAAC,EAAE,eAAe,CAAA;IAC/B,0FAA0F;IAC1F,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,4EAA4E;IAC5E,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,qBAAqB;IACrB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,71 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@molecule/app-status-summary-angular",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "1.1.0",
|
|
4
|
+
"description": "Status-page summary: component grid with operational/degraded/outage badges + incident list",
|
|
5
|
+
"homepage": "https://www.molecule.dev/packages/app-status-summary-angular",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "dist/index.js",
|
|
8
|
+
"types": "dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist",
|
|
17
|
+
"README.md"
|
|
18
|
+
],
|
|
19
|
+
"scripts": {
|
|
20
|
+
"build": "ngc",
|
|
21
|
+
"dev": "ngc --watch",
|
|
22
|
+
"test": "vitest run",
|
|
23
|
+
"test:watch": "vitest"
|
|
24
|
+
},
|
|
25
|
+
"keywords": [
|
|
26
|
+
"molecule",
|
|
27
|
+
"status-summary",
|
|
28
|
+
"angular"
|
|
29
|
+
],
|
|
30
|
+
"author": "Molecule Dev, Inc. (https://molecule.dev)",
|
|
31
|
+
"license": "Apache-2.0",
|
|
32
|
+
"repository": {
|
|
33
|
+
"type": "git",
|
|
34
|
+
"url": "https://github.com/molecule-dev/molecule.git",
|
|
35
|
+
"directory": "packages/app/features/status-summary-angular"
|
|
36
|
+
},
|
|
37
|
+
"engines": {
|
|
38
|
+
"node": ">=20"
|
|
39
|
+
},
|
|
40
|
+
"bugs": "https://github.com/molecule-dev/molecule/issues",
|
|
41
|
+
"publishConfig": {
|
|
42
|
+
"access": "public"
|
|
43
|
+
},
|
|
44
|
+
"peerDependencies": {
|
|
45
|
+
"@angular/common": "^22.0.0",
|
|
46
|
+
"@angular/core": "^22.0.0",
|
|
47
|
+
"@angular/platform-browser": "^22.0.0",
|
|
48
|
+
"@molecule/app-angular": "^3.5.0",
|
|
49
|
+
"@molecule/app-ui": "^1.0.1",
|
|
50
|
+
"@molecule/app-ui-angular": "^1.1.0"
|
|
51
|
+
},
|
|
52
|
+
"devDependencies": {
|
|
53
|
+
"@angular/common": "22.2.3",
|
|
54
|
+
"@angular/compiler": "22.2.3",
|
|
55
|
+
"@angular/compiler-cli": "22.2.3",
|
|
56
|
+
"@angular/core": "22.2.3",
|
|
57
|
+
"@angular/platform-browser": "22.2.3",
|
|
58
|
+
"@molecule/app-angular": "3.7.1",
|
|
59
|
+
"@molecule/app-framework-conformance": "0.0.0",
|
|
60
|
+
"@molecule/app-i18n": "1.2.2",
|
|
61
|
+
"@molecule/app-icons": "1.0.4",
|
|
62
|
+
"@molecule/app-ui": "1.4.0",
|
|
63
|
+
"@molecule/app-ui-angular": "1.2.0",
|
|
64
|
+
"@types/node": "26.6.5",
|
|
65
|
+
"jsdom": "30.1.3",
|
|
66
|
+
"rxjs": "7.8.2",
|
|
67
|
+
"typescript": "6.0.3",
|
|
68
|
+
"vitest": "4.1.12",
|
|
69
|
+
"zone.js": "0.16.3"
|
|
70
|
+
}
|
|
71
|
+
}
|