diff --git a/gui/.dockerignore b/gui/.dockerignore index 9414382..ae89e39 100644 --- a/gui/.dockerignore +++ b/gui/.dockerignore @@ -1 +1,6 @@ -Dockerfile +**/node_modules +**/dist +/gerrit +/licenses +.env* +!.env.docker diff --git a/gui/.env.development b/gui/.env.development deleted file mode 100644 index 8edc2f8..0000000 --- a/gui/.env.development +++ /dev/null @@ -1,3 +0,0 @@ -NODE_ENV=development -VITE_API_URL=http://localhost:3000 -VITE_API_URL=https://exz-nebulous-backend-staging-2003f98f736b.herokuapp.com diff --git a/gui/.env.docker b/gui/.env.docker new file mode 100644 index 0000000..6529b96 --- /dev/null +++ b/gui/.env.docker @@ -0,0 +1,2 @@ +VITE_API_URL=VITE_API_URL_PLACEHOLDER +CFSB_API_URL=CFSB_API_URL_PLACEHOLDER \ No newline at end of file diff --git a/gui/.gitignore b/gui/.gitignore index e0c3de1..6dc0973 100644 --- a/gui/.gitignore +++ b/gui/.gitignore @@ -6,7 +6,7 @@ yarn-debug.log* yarn-error.log* pnpm-debug.log* lerna-debug.log* - +/*.env.* node_modules dist dist-ssr @@ -24,4 +24,7 @@ dist-ssr # we are using pnpm-lock.yaml package-lock.json -yarn.lock \ No newline at end of file +yarn.lock +/gerrit + +!.env.docker diff --git a/gui/.nvmrc b/gui/.nvmrc new file mode 100644 index 0000000..67d2ffe --- /dev/null +++ b/gui/.nvmrc @@ -0,0 +1 @@ +v20.13.1 \ No newline at end of file diff --git a/gui/Dockerfile b/gui/Dockerfile index b0365c2..5dd7ece 100644 --- a/gui/Dockerfile +++ b/gui/Dockerfile @@ -1,4 +1,19 @@ -FROM docker.io/library/node:21.4.0-bookworm -COPY . /app +# Build the Vue app +FROM node:20 as build-stage WORKDIR /app -RUN corepack enable pnpm && pnpm install && npx vue-tsc +COPY package*.json ./ +COPY .env.docker ./.env + +RUN npm install +COPY ./ . +RUN npm run build + +# Copy the compiled app in an NGINX contaier +FROM nginx:alpine as production-stage +RUN mkdir /app +COPY --from=build-stage /app/dist /usr/share/nginx/html + +# Executing the script at container runtime +COPY set_env.sh /docker-entrypoint.d/ +RUN chmod +x /docker-entrypoint.d/set_env.sh + diff --git a/gui/package.json b/gui/package.json index 14435b1..4ecec78 100644 --- a/gui/package.json +++ b/gui/package.json @@ -3,7 +3,7 @@ "private": true, "version": "0.0.0", "engines": { - "node": "v21.4.0" + "node": "v20.9.0" }, "scripts": { "serve": "vite", diff --git a/gui/set_env.sh b/gui/set_env.sh new file mode 100644 index 0000000..a36f127 --- /dev/null +++ b/gui/set_env.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +ROOT_DIR=/usr/share/nginx/html + +# Replace env vars in files served by NGINX +for file in $ROOT_DIR/assets/*.js* $ROOT_DIR/index.html; +do + echo "Setting VITE_API_URL_PLACEHOlDER environment variables ${VITE_API_URL}" + sed -i 's|VITE_API_URL_PLACEHOLDER|'${VITE_API_URL}'|g' $file + + echo "Setting CFSB_API_URL_PLACEHOLDER environment variables ${CFSB_API_URL}" + sed -i 's|CFSB_API_URL_PLACEHOLDER|'${CFSB_API_URL}'|g' $file + # Your other variables here... +done + + +exec "$@" \ No newline at end of file diff --git a/gui/src/components/Application/Details.vue b/gui/src/components/Application/Details.vue index d9fcd88..1d0e777 100644 --- a/gui/src/components/Application/Details.vue +++ b/gui/src/components/Application/Details.vue @@ -129,7 +129,7 @@ v-model="env.name" type="text" :class="{ - 'input--invalid': v.name?.$error || hasBackendError(`env[${index}].name`) + 'input--invalid': v.name?.$error || hasBackendError(`environmentVariables[${index}].name`) }" /> @@ -142,7 +142,7 @@ v-model="env.value" :type="env.secret ==true ? 'password' : 'text' " :class="{ - 'input--invalid': v.value?.$error || hasBackendError(`env[${index}].value`) + 'input--invalid': v.value?.$error || hasBackendError(`environmentVariables[${index}].value`) }" /> @@ -150,7 +150,11 @@ - + diff --git a/gui/src/components/Application/Metrics/index.vue b/gui/src/components/Application/Metrics/index.vue index af7fcd3..708b298 100644 --- a/gui/src/components/Application/Metrics/index.vue +++ b/gui/src/components/Application/Metrics/index.vue @@ -3,7 +3,8 @@ -
diff --git a/gui/src/components/Application/Resources.vue b/gui/src/components/Application/Resources.vue index 043e796..26f6b46 100644 --- a/gui/src/components/Application/Resources.vue +++ b/gui/src/components/Application/Resources.vue @@ -62,6 +62,7 @@ const resources = computed>(() => uuid: resource.uuid, title: resource.title, platform: resource.platform.title, + regions: resource.regions, enabled: isEnabled } }) diff --git a/gui/src/components/Modal/ResourceCreation.vue b/gui/src/components/Modal/ResourceCreation.vue index 9c16944..280c490 100644 --- a/gui/src/components/Modal/ResourceCreation.vue +++ b/gui/src/components/Modal/ResourceCreation.vue @@ -33,6 +33,7 @@ const resourceData = reactive({ platform: {"uuid":'','title':''} as IPlatform, _platform: [{"uuid":'','title':''} as IPlatform], // TODO Remove this securityGroup:"", + regions:"", subnet:"", endpoint:"", identityVersion:"", diff --git a/gui/src/components/Modal/ResourceForm.vue b/gui/src/components/Modal/ResourceForm.vue index e7e4920..40db4e2 100644 --- a/gui/src/components/Modal/ResourceForm.vue +++ b/gui/src/components/Modal/ResourceForm.vue @@ -1,11 +1,12 @@ diff --git a/gui/src/interfaces/resources.interface.ts b/gui/src/interfaces/resources.interface.ts index 6c83629..9a634c1 100644 --- a/gui/src/interfaces/resources.interface.ts +++ b/gui/src/interfaces/resources.interface.ts @@ -18,6 +18,7 @@ export interface ICredentials{ export interface IResource { uuid: string title: string + regions: string securityGroup: string subnet: string endpoint: string @@ -35,6 +36,7 @@ export interface IAppResource { uuid: string title: string platform: string + regions: string enabled: boolean } diff --git a/gui/src/store/modules/resources.ts b/gui/src/store/modules/resources.ts index dfc7cfb..659015c 100644 --- a/gui/src/store/modules/resources.ts +++ b/gui/src/store/modules/resources.ts @@ -26,7 +26,14 @@ export const useResourceStore = defineStore("resource", { }, async getAllResources(): Promise> { this.platforms = await this.getPlatforms() - this.resources = await resourceService.getAllResources() + let resources = await resourceService.getAllResources() + + resources.results.forEach((r)=>{ + if(!r.regions){ + r.regions = '' + } + }) + this.resources = resources return this.resources }, async getAllNodeCandidate(uuid:string): Promise> {