From d4e2272308db2681f9cb4ed3ee1850521c418cef Mon Sep 17 00:00:00 2001 From: jq1836 <95712150+jq1836@users.noreply.github.com> Date: Wed, 4 Oct 2023 15:51:48 +0800 Subject: [PATCH 1/5] [#2045] Fix cypress zoom feature test (#2047) Currently, Cypress zoom feature tests are failing due to a recent change in behavior caused by a bug fix. With the tests failing, we are unable to detect any future regressions. Let's update the Cypress tests to test for the new intended behavior. --- .../tests/chartView/chartView_zoomFeature.cy.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/frontend/cypress/tests/chartView/chartView_zoomFeature.cy.js b/frontend/cypress/tests/chartView/chartView_zoomFeature.cy.js index 0ee3010da1..5915db587e 100644 --- a/frontend/cypress/tests/chartView/chartView_zoomFeature.cy.js +++ b/frontend/cypress/tests/chartView/chartView_zoomFeature.cy.js @@ -281,7 +281,7 @@ describe('range changes in chartview should reflect in zoom', () => { .get('#summary-charts .summary-chart__ramp .ramp') .first() .click(120, 20) - .click(200, 20); + .click(185, 20); cy.get('#tab-zoom') .should('be.visible'); @@ -289,7 +289,7 @@ describe('range changes in chartview should reflect in zoom', () => { cy.get('#tab-zoom .ramp .ramp__slice') .first() .invoke('attr', 'title') - .should('eq', '[2020-10-01] [#1312] Conditional run for markbind to gh pages deployment (#1337): +1 -0 lines '); + .should('eq', '[2020-05-23] [#1241] Restore checked file types (#1256): +14 -1 lines '); cy.get('#tab-zoom .ramp .ramp__slice') .last() .invoke('attr', 'title') @@ -306,7 +306,7 @@ describe('range changes in chartview should reflect in zoom', () => { cy.get('body').type(zoomKey, { release: false }) .get('#summary-charts .summary-chart__ramp .ramp') .first() - .click(200, 20) + .click(185, 20) .click(250, 20); cy.get('#tab-zoom') @@ -319,8 +319,7 @@ describe('range changes in chartview should reflect in zoom', () => { cy.get('#tab-zoom .ramp .ramp__slice') .last() .invoke('attr', 'title') - .should('eq', '[2020-11-21] [#1345] Authorship: Add last modified ' - + 'date to each LoC if specified (#1348): +165 -76 lines '); + .should('eq', '[2020-09-27] Add optional check for quotes in diff file regex (#1330): +1 -1 lines '); }); // Assumptions: Contributer 'jamessspanggg' is the first result, @@ -334,7 +333,7 @@ describe('range changes in chartview should reflect in zoom', () => { cy.get('body').type(zoomKey, { release: false }) .get('#summary-charts .summary-chart__ramp .ramp') .first() - .click(200, 20) + .click(185, 20) .click(225, 20); cy.get('#tab-zoom') @@ -351,7 +350,6 @@ describe('range changes in chartview should reflect in zoom', () => { cy.get('#tab-zoom .ramp .ramp__slice') .last() .invoke('attr', 'title') - .should('eq', '[2020-11-21] [#1345] Authorship: Add last modified date ' - + 'to each LoC if specified (#1348): +165 -76 lines '); + .should('eq', '[2020-09-27] Add optional check for quotes in diff file regex (#1330): +1 -1 lines '); }); }); From a8c3f00d43421dadecb43717ce6a041748223750 Mon Sep 17 00:00:00 2001 From: jq1836 <95712150+jq1836@users.noreply.github.com> Date: Wed, 4 Oct 2023 16:03:46 +0800 Subject: [PATCH 2/5] [#1936] Migrate random-color-gen.js to typescript (#2043) Currently, there is still some JavaScript code which remains unmigrated. This allows for type unsafe code to be written, potentially resulting in unintended behavior. Let's migrate random-color-generator.js JavaScript code to TypeScript code to facilitate future changes to the code. --- frontend/package-lock.json | 11 +++++++++++ frontend/package.json | 1 + ...m-color-generator.js => random-color-generator.ts} | 8 ++++---- 3 files changed, 16 insertions(+), 4 deletions(-) rename frontend/src/utils/{random-color-generator.js => random-color-generator.ts} (91%) diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 3a0a1f2534..fcb0dad89b 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -15,6 +15,7 @@ "@fortawesome/free-solid-svg-icons": "^6.0.0", "@fortawesome/vue-fontawesome": "^3.0.3", "@types/minimatch": "^5.1.2", + "@types/seedrandom": "^3.0.5", "core-js": "^3.6.5", "highlight.js": "^10.5.0", "jszip": "^3.5.0", @@ -2490,6 +2491,11 @@ "integrity": "sha512-wWKOClTTiizcZhXnPY4wikVAwmdYHp8q6DmC+EJUzAMsycb7HB32Kh9RN4+0gExjmPmZSAQjgURXIGATPegAvA==", "dev": true }, + "node_modules/@types/seedrandom": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/@types/seedrandom/-/seedrandom-3.0.5.tgz", + "integrity": "sha512-kopEpYpFQvQdYsZkZVwht/0THHmTFFYXDaqV/lM45eweJ8kcGVDgZHs0RVTolSq55UPZNmjhKc9r7UvLu/mQQg==" + }, "node_modules/@types/semver": { "version": "7.3.13", "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.3.13.tgz", @@ -18515,6 +18521,11 @@ "integrity": "sha512-wWKOClTTiizcZhXnPY4wikVAwmdYHp8q6DmC+EJUzAMsycb7HB32Kh9RN4+0gExjmPmZSAQjgURXIGATPegAvA==", "dev": true }, + "@types/seedrandom": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/@types/seedrandom/-/seedrandom-3.0.5.tgz", + "integrity": "sha512-kopEpYpFQvQdYsZkZVwht/0THHmTFFYXDaqV/lM45eweJ8kcGVDgZHs0RVTolSq55UPZNmjhKc9r7UvLu/mQQg==" + }, "@types/semver": { "version": "7.3.13", "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.3.13.tgz", diff --git a/frontend/package.json b/frontend/package.json index 1df6d24e2d..0ac8b545c5 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -20,6 +20,7 @@ "@fortawesome/free-solid-svg-icons": "^6.0.0", "@fortawesome/vue-fontawesome": "^3.0.3", "@types/minimatch": "^5.1.2", + "@types/seedrandom": "^3.0.5", "core-js": "^3.6.5", "highlight.js": "^10.5.0", "jszip": "^3.5.0", diff --git a/frontend/src/utils/random-color-generator.js b/frontend/src/utils/random-color-generator.ts similarity index 91% rename from frontend/src/utils/random-color-generator.js rename to frontend/src/utils/random-color-generator.ts index 82bdc9fac3..1a6b86656b 100644 --- a/frontend/src/utils/random-color-generator.js +++ b/frontend/src/utils/random-color-generator.ts @@ -8,7 +8,7 @@ function getRandomHex() { return `#${Math.round(randomGenerator() * maxHexColorValue + 1).toString(16).padStart(6, '0')}`; } -function rgb2lab(rgb) { +function rgb2lab(rgb: number[]) { let r = rgb[0] / 255; let g = rgb[1] / 255; let b = rgb[2] / 255; @@ -29,7 +29,7 @@ function rgb2lab(rgb) { // this delta E (perceptual color distance) implementation taken from @antimatter15 from // github: https://github.com/antimatter15/rgb-lab -function deltaE(rgbA, rgbB) { +function deltaE(rgbA: number[], rgbB: number[]) { const labA = rgb2lab(rgbA); const labB = rgb2lab(rgbB); const deltaL = labA[0] - labB[0]; @@ -49,7 +49,7 @@ function deltaE(rgbA, rgbB) { return distance < 0 ? 0 : Math.sqrt(distance); } -function hasSimilarExistingColors(existingColors, newHex) { +function hasSimilarExistingColors(existingColors: string[], newHex: string) { const deltaEThreshold = 11; // the lower limit of delta E to be similar, more info at http://zschuessler.github.io/DeltaE/learn/ return existingColors.some((existingHex) => { @@ -59,7 +59,7 @@ function hasSimilarExistingColors(existingColors, newHex) { }); } -function getNonRepeatingColor(existingColors) { +function getNonRepeatingColor(existingColors: string[]) { let generatedHex = getRandomHex(); while (hasSimilarExistingColors(existingColors, generatedHex)) { generatedHex = getRandomHex(); From 93e850ff8844d705343ea262e016877bafddee12 Mon Sep 17 00:00:00 2001 From: jq1836 <95712150+jq1836@users.noreply.github.com> Date: Wed, 4 Oct 2023 16:12:39 +0800 Subject: [PATCH 3/5] [#1936] Migrate c-segment-collection.vue to typescript (#2036) Currently, there is still some JavaScript code which remains unmigrated. This allows for type unsafe code to be written, potentially resulting in unintended behavior. Let's migrate the rest of the JavaScript code to TypeScript code to facilitate future changes to the code. --- frontend/src/components/c-segment-collection.vue | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/frontend/src/components/c-segment-collection.vue b/frontend/src/components/c-segment-collection.vue index b6853ba7d8..e305083a31 100644 --- a/frontend/src/components/c-segment-collection.vue +++ b/frontend/src/components/c-segment-collection.vue @@ -4,17 +4,19 @@ c-segment(v-bind:segment="segment", v-bind:path="path") - From 0d1cd991666b62473d77df3d0b4a69ca08ba9f62 Mon Sep 17 00:00:00 2001 From: jq1836 <95712150+jq1836@users.noreply.github.com> Date: Wed, 4 Oct 2023 16:32:40 +0800 Subject: [PATCH 4/5] [#1936] Migrate c-resizer.vue to typescript (#2038) Currently, there is still some JavaScript code which remains unmigrated. This allows for type unsafe code to be written, potentially resulting in unintended behavior. Let's migrate the rest of the JavaScript code to TypeScript code to facilitate future changes to the code. --- frontend/src/components/c-resizer.vue | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/frontend/src/components/c-resizer.vue b/frontend/src/components/c-resizer.vue index 4b510029c3..a315140e78 100644 --- a/frontend/src/components/c-resizer.vue +++ b/frontend/src/components/c-resizer.vue @@ -21,24 +21,30 @@ slot(name="right") - From 6292688b47d03954f917d7a91e2ceb87133ea33b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 4 Oct 2023 16:46:13 +0800 Subject: [PATCH 5/5] Bump zod from 3.20.6 to 3.22.3 in /frontend (#2048) Bumps [zod](https://github.com/colinhacks/zod) from 3.20.6 to 3.22.3. - [Release notes](https://github.com/colinhacks/zod/releases) - [Changelog](https://github.com/colinhacks/zod/blob/master/CHANGELOG.md) - [Commits](https://github.com/colinhacks/zod/compare/v3.20.6...v3.22.3) --- updated-dependencies: - dependency-name: zod dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- frontend/package-lock.json | 14 +++++++------- frontend/package.json | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/frontend/package-lock.json b/frontend/package-lock.json index fcb0dad89b..56afac2e4f 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -29,7 +29,7 @@ "vue-observe-visibility": "^1.0.0", "vue-router": "^4.1.6", "vuex": "^4.0.2", - "zod": "^3.20.6" + "zod": "^3.22.3" }, "devDependencies": { "@babel/eslint-parser": "^7.17.0", @@ -16724,9 +16724,9 @@ "dev": true }, "node_modules/zod": { - "version": "3.20.6", - "resolved": "https://registry.npmjs.org/zod/-/zod-3.20.6.tgz", - "integrity": "sha512-oyu0m54SGCtzh6EClBVqDDlAYRz4jrVtKwQ7ZnsEmMI9HnzuZFj8QFwAY1M5uniIYACdGvv0PBWPF2kO0aNofA==", + "version": "3.22.3", + "resolved": "https://registry.npmjs.org/zod/-/zod-3.22.3.tgz", + "integrity": "sha512-EjIevzuJRiRPbVH4mGc8nApb/lVLKVpmUhAaR5R5doKGfAnGJ6Gr3CViAVjP+4FWSxCsybeWQdcgCtbX+7oZug==", "funding": { "url": "https://github.com/sponsors/colinhacks" } @@ -29257,9 +29257,9 @@ } }, "zod": { - "version": "3.20.6", - "resolved": "https://registry.npmjs.org/zod/-/zod-3.20.6.tgz", - "integrity": "sha512-oyu0m54SGCtzh6EClBVqDDlAYRz4jrVtKwQ7ZnsEmMI9HnzuZFj8QFwAY1M5uniIYACdGvv0PBWPF2kO0aNofA==" + "version": "3.22.3", + "resolved": "https://registry.npmjs.org/zod/-/zod-3.22.3.tgz", + "integrity": "sha512-EjIevzuJRiRPbVH4mGc8nApb/lVLKVpmUhAaR5R5doKGfAnGJ6Gr3CViAVjP+4FWSxCsybeWQdcgCtbX+7oZug==" } } } diff --git a/frontend/package.json b/frontend/package.json index 0ac8b545c5..6663a3db8a 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -34,7 +34,7 @@ "vue-observe-visibility": "^1.0.0", "vue-router": "^4.1.6", "vuex": "^4.0.2", - "zod": "^3.20.6" + "zod": "^3.22.3" }, "devDependencies": { "@babel/eslint-parser": "^7.17.0",