@optifye/dashboard-core 4.3.5 → 4.3.8
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/index.d.mts +95 -13
- package/dist/index.d.ts +95 -13
- package/dist/index.js +947 -261
- package/dist/index.mjs +946 -262
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -434,6 +434,25 @@ var getTable2 = (dbConfig, tableName) => {
|
|
|
434
434
|
return userValue ?? defaults2[tableName];
|
|
435
435
|
};
|
|
436
436
|
var dashboardService = {
|
|
437
|
+
/**
|
|
438
|
+
* Helper method to filter workspaces by line_id for disambiguation
|
|
439
|
+
* @param workspaces - Array of workspace metrics
|
|
440
|
+
* @param lineId - Line ID to filter by
|
|
441
|
+
* @returns Filtered workspace metrics
|
|
442
|
+
*/
|
|
443
|
+
filterWorkspacesByLineId(workspaces, lineId) {
|
|
444
|
+
return workspaces.filter((workspace) => workspace.line_id === lineId);
|
|
445
|
+
},
|
|
446
|
+
/**
|
|
447
|
+
* Helper method to get workspace by composite key (line_id + workspace_name)
|
|
448
|
+
* @param workspaces - Array of workspace metrics
|
|
449
|
+
* @param workspaceName - Workspace name to search for
|
|
450
|
+
* @param lineId - Line ID to filter by
|
|
451
|
+
* @returns Matching workspace or undefined
|
|
452
|
+
*/
|
|
453
|
+
getWorkspaceByLineIdAndName(workspaces, workspaceName, lineId) {
|
|
454
|
+
return workspaces.find((workspace) => workspace.workspace_name === workspaceName && workspace.line_id === lineId);
|
|
455
|
+
},
|
|
437
456
|
// Example for getLineInfo:
|
|
438
457
|
async getLineInfo(lineIdInput) {
|
|
439
458
|
const supabase = _getSupabaseInstance();
|
|
@@ -594,6 +613,13 @@ var dashboardService = {
|
|
|
594
613
|
metrics: metricsForReturn
|
|
595
614
|
};
|
|
596
615
|
},
|
|
616
|
+
/**
|
|
617
|
+
* Get workspace data with line_id-aware filtering
|
|
618
|
+
* @param lineIdInput - Specific line ID to filter by, or factory view ID
|
|
619
|
+
* @param dateProp - Date to query (optional)
|
|
620
|
+
* @param shiftProp - Shift ID to query (optional)
|
|
621
|
+
* @returns Array of workspace metrics with line_id context
|
|
622
|
+
*/
|
|
597
623
|
async getWorkspacesData(lineIdInput, dateProp, shiftProp) {
|
|
598
624
|
const supabase = _getSupabaseInstance();
|
|
599
625
|
const config = _getDashboardConfigInstance();
|
|
@@ -620,17 +646,20 @@ var dashboardService = {
|
|
|
620
646
|
throw new Error("Factory View requires defaultLineId and secondaryLineId to be configured for workspace data.");
|
|
621
647
|
}
|
|
622
648
|
query = query.in("line_id", [defaultLineId, secondaryLineId]);
|
|
649
|
+
console.log(`[getWorkspacesData] Querying factory view with lines: ${defaultLineId}, ${secondaryLineId}`);
|
|
623
650
|
} else {
|
|
624
651
|
query = query.eq("line_id", lineId);
|
|
652
|
+
console.log(`[getWorkspacesData] Querying single line: ${lineId}`);
|
|
625
653
|
}
|
|
626
654
|
const { data, error } = await query;
|
|
627
655
|
if (error) {
|
|
628
656
|
console.error("Error in getWorkspacesData:", error);
|
|
629
657
|
throw error;
|
|
630
658
|
}
|
|
631
|
-
|
|
659
|
+
const workspaces = (data || []).map((item) => ({
|
|
632
660
|
company_id: item.company_id,
|
|
633
661
|
line_id: item.line_id,
|
|
662
|
+
// Ensure line_id is always included
|
|
634
663
|
shift_id: item.shift_id,
|
|
635
664
|
date: item.date,
|
|
636
665
|
workspace_uuid: item.workspace_id,
|
|
@@ -644,6 +673,20 @@ var dashboardService = {
|
|
|
644
673
|
efficiency: item.efficiency || 0,
|
|
645
674
|
action_threshold: item.total_day_output || 0
|
|
646
675
|
}));
|
|
676
|
+
console.log(`[getWorkspacesData] Retrieved ${workspaces.length} workspaces for line(s): ${lineId || "factory"}`);
|
|
677
|
+
console.log(
|
|
678
|
+
`[getWorkspacesData] Workspace line_id distribution:`,
|
|
679
|
+
workspaces.reduce((acc, ws) => {
|
|
680
|
+
acc[ws.line_id] = (acc[ws.line_id] || 0) + 1;
|
|
681
|
+
return acc;
|
|
682
|
+
}, {})
|
|
683
|
+
);
|
|
684
|
+
console.log(`[getWorkspacesData] Sample workspaces:`, workspaces.slice(0, 5).map((ws) => ({
|
|
685
|
+
workspace_name: ws.workspace_name,
|
|
686
|
+
line_id: ws.line_id,
|
|
687
|
+
efficiency: ws.efficiency
|
|
688
|
+
})));
|
|
689
|
+
return workspaces;
|
|
647
690
|
},
|
|
648
691
|
async getWorkspaceDetailedMetrics(workspaceUuid, dateProp, shiftIdProp) {
|
|
649
692
|
const supabase = _getSupabaseInstance();
|
|
@@ -1876,8 +1919,8 @@ var SSEChatClient = class {
|
|
|
1876
1919
|
user_id: userId,
|
|
1877
1920
|
context
|
|
1878
1921
|
});
|
|
1879
|
-
const agnoApiUrl = this.baseUrl || "https://
|
|
1880
|
-
const endpoint = `${agnoApiUrl}/api/chat`;
|
|
1922
|
+
const agnoApiUrl = this.baseUrl || "https://fastapi-production-111f9.up.railway.app";
|
|
1923
|
+
const endpoint = `${agnoApiUrl}/api/v2/chat`;
|
|
1881
1924
|
console.log("[SSEClient] Posting directly to AGNO:", endpoint);
|
|
1882
1925
|
const response = await fetch(endpoint, {
|
|
1883
1926
|
method: "POST",
|
|
@@ -1935,7 +1978,7 @@ var SSEChatClient = class {
|
|
|
1935
1978
|
const decoder = new TextDecoder();
|
|
1936
1979
|
let buffer = "";
|
|
1937
1980
|
try {
|
|
1938
|
-
console.log("[SSEClient] Starting to read stream...");
|
|
1981
|
+
console.log("[SSEClient] Starting to read enhanced stream...");
|
|
1939
1982
|
while (true) {
|
|
1940
1983
|
const { done, value } = await reader.read();
|
|
1941
1984
|
if (done) {
|
|
@@ -1965,11 +2008,14 @@ var SSEChatClient = class {
|
|
|
1965
2008
|
case "message":
|
|
1966
2009
|
callbacks.onMessage?.(data.text);
|
|
1967
2010
|
break;
|
|
1968
|
-
case "
|
|
1969
|
-
callbacks.
|
|
2011
|
+
case "tool_call":
|
|
2012
|
+
callbacks.onToolCall?.(data.tools);
|
|
2013
|
+
break;
|
|
2014
|
+
case "tool_result":
|
|
2015
|
+
callbacks.onToolResult?.(data.results);
|
|
1970
2016
|
break;
|
|
1971
2017
|
case "complete":
|
|
1972
|
-
callbacks.onComplete?.(data.message_id);
|
|
2018
|
+
callbacks.onComplete?.(data.message_id, data.metrics);
|
|
1973
2019
|
break;
|
|
1974
2020
|
case "error":
|
|
1975
2021
|
callbacks.onError?.(data.error);
|
|
@@ -2509,7 +2555,7 @@ var useMetrics = (tableName, options) => {
|
|
|
2509
2555
|
};
|
|
2510
2556
|
return { data, isLoading, error, refetch };
|
|
2511
2557
|
};
|
|
2512
|
-
var useWorkspaceDetailedMetrics = (workspaceId, date, shiftId) => {
|
|
2558
|
+
var useWorkspaceDetailedMetrics = (workspaceId, date, shiftId, lineId) => {
|
|
2513
2559
|
const entityConfig = useEntityConfig();
|
|
2514
2560
|
const databaseConfig = useDatabaseConfig();
|
|
2515
2561
|
const dateTimeConfig = useDateTimeConfig();
|
|
@@ -2537,14 +2583,32 @@ var useWorkspaceDetailedMetrics = (workspaceId, date, shiftId) => {
|
|
|
2537
2583
|
const currentShift = getCurrentShift(defaultTimezone, shiftConfig);
|
|
2538
2584
|
const queryDate = date || currentShift.date;
|
|
2539
2585
|
const queryShiftId = shiftId !== void 0 ? shiftId : currentShift.shiftId;
|
|
2586
|
+
console.log("[useWorkspaceDetailedMetrics] Hook called with parameters:", {
|
|
2587
|
+
workspaceId,
|
|
2588
|
+
date,
|
|
2589
|
+
shiftId,
|
|
2590
|
+
lineId,
|
|
2591
|
+
queryDate,
|
|
2592
|
+
queryShiftId
|
|
2593
|
+
});
|
|
2540
2594
|
console.log("[useWorkspaceDetailedMetrics] Using shift ID:", queryShiftId, "from input shift:", shiftId);
|
|
2541
2595
|
console.log("[useWorkspaceDetailedMetrics] Using date:", queryDate, "from input date:", date);
|
|
2542
|
-
console.log(`[useWorkspaceDetailedMetrics] Querying ${metricsTable} for workspace: ${workspaceId}, date: ${queryDate}, shift: ${queryShiftId}`);
|
|
2543
|
-
|
|
2596
|
+
console.log(`[useWorkspaceDetailedMetrics] Querying ${metricsTable} for workspace: ${workspaceId}, date: ${queryDate}, shift: ${queryShiftId}, line: ${lineId || "any"}`);
|
|
2597
|
+
let query = supabase.from(metricsTable).select("*").eq("workspace_id", workspaceId).eq("date", queryDate).eq("shift_id", queryShiftId);
|
|
2598
|
+
if (lineId) {
|
|
2599
|
+
query = query.eq("line_id", lineId);
|
|
2600
|
+
console.log(`[useWorkspaceDetailedMetrics] Filtering by line_id: ${lineId}`);
|
|
2601
|
+
}
|
|
2602
|
+
const { data, error: fetchError } = await query.maybeSingle();
|
|
2544
2603
|
if (fetchError) throw fetchError;
|
|
2545
2604
|
if (!data && !date && shiftId === void 0) {
|
|
2546
2605
|
console.log("[useWorkspaceDetailedMetrics] No data found for current date/shift, attempting to find most recent data...");
|
|
2547
|
-
|
|
2606
|
+
let recentQuery = supabase.from(metricsTable).select("*").eq("workspace_id", workspaceId);
|
|
2607
|
+
if (lineId) {
|
|
2608
|
+
recentQuery = recentQuery.eq("line_id", lineId);
|
|
2609
|
+
console.log(`[useWorkspaceDetailedMetrics] Fallback query filtering by line_id: ${lineId}`);
|
|
2610
|
+
}
|
|
2611
|
+
const { data: recentData, error: recentError } = await recentQuery.order("date", { ascending: false }).order("shift_id", { ascending: false }).limit(1).maybeSingle();
|
|
2548
2612
|
if (recentError) throw recentError;
|
|
2549
2613
|
if (recentData) {
|
|
2550
2614
|
console.log(`[useWorkspaceDetailedMetrics] Found fallback data from date: ${recentData.date}, shift: ${recentData.shift_id}`);
|
|
@@ -2762,7 +2826,7 @@ var useWorkspaceDetailedMetrics = (workspaceId, date, shiftId) => {
|
|
|
2762
2826
|
updateQueueRef.current = false;
|
|
2763
2827
|
setIsLoading(false);
|
|
2764
2828
|
}
|
|
2765
|
-
}, [supabase, workspaceId, date, shiftId, metricsTable, defaultTimezone, shiftConfig, workspaceConfig, companyId]);
|
|
2829
|
+
}, [supabase, workspaceId, date, shiftId, lineId, metricsTable, defaultTimezone, shiftConfig, workspaceConfig, companyId]);
|
|
2766
2830
|
const queueUpdate = useCallback(() => {
|
|
2767
2831
|
if (!workspaceId || updateQueueRef.current) return;
|
|
2768
2832
|
updateQueueRef.current = true;
|
|
@@ -2893,7 +2957,7 @@ var useWorkspaceDetailedMetrics = (workspaceId, date, shiftId) => {
|
|
|
2893
2957
|
supabase.removeChannel(channelRef.current);
|
|
2894
2958
|
}
|
|
2895
2959
|
};
|
|
2896
|
-
}, [supabase, workspaceId, date, shiftId, fetchMetrics, queueUpdate, setupSubscription, metricsTable, workspaceMetricsBaseTable, workspaceActionsTable, defaultTimezone, shiftConfig, schema, metricsTablePrefix]);
|
|
2960
|
+
}, [supabase, workspaceId, date, shiftId, lineId, fetchMetrics, queueUpdate, setupSubscription, metricsTable, workspaceMetricsBaseTable, workspaceActionsTable, defaultTimezone, shiftConfig, schema, metricsTablePrefix]);
|
|
2897
2961
|
return {
|
|
2898
2962
|
metrics: metrics2,
|
|
2899
2963
|
isLoading,
|
|
@@ -3355,6 +3419,7 @@ var setCache = (lineId, metrics2) => {
|
|
|
3355
3419
|
}
|
|
3356
3420
|
};
|
|
3357
3421
|
var useDashboardMetrics = ({ onLineMetricsUpdate, lineId }) => {
|
|
3422
|
+
console.log("[useDashboardMetrics] Hook called with lineId:", lineId);
|
|
3358
3423
|
const { supabaseUrl, supabaseKey } = useDashboardConfig();
|
|
3359
3424
|
const entityConfig = useEntityConfig();
|
|
3360
3425
|
const databaseConfig = useDatabaseConfig();
|
|
@@ -3398,14 +3463,33 @@ var useDashboardMetrics = ({ onLineMetricsUpdate, lineId }) => {
|
|
|
3398
3463
|
try {
|
|
3399
3464
|
const currentShiftDetails = getCurrentShift(defaultTimezone, shiftConfig);
|
|
3400
3465
|
const operationalDate = getOperationalDate(defaultTimezone);
|
|
3401
|
-
const
|
|
3466
|
+
const isFactoryView = currentLineIdToUse === (entityConfig.factoryViewId || "factory");
|
|
3467
|
+
const targetLineIds = isFactoryView ? [entityConfig.defaultLineId, entityConfig.secondaryLineId].filter((id3) => !!id3) : [currentLineIdToUse];
|
|
3468
|
+
console.log("[useDashboardMetrics] Target line IDs determined:", {
|
|
3469
|
+
currentLineIdToUse,
|
|
3470
|
+
isFactoryView,
|
|
3471
|
+
factoryViewId: entityConfig.factoryViewId,
|
|
3472
|
+
defaultLineId: entityConfig.defaultLineId,
|
|
3473
|
+
secondaryLineId: entityConfig.secondaryLineId,
|
|
3474
|
+
targetLineIds
|
|
3475
|
+
});
|
|
3402
3476
|
if (targetLineIds.length === 0 && currentLineIdToUse === (entityConfig.factoryViewId || "factory")) {
|
|
3403
3477
|
throw new Error("Factory view selected, but defaultLineId and/or secondaryLineId are not configured in entityConfig.");
|
|
3404
3478
|
}
|
|
3405
3479
|
if (targetLineIds.length === 0) {
|
|
3406
3480
|
throw new Error("No target line IDs available for fetching metrics.");
|
|
3407
3481
|
}
|
|
3482
|
+
console.log("[useDashboardMetrics] Executing workspace query with line IDs:", targetLineIds, "Date:", operationalDate, "ShiftID:", currentShiftDetails.shiftId, "Table:", companySpecificMetricsTable);
|
|
3408
3483
|
const { data: workspaceData, error: workspaceError } = await supabase.from(companySpecificMetricsTable).select("company_id,line_id,shift_id,date,workspace_id,workspace_name,total_output,avg_pph,performance_score,avg_cycle_time,trend_score,ideal_output,efficiency,total_day_output").eq("date", operationalDate).eq("shift_id", currentShiftDetails.shiftId).in("line_id", targetLineIds);
|
|
3484
|
+
console.log("[useDashboardMetrics] Workspace query result:", {
|
|
3485
|
+
dataCount: workspaceData?.length || 0,
|
|
3486
|
+
error: workspaceError,
|
|
3487
|
+
sampleData: workspaceData?.slice(0, 3).map((w) => ({
|
|
3488
|
+
workspace_name: w.workspace_name,
|
|
3489
|
+
line_id: w.line_id,
|
|
3490
|
+
efficiency: w.efficiency
|
|
3491
|
+
}))
|
|
3492
|
+
});
|
|
3409
3493
|
if (workspaceError) {
|
|
3410
3494
|
throw workspaceError;
|
|
3411
3495
|
}
|
|
@@ -4777,12 +4861,16 @@ function getCurrentLineIds() {
|
|
|
4777
4861
|
try {
|
|
4778
4862
|
const config = _getDashboardConfigInstance();
|
|
4779
4863
|
const entityConfig = config?.entityConfig;
|
|
4864
|
+
console.log("\u{1F504} Dashboard config:", config);
|
|
4865
|
+
console.log("\u{1F504} Entity config:", entityConfig);
|
|
4780
4866
|
const lineIds = [];
|
|
4781
4867
|
if (entityConfig?.defaultLineId) {
|
|
4782
4868
|
lineIds.push(entityConfig.defaultLineId);
|
|
4869
|
+
console.log("\u{1F504} Added defaultLineId:", entityConfig.defaultLineId);
|
|
4783
4870
|
}
|
|
4784
4871
|
if (entityConfig?.secondaryLineId) {
|
|
4785
4872
|
lineIds.push(entityConfig.secondaryLineId);
|
|
4873
|
+
console.log("\u{1F504} Added secondaryLineId:", entityConfig.secondaryLineId);
|
|
4786
4874
|
}
|
|
4787
4875
|
console.log("\u{1F504} Current line IDs from config:", lineIds);
|
|
4788
4876
|
return lineIds;
|
|
@@ -4800,15 +4888,22 @@ async function initializeWorkspaceDisplayNames(explicitLineId) {
|
|
|
4800
4888
|
let targetLineIds = [];
|
|
4801
4889
|
if (explicitLineId) {
|
|
4802
4890
|
targetLineIds = [explicitLineId];
|
|
4891
|
+
console.log("\u{1F504} Using explicit lineId:", explicitLineId);
|
|
4803
4892
|
} else {
|
|
4804
4893
|
targetLineIds = getCurrentLineIds();
|
|
4894
|
+
console.log("\u{1F504} Using line IDs from config:", targetLineIds);
|
|
4805
4895
|
}
|
|
4806
4896
|
console.log("\u{1F504} Target line IDs for workspace filtering:", targetLineIds);
|
|
4807
4897
|
const allDisplayNamesMap = /* @__PURE__ */ new Map();
|
|
4898
|
+
console.log("\u{1F504} About to fetch workspaces for lines:", targetLineIds);
|
|
4808
4899
|
if (targetLineIds.length > 0) {
|
|
4809
4900
|
for (const lineId of targetLineIds) {
|
|
4810
4901
|
console.log(`\u{1F504} Fetching workspaces for line: ${lineId}`);
|
|
4811
4902
|
const lineDisplayNamesMap = await workspaceService.getWorkspaceDisplayNames(void 0, lineId);
|
|
4903
|
+
console.log(
|
|
4904
|
+
`\u{1F504} Retrieved ${lineDisplayNamesMap.size} workspaces for line ${lineId}:`,
|
|
4905
|
+
Array.from(lineDisplayNamesMap.entries()).slice(0, 5)
|
|
4906
|
+
);
|
|
4812
4907
|
lineDisplayNamesMap.forEach((displayName, workspaceId) => {
|
|
4813
4908
|
allDisplayNamesMap.set(workspaceId, displayName);
|
|
4814
4909
|
});
|
|
@@ -4820,6 +4915,7 @@ async function initializeWorkspaceDisplayNames(explicitLineId) {
|
|
|
4820
4915
|
allDisplayNamesMap.set(workspaceId, displayName);
|
|
4821
4916
|
});
|
|
4822
4917
|
}
|
|
4918
|
+
console.log("\u{1F504} Final combined display names map size:", allDisplayNamesMap.size);
|
|
4823
4919
|
runtimeWorkspaceDisplayNames = {};
|
|
4824
4920
|
allDisplayNamesMap.forEach((displayName, workspaceId) => {
|
|
4825
4921
|
runtimeWorkspaceDisplayNames[workspaceId] = displayName;
|
|
@@ -4847,6 +4943,7 @@ var forceRefreshWorkspaceDisplayNames = async (lineId) => {
|
|
|
4847
4943
|
};
|
|
4848
4944
|
console.log("\u{1F504} Module loaded, will initialize lazily when first function is called");
|
|
4849
4945
|
var getWorkspaceDisplayName = (workspaceId, lineId) => {
|
|
4946
|
+
console.log(`\u{1F504} [DEBUG] getWorkspaceDisplayName called with:`, { workspaceId, lineId, isInitialized, isInitializing });
|
|
4850
4947
|
if (!isInitialized && !isInitializing) {
|
|
4851
4948
|
console.log(`\u{1F504} [DEBUG] getWorkspaceDisplayName(${workspaceId}) - Not initialized, triggering lazy init...`);
|
|
4852
4949
|
} else if (isInitializing) {
|
|
@@ -4858,6 +4955,14 @@ var getWorkspaceDisplayName = (workspaceId, lineId) => {
|
|
|
4858
4955
|
console.error("\u274C Lazy initialization failed:", error);
|
|
4859
4956
|
});
|
|
4860
4957
|
}
|
|
4958
|
+
if (lineId) {
|
|
4959
|
+
const lineSpecificKey = `${lineId}_${workspaceId}`;
|
|
4960
|
+
const lineSpecificDisplayName = runtimeWorkspaceDisplayNames[lineSpecificKey];
|
|
4961
|
+
if (lineSpecificDisplayName) {
|
|
4962
|
+
console.log(`getWorkspaceDisplayName(${workspaceId}, ${lineId}) -> ${lineSpecificDisplayName} (line-specific from Supabase)`);
|
|
4963
|
+
return lineSpecificDisplayName;
|
|
4964
|
+
}
|
|
4965
|
+
}
|
|
4861
4966
|
const displayName = runtimeWorkspaceDisplayNames[workspaceId];
|
|
4862
4967
|
if (displayName) {
|
|
4863
4968
|
console.log(`getWorkspaceDisplayName(${workspaceId}) -> ${displayName} (from Supabase)`);
|
|
@@ -4878,6 +4983,14 @@ var getShortWorkspaceDisplayName = (workspaceId, lineId) => {
|
|
|
4878
4983
|
console.error("\u274C Lazy initialization failed:", error);
|
|
4879
4984
|
});
|
|
4880
4985
|
}
|
|
4986
|
+
if (lineId) {
|
|
4987
|
+
const lineSpecificKey = `${lineId}_${workspaceId}`;
|
|
4988
|
+
const lineSpecificDisplayName = runtimeWorkspaceDisplayNames[lineSpecificKey];
|
|
4989
|
+
if (lineSpecificDisplayName) {
|
|
4990
|
+
console.log(`getShortWorkspaceDisplayName(${workspaceId}, ${lineId}) -> ${lineSpecificDisplayName} (line-specific from Supabase)`);
|
|
4991
|
+
return lineSpecificDisplayName;
|
|
4992
|
+
}
|
|
4993
|
+
}
|
|
4881
4994
|
const displayName = runtimeWorkspaceDisplayNames[workspaceId];
|
|
4882
4995
|
if (displayName) {
|
|
4883
4996
|
console.log(`getShortWorkspaceDisplayName(${workspaceId}) -> ${displayName} (from Supabase)`);
|
|
@@ -7952,18 +8065,36 @@ function cn(...inputs) {
|
|
|
7952
8065
|
}
|
|
7953
8066
|
|
|
7954
8067
|
// src/lib/utils/urlMapping.ts
|
|
7955
|
-
var toUrlFriendlyName = (workspaceName) => {
|
|
8068
|
+
var toUrlFriendlyName = (workspaceName, lineId) => {
|
|
7956
8069
|
if (!workspaceName) throw new Error("Workspace name is required");
|
|
7957
|
-
|
|
8070
|
+
const baseName = workspaceName.toLowerCase().replace(/\s+/g, "-");
|
|
8071
|
+
return lineId ? `${lineId}-${baseName}` : baseName;
|
|
8072
|
+
};
|
|
8073
|
+
var fromUrlFriendlyName = (urlName) => {
|
|
8074
|
+
const parts = urlName.split("-");
|
|
8075
|
+
if (parts.length >= 2 && (parts[0].startsWith("line") || parts[0].length === 36)) {
|
|
8076
|
+
return {
|
|
8077
|
+
lineId: parts[0],
|
|
8078
|
+
workspaceName: parts.slice(1).join("-").toUpperCase()
|
|
8079
|
+
};
|
|
8080
|
+
}
|
|
8081
|
+
return { workspaceName: urlName.toUpperCase() };
|
|
7958
8082
|
};
|
|
7959
|
-
var fromUrlFriendlyName = (urlName) => urlName.toUpperCase();
|
|
7960
8083
|
var storeWorkspaceMapping = (mapping) => {
|
|
7961
8084
|
const mappings = getStoredWorkspaceMappings();
|
|
7962
|
-
|
|
8085
|
+
const key = mapping.lineId ? `${mapping.lineId}_${mapping.urlName}` : mapping.urlName;
|
|
8086
|
+
mappings[key] = mapping;
|
|
7963
8087
|
sessionStorage.setItem("workspaceMappings", JSON.stringify(mappings));
|
|
7964
8088
|
};
|
|
7965
|
-
var getWorkspaceFromUrl = (urlName) => {
|
|
8089
|
+
var getWorkspaceFromUrl = (urlName, lineId) => {
|
|
7966
8090
|
const mappings = getStoredWorkspaceMappings();
|
|
8091
|
+
if (lineId) {
|
|
8092
|
+
const lineSpecificKey = `${lineId}_${urlName}`;
|
|
8093
|
+
const lineSpecificMapping = mappings[lineSpecificKey];
|
|
8094
|
+
if (lineSpecificMapping) {
|
|
8095
|
+
return lineSpecificMapping;
|
|
8096
|
+
}
|
|
8097
|
+
}
|
|
7967
8098
|
return mappings[urlName] || null;
|
|
7968
8099
|
};
|
|
7969
8100
|
var getStoredWorkspaceMappings = () => {
|
|
@@ -7974,6 +8105,26 @@ var getStoredWorkspaceMappings = () => {
|
|
|
7974
8105
|
return {};
|
|
7975
8106
|
}
|
|
7976
8107
|
};
|
|
8108
|
+
var getWorkspaceMappingsForLine = (lineId) => {
|
|
8109
|
+
const allMappings = getStoredWorkspaceMappings();
|
|
8110
|
+
const lineMappings = {};
|
|
8111
|
+
Object.entries(allMappings).forEach(([key, mapping]) => {
|
|
8112
|
+
if (mapping.lineId === lineId) {
|
|
8113
|
+
lineMappings[key] = mapping;
|
|
8114
|
+
}
|
|
8115
|
+
});
|
|
8116
|
+
return lineMappings;
|
|
8117
|
+
};
|
|
8118
|
+
var clearWorkspaceMappingsForLine = (lineId) => {
|
|
8119
|
+
const allMappings = getStoredWorkspaceMappings();
|
|
8120
|
+
const filteredMappings = {};
|
|
8121
|
+
Object.entries(allMappings).forEach(([key, mapping]) => {
|
|
8122
|
+
if (mapping.lineId !== lineId) {
|
|
8123
|
+
filteredMappings[key] = mapping;
|
|
8124
|
+
}
|
|
8125
|
+
});
|
|
8126
|
+
sessionStorage.setItem("workspaceMappings", JSON.stringify(filteredMappings));
|
|
8127
|
+
};
|
|
7977
8128
|
|
|
7978
8129
|
// src/lib/utils/workspacePreferences.ts
|
|
7979
8130
|
var getDefaultTabForWorkspace = (workspaceId, displayName) => {
|
|
@@ -17468,6 +17619,7 @@ var VideoCard = React14__default.memo(({
|
|
|
17468
17619
|
});
|
|
17469
17620
|
VideoCard.displayName = "VideoCard";
|
|
17470
17621
|
var DEFAULT_WORKSPACE_HLS_URLS = {
|
|
17622
|
+
// Line-agnostic fallbacks
|
|
17471
17623
|
"WS1": "https://dnh-hls.optifye.ai/cam1/index.m3u8",
|
|
17472
17624
|
"WS2": "https://dnh-hls.optifye.ai/cam2/index.m3u8",
|
|
17473
17625
|
"WS3": "https://dnh-hls.optifye.ai/cam3/index.m3u8",
|
|
@@ -17478,6 +17630,9 @@ var DEFAULT_WORKSPACE_HLS_URLS = {
|
|
|
17478
17630
|
"WS04": "https://59.144.218.58:8443/camera4.m3u8",
|
|
17479
17631
|
"WS05": "https://59.144.218.58:8443/camera1.m3u8",
|
|
17480
17632
|
"WS06": "https://59.144.218.58:8443/camera5.m3u8"
|
|
17633
|
+
// Line-specific mappings (line_id_workspaceName format)
|
|
17634
|
+
// Example: '98a2287e-8d55-4020-b00d-b9940437e3e1_WS1': 'https://line1-hls.optifye.ai/cam1/index.m3u8',
|
|
17635
|
+
// Example: 'd93997bb-ecac-4478-a4a6-008d536b724c_WS1': 'https://line2-hls.optifye.ai/cam1/index.m3u8',
|
|
17481
17636
|
};
|
|
17482
17637
|
var DEFAULT_HLS_URL = "https://192.168.5.9:8443/cam1.m3u8";
|
|
17483
17638
|
var VideoGridView = React14__default.memo(({
|
|
@@ -17485,7 +17640,8 @@ var VideoGridView = React14__default.memo(({
|
|
|
17485
17640
|
selectedLine,
|
|
17486
17641
|
className = "",
|
|
17487
17642
|
lineIdMapping = {},
|
|
17488
|
-
videoSources = {}
|
|
17643
|
+
videoSources = {},
|
|
17644
|
+
targetLineId
|
|
17489
17645
|
}) => {
|
|
17490
17646
|
const router = useRouter();
|
|
17491
17647
|
const containerRef = useRef(null);
|
|
@@ -17493,14 +17649,38 @@ var VideoGridView = React14__default.memo(({
|
|
|
17493
17649
|
const [gridCols, setGridCols] = useState(4);
|
|
17494
17650
|
const [visibleWorkspaces, setVisibleWorkspaces] = useState(/* @__PURE__ */ new Set());
|
|
17495
17651
|
const videoConfig = useVideoConfig();
|
|
17652
|
+
const entityConfig = useEntityConfig();
|
|
17496
17653
|
const { cropping, canvasConfig } = videoConfig;
|
|
17654
|
+
const defaultLineId = entityConfig.defaultLineId;
|
|
17655
|
+
const secondaryLineId = entityConfig.secondaryLineId;
|
|
17656
|
+
console.log("[VideoGridView] Line configuration:", {
|
|
17657
|
+
defaultLineId,
|
|
17658
|
+
secondaryLineId,
|
|
17659
|
+
selectedLine,
|
|
17660
|
+
targetLineId,
|
|
17661
|
+
totalWorkspaces: workspaces.length
|
|
17662
|
+
});
|
|
17497
17663
|
const mergedVideoSources = {
|
|
17498
17664
|
defaultHlsUrl: videoSources.defaultHlsUrl || DEFAULT_HLS_URL,
|
|
17499
17665
|
workspaceHlsUrls: { ...DEFAULT_WORKSPACE_HLS_URLS, ...videoSources.workspaceHlsUrls }
|
|
17500
17666
|
};
|
|
17501
|
-
const getWorkspaceHlsUrl = useCallback((workspaceName) => {
|
|
17667
|
+
const getWorkspaceHlsUrl = useCallback((workspaceName, lineId) => {
|
|
17502
17668
|
const wsName = workspaceName.toUpperCase();
|
|
17503
|
-
|
|
17669
|
+
if (lineId) {
|
|
17670
|
+
const lineSpecificKey = `${lineId}_${wsName}`;
|
|
17671
|
+
const lineSpecificUrl = mergedVideoSources.workspaceHlsUrls[lineSpecificKey];
|
|
17672
|
+
console.log(`[VideoGridView] HLS URL lookup for ${wsName} (line: ${lineId}):`, {
|
|
17673
|
+
lineSpecificKey,
|
|
17674
|
+
lineSpecificUrl,
|
|
17675
|
+
fallbackUrl: mergedVideoSources.workspaceHlsUrls[wsName] || mergedVideoSources.defaultHlsUrl
|
|
17676
|
+
});
|
|
17677
|
+
if (lineSpecificUrl) {
|
|
17678
|
+
return lineSpecificUrl;
|
|
17679
|
+
}
|
|
17680
|
+
}
|
|
17681
|
+
const fallbackUrl = mergedVideoSources.workspaceHlsUrls[wsName] || mergedVideoSources.defaultHlsUrl;
|
|
17682
|
+
console.log(`[VideoGridView] HLS URL fallback for ${wsName}:`, fallbackUrl);
|
|
17683
|
+
return fallbackUrl;
|
|
17504
17684
|
}, [mergedVideoSources]);
|
|
17505
17685
|
const getWorkspaceCropping = useCallback((workspaceName) => {
|
|
17506
17686
|
if (!cropping) return void 0;
|
|
@@ -17515,26 +17695,70 @@ var VideoGridView = React14__default.memo(({
|
|
|
17515
17695
|
);
|
|
17516
17696
|
}, [workspaces]);
|
|
17517
17697
|
const filteredWorkspaces = useMemo(() => {
|
|
17518
|
-
|
|
17519
|
-
|
|
17520
|
-
|
|
17521
|
-
|
|
17522
|
-
|
|
17523
|
-
|
|
17524
|
-
|
|
17525
|
-
|
|
17526
|
-
|
|
17527
|
-
|
|
17528
|
-
|
|
17529
|
-
|
|
17530
|
-
|
|
17531
|
-
|
|
17532
|
-
|
|
17533
|
-
|
|
17534
|
-
|
|
17535
|
-
|
|
17536
|
-
|
|
17537
|
-
|
|
17698
|
+
const uniqueLineIds = [...new Set(workspaces.map((w) => w.line_id))];
|
|
17699
|
+
console.log("[VideoGridView] Filtering workspaces:", {
|
|
17700
|
+
totalWorkspaces: workspaces.length,
|
|
17701
|
+
targetLineId,
|
|
17702
|
+
selectedLine,
|
|
17703
|
+
defaultLineId,
|
|
17704
|
+
secondaryLineId,
|
|
17705
|
+
uniqueLineIds,
|
|
17706
|
+
workspacesByLine: workspaces.reduce((acc, w) => {
|
|
17707
|
+
acc[w.line_id] = (acc[w.line_id] || 0) + 1;
|
|
17708
|
+
return acc;
|
|
17709
|
+
}, {})
|
|
17710
|
+
});
|
|
17711
|
+
console.log("[VideoGridView] Sample workspaces with line_id:", workspaces.slice(0, 5).map((w) => ({
|
|
17712
|
+
workspace_name: w.workspace_name,
|
|
17713
|
+
line_id: w.line_id,
|
|
17714
|
+
workspace_uuid: w.workspace_uuid
|
|
17715
|
+
})));
|
|
17716
|
+
if (targetLineId) {
|
|
17717
|
+
const filtered = workspaces.filter((w) => w.line_id === targetLineId);
|
|
17718
|
+
console.log(`[VideoGridView] Filtered by targetLineId (${targetLineId}):`, filtered.length, "workspaces");
|
|
17719
|
+
return filtered;
|
|
17720
|
+
}
|
|
17721
|
+
if (selectedLine === 1 && defaultLineId) {
|
|
17722
|
+
const filtered = workspaces.filter((w) => w.line_id === defaultLineId);
|
|
17723
|
+
console.log(`[VideoGridView] Filtered by selectedLine=1 (${defaultLineId}):`, filtered.length, "workspaces");
|
|
17724
|
+
return filtered;
|
|
17725
|
+
}
|
|
17726
|
+
if (selectedLine === 2 && secondaryLineId) {
|
|
17727
|
+
const filtered = workspaces.filter((w) => w.line_id === secondaryLineId);
|
|
17728
|
+
console.log(`[VideoGridView] Filtered by selectedLine=2 (${secondaryLineId}):`, filtered.length, "workspaces");
|
|
17729
|
+
return filtered;
|
|
17730
|
+
}
|
|
17731
|
+
if (selectedLine === 1) {
|
|
17732
|
+
const filtered = workspaces.filter((w) => {
|
|
17733
|
+
if (w.workspace_name === "WS5-5") return true;
|
|
17734
|
+
if (w.workspace_name === "WS32-5") return false;
|
|
17735
|
+
try {
|
|
17736
|
+
const wsNumber = parseInt(w.workspace_name.replace("WS", ""));
|
|
17737
|
+
return wsNumber >= 1 && wsNumber <= 22;
|
|
17738
|
+
} catch {
|
|
17739
|
+
return true;
|
|
17740
|
+
}
|
|
17741
|
+
});
|
|
17742
|
+
console.log(`[VideoGridView] Legacy filtered by selectedLine=1 (WS1-WS22):`, filtered.length, "workspaces");
|
|
17743
|
+
return filtered;
|
|
17744
|
+
}
|
|
17745
|
+
if (selectedLine === 2) {
|
|
17746
|
+
const filtered = workspaces.filter((w) => {
|
|
17747
|
+
if (w.workspace_name === "WS5-5") return false;
|
|
17748
|
+
if (w.workspace_name === "WS32-5") return true;
|
|
17749
|
+
try {
|
|
17750
|
+
const wsNumber = parseInt(w.workspace_name.replace("WS", ""));
|
|
17751
|
+
return wsNumber >= 23 && wsNumber <= 44;
|
|
17752
|
+
} catch {
|
|
17753
|
+
return false;
|
|
17754
|
+
}
|
|
17755
|
+
});
|
|
17756
|
+
console.log(`[VideoGridView] Legacy filtered by selectedLine=2 (WS23-WS44):`, filtered.length, "workspaces");
|
|
17757
|
+
return filtered;
|
|
17758
|
+
}
|
|
17759
|
+
console.log(`[VideoGridView] No filtering applied, returning all workspaces:`, workspaces.length);
|
|
17760
|
+
return workspaces;
|
|
17761
|
+
}, [workspaces, selectedLine, targetLineId, defaultLineId, secondaryLineId]);
|
|
17538
17762
|
const calculateOptimalGrid = useCallback(() => {
|
|
17539
17763
|
if (!containerRef.current) return;
|
|
17540
17764
|
const containerPadding = 16;
|
|
@@ -17611,6 +17835,12 @@ var VideoGridView = React14__default.memo(({
|
|
|
17611
17835
|
}, [filteredWorkspaces]);
|
|
17612
17836
|
const handleWorkspaceClick = useCallback((workspace) => {
|
|
17613
17837
|
const workspaceId = workspace.workspace_uuid || workspace.workspace_name;
|
|
17838
|
+
console.log("[VideoGridView] Workspace clicked:", {
|
|
17839
|
+
workspace_name: workspace.workspace_name,
|
|
17840
|
+
workspace_id: workspaceId,
|
|
17841
|
+
line_id: workspace.line_id,
|
|
17842
|
+
efficiency: workspace.efficiency
|
|
17843
|
+
});
|
|
17614
17844
|
trackCoreEvent("Workspace Detail Clicked", {
|
|
17615
17845
|
workspace_name: workspace.workspace_name,
|
|
17616
17846
|
workspace_id: workspaceId,
|
|
@@ -17619,8 +17849,15 @@ var VideoGridView = React14__default.memo(({
|
|
|
17619
17849
|
efficiency: workspace.efficiency,
|
|
17620
17850
|
action_count: workspace.action_count
|
|
17621
17851
|
});
|
|
17622
|
-
const displayName = getWorkspaceDisplayName(workspace.workspace_name);
|
|
17852
|
+
const displayName = getWorkspaceDisplayName(workspace.workspace_name, workspace.line_id);
|
|
17623
17853
|
const navParams = getWorkspaceNavigationParams(workspaceId, displayName);
|
|
17854
|
+
console.log("[VideoGridView] Navigation params:", {
|
|
17855
|
+
workspaceId,
|
|
17856
|
+
displayName,
|
|
17857
|
+
line_id: workspace.line_id,
|
|
17858
|
+
navParams,
|
|
17859
|
+
finalUrl: `/workspace/${workspaceId}${navParams}`
|
|
17860
|
+
});
|
|
17624
17861
|
router.push(`/workspace/${workspaceId}${navParams}`);
|
|
17625
17862
|
}, [router]);
|
|
17626
17863
|
return /* @__PURE__ */ jsx("div", { className: `relative overflow-hidden h-full w-full ${className}`, children: /* @__PURE__ */ jsx("div", { ref: containerRef, className: "h-full w-full p-2", children: /* @__PURE__ */ jsx(
|
|
@@ -17633,15 +17870,22 @@ var VideoGridView = React14__default.memo(({
|
|
|
17633
17870
|
minHeight: "100%"
|
|
17634
17871
|
},
|
|
17635
17872
|
children: filteredWorkspaces.sort((a, b) => {
|
|
17636
|
-
|
|
17637
|
-
|
|
17638
|
-
|
|
17639
|
-
|
|
17640
|
-
|
|
17641
|
-
|
|
17642
|
-
|
|
17873
|
+
if (!targetLineId && !selectedLine) {
|
|
17874
|
+
const aIsSecondaryLine = secondaryLineId && a.line_id === secondaryLineId;
|
|
17875
|
+
const bIsSecondaryLine = secondaryLineId && b.line_id === secondaryLineId;
|
|
17876
|
+
if (aIsSecondaryLine !== bIsSecondaryLine) {
|
|
17877
|
+
return aIsSecondaryLine ? 1 : -1;
|
|
17878
|
+
}
|
|
17879
|
+
if (!secondaryLineId && lineIdMapping.line2) {
|
|
17880
|
+
const aIsLine2 = a.line_id === lineIdMapping.line2;
|
|
17881
|
+
const bIsLine2 = b.line_id === lineIdMapping.line2;
|
|
17882
|
+
if (aIsLine2 !== bIsLine2) {
|
|
17883
|
+
return aIsLine2 ? 1 : -1;
|
|
17884
|
+
}
|
|
17643
17885
|
}
|
|
17644
17886
|
}
|
|
17887
|
+
const aNum = parseInt(a.workspace_name.slice(2));
|
|
17888
|
+
const bNum = parseInt(b.workspace_name.slice(2));
|
|
17645
17889
|
return aNum - bNum;
|
|
17646
17890
|
}).map((workspace) => {
|
|
17647
17891
|
const workspaceId = workspace.workspace_uuid || workspace.workspace_name;
|
|
@@ -17658,7 +17902,7 @@ var VideoGridView = React14__default.memo(({
|
|
|
17658
17902
|
VideoCard,
|
|
17659
17903
|
{
|
|
17660
17904
|
workspace,
|
|
17661
|
-
hlsUrl: getWorkspaceHlsUrl(workspace.workspace_name),
|
|
17905
|
+
hlsUrl: getWorkspaceHlsUrl(workspace.workspace_name, workspace.line_id),
|
|
17662
17906
|
shouldPlay: isVisible,
|
|
17663
17907
|
onClick: () => handleWorkspaceClick(workspace),
|
|
17664
17908
|
onFatalError: throttledReloadDashboard,
|
|
@@ -21302,6 +21546,14 @@ function parseS3Uri(s3Uri) {
|
|
|
21302
21546
|
severity = "high";
|
|
21303
21547
|
description = "Worst Cycle Time Performance";
|
|
21304
21548
|
break;
|
|
21549
|
+
case "cycle_completions":
|
|
21550
|
+
case "cycle_completion":
|
|
21551
|
+
case "completed_cycles":
|
|
21552
|
+
case "completed_cycle":
|
|
21553
|
+
type = "cycle_completions";
|
|
21554
|
+
severity = "low";
|
|
21555
|
+
description = "Cycle Completion";
|
|
21556
|
+
break;
|
|
21305
21557
|
case "medium_bottleneck":
|
|
21306
21558
|
severity = "medium";
|
|
21307
21559
|
description = "Medium Bottleneck Identified";
|
|
@@ -21328,6 +21580,10 @@ function parseS3Uri(s3Uri) {
|
|
|
21328
21580
|
type = "bottleneck";
|
|
21329
21581
|
severity = "high";
|
|
21330
21582
|
description = "Long Cycle Time Detected";
|
|
21583
|
+
} else if (normalizedViolationType.includes("cycle") && (normalizedViolationType.includes("completion") || normalizedViolationType.includes("complete"))) {
|
|
21584
|
+
type = "cycle_completions";
|
|
21585
|
+
severity = "low";
|
|
21586
|
+
description = "Cycle Completion";
|
|
21331
21587
|
} else {
|
|
21332
21588
|
description = `Clip type: ${violationType.replace(/_/g, " ")}`;
|
|
21333
21589
|
console.log(`Detected unknown violation type: ${violationType} in URI: ${s3Uri}`);
|
|
@@ -21507,7 +21763,7 @@ var S3ClipsService = class {
|
|
|
21507
21763
|
}
|
|
21508
21764
|
let cycleTimeSeconds = null;
|
|
21509
21765
|
let creationTimestamp = void 0;
|
|
21510
|
-
if (includeMetadata || includeCycleTime && (parsedInfo.type === "bottleneck" && parsedInfo.description.toLowerCase().includes("cycle time") || parsedInfo.type === "best_cycle_time" || parsedInfo.type === "worst_cycle_time")) {
|
|
21766
|
+
if (includeMetadata || includeCycleTime && (parsedInfo.type === "bottleneck" && parsedInfo.description.toLowerCase().includes("cycle time") || parsedInfo.type === "best_cycle_time" || parsedInfo.type === "worst_cycle_time" || parsedInfo.type === "cycle_completions")) {
|
|
21511
21767
|
const metadata = await this.getFullMetadata(uri);
|
|
21512
21768
|
if (metadata) {
|
|
21513
21769
|
if (metadata.original_task_metadata?.cycle_time) {
|
|
@@ -21540,6 +21796,7 @@ var S3ClipsService = class {
|
|
|
21540
21796
|
low_value: 0,
|
|
21541
21797
|
long_cycle_time: 0,
|
|
21542
21798
|
missing_quality_check: 0,
|
|
21799
|
+
cycle_completions: 0,
|
|
21543
21800
|
total: 0
|
|
21544
21801
|
};
|
|
21545
21802
|
const samples = {
|
|
@@ -21548,7 +21805,8 @@ var S3ClipsService = class {
|
|
|
21548
21805
|
bottleneck: null,
|
|
21549
21806
|
low_value: null,
|
|
21550
21807
|
long_cycle_time: null,
|
|
21551
|
-
missing_quality_check: null
|
|
21808
|
+
missing_quality_check: null,
|
|
21809
|
+
cycle_completions: null
|
|
21552
21810
|
};
|
|
21553
21811
|
for (const uri of s3Uris) {
|
|
21554
21812
|
const parsedInfo = parseS3Uri(uri);
|
|
@@ -21836,6 +22094,7 @@ var BottlenecksContent = ({
|
|
|
21836
22094
|
const firstBestCycle = videos.find((v) => v.type === "best_cycle_time");
|
|
21837
22095
|
const firstWorstCycle = videos.find((v) => v.type === "worst_cycle_time");
|
|
21838
22096
|
const firstSOPDeviation = videos.find((v) => v.type === "missing_quality_check");
|
|
22097
|
+
const firstCycleCompletion = videos.find((v) => v.type === "cycle_completions");
|
|
21839
22098
|
preloadVideosUrl2([
|
|
21840
22099
|
firstHigh?.src,
|
|
21841
22100
|
firstMed?.src,
|
|
@@ -21843,7 +22102,8 @@ var BottlenecksContent = ({
|
|
|
21843
22102
|
firstLowValue?.src,
|
|
21844
22103
|
firstBestCycle?.src,
|
|
21845
22104
|
firstWorstCycle?.src,
|
|
21846
|
-
firstSOPDeviation?.src
|
|
22105
|
+
firstSOPDeviation?.src,
|
|
22106
|
+
firstCycleCompletion?.src
|
|
21847
22107
|
].filter(Boolean));
|
|
21848
22108
|
}
|
|
21849
22109
|
setAllVideos(videos);
|
|
@@ -21867,6 +22127,7 @@ var BottlenecksContent = ({
|
|
|
21867
22127
|
if (activeFilter === "sop_deviations") return video.type === "missing_quality_check";
|
|
21868
22128
|
if (activeFilter === "best_cycle_time") return video.type === "best_cycle_time";
|
|
21869
22129
|
if (activeFilter === "worst_cycle_time") return video.type === "worst_cycle_time";
|
|
22130
|
+
if (activeFilter === "cycle_completions") return video.type === "cycle_completions";
|
|
21870
22131
|
if (activeFilter === "long_cycle_time") {
|
|
21871
22132
|
return video.type === "bottleneck" && video.description.toLowerCase().includes("cycle time");
|
|
21872
22133
|
}
|
|
@@ -21889,6 +22150,8 @@ var BottlenecksContent = ({
|
|
|
21889
22150
|
filtered = allVideos.filter((video) => video.type === "best_cycle_time");
|
|
21890
22151
|
} else if (activeFilter === "worst_cycle_time") {
|
|
21891
22152
|
filtered = allVideos.filter((video) => video.type === "worst_cycle_time");
|
|
22153
|
+
} else if (activeFilter === "cycle_completions") {
|
|
22154
|
+
filtered = allVideos.filter((video) => video.type === "cycle_completions");
|
|
21892
22155
|
} else if (activeFilter === "long_cycle_time") {
|
|
21893
22156
|
filtered = allVideos.filter(
|
|
21894
22157
|
(video) => video.type === "bottleneck" && video.description.toLowerCase().includes("cycle time")
|
|
@@ -22183,6 +22446,7 @@ var BottlenecksContent = ({
|
|
|
22183
22446
|
bestCycleTimes: 0,
|
|
22184
22447
|
worstCycleTimes: 0,
|
|
22185
22448
|
longCycleTimes: 0,
|
|
22449
|
+
cycleCompletions: 0,
|
|
22186
22450
|
total: 0
|
|
22187
22451
|
};
|
|
22188
22452
|
return {
|
|
@@ -22197,6 +22461,7 @@ var BottlenecksContent = ({
|
|
|
22197
22461
|
longCycleTimes: allVideos.filter(
|
|
22198
22462
|
(video) => video.type === "bottleneck" && video.description.toLowerCase().includes("cycle time")
|
|
22199
22463
|
).length,
|
|
22464
|
+
cycleCompletions: allVideos.filter((video) => video.type === "cycle_completions").length,
|
|
22200
22465
|
total: allVideos.length
|
|
22201
22466
|
};
|
|
22202
22467
|
}, [allVideos]);
|
|
@@ -22217,6 +22482,8 @@ var BottlenecksContent = ({
|
|
|
22217
22482
|
return "Best Cycle Time";
|
|
22218
22483
|
case "worst_cycle_time":
|
|
22219
22484
|
return "Worst Cycle Time";
|
|
22485
|
+
case "cycle_completions":
|
|
22486
|
+
return "Cycle Completion";
|
|
22220
22487
|
case "bottleneck":
|
|
22221
22488
|
default:
|
|
22222
22489
|
return "Bottleneck";
|
|
@@ -22252,7 +22519,7 @@ var BottlenecksContent = ({
|
|
|
22252
22519
|
] });
|
|
22253
22520
|
}
|
|
22254
22521
|
return /* @__PURE__ */ jsxs("div", { className: "flex-grow p-1.5 sm:p-2 lg:p-4 h-[calc(100vh-12rem)]", children: [
|
|
22255
|
-
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-
|
|
22522
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-5 gap-3 mb-4", children: [
|
|
22256
22523
|
/* @__PURE__ */ jsxs(
|
|
22257
22524
|
Card2,
|
|
22258
22525
|
{
|
|
@@ -22372,11 +22639,41 @@ var BottlenecksContent = ({
|
|
|
22372
22639
|
] }) })
|
|
22373
22640
|
]
|
|
22374
22641
|
}
|
|
22642
|
+
),
|
|
22643
|
+
/* @__PURE__ */ jsxs(
|
|
22644
|
+
Card2,
|
|
22645
|
+
{
|
|
22646
|
+
onClick: () => {
|
|
22647
|
+
setActiveFilter("cycle_completions");
|
|
22648
|
+
trackCoreEvent("Cycle Completions Filter Clicked", {
|
|
22649
|
+
workspaceId,
|
|
22650
|
+
workspaceName,
|
|
22651
|
+
date,
|
|
22652
|
+
filterType: "cycle_completions",
|
|
22653
|
+
clipCount: clipCounts.cycleCompletions
|
|
22654
|
+
});
|
|
22655
|
+
},
|
|
22656
|
+
className: `bg-white shadow-sm cursor-pointer transition-all duration-200 hover:bg-gray-50 ${activeFilter === "cycle_completions" ? "bg-blue-50 shadow-md ring-1 ring-blue-200" : ""}`,
|
|
22657
|
+
"aria-label": `Filter by Cycle Completions (${clipCounts.cycleCompletions} clips)`,
|
|
22658
|
+
role: "button",
|
|
22659
|
+
tabIndex: 0,
|
|
22660
|
+
onKeyDown: (e) => e.key === "Enter" && setActiveFilter("cycle_completions"),
|
|
22661
|
+
children: [
|
|
22662
|
+
/* @__PURE__ */ jsx(CardHeader2, { className: "pb-2", children: /* @__PURE__ */ jsx(CardTitle2, { className: `text-lg ${activeFilter === "cycle_completions" ? "text-blue-600" : ""}`, children: "Cycle Completions" }) }),
|
|
22663
|
+
/* @__PURE__ */ jsx(CardContent2, { children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col justify-center", children: [
|
|
22664
|
+
/* @__PURE__ */ jsx("p", { className: "text-3xl font-bold text-blue-600", children: clipCounts.cycleCompletions }),
|
|
22665
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center text-sm text-gray-500 mt-1", children: [
|
|
22666
|
+
/* @__PURE__ */ jsx("div", { className: "h-2 w-2 rounded-full bg-blue-600 mr-1.5" }),
|
|
22667
|
+
/* @__PURE__ */ jsx("span", { children: "Completed production cycles" })
|
|
22668
|
+
] })
|
|
22669
|
+
] }) })
|
|
22670
|
+
]
|
|
22671
|
+
}
|
|
22375
22672
|
)
|
|
22376
22673
|
] }),
|
|
22377
22674
|
/* @__PURE__ */ jsxs("div", { className: "bg-white rounded-lg shadow-sm overflow-hidden", style: { height: "calc(100% - 8.5rem)" }, children: [
|
|
22378
22675
|
/* @__PURE__ */ jsx("div", { className: "px-4 py-3 border-b border-gray-100", children: /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center", children: [
|
|
22379
|
-
/* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold text-gray-800", children: activeFilter === "low_value" ? `Idle Moments (${clipCounts.lowValue})` : activeFilter === "best_cycle_time" ? `Best Cycle Time (${clipCounts.bestCycleTimes})` : activeFilter === "worst_cycle_time" ? `Worst Cycle Time (${clipCounts.worstCycleTimes})` : activeFilter === "long_cycle_time" ? `Long Cycle Time (${clipCounts.longCycleTimes})` : `All Clips (${clipCounts.total})` }),
|
|
22676
|
+
/* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold text-gray-800", children: activeFilter === "low_value" ? `Idle Moments (${clipCounts.lowValue})` : activeFilter === "best_cycle_time" ? `Best Cycle Time (${clipCounts.bestCycleTimes})` : activeFilter === "worst_cycle_time" ? `Worst Cycle Time (${clipCounts.worstCycleTimes})` : activeFilter === "long_cycle_time" ? `Long Cycle Time (${clipCounts.longCycleTimes})` : activeFilter === "cycle_completions" ? `Cycle Completions (${clipCounts.cycleCompletions})` : `All Clips (${clipCounts.total})` }),
|
|
22380
22677
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center space-x-2", children: [
|
|
22381
22678
|
/* @__PURE__ */ jsxs("div", { className: "relative", ref: timestampFilterRef, children: [
|
|
22382
22679
|
/* @__PURE__ */ jsx(
|
|
@@ -22531,9 +22828,9 @@ var BottlenecksContent = ({
|
|
|
22531
22828
|
}
|
|
22532
22829
|
)
|
|
22533
22830
|
] }) }),
|
|
22534
|
-
(currentVideo.type === "best_cycle_time" || currentVideo.type === "worst_cycle_time" || currentVideo.type === "bottleneck" && currentVideo.description.toLowerCase().includes("cycle time")) && currentVideo.cycle_time_seconds || currentVideo.type === "low_value" ? /* @__PURE__ */ jsx("div", { className: "absolute top-3 left-3 z-10 bg-black/60 backdrop-blur-sm px-3 py-1.5 rounded-lg text-white shadow-lg text-xs", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
|
|
22535
|
-
/* @__PURE__ */ jsx("div", { className: `flex-shrink-0 h-2.5 w-2.5 rounded-full ${currentVideo.type === "low_value" ? "bg-purple-400" : currentVideo.type === "best_cycle_time" ? "bg-green-600" : currentVideo.type === "worst_cycle_time" ? "bg-red-700" : "bg-red-500"} mr-2 animate-pulse` }),
|
|
22536
|
-
(currentVideo.type === "best_cycle_time" || currentVideo.type === "worst_cycle_time" || currentVideo.type === "bottleneck" && currentVideo.description.toLowerCase().includes("cycle time")) && currentVideo.cycle_time_seconds ? /* @__PURE__ */ jsxs("span", { className: "opacity-90 font-mono bg-black/30 px-2 py-0.5 rounded", children: [
|
|
22831
|
+
(currentVideo.type === "best_cycle_time" || currentVideo.type === "worst_cycle_time" || currentVideo.type === "cycle_completions" || currentVideo.type === "bottleneck" && currentVideo.description.toLowerCase().includes("cycle time")) && currentVideo.cycle_time_seconds || currentVideo.type === "low_value" ? /* @__PURE__ */ jsx("div", { className: "absolute top-3 left-3 z-10 bg-black/60 backdrop-blur-sm px-3 py-1.5 rounded-lg text-white shadow-lg text-xs", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
|
|
22832
|
+
/* @__PURE__ */ jsx("div", { className: `flex-shrink-0 h-2.5 w-2.5 rounded-full ${currentVideo.type === "low_value" ? "bg-purple-400" : currentVideo.type === "best_cycle_time" ? "bg-green-600" : currentVideo.type === "worst_cycle_time" ? "bg-red-700" : currentVideo.type === "cycle_completions" ? "bg-blue-600" : "bg-red-500"} mr-2 animate-pulse` }),
|
|
22833
|
+
(currentVideo.type === "best_cycle_time" || currentVideo.type === "worst_cycle_time" || currentVideo.type === "cycle_completions" || currentVideo.type === "bottleneck" && currentVideo.description.toLowerCase().includes("cycle time")) && currentVideo.cycle_time_seconds ? /* @__PURE__ */ jsxs("span", { className: "opacity-90 font-mono bg-black/30 px-2 py-0.5 rounded", children: [
|
|
22537
22834
|
"Cycle time: ",
|
|
22538
22835
|
(currentVideo.cycle_time_seconds / 20).toFixed(1),
|
|
22539
22836
|
"s"
|
|
@@ -22615,9 +22912,9 @@ var BottlenecksContent = ({
|
|
|
22615
22912
|
children: /* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", className: "h-6 w-6", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) })
|
|
22616
22913
|
}
|
|
22617
22914
|
),
|
|
22618
|
-
(currentVideo.type === "best_cycle_time" || currentVideo.type === "worst_cycle_time" || currentVideo.type === "bottleneck" && currentVideo.description.toLowerCase().includes("cycle time")) && currentVideo.cycle_time_seconds || currentVideo.type === "low_value" ? /* @__PURE__ */ jsx("div", { className: "absolute top-4 left-4 z-[101] bg-black/60 backdrop-blur-sm px-4 py-2 rounded-lg text-white shadow-lg text-sm", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
|
|
22619
|
-
/* @__PURE__ */ jsx("div", { className: `flex-shrink-0 h-2.5 w-2.5 rounded-full ${currentVideo.type === "low_value" ? "bg-purple-400" : currentVideo.type === "best_cycle_time" ? "bg-green-600" : currentVideo.type === "worst_cycle_time" ? "bg-red-700" : "bg-red-500"} mr-2` }),
|
|
22620
|
-
(currentVideo.type === "best_cycle_time" || currentVideo.type === "worst_cycle_time" || currentVideo.type === "bottleneck" && currentVideo.description.toLowerCase().includes("cycle time")) && currentVideo.cycle_time_seconds ? /* @__PURE__ */ jsxs("span", { className: "opacity-90 font-mono bg-black/30 px-2 py-1 rounded", children: [
|
|
22915
|
+
(currentVideo.type === "best_cycle_time" || currentVideo.type === "worst_cycle_time" || currentVideo.type === "cycle_completions" || currentVideo.type === "bottleneck" && currentVideo.description.toLowerCase().includes("cycle time")) && currentVideo.cycle_time_seconds || currentVideo.type === "low_value" ? /* @__PURE__ */ jsx("div", { className: "absolute top-4 left-4 z-[101] bg-black/60 backdrop-blur-sm px-4 py-2 rounded-lg text-white shadow-lg text-sm", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
|
|
22916
|
+
/* @__PURE__ */ jsx("div", { className: `flex-shrink-0 h-2.5 w-2.5 rounded-full ${currentVideo.type === "low_value" ? "bg-purple-400" : currentVideo.type === "best_cycle_time" ? "bg-green-600" : currentVideo.type === "worst_cycle_time" ? "bg-red-700" : currentVideo.type === "cycle_completions" ? "bg-blue-600" : "bg-red-500"} mr-2` }),
|
|
22917
|
+
(currentVideo.type === "best_cycle_time" || currentVideo.type === "worst_cycle_time" || currentVideo.type === "cycle_completions" || currentVideo.type === "bottleneck" && currentVideo.description.toLowerCase().includes("cycle time")) && currentVideo.cycle_time_seconds ? /* @__PURE__ */ jsxs("span", { className: "opacity-90 font-mono bg-black/30 px-2 py-1 rounded", children: [
|
|
22621
22918
|
"Cycle time: ",
|
|
22622
22919
|
(currentVideo.cycle_time_seconds / 20).toFixed(1),
|
|
22623
22920
|
"s"
|
|
@@ -24427,6 +24724,7 @@ var AIAgentView = () => {
|
|
|
24427
24724
|
const entityConfig = useEntityConfig();
|
|
24428
24725
|
const dateTimeConfig = useDateTimeConfig();
|
|
24429
24726
|
const shiftConfig = useShiftConfig();
|
|
24727
|
+
const { formatNumber } = useFormatNumber();
|
|
24430
24728
|
const [inputValue, setInputValue] = useState("");
|
|
24431
24729
|
const [loadingThreads, setLoadingThreads] = useState(/* @__PURE__ */ new Set());
|
|
24432
24730
|
const [lastError, setLastError] = useState(null);
|
|
@@ -25253,71 +25551,184 @@ var AIAgentView = () => {
|
|
|
25253
25551
|
};
|
|
25254
25552
|
const renderChart = (chartType, args, key) => {
|
|
25255
25553
|
console.log(`[DEBUG] Attempting to render chart type: ${chartType}`, args);
|
|
25554
|
+
const CHART_COLORS = {
|
|
25555
|
+
primary: "#3b82f6",
|
|
25556
|
+
// blue-500
|
|
25557
|
+
secondary: "#10b981",
|
|
25558
|
+
// green-500
|
|
25559
|
+
accent: "#f59e0b",
|
|
25560
|
+
// amber-500
|
|
25561
|
+
danger: "#ef4444",
|
|
25562
|
+
// red-500
|
|
25563
|
+
violet: "#8b5cf6",
|
|
25564
|
+
// violet-500
|
|
25565
|
+
cyan: "#06b6d4",
|
|
25566
|
+
// cyan-500
|
|
25567
|
+
orange: "#f97316",
|
|
25568
|
+
// orange-500
|
|
25569
|
+
indigo: "#6366f1"
|
|
25570
|
+
// indigo-500
|
|
25571
|
+
};
|
|
25572
|
+
const CHART_COLOR_PALETTE = Object.values(CHART_COLORS);
|
|
25573
|
+
const CHART_STYLES = {
|
|
25574
|
+
grid: {
|
|
25575
|
+
strokeDasharray: "3 3",
|
|
25576
|
+
stroke: "#e5e7eb"
|
|
25577
|
+
// gray-300
|
|
25578
|
+
},
|
|
25579
|
+
axis: {
|
|
25580
|
+
tick: { fontSize: 12, fill: "#4b5563" },
|
|
25581
|
+
// gray-600
|
|
25582
|
+
stroke: "#9ca3af"
|
|
25583
|
+
// gray-400
|
|
25584
|
+
},
|
|
25585
|
+
margin: { top: 10, right: 30, left: 20, bottom: 40 },
|
|
25586
|
+
barRadius: [4, 4, 0, 0]
|
|
25587
|
+
// Top corners rounded
|
|
25588
|
+
};
|
|
25589
|
+
const CustomTooltip = ({ active, payload, label }) => {
|
|
25590
|
+
if (active && payload && payload.length) {
|
|
25591
|
+
return /* @__PURE__ */ jsxs("div", { className: "bg-white px-4 py-3 shadow-lg rounded-lg border border-gray-200", children: [
|
|
25592
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm font-medium text-gray-900 mb-1", children: label }),
|
|
25593
|
+
payload.map((entry, index) => /* @__PURE__ */ jsxs("p", { className: "text-sm text-gray-600", style: { color: entry.color }, children: [
|
|
25594
|
+
entry.name,
|
|
25595
|
+
": ",
|
|
25596
|
+
typeof entry.value === "number" ? formatNumber(entry.value) : entry.value,
|
|
25597
|
+
args.unit || ""
|
|
25598
|
+
] }, index))
|
|
25599
|
+
] });
|
|
25600
|
+
}
|
|
25601
|
+
return null;
|
|
25602
|
+
};
|
|
25603
|
+
const DualAxisTooltip = ({ active, payload, label }) => {
|
|
25604
|
+
if (active && payload && payload.length) {
|
|
25605
|
+
return /* @__PURE__ */ jsxs("div", { className: "bg-white px-4 py-3 shadow-lg rounded-lg border border-gray-200", children: [
|
|
25606
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm font-medium text-gray-900 mb-2", children: label }),
|
|
25607
|
+
/* @__PURE__ */ jsx("div", { className: "space-y-1", children: payload.map((entry, index) => {
|
|
25608
|
+
const value = typeof entry.value === "number" ? formatNumber(entry.value) : entry.value;
|
|
25609
|
+
const unit = entry.dataKey === args.left_y_field ? args.left_unit || "" : entry.dataKey === args.right_y_field ? args.right_unit || "" : "";
|
|
25610
|
+
return /* @__PURE__ */ jsxs("p", { className: "text-sm", style: { color: entry.color }, children: [
|
|
25611
|
+
/* @__PURE__ */ jsxs("span", { className: "font-medium", children: [
|
|
25612
|
+
entry.name,
|
|
25613
|
+
":"
|
|
25614
|
+
] }),
|
|
25615
|
+
" ",
|
|
25616
|
+
value,
|
|
25617
|
+
unit
|
|
25618
|
+
] }, index);
|
|
25619
|
+
}) })
|
|
25620
|
+
] });
|
|
25621
|
+
}
|
|
25622
|
+
return null;
|
|
25623
|
+
};
|
|
25624
|
+
const formatXAxisTick = (value) => {
|
|
25625
|
+
if (typeof value === "string") {
|
|
25626
|
+
if (value.match(/^\d{2}\/\d{2}\s/)) {
|
|
25627
|
+
return value;
|
|
25628
|
+
}
|
|
25629
|
+
if (value.length > 15) {
|
|
25630
|
+
return value.substring(0, 12) + "...";
|
|
25631
|
+
}
|
|
25632
|
+
}
|
|
25633
|
+
return value;
|
|
25634
|
+
};
|
|
25635
|
+
const ChartWrapper = ({ children, title }) => /* @__PURE__ */ jsxs("div", { className: "my-6 bg-white rounded-xl shadow-sm border border-gray-200 p-6", children: [
|
|
25636
|
+
title && /* @__PURE__ */ jsx("h3", { className: "text-base font-semibold text-gray-900 mb-4", children: title }),
|
|
25637
|
+
children
|
|
25638
|
+
] });
|
|
25256
25639
|
switch (chartType) {
|
|
25257
25640
|
case "create_gauge_chart":
|
|
25258
25641
|
console.log("[DEBUG] Rendering gauge chart");
|
|
25259
|
-
return /* @__PURE__ */ jsx("div", { className: "
|
|
25642
|
+
return /* @__PURE__ */ jsx(ChartWrapper, { title: args.title, children: /* @__PURE__ */ jsx("div", { className: "h-64 w-full flex justify-center", children: /* @__PURE__ */ jsx(
|
|
25260
25643
|
GaugeChart,
|
|
25261
25644
|
{
|
|
25262
25645
|
value: args.value || 0,
|
|
25263
25646
|
min: args.min_value || 0,
|
|
25264
25647
|
max: args.max_value || 100,
|
|
25265
25648
|
target: args.target,
|
|
25266
|
-
label: args.
|
|
25649
|
+
label: args.label || "",
|
|
25267
25650
|
unit: args.unit || "",
|
|
25268
25651
|
thresholds: args.thresholds,
|
|
25269
25652
|
className: "w-full max-w-sm"
|
|
25270
25653
|
}
|
|
25271
|
-
) }, `gauge-${key}`);
|
|
25654
|
+
) }) }, `gauge-${key}`);
|
|
25272
25655
|
case "create_bar_chart":
|
|
25273
25656
|
console.log("[DEBUG] Rendering bar chart");
|
|
25274
25657
|
if (!args.data || !args.x_field || !args.y_field) {
|
|
25275
25658
|
console.error("Bar chart missing required parameters:", { data: !!args.data, x_field: !!args.x_field, y_field: !!args.y_field });
|
|
25276
25659
|
return null;
|
|
25277
25660
|
}
|
|
25278
|
-
return /* @__PURE__ */
|
|
25661
|
+
return /* @__PURE__ */ jsx(ChartWrapper, { title: args.title, children: /* @__PURE__ */ jsx("div", { className: "w-full h-64", children: /* @__PURE__ */ jsx(ResponsiveContainer, { width: "100%", height: "100%", children: /* @__PURE__ */ jsxs(BarChart$1, { data: args.data, margin: CHART_STYLES.margin, children: [
|
|
25662
|
+
/* @__PURE__ */ jsx(CartesianGrid, { ...CHART_STYLES.grid }),
|
|
25279
25663
|
/* @__PURE__ */ jsx(
|
|
25280
|
-
|
|
25664
|
+
XAxis,
|
|
25665
|
+
{
|
|
25666
|
+
dataKey: args.x_field,
|
|
25667
|
+
...CHART_STYLES.axis,
|
|
25668
|
+
angle: -45,
|
|
25669
|
+
textAnchor: "end",
|
|
25670
|
+
height: 60,
|
|
25671
|
+
interval: 0,
|
|
25672
|
+
tickFormatter: formatXAxisTick
|
|
25673
|
+
}
|
|
25674
|
+
),
|
|
25675
|
+
/* @__PURE__ */ jsx(
|
|
25676
|
+
YAxis,
|
|
25281
25677
|
{
|
|
25282
|
-
|
|
25283
|
-
|
|
25284
|
-
dataKey: args.y_field,
|
|
25285
|
-
fill: args.color || "#3b82f6",
|
|
25286
|
-
labelList: args.show_values
|
|
25287
|
-
}],
|
|
25288
|
-
xAxisDataKey: args.x_field,
|
|
25289
|
-
className: "h-64",
|
|
25290
|
-
showLegend: false
|
|
25678
|
+
...CHART_STYLES.axis,
|
|
25679
|
+
tickFormatter: (value) => formatNumber(value)
|
|
25291
25680
|
}
|
|
25292
25681
|
),
|
|
25293
|
-
|
|
25294
|
-
|
|
25682
|
+
/* @__PURE__ */ jsx(Tooltip, { content: /* @__PURE__ */ jsx(CustomTooltip, {}), cursor: { fill: "rgba(0, 0, 0, 0.05)" } }),
|
|
25683
|
+
/* @__PURE__ */ jsx(
|
|
25684
|
+
Bar,
|
|
25685
|
+
{
|
|
25686
|
+
dataKey: args.y_field,
|
|
25687
|
+
fill: args.color || CHART_COLORS.primary,
|
|
25688
|
+
radius: CHART_STYLES.barRadius
|
|
25689
|
+
}
|
|
25690
|
+
)
|
|
25691
|
+
] }) }) }) }, `bar-${key}`);
|
|
25295
25692
|
case "create_line_chart":
|
|
25296
25693
|
console.log("[DEBUG] Rendering line chart");
|
|
25297
25694
|
if (!args.data || !args.x_field || !args.y_field) {
|
|
25298
25695
|
console.error("Line chart missing required parameters:", { data: !!args.data, x_field: !!args.x_field, y_field: !!args.y_field });
|
|
25299
25696
|
return null;
|
|
25300
25697
|
}
|
|
25301
|
-
return /* @__PURE__ */
|
|
25302
|
-
|
|
25303
|
-
width: args.width || "100%"
|
|
25304
|
-
}, children: [
|
|
25698
|
+
return /* @__PURE__ */ jsx(ChartWrapper, { title: args.title, children: /* @__PURE__ */ jsx("div", { className: "w-full h-64", children: /* @__PURE__ */ jsx(ResponsiveContainer, { width: "100%", height: "100%", children: /* @__PURE__ */ jsxs(LineChart$1, { data: args.data, margin: CHART_STYLES.margin, children: [
|
|
25699
|
+
/* @__PURE__ */ jsx(CartesianGrid, { ...CHART_STYLES.grid }),
|
|
25305
25700
|
/* @__PURE__ */ jsx(
|
|
25306
|
-
|
|
25701
|
+
XAxis,
|
|
25307
25702
|
{
|
|
25308
|
-
|
|
25309
|
-
|
|
25310
|
-
|
|
25311
|
-
|
|
25312
|
-
|
|
25313
|
-
|
|
25314
|
-
|
|
25315
|
-
className: "h-full",
|
|
25316
|
-
showLegend: false
|
|
25703
|
+
dataKey: args.x_field,
|
|
25704
|
+
...CHART_STYLES.axis,
|
|
25705
|
+
angle: -45,
|
|
25706
|
+
textAnchor: "end",
|
|
25707
|
+
height: 60,
|
|
25708
|
+
interval: 0,
|
|
25709
|
+
tickFormatter: formatXAxisTick
|
|
25317
25710
|
}
|
|
25318
25711
|
),
|
|
25319
|
-
|
|
25320
|
-
|
|
25712
|
+
/* @__PURE__ */ jsx(
|
|
25713
|
+
YAxis,
|
|
25714
|
+
{
|
|
25715
|
+
...CHART_STYLES.axis,
|
|
25716
|
+
tickFormatter: (value) => formatNumber(value)
|
|
25717
|
+
}
|
|
25718
|
+
),
|
|
25719
|
+
/* @__PURE__ */ jsx(Tooltip, { content: /* @__PURE__ */ jsx(CustomTooltip, {}), cursor: { strokeDasharray: "3 3" } }),
|
|
25720
|
+
/* @__PURE__ */ jsx(
|
|
25721
|
+
Line,
|
|
25722
|
+
{
|
|
25723
|
+
type: "monotone",
|
|
25724
|
+
dataKey: args.y_field,
|
|
25725
|
+
stroke: CHART_COLORS.primary,
|
|
25726
|
+
strokeWidth: 2,
|
|
25727
|
+
dot: { r: 4, fill: CHART_COLORS.primary },
|
|
25728
|
+
activeDot: { r: 6 }
|
|
25729
|
+
}
|
|
25730
|
+
)
|
|
25731
|
+
] }) }) }) }, `line-${key}`);
|
|
25321
25732
|
case "create_pie_chart":
|
|
25322
25733
|
console.log("[DEBUG] Rendering pie chart");
|
|
25323
25734
|
if (!args.data || !args.label_field || !args.value_field) {
|
|
@@ -25330,16 +25741,14 @@ var AIAgentView = () => {
|
|
|
25330
25741
|
value: item[args.value_field]
|
|
25331
25742
|
}));
|
|
25332
25743
|
console.log("[DEBUG] Pie chart data transformed:", pieData);
|
|
25333
|
-
return /* @__PURE__ */
|
|
25334
|
-
|
|
25335
|
-
|
|
25336
|
-
|
|
25337
|
-
|
|
25338
|
-
|
|
25339
|
-
|
|
25340
|
-
|
|
25341
|
-
) })
|
|
25342
|
-
] }, `pie-${key}`);
|
|
25744
|
+
return /* @__PURE__ */ jsx(ChartWrapper, { title: args.title, children: /* @__PURE__ */ jsx("div", { className: "h-64 w-full max-w-md mx-auto", children: /* @__PURE__ */ jsx(
|
|
25745
|
+
PieChart4,
|
|
25746
|
+
{
|
|
25747
|
+
data: pieData,
|
|
25748
|
+
showPercentages: args.show_percentages || false,
|
|
25749
|
+
colors: CHART_COLOR_PALETTE
|
|
25750
|
+
}
|
|
25751
|
+
) }) }, `pie-${key}`);
|
|
25343
25752
|
case "create_comparison_table":
|
|
25344
25753
|
console.log("[DEBUG] Rendering comparison table");
|
|
25345
25754
|
if (!args.data) {
|
|
@@ -25356,27 +25765,24 @@ var AIAgentView = () => {
|
|
|
25356
25765
|
return args.sort_descending === false ? comparison : -comparison;
|
|
25357
25766
|
});
|
|
25358
25767
|
}
|
|
25359
|
-
return /* @__PURE__ */
|
|
25360
|
-
|
|
25361
|
-
|
|
25362
|
-
|
|
25363
|
-
"
|
|
25364
|
-
|
|
25365
|
-
|
|
25366
|
-
|
|
25367
|
-
|
|
25368
|
-
|
|
25369
|
-
|
|
25370
|
-
|
|
25371
|
-
"
|
|
25372
|
-
|
|
25373
|
-
|
|
25374
|
-
|
|
25375
|
-
|
|
25376
|
-
|
|
25377
|
-
)) }, rowIdx)) })
|
|
25378
|
-
] })
|
|
25379
|
-
] }, `table-${key}`);
|
|
25768
|
+
return /* @__PURE__ */ jsx(ChartWrapper, { title: args.title, children: /* @__PURE__ */ jsx("div", { className: "overflow-x-auto rounded-lg border border-gray-200", children: /* @__PURE__ */ jsxs("table", { className: "min-w-full divide-y divide-gray-200", children: [
|
|
25769
|
+
/* @__PURE__ */ jsx("thead", { className: "bg-gray-50", children: /* @__PURE__ */ jsx("tr", { children: columns.map((col) => /* @__PURE__ */ jsx(
|
|
25770
|
+
"th",
|
|
25771
|
+
{
|
|
25772
|
+
className: `px-6 py-3 text-left text-xs font-medium text-gray-600 uppercase tracking-wider ${col === args.highlight_column ? "bg-blue-50" : ""}`,
|
|
25773
|
+
children: col
|
|
25774
|
+
},
|
|
25775
|
+
col
|
|
25776
|
+
)) }) }),
|
|
25777
|
+
/* @__PURE__ */ jsx("tbody", { className: "bg-white divide-y divide-gray-200", children: sortedData.map((row, rowIdx) => /* @__PURE__ */ jsx("tr", { className: rowIdx % 2 === 0 ? "bg-white" : "bg-gray-50", children: columns.map((col) => /* @__PURE__ */ jsx(
|
|
25778
|
+
"td",
|
|
25779
|
+
{
|
|
25780
|
+
className: `px-6 py-4 whitespace-nowrap text-sm ${col === args.highlight_column ? "font-medium text-blue-600 bg-blue-50" : "text-gray-900"}`,
|
|
25781
|
+
children: typeof row[col] === "number" ? formatNumber(row[col]) : row[col]
|
|
25782
|
+
},
|
|
25783
|
+
col
|
|
25784
|
+
)) }, rowIdx)) })
|
|
25785
|
+
] }) }) }, `table-${key}`);
|
|
25380
25786
|
case "create_multi_line_chart":
|
|
25381
25787
|
console.log("[DEBUG] Rendering multi-line chart");
|
|
25382
25788
|
if (!args.data || !args.x_field || !args.y_fields || !args.legend) {
|
|
@@ -25388,30 +25794,49 @@ var AIAgentView = () => {
|
|
|
25388
25794
|
});
|
|
25389
25795
|
return null;
|
|
25390
25796
|
}
|
|
25391
|
-
|
|
25392
|
-
|
|
25393
|
-
/* @__PURE__ */ jsx(
|
|
25394
|
-
|
|
25395
|
-
|
|
25396
|
-
|
|
25397
|
-
|
|
25398
|
-
|
|
25399
|
-
|
|
25400
|
-
|
|
25401
|
-
|
|
25402
|
-
|
|
25403
|
-
|
|
25404
|
-
|
|
25405
|
-
|
|
25406
|
-
|
|
25407
|
-
|
|
25408
|
-
|
|
25409
|
-
|
|
25410
|
-
|
|
25411
|
-
|
|
25412
|
-
|
|
25413
|
-
|
|
25414
|
-
|
|
25797
|
+
return /* @__PURE__ */ jsx(ChartWrapper, { title: args.title, children: /* @__PURE__ */ jsx("div", { className: "w-full h-80", children: /* @__PURE__ */ jsx(ResponsiveContainer, { width: "100%", height: "100%", children: /* @__PURE__ */ jsxs(LineChart$1, { data: args.data, margin: CHART_STYLES.margin, children: [
|
|
25798
|
+
/* @__PURE__ */ jsx(CartesianGrid, { ...CHART_STYLES.grid }),
|
|
25799
|
+
/* @__PURE__ */ jsx(
|
|
25800
|
+
XAxis,
|
|
25801
|
+
{
|
|
25802
|
+
dataKey: args.x_field,
|
|
25803
|
+
...CHART_STYLES.axis,
|
|
25804
|
+
angle: -45,
|
|
25805
|
+
textAnchor: "end",
|
|
25806
|
+
height: 60,
|
|
25807
|
+
interval: 0,
|
|
25808
|
+
tickFormatter: formatXAxisTick
|
|
25809
|
+
}
|
|
25810
|
+
),
|
|
25811
|
+
/* @__PURE__ */ jsx(
|
|
25812
|
+
YAxis,
|
|
25813
|
+
{
|
|
25814
|
+
...CHART_STYLES.axis,
|
|
25815
|
+
tickFormatter: (value) => formatNumber(value)
|
|
25816
|
+
}
|
|
25817
|
+
),
|
|
25818
|
+
/* @__PURE__ */ jsx(Tooltip, { content: /* @__PURE__ */ jsx(CustomTooltip, {}), cursor: { strokeDasharray: "3 3" } }),
|
|
25819
|
+
/* @__PURE__ */ jsx(
|
|
25820
|
+
Legend,
|
|
25821
|
+
{
|
|
25822
|
+
wrapperStyle: { paddingTop: "20px" },
|
|
25823
|
+
formatter: (value) => /* @__PURE__ */ jsx("span", { className: "text-sm", children: value })
|
|
25824
|
+
}
|
|
25825
|
+
),
|
|
25826
|
+
args.y_fields.map((field, index) => /* @__PURE__ */ jsx(
|
|
25827
|
+
Line,
|
|
25828
|
+
{
|
|
25829
|
+
type: "monotone",
|
|
25830
|
+
dataKey: field,
|
|
25831
|
+
stroke: CHART_COLOR_PALETTE[index % CHART_COLOR_PALETTE.length],
|
|
25832
|
+
strokeWidth: 2,
|
|
25833
|
+
name: args.legend[index] || field,
|
|
25834
|
+
dot: { r: 4 },
|
|
25835
|
+
activeDot: { r: 6 }
|
|
25836
|
+
},
|
|
25837
|
+
field
|
|
25838
|
+
))
|
|
25839
|
+
] }) }) }) }, `multi-line-${key}`);
|
|
25415
25840
|
case "create_stacked_bar_chart":
|
|
25416
25841
|
console.log("[DEBUG] Rendering stacked bar chart");
|
|
25417
25842
|
if (!args.data || !args.x_field || !args.stack_fields) {
|
|
@@ -25422,27 +25847,47 @@ var AIAgentView = () => {
|
|
|
25422
25847
|
});
|
|
25423
25848
|
return null;
|
|
25424
25849
|
}
|
|
25425
|
-
|
|
25426
|
-
|
|
25427
|
-
/* @__PURE__ */ jsx(
|
|
25428
|
-
|
|
25429
|
-
|
|
25430
|
-
|
|
25431
|
-
|
|
25432
|
-
|
|
25433
|
-
|
|
25434
|
-
|
|
25435
|
-
|
|
25436
|
-
|
|
25437
|
-
|
|
25438
|
-
|
|
25439
|
-
|
|
25440
|
-
|
|
25441
|
-
|
|
25442
|
-
|
|
25443
|
-
|
|
25444
|
-
|
|
25445
|
-
|
|
25850
|
+
return /* @__PURE__ */ jsx(ChartWrapper, { title: args.title, children: /* @__PURE__ */ jsx("div", { className: "w-full h-80", children: /* @__PURE__ */ jsx(ResponsiveContainer, { width: "100%", height: "100%", children: /* @__PURE__ */ jsxs(BarChart$1, { data: args.data, margin: CHART_STYLES.margin, children: [
|
|
25851
|
+
/* @__PURE__ */ jsx(CartesianGrid, { ...CHART_STYLES.grid }),
|
|
25852
|
+
/* @__PURE__ */ jsx(
|
|
25853
|
+
XAxis,
|
|
25854
|
+
{
|
|
25855
|
+
dataKey: args.x_field,
|
|
25856
|
+
...CHART_STYLES.axis,
|
|
25857
|
+
angle: -45,
|
|
25858
|
+
textAnchor: "end",
|
|
25859
|
+
height: 60,
|
|
25860
|
+
interval: 0,
|
|
25861
|
+
tickFormatter: formatXAxisTick
|
|
25862
|
+
}
|
|
25863
|
+
),
|
|
25864
|
+
/* @__PURE__ */ jsx(
|
|
25865
|
+
YAxis,
|
|
25866
|
+
{
|
|
25867
|
+
...CHART_STYLES.axis,
|
|
25868
|
+
tickFormatter: (value) => formatNumber(value)
|
|
25869
|
+
}
|
|
25870
|
+
),
|
|
25871
|
+
/* @__PURE__ */ jsx(Tooltip, { content: /* @__PURE__ */ jsx(CustomTooltip, {}), cursor: { fill: "rgba(0, 0, 0, 0.05)" } }),
|
|
25872
|
+
/* @__PURE__ */ jsx(
|
|
25873
|
+
Legend,
|
|
25874
|
+
{
|
|
25875
|
+
wrapperStyle: { paddingTop: "20px" },
|
|
25876
|
+
formatter: (value) => /* @__PURE__ */ jsx("span", { className: "text-sm", children: value })
|
|
25877
|
+
}
|
|
25878
|
+
),
|
|
25879
|
+
args.stack_fields.map((field, index) => /* @__PURE__ */ jsx(
|
|
25880
|
+
Bar,
|
|
25881
|
+
{
|
|
25882
|
+
dataKey: field,
|
|
25883
|
+
stackId: "stack",
|
|
25884
|
+
fill: CHART_COLOR_PALETTE[index % CHART_COLOR_PALETTE.length],
|
|
25885
|
+
name: field,
|
|
25886
|
+
radius: index === args.stack_fields.length - 1 ? CHART_STYLES.barRadius : void 0
|
|
25887
|
+
},
|
|
25888
|
+
field
|
|
25889
|
+
))
|
|
25890
|
+
] }) }) }) }, `stacked-bar-${key}`);
|
|
25446
25891
|
case "create_dual_axis_chart":
|
|
25447
25892
|
console.log("[DEBUG] Rendering dual-axis chart");
|
|
25448
25893
|
if (!args.data || !args.x_field || !args.left_y_field || !args.right_y_field) {
|
|
@@ -25454,19 +25899,82 @@ var AIAgentView = () => {
|
|
|
25454
25899
|
});
|
|
25455
25900
|
return null;
|
|
25456
25901
|
}
|
|
25457
|
-
return /* @__PURE__ */
|
|
25458
|
-
/* @__PURE__ */ jsx(
|
|
25459
|
-
|
|
25460
|
-
|
|
25461
|
-
|
|
25462
|
-
|
|
25463
|
-
|
|
25464
|
-
|
|
25465
|
-
|
|
25466
|
-
|
|
25467
|
-
|
|
25468
|
-
|
|
25469
|
-
|
|
25902
|
+
return /* @__PURE__ */ jsx(ChartWrapper, { title: args.title, children: /* @__PURE__ */ jsx("div", { className: "w-full h-80", children: /* @__PURE__ */ jsx(ResponsiveContainer, { width: "100%", height: "100%", children: /* @__PURE__ */ jsxs(ComposedChart, { data: args.data, margin: { ...CHART_STYLES.margin, bottom: 80 }, children: [
|
|
25903
|
+
/* @__PURE__ */ jsx(CartesianGrid, { ...CHART_STYLES.grid }),
|
|
25904
|
+
/* @__PURE__ */ jsx(
|
|
25905
|
+
XAxis,
|
|
25906
|
+
{
|
|
25907
|
+
dataKey: args.x_field,
|
|
25908
|
+
...CHART_STYLES.axis,
|
|
25909
|
+
angle: -45,
|
|
25910
|
+
textAnchor: "end",
|
|
25911
|
+
height: 100,
|
|
25912
|
+
interval: 0,
|
|
25913
|
+
tickFormatter: formatXAxisTick
|
|
25914
|
+
}
|
|
25915
|
+
),
|
|
25916
|
+
/* @__PURE__ */ jsx(
|
|
25917
|
+
YAxis,
|
|
25918
|
+
{
|
|
25919
|
+
yAxisId: "left",
|
|
25920
|
+
orientation: "left",
|
|
25921
|
+
label: {
|
|
25922
|
+
value: args.left_label || args.left_y_field,
|
|
25923
|
+
angle: -90,
|
|
25924
|
+
position: "insideLeft",
|
|
25925
|
+
style: { textAnchor: "middle", fill: "#4b5563" }
|
|
25926
|
+
},
|
|
25927
|
+
...CHART_STYLES.axis,
|
|
25928
|
+
tickFormatter: (value) => `${formatNumber(value)}${args.left_unit || ""}`
|
|
25929
|
+
}
|
|
25930
|
+
),
|
|
25931
|
+
/* @__PURE__ */ jsx(
|
|
25932
|
+
YAxis,
|
|
25933
|
+
{
|
|
25934
|
+
yAxisId: "right",
|
|
25935
|
+
orientation: "right",
|
|
25936
|
+
label: {
|
|
25937
|
+
value: args.right_label || args.right_y_field,
|
|
25938
|
+
angle: 90,
|
|
25939
|
+
position: "insideRight",
|
|
25940
|
+
style: { textAnchor: "middle", fill: "#4b5563" }
|
|
25941
|
+
},
|
|
25942
|
+
...CHART_STYLES.axis,
|
|
25943
|
+
tickFormatter: (value) => `${formatNumber(value)}${args.right_unit || ""}`
|
|
25944
|
+
}
|
|
25945
|
+
),
|
|
25946
|
+
/* @__PURE__ */ jsx(Tooltip, { content: /* @__PURE__ */ jsx(DualAxisTooltip, {}), cursor: { fill: "rgba(0, 0, 0, 0.05)" } }),
|
|
25947
|
+
/* @__PURE__ */ jsx(
|
|
25948
|
+
Legend,
|
|
25949
|
+
{
|
|
25950
|
+
wrapperStyle: { paddingTop: "20px" },
|
|
25951
|
+
formatter: (value) => /* @__PURE__ */ jsx("span", { className: "text-sm", children: value })
|
|
25952
|
+
}
|
|
25953
|
+
),
|
|
25954
|
+
/* @__PURE__ */ jsx(
|
|
25955
|
+
Bar,
|
|
25956
|
+
{
|
|
25957
|
+
yAxisId: "left",
|
|
25958
|
+
dataKey: args.left_y_field,
|
|
25959
|
+
fill: CHART_COLORS.primary,
|
|
25960
|
+
name: args.left_label || args.left_y_field,
|
|
25961
|
+
radius: CHART_STYLES.barRadius
|
|
25962
|
+
}
|
|
25963
|
+
),
|
|
25964
|
+
/* @__PURE__ */ jsx(
|
|
25965
|
+
Line,
|
|
25966
|
+
{
|
|
25967
|
+
yAxisId: "right",
|
|
25968
|
+
type: "monotone",
|
|
25969
|
+
dataKey: args.right_y_field,
|
|
25970
|
+
stroke: CHART_COLORS.danger,
|
|
25971
|
+
strokeWidth: 3,
|
|
25972
|
+
name: args.right_label || args.right_y_field,
|
|
25973
|
+
dot: { r: 5, fill: CHART_COLORS.danger },
|
|
25974
|
+
activeDot: { r: 7 }
|
|
25975
|
+
}
|
|
25976
|
+
)
|
|
25977
|
+
] }) }) }) }, `dual-axis-${key}`);
|
|
25470
25978
|
case "create_scatter_plot":
|
|
25471
25979
|
console.log("[DEBUG] Rendering scatter plot");
|
|
25472
25980
|
if (!args.data || !args.x_field || !args.y_field || !args.group_field) {
|
|
@@ -25486,26 +25994,50 @@ var AIAgentView = () => {
|
|
|
25486
25994
|
acc[group].push(item);
|
|
25487
25995
|
return acc;
|
|
25488
25996
|
}, {});
|
|
25489
|
-
|
|
25490
|
-
|
|
25491
|
-
/* @__PURE__ */ jsx(
|
|
25492
|
-
|
|
25493
|
-
|
|
25494
|
-
|
|
25495
|
-
|
|
25496
|
-
|
|
25497
|
-
|
|
25498
|
-
|
|
25499
|
-
|
|
25500
|
-
|
|
25501
|
-
|
|
25502
|
-
|
|
25503
|
-
|
|
25504
|
-
|
|
25505
|
-
|
|
25506
|
-
|
|
25507
|
-
|
|
25508
|
-
|
|
25997
|
+
return /* @__PURE__ */ jsx(ChartWrapper, { title: args.title, children: /* @__PURE__ */ jsx("div", { className: "w-full h-80", children: /* @__PURE__ */ jsx(ResponsiveContainer, { width: "100%", height: "100%", children: /* @__PURE__ */ jsxs(ScatterChart, { margin: CHART_STYLES.margin, children: [
|
|
25998
|
+
/* @__PURE__ */ jsx(CartesianGrid, { ...CHART_STYLES.grid }),
|
|
25999
|
+
/* @__PURE__ */ jsx(
|
|
26000
|
+
XAxis,
|
|
26001
|
+
{
|
|
26002
|
+
dataKey: args.x_field,
|
|
26003
|
+
type: "number",
|
|
26004
|
+
name: args.x_field,
|
|
26005
|
+
...CHART_STYLES.axis
|
|
26006
|
+
}
|
|
26007
|
+
),
|
|
26008
|
+
/* @__PURE__ */ jsx(
|
|
26009
|
+
YAxis,
|
|
26010
|
+
{
|
|
26011
|
+
dataKey: args.y_field,
|
|
26012
|
+
type: "number",
|
|
26013
|
+
name: args.y_field,
|
|
26014
|
+
...CHART_STYLES.axis
|
|
26015
|
+
}
|
|
26016
|
+
),
|
|
26017
|
+
/* @__PURE__ */ jsx(
|
|
26018
|
+
Tooltip,
|
|
26019
|
+
{
|
|
26020
|
+
cursor: { strokeDasharray: "3 3" },
|
|
26021
|
+
content: /* @__PURE__ */ jsx(CustomTooltip, {})
|
|
26022
|
+
}
|
|
26023
|
+
),
|
|
26024
|
+
/* @__PURE__ */ jsx(
|
|
26025
|
+
Legend,
|
|
26026
|
+
{
|
|
26027
|
+
wrapperStyle: { paddingTop: "20px" },
|
|
26028
|
+
formatter: (value) => /* @__PURE__ */ jsx("span", { className: "text-sm", children: value })
|
|
26029
|
+
}
|
|
26030
|
+
),
|
|
26031
|
+
Object.entries(groupedData).map(([group, data], index) => /* @__PURE__ */ jsx(
|
|
26032
|
+
Scatter,
|
|
26033
|
+
{
|
|
26034
|
+
name: group,
|
|
26035
|
+
data,
|
|
26036
|
+
fill: CHART_COLOR_PALETTE[index % CHART_COLOR_PALETTE.length]
|
|
26037
|
+
},
|
|
26038
|
+
group
|
|
26039
|
+
))
|
|
26040
|
+
] }) }) }) }, `scatter-${key}`);
|
|
25509
26041
|
case "create_combo_chart":
|
|
25510
26042
|
console.log("[DEBUG] Rendering combo chart");
|
|
25511
26043
|
if (!args.data || !args.x_field || !args.bar_field || !args.line_field) {
|
|
@@ -25517,19 +26049,70 @@ var AIAgentView = () => {
|
|
|
25517
26049
|
});
|
|
25518
26050
|
return null;
|
|
25519
26051
|
}
|
|
25520
|
-
return /* @__PURE__ */
|
|
25521
|
-
/* @__PURE__ */ jsx(
|
|
25522
|
-
|
|
25523
|
-
|
|
25524
|
-
|
|
25525
|
-
|
|
25526
|
-
|
|
25527
|
-
|
|
25528
|
-
|
|
25529
|
-
|
|
25530
|
-
|
|
25531
|
-
|
|
25532
|
-
|
|
26052
|
+
return /* @__PURE__ */ jsx(ChartWrapper, { title: args.title, children: /* @__PURE__ */ jsx("div", { className: "w-full h-80", children: /* @__PURE__ */ jsx(ResponsiveContainer, { width: "100%", height: "100%", children: /* @__PURE__ */ jsxs(ComposedChart, { data: args.data, margin: { ...CHART_STYLES.margin, bottom: 80 }, children: [
|
|
26053
|
+
/* @__PURE__ */ jsx(CartesianGrid, { ...CHART_STYLES.grid }),
|
|
26054
|
+
/* @__PURE__ */ jsx(
|
|
26055
|
+
XAxis,
|
|
26056
|
+
{
|
|
26057
|
+
dataKey: args.x_field,
|
|
26058
|
+
...CHART_STYLES.axis,
|
|
26059
|
+
angle: -45,
|
|
26060
|
+
textAnchor: "end",
|
|
26061
|
+
height: 100,
|
|
26062
|
+
interval: 0,
|
|
26063
|
+
tickFormatter: formatXAxisTick
|
|
26064
|
+
}
|
|
26065
|
+
),
|
|
26066
|
+
/* @__PURE__ */ jsx(
|
|
26067
|
+
YAxis,
|
|
26068
|
+
{
|
|
26069
|
+
yAxisId: "left",
|
|
26070
|
+
orientation: "left",
|
|
26071
|
+
...CHART_STYLES.axis,
|
|
26072
|
+
tickFormatter: (value) => formatNumber(value)
|
|
26073
|
+
}
|
|
26074
|
+
),
|
|
26075
|
+
/* @__PURE__ */ jsx(
|
|
26076
|
+
YAxis,
|
|
26077
|
+
{
|
|
26078
|
+
yAxisId: "right",
|
|
26079
|
+
orientation: "right",
|
|
26080
|
+
...CHART_STYLES.axis,
|
|
26081
|
+
tickFormatter: (value) => formatNumber(value)
|
|
26082
|
+
}
|
|
26083
|
+
),
|
|
26084
|
+
/* @__PURE__ */ jsx(Tooltip, { content: /* @__PURE__ */ jsx(CustomTooltip, {}), cursor: { fill: "rgba(0, 0, 0, 0.05)" } }),
|
|
26085
|
+
/* @__PURE__ */ jsx(
|
|
26086
|
+
Legend,
|
|
26087
|
+
{
|
|
26088
|
+
wrapperStyle: { paddingTop: "20px" },
|
|
26089
|
+
formatter: (value) => /* @__PURE__ */ jsx("span", { className: "text-sm", children: value })
|
|
26090
|
+
}
|
|
26091
|
+
),
|
|
26092
|
+
/* @__PURE__ */ jsx(
|
|
26093
|
+
Bar,
|
|
26094
|
+
{
|
|
26095
|
+
yAxisId: "left",
|
|
26096
|
+
dataKey: args.bar_field,
|
|
26097
|
+
fill: CHART_COLORS.primary,
|
|
26098
|
+
name: args.bar_field,
|
|
26099
|
+
radius: CHART_STYLES.barRadius
|
|
26100
|
+
}
|
|
26101
|
+
),
|
|
26102
|
+
/* @__PURE__ */ jsx(
|
|
26103
|
+
Line,
|
|
26104
|
+
{
|
|
26105
|
+
yAxisId: "right",
|
|
26106
|
+
type: "monotone",
|
|
26107
|
+
dataKey: args.line_field,
|
|
26108
|
+
stroke: CHART_COLORS.danger,
|
|
26109
|
+
strokeWidth: 3,
|
|
26110
|
+
name: args.line_field,
|
|
26111
|
+
dot: { r: 5 },
|
|
26112
|
+
activeDot: { r: 7 }
|
|
26113
|
+
}
|
|
26114
|
+
)
|
|
26115
|
+
] }) }) }) }, `combo-${key}`);
|
|
25533
26116
|
case "create_area_chart":
|
|
25534
26117
|
console.log("[DEBUG] Rendering area chart");
|
|
25535
26118
|
if (!args.data || !args.x_field || !args.y_field) {
|
|
@@ -25540,27 +26123,53 @@ var AIAgentView = () => {
|
|
|
25540
26123
|
});
|
|
25541
26124
|
return null;
|
|
25542
26125
|
}
|
|
25543
|
-
return /* @__PURE__ */
|
|
25544
|
-
/* @__PURE__ */ jsx(
|
|
25545
|
-
/* @__PURE__ */ jsx(
|
|
25546
|
-
/* @__PURE__ */ jsx(
|
|
25547
|
-
/* @__PURE__ */ jsx(YAxis, {}),
|
|
25548
|
-
/* @__PURE__ */ jsx(Tooltip, {}),
|
|
25549
|
-
/* @__PURE__ */ jsx(Legend, {}),
|
|
25550
|
-
/* @__PURE__ */ jsx(
|
|
25551
|
-
Area,
|
|
25552
|
-
{
|
|
25553
|
-
type: "monotone",
|
|
25554
|
-
dataKey: args.y_field,
|
|
25555
|
-
stroke: "#3b82f6",
|
|
25556
|
-
fill: args.fill ? "#3b82f6" : "none",
|
|
25557
|
-
fillOpacity: args.fill ? 0.6 : 0,
|
|
25558
|
-
name: args.y_field
|
|
25559
|
-
}
|
|
25560
|
-
)
|
|
26126
|
+
return /* @__PURE__ */ jsx(ChartWrapper, { title: args.title, children: /* @__PURE__ */ jsx("div", { className: "w-full h-80", children: /* @__PURE__ */ jsx(ResponsiveContainer, { width: "100%", height: "100%", children: /* @__PURE__ */ jsxs(ComposedChart, { data: args.data, margin: { ...CHART_STYLES.margin, bottom: 80 }, children: [
|
|
26127
|
+
/* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs("linearGradient", { id: "colorGradient", x1: "0", y1: "0", x2: "0", y2: "1", children: [
|
|
26128
|
+
/* @__PURE__ */ jsx("stop", { offset: "5%", stopColor: CHART_COLORS.primary, stopOpacity: 0.8 }),
|
|
26129
|
+
/* @__PURE__ */ jsx("stop", { offset: "95%", stopColor: CHART_COLORS.primary, stopOpacity: 0.1 })
|
|
25561
26130
|
] }) }),
|
|
25562
|
-
|
|
25563
|
-
|
|
26131
|
+
/* @__PURE__ */ jsx(CartesianGrid, { ...CHART_STYLES.grid }),
|
|
26132
|
+
/* @__PURE__ */ jsx(
|
|
26133
|
+
XAxis,
|
|
26134
|
+
{
|
|
26135
|
+
dataKey: args.x_field,
|
|
26136
|
+
...CHART_STYLES.axis,
|
|
26137
|
+
angle: -45,
|
|
26138
|
+
textAnchor: "end",
|
|
26139
|
+
height: 100,
|
|
26140
|
+
interval: 0,
|
|
26141
|
+
tickFormatter: formatXAxisTick
|
|
26142
|
+
}
|
|
26143
|
+
),
|
|
26144
|
+
/* @__PURE__ */ jsx(
|
|
26145
|
+
YAxis,
|
|
26146
|
+
{
|
|
26147
|
+
...CHART_STYLES.axis,
|
|
26148
|
+
tickFormatter: (value) => formatNumber(value)
|
|
26149
|
+
}
|
|
26150
|
+
),
|
|
26151
|
+
/* @__PURE__ */ jsx(Tooltip, { content: /* @__PURE__ */ jsx(CustomTooltip, {}), cursor: { strokeDasharray: "3 3" } }),
|
|
26152
|
+
/* @__PURE__ */ jsx(
|
|
26153
|
+
Legend,
|
|
26154
|
+
{
|
|
26155
|
+
wrapperStyle: { paddingTop: "20px" },
|
|
26156
|
+
formatter: (value) => /* @__PURE__ */ jsx("span", { className: "text-sm", children: value })
|
|
26157
|
+
}
|
|
26158
|
+
),
|
|
26159
|
+
/* @__PURE__ */ jsx(
|
|
26160
|
+
Area,
|
|
26161
|
+
{
|
|
26162
|
+
type: "monotone",
|
|
26163
|
+
dataKey: args.y_field,
|
|
26164
|
+
stroke: CHART_COLORS.primary,
|
|
26165
|
+
strokeWidth: 2,
|
|
26166
|
+
fill: args.fill !== false ? "url(#colorGradient)" : "none",
|
|
26167
|
+
name: args.y_field,
|
|
26168
|
+
dot: { r: 4, fill: CHART_COLORS.primary },
|
|
26169
|
+
activeDot: { r: 6 }
|
|
26170
|
+
}
|
|
26171
|
+
)
|
|
26172
|
+
] }) }) }) }, `area-${key}`);
|
|
25564
26173
|
default:
|
|
25565
26174
|
console.warn(`Unknown chart type: ${chartType}`);
|
|
25566
26175
|
return null;
|
|
@@ -25591,6 +26200,31 @@ var AIAgentView = () => {
|
|
|
25591
26200
|
opacity: 1;
|
|
25592
26201
|
}
|
|
25593
26202
|
}
|
|
26203
|
+
|
|
26204
|
+
@keyframes waveLoad {
|
|
26205
|
+
0% {
|
|
26206
|
+
background-position: -200% 0;
|
|
26207
|
+
}
|
|
26208
|
+
100% {
|
|
26209
|
+
background-position: 200% 0;
|
|
26210
|
+
}
|
|
26211
|
+
}
|
|
26212
|
+
|
|
26213
|
+
.thinking-wave {
|
|
26214
|
+
background: linear-gradient(
|
|
26215
|
+
90deg,
|
|
26216
|
+
#6b7280 0%,
|
|
26217
|
+
#6b7280 40%,
|
|
26218
|
+
#3b82f6 50%,
|
|
26219
|
+
#6b7280 60%,
|
|
26220
|
+
#6b7280 100%
|
|
26221
|
+
);
|
|
26222
|
+
background-size: 200% 100%;
|
|
26223
|
+
-webkit-background-clip: text;
|
|
26224
|
+
background-clip: text;
|
|
26225
|
+
-webkit-text-fill-color: transparent;
|
|
26226
|
+
animation: waveLoad 3s ease-in-out infinite;
|
|
26227
|
+
}
|
|
25594
26228
|
`
|
|
25595
26229
|
} }),
|
|
25596
26230
|
/* @__PURE__ */ jsxs("div", { className: `flex-1 flex flex-col h-screen transition-all duration-300 ${isSidebarOpen ? "mr-80" : "mr-0"}`, children: [
|
|
@@ -25740,14 +26374,7 @@ var AIAgentView = () => {
|
|
|
25740
26374
|
)),
|
|
25741
26375
|
/* @__PURE__ */ jsxs("div", { className: "flex gap-4 justify-start", children: [
|
|
25742
26376
|
/* @__PURE__ */ jsx(ProfilePicture, {}),
|
|
25743
|
-
/* @__PURE__ */ jsx("div", { className: "bg-white border border-gray-200/80 px-5 py-4 rounded-2xl shadow-sm max-w-full", children: /* @__PURE__ */
|
|
25744
|
-
/* @__PURE__ */ jsxs("div", { className: "flex space-x-1", children: [
|
|
25745
|
-
/* @__PURE__ */ jsx("div", { className: "w-2 h-2 bg-blue-500 rounded-full animate-bounce" }),
|
|
25746
|
-
/* @__PURE__ */ jsx("div", { className: "w-2 h-2 bg-blue-500 rounded-full animate-bounce", style: { animationDelay: "0.1s" } }),
|
|
25747
|
-
/* @__PURE__ */ jsx("div", { className: "w-2 h-2 bg-blue-500 rounded-full animate-bounce", style: { animationDelay: "0.2s" } })
|
|
25748
|
-
] }),
|
|
25749
|
-
/* @__PURE__ */ jsx("span", { className: "text-gray-600 text-sm", children: "Axel is thinking..." })
|
|
25750
|
-
] }) })
|
|
26377
|
+
/* @__PURE__ */ jsx("div", { className: "bg-white border border-gray-200/80 px-5 py-4 rounded-2xl shadow-sm max-w-full", children: /* @__PURE__ */ jsx("div", { className: "flex items-center", children: /* @__PURE__ */ jsx("span", { className: "text-sm font-medium thinking-wave", children: "Thinking" }) }) })
|
|
25751
26378
|
] })
|
|
25752
26379
|
] }) })
|
|
25753
26380
|
) : (
|
|
@@ -25813,14 +26440,7 @@ var AIAgentView = () => {
|
|
|
25813
26440
|
] }),
|
|
25814
26441
|
isCurrentThreadLoading && !currentStreaming.message && /* @__PURE__ */ jsxs("div", { className: "flex gap-4 justify-start", children: [
|
|
25815
26442
|
/* @__PURE__ */ jsx(ProfilePicture, {}),
|
|
25816
|
-
/* @__PURE__ */ jsx("div", { className: "bg-white border border-gray-200/80 px-5 py-4 rounded-2xl shadow-sm max-w-full", children: /* @__PURE__ */
|
|
25817
|
-
/* @__PURE__ */ jsxs("div", { className: "flex space-x-1", children: [
|
|
25818
|
-
/* @__PURE__ */ jsx("div", { className: "w-2 h-2 bg-blue-500 rounded-full animate-bounce" }),
|
|
25819
|
-
/* @__PURE__ */ jsx("div", { className: "w-2 h-2 bg-blue-500 rounded-full animate-bounce", style: { animationDelay: "0.1s" } }),
|
|
25820
|
-
/* @__PURE__ */ jsx("div", { className: "w-2 h-2 bg-blue-500 rounded-full animate-bounce", style: { animationDelay: "0.2s" } })
|
|
25821
|
-
] }),
|
|
25822
|
-
/* @__PURE__ */ jsx("span", { className: "text-gray-600 text-sm", children: "Axel is thinking..." })
|
|
25823
|
-
] }) })
|
|
26443
|
+
/* @__PURE__ */ jsx("div", { className: "bg-white border border-gray-200/80 px-5 py-4 rounded-2xl shadow-sm max-w-full", children: /* @__PURE__ */ jsx("div", { className: "flex items-center", children: /* @__PURE__ */ jsx("span", { className: "text-sm font-medium thinking-wave", children: "Thinking" }) }) })
|
|
25824
26444
|
] }),
|
|
25825
26445
|
/* @__PURE__ */ jsx("div", { ref: messagesEndRef })
|
|
25826
26446
|
] }) })
|
|
@@ -26822,14 +27442,30 @@ function HomeView({
|
|
|
26822
27442
|
factoryName = "Simba Beer - Line 1"
|
|
26823
27443
|
}) {
|
|
26824
27444
|
const [isHydrated, setIsHydrated] = useState(false);
|
|
26825
|
-
const [selectedLineId, setSelectedLineId] = useState(
|
|
27445
|
+
const [selectedLineId, setSelectedLineId] = useState(factoryViewId);
|
|
27446
|
+
console.log("[HomeView] Component initialized with:", {
|
|
27447
|
+
defaultLineId,
|
|
27448
|
+
factoryViewId,
|
|
27449
|
+
line1Uuid,
|
|
27450
|
+
line2Uuid,
|
|
27451
|
+
selectedLineId: factoryViewId
|
|
27452
|
+
});
|
|
26826
27453
|
const [isChangingFilter, setIsChangingFilter] = useState(false);
|
|
26827
27454
|
const [errorMessage, setErrorMessage] = useState(null);
|
|
26828
27455
|
const [displayNamesInitialized, setDisplayNamesInitialized] = useState(false);
|
|
27456
|
+
const metricsLineId = selectedLineId;
|
|
27457
|
+
console.log("[HomeView] Using metrics line ID:", metricsLineId, "for selectedLineId:", selectedLineId);
|
|
26829
27458
|
useEffect(() => {
|
|
26830
27459
|
const initDisplayNames = async () => {
|
|
26831
27460
|
try {
|
|
26832
|
-
|
|
27461
|
+
if (metricsLineId === factoryViewId) {
|
|
27462
|
+
console.log("[HomeView] Initializing display names for factory view (both lines)");
|
|
27463
|
+
await preInitializeWorkspaceDisplayNames(line1Uuid);
|
|
27464
|
+
await preInitializeWorkspaceDisplayNames(line2Uuid);
|
|
27465
|
+
} else {
|
|
27466
|
+
console.log("[HomeView] Initializing display names for single line:", selectedLineId);
|
|
27467
|
+
await preInitializeWorkspaceDisplayNames(selectedLineId);
|
|
27468
|
+
}
|
|
26833
27469
|
setDisplayNamesInitialized(true);
|
|
26834
27470
|
} catch (error) {
|
|
26835
27471
|
console.error("Failed to pre-initialize workspace display names:", error);
|
|
@@ -26837,12 +27473,13 @@ function HomeView({
|
|
|
26837
27473
|
}
|
|
26838
27474
|
};
|
|
26839
27475
|
initDisplayNames();
|
|
26840
|
-
}, [selectedLineId]);
|
|
27476
|
+
}, [selectedLineId, metricsLineId, factoryViewId, line1Uuid, line2Uuid]);
|
|
27477
|
+
const displayNamesLineId = metricsLineId === factoryViewId ? void 0 : selectedLineId;
|
|
26841
27478
|
const {
|
|
26842
27479
|
displayNames: workspaceDisplayNames,
|
|
26843
27480
|
loading: displayNamesLoading,
|
|
26844
27481
|
error: displayNamesError
|
|
26845
|
-
} = useWorkspaceDisplayNames(void 0,
|
|
27482
|
+
} = useWorkspaceDisplayNames(void 0, displayNamesLineId);
|
|
26846
27483
|
useCallback(() => {
|
|
26847
27484
|
console.log("Refetching KPIs after line metrics update");
|
|
26848
27485
|
}, []);
|
|
@@ -26867,14 +27504,16 @@ function HomeView({
|
|
|
26867
27504
|
error: metricsError,
|
|
26868
27505
|
refetch: refetchMetrics
|
|
26869
27506
|
} = useDashboardMetrics({
|
|
26870
|
-
lineId:
|
|
27507
|
+
lineId: metricsLineId,
|
|
26871
27508
|
onLineMetricsUpdate
|
|
26872
27509
|
});
|
|
27510
|
+
const breaksLineIds = metricsLineId === factoryViewId ? [line1Uuid, line2Uuid] : [selectedLineId];
|
|
27511
|
+
console.log("[HomeView] Using breaks line IDs:", breaksLineIds);
|
|
26873
27512
|
const {
|
|
26874
27513
|
activeBreaks,
|
|
26875
27514
|
isLoading: breaksLoading,
|
|
26876
27515
|
error: breaksError
|
|
26877
|
-
} = useActiveBreaks(
|
|
27516
|
+
} = useActiveBreaks(breaksLineIds);
|
|
26878
27517
|
const memoizedWorkspaceMetrics = useMemo(() => workspaceMetrics, [
|
|
26879
27518
|
// Only update reference if meaningful properties change
|
|
26880
27519
|
workspaceMetrics.length,
|
|
@@ -27029,8 +27668,12 @@ var itemVariants = {
|
|
|
27029
27668
|
};
|
|
27030
27669
|
|
|
27031
27670
|
// src/lib/utils/navigation.ts
|
|
27032
|
-
function getWorkspaceNavigationParams2(workspaceUuid, displayName) {
|
|
27033
|
-
|
|
27671
|
+
function getWorkspaceNavigationParams2(workspaceUuid, displayName, lineId) {
|
|
27672
|
+
const params = new URLSearchParams();
|
|
27673
|
+
if (displayName) {
|
|
27674
|
+
params.set("name", displayName);
|
|
27675
|
+
}
|
|
27676
|
+
return params.toString() ? `?${params.toString()}` : "";
|
|
27034
27677
|
}
|
|
27035
27678
|
var formatLocalDate = (date) => {
|
|
27036
27679
|
const options = {
|
|
@@ -28222,6 +28865,13 @@ var LeaderboardDetailView = memo(({
|
|
|
28222
28865
|
line2Id = "",
|
|
28223
28866
|
className = ""
|
|
28224
28867
|
}) => {
|
|
28868
|
+
console.log("[LeaderboardDetailView] Component initialized with:", {
|
|
28869
|
+
lineId,
|
|
28870
|
+
line1Id,
|
|
28871
|
+
line2Id,
|
|
28872
|
+
date,
|
|
28873
|
+
shift
|
|
28874
|
+
});
|
|
28225
28875
|
const navigation = useNavigation();
|
|
28226
28876
|
const [sortAscending, setSortAscending] = useState(true);
|
|
28227
28877
|
const handleSortToggle = useCallback(() => {
|
|
@@ -28239,13 +28889,39 @@ var LeaderboardDetailView = memo(({
|
|
|
28239
28889
|
error: metricsError,
|
|
28240
28890
|
refreshMetrics
|
|
28241
28891
|
} = useRealtimeLineMetrics(realtimeMetricsParams);
|
|
28892
|
+
const isFactoryView = useMemo(() => {
|
|
28893
|
+
const hasEssentialLineIds = Boolean(line1Id && line2Id);
|
|
28894
|
+
const isFactoryLineId = lineId === "factory" || !lineId;
|
|
28895
|
+
return hasEssentialLineIds && isFactoryLineId;
|
|
28896
|
+
}, [lineId, line1Id, line2Id]);
|
|
28242
28897
|
const memoizedLineId = useMemo(() => lineId || "", [lineId]);
|
|
28898
|
+
console.log("[LeaderboardDetailView] Factory view check:", {
|
|
28899
|
+
isFactoryView,
|
|
28900
|
+
lineId,
|
|
28901
|
+
line1Id,
|
|
28902
|
+
line2Id
|
|
28903
|
+
});
|
|
28904
|
+
const singleLineResult = useLineWorkspaceMetrics(isFactoryView ? "" : memoizedLineId);
|
|
28905
|
+
const factoryResult = useDashboardMetrics({
|
|
28906
|
+
lineId: isFactoryView ? "factory" : "",
|
|
28907
|
+
onLineMetricsUpdate: void 0
|
|
28908
|
+
});
|
|
28243
28909
|
const {
|
|
28244
28910
|
workspaces,
|
|
28245
28911
|
loading: workspacesLoading,
|
|
28246
28912
|
error: workspacesError,
|
|
28247
28913
|
refreshWorkspaces
|
|
28248
|
-
} =
|
|
28914
|
+
} = isFactoryView ? {
|
|
28915
|
+
workspaces: factoryResult.workspaceMetrics,
|
|
28916
|
+
loading: factoryResult.isLoading,
|
|
28917
|
+
error: factoryResult.error,
|
|
28918
|
+
refreshWorkspaces: factoryResult.refetch
|
|
28919
|
+
} : singleLineResult;
|
|
28920
|
+
console.log("[LeaderboardDetailView] Workspace data:", {
|
|
28921
|
+
workspaces: workspaces?.length || 0,
|
|
28922
|
+
loading: workspacesLoading,
|
|
28923
|
+
error: workspacesError
|
|
28924
|
+
});
|
|
28249
28925
|
const getShiftName = useCallback((shiftId) => {
|
|
28250
28926
|
if (shiftId === void 0) return "Day";
|
|
28251
28927
|
return shiftId === 0 ? "Day" : "Night";
|
|
@@ -30176,6 +30852,12 @@ var TargetsView = ({
|
|
|
30176
30852
|
userId,
|
|
30177
30853
|
onSaveChanges
|
|
30178
30854
|
}) => {
|
|
30855
|
+
console.log("[TargetsView] Component initialized with:", {
|
|
30856
|
+
lineIds,
|
|
30857
|
+
lineNames,
|
|
30858
|
+
companyId,
|
|
30859
|
+
totalLines: lineIds.length
|
|
30860
|
+
});
|
|
30179
30861
|
const initialLineWorkspaces = useMemo(() => {
|
|
30180
30862
|
return lineIds.reduce((acc, lineId) => ({
|
|
30181
30863
|
...acc,
|
|
@@ -30487,7 +31169,9 @@ var TargetsView = ({
|
|
|
30487
31169
|
continue;
|
|
30488
31170
|
}
|
|
30489
31171
|
try {
|
|
31172
|
+
console.log(`[TargetsView] Fetching workspaces for line: ${lineId}`);
|
|
30490
31173
|
const fetchedLineWorkspacesData = await workspaceService.getWorkspaces(lineId);
|
|
31174
|
+
console.log(`[TargetsView] Retrieved ${fetchedLineWorkspacesData.length} workspaces for line ${lineId}`);
|
|
30491
31175
|
const mappedWorkspaces = fetchedLineWorkspacesData.map((ws) => ({
|
|
30492
31176
|
id: ws.id,
|
|
30493
31177
|
name: ws.workspace_id,
|
|
@@ -31782,4 +32466,4 @@ var S3Service = class {
|
|
|
31782
32466
|
}
|
|
31783
32467
|
};
|
|
31784
32468
|
|
|
31785
|
-
export { ACTION_NAMES, AIAgentView_default as AIAgentView, AuthCallback, AuthCallbackView_default as AuthCallbackView, AuthProvider, AuthenticatedFactoryView, AuthenticatedHelpView, AuthenticatedHomeView, AuthenticatedTargetsView, BarChart, BaseHistoryCalendar, BottlenecksContent, BreakNotificationPopup, Card2 as Card, CardContent2 as CardContent, CardDescription2 as CardDescription, CardFooter2 as CardFooter, CardHeader2 as CardHeader, CardTitle2 as CardTitle, CycleTimeChart, CycleTimeOverTimeChart, DEFAULT_ANALYTICS_CONFIG, DEFAULT_AUTH_CONFIG, DEFAULT_CONFIG, DEFAULT_DATABASE_CONFIG, DEFAULT_DATE_TIME_CONFIG, DEFAULT_ENDPOINTS_CONFIG, DEFAULT_ENTITY_CONFIG, DEFAULT_SHIFT_CONFIG, DEFAULT_THEME_CONFIG, DEFAULT_VIDEO_CONFIG, DEFAULT_WORKSPACE_CONFIG, DEFAULT_WORKSPACE_POSITIONS, DashboardHeader, DashboardLayout, DashboardOverridesProvider, DashboardProvider, DateDisplay_default as DateDisplay, DateTimeDisplay, DebugAuth, DebugAuthView_default as DebugAuthView, EmptyStateMessage, FactoryView_default as FactoryView, GaugeChart, GridComponentsPlaceholder, Header, HelpView_default as HelpView, HomeView_default as HomeView, HourlyOutputChart2 as HourlyOutputChart, ISTTimer_default as ISTTimer, KPICard, KPIDetailView_default as KPIDetailView, KPIGrid, KPIHeader, KPISection, KPIsOverviewView_default as KPIsOverviewView, LINE_1_UUID, LargeOutputProgressChart, LeaderboardDetailView_default as LeaderboardDetailView, Legend6 as Legend, LineChart, LineHistoryCalendar, LineMonthlyHistory, LineMonthlyPdfGenerator, LinePdfExportButton, LinePdfGenerator, LineWhatsAppShareButton, LiveTimer, LoadingOverlay_default as LoadingOverlay, LoadingPage_default as LoadingPage, LoadingSpinner_default as LoadingSpinner, LoginPage, LoginView_default as LoginView, MainLayout, MetricCard_default as MetricCard, NoWorkspaceData, OptifyeAgentClient, OutputProgressChart, PageHeader, PieChart4 as PieChart, ProfileView_default as ProfileView, RegistryProvider, S3Service, SOPComplianceChart, SSEChatClient, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, ShiftDisplay_default as ShiftDisplay, ShiftsView_default as ShiftsView, SideNavBar, SingleVideoStream_default as SingleVideoStream, Skeleton, SlackAPI, SupabaseProvider, TargetWorkspaceGrid, TargetsView_default as TargetsView, ThreadSidebar, TimeDisplay_default as TimeDisplay, TimePickerDropdown, VideoCard, VideoGridView, VideoPreloader, WORKSPACE_POSITIONS, WhatsAppShareButton, WorkspaceCard, WorkspaceDetailView_default as WorkspaceDetailView, WorkspaceDisplayNameExample, WorkspaceGrid, WorkspaceGridItem, WorkspaceHistoryCalendar, WorkspaceMetricCards, WorkspaceMonthlyDataFetcher, WorkspaceMonthlyPdfGenerator, WorkspacePdfExportButton, WorkspacePdfGenerator, WorkspaceWhatsAppShareButton, actionService, apiUtils, authCoreService, authOTPService, authRateLimitService, checkRateLimit2 as checkRateLimit, clearAllRateLimits2 as clearAllRateLimits, clearRateLimit2 as clearRateLimit, clearS3VideoCache, clearS3VideoFromCache, clearWorkspaceDisplayNamesCache, cn, createStreamProxyHandler, createSupabaseClient, createThrottledReload, dashboardService, deleteThread, forceRefreshWorkspaceDisplayNames, formatDateInZone, formatDateTimeInZone, formatISTDate, formatIdleTime, formatTimeInZone, fromUrlFriendlyName, getAllThreadMessages, getAllWorkspaceDisplayNamesAsync, getAnonClient, getCameraNumber, getCompanyMetricsTableName, getConfigurableShortWorkspaceDisplayName, getConfigurableWorkspaceDisplayName, getCurrentShift, getCurrentTimeInZone, getDashboardHeaderTimeInZone, getDaysDifferenceInZone, getDefaultCameraStreamUrl, getDefaultTabForWorkspace, getManufacturingInsights, getMetricsTablePrefix, getOperationalDate, getS3SignedUrl, getS3VideoSrc, getShortWorkspaceDisplayName, getShortWorkspaceDisplayNameAsync, getStoredWorkspaceMappings, getThreadMessages, getUserThreads, getUserThreadsPaginated, getWorkspaceDisplayName, getWorkspaceDisplayNameAsync, getWorkspaceDisplayNamesMap, getWorkspaceFromUrl, getWorkspaceNavigationParams, identifyCoreUser, initializeCoreMixpanel, isTransitionPeriod, isValidLineInfoPayload, isValidWorkspaceDetailedMetricsPayload, isValidWorkspaceMetricsPayload, isWorkspaceDisplayNamesLoaded, isWorkspaceDisplayNamesLoading, mergeWithDefaultConfig, optifyeAgentClient, preInitializeWorkspaceDisplayNames, preloadS3Video, preloadS3VideoUrl, preloadS3VideosUrl, preloadVideoUrl, preloadVideosUrl, qualityService, realtimeService, refreshWorkspaceDisplayNames, resetCoreMixpanel, s3VideoPreloader, storeWorkspaceMapping, streamProxyConfig, throttledReloadDashboard, toUrlFriendlyName, trackCoreEvent, trackCorePageView, updateThreadTitle, useActiveBreaks, useAnalyticsConfig, useAuth, useAuthConfig, useComponentOverride, useCustomConfig, useDashboardConfig, useDashboardMetrics, useDatabaseConfig, useDateFormatter, useDateTimeConfig, useEndpointsConfig, useEntityConfig, useFactoryOverviewMetrics, useFeatureFlags, useFormatNumber, useHistoricWorkspaceMetrics, useHlsStream, useHlsStreamWithCropping, useHookOverride, useLeaderboardMetrics, useLineDetailedMetrics, useLineKPIs, useLineMetrics, useLineWorkspaceMetrics, useMessages, useMetrics, useNavigation, useOverrides, usePageOverride, useRealtimeLineMetrics, useRegistry, useShiftConfig, useShifts, useSupabase, useSupabaseClient, useTargets, useTheme, useThemeConfig, useThreads, useVideoConfig, useWorkspaceConfig, useWorkspaceDetailedMetrics, useWorkspaceDisplayName, useWorkspaceDisplayNames, useWorkspaceDisplayNamesMap, useWorkspaceMetrics, useWorkspaceNavigation, useWorkspaceOperators, videoPreloader, whatsappService, withAuth, withRegistry, workspaceService };
|
|
32469
|
+
export { ACTION_NAMES, AIAgentView_default as AIAgentView, AuthCallback, AuthCallbackView_default as AuthCallbackView, AuthProvider, AuthenticatedFactoryView, AuthenticatedHelpView, AuthenticatedHomeView, AuthenticatedTargetsView, BarChart, BaseHistoryCalendar, BottlenecksContent, BreakNotificationPopup, Card2 as Card, CardContent2 as CardContent, CardDescription2 as CardDescription, CardFooter2 as CardFooter, CardHeader2 as CardHeader, CardTitle2 as CardTitle, CycleTimeChart, CycleTimeOverTimeChart, DEFAULT_ANALYTICS_CONFIG, DEFAULT_AUTH_CONFIG, DEFAULT_CONFIG, DEFAULT_DATABASE_CONFIG, DEFAULT_DATE_TIME_CONFIG, DEFAULT_ENDPOINTS_CONFIG, DEFAULT_ENTITY_CONFIG, DEFAULT_SHIFT_CONFIG, DEFAULT_THEME_CONFIG, DEFAULT_VIDEO_CONFIG, DEFAULT_WORKSPACE_CONFIG, DEFAULT_WORKSPACE_POSITIONS, DashboardHeader, DashboardLayout, DashboardOverridesProvider, DashboardProvider, DateDisplay_default as DateDisplay, DateTimeDisplay, DebugAuth, DebugAuthView_default as DebugAuthView, EmptyStateMessage, FactoryView_default as FactoryView, GaugeChart, GridComponentsPlaceholder, Header, HelpView_default as HelpView, HomeView_default as HomeView, HourlyOutputChart2 as HourlyOutputChart, ISTTimer_default as ISTTimer, KPICard, KPIDetailView_default as KPIDetailView, KPIGrid, KPIHeader, KPISection, KPIsOverviewView_default as KPIsOverviewView, LINE_1_UUID, LargeOutputProgressChart, LeaderboardDetailView_default as LeaderboardDetailView, Legend6 as Legend, LineChart, LineHistoryCalendar, LineMonthlyHistory, LineMonthlyPdfGenerator, LinePdfExportButton, LinePdfGenerator, LineWhatsAppShareButton, LiveTimer, LoadingOverlay_default as LoadingOverlay, LoadingPage_default as LoadingPage, LoadingSpinner_default as LoadingSpinner, LoginPage, LoginView_default as LoginView, MainLayout, MetricCard_default as MetricCard, NoWorkspaceData, OptifyeAgentClient, OutputProgressChart, PageHeader, PieChart4 as PieChart, ProfileView_default as ProfileView, RegistryProvider, S3Service, SOPComplianceChart, SSEChatClient, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, ShiftDisplay_default as ShiftDisplay, ShiftsView_default as ShiftsView, SideNavBar, SingleVideoStream_default as SingleVideoStream, Skeleton, SlackAPI, SupabaseProvider, TargetWorkspaceGrid, TargetsView_default as TargetsView, ThreadSidebar, TimeDisplay_default as TimeDisplay, TimePickerDropdown, VideoCard, VideoGridView, VideoPreloader, WORKSPACE_POSITIONS, WhatsAppShareButton, WorkspaceCard, WorkspaceDetailView_default as WorkspaceDetailView, WorkspaceDisplayNameExample, WorkspaceGrid, WorkspaceGridItem, WorkspaceHistoryCalendar, WorkspaceMetricCards, WorkspaceMonthlyDataFetcher, WorkspaceMonthlyPdfGenerator, WorkspacePdfExportButton, WorkspacePdfGenerator, WorkspaceWhatsAppShareButton, actionService, apiUtils, authCoreService, authOTPService, authRateLimitService, checkRateLimit2 as checkRateLimit, clearAllRateLimits2 as clearAllRateLimits, clearRateLimit2 as clearRateLimit, clearS3VideoCache, clearS3VideoFromCache, clearWorkspaceDisplayNamesCache, clearWorkspaceMappingsForLine, cn, createStreamProxyHandler, createSupabaseClient, createThrottledReload, dashboardService, deleteThread, forceRefreshWorkspaceDisplayNames, formatDateInZone, formatDateTimeInZone, formatISTDate, formatIdleTime, formatTimeInZone, fromUrlFriendlyName, getAllThreadMessages, getAllWorkspaceDisplayNamesAsync, getAnonClient, getCameraNumber, getCompanyMetricsTableName, getConfigurableShortWorkspaceDisplayName, getConfigurableWorkspaceDisplayName, getCurrentShift, getCurrentTimeInZone, getDashboardHeaderTimeInZone, getDaysDifferenceInZone, getDefaultCameraStreamUrl, getDefaultTabForWorkspace, getManufacturingInsights, getMetricsTablePrefix, getOperationalDate, getS3SignedUrl, getS3VideoSrc, getShortWorkspaceDisplayName, getShortWorkspaceDisplayNameAsync, getStoredWorkspaceMappings, getThreadMessages, getUserThreads, getUserThreadsPaginated, getWorkspaceDisplayName, getWorkspaceDisplayNameAsync, getWorkspaceDisplayNamesMap, getWorkspaceFromUrl, getWorkspaceMappingsForLine, getWorkspaceNavigationParams, identifyCoreUser, initializeCoreMixpanel, isTransitionPeriod, isValidLineInfoPayload, isValidWorkspaceDetailedMetricsPayload, isValidWorkspaceMetricsPayload, isWorkspaceDisplayNamesLoaded, isWorkspaceDisplayNamesLoading, mergeWithDefaultConfig, optifyeAgentClient, preInitializeWorkspaceDisplayNames, preloadS3Video, preloadS3VideoUrl, preloadS3VideosUrl, preloadVideoUrl, preloadVideosUrl, qualityService, realtimeService, refreshWorkspaceDisplayNames, resetCoreMixpanel, s3VideoPreloader, storeWorkspaceMapping, streamProxyConfig, throttledReloadDashboard, toUrlFriendlyName, trackCoreEvent, trackCorePageView, updateThreadTitle, useActiveBreaks, useAnalyticsConfig, useAuth, useAuthConfig, useComponentOverride, useCustomConfig, useDashboardConfig, useDashboardMetrics, useDatabaseConfig, useDateFormatter, useDateTimeConfig, useEndpointsConfig, useEntityConfig, useFactoryOverviewMetrics, useFeatureFlags, useFormatNumber, useHistoricWorkspaceMetrics, useHlsStream, useHlsStreamWithCropping, useHookOverride, useLeaderboardMetrics, useLineDetailedMetrics, useLineKPIs, useLineMetrics, useLineWorkspaceMetrics, useMessages, useMetrics, useNavigation, useOverrides, usePageOverride, useRealtimeLineMetrics, useRegistry, useShiftConfig, useShifts, useSupabase, useSupabaseClient, useTargets, useTheme, useThemeConfig, useThreads, useVideoConfig, useWorkspaceConfig, useWorkspaceDetailedMetrics, useWorkspaceDisplayName, useWorkspaceDisplayNames, useWorkspaceDisplayNamesMap, useWorkspaceMetrics, useWorkspaceNavigation, useWorkspaceOperators, videoPreloader, whatsappService, withAuth, withRegistry, workspaceService };
|