From 2333d2e9480a31dc92577459b12562ef8ff8cf94 Mon Sep 17 00:00:00 2001 From: Tymoteusz Czech <2625371+Tymek@users.noreply.github.com> Date: Mon, 11 Sep 2023 13:49:25 +0200 Subject: [PATCH 1/5] fix: integrations form submit --- .../integrations/IntegrationForm/IntegrationForm.tsx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/frontend/src/component/integrations/IntegrationForm/IntegrationForm.tsx b/frontend/src/component/integrations/IntegrationForm/IntegrationForm.tsx index 756284226c24..51769430dda3 100644 --- a/frontend/src/component/integrations/IntegrationForm/IntegrationForm.tsx +++ b/frontend/src/component/integrations/IntegrationForm/IntegrationForm.tsx @@ -43,6 +43,7 @@ import { ConditionallyRender } from 'component/common/ConditionallyRender/Condit import { IntegrationDelete } from './IntegrationDelete/IntegrationDelete'; import { IntegrationStateSwitch } from './IntegrationStateSwitch/IntegrationStateSwitch'; import { capitalizeFirst } from 'utils/capitalizeFirst'; +import { useUiFlag } from 'hooks/useUiFlag'; type IntegrationFormProps = { provider?: AddonTypeSchema; @@ -75,6 +76,7 @@ export const IntegrationForm: VFC = ({ label: event, })); const { uiConfig } = useUiConfig(); + const integrationsRework = useUiFlag('integrationsRework'); const [formValues, setFormValues] = useState(initialValues); const [errors, setErrors] = useState<{ containsErrors: boolean; @@ -218,14 +220,14 @@ export const IntegrationForm: VFC = ({ try { if (editMode) { await updateAddon(formValues as AddonSchema); - navigate('/addons'); + navigate(integrationsRework ? '/integrations' : '/addons'); setToastData({ type: 'success', title: 'Addon updated successfully', }); } else { await createAddon(formValues as Omit); - navigate('/addons'); + navigate(integrationsRework ? '/integrations' : '/addons'); setToastData({ type: 'success', confetti: true, @@ -271,6 +273,7 @@ export const IntegrationForm: VFC = ({ color="primary" variant="contained" permission={editMode ? UPDATE_ADDON : CREATE_ADDON} + onClick={onSubmit} > {submitText} @@ -382,9 +385,7 @@ export const IntegrationForm: VFC = ({ ( <> From d087dec756652e5950f04516965531e46c37fb3d Mon Sep 17 00:00:00 2001 From: Tymoteusz Czech <2625371+Tymek@users.noreply.github.com> Date: Mon, 11 Sep 2023 13:50:12 +0200 Subject: [PATCH 2/5] refactor: integrations list --- .../AvailableIntegrations.tsx | 26 +++++++------------ 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/frontend/src/component/integrations/IntegrationList/AvailableIntegrations/AvailableIntegrations.tsx b/frontend/src/component/integrations/IntegrationList/AvailableIntegrations/AvailableIntegrations.tsx index efe5ac57e84b..ba3861819e9f 100644 --- a/frontend/src/component/integrations/IntegrationList/AvailableIntegrations/AvailableIntegrations.tsx +++ b/frontend/src/component/integrations/IntegrationList/AvailableIntegrations/AvailableIntegrations.tsx @@ -1,5 +1,5 @@ import { type VFC } from 'react'; -import { Typography, styled } from '@mui/material'; +import { Box, Typography, styled } from '@mui/material'; import type { AddonTypeSchema } from 'openapi'; import useLoading from 'hooks/useLoading'; import { PageContent } from 'component/common/PageContent/PageContent'; @@ -58,23 +58,16 @@ export const AvailableIntegrations: VFC = ({ > -
- - Title - - - Description - -
{providers?.map( - ({ name, displayName, description }) => ( + ({ name, displayName, description, deprecated }) => ( ) )} @@ -109,16 +102,17 @@ export const AvailableIntegrations: VFC = ({ icon="unleash" title="Unleash Edge" description="Unleash Edge is built to help you scale Unleash. As a successor of Unleash Proxy it's even faster and more versitile." - link="/integrations/create/unleash-proxy" + link="/integrations/view/edge" configureActionText="Learn more" />
@@ -140,7 +134,7 @@ export const AvailableIntegrations: VFC = ({ -
+ ({ marginTop: theme.spacing(2) })}> Server-side SDKs @@ -148,7 +142,7 @@ export const AvailableIntegrations: VFC = ({ Server-side clients run on your server and communicate directly with your Unleash instance. -
+ {serverSdks?.map( ({ @@ -169,7 +163,7 @@ export const AvailableIntegrations: VFC = ({ ) )} -
+ ({ marginTop: theme.spacing(2) })}> Client-side SDKs @@ -192,7 +186,7 @@ export const AvailableIntegrations: VFC = ({ , but not to the regular Unleash client API. -
+ {clientSdks?.map( ({ From 588c953311e7c6c8af3293bdfa652adabd3cb0f8 Mon Sep 17 00:00:00 2001 From: Tymoteusz Czech <2625371+Tymek@users.noreply.github.com> Date: Mon, 11 Sep 2023 13:50:41 +0200 Subject: [PATCH 3/5] negative feature flag on routing --- frontend/src/component/common/util.ts | 6 ++++++ frontend/src/component/menu/routes.ts | 2 ++ frontend/src/interfaces/route.ts | 2 ++ 3 files changed, 10 insertions(+) diff --git a/frontend/src/component/common/util.ts b/frontend/src/component/common/util.ts index b40834b06ba9..f1a6764ca833 100644 --- a/frontend/src/component/common/util.ts +++ b/frontend/src/component/common/util.ts @@ -16,6 +16,12 @@ export const filterByConfig = return Boolean(flags[r.flag]); } + if (r.notFlag) { + const flags = config.flags as unknown as Record; + + return !(flags[r.notFlag] === true); + } + if (r.configFlag) { // Check if the route's `configFlag` is enabled in IUiConfig. return Boolean(config[r.configFlag]); diff --git a/frontend/src/component/menu/routes.ts b/frontend/src/component/menu/routes.ts index c0003f479af3..3a3eefba0177 100644 --- a/frontend/src/component/menu/routes.ts +++ b/frontend/src/component/menu/routes.ts @@ -327,6 +327,7 @@ export const routes: IRoute[] = [ // TODO: use AddonRedirect after removing `integrationsRework` menu flag hidden: false, type: 'protected', + notFlag: 'integrationsRework', menu: { mobile: true, advanced: true }, // TODO: remove 'addons' from menu after removing `integrationsRework` menu flag }, @@ -508,6 +509,7 @@ export const getCondensedRoutes = (routes: IRoute[]): INavigationMenuItem[] => { title: route.title, menu: route.menu, configFlag: route.configFlag, + notFlag: route.notFlag, }; }); }; diff --git a/frontend/src/interfaces/route.ts b/frontend/src/interfaces/route.ts index 06a38243bbaa..277e5d5e0aad 100644 --- a/frontend/src/interfaces/route.ts +++ b/frontend/src/interfaces/route.ts @@ -8,6 +8,7 @@ export interface IRoute { layout?: string; parent?: string; flag?: keyof UiFlags; + notFlag?: keyof UiFlags; configFlag?: keyof IUiConfig; hidden?: boolean; enterprise?: boolean; @@ -21,6 +22,7 @@ export interface INavigationMenuItem { title: string; menu: IRouteMenu; flag?: keyof UiFlags; + notFlag?: keyof UiFlags; configFlag?: keyof IUiConfig; group?: string; } From 1dc615dedb1cca05d8fff284a5238b0004ab79cb Mon Sep 17 00:00:00 2001 From: Tymoteusz Czech <2625371+Tymek@users.noreply.github.com> Date: Mon, 11 Sep 2023 14:01:16 +0200 Subject: [PATCH 4/5] fix: routes snapshot --- .../component/menu/__tests__/__snapshots__/routes.test.tsx.snap | 1 + 1 file changed, 1 insertion(+) diff --git a/frontend/src/component/menu/__tests__/__snapshots__/routes.test.tsx.snap b/frontend/src/component/menu/__tests__/__snapshots__/routes.test.tsx.snap index 2c96ef3a01f6..e7ec5ef2171d 100644 --- a/frontend/src/component/menu/__tests__/__snapshots__/routes.test.tsx.snap +++ b/frontend/src/component/menu/__tests__/__snapshots__/routes.test.tsx.snap @@ -312,6 +312,7 @@ exports[`returns all baseRoutes 1`] = ` "advanced": true, "mobile": true, }, + "notFlag": "integrationsRework", "path": "/addons", "title": "Addons", "type": "protected", From 3d44bc233b5ffa415a09ce2c7b4f8d348fd64e4f Mon Sep 17 00:00:00 2001 From: Tymoteusz Czech <2625371+Tymek@users.noreply.github.com> Date: Mon, 11 Sep 2023 14:18:31 +0200 Subject: [PATCH 5/5] fix: formatting --- .../AvailableIntegrations/AvailableIntegrations.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/frontend/src/component/integrations/IntegrationList/AvailableIntegrations/AvailableIntegrations.tsx b/frontend/src/component/integrations/IntegrationList/AvailableIntegrations/AvailableIntegrations.tsx index ba3861819e9f..36568a19e3c7 100644 --- a/frontend/src/component/integrations/IntegrationList/AvailableIntegrations/AvailableIntegrations.tsx +++ b/frontend/src/component/integrations/IntegrationList/AvailableIntegrations/AvailableIntegrations.tsx @@ -60,7 +60,12 @@ export const AvailableIntegrations: VFC = ({ {providers?.map( - ({ name, displayName, description, deprecated }) => ( + ({ + name, + displayName, + description, + deprecated, + }) => (