Skip to content

fix(add):analytics#47

Merged
HUAHUAI23 merged 43 commits into
labring:mainfrom
huanglvjing:feature/analytics-dashboard
Oct 30, 2025
Merged

fix(add):analytics#47
HUAHUAI23 merged 43 commits into
labring:mainfrom
huanglvjing:feature/analytics-dashboard

Conversation

@huanglvjing

Copy link
Copy Markdown
Contributor

No description provided.

@github-actions

github-actions Bot commented Oct 27, 2025

Copy link
Copy Markdown

🤖 Fork Repository Check Complete

✅ Basic security scan completed
✅ Dependency check completed
✅ Linting check completed
✅ Build test completed

This PR from a fork repository has passed basic safety checks. A maintainer will review the changes before running full CI/CD pipeline.

This is an automated safety check for contributions from fork repositories.

HUAHUAI23 and others added 17 commits October 28, 2025 07:33
- Add @eslint/js to eslint-config
- Move i18next to dependencies and add to server
- Add @tiptap/core, lucide-react, date-fns to ui package
- Add @types/markdown-it to server
- Refactor menubar component (user changes)
- Remove bun-types from frontend TypeScript config

Resolves all CI typecheck and build failures.
feat(server): add ticket autoclose job,knowledge access log
@huanglvjing huanglvjing force-pushed the feature/analytics-dashboard branch from cf44b85 to ecbb631 Compare October 29, 2025 03:57
import { useTranslation } from "i18n";

const getRatingChartConfig = (t: any) => ({
"1星": {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i18n 国际化


<AlertTitle className="text-black flex items-center gap-2"><TriangleAlert className="h-4 w-4 text-red-600" />{t("tkt_backlog_rate_error")}</AlertTitle>
<AlertDescription className="text-black">
当前未处理工单占比 <span className="text-red-600 ">{data.backlogRate}%</span>,超过正常水平,建议增加处理人力。

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i18n 国际化

Comment thread frontend/src/lib/query.ts Outdated
staleTime: 0,
refetchOnMount: true,
refetchOnWindowFocus: true,
staleTime: 5 * 60 * 1000, // 5分钟缓存

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

为什么修改这里

Comment thread server/api/analytics/index.ts Outdated
支付问题: "#F59E0B",
性能问题: "#EF4444",
界面问题: "#8B5CF6",
服务问题: "#06B6D4",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

颜色为什么定义在后端

Comment thread server/api/analytics/index.ts Outdated

const analyticsRouter = factory
.createApp()
.use("*", authMiddleware)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

还是之前说的问题

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

server/api/feedback/index.ts 可以参考这个的写法

Comment thread server/api/analytics/index.ts Outdated
ratingDistribution: [
{ name: "未评分", value: unratedTickets, percentage: 0 },
{ name: "1星", value: ratingMap[1], percentage: 0 },
{ name: "2星", value: ratingMap[2], percentage: 0 },

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

国家化

Comment thread server/api/ticket/index.ts Outdated
ticketId,
payload.title,
payload.description
);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

可以参考 server/api/kb/index.ts
server/utils/events/kb

export const Events = {
KBFavoritesSync: "kb.favorites.sync",
} as const;

添加一个 工单分析事件,然后写一个 工单分析的 listener 和 数据 repo 操作

避免创建工单时等待分析

Comment thread server/db/schema.ts Outdated
export const hotIssues = tentix.table(
"hot_issues",
{
id: serial("id").primaryKey().notNull(),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tag 没有抽离出来吗,那么怎么人工修改tag 或者添加tag,例如如果已经有一组 tag 用于使用,现在要修改tag 怎么操作,没有用到 tags 吗

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hotIssues 用单数 hotIssue

}

export async function getHotIssuesStats(
db: NodePgDatabase<AppSchema>,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

db: NodePgDatabase
换成
db: ReturnType

@huanglvjing huanglvjing force-pushed the feature/analytics-dashboard branch from a4ebf1c to c738ae3 Compare October 29, 2025 07:05
const lowEffY = intersectionY + spacingFromCenter;

const titleStyle: React.CSSProperties = {
fontFamily: 'var(--typography-font-family-font-sans, Geist)',

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

字体不要设置

import { dateRangeSchema } from "./schemas.ts";

export const knowledgeBaseHitsRouter = factory
.createApp()

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

用 new Hono().get


type DB = ReturnType<typeof connectDB>;

export async function markAnalyzed(db: DB, ticketId: string): Promise<void> {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

markAnalyzed 和 markFailed 作用是什么?


useEffect(() => {
const updateSize = () => {
if (chartContainerRef.current) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

echart 容器挂载可以抽离出一个包装容器

const chartInstanceRef = useRef<echarts.ECharts | null>(null);

useEffect(() => {
if (!chartRef.current) return;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

echart 包装容器抽离

useEffect(() => {
if (!chartRef.current) return;

// 初始化图表

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

echart 包装容器抽离

// 初始化图表
const chart = echarts.init(chartRef.current, undefined, { renderer: 'svg' });
chartInstanceRef.current = chart;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

echart 容器包装抽离

Comment thread frontend/src/lib/query.ts Outdated
});

export const knowledgeHitsQueryOptions = (filterParams?: {
startDate?: string;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个文件太大了,可以把你的query单出抽出在一个文件中

@HUAHUAI23 HUAHUAI23 merged commit 25237a7 into labring:main Oct 30, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants