From 6f6d04d2a3ed9ca5260c5e8e11a8f536fd5e4ed9 Mon Sep 17 00:00:00 2001 From: Anne Haley Date: Thu, 12 Sep 2024 19:35:51 +0000 Subject: [PATCH] feat: add version tag to toolbar in UI --- docker-compose.override.yml | 1 + web/package-lock.json | 53 +++++++++++++++++++++++++++++++++++++ web/package.json | 1 + web/src/App.vue | 9 ++++++- web/vue.config.js | 4 +++ 5 files changed, 67 insertions(+), 1 deletion(-) diff --git a/docker-compose.override.yml b/docker-compose.override.yml index b44c8239..55e4e352 100644 --- a/docker-compose.override.yml +++ b/docker-compose.override.yml @@ -54,6 +54,7 @@ services: working_dir: /web volumes: - ./web:/web + - ./.git:/web/.git # allow fetching version tag ports: - 8080:8080 environment: diff --git a/web/package-lock.json b/web/package-lock.json index d4e64a89..8350043a 100644 --- a/web/package-lock.json +++ b/web/package-lock.json @@ -14,6 +14,7 @@ "axios": "^1.4.0", "buffer": "^6.0.3", "core-js": "^3.8.3", + "git-describe": "^4.1.1", "lodash": "^4.17.21", "maplibre-gl": "^4.6.0", "shpjs": "^4.0.4", @@ -4373,6 +4374,11 @@ "integrity": "sha512-wWKOClTTiizcZhXnPY4wikVAwmdYHp8q6DmC+EJUzAMsycb7HB32Kh9RN4+0gExjmPmZSAQjgURXIGATPegAvA==", "dev": true }, + "node_modules/@types/semver": { + "version": "7.5.8", + "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.8.tgz", + "integrity": "sha512-I8EUhyrgfLrcTkzV3TSsGyl1tSuPrEDzr0yd5m90UgNxQkyDXULk3b6MlQqTCpZpNtWe1K0hzclnZkTcLBe2UQ==" + }, "node_modules/@types/send": { "version": "0.17.1", "resolved": "https://registry.npmjs.org/@types/send/-/send-0.17.1.tgz", @@ -9290,6 +9296,30 @@ "node": ">=0.10.0" } }, + "node_modules/git-describe": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/git-describe/-/git-describe-4.1.1.tgz", + "integrity": "sha512-JC8ganO5kO80G8+XE98TDDjnMXQN3Estk3qdJuG2EGRF/l6zuMTMcN+8OSfQZ5FWpqIRLB015anWX4aSRgnxAQ==", + "dependencies": { + "@types/semver": "^7.3.8", + "lodash": "^4.17.21" + }, + "engines": { + "node": ">=4.0.0" + }, + "optionalDependencies": { + "semver": "^5.6.0" + } + }, + "node_modules/git-describe/node_modules/semver": { + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", + "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", + "optional": true, + "bin": { + "semver": "bin/semver" + } + }, "node_modules/gl-matrix": { "version": "3.4.3", "resolved": "https://registry.npmjs.org/gl-matrix/-/gl-matrix-3.4.3.tgz", @@ -18587,6 +18617,11 @@ "integrity": "sha512-wWKOClTTiizcZhXnPY4wikVAwmdYHp8q6DmC+EJUzAMsycb7HB32Kh9RN4+0gExjmPmZSAQjgURXIGATPegAvA==", "dev": true }, + "@types/semver": { + "version": "7.5.8", + "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.8.tgz", + "integrity": "sha512-I8EUhyrgfLrcTkzV3TSsGyl1tSuPrEDzr0yd5m90UgNxQkyDXULk3b6MlQqTCpZpNtWe1K0hzclnZkTcLBe2UQ==" + }, "@types/send": { "version": "0.17.1", "resolved": "https://registry.npmjs.org/@types/send/-/send-0.17.1.tgz", @@ -22223,6 +22258,24 @@ "resolved": "https://registry.npmjs.org/get-value/-/get-value-2.0.6.tgz", "integrity": "sha512-Ln0UQDlxH1BapMu3GPtf7CuYNwRZf2gwCuPqbyG6pB8WfmFpzqcy4xtAaAMUhnNqjMKTiCPZG2oMT3YSx8U2NA==" }, + "git-describe": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/git-describe/-/git-describe-4.1.1.tgz", + "integrity": "sha512-JC8ganO5kO80G8+XE98TDDjnMXQN3Estk3qdJuG2EGRF/l6zuMTMcN+8OSfQZ5FWpqIRLB015anWX4aSRgnxAQ==", + "requires": { + "@types/semver": "^7.3.8", + "lodash": "^4.17.21", + "semver": "^5.6.0" + }, + "dependencies": { + "semver": { + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", + "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", + "optional": true + } + } + }, "gl-matrix": { "version": "3.4.3", "resolved": "https://registry.npmjs.org/gl-matrix/-/gl-matrix-3.4.3.tgz", diff --git a/web/package.json b/web/package.json index c6595f07..3d4d8468 100644 --- a/web/package.json +++ b/web/package.json @@ -15,6 +15,7 @@ "axios": "^1.4.0", "buffer": "^6.0.3", "core-js": "^3.8.3", + "git-describe": "^4.1.1", "lodash": "^4.17.21", "maplibre-gl": "^4.6.0", "shpjs": "^4.0.4", diff --git a/web/src/App.vue b/web/src/App.vue index 1fbf6a93..122f4e38 100644 --- a/web/src/App.vue +++ b/web/src/App.vue @@ -31,6 +31,7 @@ export default defineComponent({ setup() { const drawer = ref(true); const showError = computed(() => currentError.value !== undefined); + const version = process.env.VUE_APP_VERSION; function onReady() { if (currentUser.value) { @@ -49,6 +50,7 @@ export default defineComponent({ return { login, logout, + version, currentUser, drawer, currentProject, @@ -103,7 +105,12 @@ export default defineComponent({ @click.stop="drawer = !drawer" v-if="!projectConfigMode" /> - UVDAT + + UVDAT + + {{ version }} + +
{{ currentUser.first_name }} diff --git a/web/vue.config.js b/web/vue.config.js index 53891962..652f8d52 100644 --- a/web/vue.config.js +++ b/web/vue.config.js @@ -1,5 +1,9 @@ const { ProvidePlugin } = require("webpack"); +const { gitDescribeSync } = require("git-describe"); +const describe = gitDescribeSync(); +process.env.VUE_APP_VERSION = describe.dirty ? describe.raw : describe.tag; + module.exports = { transpileDependencies: true, configureWebpack: {