@optifye/dashboard-core 4.3.8 → 4.3.9
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 +6 -83
- package/dist/index.d.ts +6 -83
- package/dist/index.js +54 -361
- package/dist/index.mjs +55 -360
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -434,25 +434,6 @@ 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
|
-
},
|
|
456
437
|
// Example for getLineInfo:
|
|
457
438
|
async getLineInfo(lineIdInput) {
|
|
458
439
|
const supabase = _getSupabaseInstance();
|
|
@@ -613,13 +594,6 @@ var dashboardService = {
|
|
|
613
594
|
metrics: metricsForReturn
|
|
614
595
|
};
|
|
615
596
|
},
|
|
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
|
-
*/
|
|
623
597
|
async getWorkspacesData(lineIdInput, dateProp, shiftProp) {
|
|
624
598
|
const supabase = _getSupabaseInstance();
|
|
625
599
|
const config = _getDashboardConfigInstance();
|
|
@@ -646,20 +620,17 @@ var dashboardService = {
|
|
|
646
620
|
throw new Error("Factory View requires defaultLineId and secondaryLineId to be configured for workspace data.");
|
|
647
621
|
}
|
|
648
622
|
query = query.in("line_id", [defaultLineId, secondaryLineId]);
|
|
649
|
-
console.log(`[getWorkspacesData] Querying factory view with lines: ${defaultLineId}, ${secondaryLineId}`);
|
|
650
623
|
} else {
|
|
651
624
|
query = query.eq("line_id", lineId);
|
|
652
|
-
console.log(`[getWorkspacesData] Querying single line: ${lineId}`);
|
|
653
625
|
}
|
|
654
626
|
const { data, error } = await query;
|
|
655
627
|
if (error) {
|
|
656
628
|
console.error("Error in getWorkspacesData:", error);
|
|
657
629
|
throw error;
|
|
658
630
|
}
|
|
659
|
-
|
|
631
|
+
return (data || []).map((item) => ({
|
|
660
632
|
company_id: item.company_id,
|
|
661
633
|
line_id: item.line_id,
|
|
662
|
-
// Ensure line_id is always included
|
|
663
634
|
shift_id: item.shift_id,
|
|
664
635
|
date: item.date,
|
|
665
636
|
workspace_uuid: item.workspace_id,
|
|
@@ -673,20 +644,6 @@ var dashboardService = {
|
|
|
673
644
|
efficiency: item.efficiency || 0,
|
|
674
645
|
action_threshold: item.total_day_output || 0
|
|
675
646
|
}));
|
|
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;
|
|
690
647
|
},
|
|
691
648
|
async getWorkspaceDetailedMetrics(workspaceUuid, dateProp, shiftIdProp) {
|
|
692
649
|
const supabase = _getSupabaseInstance();
|
|
@@ -2555,7 +2512,7 @@ var useMetrics = (tableName, options) => {
|
|
|
2555
2512
|
};
|
|
2556
2513
|
return { data, isLoading, error, refetch };
|
|
2557
2514
|
};
|
|
2558
|
-
var useWorkspaceDetailedMetrics = (workspaceId, date, shiftId
|
|
2515
|
+
var useWorkspaceDetailedMetrics = (workspaceId, date, shiftId) => {
|
|
2559
2516
|
const entityConfig = useEntityConfig();
|
|
2560
2517
|
const databaseConfig = useDatabaseConfig();
|
|
2561
2518
|
const dateTimeConfig = useDateTimeConfig();
|
|
@@ -2583,32 +2540,14 @@ var useWorkspaceDetailedMetrics = (workspaceId, date, shiftId, lineId) => {
|
|
|
2583
2540
|
const currentShift = getCurrentShift(defaultTimezone, shiftConfig);
|
|
2584
2541
|
const queryDate = date || currentShift.date;
|
|
2585
2542
|
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
|
-
});
|
|
2594
2543
|
console.log("[useWorkspaceDetailedMetrics] Using shift ID:", queryShiftId, "from input shift:", shiftId);
|
|
2595
2544
|
console.log("[useWorkspaceDetailedMetrics] Using date:", queryDate, "from input date:", date);
|
|
2596
|
-
console.log(`[useWorkspaceDetailedMetrics] Querying ${metricsTable} for workspace: ${workspaceId}, date: ${queryDate}, shift: ${queryShiftId}
|
|
2597
|
-
|
|
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();
|
|
2545
|
+
console.log(`[useWorkspaceDetailedMetrics] Querying ${metricsTable} for workspace: ${workspaceId}, date: ${queryDate}, shift: ${queryShiftId}`);
|
|
2546
|
+
const { data, error: fetchError } = await supabase.from(metricsTable).select("*").eq("workspace_id", workspaceId).eq("date", queryDate).eq("shift_id", queryShiftId).maybeSingle();
|
|
2603
2547
|
if (fetchError) throw fetchError;
|
|
2604
2548
|
if (!data && !date && shiftId === void 0) {
|
|
2605
2549
|
console.log("[useWorkspaceDetailedMetrics] No data found for current date/shift, attempting to find most recent data...");
|
|
2606
|
-
|
|
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();
|
|
2550
|
+
const { data: recentData, error: recentError } = await supabase.from(metricsTable).select("*").eq("workspace_id", workspaceId).order("date", { ascending: false }).order("shift_id", { ascending: false }).limit(1).maybeSingle();
|
|
2612
2551
|
if (recentError) throw recentError;
|
|
2613
2552
|
if (recentData) {
|
|
2614
2553
|
console.log(`[useWorkspaceDetailedMetrics] Found fallback data from date: ${recentData.date}, shift: ${recentData.shift_id}`);
|
|
@@ -2826,7 +2765,7 @@ var useWorkspaceDetailedMetrics = (workspaceId, date, shiftId, lineId) => {
|
|
|
2826
2765
|
updateQueueRef.current = false;
|
|
2827
2766
|
setIsLoading(false);
|
|
2828
2767
|
}
|
|
2829
|
-
}, [supabase, workspaceId, date, shiftId,
|
|
2768
|
+
}, [supabase, workspaceId, date, shiftId, metricsTable, defaultTimezone, shiftConfig, workspaceConfig, companyId]);
|
|
2830
2769
|
const queueUpdate = useCallback(() => {
|
|
2831
2770
|
if (!workspaceId || updateQueueRef.current) return;
|
|
2832
2771
|
updateQueueRef.current = true;
|
|
@@ -2957,7 +2896,7 @@ var useWorkspaceDetailedMetrics = (workspaceId, date, shiftId, lineId) => {
|
|
|
2957
2896
|
supabase.removeChannel(channelRef.current);
|
|
2958
2897
|
}
|
|
2959
2898
|
};
|
|
2960
|
-
}, [supabase, workspaceId, date, shiftId,
|
|
2899
|
+
}, [supabase, workspaceId, date, shiftId, fetchMetrics, queueUpdate, setupSubscription, metricsTable, workspaceMetricsBaseTable, workspaceActionsTable, defaultTimezone, shiftConfig, schema, metricsTablePrefix]);
|
|
2961
2900
|
return {
|
|
2962
2901
|
metrics: metrics2,
|
|
2963
2902
|
isLoading,
|
|
@@ -3419,7 +3358,6 @@ var setCache = (lineId, metrics2) => {
|
|
|
3419
3358
|
}
|
|
3420
3359
|
};
|
|
3421
3360
|
var useDashboardMetrics = ({ onLineMetricsUpdate, lineId }) => {
|
|
3422
|
-
console.log("[useDashboardMetrics] Hook called with lineId:", lineId);
|
|
3423
3361
|
const { supabaseUrl, supabaseKey } = useDashboardConfig();
|
|
3424
3362
|
const entityConfig = useEntityConfig();
|
|
3425
3363
|
const databaseConfig = useDatabaseConfig();
|
|
@@ -3463,33 +3401,14 @@ var useDashboardMetrics = ({ onLineMetricsUpdate, lineId }) => {
|
|
|
3463
3401
|
try {
|
|
3464
3402
|
const currentShiftDetails = getCurrentShift(defaultTimezone, shiftConfig);
|
|
3465
3403
|
const operationalDate = getOperationalDate(defaultTimezone);
|
|
3466
|
-
const
|
|
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
|
-
});
|
|
3404
|
+
const targetLineIds = currentLineIdToUse === (entityConfig.factoryViewId || "factory") ? [entityConfig.defaultLineId, entityConfig.secondaryLineId].filter((id3) => !!id3) : [currentLineIdToUse];
|
|
3476
3405
|
if (targetLineIds.length === 0 && currentLineIdToUse === (entityConfig.factoryViewId || "factory")) {
|
|
3477
3406
|
throw new Error("Factory view selected, but defaultLineId and/or secondaryLineId are not configured in entityConfig.");
|
|
3478
3407
|
}
|
|
3479
3408
|
if (targetLineIds.length === 0) {
|
|
3480
3409
|
throw new Error("No target line IDs available for fetching metrics.");
|
|
3481
3410
|
}
|
|
3482
|
-
console.log("[useDashboardMetrics] Executing workspace query with line IDs:", targetLineIds, "Date:", operationalDate, "ShiftID:", currentShiftDetails.shiftId, "Table:", companySpecificMetricsTable);
|
|
3483
3411
|
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
|
-
});
|
|
3493
3412
|
if (workspaceError) {
|
|
3494
3413
|
throw workspaceError;
|
|
3495
3414
|
}
|
|
@@ -4861,16 +4780,12 @@ function getCurrentLineIds() {
|
|
|
4861
4780
|
try {
|
|
4862
4781
|
const config = _getDashboardConfigInstance();
|
|
4863
4782
|
const entityConfig = config?.entityConfig;
|
|
4864
|
-
console.log("\u{1F504} Dashboard config:", config);
|
|
4865
|
-
console.log("\u{1F504} Entity config:", entityConfig);
|
|
4866
4783
|
const lineIds = [];
|
|
4867
4784
|
if (entityConfig?.defaultLineId) {
|
|
4868
4785
|
lineIds.push(entityConfig.defaultLineId);
|
|
4869
|
-
console.log("\u{1F504} Added defaultLineId:", entityConfig.defaultLineId);
|
|
4870
4786
|
}
|
|
4871
4787
|
if (entityConfig?.secondaryLineId) {
|
|
4872
4788
|
lineIds.push(entityConfig.secondaryLineId);
|
|
4873
|
-
console.log("\u{1F504} Added secondaryLineId:", entityConfig.secondaryLineId);
|
|
4874
4789
|
}
|
|
4875
4790
|
console.log("\u{1F504} Current line IDs from config:", lineIds);
|
|
4876
4791
|
return lineIds;
|
|
@@ -4888,22 +4803,15 @@ async function initializeWorkspaceDisplayNames(explicitLineId) {
|
|
|
4888
4803
|
let targetLineIds = [];
|
|
4889
4804
|
if (explicitLineId) {
|
|
4890
4805
|
targetLineIds = [explicitLineId];
|
|
4891
|
-
console.log("\u{1F504} Using explicit lineId:", explicitLineId);
|
|
4892
4806
|
} else {
|
|
4893
4807
|
targetLineIds = getCurrentLineIds();
|
|
4894
|
-
console.log("\u{1F504} Using line IDs from config:", targetLineIds);
|
|
4895
4808
|
}
|
|
4896
4809
|
console.log("\u{1F504} Target line IDs for workspace filtering:", targetLineIds);
|
|
4897
4810
|
const allDisplayNamesMap = /* @__PURE__ */ new Map();
|
|
4898
|
-
console.log("\u{1F504} About to fetch workspaces for lines:", targetLineIds);
|
|
4899
4811
|
if (targetLineIds.length > 0) {
|
|
4900
4812
|
for (const lineId of targetLineIds) {
|
|
4901
4813
|
console.log(`\u{1F504} Fetching workspaces for line: ${lineId}`);
|
|
4902
4814
|
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
|
-
);
|
|
4907
4815
|
lineDisplayNamesMap.forEach((displayName, workspaceId) => {
|
|
4908
4816
|
allDisplayNamesMap.set(workspaceId, displayName);
|
|
4909
4817
|
});
|
|
@@ -4915,7 +4823,6 @@ async function initializeWorkspaceDisplayNames(explicitLineId) {
|
|
|
4915
4823
|
allDisplayNamesMap.set(workspaceId, displayName);
|
|
4916
4824
|
});
|
|
4917
4825
|
}
|
|
4918
|
-
console.log("\u{1F504} Final combined display names map size:", allDisplayNamesMap.size);
|
|
4919
4826
|
runtimeWorkspaceDisplayNames = {};
|
|
4920
4827
|
allDisplayNamesMap.forEach((displayName, workspaceId) => {
|
|
4921
4828
|
runtimeWorkspaceDisplayNames[workspaceId] = displayName;
|
|
@@ -4943,7 +4850,6 @@ var forceRefreshWorkspaceDisplayNames = async (lineId) => {
|
|
|
4943
4850
|
};
|
|
4944
4851
|
console.log("\u{1F504} Module loaded, will initialize lazily when first function is called");
|
|
4945
4852
|
var getWorkspaceDisplayName = (workspaceId, lineId) => {
|
|
4946
|
-
console.log(`\u{1F504} [DEBUG] getWorkspaceDisplayName called with:`, { workspaceId, lineId, isInitialized, isInitializing });
|
|
4947
4853
|
if (!isInitialized && !isInitializing) {
|
|
4948
4854
|
console.log(`\u{1F504} [DEBUG] getWorkspaceDisplayName(${workspaceId}) - Not initialized, triggering lazy init...`);
|
|
4949
4855
|
} else if (isInitializing) {
|
|
@@ -4955,14 +4861,6 @@ var getWorkspaceDisplayName = (workspaceId, lineId) => {
|
|
|
4955
4861
|
console.error("\u274C Lazy initialization failed:", error);
|
|
4956
4862
|
});
|
|
4957
4863
|
}
|
|
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
|
-
}
|
|
4966
4864
|
const displayName = runtimeWorkspaceDisplayNames[workspaceId];
|
|
4967
4865
|
if (displayName) {
|
|
4968
4866
|
console.log(`getWorkspaceDisplayName(${workspaceId}) -> ${displayName} (from Supabase)`);
|
|
@@ -4983,14 +4881,6 @@ var getShortWorkspaceDisplayName = (workspaceId, lineId) => {
|
|
|
4983
4881
|
console.error("\u274C Lazy initialization failed:", error);
|
|
4984
4882
|
});
|
|
4985
4883
|
}
|
|
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
|
-
}
|
|
4994
4884
|
const displayName = runtimeWorkspaceDisplayNames[workspaceId];
|
|
4995
4885
|
if (displayName) {
|
|
4996
4886
|
console.log(`getShortWorkspaceDisplayName(${workspaceId}) -> ${displayName} (from Supabase)`);
|
|
@@ -8065,36 +7955,18 @@ function cn(...inputs) {
|
|
|
8065
7955
|
}
|
|
8066
7956
|
|
|
8067
7957
|
// src/lib/utils/urlMapping.ts
|
|
8068
|
-
var toUrlFriendlyName = (workspaceName
|
|
7958
|
+
var toUrlFriendlyName = (workspaceName) => {
|
|
8069
7959
|
if (!workspaceName) throw new Error("Workspace name is required");
|
|
8070
|
-
|
|
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() };
|
|
7960
|
+
return workspaceName.toLowerCase().replace(/\s+/g, "-");
|
|
8082
7961
|
};
|
|
7962
|
+
var fromUrlFriendlyName = (urlName) => urlName.toUpperCase();
|
|
8083
7963
|
var storeWorkspaceMapping = (mapping) => {
|
|
8084
7964
|
const mappings = getStoredWorkspaceMappings();
|
|
8085
|
-
|
|
8086
|
-
mappings[key] = mapping;
|
|
7965
|
+
mappings[mapping.urlName] = mapping;
|
|
8087
7966
|
sessionStorage.setItem("workspaceMappings", JSON.stringify(mappings));
|
|
8088
7967
|
};
|
|
8089
|
-
var getWorkspaceFromUrl = (urlName
|
|
7968
|
+
var getWorkspaceFromUrl = (urlName) => {
|
|
8090
7969
|
const mappings = getStoredWorkspaceMappings();
|
|
8091
|
-
if (lineId) {
|
|
8092
|
-
const lineSpecificKey = `${lineId}_${urlName}`;
|
|
8093
|
-
const lineSpecificMapping = mappings[lineSpecificKey];
|
|
8094
|
-
if (lineSpecificMapping) {
|
|
8095
|
-
return lineSpecificMapping;
|
|
8096
|
-
}
|
|
8097
|
-
}
|
|
8098
7970
|
return mappings[urlName] || null;
|
|
8099
7971
|
};
|
|
8100
7972
|
var getStoredWorkspaceMappings = () => {
|
|
@@ -8105,26 +7977,6 @@ var getStoredWorkspaceMappings = () => {
|
|
|
8105
7977
|
return {};
|
|
8106
7978
|
}
|
|
8107
7979
|
};
|
|
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
|
-
};
|
|
8128
7980
|
|
|
8129
7981
|
// src/lib/utils/workspacePreferences.ts
|
|
8130
7982
|
var getDefaultTabForWorkspace = (workspaceId, displayName) => {
|
|
@@ -17619,7 +17471,6 @@ var VideoCard = React14__default.memo(({
|
|
|
17619
17471
|
});
|
|
17620
17472
|
VideoCard.displayName = "VideoCard";
|
|
17621
17473
|
var DEFAULT_WORKSPACE_HLS_URLS = {
|
|
17622
|
-
// Line-agnostic fallbacks
|
|
17623
17474
|
"WS1": "https://dnh-hls.optifye.ai/cam1/index.m3u8",
|
|
17624
17475
|
"WS2": "https://dnh-hls.optifye.ai/cam2/index.m3u8",
|
|
17625
17476
|
"WS3": "https://dnh-hls.optifye.ai/cam3/index.m3u8",
|
|
@@ -17630,9 +17481,6 @@ var DEFAULT_WORKSPACE_HLS_URLS = {
|
|
|
17630
17481
|
"WS04": "https://59.144.218.58:8443/camera4.m3u8",
|
|
17631
17482
|
"WS05": "https://59.144.218.58:8443/camera1.m3u8",
|
|
17632
17483
|
"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',
|
|
17636
17484
|
};
|
|
17637
17485
|
var DEFAULT_HLS_URL = "https://192.168.5.9:8443/cam1.m3u8";
|
|
17638
17486
|
var VideoGridView = React14__default.memo(({
|
|
@@ -17640,8 +17488,7 @@ var VideoGridView = React14__default.memo(({
|
|
|
17640
17488
|
selectedLine,
|
|
17641
17489
|
className = "",
|
|
17642
17490
|
lineIdMapping = {},
|
|
17643
|
-
videoSources = {}
|
|
17644
|
-
targetLineId
|
|
17491
|
+
videoSources = {}
|
|
17645
17492
|
}) => {
|
|
17646
17493
|
const router = useRouter();
|
|
17647
17494
|
const containerRef = useRef(null);
|
|
@@ -17649,38 +17496,14 @@ var VideoGridView = React14__default.memo(({
|
|
|
17649
17496
|
const [gridCols, setGridCols] = useState(4);
|
|
17650
17497
|
const [visibleWorkspaces, setVisibleWorkspaces] = useState(/* @__PURE__ */ new Set());
|
|
17651
17498
|
const videoConfig = useVideoConfig();
|
|
17652
|
-
const entityConfig = useEntityConfig();
|
|
17653
17499
|
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
|
-
});
|
|
17663
17500
|
const mergedVideoSources = {
|
|
17664
17501
|
defaultHlsUrl: videoSources.defaultHlsUrl || DEFAULT_HLS_URL,
|
|
17665
17502
|
workspaceHlsUrls: { ...DEFAULT_WORKSPACE_HLS_URLS, ...videoSources.workspaceHlsUrls }
|
|
17666
17503
|
};
|
|
17667
|
-
const getWorkspaceHlsUrl = useCallback((workspaceName
|
|
17504
|
+
const getWorkspaceHlsUrl = useCallback((workspaceName) => {
|
|
17668
17505
|
const wsName = workspaceName.toUpperCase();
|
|
17669
|
-
|
|
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;
|
|
17506
|
+
return mergedVideoSources.workspaceHlsUrls[wsName] || mergedVideoSources.defaultHlsUrl;
|
|
17684
17507
|
}, [mergedVideoSources]);
|
|
17685
17508
|
const getWorkspaceCropping = useCallback((workspaceName) => {
|
|
17686
17509
|
if (!cropping) return void 0;
|
|
@@ -17695,70 +17518,26 @@ var VideoGridView = React14__default.memo(({
|
|
|
17695
17518
|
);
|
|
17696
17519
|
}, [workspaces]);
|
|
17697
17520
|
const filteredWorkspaces = useMemo(() => {
|
|
17698
|
-
|
|
17699
|
-
|
|
17700
|
-
|
|
17701
|
-
|
|
17702
|
-
|
|
17703
|
-
|
|
17704
|
-
|
|
17705
|
-
|
|
17706
|
-
|
|
17707
|
-
|
|
17708
|
-
|
|
17709
|
-
|
|
17710
|
-
|
|
17711
|
-
|
|
17712
|
-
|
|
17713
|
-
|
|
17714
|
-
|
|
17715
|
-
|
|
17716
|
-
|
|
17717
|
-
|
|
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]);
|
|
17521
|
+
return selectedLine === 1 ? workspaces.filter((w) => {
|
|
17522
|
+
if (w.workspace_name === "WS5-5") return true;
|
|
17523
|
+
if (w.workspace_name === "WS32-5") return false;
|
|
17524
|
+
try {
|
|
17525
|
+
const wsNumber = parseInt(w.workspace_name.replace("WS", ""));
|
|
17526
|
+
return wsNumber >= 1 && wsNumber <= 22;
|
|
17527
|
+
} catch {
|
|
17528
|
+
return true;
|
|
17529
|
+
}
|
|
17530
|
+
}) : selectedLine === 2 ? workspaces.filter((w) => {
|
|
17531
|
+
if (w.workspace_name === "WS5-5") return false;
|
|
17532
|
+
if (w.workspace_name === "WS32-5") return true;
|
|
17533
|
+
try {
|
|
17534
|
+
const wsNumber = parseInt(w.workspace_name.replace("WS", ""));
|
|
17535
|
+
return wsNumber >= 23 && wsNumber <= 44;
|
|
17536
|
+
} catch {
|
|
17537
|
+
return false;
|
|
17538
|
+
}
|
|
17539
|
+
}) : workspaces;
|
|
17540
|
+
}, [workspaces, selectedLine]);
|
|
17762
17541
|
const calculateOptimalGrid = useCallback(() => {
|
|
17763
17542
|
if (!containerRef.current) return;
|
|
17764
17543
|
const containerPadding = 16;
|
|
@@ -17835,12 +17614,6 @@ var VideoGridView = React14__default.memo(({
|
|
|
17835
17614
|
}, [filteredWorkspaces]);
|
|
17836
17615
|
const handleWorkspaceClick = useCallback((workspace) => {
|
|
17837
17616
|
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
|
-
});
|
|
17844
17617
|
trackCoreEvent("Workspace Detail Clicked", {
|
|
17845
17618
|
workspace_name: workspace.workspace_name,
|
|
17846
17619
|
workspace_id: workspaceId,
|
|
@@ -17849,15 +17622,8 @@ var VideoGridView = React14__default.memo(({
|
|
|
17849
17622
|
efficiency: workspace.efficiency,
|
|
17850
17623
|
action_count: workspace.action_count
|
|
17851
17624
|
});
|
|
17852
|
-
const displayName = getWorkspaceDisplayName(workspace.workspace_name
|
|
17625
|
+
const displayName = getWorkspaceDisplayName(workspace.workspace_name);
|
|
17853
17626
|
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
|
-
});
|
|
17861
17627
|
router.push(`/workspace/${workspaceId}${navParams}`);
|
|
17862
17628
|
}, [router]);
|
|
17863
17629
|
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(
|
|
@@ -17870,22 +17636,15 @@ var VideoGridView = React14__default.memo(({
|
|
|
17870
17636
|
minHeight: "100%"
|
|
17871
17637
|
},
|
|
17872
17638
|
children: filteredWorkspaces.sort((a, b) => {
|
|
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
|
-
}
|
|
17885
|
-
}
|
|
17886
|
-
}
|
|
17887
17639
|
const aNum = parseInt(a.workspace_name.slice(2));
|
|
17888
17640
|
const bNum = parseInt(b.workspace_name.slice(2));
|
|
17641
|
+
if (!selectedLine) {
|
|
17642
|
+
const aIsLine2 = a.line_id === lineIdMapping.line2;
|
|
17643
|
+
const bIsLine2 = b.line_id === lineIdMapping.line2;
|
|
17644
|
+
if (aIsLine2 !== bIsLine2) {
|
|
17645
|
+
return aIsLine2 ? 1 : -1;
|
|
17646
|
+
}
|
|
17647
|
+
}
|
|
17889
17648
|
return aNum - bNum;
|
|
17890
17649
|
}).map((workspace) => {
|
|
17891
17650
|
const workspaceId = workspace.workspace_uuid || workspace.workspace_name;
|
|
@@ -17902,7 +17661,7 @@ var VideoGridView = React14__default.memo(({
|
|
|
17902
17661
|
VideoCard,
|
|
17903
17662
|
{
|
|
17904
17663
|
workspace,
|
|
17905
|
-
hlsUrl: getWorkspaceHlsUrl(workspace.workspace_name
|
|
17664
|
+
hlsUrl: getWorkspaceHlsUrl(workspace.workspace_name),
|
|
17906
17665
|
shouldPlay: isVisible,
|
|
17907
17666
|
onClick: () => handleWorkspaceClick(workspace),
|
|
17908
17667
|
onFatalError: throttledReloadDashboard,
|
|
@@ -27442,30 +27201,14 @@ function HomeView({
|
|
|
27442
27201
|
factoryName = "Simba Beer - Line 1"
|
|
27443
27202
|
}) {
|
|
27444
27203
|
const [isHydrated, setIsHydrated] = useState(false);
|
|
27445
|
-
const [selectedLineId, setSelectedLineId] = useState(
|
|
27446
|
-
console.log("[HomeView] Component initialized with:", {
|
|
27447
|
-
defaultLineId,
|
|
27448
|
-
factoryViewId,
|
|
27449
|
-
line1Uuid,
|
|
27450
|
-
line2Uuid,
|
|
27451
|
-
selectedLineId: factoryViewId
|
|
27452
|
-
});
|
|
27204
|
+
const [selectedLineId, setSelectedLineId] = useState(defaultLineId);
|
|
27453
27205
|
const [isChangingFilter, setIsChangingFilter] = useState(false);
|
|
27454
27206
|
const [errorMessage, setErrorMessage] = useState(null);
|
|
27455
27207
|
const [displayNamesInitialized, setDisplayNamesInitialized] = useState(false);
|
|
27456
|
-
const metricsLineId = selectedLineId;
|
|
27457
|
-
console.log("[HomeView] Using metrics line ID:", metricsLineId, "for selectedLineId:", selectedLineId);
|
|
27458
27208
|
useEffect(() => {
|
|
27459
27209
|
const initDisplayNames = async () => {
|
|
27460
27210
|
try {
|
|
27461
|
-
|
|
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
|
-
}
|
|
27211
|
+
await preInitializeWorkspaceDisplayNames(selectedLineId);
|
|
27469
27212
|
setDisplayNamesInitialized(true);
|
|
27470
27213
|
} catch (error) {
|
|
27471
27214
|
console.error("Failed to pre-initialize workspace display names:", error);
|
|
@@ -27473,13 +27216,12 @@ function HomeView({
|
|
|
27473
27216
|
}
|
|
27474
27217
|
};
|
|
27475
27218
|
initDisplayNames();
|
|
27476
|
-
}, [selectedLineId
|
|
27477
|
-
const displayNamesLineId = metricsLineId === factoryViewId ? void 0 : selectedLineId;
|
|
27219
|
+
}, [selectedLineId]);
|
|
27478
27220
|
const {
|
|
27479
27221
|
displayNames: workspaceDisplayNames,
|
|
27480
27222
|
loading: displayNamesLoading,
|
|
27481
27223
|
error: displayNamesError
|
|
27482
|
-
} = useWorkspaceDisplayNames(void 0,
|
|
27224
|
+
} = useWorkspaceDisplayNames(void 0, selectedLineId);
|
|
27483
27225
|
useCallback(() => {
|
|
27484
27226
|
console.log("Refetching KPIs after line metrics update");
|
|
27485
27227
|
}, []);
|
|
@@ -27504,16 +27246,14 @@ function HomeView({
|
|
|
27504
27246
|
error: metricsError,
|
|
27505
27247
|
refetch: refetchMetrics
|
|
27506
27248
|
} = useDashboardMetrics({
|
|
27507
|
-
lineId:
|
|
27249
|
+
lineId: selectedLineId,
|
|
27508
27250
|
onLineMetricsUpdate
|
|
27509
27251
|
});
|
|
27510
|
-
const breaksLineIds = metricsLineId === factoryViewId ? [line1Uuid, line2Uuid] : [selectedLineId];
|
|
27511
|
-
console.log("[HomeView] Using breaks line IDs:", breaksLineIds);
|
|
27512
27252
|
const {
|
|
27513
27253
|
activeBreaks,
|
|
27514
27254
|
isLoading: breaksLoading,
|
|
27515
27255
|
error: breaksError
|
|
27516
|
-
} = useActiveBreaks(
|
|
27256
|
+
} = useActiveBreaks([selectedLineId]);
|
|
27517
27257
|
const memoizedWorkspaceMetrics = useMemo(() => workspaceMetrics, [
|
|
27518
27258
|
// Only update reference if meaningful properties change
|
|
27519
27259
|
workspaceMetrics.length,
|
|
@@ -27668,12 +27408,8 @@ var itemVariants = {
|
|
|
27668
27408
|
};
|
|
27669
27409
|
|
|
27670
27410
|
// src/lib/utils/navigation.ts
|
|
27671
|
-
function getWorkspaceNavigationParams2(workspaceUuid, displayName
|
|
27672
|
-
|
|
27673
|
-
if (displayName) {
|
|
27674
|
-
params.set("name", displayName);
|
|
27675
|
-
}
|
|
27676
|
-
return params.toString() ? `?${params.toString()}` : "";
|
|
27411
|
+
function getWorkspaceNavigationParams2(workspaceUuid, displayName) {
|
|
27412
|
+
return `?name=${encodeURIComponent(displayName || "")}`;
|
|
27677
27413
|
}
|
|
27678
27414
|
var formatLocalDate = (date) => {
|
|
27679
27415
|
const options = {
|
|
@@ -28865,13 +28601,6 @@ var LeaderboardDetailView = memo(({
|
|
|
28865
28601
|
line2Id = "",
|
|
28866
28602
|
className = ""
|
|
28867
28603
|
}) => {
|
|
28868
|
-
console.log("[LeaderboardDetailView] Component initialized with:", {
|
|
28869
|
-
lineId,
|
|
28870
|
-
line1Id,
|
|
28871
|
-
line2Id,
|
|
28872
|
-
date,
|
|
28873
|
-
shift
|
|
28874
|
-
});
|
|
28875
28604
|
const navigation = useNavigation();
|
|
28876
28605
|
const [sortAscending, setSortAscending] = useState(true);
|
|
28877
28606
|
const handleSortToggle = useCallback(() => {
|
|
@@ -28889,39 +28618,13 @@ var LeaderboardDetailView = memo(({
|
|
|
28889
28618
|
error: metricsError,
|
|
28890
28619
|
refreshMetrics
|
|
28891
28620
|
} = 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]);
|
|
28897
28621
|
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
|
-
});
|
|
28909
28622
|
const {
|
|
28910
28623
|
workspaces,
|
|
28911
28624
|
loading: workspacesLoading,
|
|
28912
28625
|
error: workspacesError,
|
|
28913
28626
|
refreshWorkspaces
|
|
28914
|
-
} =
|
|
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
|
-
});
|
|
28627
|
+
} = useLineWorkspaceMetrics(memoizedLineId);
|
|
28925
28628
|
const getShiftName = useCallback((shiftId) => {
|
|
28926
28629
|
if (shiftId === void 0) return "Day";
|
|
28927
28630
|
return shiftId === 0 ? "Day" : "Night";
|
|
@@ -30852,12 +30555,6 @@ var TargetsView = ({
|
|
|
30852
30555
|
userId,
|
|
30853
30556
|
onSaveChanges
|
|
30854
30557
|
}) => {
|
|
30855
|
-
console.log("[TargetsView] Component initialized with:", {
|
|
30856
|
-
lineIds,
|
|
30857
|
-
lineNames,
|
|
30858
|
-
companyId,
|
|
30859
|
-
totalLines: lineIds.length
|
|
30860
|
-
});
|
|
30861
30558
|
const initialLineWorkspaces = useMemo(() => {
|
|
30862
30559
|
return lineIds.reduce((acc, lineId) => ({
|
|
30863
30560
|
...acc,
|
|
@@ -31169,9 +30866,7 @@ var TargetsView = ({
|
|
|
31169
30866
|
continue;
|
|
31170
30867
|
}
|
|
31171
30868
|
try {
|
|
31172
|
-
console.log(`[TargetsView] Fetching workspaces for line: ${lineId}`);
|
|
31173
30869
|
const fetchedLineWorkspacesData = await workspaceService.getWorkspaces(lineId);
|
|
31174
|
-
console.log(`[TargetsView] Retrieved ${fetchedLineWorkspacesData.length} workspaces for line ${lineId}`);
|
|
31175
30870
|
const mappedWorkspaces = fetchedLineWorkspacesData.map((ws) => ({
|
|
31176
30871
|
id: ws.id,
|
|
31177
30872
|
name: ws.workspace_id,
|
|
@@ -32466,4 +32161,4 @@ var S3Service = class {
|
|
|
32466
32161
|
}
|
|
32467
32162
|
};
|
|
32468
32163
|
|
|
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,
|
|
32164
|
+
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 };
|