Files
taskq/ui/components/help-tooltip.js
hupeh 1f9f1cab53 feat: 添加监控仪表盘
- 新增 Lit.js 组件化 UI (ui/ 目录)
  - tasks-chart: 带十字准星和拖拽选择的图表
  - queue-table: 队列列表,支持暂停/恢复
  - queue-modal: 队列详情弹窗,支持任务重试
  - time-range-picker: Prometheus 风格时间选择器
  - help-tooltip: 可复用的提示组件

- HTTPHandler 功能
  - SSE 实时推送 (stats + queues)
  - 队列暂停/恢复 API
  - 任务重试 API
  - 时间范围查询 API

- Inspector 改进
  - Prometheus 风格单表存储
  - 集成到 Start/Stop 生命周期
  - 新增 PauseQueue/UnpauseQueue/RunTask 方法

- 代码重构
  - Start 函数拆分为小函数
  - 优雅关闭流程优化

- 其他
  - 忽略 SQLite 数据库文件
  - example 添加延迟/定点任务示例
2025-12-09 19:58:18 +08:00

81 lines
1.5 KiB
JavaScript

import { LitElement, html, css } from 'lit';
class HelpTooltip extends LitElement {
static properties = {
text: { type: String }
};
static styles = css`
:host {
display: inline-flex;
align-items: center;
justify-content: center;
position: relative;
}
.icon {
display: inline-flex;
align-items: center;
justify-content: center;
width: 14px;
height: 14px;
border-radius: 50%;
background: #616161;
color: #9e9e9e;
font-size: 10px;
cursor: help;
}
.icon:hover {
background: #757575;
color: #e0e0e0;
}
.icon:hover + .tooltip {
display: block;
}
.tooltip {
display: none;
position: absolute;
top: 100%;
left: 50%;
transform: translateX(-50%);
margin-top: 8px;
padding: 8px 12px;
background: #212121;
color: #e0e0e0;
font-size: 12px;
font-weight: normal;
border-radius: 4px;
white-space: nowrap;
z-index: 1000;
box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.tooltip::before {
content: '';
position: absolute;
bottom: 100%;
left: 50%;
transform: translateX(-50%);
border: 6px solid transparent;
border-bottom-color: #212121;
}
`;
constructor() {
super();
this.text = '';
}
render() {
return html`
<span class="icon">?</span>
<span class="tooltip">${this.text}</span>
`;
}
}
customElements.define('help-tooltip', HelpTooltip);