From 1ddcfaffe9267b8161caa1bee111472c7df20d1a Mon Sep 17 00:00:00 2001 From: Thomas GRUSON Date: Wed, 7 Jul 2021 16:27:19 +0200 Subject: [PATCH] feat: add web-ui version (#460) * feat: add web-ui version * chore: add noopener on href target _blank --- .../templates/mail/html/nrt-cycle.html | 2 +- .../templates/mail/html/nrt-run.html | 4 +-- code/web-ui/Makefile | 12 +++------ code/web-ui/build/template/about.jq | 4 --- code/web-ui/config/index.js | 13 ++++++++-- code/web-ui/package-lock.json | 7 ++++- code/web-ui/package.json | 3 ++- .../src/components/error-debug-dropdown.vue | 15 ++++++----- code/web-ui/src/components/error-popups.vue | 7 +++-- .../components/execution-actions-button.vue | 26 +++++++++++-------- .../functionality-coverage-details.vue | 6 ++++- .../src/components/nrt-cycle-quality.vue | 5 +++- .../src/components/nrt-ignored-scenarios.vue | 11 +++++--- code/web-ui/src/components/nrt-run.vue | 16 ++++++++---- code/web-ui/src/components/top-menu.vue | 16 +++++++----- code/web-ui/src/main.js | 4 +++ code/web-ui/src/views/executions.vue | 2 +- .../src/views/functionality-cartography.vue | 2 +- code/web-ui/src/views/problem.vue | 6 ++++- code/web-ui/src/views/raw-executions.vue | 6 ++++- 20 files changed, 107 insertions(+), 60 deletions(-) delete mode 100644 code/web-ui/build/template/about.jq diff --git a/code/api/api/src/main/resources/templates/mail/html/nrt-cycle.html b/code/api/api/src/main/resources/templates/mail/html/nrt-cycle.html index 3884d98f4..3bf62f120 100644 --- a/code/api/api/src/main/resources/templates/mail/html/nrt-cycle.html +++ b/code/api/api/src/main/resources/templates/mail/html/nrt-cycle.html @@ -70,7 +70,7 @@ NO DATA ([[${#strings.toLowerCase(execution.status)}]]) ([[${#strings.toLowerCase(execution.result)}]]) - + SHOW LOGS diff --git a/code/api/api/src/main/resources/templates/mail/html/nrt-run.html b/code/api/api/src/main/resources/templates/mail/html/nrt-run.html index 972a1e135..32f4b4b88 100644 --- a/code/api/api/src/main/resources/templates/mail/html/nrt-run.html +++ b/code/api/api/src/main/resources/templates/mail/html/nrt-run.html @@ -42,7 +42,7 @@ ([[${#strings.toLowerCase(countryDeployment.status)}]]) ([[${#strings.toLowerCase(countryDeployment.result)}]]) - + SHOW LOGS @@ -51,7 +51,7 @@ No result (test failed to launch, initialize or report) - + SHOW LOGS diff --git a/code/web-ui/Makefile b/code/web-ui/Makefile index 0b210fa1f..1d3b625c7 100644 --- a/code/web-ui/Makefile +++ b/code/web-ui/Makefile @@ -3,6 +3,7 @@ ##################################### NODE_VERSION=12 +FULL_IMAGE?=decathlon/ara-web-ui ##################################### ## DEVELOP ## @@ -31,7 +32,7 @@ dkr-install: ## DEV - install project with docker dkr-run: ## DEV - run web-ui with docker @docker container run -it --name ara-web-ui --rm \ - --network="host" \ + -p 8081:8081 \ --user $(shell id -u):$(shell id -g) \ -v $${HOME}/.ara-web:/var/node:rw \ -e HOME=/var/node \ @@ -45,7 +46,7 @@ dkr-run: ## DEV - run web-ui with docker dkr-shell: ## Start a shell in docker node container @docker container run -it --rm --name ara-node-$(NODE_VERSION) \ - --network=host \ + -p 8081:8081 \ --user $(shell id -u):$(shell id -g) \ -v $${HOME}/.ara-web:/var/node:rw \ -e HOME=/var/node \ @@ -73,13 +74,6 @@ dkr-build: ## DEV - build web-ui with docker ##################################### dkr-build-image: - @mkdir -p static/version - @SHA=$(shell git rev-parse --short HEAD) && \ - WEB_VERSION=$(shell cat package.json | jq -r '.version') && \ - jq -n --arg version $$WEB_VERSION \ - --arg sha $$SHA \ - -f build/template/about.jq > \ - static/version/about.json @docker build -t $(FULL_IMAGE) . ##################################### diff --git a/code/web-ui/build/template/about.jq b/code/web-ui/build/template/about.jq deleted file mode 100644 index 854370f70..000000000 --- a/code/web-ui/build/template/about.jq +++ /dev/null @@ -1,4 +0,0 @@ -{ - version: $version, - sha: $sha -} diff --git a/code/web-ui/config/index.js b/code/web-ui/config/index.js index fbd1036cd..0eeceb67f 100644 --- a/code/web-ui/config/index.js +++ b/code/web-ui/config/index.js @@ -6,8 +6,17 @@ var araAPIPort = process.env.ARA_API_PORT || 8080 var araAPIURL = 'http://' + araAPIHost + ':' + araAPIPort -const development = { NODE_ENV: 'development' } -const production = { NODE_ENV: 'production' } +var PACKAGE = require('../package.json') +var version = PACKAGE.version + +const development = { + NODE_ENV: 'development', + VERSION: version +} +const production = { + NODE_ENV: 'production', + VERSION: version +} module.exports = { build: { diff --git a/code/web-ui/package-lock.json b/code/web-ui/package-lock.json index 4c79da2b1..f5f8c33f7 100644 --- a/code/web-ui/package-lock.json +++ b/code/web-ui/package-lock.json @@ -1,6 +1,6 @@ { "name": "ara-client", - "version": "8.6.2", + "version": "8.7.0", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -1205,6 +1205,11 @@ "to-fast-properties": "^2.0.0" } }, + "@braintree/sanitize-url": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/@braintree/sanitize-url/-/sanitize-url-5.0.2.tgz", + "integrity": "sha512-NBEJlHWrhQucLhZGHtSxM2loSaNUMajC7KOYJLyfcdW/6goVoff2HoYI3bz8YCDN0wKGbxtUL0gx2dvHpvnWlw==" + }, "@cypress/browserify-preprocessor": { "version": "2.2.4", "resolved": "https://registry.npmjs.org/@cypress/browserify-preprocessor/-/browserify-preprocessor-2.2.4.tgz", diff --git a/code/web-ui/package.json b/code/web-ui/package.json index 7e02ebd73..4d0d654fa 100644 --- a/code/web-ui/package.json +++ b/code/web-ui/package.json @@ -1,6 +1,6 @@ { "name": "ara-client", - "version": "8.6.2", + "version": "8.7.0", "description": "Agile Regression Analyzer front app", "author": "Decathlon ", "private": true, @@ -21,6 +21,7 @@ "cy:report:html": "npm run cy:report:merge; npx marge test/cypress/outputs/reports/json/merged/final-report.json --overwrite=true --charts=true --reportDir=test/cypress/outputs/reports/html" }, "dependencies": { + "@braintree/sanitize-url": "^5.0.2", "downloadjs": "^1.4.7", "eslint-plugin-html": "^3.1.1", "html-to-image": "^1.6.2", diff --git a/code/web-ui/src/components/error-debug-dropdown.vue b/code/web-ui/src/components/error-debug-dropdown.vue index 694d9e88d..dfdc7cdb8 100644 --- a/code/web-ui/src/components/error-debug-dropdown.vue +++ b/code/web-ui/src/components/error-debug-dropdown.vue @@ -40,37 +40,37 @@ This scenario used selenium node {{executedScenario.seleniumNode}} - + SHOW DIFF REPORT - + SHOW LOGS - + SHOW HTTP REQUESTS - + SHOW JAVASCRIPT ERRORS - + SHOW CUCUMBER REPORT - + EDIT SCENARIO @@ -107,6 +107,9 @@ methods: { goToErrorsPage (errorId) { this.$router.push({ name: 'error', params: { id: errorId } }) + }, + sanitizeARAUrl (url) { + return this.$sanitizeUrl(url) } } } diff --git a/code/web-ui/src/components/error-popups.vue b/code/web-ui/src/components/error-popups.vue index 21b9c8d76..23eb9d2cd 100644 --- a/code/web-ui/src/components/error-popups.vue +++ b/code/web-ui/src/components/error-popups.vue @@ -19,7 +19,7 @@
- +
@@ -32,7 +32,7 @@
@@ -101,6 +101,9 @@ }, methods: { + sanitizeARAUrl (url) { + return this.$sanitizeUrl(url) + }, prettySeverity (severityCode) { return util.prettySeverity(severityCode, this) }, diff --git a/code/web-ui/src/components/execution-actions-button.vue b/code/web-ui/src/components/execution-actions-button.vue index fe352093d..0b4db9edd 100644 --- a/code/web-ui/src/components/execution-actions-button.vue +++ b/code/web-ui/src/components/execution-actions-button.vue @@ -21,7 +21,7 @@ - @@ -30,11 +30,11 @@
{{execution.discardReason ? 'CHANGE DISCARD REASON' : 'DISCARD EXECUTION'}}
-
UN-DISCARD EXECUTION
- @@ -42,8 +42,8 @@ JOB REPORTS - - + @@ -52,9 +52,9 @@
- - + @@ -63,9 +63,9 @@ - + @@ -122,6 +122,10 @@ }, methods: { + sanitizeARAUrl (url) { + return this.$sanitizeUrl(url) + }, + discard (execution) { this.discardReason = execution.discardReason this.executionToDiscard = execution diff --git a/code/web-ui/src/components/functionality-coverage-details.vue b/code/web-ui/src/components/functionality-coverage-details.vue index 5eb878c5c..4bf700573 100644 --- a/code/web-ui/src/components/functionality-coverage-details.vue +++ b/code/web-ui/src/components/functionality-coverage-details.vue @@ -28,7 +28,7 @@ {{scenario.tags}} {{scenario.name}} {{prettySeverity(scenario.severity)}} - + EDIT SCENARIO
@@ -99,6 +99,10 @@ }, methods: { + sanitizeARAUrl (url) { + return this.$sanitizeUrl(url) + }, + prettySeverity (severityCode) { return util.prettySeverity(severityCode, this) }, diff --git a/code/web-ui/src/components/nrt-cycle-quality.vue b/code/web-ui/src/components/nrt-cycle-quality.vue index ab2fc6090..f30f58274 100644 --- a/code/web-ui/src/components/nrt-cycle-quality.vue +++ b/code/web-ui/src/components/nrt-cycle-quality.vue @@ -53,7 +53,7 @@ @@ -74,6 +74,9 @@ }, methods: { + sanitizeARAUrl (url) { + return this.$sanitizeUrl(url) + }, routerLink (severityCode, counts) { return { name: 'execution', diff --git a/code/web-ui/src/components/nrt-ignored-scenarios.vue b/code/web-ui/src/components/nrt-ignored-scenarios.vue index 4e6c92177..fdaec11ab 100644 --- a/code/web-ui/src/components/nrt-ignored-scenarios.vue +++ b/code/web-ui/src/components/nrt-ignored-scenarios.vue @@ -25,8 +25,8 @@ {{globalSeverityStat.severity.shortName}} -
{{globalSeverityStat.counts.percent}}%
{{globalSeverityStat.counts.ignored}}/{{globalSeverityStat.counts.total}} @@ -47,7 +47,7 @@ ? - {{severityStat.counts.percent}}%
{{severityStat.counts.ignored}}/{{severityStat.counts.total}} @@ -70,7 +70,7 @@ {{feature.name}} ({{feature.scenarios.length}}) - + EDIT SCENARIOS @@ -109,6 +109,9 @@ }, methods: { + sanitizeARAUrl (url) { + return this.$sanitizeUrl(url) + }, loadIgnoredScenarios () { this.loadingIgnoredScenarios = true Vue.http diff --git a/code/web-ui/src/components/nrt-run.vue b/code/web-ui/src/components/nrt-run.vue index 43a728bf9..6a916b483 100644 --- a/code/web-ui/src/components/nrt-run.vue +++ b/code/web-ui/src/components/nrt-run.vue @@ -22,7 +22,7 @@ - @@ -47,7 +47,7 @@ Deploying on {{countryDeployment.platform}}... - + @@ -57,7 +57,7 @@ The country {{countryDeployment.country.displayName}} did not deploy on {{countryDeployment.platform}} - + @@ -74,7 +74,7 @@ Testing... - + @@ -83,7 +83,7 @@ No result (test failed to launch, initialize or report) - + @@ -144,6 +144,12 @@ } }, + methods: { + sanitizeARAUrl (url) { + return this.$sanitizeUrl(url) + } + }, + computed: { teamsAssignableToProblems () { return this.$store.getters['teams/teamsAssignableToProblems'](this) diff --git a/code/web-ui/src/components/top-menu.vue b/code/web-ui/src/components/top-menu.vue index 626e24e7a..3bf3dbc25 100644 --- a/code/web-ui/src/components/top-menu.vue +++ b/code/web-ui/src/components/top-menu.vue @@ -73,8 +73,8 @@ - + @@ -97,9 +97,9 @@ - + rel="noopener" target="_blank"> @@ -146,7 +146,7 @@ isMediaDisplayedOnSamePage: true, appVersion: undefined, apiVersion: undefined, - webUIVersion: undefined, + webUIVersion: process.env.VERSION, latestChangelogVersion: this.getCookie(LATEST_CHANGELOG_VERSION_COOKIE_NAME), projectCode: this.$route.params.projectCode || this.defaultProjectCode, isLoggedIn: AuthenticationService.isAlreadyLoggedIn() @@ -192,6 +192,11 @@ }, methods: { + sanitizeARAUrl (url) { + console.log(this) + return this.$sanitizeUrl(url) + }, + loadLocalParameters () { this.isMediaDisplayedOnSamePage = LocalParameterService.isMediaDisplayedOnSamePage() }, @@ -273,7 +278,6 @@ .then((response) => { const data = response?.data this.appVersion = this.extractVersion(data, 'app') - this.webUIVersion = this.extractVersion(data, 'web-ui') this.apiVersion = this.extractVersion(data, 'api') // If it is the first time the user opens ARA, make sure to remember the current version for future notification badge if (!this.latestChangelogVersion) { diff --git a/code/web-ui/src/main.js b/code/web-ui/src/main.js index 54b3e4db2..6cd3a6e84 100644 --- a/code/web-ui/src/main.js +++ b/code/web-ui/src/main.js @@ -36,6 +36,8 @@ import { config } from './config' import api from './libs/api' import VueCookies from 'vue-cookies' +import { sanitizeUrl } from '@braintree/sanitize-url' + Vue.use(Vue2Filters) Vue.use(VueResource) Vue.use(VueRouter) @@ -162,6 +164,8 @@ router.afterEach(() => { window.scrollTo(0, 0) }) +Vue.prototype.$sanitizeUrl = sanitizeUrl + /* eslint-disable no-new */ new Vue({ el: '#app', diff --git a/code/web-ui/src/views/executions.vue b/code/web-ui/src/views/executions.vue index 3aff1ed6c..7f8f88204 100644 --- a/code/web-ui/src/views/executions.vue +++ b/code/web-ui/src/views/executions.vue @@ -18,7 +18,7 @@
-
ARA - AGILE REGRESSION ANALYZER
diff --git a/code/web-ui/src/views/functionality-cartography.vue b/code/web-ui/src/views/functionality-cartography.vue index 6e5f11e16..3b2f04aca 100644 --- a/code/web-ui/src/views/functionality-cartography.vue +++ b/code/web-ui/src/views/functionality-cartography.vue @@ -50,7 +50,7 @@
+ rel="noopener" target="_blank" id="helpLink"> How to create & move functionalities diff --git a/code/web-ui/src/views/problem.vue b/code/web-ui/src/views/problem.vue index 26b54e788..7a00e0a0d 100644 --- a/code/web-ui/src/views/problem.vue +++ b/code/web-ui/src/views/problem.vue @@ -19,7 +19,7 @@

PROBLEM - + @@ -242,6 +242,10 @@ If you updated the work-item a few seconds ago, you may want to speed up the ARA }, methods: { + sanitizeARAUrl (url) { + return this.$sanitizeUrl(url) + }, + loadProblem (skipMatchingErrorsReloading) { this.loadingProblem = true Vue.http diff --git a/code/web-ui/src/views/raw-executions.vue b/code/web-ui/src/views/raw-executions.vue index 7e8660c36..277d0bf54 100644 --- a/code/web-ui/src/views/raw-executions.vue +++ b/code/web-ui/src/views/raw-executions.vue @@ -50,7 +50,7 @@ {{execution.version}} {{util.formatDate(execution.buildDateTime)}} {{util.formatDate(execution.testDateTime)}} - JOB + JOB {{execution.status}} @@ -135,6 +135,10 @@ }, methods: { + sanitizeARAUrl (url) { + return this.$sanitizeUrl(url) + }, + loadExecutions () { let url = api.pageUrl(api.paths.executions(this), this.executionsPaging) this.loadingExecutions = true