polyv-live-cli 1.1.2 → 1.1.5
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/commands/index.d.ts +1 -0
- package/dist/commands/index.d.ts.map +1 -1
- package/dist/commands/index.js +3 -1
- package/dist/commands/index.js.map +1 -1
- package/dist/commands/monitor.commands.d.ts +12 -0
- package/dist/commands/monitor.commands.d.ts.map +1 -0
- package/dist/commands/monitor.commands.js +75 -0
- package/dist/commands/monitor.commands.js.map +1 -0
- package/dist/components/alert.panel.d.ts +98 -0
- package/dist/components/alert.panel.d.ts.map +1 -0
- package/dist/components/alert.panel.js +1000 -0
- package/dist/components/alert.panel.js.map +1 -0
- package/dist/components/base.component.d.ts +61 -0
- package/dist/components/base.component.d.ts.map +1 -0
- package/dist/components/base.component.js +346 -0
- package/dist/components/base.component.js.map +1 -0
- package/dist/components/batch-operations.dialog.d.ts +58 -0
- package/dist/components/batch-operations.dialog.d.ts.map +1 -0
- package/dist/components/batch-operations.dialog.js +340 -0
- package/dist/components/batch-operations.dialog.js.map +1 -0
- package/dist/components/channel-details.popup.d.ts +55 -0
- package/dist/components/channel-details.popup.d.ts.map +1 -0
- package/dist/components/channel-details.popup.js +416 -0
- package/dist/components/channel-details.popup.js.map +1 -0
- package/dist/components/channel-status.panel.d.ts +129 -0
- package/dist/components/channel-status.panel.d.ts.map +1 -0
- package/dist/components/channel-status.panel.js +858 -0
- package/dist/components/channel-status.panel.js.map +1 -0
- package/dist/components/component-registry.d.ts +36 -0
- package/dist/components/component-registry.d.ts.map +1 -0
- package/dist/components/component-registry.js +119 -0
- package/dist/components/component-registry.js.map +1 -0
- package/dist/components/context-menu-factory.d.ts +13 -0
- package/dist/components/context-menu-factory.d.ts.map +1 -0
- package/dist/components/context-menu-factory.js +341 -0
- package/dist/components/context-menu-factory.js.map +1 -0
- package/dist/components/context-menu.d.ts +54 -0
- package/dist/components/context-menu.d.ts.map +1 -0
- package/dist/components/context-menu.js +235 -0
- package/dist/components/context-menu.js.map +1 -0
- package/dist/components/grid-manager.d.ts +52 -0
- package/dist/components/grid-manager.d.ts.map +1 -0
- package/dist/components/grid-manager.js +404 -0
- package/dist/components/grid-manager.js.map +1 -0
- package/dist/components/help-panel.d.ts +34 -0
- package/dist/components/help-panel.d.ts.map +1 -0
- package/dist/components/help-panel.js +249 -0
- package/dist/components/help-panel.js.map +1 -0
- package/dist/components/index.d.ts +20 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +43 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/interaction-manager.d.ts +47 -0
- package/dist/components/interaction-manager.d.ts.map +1 -0
- package/dist/components/interaction-manager.js +597 -0
- package/dist/components/interaction-manager.js.map +1 -0
- package/dist/components/layout-manager.d.ts +76 -0
- package/dist/components/layout-manager.d.ts.map +1 -0
- package/dist/components/layout-manager.js +538 -0
- package/dist/components/layout-manager.js.map +1 -0
- package/dist/components/monitoring-dashboard.d.ts +85 -0
- package/dist/components/monitoring-dashboard.d.ts.map +1 -0
- package/dist/components/monitoring-dashboard.js +908 -0
- package/dist/components/monitoring-dashboard.js.map +1 -0
- package/dist/components/search-panel.d.ts +80 -0
- package/dist/components/search-panel.d.ts.map +1 -0
- package/dist/components/search-panel.js +585 -0
- package/dist/components/search-panel.js.map +1 -0
- package/dist/components/status-bar.d.ts +77 -0
- package/dist/components/status-bar.d.ts.map +1 -0
- package/dist/components/status-bar.js +482 -0
- package/dist/components/status-bar.js.map +1 -0
- package/dist/components/status.component.d.ts +16 -0
- package/dist/components/status.component.d.ts.map +1 -0
- package/dist/components/status.component.js +79 -0
- package/dist/components/status.component.js.map +1 -0
- package/dist/components/stream-metrics.panel.d.ts +86 -0
- package/dist/components/stream-metrics.panel.d.ts.map +1 -0
- package/dist/components/stream-metrics.panel.js +395 -0
- package/dist/components/stream-metrics.panel.js.map +1 -0
- package/dist/components/system-resource.panel.d.ts +78 -0
- package/dist/components/system-resource.panel.d.ts.map +1 -0
- package/dist/components/system-resource.panel.js +642 -0
- package/dist/components/system-resource.panel.js.map +1 -0
- package/dist/components/tooltip.d.ts +35 -0
- package/dist/components/tooltip.d.ts.map +1 -0
- package/dist/components/tooltip.js +156 -0
- package/dist/components/tooltip.js.map +1 -0
- package/dist/config/config-io.d.ts +63 -0
- package/dist/config/config-io.d.ts.map +1 -0
- package/dist/config/config-io.js +352 -0
- package/dist/config/config-io.js.map +1 -0
- package/dist/config/config-manager.d.ts +51 -0
- package/dist/config/config-manager.d.ts.map +1 -0
- package/dist/config/config-manager.js +404 -0
- package/dist/config/config-manager.js.map +1 -0
- package/dist/config/config-validator.d.ts +27 -0
- package/dist/config/config-validator.d.ts.map +1 -0
- package/dist/config/config-validator.js +421 -0
- package/dist/config/config-validator.js.map +1 -0
- package/dist/config/custom-theme-builder.d.ts +88 -0
- package/dist/config/custom-theme-builder.d.ts.map +1 -0
- package/dist/config/custom-theme-builder.js +458 -0
- package/dist/config/custom-theme-builder.js.map +1 -0
- package/dist/config/layout-manager.d.ts +60 -0
- package/dist/config/layout-manager.d.ts.map +1 -0
- package/dist/config/layout-manager.js +595 -0
- package/dist/config/layout-manager.js.map +1 -0
- package/dist/config/monitoring.d.ts +27 -0
- package/dist/config/monitoring.d.ts.map +1 -0
- package/dist/config/monitoring.js +276 -0
- package/dist/config/monitoring.js.map +1 -0
- package/dist/config/theme-manager.d.ts +53 -0
- package/dist/config/theme-manager.d.ts.map +1 -0
- package/dist/config/theme-manager.js +490 -0
- package/dist/config/theme-manager.js.map +1 -0
- package/dist/handlers/monitor.handler.d.ts +28 -0
- package/dist/handlers/monitor.handler.d.ts.map +1 -0
- package/dist/handlers/monitor.handler.js +457 -0
- package/dist/handlers/monitor.handler.js.map +1 -0
- package/dist/index.d.ts +9 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +24 -3
- package/dist/index.js.map +1 -1
- package/dist/performance/adaptive-polling.d.ts +69 -0
- package/dist/performance/adaptive-polling.d.ts.map +1 -0
- package/dist/performance/adaptive-polling.js +313 -0
- package/dist/performance/adaptive-polling.js.map +1 -0
- package/dist/performance/api-analytics.d.ts +137 -0
- package/dist/performance/api-analytics.d.ts.map +1 -0
- package/dist/performance/api-analytics.js +351 -0
- package/dist/performance/api-analytics.js.map +1 -0
- package/dist/performance/api-optimizer.d.ts +66 -0
- package/dist/performance/api-optimizer.d.ts.map +1 -0
- package/dist/performance/api-optimizer.js +368 -0
- package/dist/performance/api-optimizer.js.map +1 -0
- package/dist/performance/batch-request-manager.d.ts +89 -0
- package/dist/performance/batch-request-manager.d.ts.map +1 -0
- package/dist/performance/batch-request-manager.js +351 -0
- package/dist/performance/batch-request-manager.js.map +1 -0
- package/dist/performance/change-detector.d.ts +75 -0
- package/dist/performance/change-detector.d.ts.map +1 -0
- package/dist/performance/change-detector.js +392 -0
- package/dist/performance/change-detector.js.map +1 -0
- package/dist/performance/connection-pool-manager.d.ts +99 -0
- package/dist/performance/connection-pool-manager.d.ts.map +1 -0
- package/dist/performance/connection-pool-manager.js +474 -0
- package/dist/performance/connection-pool-manager.js.map +1 -0
- package/dist/performance/error-recovery-manager.d.ts +134 -0
- package/dist/performance/error-recovery-manager.d.ts.map +1 -0
- package/dist/performance/error-recovery-manager.js +673 -0
- package/dist/performance/error-recovery-manager.js.map +1 -0
- package/dist/performance/fallback-manager.d.ts +123 -0
- package/dist/performance/fallback-manager.d.ts.map +1 -0
- package/dist/performance/fallback-manager.js +524 -0
- package/dist/performance/fallback-manager.js.map +1 -0
- package/dist/performance/index.d.ts +13 -0
- package/dist/performance/index.d.ts.map +1 -0
- package/dist/performance/index.js +28 -0
- package/dist/performance/index.js.map +1 -0
- package/dist/performance/memory-manager.d.ts +97 -0
- package/dist/performance/memory-manager.d.ts.map +1 -0
- package/dist/performance/memory-manager.js +417 -0
- package/dist/performance/memory-manager.js.map +1 -0
- package/dist/performance/performance-monitor.d.ts +149 -0
- package/dist/performance/performance-monitor.d.ts.map +1 -0
- package/dist/performance/performance-monitor.js +513 -0
- package/dist/performance/performance-monitor.js.map +1 -0
- package/dist/performance/performance-optimizer.d.ts +110 -0
- package/dist/performance/performance-optimizer.d.ts.map +1 -0
- package/dist/performance/performance-optimizer.js +476 -0
- package/dist/performance/performance-optimizer.js.map +1 -0
- package/dist/performance/render-optimizer.d.ts +95 -0
- package/dist/performance/render-optimizer.d.ts.map +1 -0
- package/dist/performance/render-optimizer.js +408 -0
- package/dist/performance/render-optimizer.js.map +1 -0
- package/dist/services/index.d.ts +1 -0
- package/dist/services/index.d.ts.map +1 -1
- package/dist/services/index.js +3 -1
- package/dist/services/index.js.map +1 -1
- package/dist/services/system-resource.service.d.ts +168 -0
- package/dist/services/system-resource.service.d.ts.map +1 -0
- package/dist/services/system-resource.service.js +544 -0
- package/dist/services/system-resource.service.js.map +1 -0
- package/dist/types/alert.d.ts +147 -0
- package/dist/types/alert.d.ts.map +1 -0
- package/dist/types/alert.js +3 -0
- package/dist/types/alert.js.map +1 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +2 -0
- package/dist/types/index.js.map +1 -1
- package/dist/types/interaction.d.ts +147 -0
- package/dist/types/interaction.d.ts.map +1 -0
- package/dist/types/interaction.js +3 -0
- package/dist/types/interaction.js.map +1 -0
- package/dist/types/monitoring.d.ts +233 -0
- package/dist/types/monitoring.d.ts.map +1 -0
- package/dist/types/monitoring.js +35 -0
- package/dist/types/monitoring.js.map +1 -0
- package/dist/utils/alert-history-manager.d.ts +72 -0
- package/dist/utils/alert-history-manager.d.ts.map +1 -0
- package/dist/utils/alert-history-manager.js +492 -0
- package/dist/utils/alert-history-manager.js.map +1 -0
- package/dist/utils/alert-manager.d.ts +75 -0
- package/dist/utils/alert-manager.d.ts.map +1 -0
- package/dist/utils/alert-manager.js +348 -0
- package/dist/utils/alert-manager.js.map +1 -0
- package/dist/utils/alert-rule-manager.d.ts +51 -0
- package/dist/utils/alert-rule-manager.d.ts.map +1 -0
- package/dist/utils/alert-rule-manager.js +515 -0
- package/dist/utils/alert-rule-manager.js.map +1 -0
- package/dist/utils/data-manager.d.ts +53 -0
- package/dist/utils/data-manager.d.ts.map +1 -0
- package/dist/utils/data-manager.js +228 -0
- package/dist/utils/data-manager.js.map +1 -0
- package/dist/utils/formatter.d.ts +5 -0
- package/dist/utils/formatter.d.ts.map +1 -1
- package/dist/utils/formatter.js +19 -0
- package/dist/utils/formatter.js.map +1 -1
- package/dist/utils/index.d.ts +6 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +6 -0
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/keyboard-handler.d.ts +32 -0
- package/dist/utils/keyboard-handler.d.ts.map +1 -0
- package/dist/utils/keyboard-handler.js +193 -0
- package/dist/utils/keyboard-handler.js.map +1 -0
- package/dist/utils/mouse-handler.d.ts +61 -0
- package/dist/utils/mouse-handler.d.ts.map +1 -0
- package/dist/utils/mouse-handler.js +192 -0
- package/dist/utils/mouse-handler.js.map +1 -0
- package/dist/utils/stream-verification.d.ts.map +1 -1
- package/dist/utils/stream-verification.js +2 -13
- package/dist/utils/stream-verification.js.map +1 -1
- package/dist/utils/terminal.d.ts +24 -0
- package/dist/utils/terminal.d.ts.map +1 -0
- package/dist/utils/terminal.js +148 -0
- package/dist/utils/terminal.js.map +1 -0
- package/dist/utils/time-series.processor.d.ts +65 -0
- package/dist/utils/time-series.processor.d.ts.map +1 -0
- package/dist/utils/time-series.processor.js +263 -0
- package/dist/utils/time-series.processor.js.map +1 -0
- package/package.json +28 -4
|
@@ -0,0 +1,858 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ChannelStatusPanel = void 0;
|
|
7
|
+
const blessed_1 = __importDefault(require("blessed"));
|
|
8
|
+
const blessed_contrib_1 = require("blessed-contrib");
|
|
9
|
+
const base_component_1 = require("./base.component");
|
|
10
|
+
const channel_details_popup_1 = require("./channel-details.popup");
|
|
11
|
+
const batch_operations_dialog_1 = require("./batch-operations.dialog");
|
|
12
|
+
class ChannelStatusPanel extends base_component_1.BaseComponent {
|
|
13
|
+
constructor(config, eventBus) {
|
|
14
|
+
super(config, eventBus);
|
|
15
|
+
this.channels = [];
|
|
16
|
+
this.filteredChannels = [];
|
|
17
|
+
this.selectedChannels = new Set();
|
|
18
|
+
this.currentIndex = 0;
|
|
19
|
+
this.selectionStartIndex = -1;
|
|
20
|
+
this.isRangeSelecting = false;
|
|
21
|
+
this.lastJumpPosition = 0;
|
|
22
|
+
this.navigationHistory = [];
|
|
23
|
+
this.sortConfig = {
|
|
24
|
+
field: config.sortField || 'name',
|
|
25
|
+
order: config.sortOrder || 'asc'
|
|
26
|
+
};
|
|
27
|
+
this.filterConfig = config.filters || {};
|
|
28
|
+
this.lastUpdateTime = new Date();
|
|
29
|
+
}
|
|
30
|
+
createWidget() {
|
|
31
|
+
this.container = blessed_1.default.box({
|
|
32
|
+
label: ' Channel Status Monitor ',
|
|
33
|
+
border: { type: 'line' },
|
|
34
|
+
style: {
|
|
35
|
+
fg: 'white',
|
|
36
|
+
bg: 'black',
|
|
37
|
+
border: { fg: 'cyan' }
|
|
38
|
+
},
|
|
39
|
+
top: this.config.position.y,
|
|
40
|
+
left: this.config.position.x,
|
|
41
|
+
width: this.config.position.width,
|
|
42
|
+
height: this.config.position.height,
|
|
43
|
+
scrollable: false,
|
|
44
|
+
mouse: true,
|
|
45
|
+
keys: true,
|
|
46
|
+
vi: true,
|
|
47
|
+
tags: true
|
|
48
|
+
});
|
|
49
|
+
this.headerBox = blessed_1.default.box({
|
|
50
|
+
parent: this.container,
|
|
51
|
+
top: 0,
|
|
52
|
+
left: 0,
|
|
53
|
+
width: '100%',
|
|
54
|
+
height: 2,
|
|
55
|
+
content: this.getHeaderContent(),
|
|
56
|
+
style: { fg: 'yellow' },
|
|
57
|
+
tags: true
|
|
58
|
+
});
|
|
59
|
+
this.footerBox = blessed_1.default.box({
|
|
60
|
+
parent: this.container,
|
|
61
|
+
bottom: 0,
|
|
62
|
+
left: 0,
|
|
63
|
+
width: '100%',
|
|
64
|
+
height: 2,
|
|
65
|
+
content: this.getFooterContent(),
|
|
66
|
+
style: { fg: 'gray' },
|
|
67
|
+
tags: true
|
|
68
|
+
});
|
|
69
|
+
const tableConfig = {
|
|
70
|
+
keys: true,
|
|
71
|
+
interactive: true,
|
|
72
|
+
columnSpacing: 2,
|
|
73
|
+
columnWidth: this.getConfig().columnWidths || [20, 12, 10, 10, 15, 15],
|
|
74
|
+
style: {
|
|
75
|
+
fg: 'white',
|
|
76
|
+
bg: 'black',
|
|
77
|
+
border: { fg: 'gray' },
|
|
78
|
+
header: { fg: 'cyan', bold: true },
|
|
79
|
+
cell: { fg: 'white' },
|
|
80
|
+
selected: { bg: 'blue', fg: 'white' }
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
this.table = (0, blessed_contrib_1.table)(tableConfig);
|
|
84
|
+
this.table.parent = this.container;
|
|
85
|
+
this.table.top = 2;
|
|
86
|
+
this.table.left = 0;
|
|
87
|
+
this.table.width = '100%';
|
|
88
|
+
this.table.height = 'bottom-2';
|
|
89
|
+
this.noDataBox = blessed_1.default.box({
|
|
90
|
+
parent: this.container,
|
|
91
|
+
top: 'center',
|
|
92
|
+
left: 'center',
|
|
93
|
+
width: 'shrink',
|
|
94
|
+
height: 'shrink',
|
|
95
|
+
content: this.getNoDataMessage(),
|
|
96
|
+
style: { fg: 'gray' },
|
|
97
|
+
tags: true,
|
|
98
|
+
hidden: true
|
|
99
|
+
});
|
|
100
|
+
this.widget = this.container;
|
|
101
|
+
this.initializeDetailsPopup();
|
|
102
|
+
this.initializeBatchDialog();
|
|
103
|
+
this.setupKeyBindings();
|
|
104
|
+
this.updateTableDisplay();
|
|
105
|
+
}
|
|
106
|
+
initializeDetailsPopup() {
|
|
107
|
+
this.detailsPopup = new channel_details_popup_1.ChannelDetailsPopup({
|
|
108
|
+
screen: this.widget.screen,
|
|
109
|
+
eventBus: this.eventBus,
|
|
110
|
+
showColors: this.getConfig().showColors,
|
|
111
|
+
refreshInterval: this.getConfig().refreshInterval
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
initializeBatchDialog() {
|
|
115
|
+
this.batchDialog = new batch_operations_dialog_1.BatchOperationsDialog({
|
|
116
|
+
screen: this.widget.screen,
|
|
117
|
+
eventBus: this.eventBus,
|
|
118
|
+
showColors: this.getConfig().showColors
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
setupKeyBindings() {
|
|
122
|
+
this.container.key(['up', 'k'], () => {
|
|
123
|
+
this.moveSelection(-1);
|
|
124
|
+
});
|
|
125
|
+
this.container.key(['down', 'j'], () => {
|
|
126
|
+
this.moveSelection(1);
|
|
127
|
+
});
|
|
128
|
+
this.container.key(['pageup'], () => {
|
|
129
|
+
this.moveSelection(-10);
|
|
130
|
+
});
|
|
131
|
+
this.container.key(['pagedown'], () => {
|
|
132
|
+
this.moveSelection(10);
|
|
133
|
+
});
|
|
134
|
+
this.container.key(['home'], () => {
|
|
135
|
+
this.moveToTop();
|
|
136
|
+
});
|
|
137
|
+
this.container.key(['end'], () => {
|
|
138
|
+
this.moveToBottom();
|
|
139
|
+
});
|
|
140
|
+
this.container.key(['space'], () => {
|
|
141
|
+
this.toggleSelection();
|
|
142
|
+
});
|
|
143
|
+
this.container.key(['enter'], () => {
|
|
144
|
+
this.showChannelDetails();
|
|
145
|
+
});
|
|
146
|
+
this.container.key(['s'], () => {
|
|
147
|
+
this.cycleSortField();
|
|
148
|
+
});
|
|
149
|
+
this.container.key(['S'], () => {
|
|
150
|
+
this.toggleSortOrder();
|
|
151
|
+
});
|
|
152
|
+
this.container.key(['f'], () => {
|
|
153
|
+
this.showFilterDialog();
|
|
154
|
+
});
|
|
155
|
+
this.container.key(['F'], () => {
|
|
156
|
+
this.showAdvancedFilterDialog();
|
|
157
|
+
});
|
|
158
|
+
this.container.key(['c'], () => {
|
|
159
|
+
this.clearFilters();
|
|
160
|
+
});
|
|
161
|
+
this.container.key(['1'], () => {
|
|
162
|
+
this.quickFilterByStatus('live');
|
|
163
|
+
});
|
|
164
|
+
this.container.key(['2'], () => {
|
|
165
|
+
this.quickFilterByStatus('waiting');
|
|
166
|
+
});
|
|
167
|
+
this.container.key(['3'], () => {
|
|
168
|
+
this.quickFilterByStatus('end');
|
|
169
|
+
});
|
|
170
|
+
this.container.key(['4'], () => {
|
|
171
|
+
this.quickFilterByStatus('banpush');
|
|
172
|
+
});
|
|
173
|
+
this.container.key(['r', 'R', 'f5'], () => {
|
|
174
|
+
this.requestUpdate();
|
|
175
|
+
});
|
|
176
|
+
this.container.key(['a'], () => {
|
|
177
|
+
this.selectAll();
|
|
178
|
+
});
|
|
179
|
+
this.container.key(['A'], () => {
|
|
180
|
+
this.deselectAll();
|
|
181
|
+
});
|
|
182
|
+
this.container.key(['d'], () => {
|
|
183
|
+
this.showBatchOperations();
|
|
184
|
+
});
|
|
185
|
+
this.container.key(['g'], () => {
|
|
186
|
+
this.moveToTop();
|
|
187
|
+
});
|
|
188
|
+
this.container.key(['G'], () => {
|
|
189
|
+
this.moveToBottom();
|
|
190
|
+
});
|
|
191
|
+
this.container.key(['ctrl+f'], () => {
|
|
192
|
+
this.showQuickJumpDialog();
|
|
193
|
+
});
|
|
194
|
+
this.container.key(['ctrl+g'], () => {
|
|
195
|
+
this.showGoToLineDialog();
|
|
196
|
+
});
|
|
197
|
+
this.container.key(['shift+up', 'shift+k'], () => {
|
|
198
|
+
this.extendSelectionUp();
|
|
199
|
+
});
|
|
200
|
+
this.container.key(['shift+down', 'shift+j'], () => {
|
|
201
|
+
this.extendSelectionDown();
|
|
202
|
+
});
|
|
203
|
+
this.container.key(['ctrl+c'], () => {
|
|
204
|
+
this.copySelectionInfo();
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
render() {
|
|
208
|
+
if (this.isDestroyed || !this.widget)
|
|
209
|
+
return;
|
|
210
|
+
try {
|
|
211
|
+
this.updateHeader();
|
|
212
|
+
this.updateFooter();
|
|
213
|
+
this.updateTableDisplay();
|
|
214
|
+
this.widget.screen?.render();
|
|
215
|
+
}
|
|
216
|
+
catch (error) {
|
|
217
|
+
this.handleError(error instanceof Error ? error : new Error('Unknown render error'));
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
update(data) {
|
|
221
|
+
if (this.isDestroyed)
|
|
222
|
+
return;
|
|
223
|
+
try {
|
|
224
|
+
let channelsArray;
|
|
225
|
+
if (Array.isArray(data)) {
|
|
226
|
+
channelsArray = data;
|
|
227
|
+
}
|
|
228
|
+
else if ('channels' in data && Array.isArray(data.channels)) {
|
|
229
|
+
channelsArray = data.channels;
|
|
230
|
+
}
|
|
231
|
+
else {
|
|
232
|
+
channelsArray = [data];
|
|
233
|
+
}
|
|
234
|
+
this.channels = channelsArray.map(channel => this.convertToStatusInfo(channel));
|
|
235
|
+
this.applyFiltersAndSort();
|
|
236
|
+
this.lastUpdateTime = new Date();
|
|
237
|
+
this.updateState({ lastUpdate: this.lastUpdateTime });
|
|
238
|
+
if (this.channels.length === 0) {
|
|
239
|
+
this.noDataBox.show();
|
|
240
|
+
this.table.hide();
|
|
241
|
+
}
|
|
242
|
+
else {
|
|
243
|
+
this.noDataBox.hide();
|
|
244
|
+
this.table.show();
|
|
245
|
+
}
|
|
246
|
+
this.updateStatusColors();
|
|
247
|
+
}
|
|
248
|
+
catch (error) {
|
|
249
|
+
this.handleError(error instanceof Error ? error : new Error('Failed to update channel status'));
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
convertToStatusInfo(channel) {
|
|
253
|
+
const selectedChannels = this.selectedChannels || new Set();
|
|
254
|
+
return {
|
|
255
|
+
channelId: channel.channelId.toString(),
|
|
256
|
+
name: channel.name,
|
|
257
|
+
status: channel.watchStatus,
|
|
258
|
+
statusText: channel.watchStatusText,
|
|
259
|
+
viewerCount: channel.pageView || 0,
|
|
260
|
+
maxViewer: channel.maxViewer || 0,
|
|
261
|
+
publisher: channel.publisher || '',
|
|
262
|
+
startTime: channel.startTime || 0,
|
|
263
|
+
endTime: channel.endTime || 0,
|
|
264
|
+
createdTime: channel.createdTime || 0,
|
|
265
|
+
selected: selectedChannels.has(channel.channelId.toString())
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
compareValues(a, b) {
|
|
269
|
+
if (a === undefined && b === undefined)
|
|
270
|
+
return 0;
|
|
271
|
+
if (a === undefined)
|
|
272
|
+
return 1;
|
|
273
|
+
if (b === undefined)
|
|
274
|
+
return -1;
|
|
275
|
+
if (typeof a === 'string' && typeof b === 'string') {
|
|
276
|
+
return a.localeCompare(b);
|
|
277
|
+
}
|
|
278
|
+
if (typeof a === 'number' && typeof b === 'number') {
|
|
279
|
+
return a - b;
|
|
280
|
+
}
|
|
281
|
+
return String(a).localeCompare(String(b));
|
|
282
|
+
}
|
|
283
|
+
applyFiltersAndSort() {
|
|
284
|
+
const channels = this.channels || [];
|
|
285
|
+
this.filteredChannels = channels.filter(channel => {
|
|
286
|
+
if (this.filterConfig.status && this.filterConfig.status.length > 0) {
|
|
287
|
+
if (!this.filterConfig.status.includes(channel.status)) {
|
|
288
|
+
return false;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
if (this.filterConfig.searchTerm) {
|
|
292
|
+
const searchTerms = this.filterConfig.searchTerm.toLowerCase().split(' ').filter(term => term.length > 0);
|
|
293
|
+
const searchableText = `${channel.name} ${channel.channelId} ${channel.publisher} ${channel.statusText}`.toLowerCase();
|
|
294
|
+
const allTermsMatch = searchTerms.every(term => searchableText.includes(term));
|
|
295
|
+
if (!allTermsMatch) {
|
|
296
|
+
return false;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
if (this.filterConfig.viewerCountMin !== undefined && channel.viewerCount < this.filterConfig.viewerCountMin) {
|
|
300
|
+
return false;
|
|
301
|
+
}
|
|
302
|
+
if (this.filterConfig.viewerCountMax !== undefined && channel.viewerCount > this.filterConfig.viewerCountMax) {
|
|
303
|
+
return false;
|
|
304
|
+
}
|
|
305
|
+
if (this.filterConfig.publisherFilter) {
|
|
306
|
+
const publisherFilter = this.filterConfig.publisherFilter.toLowerCase();
|
|
307
|
+
if (!channel.publisher.toLowerCase().includes(publisherFilter)) {
|
|
308
|
+
return false;
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
if (this.filterConfig.dateRange) {
|
|
312
|
+
const channelDate = new Date(channel.createdTime);
|
|
313
|
+
if (this.filterConfig.dateRange.startDate && channelDate < this.filterConfig.dateRange.startDate) {
|
|
314
|
+
return false;
|
|
315
|
+
}
|
|
316
|
+
if (this.filterConfig.dateRange.endDate && channelDate > this.filterConfig.dateRange.endDate) {
|
|
317
|
+
return false;
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
return true;
|
|
321
|
+
});
|
|
322
|
+
this.filteredChannels.sort((a, b) => {
|
|
323
|
+
const aVal = a[this.sortConfig.field];
|
|
324
|
+
const bVal = b[this.sortConfig.field];
|
|
325
|
+
let comparison = this.compareValues(aVal, bVal);
|
|
326
|
+
if (comparison === 0 && this.sortConfig.secondaryField) {
|
|
327
|
+
const aSecVal = a[this.sortConfig.secondaryField];
|
|
328
|
+
const bSecVal = b[this.sortConfig.secondaryField];
|
|
329
|
+
comparison = this.compareValues(aSecVal, bSecVal);
|
|
330
|
+
if (this.sortConfig.secondaryOrder === 'desc') {
|
|
331
|
+
comparison = -comparison;
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
return this.sortConfig.order === 'asc' ? comparison : -comparison;
|
|
335
|
+
});
|
|
336
|
+
const filteredChannels = this.filteredChannels || [];
|
|
337
|
+
if (this.currentIndex >= filteredChannels.length) {
|
|
338
|
+
this.currentIndex = Math.max(0, filteredChannels.length - 1);
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
updateTableDisplay() {
|
|
342
|
+
if (!this.table)
|
|
343
|
+
return;
|
|
344
|
+
const headers = ['Channel Name', 'Status', 'Viewers', 'Max', 'Publisher', 'Created'];
|
|
345
|
+
const data = [];
|
|
346
|
+
const channels = this.filteredChannels || [];
|
|
347
|
+
const selectedChannels = this.selectedChannels || new Set();
|
|
348
|
+
for (let i = 0; i < channels.length; i++) {
|
|
349
|
+
const channel = channels[i];
|
|
350
|
+
if (!channel)
|
|
351
|
+
continue;
|
|
352
|
+
const isSelected = selectedChannels.has(channel.channelId);
|
|
353
|
+
const isCurrent = i === this.currentIndex;
|
|
354
|
+
const row = [
|
|
355
|
+
this.formatCellValue(channel.name, isSelected, isCurrent),
|
|
356
|
+
this.formatStatusCell(channel.status, channel.statusText, isSelected, isCurrent),
|
|
357
|
+
this.formatCellValue(channel.viewerCount.toString(), isSelected, isCurrent),
|
|
358
|
+
this.formatCellValue(channel.maxViewer.toString(), isSelected, isCurrent),
|
|
359
|
+
this.formatCellValue(channel.publisher, isSelected, isCurrent),
|
|
360
|
+
this.formatCellValue(this.formatDate(new Date(channel.createdTime)), isSelected, isCurrent)
|
|
361
|
+
];
|
|
362
|
+
data.push(row);
|
|
363
|
+
}
|
|
364
|
+
this.table.setData({
|
|
365
|
+
headers,
|
|
366
|
+
data
|
|
367
|
+
});
|
|
368
|
+
}
|
|
369
|
+
formatCellValue(value, isSelected, isCurrent) {
|
|
370
|
+
if (isCurrent) {
|
|
371
|
+
return `{inverse}${isSelected ? '✓ ' : ''}${value}{/inverse}`;
|
|
372
|
+
}
|
|
373
|
+
return isSelected ? `{cyan-fg}✓ ${value}{/cyan-fg}` : value;
|
|
374
|
+
}
|
|
375
|
+
formatStatusCell(status, statusText, isSelected, isCurrent) {
|
|
376
|
+
const colors = this.getStatusColors(status);
|
|
377
|
+
const safeColor = this.getTerminalSafeColor(colors.fg);
|
|
378
|
+
const prefix = isCurrent ? '{inverse}' : '';
|
|
379
|
+
const suffix = isCurrent ? '{/inverse}' : '';
|
|
380
|
+
const checkmark = isSelected ? '✓ ' : '';
|
|
381
|
+
const icon = colors.icon || '';
|
|
382
|
+
const healthLevel = this.getStatusHealthLevel(status);
|
|
383
|
+
let statusDisplay = statusText;
|
|
384
|
+
switch (healthLevel) {
|
|
385
|
+
case 'healthy':
|
|
386
|
+
statusDisplay = `${icon} ${statusText}`;
|
|
387
|
+
break;
|
|
388
|
+
case 'warning':
|
|
389
|
+
statusDisplay = `${icon} ${statusText}`;
|
|
390
|
+
break;
|
|
391
|
+
case 'error':
|
|
392
|
+
statusDisplay = `${icon} ${statusText}`;
|
|
393
|
+
break;
|
|
394
|
+
}
|
|
395
|
+
return `${prefix}{${safeColor}-fg}${checkmark}${statusDisplay}{/${safeColor}-fg}${suffix}`;
|
|
396
|
+
}
|
|
397
|
+
updateStatusColors() {
|
|
398
|
+
this.throttledRender();
|
|
399
|
+
this.emit('component:statusChanged', {
|
|
400
|
+
componentId: this.state.id,
|
|
401
|
+
healthSummary: this.getChannelHealthSummary(),
|
|
402
|
+
timestamp: new Date()
|
|
403
|
+
});
|
|
404
|
+
}
|
|
405
|
+
getChannelHealthSummary() {
|
|
406
|
+
const channels = this.filteredChannels || [];
|
|
407
|
+
const summary = { healthy: 0, warning: 0, error: 0 };
|
|
408
|
+
channels.forEach(channel => {
|
|
409
|
+
const healthLevel = this.getStatusHealthLevel(channel.status);
|
|
410
|
+
summary[healthLevel]++;
|
|
411
|
+
});
|
|
412
|
+
return summary;
|
|
413
|
+
}
|
|
414
|
+
getStatusColors(status) {
|
|
415
|
+
switch (status) {
|
|
416
|
+
case 'live':
|
|
417
|
+
return { fg: 'green', icon: '●' };
|
|
418
|
+
case 'waiting':
|
|
419
|
+
return { fg: 'yellow', icon: '◯' };
|
|
420
|
+
case 'end':
|
|
421
|
+
return { fg: 'gray', icon: '◦' };
|
|
422
|
+
case 'unStart':
|
|
423
|
+
return { fg: 'gray', icon: '◦' };
|
|
424
|
+
case 'banpush':
|
|
425
|
+
return { fg: 'red', icon: '✖' };
|
|
426
|
+
case 'playback':
|
|
427
|
+
return { fg: 'blue', icon: '▶' };
|
|
428
|
+
default:
|
|
429
|
+
return { fg: 'white', icon: '?' };
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
getTerminalSafeColor(color) {
|
|
433
|
+
const config = this.getConfig();
|
|
434
|
+
if (!config.showColors) {
|
|
435
|
+
return 'white';
|
|
436
|
+
}
|
|
437
|
+
const colorMapping = {
|
|
438
|
+
'green': 'green',
|
|
439
|
+
'yellow': 'yellow',
|
|
440
|
+
'red': 'red',
|
|
441
|
+
'blue': 'blue',
|
|
442
|
+
'gray': 'gray',
|
|
443
|
+
'white': 'white'
|
|
444
|
+
};
|
|
445
|
+
return colorMapping[color] || 'white';
|
|
446
|
+
}
|
|
447
|
+
getStatusHealthLevel(status) {
|
|
448
|
+
switch (status) {
|
|
449
|
+
case 'live':
|
|
450
|
+
return 'healthy';
|
|
451
|
+
case 'waiting':
|
|
452
|
+
case 'playback':
|
|
453
|
+
return 'warning';
|
|
454
|
+
case 'banpush':
|
|
455
|
+
return 'error';
|
|
456
|
+
case 'end':
|
|
457
|
+
case 'unStart':
|
|
458
|
+
default:
|
|
459
|
+
return 'warning';
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
formatDate(date) {
|
|
463
|
+
return date.toLocaleDateString();
|
|
464
|
+
}
|
|
465
|
+
updateHeader() {
|
|
466
|
+
this.headerBox.setContent(this.getHeaderContent());
|
|
467
|
+
}
|
|
468
|
+
updateFooter() {
|
|
469
|
+
this.footerBox.setContent(this.getFooterContent());
|
|
470
|
+
}
|
|
471
|
+
getHeaderContent() {
|
|
472
|
+
const total = this.channels?.length || 0;
|
|
473
|
+
const filtered = this.filteredChannels?.length || 0;
|
|
474
|
+
const selected = this.selectedChannels?.size || 0;
|
|
475
|
+
const lastUpdate = this.lastUpdateTime?.toLocaleTimeString() || 'Never';
|
|
476
|
+
const health = this.getChannelHealthSummary();
|
|
477
|
+
const healthDisplay = `{green-fg}●${health.healthy}{/green-fg} {yellow-fg}◯${health.warning}{/yellow-fg} {red-fg}✖${health.error}{/red-fg}`;
|
|
478
|
+
return `Total: {bold}${total}{/bold} | Displayed: {bold}${filtered}{/bold} | Selected: {cyan-fg}${selected}{/cyan-fg} | Health: ${healthDisplay} | Updated: {gray-fg}${lastUpdate}{/gray-fg}`;
|
|
479
|
+
}
|
|
480
|
+
getFooterContent() {
|
|
481
|
+
const activeFilters = this.filterConfig ? Object.keys(this.filterConfig).length : 0;
|
|
482
|
+
const filterInfo = activeFilters > 0 ? `{yellow-fg}[${activeFilters} filters]{/yellow-fg}` : '';
|
|
483
|
+
const sortInfo = this.sortConfig?.secondaryField ? `{cyan-fg}[Multi-sort]{/cyan-fg}` : '';
|
|
484
|
+
return `{gray-fg}↑↓: Navigate | Space: Select | Enter: Details | S: Sort | Shift+S: Order | F: Filter | Shift+F: Advanced | 1-4: Quick Filter | C: Clear | R: Refresh{/gray-fg} ${filterInfo} ${sortInfo}`;
|
|
485
|
+
}
|
|
486
|
+
getNoDataMessage() {
|
|
487
|
+
return '{center}{gray-fg}No channel data available{/gray-fg}\n{center}{gray-fg}Waiting for channel information...{/gray-fg}{/center}';
|
|
488
|
+
}
|
|
489
|
+
moveSelection(delta) {
|
|
490
|
+
const channels = this.filteredChannels || [];
|
|
491
|
+
if (channels.length === 0)
|
|
492
|
+
return;
|
|
493
|
+
this.currentIndex = Math.max(0, Math.min(channels.length - 1, this.currentIndex + delta));
|
|
494
|
+
this.throttledRender();
|
|
495
|
+
}
|
|
496
|
+
moveToTop() {
|
|
497
|
+
this.saveNavigationHistory();
|
|
498
|
+
this.currentIndex = 0;
|
|
499
|
+
this.isRangeSelecting = false;
|
|
500
|
+
this.throttledRender();
|
|
501
|
+
this.emitNavigationEvent('moveToTop');
|
|
502
|
+
}
|
|
503
|
+
moveToBottom() {
|
|
504
|
+
const channels = this.filteredChannels || [];
|
|
505
|
+
this.saveNavigationHistory();
|
|
506
|
+
this.currentIndex = Math.max(0, channels.length - 1);
|
|
507
|
+
this.isRangeSelecting = false;
|
|
508
|
+
this.throttledRender();
|
|
509
|
+
this.emitNavigationEvent('moveToBottom');
|
|
510
|
+
}
|
|
511
|
+
showQuickJumpDialog() {
|
|
512
|
+
this.emit('component:quickJumpDialog', {
|
|
513
|
+
componentId: this.state.id,
|
|
514
|
+
currentIndex: this.currentIndex,
|
|
515
|
+
totalItems: this.filteredChannels?.length || 0,
|
|
516
|
+
timestamp: new Date()
|
|
517
|
+
});
|
|
518
|
+
}
|
|
519
|
+
showGoToLineDialog() {
|
|
520
|
+
this.emit('component:goToLineDialog', {
|
|
521
|
+
componentId: this.state.id,
|
|
522
|
+
currentLine: this.currentIndex + 1,
|
|
523
|
+
totalLines: this.filteredChannels?.length || 0,
|
|
524
|
+
timestamp: new Date()
|
|
525
|
+
});
|
|
526
|
+
}
|
|
527
|
+
extendSelectionUp() {
|
|
528
|
+
const channels = this.filteredChannels || [];
|
|
529
|
+
if (channels.length === 0)
|
|
530
|
+
return;
|
|
531
|
+
if (!this.isRangeSelecting) {
|
|
532
|
+
this.selectionStartIndex = this.currentIndex;
|
|
533
|
+
this.isRangeSelecting = true;
|
|
534
|
+
}
|
|
535
|
+
const newIndex = Math.max(0, this.currentIndex - 1);
|
|
536
|
+
this.updateRangeSelection(newIndex);
|
|
537
|
+
}
|
|
538
|
+
extendSelectionDown() {
|
|
539
|
+
const channels = this.filteredChannels || [];
|
|
540
|
+
if (channels.length === 0)
|
|
541
|
+
return;
|
|
542
|
+
if (!this.isRangeSelecting) {
|
|
543
|
+
this.selectionStartIndex = this.currentIndex;
|
|
544
|
+
this.isRangeSelecting = true;
|
|
545
|
+
}
|
|
546
|
+
const newIndex = Math.min(channels.length - 1, this.currentIndex + 1);
|
|
547
|
+
this.updateRangeSelection(newIndex);
|
|
548
|
+
}
|
|
549
|
+
updateRangeSelection(newIndex) {
|
|
550
|
+
const channels = this.filteredChannels || [];
|
|
551
|
+
const selectedChannels = this.selectedChannels || new Set();
|
|
552
|
+
if (this.selectionStartIndex === -1)
|
|
553
|
+
return;
|
|
554
|
+
this.clearRangeSelection();
|
|
555
|
+
const startIndex = Math.min(this.selectionStartIndex, newIndex);
|
|
556
|
+
const endIndex = Math.max(this.selectionStartIndex, newIndex);
|
|
557
|
+
for (let i = startIndex; i <= endIndex; i++) {
|
|
558
|
+
const channel = channels[i];
|
|
559
|
+
if (channel) {
|
|
560
|
+
selectedChannels.add(channel.channelId);
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
this.currentIndex = newIndex;
|
|
564
|
+
this.throttledRender();
|
|
565
|
+
}
|
|
566
|
+
clearRangeSelection() {
|
|
567
|
+
}
|
|
568
|
+
copySelectionInfo() {
|
|
569
|
+
const selectedChannels = this.selectedChannels || new Set();
|
|
570
|
+
const channels = this.filteredChannels || [];
|
|
571
|
+
if (selectedChannels.size === 0 && this.currentIndex < channels.length) {
|
|
572
|
+
const currentChannel = channels[this.currentIndex];
|
|
573
|
+
if (currentChannel) {
|
|
574
|
+
this.copyChannelInfo(currentChannel);
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
else {
|
|
578
|
+
const selectedChannelData = channels.filter(c => selectedChannels.has(c.channelId));
|
|
579
|
+
this.copyMultipleChannelsInfo(selectedChannelData);
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
copyChannelInfo(channel) {
|
|
583
|
+
const info = `${channel.name} (${channel.channelId}) - ${channel.statusText} - ${channel.viewerCount} viewers`;
|
|
584
|
+
this.emit('component:copyToClipboard', {
|
|
585
|
+
componentId: this.state.id,
|
|
586
|
+
content: info,
|
|
587
|
+
type: 'singleChannel',
|
|
588
|
+
channel,
|
|
589
|
+
timestamp: new Date()
|
|
590
|
+
});
|
|
591
|
+
}
|
|
592
|
+
copyMultipleChannelsInfo(channels) {
|
|
593
|
+
const info = channels.map(c => `${c.name} (${c.channelId}) - ${c.statusText} - ${c.viewerCount} viewers`).join('\n');
|
|
594
|
+
this.emit('component:copyToClipboard', {
|
|
595
|
+
componentId: this.state.id,
|
|
596
|
+
content: info,
|
|
597
|
+
type: 'multipleChannels',
|
|
598
|
+
channels,
|
|
599
|
+
count: channels.length,
|
|
600
|
+
timestamp: new Date()
|
|
601
|
+
});
|
|
602
|
+
}
|
|
603
|
+
saveNavigationHistory() {
|
|
604
|
+
if (this.currentIndex !== this.lastJumpPosition) {
|
|
605
|
+
this.navigationHistory.push(this.lastJumpPosition);
|
|
606
|
+
if (this.navigationHistory.length > 10) {
|
|
607
|
+
this.navigationHistory.shift();
|
|
608
|
+
}
|
|
609
|
+
this.lastJumpPosition = this.currentIndex;
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
emitNavigationEvent(action) {
|
|
613
|
+
this.emit('component:navigation', {
|
|
614
|
+
componentId: this.state.id,
|
|
615
|
+
action,
|
|
616
|
+
currentIndex: this.currentIndex,
|
|
617
|
+
totalItems: this.filteredChannels?.length || 0,
|
|
618
|
+
timestamp: new Date()
|
|
619
|
+
});
|
|
620
|
+
}
|
|
621
|
+
jumpToLine(lineNumber) {
|
|
622
|
+
const channels = this.filteredChannels || [];
|
|
623
|
+
const targetIndex = lineNumber - 1;
|
|
624
|
+
if (targetIndex >= 0 && targetIndex < channels.length) {
|
|
625
|
+
this.saveNavigationHistory();
|
|
626
|
+
this.currentIndex = targetIndex;
|
|
627
|
+
this.isRangeSelecting = false;
|
|
628
|
+
this.throttledRender();
|
|
629
|
+
this.emitNavigationEvent('jumpToLine');
|
|
630
|
+
return true;
|
|
631
|
+
}
|
|
632
|
+
return false;
|
|
633
|
+
}
|
|
634
|
+
jumpToChannel(searchTerm) {
|
|
635
|
+
const channels = this.filteredChannels || [];
|
|
636
|
+
const lowerSearchTerm = searchTerm.toLowerCase();
|
|
637
|
+
const targetIndex = channels.findIndex(channel => channel.channelId.toLowerCase().includes(lowerSearchTerm) ||
|
|
638
|
+
channel.name.toLowerCase().includes(lowerSearchTerm));
|
|
639
|
+
if (targetIndex !== -1) {
|
|
640
|
+
this.saveNavigationHistory();
|
|
641
|
+
this.currentIndex = targetIndex;
|
|
642
|
+
this.isRangeSelecting = false;
|
|
643
|
+
this.throttledRender();
|
|
644
|
+
this.emitNavigationEvent('jumpToChannel');
|
|
645
|
+
return true;
|
|
646
|
+
}
|
|
647
|
+
return false;
|
|
648
|
+
}
|
|
649
|
+
toggleSelection() {
|
|
650
|
+
const channels = this.filteredChannels || [];
|
|
651
|
+
const selectedChannels = this.selectedChannels || new Set();
|
|
652
|
+
if (channels.length === 0)
|
|
653
|
+
return;
|
|
654
|
+
const currentChannel = channels[this.currentIndex];
|
|
655
|
+
if (!currentChannel)
|
|
656
|
+
return;
|
|
657
|
+
if (selectedChannels.has(currentChannel.channelId)) {
|
|
658
|
+
selectedChannels.delete(currentChannel.channelId);
|
|
659
|
+
}
|
|
660
|
+
else {
|
|
661
|
+
selectedChannels.add(currentChannel.channelId);
|
|
662
|
+
}
|
|
663
|
+
this.throttledRender();
|
|
664
|
+
}
|
|
665
|
+
selectAll() {
|
|
666
|
+
const channels = this.filteredChannels || [];
|
|
667
|
+
const selectedChannels = this.selectedChannels || new Set();
|
|
668
|
+
channels.forEach(channel => {
|
|
669
|
+
selectedChannels.add(channel.channelId);
|
|
670
|
+
});
|
|
671
|
+
this.throttledRender();
|
|
672
|
+
}
|
|
673
|
+
deselectAll() {
|
|
674
|
+
const selectedChannels = this.selectedChannels || new Set();
|
|
675
|
+
selectedChannels.clear();
|
|
676
|
+
this.throttledRender();
|
|
677
|
+
}
|
|
678
|
+
cycleSortField() {
|
|
679
|
+
const fields = ['name', 'status', 'viewerCount', 'maxViewer', 'publisher', 'createdTime'];
|
|
680
|
+
const currentIndex = fields.indexOf(this.sortConfig.field);
|
|
681
|
+
const nextIndex = (currentIndex + 1) % fields.length;
|
|
682
|
+
const nextField = fields[nextIndex];
|
|
683
|
+
if (nextField) {
|
|
684
|
+
if (this.sortConfig.secondaryField) {
|
|
685
|
+
this.sortConfig.field = this.sortConfig.secondaryField;
|
|
686
|
+
this.sortConfig.order = this.sortConfig.secondaryOrder || 'asc';
|
|
687
|
+
delete this.sortConfig.secondaryField;
|
|
688
|
+
delete this.sortConfig.secondaryOrder;
|
|
689
|
+
}
|
|
690
|
+
else {
|
|
691
|
+
this.sortConfig.field = nextField;
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
this.applyFiltersAndSort();
|
|
695
|
+
this.throttledRender();
|
|
696
|
+
this.emit('component:sortChanged', {
|
|
697
|
+
componentId: this.state.id,
|
|
698
|
+
sortConfig: this.sortConfig,
|
|
699
|
+
timestamp: new Date()
|
|
700
|
+
});
|
|
701
|
+
}
|
|
702
|
+
toggleSortOrder() {
|
|
703
|
+
this.sortConfig.order = this.sortConfig.order === 'asc' ? 'desc' : 'asc';
|
|
704
|
+
this.applyFiltersAndSort();
|
|
705
|
+
this.throttledRender();
|
|
706
|
+
this.emit('component:sortChanged', {
|
|
707
|
+
componentId: this.state.id,
|
|
708
|
+
sortConfig: this.sortConfig,
|
|
709
|
+
timestamp: new Date()
|
|
710
|
+
});
|
|
711
|
+
}
|
|
712
|
+
setMultiFieldSort(primary, primaryOrder, secondary, secondaryOrder) {
|
|
713
|
+
const newConfig = {
|
|
714
|
+
field: primary,
|
|
715
|
+
order: primaryOrder
|
|
716
|
+
};
|
|
717
|
+
if (secondary !== undefined) {
|
|
718
|
+
newConfig.secondaryField = secondary;
|
|
719
|
+
}
|
|
720
|
+
if (secondaryOrder !== undefined) {
|
|
721
|
+
newConfig.secondaryOrder = secondaryOrder;
|
|
722
|
+
}
|
|
723
|
+
this.sortConfig = newConfig;
|
|
724
|
+
this.applyFiltersAndSort();
|
|
725
|
+
this.throttledRender();
|
|
726
|
+
this.emit('component:sortChanged', {
|
|
727
|
+
componentId: this.state.id,
|
|
728
|
+
sortConfig: this.sortConfig,
|
|
729
|
+
changeType: 'multiField',
|
|
730
|
+
timestamp: new Date()
|
|
731
|
+
});
|
|
732
|
+
}
|
|
733
|
+
showFilterDialog() {
|
|
734
|
+
this.emit('component:filterDialog', {
|
|
735
|
+
componentId: this.state.id,
|
|
736
|
+
currentFilter: this.filterConfig,
|
|
737
|
+
type: 'basic',
|
|
738
|
+
timestamp: new Date()
|
|
739
|
+
});
|
|
740
|
+
}
|
|
741
|
+
showAdvancedFilterDialog() {
|
|
742
|
+
this.emit('component:advancedFilterDialog', {
|
|
743
|
+
componentId: this.state.id,
|
|
744
|
+
currentFilter: this.filterConfig,
|
|
745
|
+
availableFields: ['viewerCount', 'publisher', 'createdTime'],
|
|
746
|
+
timestamp: new Date()
|
|
747
|
+
});
|
|
748
|
+
}
|
|
749
|
+
quickFilterByStatus(status) {
|
|
750
|
+
if (this.filterConfig.status?.includes(status)) {
|
|
751
|
+
this.filterConfig.status = this.filterConfig.status.filter(s => s !== status);
|
|
752
|
+
if (this.filterConfig.status.length === 0) {
|
|
753
|
+
delete this.filterConfig.status;
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
else {
|
|
757
|
+
if (!this.filterConfig.status) {
|
|
758
|
+
this.filterConfig.status = [];
|
|
759
|
+
}
|
|
760
|
+
this.filterConfig.status.push(status);
|
|
761
|
+
}
|
|
762
|
+
this.applyFiltersAndSort();
|
|
763
|
+
this.throttledRender();
|
|
764
|
+
this.emit('component:filterChanged', {
|
|
765
|
+
componentId: this.state.id,
|
|
766
|
+
filter: this.filterConfig,
|
|
767
|
+
changeType: 'quickFilter',
|
|
768
|
+
status,
|
|
769
|
+
timestamp: new Date()
|
|
770
|
+
});
|
|
771
|
+
}
|
|
772
|
+
clearFilters() {
|
|
773
|
+
const hadFilters = Object.keys(this.filterConfig).length > 0;
|
|
774
|
+
this.filterConfig = {};
|
|
775
|
+
this.applyFiltersAndSort();
|
|
776
|
+
this.throttledRender();
|
|
777
|
+
if (hadFilters) {
|
|
778
|
+
this.emit('component:filtersCleared', {
|
|
779
|
+
componentId: this.state.id,
|
|
780
|
+
timestamp: new Date()
|
|
781
|
+
});
|
|
782
|
+
}
|
|
783
|
+
}
|
|
784
|
+
setAdvancedFilter(filter) {
|
|
785
|
+
this.filterConfig = { ...this.filterConfig, ...filter };
|
|
786
|
+
this.applyFiltersAndSort();
|
|
787
|
+
this.throttledRender();
|
|
788
|
+
this.emit('component:filterChanged', {
|
|
789
|
+
componentId: this.state.id,
|
|
790
|
+
filter: this.filterConfig,
|
|
791
|
+
changeType: 'advanced',
|
|
792
|
+
timestamp: new Date()
|
|
793
|
+
});
|
|
794
|
+
}
|
|
795
|
+
showChannelDetails() {
|
|
796
|
+
const channels = this.filteredChannels || [];
|
|
797
|
+
if (channels.length === 0)
|
|
798
|
+
return;
|
|
799
|
+
const currentChannel = channels[this.currentIndex];
|
|
800
|
+
if (!currentChannel)
|
|
801
|
+
return;
|
|
802
|
+
this.detailsPopup.show(currentChannel);
|
|
803
|
+
this.emit('component:showDetails', {
|
|
804
|
+
componentId: this.state.id,
|
|
805
|
+
channelId: currentChannel.channelId,
|
|
806
|
+
channel: currentChannel,
|
|
807
|
+
timestamp: new Date()
|
|
808
|
+
});
|
|
809
|
+
}
|
|
810
|
+
showBatchOperations() {
|
|
811
|
+
const selectedChannels = this.selectedChannels || new Set();
|
|
812
|
+
if (selectedChannels.size === 0)
|
|
813
|
+
return;
|
|
814
|
+
this.batchDialog.show(Array.from(selectedChannels));
|
|
815
|
+
this.emit('component:batchOperations', {
|
|
816
|
+
componentId: this.state.id,
|
|
817
|
+
selectedChannels: Array.from(selectedChannels),
|
|
818
|
+
timestamp: new Date()
|
|
819
|
+
});
|
|
820
|
+
}
|
|
821
|
+
getConfig() {
|
|
822
|
+
return this.config;
|
|
823
|
+
}
|
|
824
|
+
getSelectedChannels() {
|
|
825
|
+
return Array.from(this.selectedChannels || new Set());
|
|
826
|
+
}
|
|
827
|
+
getCurrentChannel() {
|
|
828
|
+
const channels = this.filteredChannels || [];
|
|
829
|
+
return channels[this.currentIndex] || null;
|
|
830
|
+
}
|
|
831
|
+
setFilter(filter) {
|
|
832
|
+
this.filterConfig = filter;
|
|
833
|
+
this.applyFiltersAndSort();
|
|
834
|
+
this.throttledRender();
|
|
835
|
+
}
|
|
836
|
+
setSort(sort) {
|
|
837
|
+
this.sortConfig = sort;
|
|
838
|
+
this.applyFiltersAndSort();
|
|
839
|
+
this.throttledRender();
|
|
840
|
+
}
|
|
841
|
+
destroy() {
|
|
842
|
+
this.stopRefresh();
|
|
843
|
+
this.channels = [];
|
|
844
|
+
this.filteredChannels = [];
|
|
845
|
+
if (this.selectedChannels) {
|
|
846
|
+
this.selectedChannels.clear();
|
|
847
|
+
}
|
|
848
|
+
if (this.detailsPopup) {
|
|
849
|
+
this.detailsPopup.destroy();
|
|
850
|
+
}
|
|
851
|
+
if (this.batchDialog) {
|
|
852
|
+
this.batchDialog.destroy();
|
|
853
|
+
}
|
|
854
|
+
super.destroy();
|
|
855
|
+
}
|
|
856
|
+
}
|
|
857
|
+
exports.ChannelStatusPanel = ChannelStatusPanel;
|
|
858
|
+
//# sourceMappingURL=channel-status.panel.js.map
|