feat(workload): change header
This commit is contained in:
10
.gitignore
vendored
10
.gitignore
vendored
@@ -47,4 +47,12 @@ redislocal/logs
|
|||||||
redislocal/conf
|
redislocal/conf
|
||||||
|
|
||||||
|
|
||||||
pnpm-lock.yaml
|
pnpm-lock.yaml
|
||||||
|
graphify-out
|
||||||
|
.graphify_detect.json
|
||||||
|
.graphify_extract.json
|
||||||
|
.graphify_ast.json
|
||||||
|
.graphify_semantic.json
|
||||||
|
.graphify_analysis.json
|
||||||
|
.graphify_labels.json
|
||||||
|
.graphify_chunk_*.json
|
||||||
|
|||||||
@@ -15,12 +15,12 @@ export default function LabelWorkloadTable() {
|
|||||||
{ key: "object_size", title: "新增对象数" },
|
{ key: "object_size", title: "新增对象数" },
|
||||||
{ key: "confirmed_prelabel_size", title: "确认预标注对象数" },
|
{ key: "confirmed_prelabel_size", title: "确认预标注对象数" },
|
||||||
{ key: "prelabel_object_size", title: "预标注对象数" },
|
{ key: "prelabel_object_size", title: "预标注对象数" },
|
||||||
{ key: "commit_label_1", title: "提交标注任务数" },
|
|
||||||
{ key: "commit_reviewed_1", title: "被审核任务数" },
|
|
||||||
{ key: "reviewed_size", title: "被审核对象数" },
|
{ key: "reviewed_size", title: "被审核对象数" },
|
||||||
{ key: "commented_size", title: "被批注对象数" },
|
{ key: "commented_size", title: "被批注对象数" },
|
||||||
{ key: "rejected_label_1", title: "被驳回任务数" },
|
|
||||||
{ key: "total_reviewed_size", title: "被审核过任务对象总数" },
|
{ key: "total_reviewed_size", title: "被审核过任务对象总数" },
|
||||||
|
{ key: "commit_label_1", title: "提交标注任务数" },
|
||||||
|
{ key: "commit_reviewed_1", title: "被审核任务数" },
|
||||||
|
{ key: "rejected_label_1", title: "标注任务被驳回数" },
|
||||||
{ key: "dynamic_size", title: "新增动态对象数" },
|
{ key: "dynamic_size", title: "新增动态对象数" },
|
||||||
{ key: "static_size", title: "新增静态对象数" },
|
{ key: "static_size", title: "新增静态对象数" },
|
||||||
{ key: "key_frame_size", title: "新增关键帧数" },
|
{ key: "key_frame_size", title: "新增关键帧数" },
|
||||||
|
|||||||
@@ -53,6 +53,19 @@ function createInitialFilters() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function createDimensionColumn(
|
||||||
|
accessor: string,
|
||||||
|
title: string,
|
||||||
|
width: number
|
||||||
|
): DataTableColumn<any> {
|
||||||
|
return {
|
||||||
|
accessor,
|
||||||
|
title,
|
||||||
|
width,
|
||||||
|
sortable: true,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export default function WorkloadMetricsTable(props: {
|
export default function WorkloadMetricsTable(props: {
|
||||||
title: string
|
title: string
|
||||||
sheetName: string
|
sheetName: string
|
||||||
@@ -144,6 +157,72 @@ export default function WorkloadMetricsTable(props: {
|
|||||||
return records
|
return records
|
||||||
}, [appliedFilters, data])
|
}, [appliedFilters, data])
|
||||||
|
|
||||||
|
const getTime = (time: number) => {
|
||||||
|
return dayjs.duration(time, "seconds").format("HH:mm:ss")
|
||||||
|
}
|
||||||
|
|
||||||
|
const baseColumns = useMemo(() => {
|
||||||
|
const allCols: Record<DimensionType, DataTableColumn<any>[]> = {
|
||||||
|
all: [
|
||||||
|
createDimensionColumn("uid", "用户ID", 100),
|
||||||
|
createDimensionColumn("user_name", "用户名", 140),
|
||||||
|
createDimensionColumn("group_name", "用户组", 160),
|
||||||
|
createDimensionColumn("project_id", "项目ID", 120),
|
||||||
|
createDimensionColumn("project_name", "项目名称", 180),
|
||||||
|
createDimensionColumn("project_type", "项目类型", 320),
|
||||||
|
createDimensionColumn("project_label_type", "标注类别", 140),
|
||||||
|
],
|
||||||
|
order_by_group_name: [createDimensionColumn("group_name", "用户组", 180)],
|
||||||
|
order_by_project_name: [
|
||||||
|
createDimensionColumn("project_name", "项目名称", 220),
|
||||||
|
],
|
||||||
|
order_by_project_type: [
|
||||||
|
createDimensionColumn("project_type", "项目类型", 320),
|
||||||
|
],
|
||||||
|
order_by_user_name: [createDimensionColumn("user_name", "用户名", 180)],
|
||||||
|
}
|
||||||
|
return allCols[appliedFilters.dimension]
|
||||||
|
}, [appliedFilters.dimension])
|
||||||
|
|
||||||
|
const defaultSortStatus = useMemo<DataTableSortStatus>(() => {
|
||||||
|
const dimensionDefaultAccessorMap: Record<DimensionType, string> = {
|
||||||
|
all: "work_time",
|
||||||
|
order_by_group_name: "group_name",
|
||||||
|
order_by_project_name: "project_name",
|
||||||
|
order_by_project_type: "project_type",
|
||||||
|
order_by_user_name: "user_name",
|
||||||
|
}
|
||||||
|
|
||||||
|
const preferredAccessor =
|
||||||
|
dimensionDefaultAccessorMap[appliedFilters.dimension] ??
|
||||||
|
metrics[0]?.key ??
|
||||||
|
String(baseColumns[0]?.accessor ?? "index")
|
||||||
|
const isMetricColumn = metrics.some(
|
||||||
|
(metric) => metric.key === preferredAccessor
|
||||||
|
)
|
||||||
|
|
||||||
|
return {
|
||||||
|
columnAccessor: preferredAccessor,
|
||||||
|
direction: isMetricColumn ? "desc" : "asc",
|
||||||
|
}
|
||||||
|
}, [appliedFilters.dimension, baseColumns, metrics])
|
||||||
|
|
||||||
|
const availableSortAccessors = useMemo(
|
||||||
|
() =>
|
||||||
|
new Set([
|
||||||
|
...baseColumns.map((column) => String(column.accessor)),
|
||||||
|
...metrics.map((metric) => metric.key),
|
||||||
|
]),
|
||||||
|
[baseColumns, metrics]
|
||||||
|
)
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (availableSortAccessors.has(String(sortStatus.columnAccessor))) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
setSortStatus(defaultSortStatus)
|
||||||
|
}, [availableSortAccessors, defaultSortStatus, sortStatus.columnAccessor])
|
||||||
|
|
||||||
const sortedRecords = useMemo(() => {
|
const sortedRecords = useMemo(() => {
|
||||||
const list = [...filteredRecords]
|
const list = [...filteredRecords]
|
||||||
const accessor = sortStatus.columnAccessor
|
const accessor = sortStatus.columnAccessor
|
||||||
@@ -156,39 +235,16 @@ export default function WorkloadMetricsTable(props: {
|
|||||||
if (Number.isFinite(an) && Number.isFinite(bn)) {
|
if (Number.isFinite(an) && Number.isFinite(bn)) {
|
||||||
return (an - bn) * dir
|
return (an - bn) * dir
|
||||||
}
|
}
|
||||||
return String(av ?? "").localeCompare(String(bv ?? "")) * dir
|
return (
|
||||||
|
String(av ?? "").localeCompare(String(bv ?? ""), "zh-CN", {
|
||||||
|
numeric: true,
|
||||||
|
sensitivity: "base",
|
||||||
|
}) * dir
|
||||||
|
)
|
||||||
})
|
})
|
||||||
return list
|
return list
|
||||||
}, [filteredRecords, sortStatus.columnAccessor, sortStatus.direction])
|
}, [filteredRecords, sortStatus.columnAccessor, sortStatus.direction])
|
||||||
|
|
||||||
const getTime = (time: number) => {
|
|
||||||
return dayjs.duration(time, "seconds").format("HH:mm:ss")
|
|
||||||
}
|
|
||||||
|
|
||||||
const baseColumns = useMemo(() => {
|
|
||||||
const allCols: Record<DimensionType, DataTableColumn<any>[]> = {
|
|
||||||
all: [
|
|
||||||
{ accessor: "project_name", title: "项目名称", width: 180 },
|
|
||||||
{ accessor: "project_type", title: "项目类型", width: 280 },
|
|
||||||
{ accessor: "user_name", title: "用户名", width: 120 },
|
|
||||||
{ accessor: "group_name", title: "用户组", width: 160 },
|
|
||||||
],
|
|
||||||
order_by_group_name: [
|
|
||||||
{ accessor: "group_name", title: "用户组", width: 180 },
|
|
||||||
],
|
|
||||||
order_by_project_name: [
|
|
||||||
{ accessor: "project_name", title: "项目名称", width: 220 },
|
|
||||||
],
|
|
||||||
order_by_project_type: [
|
|
||||||
{ accessor: "project_type", title: "项目类型", width: 320 },
|
|
||||||
],
|
|
||||||
order_by_user_name: [
|
|
||||||
{ accessor: "user_name", title: "用户名", width: 180 },
|
|
||||||
],
|
|
||||||
}
|
|
||||||
return allCols[appliedFilters.dimension]
|
|
||||||
}, [appliedFilters.dimension])
|
|
||||||
|
|
||||||
const columns = useMemo(() => {
|
const columns = useMemo(() => {
|
||||||
const totalsByKey = Object.fromEntries(
|
const totalsByKey = Object.fromEntries(
|
||||||
metrics.map((metric) => {
|
metrics.map((metric) => {
|
||||||
@@ -268,7 +324,7 @@ export default function WorkloadMetricsTable(props: {
|
|||||||
const rowKey = useMemo(() => {
|
const rowKey = useMemo(() => {
|
||||||
if (appliedFilters.dimension === "all") {
|
if (appliedFilters.dimension === "all") {
|
||||||
return (record: any) =>
|
return (record: any) =>
|
||||||
`${record.project_id ?? "p"}_${record.uid ?? "u"}_${record.project_name ?? ""}_${record.user_name ?? ""}`
|
`${record.project_id ?? "p"}_${record.uid ?? "u"}_${record.project_label_type ?? ""}_${record.project_name ?? ""}_${record.user_name ?? ""}`
|
||||||
}
|
}
|
||||||
if (appliedFilters.dimension === "order_by_group_name") return "group_name"
|
if (appliedFilters.dimension === "order_by_group_name") return "group_name"
|
||||||
if (appliedFilters.dimension === "order_by_project_name")
|
if (appliedFilters.dimension === "order_by_project_name")
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ export namespace WorkLoad {
|
|||||||
project_id: number
|
project_id: number
|
||||||
project_name: string
|
project_name: string
|
||||||
project_type: string
|
project_type: string
|
||||||
|
project_label_type: string
|
||||||
question_size: number
|
question_size: number
|
||||||
rejected_label_1: number
|
rejected_label_1: number
|
||||||
reviewed_question_size: number
|
reviewed_question_size: number
|
||||||
@@ -48,6 +49,7 @@ export namespace WorkLoad {
|
|||||||
object_size: number
|
object_size: number
|
||||||
prelabel_object_size: number
|
prelabel_object_size: number
|
||||||
project_id: number
|
project_id: number
|
||||||
|
project_label_type: string
|
||||||
project_name: string
|
project_name: string
|
||||||
project_type: string
|
project_type: string
|
||||||
reject_review_1: number
|
reject_review_1: number
|
||||||
@@ -82,6 +84,7 @@ export namespace WorkLoad {
|
|||||||
object_size: number
|
object_size: number
|
||||||
prelabel_object_size: number
|
prelabel_object_size: number
|
||||||
project_id: number
|
project_id: number
|
||||||
|
project_label_type: string
|
||||||
project_name: string
|
project_name: string
|
||||||
project_type: string
|
project_type: string
|
||||||
reject_review_2: number
|
reject_review_2: number
|
||||||
|
|||||||
@@ -49,7 +49,7 @@
|
|||||||
"env-cmd": "^11.0.0",
|
"env-cmd": "^11.0.0",
|
||||||
"geojson": "^0.5.0",
|
"geojson": "^0.5.0",
|
||||||
"html-react-parser": "^5.2.11",
|
"html-react-parser": "^5.2.11",
|
||||||
"idb-keyval": "^6.2.2",
|
"idb-keyval": "6.2.2",
|
||||||
"ioredis": "^5.8.0",
|
"ioredis": "^5.8.0",
|
||||||
"js-base64": "^3.7.8",
|
"js-base64": "^3.7.8",
|
||||||
"libav.js": "^6.8.8",
|
"libav.js": "^6.8.8",
|
||||||
|
|||||||
Reference in New Issue
Block a user