andoncloud-prometheus-widget 1.3.17 → 1.3.19
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/README.md +36 -3
- package/dist/assets/thumbnail.svg +42 -0
- package/dist/index.d.ts +5 -3
- package/dist/index.js +278 -101
- package/dist/index.js.map +1 -1
- package/dist/thumbnail-B_DBfYD0.js +6 -0
- package/dist/thumbnail-B_DBfYD0.js.map +1 -0
- package/package.json +33 -31
- package/dist/index.cjs +0 -628
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts +0 -42
package/README.md
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
# andoncloud-prometheus-widget
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
[](https://www.npmjs.com/package/prometheus-widget) [](https://standardjs.com)
|
|
3
|
+
PromQL chart widget for the AndonCloud Dashboard.
|
|
6
4
|
|
|
7
5
|
## Install
|
|
8
6
|
|
|
@@ -15,3 +13,38 @@ npm install --save andoncloud-prometheus-widget
|
|
|
15
13
|
```tsx
|
|
16
14
|
import { Widget, permissions } from 'andoncloud-prometheus-widget';
|
|
17
15
|
```
|
|
16
|
+
|
|
17
|
+
## Settings
|
|
18
|
+
|
|
19
|
+
| Field | Required | Notes |
|
|
20
|
+
|---|---|---|
|
|
21
|
+
| Endpoint URL | yes | Prometheus HTTP API base (e.g. `https://prometheus.example.com`) |
|
|
22
|
+
| Username | no | Optional — fill only if your Prometheus requires HTTP Basic Auth |
|
|
23
|
+
| Password | no | Optional — paired with Username; left empty for anonymous Prometheus |
|
|
24
|
+
| Period | yes | Current shift / Previous shift |
|
|
25
|
+
| Queries | ≥1 | PromQL expressions with display names |
|
|
26
|
+
| Displayed query parameters | optional | Labels to include in dataset names |
|
|
27
|
+
| X-axis unit, Y-axis unit | yes | Axis titles |
|
|
28
|
+
|
|
29
|
+
When **both** Username and Password are filled, the widget sends `Authorization: Basic <base64(user:pass)>` on every Prometheus request. When either is empty, the request is anonymous.
|
|
30
|
+
|
|
31
|
+
If the Endpoint URL uses `http://` (not `https://`) and credentials are filled, the settings dialog shows a non-blocking warning that credentials will be sent over an unencrypted channel.
|
|
32
|
+
|
|
33
|
+
## Error states
|
|
34
|
+
|
|
35
|
+
The widget body distinguishes three failure modes:
|
|
36
|
+
|
|
37
|
+
- **401** — `Could not authenticate to Prometheus. Check the username and password in widget settings.`
|
|
38
|
+
- **403** — `Authenticated, but the Prometheus user has no permission to read these metrics.`
|
|
39
|
+
- network / DNS / TLS / 5xx — `Could not reach Prometheus at the configured URL.`
|
|
40
|
+
|
|
41
|
+
## Development
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
npm start # build:watch + preview
|
|
45
|
+
npm run build # production build
|
|
46
|
+
./scripts/cypress_run_prod.sh # component tests (Docker)
|
|
47
|
+
./scripts/cypress_run_prod.sh --e2e # E2E tests (Docker)
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
See `specs/projects/dashboard/widgets/prometheus-widget/spec.md` for the full project specification.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 180" fill="none">
|
|
2
|
+
<!-- Grid lines (rgba 255,255,255,0.1) -->
|
|
3
|
+
<line x1="40" y1="20" x2="304" y2="20" stroke="#ffffff1a" stroke-width="1"/>
|
|
4
|
+
<line x1="40" y1="50" x2="304" y2="50" stroke="#ffffff1a" stroke-width="1"/>
|
|
5
|
+
<line x1="40" y1="80" x2="304" y2="80" stroke="#ffffff1a" stroke-width="1"/>
|
|
6
|
+
<line x1="40" y1="110" x2="304" y2="110" stroke="#ffffff1a" stroke-width="1"/>
|
|
7
|
+
<line x1="40" y1="140" x2="304" y2="140" stroke="#ffffff1a" stroke-width="1"/>
|
|
8
|
+
|
|
9
|
+
<!-- Area fills -->
|
|
10
|
+
<defs>
|
|
11
|
+
<linearGradient id="g1" x1="0" y1="0" x2="0" y2="1">
|
|
12
|
+
<stop offset="0%" stop-color="#36A2EB" stop-opacity="0.3"/>
|
|
13
|
+
<stop offset="100%" stop-color="#36A2EB" stop-opacity="0"/>
|
|
14
|
+
</linearGradient>
|
|
15
|
+
<linearGradient id="g2" x1="0" y1="0" x2="0" y2="1">
|
|
16
|
+
<stop offset="0%" stop-color="#FF6384" stop-opacity="0.3"/>
|
|
17
|
+
<stop offset="100%" stop-color="#FF6384" stop-opacity="0"/>
|
|
18
|
+
</linearGradient>
|
|
19
|
+
</defs>
|
|
20
|
+
|
|
21
|
+
<!-- Line 1: Uptime (higher values) -->
|
|
22
|
+
<path d="M40,75 C70,55 100,65 140,40 C180,18 220,45 260,30 L304,36 L304,140 L40,140 Z" fill="url(#g1)"/>
|
|
23
|
+
<path d="M40,75 C70,55 100,65 140,40 C180,18 220,45 260,30 L304,36" stroke="#36A2EB" stroke-width="3" fill="none"/>
|
|
24
|
+
|
|
25
|
+
<!-- Line 2: Downtime (lower values, inverse) -->
|
|
26
|
+
<path d="M40,105 C70,90 100,100 140,80 C180,70 220,85 260,65 L304,70 L304,140 L40,140 Z" fill="url(#g2)"/>
|
|
27
|
+
<path d="M40,105 C70,90 100,100 140,80 C180,70 220,85 260,65 L304,70" stroke="#FF6384" stroke-width="3" fill="none"/>
|
|
28
|
+
|
|
29
|
+
<!-- Line 3: removed -->
|
|
30
|
+
|
|
31
|
+
<!-- X-axis time labels -->
|
|
32
|
+
<text x="60" y="155" text-anchor="middle" font-size="8" font-family="Inter, system-ui" fill="#A7ADB6">06:00</text>
|
|
33
|
+
<text x="126" y="155" text-anchor="middle" font-size="8" font-family="Inter, system-ui" fill="#A7ADB6">08:00</text>
|
|
34
|
+
<text x="192" y="155" text-anchor="middle" font-size="8" font-family="Inter, system-ui" fill="#A7ADB6">10:00</text>
|
|
35
|
+
<text x="258" y="155" text-anchor="middle" font-size="8" font-family="Inter, system-ui" fill="#A7ADB6">12:00</text>
|
|
36
|
+
|
|
37
|
+
<!-- Legend -->
|
|
38
|
+
<line x1="44" y1="10" x2="58" y2="10" stroke="#36A2EB" stroke-width="2"/>
|
|
39
|
+
<text x="62" y="13" font-size="9" font-family="Inter, system-ui" fill="#A7ADB6">Uptime</text>
|
|
40
|
+
<line x1="120" y1="10" x2="134" y2="10" stroke="#FF6384" stroke-width="2"/>
|
|
41
|
+
<text x="138" y="13" font-size="9" font-family="Inter, system-ui" fill="#A7ADB6">Downtime</text>
|
|
42
|
+
</svg>
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { t as thumbnail_default } from "./thumbnail-B_DBfYD0.js";
|
|
1
2
|
import { BaseWidgetData, BaseWidgetSettings, FilterValues, ListShifts_Shift, WidgetProps } from "andoncloud-dashboard-toolkit";
|
|
2
3
|
//#region src/types.d.ts
|
|
3
4
|
interface WidgetSettingsData {
|
|
@@ -11,6 +12,8 @@ interface PrometheusQuery {
|
|
|
11
12
|
interface WidgetSettings extends BaseWidgetSettings {
|
|
12
13
|
customTitle: string;
|
|
13
14
|
endpointUrl: string;
|
|
15
|
+
username?: string;
|
|
16
|
+
password?: string;
|
|
14
17
|
queriesPeriod: QueriesPeriod;
|
|
15
18
|
prometheusQueries: PrometheusQuery[];
|
|
16
19
|
displayedQueryParams: string[];
|
|
@@ -30,12 +33,11 @@ declare const getDisplayName: (lang: string) => string;
|
|
|
30
33
|
declare const getTitle: (_data: WidgetData | undefined, settings: WidgetSettings | undefined, _filters: FilterValues | undefined, lang: string) => string;
|
|
31
34
|
//#endregion
|
|
32
35
|
//#region src/version.d.ts
|
|
33
|
-
declare const LIBRARY_VERSION = "1.3.
|
|
36
|
+
declare const LIBRARY_VERSION = "1.3.19";
|
|
34
37
|
//#endregion
|
|
35
38
|
//#region src/index.d.ts
|
|
36
|
-
declare const thumbnail: string | undefined;
|
|
37
39
|
declare const requiredFeatures: string[];
|
|
38
40
|
declare const extraPermissions: string[];
|
|
39
41
|
//#endregion
|
|
40
|
-
export { Widget, extraPermissions, getDisplayName, getTitle, requiredFeatures, thumbnail, LIBRARY_VERSION as version };
|
|
42
|
+
export { Widget, extraPermissions, getDisplayName, getTitle, requiredFeatures, thumbnail_default as thumbnail, LIBRARY_VERSION as version };
|
|
41
43
|
//# sourceMappingURL=index.d.ts.map
|