@geode/opengeodeweb-front 10.28.0-rc.1 → 10.28.0-rc.3

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.
@@ -1,17 +1,20 @@
1
1
  import { useInfraStore } from "@ogw_front/stores/infra";
2
2
 
3
- export function run_function_when_microservices_connected(function_to_run) {
3
+ export function runFunctionWhenMicroservicesConnected(functionToRun) {
4
4
  const infraStore = useInfraStore();
5
5
  const { microservices_connected } = storeToRefs(infraStore);
6
6
  console.log("inside microservices_connected", microservices_connected.value);
7
7
  if (microservices_connected.value) {
8
- function_to_run();
9
- } else {
10
- watch(microservices_connected, (value) => {
8
+ functionToRun();
9
+ }
10
+ watch(
11
+ microservices_connected,
12
+ (value) => {
11
13
  if (value) {
12
14
  console.log("watch microservices_connected", value);
13
- function_to_run();
15
+ functionToRun();
14
16
  }
15
- });
16
- }
17
+ },
18
+ { once: true },
19
+ );
17
20
  }
@@ -27,14 +27,14 @@ function extensionsConf(projectName) {
27
27
  return extensionsConfig;
28
28
  }
29
29
 
30
- function addExtensionToConf(projectName, { extensionID, extensionPath }) {
30
+ function addExtensionToConf(projectName, { extensionId, extensionPath }) {
31
31
  const projectConfig = projectConf(projectName);
32
- projectConfig.set(`extensions.${extensionID}.path`, extensionPath);
32
+ projectConfig.set(`extensions.${extensionId}.path`, extensionPath);
33
33
  }
34
34
 
35
- async function removeExtensionFromConf(projectName, extensionID) {
35
+ async function removeExtensionFromConf(projectName, extensionId) {
36
36
  const projectConfig = projectConf(projectName);
37
- const extensionArchivePath = extensionPathFromConf(projectName, extensionID);
37
+ const extensionArchivePath = extensionPathFromConf(projectName, extensionId);
38
38
 
39
39
  await unlink(extensionArchivePath, (error) => {
40
40
  if (error) {
@@ -42,13 +42,13 @@ async function removeExtensionFromConf(projectName, extensionID) {
42
42
  }
43
43
  console.log(`${extensionArchivePath} was deleted`);
44
44
  });
45
- projectConfig.delete(`extensions.${extensionID}`);
46
- console.log(`${extensionID} was deleted from ${projectName} config`);
45
+ projectConfig.delete(`extensions.${extensionId}`);
46
+ console.log(`${extensionId} was deleted from ${projectName} config`);
47
47
  }
48
48
 
49
- function extensionPathFromConf(projectName, extensionID) {
49
+ function extensionPathFromConf(projectName, extensionId) {
50
50
  const projectConfig = projectConf(projectName);
51
- return projectConfig.get(`extensions.${extensionID}.path`);
51
+ return projectConfig.get(`extensions.${extensionId}.path`);
52
52
  }
53
53
 
54
54
  export {
@@ -55,8 +55,8 @@ function generateProjectFolderPath(projectName) {
55
55
  return path.join(os.tmpdir(), projectName.replaceAll("/", "_"), uuidv4());
56
56
  }
57
57
 
58
- function extensionFolderPath(projectFolderPath, extensionID) {
59
- return path.join(projectFolderPath, "extensions", extensionID);
58
+ function extensionFolderPath(projectFolderPath, extensionId) {
59
+ return path.join(projectFolderPath, "extensions", extensionId);
60
60
  }
61
61
 
62
62
  async function lookForLocalExtensionDistPath(rootPath, extentionRepoName, frontendFile) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geode/opengeodeweb-front",
3
- "version": "10.28.0-rc.1",
3
+ "version": "10.28.0-rc.3",
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": {
@@ -23,7 +23,7 @@ export default defineEventHandler(async (event) => {
23
23
  });
24
24
  const authClient = await auth.getClient();
25
25
  const [routerImage, backImage, viewerImage] = await artifactImages(parent, authClient);
26
- const request = requestConfig(parent, routerImage, backImage, viewerImage);
26
+ const request = requestConfig(parent, routerImage, backImage, viewerImage, email);
27
27
  console.log({ request });
28
28
  const runClient = new ServicesClient({ authClient });
29
29
  const [operation] = await runClient.createService(request);
@@ -25,11 +25,11 @@ export default defineEventHandler(async (event) => {
25
25
  const extensionsConfig = extensionsConf(projectName);
26
26
 
27
27
  const extensionsArray = await Promise.all(
28
- Object.keys(extensionsConfig).map(async (extensionID) => {
29
- const extensionPath = extensionsConfig[extensionID].path;
28
+ Object.keys(extensionsConfig).map(async (extensionId) => {
29
+ const extensionPath = extensionsConfig[extensionId].path;
30
30
  const unzippedExtensionPath = await unzipFile(
31
31
  extensionPath,
32
- extensionFolderPath(projectFolderPath, extensionID),
32
+ extensionFolderPath(projectFolderPath, extensionId),
33
33
  );
34
34
  const metadataPath = path.join(unzippedExtensionPath, "metadata.json");
35
35
  const metadataContent = await fs.promises.readFile(metadataPath, "utf8");
@@ -83,7 +83,7 @@ export default defineEventHandler(async (event) => {
83
83
  const metadata = JSON.parse(metadataJson);
84
84
  const { id } = metadata;
85
85
  await addExtensionToConf(projectName, {
86
- extensionID: id,
86
+ extensionId: id,
87
87
  extensionPath: file,
88
88
  });
89
89
  }),
@@ -35,8 +35,16 @@ function artifactImages(parent, authClient) {
35
35
  ]);
36
36
  }
37
37
 
38
+ function sanitizeLabelValue(label) {
39
+ const maxLabelLength = 63;
40
+ return label
41
+ .toLowerCase()
42
+ .replaceAll(/[^a-z0-9_-]/gu, "_")
43
+ .slice(0, maxLabelLength);
44
+ }
45
+
38
46
  // oxlint-disable-next-line max-lines-per-function
39
- function requestConfig(parent, routerImage, backImage, viewerImage) {
47
+ function requestConfig(parent, routerImage, backImage, viewerImage, email, projectId) {
40
48
  const resources = {
41
49
  limits: {
42
50
  cpu: "1000m",
@@ -52,11 +60,19 @@ function requestConfig(parent, routerImage, backImage, viewerImage) {
52
60
  service: {
53
61
  ingress: "INGRESS_TRAFFIC_ALL",
54
62
  invokerIamDisabled: true,
63
+ labels: {
64
+ user: sanitizeLabelValue(email),
65
+ project: sanitizeLabelValue(projectId),
66
+ },
55
67
  scaling: {
56
68
  scalingMode: "MANUAL",
57
69
  manualInstanceCount: 1,
58
70
  },
59
71
  template: {
72
+ labels: {
73
+ user: sanitizeLabelValue(email),
74
+ project: sanitizeLabelValue(projectId),
75
+ },
60
76
  volumes: [
61
77
  {
62
78
  name: "project",
@@ -4,7 +4,7 @@ import { flushPromises } from "@vue/test-utils";
4
4
 
5
5
  // Local imports
6
6
  import { Status } from "@ogw_front/utils/status";
7
- import { run_function_when_microservices_connected } from "@ogw_front/composables/run_function_when_microservices_connected";
7
+ import { runFunctionWhenMicroservicesConnected } from "@ogw_front/composables/run_function_when_microservices_connected";
8
8
  import { setupActivePinia } from "@ogw_tests/utils";
9
9
  import { useBackStore } from "@ogw_front/stores/back";
10
10
  import { useInfraStore } from "@ogw_front/stores/infra";
@@ -40,7 +40,7 @@ describe("when_microservices_connected_run_function", () => {
40
40
 
41
41
  test("microservices not connected", () => {
42
42
  const spy = vi.spyOn(dumb_obj, "dumb_method");
43
- run_function_when_microservices_connected(dumb_obj.dumb_method);
43
+ runFunctionWhenMicroservicesConnected(dumb_obj.dumb_method);
44
44
  backStore.$patch({ status: Status.NOT_CONNECTED });
45
45
  viewerStore.$patch({ status: Status.NOT_CONNECTED });
46
46
  expect(spy).not.toHaveBeenCalled();
@@ -48,7 +48,7 @@ describe("when_microservices_connected_run_function", () => {
48
48
 
49
49
  test("microservices connected", async () => {
50
50
  const spy = vi.spyOn(dumb_obj, "dumb_method");
51
- run_function_when_microservices_connected(dumb_obj.dumb_method);
51
+ runFunctionWhenMicroservicesConnected(dumb_obj.dumb_method);
52
52
  backStore.$patch({ status: Status.CONNECTED });
53
53
  viewerStore.$patch({ status: Status.CONNECTED });
54
54
  await flushPromises();