From 95670ed735a7628e80a1c078dfa9a433b93b7000 Mon Sep 17 00:00:00 2001 From: sgendre <31214611+sgendre@users.noreply.github.com> Date: Fri, 30 Jun 2023 10:47:18 +0200 Subject: [PATCH 1/5] feat(designer): change canvas background (#4762) --- .changeset/fair-tomatoes-work.md | 5 +++++ packages/flow-designer/package.json | 1 + .../src/components/grid/Grid.component.tsx | 19 +++++++++++++---- .../grid/__snapshots__/Grid.test.tsx.snap | 21 ++++++++++++++----- 4 files changed, 37 insertions(+), 9 deletions(-) create mode 100644 .changeset/fair-tomatoes-work.md diff --git a/.changeset/fair-tomatoes-work.md b/.changeset/fair-tomatoes-work.md new file mode 100644 index 00000000000..b12d5667141 --- /dev/null +++ b/.changeset/fair-tomatoes-work.md @@ -0,0 +1,5 @@ +--- +'@talend/react-flow-designer': minor +--- + +Lighten grid background diff --git a/packages/flow-designer/package.json b/packages/flow-designer/package.json index aedc2175261..5ab44d003b1 100644 --- a/packages/flow-designer/package.json +++ b/packages/flow-designer/package.json @@ -54,6 +54,7 @@ "reselect": "^4.1.8" }, "dependencies": { + "@talend/design-tokens": "^2.7.3", "classnames": "^2.3.2", "d3": "^7.8.5", "invariant": "^2.2.4", diff --git a/packages/flow-designer/src/components/grid/Grid.component.tsx b/packages/flow-designer/src/components/grid/Grid.component.tsx index c68b645d928..3f1d5310a50 100644 --- a/packages/flow-designer/src/components/grid/Grid.component.tsx +++ b/packages/flow-designer/src/components/grid/Grid.component.tsx @@ -1,18 +1,27 @@ import PropTypes from 'prop-types'; import get from 'lodash/get'; +import tokens from '@talend/design-tokens'; + import { GRID_SIZE } from '../../constants/flowdesigner.constants'; import { Transform } from '../../customTypings/index.d'; +const size = (4 * 5) / 3; +const halfSize = size / 2; + function Grid({ transformData }: { transformData?: Transform }) { - const largeGridSize = GRID_SIZE * get(transformData, 'k', 1); + const scale = get(transformData, 'k', 1); + const largeGridSize = GRID_SIZE * scale; + const halfCrossSize = halfSize * scale; + const deltaSize = largeGridSize - halfCrossSize; + return ( - - + + + + - + + From 64f79f23dd50dab9f832f8ccf777fb5320c48e12 Mon Sep 17 00:00:00 2001 From: Talend bot Date: Fri, 30 Jun 2023 11:16:07 +0200 Subject: [PATCH 2/5] chore: prepare release (#4775) Co-authored-by: github-actions[bot] --- .changeset/fair-tomatoes-work.md | 5 ----- .changeset/fluffy-horses-poke.md | 6 ------ packages/design-system/CHANGELOG.md | 6 ++++++ packages/design-system/package.json | 2 +- packages/flow-designer/CHANGELOG.md | 6 ++++++ packages/flow-designer/package.json | 2 +- packages/storybook/CHANGELOG.md | 11 +++++++++++ packages/storybook/package.json | 4 ++-- 8 files changed, 27 insertions(+), 15 deletions(-) delete mode 100644 .changeset/fair-tomatoes-work.md delete mode 100644 .changeset/fluffy-horses-poke.md diff --git a/.changeset/fair-tomatoes-work.md b/.changeset/fair-tomatoes-work.md deleted file mode 100644 index b12d5667141..00000000000 --- a/.changeset/fair-tomatoes-work.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@talend/react-flow-designer': minor ---- - -Lighten grid background diff --git a/.changeset/fluffy-horses-poke.md b/.changeset/fluffy-horses-poke.md deleted file mode 100644 index b2be6eb7238..00000000000 --- a/.changeset/fluffy-horses-poke.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -'@talend/design-system': minor -'@talend/ui-storybook': minor ---- - -[DS] InlineEditing : allow to update value from default value prop diff --git a/packages/design-system/CHANGELOG.md b/packages/design-system/CHANGELOG.md index 98c0ac9b5c1..3cc8da879b2 100644 --- a/packages/design-system/CHANGELOG.md +++ b/packages/design-system/CHANGELOG.md @@ -1,5 +1,11 @@ # @talend/design-system +## 7.11.0 + +### Minor Changes + +- d8c9adc34: [DS] InlineEditing : allow to update value from default value prop + ## 7.10.0 ### Minor Changes diff --git a/packages/design-system/package.json b/packages/design-system/package.json index 11bb7c31094..17eeae1282a 100644 --- a/packages/design-system/package.json +++ b/packages/design-system/package.json @@ -1,6 +1,6 @@ { "name": "@talend/design-system", - "version": "7.10.0", + "version": "7.11.0", "description": "Talend Design System", "main": "lib/index.js", "types": "lib/index.d.ts", diff --git a/packages/flow-designer/CHANGELOG.md b/packages/flow-designer/CHANGELOG.md index 816b4ced569..8e3dc830f5f 100644 --- a/packages/flow-designer/CHANGELOG.md +++ b/packages/flow-designer/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## 5.5.0 + +### Minor Changes + +- 95670ed73: Lighten grid background + ## 5.4.0 ### Minor Changes diff --git a/packages/flow-designer/package.json b/packages/flow-designer/package.json index 5ab44d003b1..ad1e7754251 100644 --- a/packages/flow-designer/package.json +++ b/packages/flow-designer/package.json @@ -1,7 +1,7 @@ { "name": "@talend/react-flow-designer", "description": "Flow designer for react and redux", - "version": "5.4.0", + "version": "5.5.0", "types": "lib/index.d.ts", "main": "lib/index.js", "mainSrc": "src/index.js", diff --git a/packages/storybook/CHANGELOG.md b/packages/storybook/CHANGELOG.md index 6ec20e78051..183f2b449ff 100644 --- a/packages/storybook/CHANGELOG.md +++ b/packages/storybook/CHANGELOG.md @@ -1,5 +1,16 @@ # @talend/ui-storybook +## 1.2.0 + +### Minor Changes + +- d8c9adc34: [DS] InlineEditing : allow to update value from default value prop + +### Patch Changes + +- Updated dependencies [d8c9adc34] + - @talend/design-system@7.11.0 + ## 1.1.3 ### Patch Changes diff --git a/packages/storybook/package.json b/packages/storybook/package.json index 5521ca4c5ad..dcb1208d2dd 100644 --- a/packages/storybook/package.json +++ b/packages/storybook/package.json @@ -1,6 +1,6 @@ { "name": "@talend/ui-storybook", - "version": "1.1.3", + "version": "1.2.0", "description": "Package containing all stories from talend/ui repository", "homepage": "https://github.com/Talend/ui#readme", "main": "src/index.ts", @@ -20,7 +20,7 @@ "url": "https://github.com/Talend/ui/issues" }, "dependencies": { - "@talend/design-system": "^7.10.0", + "@talend/design-system": "^7.11.0", "@talend/design-tokens": "^2.7.3", "react-hook-form": "^6.15.8" }, From 67144d23d77090275acc46f5773833e8fff8f8c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Romain?= Date: Mon, 3 Jul 2023 08:37:32 +0200 Subject: [PATCH 3/5] feat(http): add global interceptors (#4774) --- .changeset/good-radios-push.md | 17 ++++++++++ packages/http/src/config.test.ts | 57 +++++++++++++++++++++++++++++++- packages/http/src/config.ts | 19 +++++++++++ packages/http/src/http.common.ts | 7 +++- packages/http/src/index.ts | 8 +++++ 5 files changed, 106 insertions(+), 2 deletions(-) create mode 100644 .changeset/good-radios-push.md diff --git a/.changeset/good-radios-push.md b/.changeset/good-radios-push.md new file mode 100644 index 00000000000..8ad5feff2f9 --- /dev/null +++ b/.changeset/good-radios-push.md @@ -0,0 +1,17 @@ +--- +'@talend/http': minor +--- + +feat(http): add the possibility to add global interceptors for every calls that got through @talend/http calls + +Usage: + +```typescript +import { addHttpResponseInterceptor, HTTP_STATUS } from '@talend/http'; + +addHttpResponseInterceptor('logout', (response: Response): void => { + if (response.status === HTTP_STATUS.UNAUTHORIZED) { + logout(); + } +}); +``` diff --git a/packages/http/src/config.test.ts b/packages/http/src/config.test.ts index 82b327f8671..4f2513d6a70 100644 --- a/packages/http/src/config.test.ts +++ b/packages/http/src/config.test.ts @@ -1,4 +1,12 @@ -import { HTTP, getDefaultConfig, setDefaultConfig, setDefaultLanguage } from './config'; +import { + HTTP, + HTTP_RESPONSE_INTERCEPTORS, + addHttpResponseInterceptor, + getDefaultConfig, + removeHttpResponseInterceptor, + setDefaultConfig, + setDefaultLanguage, +} from './config'; describe('Configuration service', () => { describe('setDefaultLanguage', () => { @@ -39,4 +47,51 @@ describe('Configuration service', () => { ); }); }); + + describe('Http interceptors', () => { + beforeEach(() => { + for (const key in HTTP_RESPONSE_INTERCEPTORS) { + if (HTTP_RESPONSE_INTERCEPTORS.hasOwnProperty(key)) { + delete HTTP_RESPONSE_INTERCEPTORS[key]; + } + } + }); + + it('should add a new interceptor when the name is not already used', () => { + const interceptor = jest.fn(); + addHttpResponseInterceptor('myInterceptor', interceptor); + expect(HTTP_RESPONSE_INTERCEPTORS).toEqual({ + myInterceptor: interceptor, + }); + }); + + it('should throw an error when the name is already used', () => { + const interceptor1 = jest.fn(); + const interceptor2 = jest.fn(); + addHttpResponseInterceptor('myInterceptor', interceptor1); + expect(() => addHttpResponseInterceptor('myInterceptor', interceptor2)).toThrowError( + 'Interceptor myInterceptor already exists', + ); + expect(HTTP_RESPONSE_INTERCEPTORS).toEqual({ + myInterceptor: interceptor1, + }); + }); + + it('should remove an existing interceptor', () => { + const interceptor1 = jest.fn(); + addHttpResponseInterceptor('myInterceptor', interceptor1); + + removeHttpResponseInterceptor('myInterceptor'); + expect(HTTP_RESPONSE_INTERCEPTORS).toEqual({}); + }); + + it('should throw an error when the interceptor does not exist', () => { + const interceptor2 = jest.fn(); + addHttpResponseInterceptor('myInterceptor2', interceptor2); + expect(() => removeHttpResponseInterceptor('myInterceptor')).toThrowError( + 'Interceptor myInterceptor does not exist', + ); + expect(HTTP_RESPONSE_INTERCEPTORS).toEqual({ myInterceptor2: interceptor2 }); + }); + }); }); diff --git a/packages/http/src/config.ts b/packages/http/src/config.ts index b2539b39aad..bd12d85b015 100644 --- a/packages/http/src/config.ts +++ b/packages/http/src/config.ts @@ -7,6 +7,25 @@ export const HTTP: { defaultConfig?: TalendRequestInit | null } = { defaultConfig: null, }; +export const HTTP_RESPONSE_INTERCEPTORS: Record void> = {}; + +export function addHttpResponseInterceptor( + name: string, + interceptor: (response: Response) => void, +) { + if (HTTP_RESPONSE_INTERCEPTORS[name]) { + throw new Error(`Interceptor ${name} already exists`); + } + HTTP_RESPONSE_INTERCEPTORS[name] = interceptor; +} + +export function removeHttpResponseInterceptor(name: string) { + if (!HTTP_RESPONSE_INTERCEPTORS[name]) { + throw new Error(`Interceptor ${name} does not exist`); + } + delete HTTP_RESPONSE_INTERCEPTORS[name]; +} + /** * setDefaultHeader - define a default config to use with the saga http * this default config is stored in this module for the whole application diff --git a/packages/http/src/http.common.ts b/packages/http/src/http.common.ts index b6c9def5644..9ebc4802295 100644 --- a/packages/http/src/http.common.ts +++ b/packages/http/src/http.common.ts @@ -1,4 +1,4 @@ -import { HTTP } from './config'; +import { HTTP, HTTP_RESPONSE_INTERCEPTORS } from './config'; import { mergeCSRFToken } from './csrfHandling'; import { HTTP_STATUS, testHTTPCode } from './http.constants'; import { TalendHttpResponse, TalendRequestInit } from './http.types'; @@ -125,5 +125,10 @@ export async function httpFetch( body: encodePayload(params.headers || {}, payload), }), ); + + Object.values(HTTP_RESPONSE_INTERCEPTORS).forEach(interceptor => { + interceptor(response); + }); + return handleHttpResponse(response); } diff --git a/packages/http/src/index.ts b/packages/http/src/index.ts index 6b71c145c92..798cfd4c249 100644 --- a/packages/http/src/index.ts +++ b/packages/http/src/index.ts @@ -3,3 +3,11 @@ export { http } from './async'; export * from './http.types'; export * from './http.constants'; + +export { + addHttpResponseInterceptor, + removeHttpResponseInterceptor, + getDefaultConfig, + setDefaultConfig, + setDefaultLanguage, +} from './config'; From bb0cd786ed0a29a0612738bf75cc1471c62a3875 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Romain?= Date: Mon, 3 Jul 2023 14:37:08 +0200 Subject: [PATCH 4/5] fix(faceted-search): badge overlap with button (#4769) --- .changeset/grumpy-cars-teach.md | 5 +++++ .../Badges/BadgeFaceted/BadgeFaceted.module.scss | 2 +- .../faceted-search/stories/facetedSearch.stories.js | 10 ++++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 .changeset/grumpy-cars-teach.md diff --git a/.changeset/grumpy-cars-teach.md b/.changeset/grumpy-cars-teach.md new file mode 100644 index 00000000000..01c1b519b7a --- /dev/null +++ b/.changeset/grumpy-cars-teach.md @@ -0,0 +1,5 @@ +--- +'@talend/react-faceted-search': patch +--- + +fix(TDC-6575): badge size overlap with "Add Filter" button with some long values diff --git a/packages/faceted-search/src/components/Badges/BadgeFaceted/BadgeFaceted.module.scss b/packages/faceted-search/src/components/Badges/BadgeFaceted/BadgeFaceted.module.scss index ae042cfb353..6ef388bf4d9 100644 --- a/packages/faceted-search/src/components/Badges/BadgeFaceted/BadgeFaceted.module.scss +++ b/packages/faceted-search/src/components/Badges/BadgeFaceted/BadgeFaceted.module.scss @@ -5,7 +5,7 @@ // stylelint-disable scss/selector-no-redundant-nesting-selector .tc-badge-faceted { padding: tokens.$coral-spacing-xxs tokens.$coral-spacing-xs; - max-width: tokens.$coral-sizing-maximal; + max-width: fit-content; :global(.tc-badge-button) { max-width: none; diff --git a/packages/faceted-search/stories/facetedSearch.stories.js b/packages/faceted-search/stories/facetedSearch.stories.js index 2edad547d1a..b825a4e3e56 100644 --- a/packages/faceted-search/stories/facetedSearch.stories.js +++ b/packages/faceted-search/stories/facetedSearch.stories.js @@ -97,6 +97,16 @@ const badgesFaceted = { label: 'Amazon S3', checked: true, }, + { + id: 'hdfs', + label: 'HDFS', + checked: true, + }, + { + id: 'localcon', + label: 'Local connection', + checked: true, + }, ], }, metadata: { From 04167fe3de88f53ab9bdb4f69ced81acb225b0c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Romain?= Date: Mon, 3 Jul 2023 14:37:21 +0200 Subject: [PATCH 5/5] fix(faceted-search): data feature typo (#4767) --- .changeset/tidy-suits-mix.md | 5 +++++ .../components/FacetedToolbar/FacetedToolbar.component.js | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/tidy-suits-mix.md diff --git a/.changeset/tidy-suits-mix.md b/.changeset/tidy-suits-mix.md new file mode 100644 index 00000000000..11d6a4627a3 --- /dev/null +++ b/.changeset/tidy-suits-mix.md @@ -0,0 +1,5 @@ +--- +'@talend/react-faceted-search': patch +--- + +fix(faceted-search): data-feature typo diff --git a/packages/faceted-search/src/components/FacetedToolbar/FacetedToolbar.component.js b/packages/faceted-search/src/components/FacetedToolbar/FacetedToolbar.component.js index e53b1ca5d09..6b58d1f344f 100644 --- a/packages/faceted-search/src/components/FacetedToolbar/FacetedToolbar.component.js +++ b/packages/faceted-search/src/components/FacetedToolbar/FacetedToolbar.component.js @@ -14,7 +14,7 @@ const SwitchFacetedMode = ({ facetedMode, onChange, t }) => ( onChange={() => onChange(facetedMode === FACETED_MODE.BASIC ? FACETED_MODE.ADVANCED : FACETED_MODE.BASIC) } - dataFeature={ + data-feature={ facetedMode === FACETED_MODE.BASIC ? USAGE_TRACKING_TAGS.BASIC : USAGE_TRACKING_TAGS.ADVANCED