mirror of
https://github.com/Unleash/unleash.git
synced 2025-10-13 11:17:26 +02:00
revert renaming addons list
This commit is contained in:
parent
583dc8048a
commit
7ccacbe89e
@ -0,0 +1,18 @@
|
|||||||
|
import { Link, useLocation, useNavigate } from 'react-router-dom';
|
||||||
|
import { useEffect } from 'react';
|
||||||
|
import { PageContent } from 'component/common/PageContent/PageContent';
|
||||||
|
|
||||||
|
export const AddonRedirect = () => {
|
||||||
|
const location = useLocation();
|
||||||
|
const navigate = useNavigate();
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
navigate(`/integrations${location.pathname.replace('/addons', '')}`);
|
||||||
|
}, [location.pathname, navigate]);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<PageContent>
|
||||||
|
Addons where renamed to <Link to="/integrations">/integrations</Link>
|
||||||
|
</PageContent>
|
||||||
|
);
|
||||||
|
};
|
@ -16,10 +16,11 @@ import { PageHeader } from 'component/common/PageHeader/PageHeader';
|
|||||||
import { sortTypes } from 'utils/sortTypes';
|
import { sortTypes } from 'utils/sortTypes';
|
||||||
import { IconCell } from 'component/common/Table/cells/IconCell/IconCell';
|
import { IconCell } from 'component/common/Table/cells/IconCell/IconCell';
|
||||||
import { ActionCell } from 'component/common/Table/cells/ActionCell/ActionCell';
|
import { ActionCell } from 'component/common/Table/cells/ActionCell/ActionCell';
|
||||||
import { ConfigureIntegrationButton } from './ConfigureIntegrationButton/ConfigureIntegrationButton';
|
import { ConfigureAddonsButton } from './ConfigureAddonButton/ConfigureAddonsButton';
|
||||||
import { IntegrationIcon } from '../IntegrationIcon/IntegrationIcon';
|
import { IntegrationIcon } from '../IntegrationIcon/IntegrationIcon';
|
||||||
import { IntegrationNameCell } from '../IntegrationNameCell/IntegrationNameCell';
|
import { IntegrationNameCell } from '../IntegrationNameCell/IntegrationNameCell';
|
||||||
import { IAddonInstallation } from 'interfaces/addons';
|
import { IAddonInstallation } from 'interfaces/addons';
|
||||||
|
import useUiConfig from 'hooks/api/getters/useUiConfig/useUiConfig';
|
||||||
|
|
||||||
interface IProvider {
|
interface IProvider {
|
||||||
name: string;
|
name: string;
|
||||||
@ -32,15 +33,15 @@ interface IProvider {
|
|||||||
deprecated?: string;
|
deprecated?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface IAvailableIntegrationsProps {
|
interface IAvailableAddonsProps {
|
||||||
providers: IProvider[];
|
providers: IProvider[];
|
||||||
loading: boolean;
|
loading: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const AvailableIntegrations = ({
|
export const AvailableAddons = ({
|
||||||
providers,
|
providers,
|
||||||
loading,
|
loading,
|
||||||
}: IAvailableIntegrationsProps) => {
|
}: IAvailableAddonsProps) => {
|
||||||
const data = useMemo(() => {
|
const data = useMemo(() => {
|
||||||
if (loading) {
|
if (loading) {
|
||||||
return Array(5).fill({
|
return Array(5).fill({
|
||||||
@ -70,7 +71,9 @@ export const AvailableIntegrations = ({
|
|||||||
},
|
},
|
||||||
}: any) => {
|
}: any) => {
|
||||||
return (
|
return (
|
||||||
<IconCell icon={<IntegrationIcon name={name as string} />} />
|
<IconCell
|
||||||
|
icon={<IntegrationIcon name={name as string} />}
|
||||||
|
/>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -88,7 +91,7 @@ export const AvailableIntegrations = ({
|
|||||||
align: 'center',
|
align: 'center',
|
||||||
Cell: ({ row: { original } }: any) => (
|
Cell: ({ row: { original } }: any) => (
|
||||||
<ActionCell>
|
<ActionCell>
|
||||||
<ConfigureIntegrationButton provider={original} />
|
<ConfigureAddonsButton provider={original} />
|
||||||
</ActionCell>
|
</ActionCell>
|
||||||
),
|
),
|
||||||
width: 150,
|
width: 150,
|
||||||
@ -133,7 +136,11 @@ export const AvailableIntegrations = ({
|
|||||||
return (
|
return (
|
||||||
<PageContent
|
<PageContent
|
||||||
isLoading={loading}
|
isLoading={loading}
|
||||||
header={<PageHeader title={`Available addons (${rows.length})`} />}
|
header={
|
||||||
|
<PageHeader
|
||||||
|
title={`Available addons (${rows.length})`}
|
||||||
|
/>
|
||||||
|
}
|
||||||
>
|
>
|
||||||
<Table {...getTableProps()}>
|
<Table {...getTableProps()}>
|
||||||
<SortableTableHeader headerGroups={headerGroups} />
|
<SortableTableHeader headerGroups={headerGroups} />
|
@ -3,13 +3,13 @@ import { CREATE_ADDON } from 'component/providers/AccessProvider/permissions';
|
|||||||
import { IAddonProvider } from 'interfaces/addons';
|
import { IAddonProvider } from 'interfaces/addons';
|
||||||
import { useNavigate } from 'react-router-dom';
|
import { useNavigate } from 'react-router-dom';
|
||||||
|
|
||||||
interface IConfigureIntegrationButtonProps {
|
interface IConfigureAddonsButtonProps {
|
||||||
provider: IAddonProvider;
|
provider: IAddonProvider;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const ConfigureIntegrationButton = ({
|
export const ConfigureAddonsButton = ({
|
||||||
provider,
|
provider,
|
||||||
}: IConfigureIntegrationButtonProps) => {
|
}: IConfigureAddonsButtonProps) => {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
return (
|
return (
|
@ -14,10 +14,10 @@ import { PageHeader } from 'component/common/PageHeader/PageHeader';
|
|||||||
import { SortableTableHeader, TablePlaceholder } from 'component/common/Table';
|
import { SortableTableHeader, TablePlaceholder } from 'component/common/Table';
|
||||||
import { IconCell } from 'component/common/Table/cells/IconCell/IconCell';
|
import { IconCell } from 'component/common/Table/cells/IconCell/IconCell';
|
||||||
import { IntegrationIcon } from '../IntegrationIcon/IntegrationIcon';
|
import { IntegrationIcon } from '../IntegrationIcon/IntegrationIcon';
|
||||||
import { ConfiguredAddonsActionsCell } from './ConfiguredIntegrationsActionCell/ConfiguredIntegrationActionsCell';
|
import { ConfiguredAddonsActionsCell } from './ConfiguredAddonsActionCell/ConfiguredAddonsActionsCell';
|
||||||
import { IntegrationNameCell } from '../IntegrationNameCell/IntegrationNameCell';
|
import { IntegrationNameCell } from '../IntegrationNameCell/IntegrationNameCell';
|
||||||
|
|
||||||
export const ConfiguredIntegrations = () => {
|
export const ConfiguredAddons = () => {
|
||||||
const { refetchAddons, addons, providers, loading } = useAddons();
|
const { refetchAddons, addons, providers, loading } = useAddons();
|
||||||
const { updateAddon, removeAddon } = useAddonsApi();
|
const { updateAddon, removeAddon } = useAddonsApi();
|
||||||
const { setToastData, setToastApiError } = useToast();
|
const { setToastData, setToastApiError } = useToast();
|
||||||
@ -73,7 +73,9 @@ export const ConfiguredIntegrations = () => {
|
|||||||
original: { provider },
|
original: { provider },
|
||||||
},
|
},
|
||||||
}: any) => (
|
}: any) => (
|
||||||
<IconCell icon={<IntegrationIcon name={provider as string} />} />
|
<IconCell
|
||||||
|
icon={<IntegrationIcon name={provider as string} />}
|
||||||
|
/>
|
||||||
),
|
),
|
||||||
disableSortBy: true,
|
disableSortBy: true,
|
||||||
},
|
},
|
||||||
@ -175,7 +177,11 @@ export const ConfiguredIntegrations = () => {
|
|||||||
return (
|
return (
|
||||||
<PageContent
|
<PageContent
|
||||||
isLoading={loading}
|
isLoading={loading}
|
||||||
header={<PageHeader title={`Configured addons (${rows.length})`} />}
|
header={
|
||||||
|
<PageHeader
|
||||||
|
title={`Configured addons (${rows.length})`}
|
||||||
|
/>
|
||||||
|
}
|
||||||
sx={theme => ({ marginBottom: theme.spacing(2) })}
|
sx={theme => ({ marginBottom: theme.spacing(2) })}
|
||||||
>
|
>
|
||||||
<Table {...getTableProps()}>
|
<Table {...getTableProps()}>
|
@ -1,19 +1,21 @@
|
|||||||
import React from 'react';
|
import { ConfiguredAddons } from './ConfiguredAddons/ConfiguredAddons';
|
||||||
import { ConfiguredIntegrations } from './ConfiguredIntegrations/ConfiguredIntegrations';
|
import { AvailableAddons } from './AvailableAddons/AvailableAddons';
|
||||||
import { AvailableIntegrations } from './AvailableIntegrations/AvailableIntegrations';
|
|
||||||
import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender';
|
import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender';
|
||||||
import useAddons from 'hooks/api/getters/useAddons/useAddons';
|
import useAddons from 'hooks/api/getters/useAddons/useAddons';
|
||||||
|
import useUiConfig from 'hooks/api/getters/useUiConfig/useUiConfig';
|
||||||
|
|
||||||
export const IntegrationList = () => {
|
export const IntegrationList = () => {
|
||||||
const { providers, addons, loading } = useAddons();
|
const { providers, addons, loading } = useAddons();
|
||||||
|
const { uiConfig } = useUiConfig();
|
||||||
|
const integrationsRework = uiConfig?.flags?.integrationsRework || false;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<ConditionallyRender
|
<ConditionallyRender
|
||||||
condition={addons.length > 0}
|
condition={addons.length > 0}
|
||||||
show={<ConfiguredIntegrations />}
|
show={<ConfiguredAddons />}
|
||||||
/>
|
/>
|
||||||
<AvailableIntegrations loading={loading} providers={providers} />
|
<AvailableAddons loading={loading} providers={providers} />
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -306,6 +306,7 @@ export const routes: IRoute[] = [
|
|||||||
parent: '/addons',
|
parent: '/addons',
|
||||||
title: 'Create',
|
title: 'Create',
|
||||||
component: CreateIntegration,
|
component: CreateIntegration,
|
||||||
|
// TODO: use AddonRedirect after removing `integrationsRework` menu flag
|
||||||
type: 'protected',
|
type: 'protected',
|
||||||
menu: {},
|
menu: {},
|
||||||
},
|
},
|
||||||
@ -314,6 +315,7 @@ export const routes: IRoute[] = [
|
|||||||
parent: '/addons',
|
parent: '/addons',
|
||||||
title: 'Edit',
|
title: 'Edit',
|
||||||
component: EditIntegration,
|
component: EditIntegration,
|
||||||
|
// TODO: use AddonRedirect after removing `integrationsRework` menu flag
|
||||||
type: 'protected',
|
type: 'protected',
|
||||||
menu: {},
|
menu: {},
|
||||||
},
|
},
|
||||||
@ -321,11 +323,28 @@ export const routes: IRoute[] = [
|
|||||||
path: '/addons',
|
path: '/addons',
|
||||||
title: 'Addons',
|
title: 'Addons',
|
||||||
component: IntegrationList,
|
component: IntegrationList,
|
||||||
|
// TODO: use AddonRedirect after removing `integrationsRework` menu flag
|
||||||
hidden: false,
|
hidden: false,
|
||||||
type: 'protected',
|
type: 'protected',
|
||||||
menu: { mobile: true, advanced: true },
|
menu: { mobile: true, advanced: true },
|
||||||
|
// TODO: remove 'addons' from menu after removing `integrationsRework` menu flag
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: '/integrations/create/:providerId',
|
||||||
|
parent: '/integrations',
|
||||||
|
title: 'Create',
|
||||||
|
component: CreateIntegration,
|
||||||
|
type: 'protected',
|
||||||
|
menu: {},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: '/integrations/edit/:addonId',
|
||||||
|
parent: '/integrations',
|
||||||
|
title: 'Edit',
|
||||||
|
component: EditIntegration,
|
||||||
|
type: 'protected',
|
||||||
|
menu: {},
|
||||||
},
|
},
|
||||||
// TODO: remove 'addons' from menu after removing Integrations menu flag
|
|
||||||
{
|
{
|
||||||
path: '/integrations',
|
path: '/integrations',
|
||||||
title: 'Integrations',
|
title: 'Integrations',
|
||||||
|
Loading…
Reference in New Issue
Block a user