From d54ca2a95c0358e2352c78f080db69e0c5e21cf9 Mon Sep 17 00:00:00 2001 From: NikoHelle Date: Thu, 11 Apr 2024 13:09:47 +0300 Subject: [PATCH 01/39] development Reset CHANGELOG after release --- CHANGELOG.md | 92 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7c012a41ea..20eb18d939 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,98 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [3.X.X] - Month, XX, 202X + +### React + +#### Breaking + +- [Component] What are the breaking changes? + +#### Added + +- [Component] What is added? + +#### Changed + +- [Component] What has been changed + +#### Fixed + +- [Component] What bugs/typos are fixed? + +### Core + +#### Breaking + +- [Component] What are the breaking changes? + +#### Added + +- [Component] What is added? + +#### Changed + +- [Component] What has been changed + +#### Fixed + +- [Component] What bugs/typos are fixed? + +### Documentation + +#### Breaking + +- [Component] What are the breaking changes? + +#### Added + +- [Component] What is added? + +#### Changed + +- [Component] What has been changed + +#### Fixed + +- [Component] What bugs/typos are fixed? + +### Figma + +#### Breaking + +- [Component] What are the breaking changes? + +#### Added + +- [Component] What is added? + +#### Changed + +- [Component] What has been changed + +#### Fixed + +- [Component] What bugs/typos are fixed? + +### Sketch/Abstract + +#### Breaking + +- [Component] What are the breaking changes? + +#### Added + +- [Component] What is added? + +#### Changed + +- [Component] What has been changed + +#### Fixed + +- [Component] What bugs/typos are fixed? + ## [3.7.0] - April, 11, 2024 ### React From 22d66865227879b0e5cd7b78b6d413319eeb47b7 Mon Sep 17 00:00:00 2001 From: Tuomo Kivinen Date: Thu, 11 Apr 2024 14:45:18 +0300 Subject: [PATCH 02/39] (HDS-2225) fix iconkit build workflow to skip if versions already updated --- .github/workflows/update-icon-library.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/.github/workflows/update-icon-library.yml b/.github/workflows/update-icon-library.yml index 65d6702eac..2589aeb132 100644 --- a/.github/workflows/update-icon-library.yml +++ b/.github/workflows/update-icon-library.yml @@ -31,16 +31,19 @@ jobs: # Don't do anything if we're on release-x.x.x AND the icon-kit has the same version number (already built for the release) # Skip this step if workflow was triggered by workflow_dispatch - name: Check if icon library has already been built for this release + id: build_checker if: github.event_name != 'workflow_dispatch' run: | PKG_VER=`node -pe "require('./packages/react/package.json').version"` ICON_KIT_VER=`sed -n -E 's/.*version[[:space:]]+([0-9]+([.][0-9]+)*).*/\1/p' ./release/icon-kit-template-CHANGELOG.txt` if [[ ${PKG_VER} == ${ICON_KIT_VER} ]]; then echo "Icon library has already been built for this release, skipping" + echo "SKIP_REST_STEPS=true" >> $GITHUB_OUTPUT exit 0 fi - name: Run Glypfig + if: steps.build_checker.outputs.SKIP_REST_STEPS != 'true' run: | npx glypfig \ --apikey $API_KEY \ @@ -61,46 +64,58 @@ jobs: NODE_ID: '172:2478' - name: Append React interface into index file + if: steps.build_checker.outputs.SKIP_REST_STEPS != 'true' run: | echo -e "export { IconProps } from './Icon.interface';\n" | \ cat - ./icon-library/react/tsx/index.ts > temp && mv temp ./icon-library/react/tsx/index.ts - name: Bump version in Changelog + if: steps.build_checker.outputs.SKIP_REST_STEPS != 'true' run: | PKG_VER=`node -pe "require('./packages/react/package.json').version"` sed -i -E "s/version [0-9]{1,2}.[0-9]{1,2}.[0-9]{1,2}/version ${PKG_VER}/" ./release/icon-kit-template-CHANGELOG.txt - name: Copy Changelog file to icon library + if: steps.build_checker.outputs.SKIP_REST_STEPS != 'true' run: cp ./release/icon-kit-template-CHANGELOG.txt ./icon-library/CHANGELOG.txt - name: Create release zip file + if: steps.build_checker.outputs.SKIP_REST_STEPS != 'true' uses: TheDoctor0/zip-release@0.7.6 with: filename: 'release/hds-icon-kit.zip' path: './icon-library' - name: Copy svg files to repo folders + if: steps.build_checker.outputs.SKIP_REST_STEPS != 'true' run: cp ./icon-library/svg/* ./packages/core/src/svg - name: Copy css files to repo folders + if: steps.build_checker.outputs.SKIP_REST_STEPS != 'true' run: cp ./icon-library/css/* ./packages/core/src/icons - name: Copy react files to repo folders + if: steps.build_checker.outputs.SKIP_REST_STEPS != 'true' run: cp ./icon-library/react/tsx/* ./packages/react/src/icons - name: Install React package NPM dependencies + if: steps.build_checker.outputs.SKIP_REST_STEPS != 'true' run: (cd ./packages/react && yarn) - name: Lint React files + if: steps.build_checker.outputs.SKIP_REST_STEPS != 'true' run: npx prettier --write './packages/react/src/icons/*.{ts,tsx}' - name: Code analysis for React files + if: steps.build_checker.outputs.SKIP_REST_STEPS != 'true' run: npx eslint --debug -c './packages/react/.eslintrc.json' --ignore-path './packages/react/.eslintignore' --fix './packages/react/src/icons/*.{ts,tsx}' - name: Remove icon library build directory + if: steps.build_checker.outputs.SKIP_REST_STEPS != 'true' run: rm -rf ./icon-library - name: Commit changed files + if: steps.build_checker.outputs.SKIP_REST_STEPS != 'true' run: | git config --global user.email "hds@hel.fi" git config --global user.name "Github Actions" From 6a47138bb9da7576a021f23e422957e7bbcf5d48 Mon Sep 17 00:00:00 2001 From: Tuomo Kivinen Date: Tue, 16 Apr 2024 10:04:54 +0300 Subject: [PATCH 03/39] (HDS-2160) change notification progressbar direction --- CHANGELOG.md | 1 + packages/react/src/components/notification/Notification.tsx | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 20eb18d939..3d2d62137f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 #### Changed - [Component] What has been changed +- [Notification] Change auto closing notification progressbar to decrease instead of increase. #### Fixed diff --git a/packages/react/src/components/notification/Notification.tsx b/packages/react/src/components/notification/Notification.tsx index ab30dad4e0..cfc0489e87 100644 --- a/packages/react/src/components/notification/Notification.tsx +++ b/packages/react/src/components/notification/Notification.tsx @@ -164,8 +164,8 @@ const getCloseTransition = (duration: number) => ({ * @param duration */ const getAutoCloseTransition = (duration: number) => ({ - from: { transform: 'translate3d(-100%, 0, 0)' }, - to: { transform: 'translate3d(0%, 0, 0)' }, + from: { transform: 'translate3d(0%, 0, 0)' }, + to: { transform: 'translate3d(-100%, 0, 0)' }, config: { duration, }, From 94389c969ef0e922663a465100c744aafe945252 Mon Sep 17 00:00:00 2001 From: NikoHelle Date: Tue, 16 Apr 2024 11:30:32 +0300 Subject: [PATCH 04/39] (hds-2034) Fix bug with session poller The poller was unintentionally stopped when "USER_UPDATED" signal was received. It should have been USER_REMOVED --- .../login/sessionPoller/sessionPoller.test.ts | 1 + .../login/sessionPoller/sessionPoller.ts | 12 +++++------- .../src/components/login/whole.setup.test.ts | 15 +++++++-------- 3 files changed, 13 insertions(+), 15 deletions(-) diff --git a/packages/react/src/components/login/sessionPoller/sessionPoller.test.ts b/packages/react/src/components/login/sessionPoller/sessionPoller.test.ts index 4993933303..3b30cda08c 100644 --- a/packages/react/src/components/login/sessionPoller/sessionPoller.test.ts +++ b/packages/react/src/components/login/sessionPoller/sessionPoller.test.ts @@ -491,6 +491,7 @@ describe(`sessionPoller`, () => { payload: { type: oidcClientEvents.USER_UPDATED, data: createUser() }, }); expect(getHttpPollerStartCalls()).toHaveLength(2); + expect(getHttpPollerStopCalls()).toHaveLength(1); }); it('Polling is not started again if renewal fails. No need to poll with old tokens', async () => { initTests({ setValidSession: true, responses: [successfulResponse, successfulResponse, successfulResponse] }); diff --git a/packages/react/src/components/login/sessionPoller/sessionPoller.ts b/packages/react/src/components/login/sessionPoller/sessionPoller.ts index 3dd82a15a8..a43c272b64 100644 --- a/packages/react/src/components/login/sessionPoller/sessionPoller.ts +++ b/packages/react/src/components/login/sessionPoller/sessionPoller.ts @@ -129,10 +129,12 @@ export function createSessionPoller(options: SessionPollerOptions = { pollInterv const stateChanged = storeStateChangeFromSignal(signal); const eventPayload = getEventSignalPayload(signal); if (eventPayload) { - if (eventPayload.type === oidcClientEvents.USER_RENEWAL_STARTED) { - stop(); - } if ( + eventPayload.type === oidcClientEvents.USER_RENEWAL_STARTED || + eventPayload.type === oidcClientEvents.USER_REMOVED + ) { + stop(); + } else if ( eventPayload.type === oidcClientEvents.USER_UPDATED && eventPayload.data && currentState === oidcClientStates.VALID_SESSION @@ -140,10 +142,6 @@ export function createSessionPoller(options: SessionPollerOptions = { pollInterv start(); } } - if (eventPayload && eventPayload.type === oidcClientEvents.USER_UPDATED) { - stop(); - return; - } if (stateChanged && currentState === oidcClientStates.VALID_SESSION) { start(); } else if (currentState !== oidcClientStates.VALID_SESSION) { diff --git a/packages/react/src/components/login/whole.setup.test.ts b/packages/react/src/components/login/whole.setup.test.ts index 9d3a9401fb..1920652ac8 100644 --- a/packages/react/src/components/login/whole.setup.test.ts +++ b/packages/react/src/components/login/whole.setup.test.ts @@ -405,11 +405,9 @@ describe('Test all modules together', () => { ]); // api tokens are fetched. Oidc client requests are mock in the the client itself. expect(getRequestCount()).toBe(1); - expect(getReceivedSignalTypes(sessionPollerNamespace)).toEqual([ - initSignalType, - sessionPollerEvents.SESSION_POLLING_STOPPED, - ]); - expect(getReceivedSignalTypes(LISTEN_TO_ALL_MARKER)).toHaveLength(12); + // session poller will not emit signals until polling interval is reached. + expect(getReceivedSignalTypes(sessionPollerNamespace)).toEqual([initSignalType]); + expect(getReceivedSignalTypes(LISTEN_TO_ALL_MARKER)).toHaveLength(11); }); it("When user and user's tokens are already stored in sessionStorage, only polling starts", async () => { const { getReceivedSignalTypes } = await initAll({ @@ -507,7 +505,7 @@ describe('Test all modules together', () => { await renewPromise; expect(mockMapForSessionHttpPoller.getCalls('start')).toHaveLength(2); - expect(mockMapForSessionHttpPoller.getCalls('stop')).toHaveLength(2); + expect(mockMapForSessionHttpPoller.getCalls('stop')).toHaveLength(1); }); it('When user is logs out, api tokens are removed and session polling is stopped.', async () => { const { getReceivedSignalTypes } = await initAll({ @@ -526,7 +524,7 @@ describe('Test all modules together', () => { oidcClientStates.LOGGING_OUT, oidcClientEvents.USER_REMOVED, ]); - expect(mockMapForSessionHttpPoller.getCalls('stop')).toHaveLength(2); + expect(getReceivedSignalTypes(apiTokensClientNamespace)).toEqual([ apiTokensClientEvents.API_TOKENS_UPDATED, initSignalType, @@ -538,7 +536,8 @@ describe('Test all modules together', () => { ]); expect(mockMapForSessionHttpPoller.getCalls('start')).toHaveLength(1); - expect(mockMapForSessionHttpPoller.getCalls('stop')).toHaveLength(2); + // 3 calls caused by LOGGING_OUT, USER_REMOVED and VALID_SESSION changed to invalid. + expect(mockMapForSessionHttpPoller.getCalls('stop')).toHaveLength(3); }); }); }); From 67c17773415b3aaee510563730c15cc94e802ce2 Mon Sep 17 00:00:00 2001 From: timwessman Date: Tue, 16 Apr 2024 12:51:45 +0300 Subject: [PATCH 05/39] fix: Add onblur event for Tooltip parent --- packages/react/src/components/tooltip/Tooltip.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/react/src/components/tooltip/Tooltip.tsx b/packages/react/src/components/tooltip/Tooltip.tsx index d4123badec..a39b739ed2 100644 --- a/packages/react/src/components/tooltip/Tooltip.tsx +++ b/packages/react/src/components/tooltip/Tooltip.tsx @@ -127,6 +127,7 @@ export const Tooltip = ({ aria-label={buttonLabel} aria-expanded={isTooltipOpen} onClick={onButtonClick} + onBlur={() => setIsTooltipOpen(false)} >