feat(assets): add dimension analysis and authorized user previews
ci/woodpecker/push/woodpecker Pipeline was successful

Refactor asset drilldowns with combined dimension filters, parent summaries and progressive loading. Add the hidden /who read-only permission preview with scoped authorization, identity mapping and audit logging. Refine inventory counts and AI问数 presentation.
This commit is contained in:
shishengliang
2026-09-28 12:29:51 +08:00
parent 6de77adb47
commit f1b3f8d3da
69 changed files with 3871 additions and 536 deletions
+6 -4
View File
@@ -58,13 +58,15 @@ export const gapStore = {
[userId, fingerprint, demand, reason],
);
},
async list(userId: string | null): Promise<DemandGap[]> {
await ensure();
await purge();
async list(userId: string | null, options: { readOnly?: boolean } = {}): Promise<DemandGap[]> {
if (!options.readOnly) {
await ensure();
await purge();
}
const [rows] = await pool.query<RowDataPacket[]>(
`SELECT id,demand,reason,status,occurrences,
DATE_FORMAT(first_seen,'%Y-%m-%dT%H:%i:%sZ') firstSeen, DATE_FORMAT(last_seen,'%Y-%m-%dT%H:%i:%sZ') lastSeen
FROM bi_asset_ai_gaps ${userId ? "WHERE user_id = ?" : ""} ORDER BY last_seen DESC LIMIT 200`,
FROM bi_asset_ai_gaps WHERE ${userId ? "user_id = ? AND " : ""}last_seen >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 90 DAY) ORDER BY last_seen DESC LIMIT 200`,
userId ? [userId] : [],
);
return rows as DemandGap[];