@optifye/dashboard-core 6.9.5 → 6.9.6

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.js CHANGED
@@ -9603,8 +9603,13 @@ var getAllWorkspaceDisplayNamesAsync = async (companyId, lineId) => {
9603
9603
  return { ...runtimeWorkspaceDisplayNames[lineId] };
9604
9604
  }
9605
9605
  const allNames = {};
9606
- Object.values(runtimeWorkspaceDisplayNames).forEach((lineNames) => {
9607
- Object.assign(allNames, lineNames);
9606
+ Object.entries(runtimeWorkspaceDisplayNames).forEach(([lineId2, lineNames]) => {
9607
+ Object.entries(lineNames).forEach(([workspaceId, displayName]) => {
9608
+ allNames[`${lineId2}_${workspaceId}`] = displayName;
9609
+ if (!allNames[workspaceId]) {
9610
+ allNames[workspaceId] = displayName;
9611
+ }
9612
+ });
9608
9613
  });
9609
9614
  return allNames;
9610
9615
  };
@@ -24729,7 +24734,11 @@ var VideoGridView = React23__namespace.default.memo(({
24729
24734
  isVeryLowEfficiency,
24730
24735
  cropping: workspaceCropping,
24731
24736
  canvasFps: canvasConfig?.fps,
24732
- displayName: displayNames[workspace.workspace_name] || workspace.workspace_name,
24737
+ displayName: (
24738
+ // Create line-aware lookup key: lineId_workspaceName
24739
+ // This ensures correct mapping when multiple lines have same workspace names
24740
+ displayNames[`${workspace.line_id}_${workspace.workspace_name}`] || displayNames[workspace.workspace_name] || getWorkspaceDisplayName(workspace.workspace_name, workspace.line_id)
24741
+ ),
24733
24742
  useRAF: canvasConfig?.useRAF,
24734
24743
  compact: !selectedLine,
24735
24744
  onMouseEnter: onWorkspaceHover ? () => onWorkspaceHover(workspaceId) : void 0,
@@ -24778,7 +24787,7 @@ var MapGridView = React23__namespace.default.memo(({
24778
24787
  efficiency: workspace.efficiency,
24779
24788
  action_count: workspace.action_count
24780
24789
  });
24781
- const displayName = displayNames[workspace.workspace_name] || getWorkspaceDisplayName(workspace.workspace_name, workspace.line_id);
24790
+ const displayName = displayNames[`${workspace.line_id}_${workspace.workspace_name}`] || displayNames[workspace.workspace_name] || getWorkspaceDisplayName(workspace.workspace_name, workspace.line_id);
24782
24791
  const navParams = getWorkspaceNavigationParams(workspaceId, displayName, workspace.line_id);
24783
24792
  router$1.push(`/workspace/${workspaceId}${navParams}`);
24784
24793
  }, [router$1, displayNames]);
@@ -24807,7 +24816,7 @@ var MapGridView = React23__namespace.default.memo(({
24807
24816
  if (!workspace) return null;
24808
24817
  const workspaceId = workspace.workspace_uuid || workspace.workspace_name;
24809
24818
  getPerformanceColor(workspace.efficiency);
24810
- const workspaceDisplayName = displayNames[workspace.workspace_name] || getWorkspaceDisplayName(workspace.workspace_name, workspace.line_id);
24819
+ const workspaceDisplayName = displayNames[`${workspace.line_id}_${workspace.workspace_name}`] || displayNames[workspace.workspace_name] || getWorkspaceDisplayName(workspace.workspace_name, workspace.line_id);
24811
24820
  return /* @__PURE__ */ jsxRuntime.jsx(
24812
24821
  motion.div,
24813
24822
  {
@@ -41537,11 +41546,12 @@ function HomeView({
41537
41546
  };
41538
41547
  initDisplayNames();
41539
41548
  }, [selectedLineId, factoryViewId, allLineIds]);
41549
+ const displayNameLineId = selectedLineId === factoryViewId ? void 0 : selectedLineId;
41540
41550
  const {
41541
41551
  displayNames: workspaceDisplayNames,
41542
41552
  loading: displayNamesLoading,
41543
41553
  error: displayNamesError
41544
- } = useWorkspaceDisplayNames(selectedLineId, void 0);
41554
+ } = useWorkspaceDisplayNames(displayNameLineId, void 0);
41545
41555
  React23.useCallback(() => {
41546
41556
  console.log("Refetching KPIs after line metrics update");
41547
41557
  }, []);
@@ -41905,7 +41915,7 @@ function HomeView({
41905
41915
  /* @__PURE__ */ jsxRuntime.jsx(SelectContent, { className: "z-50 bg-white shadow-lg border border-gray-200 rounded-md text-xs sm:text-sm", children: availableLineIds.map((id3) => /* @__PURE__ */ jsxRuntime.jsx(SelectItem, { value: id3, children: lineNames[id3] || (id3 === factoryViewId ? "All Lines" : `Line ${id3.substring(0, 4)}`) }, id3)) })
41906
41916
  ] });
41907
41917
  }, [availableLineIds, handleLineChange, selectedLineId, lineNames, factoryViewId, allLineIds.length]);
41908
- const isInitialLoading = !isHydrated || displayNamesLoading || !displayNamesInitialized && displayNamesLoading;
41918
+ const isInitialLoading = !isHydrated || displayNamesLoading || !displayNamesInitialized;
41909
41919
  const isDataLoading = metricsLoading || kpisLoading;
41910
41920
  if (isInitialLoading) {
41911
41921
  return /* @__PURE__ */ jsxRuntime.jsx(LoadingPageCmp, { message: "Loading Dashboard..." });
package/dist/index.mjs CHANGED
@@ -9573,8 +9573,13 @@ var getAllWorkspaceDisplayNamesAsync = async (companyId, lineId) => {
9573
9573
  return { ...runtimeWorkspaceDisplayNames[lineId] };
9574
9574
  }
9575
9575
  const allNames = {};
9576
- Object.values(runtimeWorkspaceDisplayNames).forEach((lineNames) => {
9577
- Object.assign(allNames, lineNames);
9576
+ Object.entries(runtimeWorkspaceDisplayNames).forEach(([lineId2, lineNames]) => {
9577
+ Object.entries(lineNames).forEach(([workspaceId, displayName]) => {
9578
+ allNames[`${lineId2}_${workspaceId}`] = displayName;
9579
+ if (!allNames[workspaceId]) {
9580
+ allNames[workspaceId] = displayName;
9581
+ }
9582
+ });
9578
9583
  });
9579
9584
  return allNames;
9580
9585
  };
@@ -24699,7 +24704,11 @@ var VideoGridView = React23__default.memo(({
24699
24704
  isVeryLowEfficiency,
24700
24705
  cropping: workspaceCropping,
24701
24706
  canvasFps: canvasConfig?.fps,
24702
- displayName: displayNames[workspace.workspace_name] || workspace.workspace_name,
24707
+ displayName: (
24708
+ // Create line-aware lookup key: lineId_workspaceName
24709
+ // This ensures correct mapping when multiple lines have same workspace names
24710
+ displayNames[`${workspace.line_id}_${workspace.workspace_name}`] || displayNames[workspace.workspace_name] || getWorkspaceDisplayName(workspace.workspace_name, workspace.line_id)
24711
+ ),
24703
24712
  useRAF: canvasConfig?.useRAF,
24704
24713
  compact: !selectedLine,
24705
24714
  onMouseEnter: onWorkspaceHover ? () => onWorkspaceHover(workspaceId) : void 0,
@@ -24748,7 +24757,7 @@ var MapGridView = React23__default.memo(({
24748
24757
  efficiency: workspace.efficiency,
24749
24758
  action_count: workspace.action_count
24750
24759
  });
24751
- const displayName = displayNames[workspace.workspace_name] || getWorkspaceDisplayName(workspace.workspace_name, workspace.line_id);
24760
+ const displayName = displayNames[`${workspace.line_id}_${workspace.workspace_name}`] || displayNames[workspace.workspace_name] || getWorkspaceDisplayName(workspace.workspace_name, workspace.line_id);
24752
24761
  const navParams = getWorkspaceNavigationParams(workspaceId, displayName, workspace.line_id);
24753
24762
  router.push(`/workspace/${workspaceId}${navParams}`);
24754
24763
  }, [router, displayNames]);
@@ -24777,7 +24786,7 @@ var MapGridView = React23__default.memo(({
24777
24786
  if (!workspace) return null;
24778
24787
  const workspaceId = workspace.workspace_uuid || workspace.workspace_name;
24779
24788
  getPerformanceColor(workspace.efficiency);
24780
- const workspaceDisplayName = displayNames[workspace.workspace_name] || getWorkspaceDisplayName(workspace.workspace_name, workspace.line_id);
24789
+ const workspaceDisplayName = displayNames[`${workspace.line_id}_${workspace.workspace_name}`] || displayNames[workspace.workspace_name] || getWorkspaceDisplayName(workspace.workspace_name, workspace.line_id);
24781
24790
  return /* @__PURE__ */ jsx(
24782
24791
  motion.div,
24783
24792
  {
@@ -41507,11 +41516,12 @@ function HomeView({
41507
41516
  };
41508
41517
  initDisplayNames();
41509
41518
  }, [selectedLineId, factoryViewId, allLineIds]);
41519
+ const displayNameLineId = selectedLineId === factoryViewId ? void 0 : selectedLineId;
41510
41520
  const {
41511
41521
  displayNames: workspaceDisplayNames,
41512
41522
  loading: displayNamesLoading,
41513
41523
  error: displayNamesError
41514
- } = useWorkspaceDisplayNames(selectedLineId, void 0);
41524
+ } = useWorkspaceDisplayNames(displayNameLineId, void 0);
41515
41525
  useCallback(() => {
41516
41526
  console.log("Refetching KPIs after line metrics update");
41517
41527
  }, []);
@@ -41875,7 +41885,7 @@ function HomeView({
41875
41885
  /* @__PURE__ */ jsx(SelectContent, { className: "z-50 bg-white shadow-lg border border-gray-200 rounded-md text-xs sm:text-sm", children: availableLineIds.map((id3) => /* @__PURE__ */ jsx(SelectItem, { value: id3, children: lineNames[id3] || (id3 === factoryViewId ? "All Lines" : `Line ${id3.substring(0, 4)}`) }, id3)) })
41876
41886
  ] });
41877
41887
  }, [availableLineIds, handleLineChange, selectedLineId, lineNames, factoryViewId, allLineIds.length]);
41878
- const isInitialLoading = !isHydrated || displayNamesLoading || !displayNamesInitialized && displayNamesLoading;
41888
+ const isInitialLoading = !isHydrated || displayNamesLoading || !displayNamesInitialized;
41879
41889
  const isDataLoading = metricsLoading || kpisLoading;
41880
41890
  if (isInitialLoading) {
41881
41891
  return /* @__PURE__ */ jsx(LoadingPageCmp, { message: "Loading Dashboard..." });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@optifye/dashboard-core",
3
- "version": "6.9.5",
3
+ "version": "6.9.6",
4
4
  "description": "Reusable UI & logic for Optifye dashboard",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",