agent-relay-server 0.4.30 → 0.4.31
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/package.json +1 -1
- package/public/dashboard.js +43 -13
- package/public/index.html +6 -6
package/package.json
CHANGED
package/public/dashboard.js
CHANGED
|
@@ -123,8 +123,9 @@
|
|
|
123
123
|
vm.$watch("pairStatusFilter", (value) => vm.save("pairStatusFilter", value));
|
|
124
124
|
vm.$watch("inboxShowArchived", (value) => vm.save("inboxShowArchived", value));
|
|
125
125
|
vm.$watch("activityFilter", (value) => vm.save("activityFilter", value));
|
|
126
|
-
vm.$watch("view", (value) => {
|
|
126
|
+
vm.$watch("view", (value, oldValue) => {
|
|
127
127
|
vm.save("view", value);
|
|
128
|
+
if (oldValue === "analytics") vm.destroyAllCharts();
|
|
128
129
|
if (value === "analytics") vm.$nextTick(() => vm.renderCharts());
|
|
129
130
|
});
|
|
130
131
|
}
|
|
@@ -2424,6 +2425,7 @@
|
|
|
2424
2425
|
renderVolumeChart,
|
|
2425
2426
|
renderStatusChart,
|
|
2426
2427
|
renderAgentChart,
|
|
2428
|
+
destroyAllCharts,
|
|
2427
2429
|
};
|
|
2428
2430
|
}
|
|
2429
2431
|
|
|
@@ -2434,15 +2436,20 @@
|
|
|
2434
2436
|
}
|
|
2435
2437
|
|
|
2436
2438
|
function renderVolumeChart() {
|
|
2437
|
-
|
|
2439
|
+
const data = buildVolumeSeries(this.messages);
|
|
2440
|
+
|
|
2441
|
+
if (this.chartInstances.volume) {
|
|
2442
|
+
this.chartInstances.volume.updateSeries([{ name: "Messages", data }]);
|
|
2443
|
+
return;
|
|
2444
|
+
}
|
|
2438
2445
|
|
|
2439
2446
|
const el = document.querySelector("#chart-volume");
|
|
2440
2447
|
if (!el) return;
|
|
2441
2448
|
|
|
2442
2449
|
this.chartInstances.volume = new ApexCharts(el, {
|
|
2443
|
-
chart: { type: "area", height: 280, background: "transparent", toolbar: { show: false } },
|
|
2450
|
+
chart: { type: "area", height: 280, background: "transparent", toolbar: { show: false }, animations: { dynamicAnimation: { speed: 350 } } },
|
|
2444
2451
|
theme: { mode: "dark" },
|
|
2445
|
-
series: [{ name: "Messages", data
|
|
2452
|
+
series: [{ name: "Messages", data }],
|
|
2446
2453
|
xaxis: { type: "datetime" },
|
|
2447
2454
|
stroke: { curve: "smooth", width: 2 },
|
|
2448
2455
|
fill: { type: "gradient", gradient: { opacityFrom: 0.4, opacityTo: 0 } },
|
|
@@ -2465,16 +2472,23 @@
|
|
|
2465
2472
|
}
|
|
2466
2473
|
|
|
2467
2474
|
function renderStatusChart() {
|
|
2468
|
-
|
|
2475
|
+
const { labels, series } = countAgentStatuses(this.agents);
|
|
2476
|
+
const colorMap = { online: "#48bb78", idle: "#48bb78", busy: "#ecc94b", offline: "#718096" };
|
|
2477
|
+
|
|
2478
|
+
if (this.chartInstances.status) {
|
|
2479
|
+
this.chartInstances.status.updateOptions({
|
|
2480
|
+
series,
|
|
2481
|
+
labels,
|
|
2482
|
+
colors: labels.map((label) => colorMap[label] || "#718096"),
|
|
2483
|
+
});
|
|
2484
|
+
return;
|
|
2485
|
+
}
|
|
2469
2486
|
|
|
2470
2487
|
const el = document.querySelector("#chart-status");
|
|
2471
2488
|
if (!el) return;
|
|
2472
2489
|
|
|
2473
|
-
const { labels, series } = countAgentStatuses(this.agents);
|
|
2474
|
-
const colorMap = { online: "#48bb78", idle: "#48bb78", busy: "#ecc94b", offline: "#718096" };
|
|
2475
|
-
|
|
2476
2490
|
this.chartInstances.status = new ApexCharts(el, {
|
|
2477
|
-
chart: { type: "donut", height: 280, background: "transparent" },
|
|
2491
|
+
chart: { type: "donut", height: 280, background: "transparent", animations: { dynamicAnimation: { speed: 350 } } },
|
|
2478
2492
|
theme: { mode: "dark" },
|
|
2479
2493
|
series,
|
|
2480
2494
|
labels,
|
|
@@ -2494,14 +2508,21 @@
|
|
|
2494
2508
|
}
|
|
2495
2509
|
|
|
2496
2510
|
function renderAgentChart() {
|
|
2497
|
-
|
|
2511
|
+
const sorted = countMessagesByAgent(this);
|
|
2512
|
+
|
|
2513
|
+
if (this.chartInstances.agents) {
|
|
2514
|
+
this.chartInstances.agents.updateOptions({
|
|
2515
|
+
series: [{ name: "Messages", data: sorted.map(([, count]) => count) }],
|
|
2516
|
+
xaxis: { categories: sorted.map(([name]) => name) },
|
|
2517
|
+
});
|
|
2518
|
+
return;
|
|
2519
|
+
}
|
|
2498
2520
|
|
|
2499
2521
|
const el = document.querySelector("#chart-agents");
|
|
2500
2522
|
if (!el) return;
|
|
2501
2523
|
|
|
2502
|
-
const sorted = countMessagesByAgent(this);
|
|
2503
2524
|
this.chartInstances.agents = new ApexCharts(el, {
|
|
2504
|
-
chart: { type: "bar", height: 280, background: "transparent", toolbar: { show: false } },
|
|
2525
|
+
chart: { type: "bar", height: 280, background: "transparent", toolbar: { show: false }, animations: { dynamicAnimation: { speed: 350 } } },
|
|
2505
2526
|
theme: { mode: "dark" },
|
|
2506
2527
|
series: [{ name: "Messages", data: sorted.map(([, count]) => count) }],
|
|
2507
2528
|
xaxis: { categories: sorted.map(([name]) => name) },
|
|
@@ -2523,7 +2544,16 @@
|
|
|
2523
2544
|
}
|
|
2524
2545
|
|
|
2525
2546
|
function destroyChart(vm, name) {
|
|
2526
|
-
if (vm.chartInstances[name])
|
|
2547
|
+
if (vm.chartInstances[name]) {
|
|
2548
|
+
vm.chartInstances[name].destroy();
|
|
2549
|
+
vm.chartInstances[name] = null;
|
|
2550
|
+
}
|
|
2551
|
+
}
|
|
2552
|
+
|
|
2553
|
+
function destroyAllCharts() {
|
|
2554
|
+
destroyChart(this, "volume");
|
|
2555
|
+
destroyChart(this, "status");
|
|
2556
|
+
destroyChart(this, "agents");
|
|
2527
2557
|
}
|
|
2528
2558
|
|
|
2529
2559
|
function createRelayDashboard() {
|
package/public/index.html
CHANGED
|
@@ -433,7 +433,7 @@
|
|
|
433
433
|
</div>
|
|
434
434
|
<div class="list-group list-group-flush" style="max-height: 60vh; overflow-y: auto">
|
|
435
435
|
<template x-for="a in sortedAgents.slice(0, 20)" :key="a.id">
|
|
436
|
-
<div class="list-group-item d-flex align-items-center gap-2" style="cursor:pointer" @click="openAgentDetail(a)">
|
|
436
|
+
<div class="list-group-item d-flex align-items-center gap-2" style="cursor:pointer" @click="if (!window.getSelection().toString()) openAgentDetail(a)">
|
|
437
437
|
<span class="status-dot" :class="agentStatusClass(a)"></span>
|
|
438
438
|
<span class="agent-type-icon" :class="agentType(a)" :title="agentTypeTitle(a)" :aria-label="agentTypeTitle(a)">
|
|
439
439
|
<i class="ti" :class="agentTypeIcon(a)"></i>
|
|
@@ -483,7 +483,7 @@
|
|
|
483
483
|
</div>
|
|
484
484
|
<div class="card-body p-0" style="max-height: 60vh; overflow-y: auto">
|
|
485
485
|
<template x-for="item in activityItems.slice(0, 15)" :key="item.id">
|
|
486
|
-
<
|
|
486
|
+
<div role="button" class="list-group-item list-group-item-action activity-item text-start w-100 border-0 border-bottom rounded-0" style="cursor:pointer" @click="if (!window.getSelection().toString()) openActivityItem(item)">
|
|
487
487
|
<div class="d-flex align-items-start gap-3">
|
|
488
488
|
<span class="activity-icon" :class="activityKindClass(item.kind)">
|
|
489
489
|
<i class="ti" :class="item.icon"></i>
|
|
@@ -498,7 +498,7 @@
|
|
|
498
498
|
<div class="text-secondary small text-truncate" x-show="item.meta" x-text="item.meta"></div>
|
|
499
499
|
</div>
|
|
500
500
|
</div>
|
|
501
|
-
</
|
|
501
|
+
</div>
|
|
502
502
|
</template>
|
|
503
503
|
<template x-if="activityItems.length === 0">
|
|
504
504
|
<div class="p-3 text-secondary text-center">No activity</div>
|
|
@@ -568,7 +568,7 @@
|
|
|
568
568
|
<div class="row g-3">
|
|
569
569
|
<template x-for="a in sortedAgents" :key="a.id">
|
|
570
570
|
<div class="col-md-6 col-xl-4">
|
|
571
|
-
<div class="card agent-card" :class="{ selected: selectedAgent === a.id }" @click="openAgentDetail(a)">
|
|
571
|
+
<div class="card agent-card" :class="{ selected: selectedAgent === a.id }" @click="if (!window.getSelection().toString()) openAgentDetail(a)">
|
|
572
572
|
<div class="card-body">
|
|
573
573
|
<div class="d-flex align-items-start gap-2">
|
|
574
574
|
<span class="status-dot mt-1" :class="agentStatusClass(a)" :title="agentStatusTitle(a)"></span>
|
|
@@ -1028,7 +1028,7 @@
|
|
|
1028
1028
|
<div class="card">
|
|
1029
1029
|
<div class="list-group list-group-flush">
|
|
1030
1030
|
<template x-for="item in activityItems" :key="item.id">
|
|
1031
|
-
<
|
|
1031
|
+
<div role="button" class="list-group-item list-group-item-action activity-item text-start" style="cursor:pointer" @click="if (!window.getSelection().toString()) openActivityItem(item)">
|
|
1032
1032
|
<div class="d-flex align-items-start gap-3">
|
|
1033
1033
|
<span class="activity-icon" :class="activityKindClass(item.kind)">
|
|
1034
1034
|
<i class="ti" :class="item.icon"></i>
|
|
@@ -1043,7 +1043,7 @@
|
|
|
1043
1043
|
<div class="text-secondary small mt-1 text-truncate" x-show="item.meta" x-text="item.meta"></div>
|
|
1044
1044
|
</div>
|
|
1045
1045
|
</div>
|
|
1046
|
-
</
|
|
1046
|
+
</div>
|
|
1047
1047
|
</template>
|
|
1048
1048
|
<template x-if="activityItems.length === 0">
|
|
1049
1049
|
<div class="list-group-item text-secondary text-center py-5">
|