From b82ece33daf42c1ef998e414f3fb664c062c2adc Mon Sep 17 00:00:00 2001 From: Andrei Nenashev Date: Wed, 18 Oct 2023 19:04:28 +0200 Subject: [PATCH 1/2] chore: minor dep updates. Disable serialization warnings for token actions. Render markdown in tooltips. Minor markup refactoring --- odd-platform-ui/.nvmrc | 2 +- odd-platform-ui/build.gradle | 4 +- odd-platform-ui/package.json | 6 +- odd-platform-ui/pnpm-lock.yaml | 23 +- .../src/components/Search/Filters/Filters.tsx | 2 +- .../Search/Results/ResultItem/ResultItem.tsx | 316 +++++++++--------- .../shared/elements/AppTabs/AppTabs.tsx | 4 +- .../shared/elements/Markdown/Markdown.tsx | 4 +- odd-platform-ui/src/redux/store/index.ts | 7 +- .../src/redux/thunks/datasources.thunks.ts | 5 +- 10 files changed, 191 insertions(+), 182 deletions(-) diff --git a/odd-platform-ui/.nvmrc b/odd-platform-ui/.nvmrc index 8ddbc0c64..bb52a169c 100644 --- a/odd-platform-ui/.nvmrc +++ b/odd-platform-ui/.nvmrc @@ -1 +1 @@ -v18.16.0 +v18.18.2 diff --git a/odd-platform-ui/build.gradle b/odd-platform-ui/build.gradle index c02266e33..6f3e36aa2 100644 --- a/odd-platform-ui/build.gradle +++ b/odd-platform-ui/build.gradle @@ -6,8 +6,8 @@ plugins { node { download = true - version = "18.16.0" - pnpmVersion = "8.4.0" + version = "18.18.2" + pnpmVersion = "8.9.2" } tasks.register("buildUI", PnpmTask) { diff --git a/odd-platform-ui/package.json b/odd-platform-ui/package.json index 40572c3a1..15f05f7b5 100644 --- a/odd-platform-ui/package.json +++ b/odd-platform-ui/package.json @@ -83,7 +83,7 @@ "react-truncate-markup": "^5.1.2", "styled-components": "^5.3.11", "use-debounce": "^9.0.4", - "uuid": "^9.0.0", + "uuid": "^9.0.1", "vanilla-jsoneditor": "^0.7.11" }, "devDependencies": { @@ -137,8 +137,8 @@ "minimist": "1.2.6" }, "engines": { - "node": "v18.16.0", - "pnpm": "^8.4.0" + "node": "v18.18.2", + "pnpm": "^8.9.2" }, "pnpm": { "overrides": { diff --git a/odd-platform-ui/pnpm-lock.yaml b/odd-platform-ui/pnpm-lock.yaml index 36452b75e..f544a65df 100644 --- a/odd-platform-ui/pnpm-lock.yaml +++ b/odd-platform-ui/pnpm-lock.yaml @@ -1,6 +1,11 @@ lockfileVersion: '6.0' +settings: + autoInstallPeers: true + excludeLinksFromLockfile: false + overrides: + minimist: 1.2.6 glob-parent@<5.1.2: '>=5.1.2' dependencies: @@ -137,8 +142,8 @@ dependencies: specifier: ^9.0.4 version: 9.0.4(react@18.2.0) uuid: - specifier: ^9.0.0 - version: 9.0.0 + specifier: ^9.0.1 + version: 9.0.1 vanilla-jsoneditor: specifier: ^0.7.11 version: 0.7.11 @@ -1683,8 +1688,8 @@ packages: resolution: {integrity: sha512-Y+/1vGBHV/cYk6OI1Na/LHzwnlNCAfU3ZNGrc1LdRe/LAIbdDPTTv/HU3M7yXN448aTVDq3eKRm2cg7iKLb8gw==} dev: true - /@types/parse-json@4.0.0: - resolution: {integrity: sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA==} + /@types/parse-json@4.0.1: + resolution: {integrity: sha512-3YmXzzPAdOTVljVMkTMBdBEvlOLg2cDQaDhnnhT3nT9uDbnJzjWhKlzb+desT12Y7tGqaN6d+AbozcKzyL36Ng==} /@types/parse5@6.0.3: resolution: {integrity: sha512-SuT16Q1K51EAVPz1K29DJ/sXjhSQ0zjvsypYJ6tlwVsRV9jwW5Adq2ch8Dq8kDBCkYnELS7N7VNCSB5nC56t/g==} @@ -2744,7 +2749,7 @@ packages: resolution: {integrity: sha512-AdmX6xUzdNASswsFtmwSt7Vj8po9IuqXm0UXz7QKPuEUmPB4XyjGfaAr2PSuELMwkRMVH1EpIkX5bTZGRB3eCA==} engines: {node: '>=10'} dependencies: - '@types/parse-json': 4.0.0 + '@types/parse-json': 4.0.1 import-fresh: 3.3.0 parse-json: 5.2.0 path-type: 4.0.0 @@ -7046,8 +7051,8 @@ packages: resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==} dev: true - /uuid@9.0.0: - resolution: {integrity: sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg==} + /uuid@9.0.1: + resolution: {integrity: sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==} hasBin: true dev: false @@ -7588,7 +7593,3 @@ packages: /zwitch@2.0.4: resolution: {integrity: sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A==} dev: false - -settings: - autoInstallPeers: true - excludeLinksFromLockfile: false diff --git a/odd-platform-ui/src/components/Search/Filters/Filters.tsx b/odd-platform-ui/src/components/Search/Filters/Filters.tsx index 1b0bd4b8b..87b233a5d 100644 --- a/odd-platform-ui/src/components/Search/Filters/Filters.tsx +++ b/odd-platform-ui/src/components/Search/Filters/Filters.tsx @@ -51,7 +51,7 @@ const Filters: React.FC = () => { facetOptions={datasources} /> {typeof searchClass === 'number' && searchClass > 0 ? ( - + ) : null} = ({ }) => { const { t } = useTranslation(); const { dataEntityOverviewPath } = useAppPaths(); + const navigate = useNavigate(); const { dataEntityFormattedDateTime, formatDistanceToNowStrict } = useAppDateTime(); const detailsLink = dataEntityOverviewPath(searchResult.id); @@ -67,178 +69,176 @@ const ResultItem: React.FC = ({ ) : null; return ( - - - - - - navigate(detailsLink)}> + + + + + + {searchResult.internalName ?? searchResult.externalName} + + + + {searchQuery && ( + + + + )} + + + + + {showClassIcons && + searchResult.entityClasses?.map(entityClass => ( + - - {searchResult.internalName ?? searchResult.externalName} - - - - {searchQuery && ( - - - - )} - - - - - {showClassIcons && - searchResult.entityClasses?.map(entityClass => ( - - ))} - + ))} + + + {searchClassIdPredicate(DataEntityClassNameEnum.SET) ? ( + <> + + + {searchResult.stats?.consumersCount} + + + + + + + + + + {searchResult.stats?.fieldsCount} + + + + ) : null} + {searchClassIdPredicate(DataEntityClassNameEnum.TRANSFORMER) ? ( + <> + + + + + + + + ) : null} + {searchClassIdPredicate(DataEntityClassNameEnum.CONSUMER) ? ( + + - {searchClassIdPredicate(DataEntityClassNameEnum.SET) ? ( - <> - - - {searchResult.stats?.consumersCount} - - - - - - - - - - {searchResult.stats?.fieldsCount} - - - - ) : null} - {searchClassIdPredicate(DataEntityClassNameEnum.TRANSFORMER) ? ( - <> - - - - - - - - ) : null} - {searchClassIdPredicate(DataEntityClassNameEnum.CONSUMER) ? ( - + ) : null} + {searchClassIdPredicate(DataEntityClassNameEnum.QUALITY_TEST) ? ( + <> + - ) : null} - {searchClassIdPredicate(DataEntityClassNameEnum.QUALITY_TEST) ? ( - <> - - - - - - - - ) : null} - {searchClassIdPredicate(DataEntityClassNameEnum.ENTITY_GROUP) ? ( - - - {searchResult?.itemsCount} - + + - ) : null} - - {searchResult.dataSource.namespace?.name ? ( + + ) : null} + {searchClassIdPredicate(DataEntityClassNameEnum.ENTITY_GROUP) ? ( + + + {searchResult?.itemsCount} + + + ) : null} + + {searchResult.dataSource.namespace?.name ? ( + + {searchResult.dataSource.namespace?.name} + + ) : ( + not in any namespace + )} + {searchResult.dataSource?.name ? ( + + - {searchResult.dataSource.namespace?.name} + {searchResult.dataSource?.name} - ) : ( - not in any namespace - )} - {searchResult.dataSource?.name ? ( - - - - {searchResult.dataSource?.name} + + ) : ( + {t('manually created')} + )} + + + + {searchResult.ownership?.map(ownership => ( + + + {ownership.owner.name} - ) : ( - {t('manually created')} - )} - - - - {searchResult.ownership?.map(ownership => ( - - - {ownership.owner.name} - - - ))} - - - - - - - - - - {createdAtDS} - - - {updatedAtDS} - - - + ))} + + + + + + + + + + {createdAtDS} + + + {updatedAtDS} + + ); }; diff --git a/odd-platform-ui/src/components/shared/elements/AppTabs/AppTabs.tsx b/odd-platform-ui/src/components/shared/elements/AppTabs/AppTabs.tsx index 5c60892c7..a902665da 100644 --- a/odd-platform-ui/src/components/shared/elements/AppTabs/AppTabs.tsx +++ b/odd-platform-ui/src/components/shared/elements/AppTabs/AppTabs.tsx @@ -80,7 +80,7 @@ const AppTabs: FC = ({ $orientation={orientation} type={type} hidden={item.hidden} - key={item.link} + key={item.link || item.name} sx={tabSx} label={ = ({ $orientation={orientation} type={type} hidden={item.hidden} - key={item.link} + key={item.link || item.name} sx={tabSx} label={ return ( } childSx={{ display: 'inline-block' }} type='termLink' > @@ -75,7 +75,7 @@ type MarkdownPreviewProps = MarkdownElementProps; const Preview = (variant?: TypographyVariant) => ({ ...props }: MarkdownPreviewProps) => - !variant ?

: ; + !variant ?

: ; const Markdown: FC = ({ value, diff --git a/odd-platform-ui/src/redux/store/index.ts b/odd-platform-ui/src/redux/store/index.ts index 295f19bf2..0e1e36b87 100644 --- a/odd-platform-ui/src/redux/store/index.ts +++ b/odd-platform-ui/src/redux/store/index.ts @@ -1,9 +1,14 @@ import { configureStore } from '@reduxjs/toolkit'; +import type { SerializableStateInvariantMiddlewareOptions } from '@reduxjs/toolkit/src/serializableStateInvariantMiddleware'; import { unauthenticatedMiddleware } from 'redux/lib/unauthenticatedMiddleware'; import rootReducer from 'redux/slices'; +const serializableCheck: SerializableStateInvariantMiddlewareOptions = { + ignoredPaths: [/token/], + ignoredActionPaths: [/token/], +}; export const store = configureStore({ reducer: rootReducer, middleware: getDefaultMiddleware => - getDefaultMiddleware().concat([unauthenticatedMiddleware]), + getDefaultMiddleware({ serializableCheck }).concat(unauthenticatedMiddleware), }); diff --git a/odd-platform-ui/src/redux/thunks/datasources.thunks.ts b/odd-platform-ui/src/redux/thunks/datasources.thunks.ts index ed2748c34..5840a2aed 100644 --- a/odd-platform-ui/src/redux/thunks/datasources.thunks.ts +++ b/odd-platform-ui/src/redux/thunks/datasources.thunks.ts @@ -23,7 +23,10 @@ export const fetchDataSourcesList = handleResponseAsyncThunk< query, }); - return { datasourceList: items, pageInfo: { ...pageInfo, page } }; + return { + datasourceList: items, + pageInfo: { ...pageInfo, page }, + }; }, {} ); From 199c6609c1087521641b0617356aa757234fd207 Mon Sep 17 00:00:00 2001 From: Andrei Nenashev Date: Thu, 19 Oct 2023 12:49:33 +0200 Subject: [PATCH 2/2] fix tests --- .../src/components/Search/Results/ResultItem/ResultItem.tsx | 6 +++++- tests/ui/pages/catalog/catalog.page.ts | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/odd-platform-ui/src/components/Search/Results/ResultItem/ResultItem.tsx b/odd-platform-ui/src/components/Search/Results/ResultItem/ResultItem.tsx index 26df3b887..c49cf003c 100644 --- a/odd-platform-ui/src/components/Search/Results/ResultItem/ResultItem.tsx +++ b/odd-platform-ui/src/components/Search/Results/ResultItem/ResultItem.tsx @@ -69,7 +69,11 @@ const ResultItem: React.FC = ({ ) : null; return ( - navigate(detailsLink)}> + navigate(detailsLink)} + > `a:has-text('${name}')`, + listItemName: name => `div[data-testid="search-result-item"]:has-text('${name}')`, tab: name => `[role="tab"]:has-text('${name}')`, searchButton: `[placeholder="Search"] >> ..`, noMatchesFound: `text=No matches found`, resultList: `#results-list`, - listItem: `a[class][href]`, + listItem: `div[data-testid="search-result-item"]`, }; export default class CatalogPage extends BasePage { get searchBar() {