myio-js-library 0.1.415 → 0.1.416
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/dist/index.cjs +24 -7
- package/dist/index.d.cts +13 -1
- package/dist/index.js +24 -7
- package/dist/myio-js-library.umd.js +26 -9
- package/dist/myio-js-library.umd.min.js +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1122,7 +1122,7 @@ module.exports = __toCommonJS(index_exports);
|
|
|
1122
1122
|
// package.json
|
|
1123
1123
|
var package_default = {
|
|
1124
1124
|
name: "myio-js-library",
|
|
1125
|
-
version: "0.1.
|
|
1125
|
+
version: "0.1.416",
|
|
1126
1126
|
description: "A clean, standalone JS SDK for MYIO projects",
|
|
1127
1127
|
license: "MIT",
|
|
1128
1128
|
repository: "github:gh-myio/myio-js-library",
|
|
@@ -105080,9 +105080,9 @@ function mapApiStats(api) {
|
|
|
105080
105080
|
}
|
|
105081
105081
|
function mapApiTrend(apiTrend) {
|
|
105082
105082
|
return (apiTrend || []).map((point) => ({
|
|
105083
|
-
label: point.period,
|
|
105084
|
-
timestamp: new Date(point.period).getTime() || 0,
|
|
105085
|
-
total: point.count,
|
|
105083
|
+
label: point.label || point.period,
|
|
105084
|
+
timestamp: point.timestamp || new Date(point.period).getTime() || 0,
|
|
105085
|
+
total: point.total ?? point.count,
|
|
105086
105086
|
bySeverity: point.bySeverity ? {
|
|
105087
105087
|
CRITICAL: point.bySeverity.CRITICAL ?? 0,
|
|
105088
105088
|
HIGH: point.bySeverity.HIGH ?? 0,
|
|
@@ -105913,6 +105913,9 @@ var AlarmsNotificationsPanelView = class {
|
|
|
105913
105913
|
groupedAlarms = [];
|
|
105914
105914
|
// View mode: 'card' (default) or 'list' (table)
|
|
105915
105915
|
viewMode = "card";
|
|
105916
|
+
// Trend chart data (fetched once when Dashboard tab first opens)
|
|
105917
|
+
trendData = [];
|
|
105918
|
+
trendFetched = false;
|
|
105916
105919
|
// Group mode:
|
|
105917
105920
|
// 'consolidado' – Por Tipo de Alarme (one row per alarm type, all devices merged)
|
|
105918
105921
|
// 'separado' – Por Dispositivo - Tipo (one row per device × alarm type pair)
|
|
@@ -106301,18 +106304,32 @@ var AlarmsNotificationsPanelView = class {
|
|
|
106301
106304
|
this.emit("cards-rendered", this.groupedAlarms.length);
|
|
106302
106305
|
}
|
|
106303
106306
|
/**
|
|
106304
|
-
* Render dashboard tab content
|
|
106307
|
+
* Render dashboard tab content.
|
|
106308
|
+
* Trend data is fetched asynchronously on first open and injected when ready.
|
|
106305
106309
|
*/
|
|
106306
106310
|
renderDashboardContent(state6) {
|
|
106307
106311
|
if (!this.root) return;
|
|
106308
106312
|
const container = this.root.querySelector("#dashboardContent");
|
|
106309
106313
|
if (!container) return;
|
|
106310
106314
|
if (container.children.length > 0) {
|
|
106311
|
-
updateDashboard(container, state6.stats);
|
|
106315
|
+
updateDashboard(container, state6.stats, this.trendData);
|
|
106312
106316
|
} else {
|
|
106313
|
-
container.innerHTML = renderDashboard(state6.stats);
|
|
106317
|
+
container.innerHTML = renderDashboard(state6.stats, this.trendData);
|
|
106314
106318
|
}
|
|
106315
106319
|
this.emit("stats-updated", state6.stats);
|
|
106320
|
+
if (!this.trendFetched && this.params.tenantId) {
|
|
106321
|
+
this.trendFetched = true;
|
|
106322
|
+
AlarmService.getAlarmTrend(this.params.tenantId, "week", "day").then((data) => {
|
|
106323
|
+
this.trendData = data;
|
|
106324
|
+
const trendArea = container.querySelector(
|
|
106325
|
+
".alarms-chart-card:nth-child(1) .alarms-chart-area"
|
|
106326
|
+
);
|
|
106327
|
+
if (trendArea) {
|
|
106328
|
+
updateDashboard(container, this.controller.getState().stats, this.trendData);
|
|
106329
|
+
}
|
|
106330
|
+
}).catch(() => {
|
|
106331
|
+
});
|
|
106332
|
+
}
|
|
106316
106333
|
}
|
|
106317
106334
|
// =====================================================================
|
|
106318
106335
|
// Bulk Selection
|
package/dist/index.d.cts
CHANGED
|
@@ -14437,6 +14437,8 @@ interface AlarmsNotificationsPanelParams {
|
|
|
14437
14437
|
alarmsApiBaseUrl?: string;
|
|
14438
14438
|
/** Alarms API key (required — no hardcoded fallback) */
|
|
14439
14439
|
alarmsApiKey?: string;
|
|
14440
|
+
/** GCDR Tenant ID — required for trend/stats API calls (query param tenantId) */
|
|
14441
|
+
tenantId?: string;
|
|
14440
14442
|
/** Theme mode (default: 'dark') */
|
|
14441
14443
|
themeMode?: ThemeMode;
|
|
14442
14444
|
/** Enable debug logging */
|
|
@@ -14751,6 +14753,8 @@ declare class AlarmsNotificationsPanelView {
|
|
|
14751
14753
|
private selectedTitles;
|
|
14752
14754
|
private groupedAlarms;
|
|
14753
14755
|
private viewMode;
|
|
14756
|
+
private trendData;
|
|
14757
|
+
private trendFetched;
|
|
14754
14758
|
private groupMode;
|
|
14755
14759
|
private sortCol;
|
|
14756
14760
|
private sortDir;
|
|
@@ -14784,7 +14788,8 @@ declare class AlarmsNotificationsPanelView {
|
|
|
14784
14788
|
*/
|
|
14785
14789
|
private renderListContent;
|
|
14786
14790
|
/**
|
|
14787
|
-
* Render dashboard tab content
|
|
14791
|
+
* Render dashboard tab content.
|
|
14792
|
+
* Trend data is fetched asynchronously on first open and injected when ready.
|
|
14788
14793
|
*/
|
|
14789
14794
|
private renderDashboardContent;
|
|
14790
14795
|
private handleAlarmSelect;
|
|
@@ -17985,6 +17990,13 @@ interface AlarmStatsApiResponse {
|
|
|
17985
17990
|
}
|
|
17986
17991
|
interface AlarmTrendApiPoint {
|
|
17987
17992
|
period: string;
|
|
17993
|
+
/** Pre-formatted display label returned by the API (e.g. "23/02") */
|
|
17994
|
+
label?: string;
|
|
17995
|
+
/** Millisecond timestamp returned by the API */
|
|
17996
|
+
timestamp?: number;
|
|
17997
|
+
/** Total alarm count (preferred field) */
|
|
17998
|
+
total?: number;
|
|
17999
|
+
/** Total alarm count (alias — same value as total) */
|
|
17988
18000
|
count: number;
|
|
17989
18001
|
bySeverity?: Record<string, number>;
|
|
17990
18002
|
}
|
package/dist/index.js
CHANGED
|
@@ -546,7 +546,7 @@ var init_template_card = __esm({
|
|
|
546
546
|
// package.json
|
|
547
547
|
var package_default = {
|
|
548
548
|
name: "myio-js-library",
|
|
549
|
-
version: "0.1.
|
|
549
|
+
version: "0.1.416",
|
|
550
550
|
description: "A clean, standalone JS SDK for MYIO projects",
|
|
551
551
|
license: "MIT",
|
|
552
552
|
repository: "github:gh-myio/myio-js-library",
|
|
@@ -104504,9 +104504,9 @@ function mapApiStats(api) {
|
|
|
104504
104504
|
}
|
|
104505
104505
|
function mapApiTrend(apiTrend) {
|
|
104506
104506
|
return (apiTrend || []).map((point) => ({
|
|
104507
|
-
label: point.period,
|
|
104508
|
-
timestamp: new Date(point.period).getTime() || 0,
|
|
104509
|
-
total: point.count,
|
|
104507
|
+
label: point.label || point.period,
|
|
104508
|
+
timestamp: point.timestamp || new Date(point.period).getTime() || 0,
|
|
104509
|
+
total: point.total ?? point.count,
|
|
104510
104510
|
bySeverity: point.bySeverity ? {
|
|
104511
104511
|
CRITICAL: point.bySeverity.CRITICAL ?? 0,
|
|
104512
104512
|
HIGH: point.bySeverity.HIGH ?? 0,
|
|
@@ -105337,6 +105337,9 @@ var AlarmsNotificationsPanelView = class {
|
|
|
105337
105337
|
groupedAlarms = [];
|
|
105338
105338
|
// View mode: 'card' (default) or 'list' (table)
|
|
105339
105339
|
viewMode = "card";
|
|
105340
|
+
// Trend chart data (fetched once when Dashboard tab first opens)
|
|
105341
|
+
trendData = [];
|
|
105342
|
+
trendFetched = false;
|
|
105340
105343
|
// Group mode:
|
|
105341
105344
|
// 'consolidado' – Por Tipo de Alarme (one row per alarm type, all devices merged)
|
|
105342
105345
|
// 'separado' – Por Dispositivo - Tipo (one row per device × alarm type pair)
|
|
@@ -105725,18 +105728,32 @@ var AlarmsNotificationsPanelView = class {
|
|
|
105725
105728
|
this.emit("cards-rendered", this.groupedAlarms.length);
|
|
105726
105729
|
}
|
|
105727
105730
|
/**
|
|
105728
|
-
* Render dashboard tab content
|
|
105731
|
+
* Render dashboard tab content.
|
|
105732
|
+
* Trend data is fetched asynchronously on first open and injected when ready.
|
|
105729
105733
|
*/
|
|
105730
105734
|
renderDashboardContent(state6) {
|
|
105731
105735
|
if (!this.root) return;
|
|
105732
105736
|
const container = this.root.querySelector("#dashboardContent");
|
|
105733
105737
|
if (!container) return;
|
|
105734
105738
|
if (container.children.length > 0) {
|
|
105735
|
-
updateDashboard(container, state6.stats);
|
|
105739
|
+
updateDashboard(container, state6.stats, this.trendData);
|
|
105736
105740
|
} else {
|
|
105737
|
-
container.innerHTML = renderDashboard(state6.stats);
|
|
105741
|
+
container.innerHTML = renderDashboard(state6.stats, this.trendData);
|
|
105738
105742
|
}
|
|
105739
105743
|
this.emit("stats-updated", state6.stats);
|
|
105744
|
+
if (!this.trendFetched && this.params.tenantId) {
|
|
105745
|
+
this.trendFetched = true;
|
|
105746
|
+
AlarmService.getAlarmTrend(this.params.tenantId, "week", "day").then((data) => {
|
|
105747
|
+
this.trendData = data;
|
|
105748
|
+
const trendArea = container.querySelector(
|
|
105749
|
+
".alarms-chart-card:nth-child(1) .alarms-chart-area"
|
|
105750
|
+
);
|
|
105751
|
+
if (trendArea) {
|
|
105752
|
+
updateDashboard(container, this.controller.getState().stats, this.trendData);
|
|
105753
|
+
}
|
|
105754
|
+
}).catch(() => {
|
|
105755
|
+
});
|
|
105756
|
+
}
|
|
105740
105757
|
}
|
|
105741
105758
|
// =====================================================================
|
|
105742
105759
|
// Bulk Selection
|
|
@@ -551,7 +551,7 @@
|
|
|
551
551
|
|
|
552
552
|
// package.json
|
|
553
553
|
var package_default = {
|
|
554
|
-
version: "0.1.
|
|
554
|
+
version: "0.1.416"};
|
|
555
555
|
|
|
556
556
|
// src/format/energy.ts
|
|
557
557
|
function formatPower(value, decimals = 2) {
|
|
@@ -104231,9 +104231,9 @@ ${errors.slice(0, 5).join("\n")}` + (errors.length > 5 ? `
|
|
|
104231
104231
|
}
|
|
104232
104232
|
function mapApiTrend(apiTrend) {
|
|
104233
104233
|
return (apiTrend || []).map((point) => ({
|
|
104234
|
-
label: point.period,
|
|
104235
|
-
timestamp: new Date(point.period).getTime() || 0,
|
|
104236
|
-
total: point.count,
|
|
104234
|
+
label: point.label || point.period,
|
|
104235
|
+
timestamp: point.timestamp || new Date(point.period).getTime() || 0,
|
|
104236
|
+
total: point.total ?? point.count,
|
|
104237
104237
|
bySeverity: point.bySeverity ? {
|
|
104238
104238
|
CRITICAL: point.bySeverity.CRITICAL ?? 0,
|
|
104239
104239
|
HIGH: point.bySeverity.HIGH ?? 0,
|
|
@@ -105010,7 +105010,7 @@ ${errors.slice(0, 5).join("\n")}` + (errors.length > 5 ? `
|
|
|
105010
105010
|
}
|
|
105011
105011
|
function renderDashboard(stats, trendData) {
|
|
105012
105012
|
const kpiCards = renderKPICards(stats);
|
|
105013
|
-
const trendChart = renderTrendChart([]);
|
|
105013
|
+
const trendChart = renderTrendChart(trendData || []);
|
|
105014
105014
|
const stateDonut = renderStateDonutChart(stats.byState);
|
|
105015
105015
|
const severityBars = renderSeverityBarChart(stats.bySeverity);
|
|
105016
105016
|
return `
|
|
@@ -105040,7 +105040,7 @@ ${errors.slice(0, 5).join("\n")}` + (errors.length > 5 ? `
|
|
|
105040
105040
|
updateKPIValues(container, stats);
|
|
105041
105041
|
const trendArea = container.querySelector(".alarms-chart-card:nth-child(1) .alarms-chart-area");
|
|
105042
105042
|
if (trendArea) {
|
|
105043
|
-
trendArea.innerHTML = renderTrendChart([]);
|
|
105043
|
+
trendArea.innerHTML = renderTrendChart(trendData || []);
|
|
105044
105044
|
}
|
|
105045
105045
|
const stateArea = container.querySelector(".alarms-chart-card:nth-child(2) .alarms-chart-area");
|
|
105046
105046
|
if (stateArea) {
|
|
@@ -105064,6 +105064,9 @@ ${errors.slice(0, 5).join("\n")}` + (errors.length > 5 ? `
|
|
|
105064
105064
|
groupedAlarms = [];
|
|
105065
105065
|
// View mode: 'card' (default) or 'list' (table)
|
|
105066
105066
|
viewMode = "card";
|
|
105067
|
+
// Trend chart data (fetched once when Dashboard tab first opens)
|
|
105068
|
+
trendData = [];
|
|
105069
|
+
trendFetched = false;
|
|
105067
105070
|
// Group mode:
|
|
105068
105071
|
// 'consolidado' – Por Tipo de Alarme (one row per alarm type, all devices merged)
|
|
105069
105072
|
// 'separado' – Por Dispositivo - Tipo (one row per device × alarm type pair)
|
|
@@ -105452,18 +105455,32 @@ ${errors.slice(0, 5).join("\n")}` + (errors.length > 5 ? `
|
|
|
105452
105455
|
this.emit("cards-rendered", this.groupedAlarms.length);
|
|
105453
105456
|
}
|
|
105454
105457
|
/**
|
|
105455
|
-
* Render dashboard tab content
|
|
105458
|
+
* Render dashboard tab content.
|
|
105459
|
+
* Trend data is fetched asynchronously on first open and injected when ready.
|
|
105456
105460
|
*/
|
|
105457
105461
|
renderDashboardContent(state6) {
|
|
105458
105462
|
if (!this.root) return;
|
|
105459
105463
|
const container = this.root.querySelector("#dashboardContent");
|
|
105460
105464
|
if (!container) return;
|
|
105461
105465
|
if (container.children.length > 0) {
|
|
105462
|
-
updateDashboard(container, state6.stats);
|
|
105466
|
+
updateDashboard(container, state6.stats, this.trendData);
|
|
105463
105467
|
} else {
|
|
105464
|
-
container.innerHTML = renderDashboard(state6.stats);
|
|
105468
|
+
container.innerHTML = renderDashboard(state6.stats, this.trendData);
|
|
105465
105469
|
}
|
|
105466
105470
|
this.emit("stats-updated", state6.stats);
|
|
105471
|
+
if (!this.trendFetched && this.params.tenantId) {
|
|
105472
|
+
this.trendFetched = true;
|
|
105473
|
+
AlarmService.getAlarmTrend(this.params.tenantId, "week", "day").then((data) => {
|
|
105474
|
+
this.trendData = data;
|
|
105475
|
+
const trendArea = container.querySelector(
|
|
105476
|
+
".alarms-chart-card:nth-child(1) .alarms-chart-area"
|
|
105477
|
+
);
|
|
105478
|
+
if (trendArea) {
|
|
105479
|
+
updateDashboard(container, this.controller.getState().stats, this.trendData);
|
|
105480
|
+
}
|
|
105481
|
+
}).catch(() => {
|
|
105482
|
+
});
|
|
105483
|
+
}
|
|
105467
105484
|
}
|
|
105468
105485
|
// =====================================================================
|
|
105469
105486
|
// Bulk Selection
|