@geode/opengeodeweb-front 10.29.0-rc.2 → 10.29.0-rc.4

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.
@@ -19,7 +19,7 @@ const hybridViewerStore = useHybridViewerStore();
19
19
  const blocksVisibility = computed({
20
20
  get: () => dataStyleStore.modelComponentTypeVisibility(modelId, "Block"),
21
21
  set: async (newValue) => {
22
- await dataStyleStore.setModelComponentTypeVisibility(modelId, "Block", newValue);
22
+ await dataStyleStore.setModelBlocksVisibility(modelId, targetBlockIds, newValue);
23
23
  hybridViewerStore.remoteRender();
24
24
  },
25
25
  });
@@ -36,7 +36,7 @@ const blockVisibility = computed({
36
36
  const blocksColor = computed({
37
37
  get: () => dataStyleStore.modelComponentTypeColor(modelId, "Block"),
38
38
  set: async (color) => {
39
- await dataStyleStore.setModelComponentTypeColor(modelId, "Block", color);
39
+ await dataStyleStore.setModelBlocksColor(modelId, targetBlockIds, color);
40
40
  hybridViewerStore.remoteRender();
41
41
  },
42
42
  });
@@ -52,7 +52,7 @@ const blockColor = computed({
52
52
  const blocksActiveColoring = computed({
53
53
  get: () => dataStyleStore.getModelComponentTypeActiveColoring(modelId, "Block"),
54
54
  set: async (coloringType) => {
55
- await dataStyleStore.setModelComponentTypeActiveColoring(modelId, "Block", coloringType);
55
+ await dataStyleStore.setModelBlocksActiveColoring(modelId, targetBlockIds, coloringType);
56
56
  hybridViewerStore.remoteRender();
57
57
  },
58
58
  });
@@ -13,14 +13,13 @@ const { modelId, cornerId, targetCornerIds } = defineProps({
13
13
  });
14
14
 
15
15
  const dataStyleStore = useDataStyleStore();
16
- console.log("CornersOptions setup!");
17
16
  const hybridViewerStore = useHybridViewerStore();
18
17
 
19
18
  // Visibility
20
19
  const cornersVisibility = computed({
21
20
  get: () => dataStyleStore.modelComponentTypeVisibility(modelId, "Corner"),
22
21
  set: async (newValue) => {
23
- await dataStyleStore.setModelComponentTypeVisibility(modelId, "Corner", newValue);
22
+ await dataStyleStore.setModelCornersVisibility(modelId, targetCornerIds, newValue);
24
23
  hybridViewerStore.remoteRender();
25
24
  },
26
25
  });
@@ -37,7 +36,7 @@ const cornerVisibility = computed({
37
36
  const cornersColor = computed({
38
37
  get: () => dataStyleStore.modelComponentTypeColor(modelId, "Corner"),
39
38
  set: async (color) => {
40
- await dataStyleStore.setModelComponentTypeColor(modelId, "Corner", color);
39
+ await dataStyleStore.setModelCornersColor(modelId, targetCornerIds, color);
41
40
  hybridViewerStore.remoteRender();
42
41
  },
43
42
  });
@@ -53,7 +52,7 @@ const cornerColor = computed({
53
52
  const cornersActiveColoring = computed({
54
53
  get: () => dataStyleStore.getModelComponentTypeActiveColoring(modelId, "Corner"),
55
54
  set: async (coloringType) => {
56
- await dataStyleStore.setModelComponentTypeActiveColoring(modelId, "Corner", coloringType);
55
+ await dataStyleStore.setModelCornersActiveColoring(modelId, targetCornerIds, coloringType);
57
56
  hybridViewerStore.remoteRender();
58
57
  },
59
58
  });
@@ -19,7 +19,7 @@ const hybridViewerStore = useHybridViewerStore();
19
19
  const linesVisibility = computed({
20
20
  get: () => dataStyleStore.modelComponentTypeVisibility(modelId, "Line"),
21
21
  set: async (newValue) => {
22
- await dataStyleStore.setModelComponentTypeVisibility(modelId, "Line", newValue);
22
+ await dataStyleStore.setModelLinesVisibility(modelId, targetLineIds, newValue);
23
23
  hybridViewerStore.remoteRender();
24
24
  },
25
25
  });
@@ -36,7 +36,7 @@ const lineVisibility = computed({
36
36
  const linesColor = computed({
37
37
  get: () => dataStyleStore.modelComponentTypeColor(modelId, "Line"),
38
38
  set: async (color) => {
39
- await dataStyleStore.setModelComponentTypeColor(modelId, "Line", color);
39
+ await dataStyleStore.setModelLinesColor(modelId, targetLineIds, color);
40
40
  hybridViewerStore.remoteRender();
41
41
  },
42
42
  });
@@ -52,7 +52,7 @@ const lineColor = computed({
52
52
  const linesActiveColoring = computed({
53
53
  get: () => dataStyleStore.getModelComponentTypeActiveColoring(modelId, "Line"),
54
54
  set: async (coloringType) => {
55
- await dataStyleStore.setModelComponentTypeActiveColoring(modelId, "Line", coloringType);
55
+ await dataStyleStore.setModelLinesActiveColoring(modelId, targetLineIds, coloringType);
56
56
  hybridViewerStore.remoteRender();
57
57
  },
58
58
  });
@@ -63,9 +63,13 @@ watch(
63
63
 
64
64
  const targetComponentIds = ref([]);
65
65
  watch(
66
- () => [modelId.value, componentType.value],
66
+ () => [modelId.value, componentType.value, itemProps.meta_data.targetComponentIds],
67
67
  async () => {
68
68
  targetComponentIds.value = [];
69
+ if (itemProps.meta_data.targetComponentIds) {
70
+ targetComponentIds.value = itemProps.meta_data.targetComponentIds;
71
+ return;
72
+ }
69
73
  if (componentType.value && modelId.value) {
70
74
  const currentModelId = modelId.value;
71
75
  const currentType = componentType.value;
@@ -19,7 +19,7 @@ const hybridViewerStore = useHybridViewerStore();
19
19
  const surfacesVisibility = computed({
20
20
  get: () => dataStyleStore.modelComponentTypeVisibility(modelId, "Surface"),
21
21
  set: async (newValue) => {
22
- await dataStyleStore.setModelComponentTypeVisibility(modelId, "Surface", newValue);
22
+ await dataStyleStore.setModelSurfacesVisibility(modelId, targetSurfaceIds, newValue);
23
23
  hybridViewerStore.remoteRender();
24
24
  },
25
25
  });
@@ -36,7 +36,7 @@ const surfaceVisibility = computed({
36
36
  const surfacesColor = computed({
37
37
  get: () => dataStyleStore.modelComponentTypeColor(modelId, "Surface"),
38
38
  set: async (color) => {
39
- await dataStyleStore.setModelComponentTypeColor(modelId, "Surface", color);
39
+ await dataStyleStore.setModelSurfacesColor(modelId, targetSurfaceIds, color);
40
40
  hybridViewerStore.remoteRender();
41
41
  },
42
42
  });
@@ -52,7 +52,7 @@ const surfaceColor = computed({
52
52
  const surfacesActiveColoring = computed({
53
53
  get: () => dataStyleStore.getModelComponentTypeActiveColoring(modelId, "Surface"),
54
54
  set: async (coloringType) => {
55
- await dataStyleStore.setModelComponentTypeActiveColoring(modelId, "Surface", coloringType);
55
+ await dataStyleStore.setModelSurfacesActiveColoring(modelId, targetSurfaceIds, coloringType);
56
56
  hybridViewerStore.remoteRender();
57
57
  },
58
58
  });
@@ -79,7 +79,7 @@ const itemsForTreeView = computed(() => {
79
79
  for (const category of filteredCategories.value) {
80
80
  result.push({
81
81
  ...category,
82
- children: sortAndFormatItems(componentsCache.value?.[category.id], sortType.value),
82
+ children: sortAndFormatItems(componentsCache.value[category.id], sortType.value),
83
83
  });
84
84
  }
85
85
  return result;
@@ -87,12 +87,16 @@ const itemsForTreeView = computed(() => {
87
87
 
88
88
  function showContextMenu(event, item) {
89
89
  const actualItem = item.raw || item;
90
+ const typeId = actualItem.category || actualItem.id;
91
+ const typeItem = itemsForTreeView.value.find((type) => type.id === typeId);
92
+ const targetComponentIds = typeItem ? typeItem.children.map((child) => child.id) : undefined;
90
93
  emit("show-menu", {
91
94
  event,
92
95
  itemId: actualItem.category ? actualItem.id : id,
93
96
  context_type: actualItem.category ? "model_component" : "model_component_type",
94
97
  modelId: id,
95
98
  modelComponentType: actualItem.category ? undefined : actualItem.id,
99
+ targetComponentIds,
96
100
  });
97
101
  }
98
102
 
@@ -108,7 +112,7 @@ function handleHoverEnter({ item, immediate = false }) {
108
112
  () =>
109
113
  actualItem.category
110
114
  ? [actualItem.viewer_id]
111
- : actualItem.children?.map((child) => child.viewer_id) || [],
115
+ : actualItem.children.map((child) => child.viewer_id),
112
116
  "model",
113
117
  immediate,
114
118
  );
@@ -13,6 +13,7 @@ import { executablePath } from "./path.js";
13
13
 
14
14
  const MILLISECONDS_PER_SECOND = 1000;
15
15
  const DEFAULT_TIMEOUT_SECONDS = 45;
16
+ const MAX_PORT_RETRIES = 1;
16
17
 
17
18
  async function runScript(
18
19
  execPath,
@@ -51,7 +52,11 @@ async function runScript(
51
52
  }
52
53
  }
53
54
 
54
- async function runBack(execName, execPath, args = {}) {
55
+ function isPortInUseError(errorMessage) {
56
+ return /EADDRINUSE|address already in use|port already in use/iu.test(errorMessage);
57
+ }
58
+
59
+ async function runBack(execName, execPath, args = {}, attempts = 0) {
55
60
  const { projectFolderPath } = args;
56
61
  if (!projectFolderPath) {
57
62
  throw new Error("projectFolderPath is required");
@@ -60,44 +65,68 @@ async function runBack(execName, execPath, args = {}) {
60
65
  if (!uploadFolderPath) {
61
66
  uploadFolderPath = path.join(projectFolderPath, "uploads");
62
67
  }
63
- const port = await getAvailablePort();
64
- const backArgs = [
65
- "--port",
66
- String(port),
67
- "--project_folder_path",
68
- projectFolderPath,
69
- "--upload_folder_path",
70
- uploadFolderPath,
71
- "--allowed_origins",
72
- "http://localhost:*",
73
- "--timeout",
74
- "0",
75
- ];
76
- if (process.env.NODE_ENV === "development" || !process.env.NODE_ENV) {
77
- backArgs.push("--debug");
68
+ try {
69
+ const port = await getAvailablePort();
70
+ const backArgs = [
71
+ "--port",
72
+ String(port),
73
+ "--project_folder_path",
74
+ projectFolderPath,
75
+ "--upload_folder_path",
76
+ uploadFolderPath,
77
+ "--allowed_origins",
78
+ "http://localhost:*",
79
+ "--timeout",
80
+ "0",
81
+ ];
82
+ if (process.env.NODE_ENV === "development" || !process.env.NODE_ENV) {
83
+ backArgs.push("--debug");
84
+ }
85
+ console.log("runBack", execPath, execName, backArgs);
86
+ await runScript(execPath, execName, backArgs, "Serving Flask app");
87
+ return port;
88
+ } catch (error) {
89
+ if (!isPortInUseError(error)) {
90
+ console.log("runBack error", error);
91
+ throw error;
92
+ }
93
+ if (attempts <= MAX_PORT_RETRIES) {
94
+ console.log("Retrying runBack on conflicting port", port);
95
+ const port = await runBack(execName, execPath, args, attempts + 1);
96
+ return port;
97
+ }
78
98
  }
79
- console.log("runBack", execPath, execName, backArgs);
80
- await runScript(execPath, execName, backArgs, "Serving Flask app");
81
- return port;
82
99
  }
83
100
 
84
- async function runViewer(execName, execPath, args = {}) {
101
+ async function runViewer(execName, execPath, args = {}, attempts = 0) {
85
102
  const { projectFolderPath } = args;
86
103
  if (!projectFolderPath) {
87
104
  throw new Error("projectFolderPath is required");
88
105
  }
89
- const port = await getAvailablePort();
90
- const viewerArgs = [
91
- "--port",
92
- String(port),
93
- "--project_folder_path",
94
- projectFolderPath,
95
- "--timeout",
96
- "0",
97
- ];
98
- console.log("runViewer", execPath, execName, viewerArgs);
99
- await runScript(execPath, execName, viewerArgs, "Starting factory");
100
- return port;
106
+ try {
107
+ const port = await getAvailablePort();
108
+ const viewerArgs = [
109
+ "--port",
110
+ String(port),
111
+ "--project_folder_path",
112
+ projectFolderPath,
113
+ "--timeout",
114
+ "0",
115
+ ];
116
+ console.log("runViewer", execPath, execName, viewerArgs);
117
+ await runScript(execPath, execName, viewerArgs, "Starting factory");
118
+ return port;
119
+ } catch (error) {
120
+ if (!isPortInUseError(error)) {
121
+ console.log("runBack error", error);
122
+ throw error;
123
+ }
124
+ if (attempts <= MAX_PORT_RETRIES) {
125
+ console.log("Retrying runViewer on conflicting port", port);
126
+ const port = await runViewer(execName, execPath, args, attempts + 1);
127
+ return port;
128
+ }
129
+ }
101
130
  }
102
131
 
103
132
  function addMicroserviceMetadatas(projectFolderPath, serviceObj) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geode/opengeodeweb-front",
3
- "version": "10.29.0-rc.2",
3
+ "version": "10.29.0-rc.4",
4
4
  "description": "OpenSource Vue/Nuxt/Pinia/Vuetify framework for web applications",
5
5
  "homepage": "https://github.com/Geode-solutions/OpenGeodeWeb-Front",
6
6
  "bugs": {