Skip to content

Commit

Permalink
changed proxy fix to use BrowserRouter basename
Browse files Browse the repository at this point in the history
  • Loading branch information
shumway743 committed Mar 17, 2023
1 parent ed73acd commit 53ab87d
Show file tree
Hide file tree
Showing 22 changed files with 50 additions and 51 deletions.
5 changes: 3 additions & 2 deletions ui/src/FeastUI.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,16 @@ import FeastUISansProviders, { FeastUIConfigs } from "./FeastUISansProviders";
interface FeastUIProps {
reactQueryClient?: QueryClient;
feastUIConfigs?: FeastUIConfigs;
basename?: string;
}

const defaultQueryClient = new QueryClient();

const FeastUI = ({ reactQueryClient, feastUIConfigs }: FeastUIProps) => {
const FeastUI = ({ reactQueryClient, feastUIConfigs, basename }: FeastUIProps) => {
const queryClient = reactQueryClient || defaultQueryClient;

return (
<BrowserRouter>
<BrowserRouter basename={basename}>
<QueryClientProvider client={queryClient}>
<QueryParamProvider
ReactRouterRoute={RouteAdapter as unknown as React.FunctionComponent}
Expand Down
6 changes: 2 additions & 4 deletions ui/src/FeastUISansProviders.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@ const FeastUISansProviders = ({
isCustom: true,
}
: { projectsListPromise: defaultProjectListPromise(), isCustom: false };

const BASE_URL = process.env.PUBLIC_URL || ""

return (
<EuiProvider colorMode="light">
Expand All @@ -76,9 +74,9 @@ const FeastUISansProviders = ({
>
<ProjectListContext.Provider value={projectListContext}>
<Routes>
<Route path={BASE_URL + "/"} element={<Layout />}>
<Route path={"/"} element={<Layout />}>
<Route index element={<RootProjectSelectionPage />} />
<Route path={BASE_URL + "/p/:projectName/*"} element={<NoProjectGuard />}>
<Route path={"/p/:projectName/*"} element={<NoProjectGuard />}>
<Route index element={<ProjectOverviewPage />} />
<Route path="data-source/" element={<DatasourceIndex />} />
<Route
Expand Down
4 changes: 2 additions & 2 deletions ui/src/components/FeaturesInServiceDisplay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ const FeaturesInServiceList = ({ featureViews }: FeatureViewsListInterace) => {
render: (name: string) => {
return (
<EuiCustomLink
href={`${process.env.PUBLIC_URL || ""}/p/${projectName}/feature-view/${name}`}
to={`${process.env.PUBLIC_URL || ""}/p/${projectName}/feature-view/${name}`}
href={`/p/${projectName}/feature-view/${name}`}
to={`/p/${projectName}/feature-view/${name}`}
>
{name}
</EuiCustomLink>
Expand Down
4 changes: 2 additions & 2 deletions ui/src/components/FeaturesListDisplay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ const FeaturesList = ({
field: "name",
render: (item: string) => (
<EuiCustomLink
href={`${process.env.PUBLIC_URL || ""}/p/${projectName}/feature-view/${featureViewName}/feature/${item}`}
to={`${process.env.PUBLIC_URL || ""}/p/${projectName}/feature-view/${featureViewName}/feature/${item}`}
href={`/p/${projectName}/feature-view/${featureViewName}/feature/${item}`}
to={`/p/${projectName}/feature-view/${featureViewName}/feature/${item}`}
>
{item}
</EuiCustomLink>
Expand Down
8 changes: 4 additions & 4 deletions ui/src/components/ObjectsCountStats.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ const ObjectsCountStats = () => {
<EuiFlexItem>
<EuiStat
style={statStyle}
onClick={() => navigate(`${process.env.PUBLIC_URL || ""}/p/${projectName}/feature-service`)}
onClick={() => navigate(`/p/${projectName}/feature-service`)}
description="Feature Services→"
title={data.featureServices}
reverse
Expand All @@ -65,7 +65,7 @@ const ObjectsCountStats = () => {
<EuiStat
style={statStyle}
description="Feature Views→"
onClick={() => navigate(`${process.env.PUBLIC_URL || ""}/p/${projectName}/feature-view`)}
onClick={() => navigate(`/p/${projectName}/feature-view`)}
title={data.featureViews}
reverse
/>
Expand All @@ -74,7 +74,7 @@ const ObjectsCountStats = () => {
<EuiStat
style={statStyle}
description="Entities→"
onClick={() => navigate(`${process.env.PUBLIC_URL || ""}/p/${projectName}/entity`)}
onClick={() => navigate(`/p/${projectName}/entity`)}
title={data.entities}
reverse
/>
Expand All @@ -83,7 +83,7 @@ const ObjectsCountStats = () => {
<EuiStat
style={statStyle}
description="Data Sources→"
onClick={() => navigate(`${process.env.PUBLIC_URL || ""}/p/${projectName}/data-source`)}
onClick={() => navigate(`/p/${projectName}/data-source`)}
title={data.dataSources}
reverse
/>
Expand Down
2 changes: 1 addition & 1 deletion ui/src/components/ProjectSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const ProjectSelector = () => {

const basicSelectId = useGeneratedHtmlId({ prefix: "basicSelect" });
const onChange = (e: React.ChangeEvent<HTMLSelectElement>) => {
navigate(`${process.env.PUBLIC_URL || ""}/p/${e.target.value}`);
navigate(`/p/${e.target.value}`);
};

return (
Expand Down
2 changes: 1 addition & 1 deletion ui/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ ReactDOM.render(
reactQueryClient={queryClient}
feastUIConfigs={{
tabsRegistry: tabsRegistry,
projectListPromise: fetch(process.env.PUBLIC_URL || "" + "/projects-list.json", {
projectListPromise: fetch("/projects-list.json", {
headers: {
"Content-Type": "application/json",
},
Expand Down
6 changes: 3 additions & 3 deletions ui/src/pages/RootProjectSelectionPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ const RootProjectSelectionPage = () => {
useEffect(() => {
if (data && data.default) {
// If a default is set, redirect there.
navigate(`${process.env.PUBLIC_URL || ""}/p/${data.default}`);
navigate(`/p/${data.default}`);
}

if (data && data.projects.length === 1) {
// If there is only one project, redirect there.
navigate(`${process.env.PUBLIC_URL || ""}/p/${data.projects[0].id}`);
navigate(`/p/${data.projects[0].id}`);
}
}, [data, navigate]);

Expand All @@ -39,7 +39,7 @@ const RootProjectSelectionPage = () => {
title={`${item.name}`}
description={item?.description || ""}
onClick={() => {
navigate(`${process.env.PUBLIC_URL || ""}/p/${item.id}`);
navigate(`/p/${item.id}`);
}}
/>
</EuiFlexItem>
Expand Down
12 changes: 6 additions & 6 deletions ui/src/pages/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,15 @@ const SideNav = () => {
name: "Home",
id: htmlIdGenerator("basicExample")(),
onClick: () => {
navigate(`${process.env.PUBLIC_URL || ""}/p/${projectName}/`);
navigate(`/p/${projectName}/`);
},
items: [
{
name: dataSourcesLabel,
id: htmlIdGenerator("dataSources")(),
icon: <EuiIcon type={DataSourceIcon16} />,
onClick: () => {
navigate(`${process.env.PUBLIC_URL || ""}/p/${projectName}/data-source`);
navigate(`/p/${projectName}/data-source`);
},
isSelected: useMatchSubpath("data-source"),
},
Expand All @@ -77,7 +77,7 @@ const SideNav = () => {
id: htmlIdGenerator("entities")(),
icon: <EuiIcon type={EntityIcon16} />,
onClick: () => {
navigate(`${process.env.PUBLIC_URL || ""}/p/${projectName}/entity`);
navigate(`/p/${projectName}/entity`);
},
isSelected: useMatchSubpath("entity"),
},
Expand All @@ -86,7 +86,7 @@ const SideNav = () => {
id: htmlIdGenerator("featureView")(),
icon: <EuiIcon type={FeatureViewIcon16} />,
onClick: () => {
navigate(`${process.env.PUBLIC_URL || ""}/p/${projectName}/feature-view`);
navigate(`/p/${projectName}/feature-view`);
},
isSelected: useMatchSubpath("feature-view"),
},
Expand All @@ -95,7 +95,7 @@ const SideNav = () => {
id: htmlIdGenerator("featureService")(),
icon: <EuiIcon type={FeatureServiceIcon16} />,
onClick: () => {
navigate(`${process.env.PUBLIC_URL || ""}/p/${projectName}/feature-service`);
navigate(`/p/${projectName}/feature-service`);
},
isSelected: useMatchSubpath("feature-service"),
},
Expand All @@ -104,7 +104,7 @@ const SideNav = () => {
id: htmlIdGenerator("savedDatasets")(),
icon: <EuiIcon type={DatasetIcon16} />,
onClick: () => {
navigate(`${process.env.PUBLIC_URL || ""}/p/${projectName}/data-set`);
navigate(`/p/${projectName}/data-set`);
},
isSelected: useMatchSubpath("data-set"),
},
Expand Down
4 changes: 2 additions & 2 deletions ui/src/pages/data-sources/DataSourcesListingTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ const DatasourcesListingTable = ({
render: (name: string) => {
return (
<EuiCustomLink
href={`${process.env.PUBLIC_URL || ""}/p/${projectName}/data-source/${name}`}
to={`${process.env.PUBLIC_URL || ""}/p/${projectName}/data-source/${name}`}
href={`/p/${projectName}/data-source/${name}`}
to={`/p/${projectName}/data-source/${name}`}
>
{name}
</EuiCustomLink>
Expand Down
4 changes: 2 additions & 2 deletions ui/src/pages/entities/EntitiesListingTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ const EntitiesListingTable = ({ entities }: EntitiesListingTableProps) => {
render: (name: string) => {
return (
<EuiCustomLink
href={`${process.env.PUBLIC_URL || ""}/p/${projectName}/entity/${name}`}
to={`${process.env.PUBLIC_URL || ""}/p/${projectName}/entity/${name}`}
href={`/p/${projectName}/entity/${name}`}
to={`/p/${projectName}/entity/${name}`}
>
{name}
</EuiCustomLink>
Expand Down
4 changes: 2 additions & 2 deletions ui/src/pages/entities/FeatureViewEdgesList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ const FeatureViewEdgesList = ({ fvNames }: FeatureViewEdgesListInterace) => {
render: (name: string) => {
return (
<EuiCustomLink
href={`${process.env.PUBLIC_URL || ""}/p/${projectName}/feature-view/${name}`}
to={`${process.env.PUBLIC_URL || ""}/p/${projectName}/feature-view/${name}`}
href={`/p/${projectName}/feature-view/${name}`}
to={`/p/${projectName}/feature-view/${name}`}
>
{name}
</EuiCustomLink>
Expand Down
4 changes: 2 additions & 2 deletions ui/src/pages/feature-services/FeatureServiceListingTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ const FeatureServiceListingTable = ({
render: (name: string) => {
return (
<EuiCustomLink
href={`${process.env.PUBLIC_URL || ""}/p/${projectName}/feature-service/${name}`}
to={`${process.env.PUBLIC_URL || ""}/p/${projectName}/feature-service/${name}`}
href={`/p/${projectName}/feature-service/${name}`}
to={`/p/${projectName}/feature-service/${name}`}
>
{name}
</EuiCustomLink>
Expand Down
4 changes: 2 additions & 2 deletions ui/src/pages/feature-services/FeatureServiceOverviewTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ const FeatureServiceOverviewTab = () => {
tags={data.spec.tags}
createLink={(key, value) => {
return (
`${process.env.PUBLIC_URL || ""}/p/${projectName}/feature-service?` +
`/p/${projectName}/feature-service?` +
encodeSearchQueryString(`${key}:${value}`)
);
}}
Expand All @@ -133,7 +133,7 @@ const FeatureServiceOverviewTab = () => {
color="primary"
onClick={() => {
navigate(
`${process.env.PUBLIC_URL || ""}/p/${projectName}/entity/${entity.name}`
`/p/${projectName}/entity/${entity.name}`
);
}}
onClickAriaLabel={entity.name}
Expand Down
4 changes: 2 additions & 2 deletions ui/src/pages/feature-views/ConsumingFeatureServicesList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ const ConsumingFeatureServicesList = ({
render: (name: string) => {
return (
<EuiCustomLink
href={`${process.env.PUBLIC_URL || ""}/p/${projectName}/feature-service/${name}`}
to={`${process.env.PUBLIC_URL || ""}/p/${projectName}/feature-service/${name}`}
href={`/p/${projectName}/feature-service/${name}`}
to={`/p/${projectName}/feature-service/${name}`}
>
{name}
</EuiCustomLink>
Expand Down
4 changes: 2 additions & 2 deletions ui/src/pages/feature-views/FeatureViewListingTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ const FeatureViewListingTable = ({
render: (name: string, item: genericFVType) => {
return (
<EuiCustomLink
href={`${process.env.PUBLIC_URL || ""}/p/${projectName}/feature-view/${name}`}
to={`${process.env.PUBLIC_URL || ""}/p/${projectName}/feature-view/${name}`}
href={`/p/${projectName}/feature-view/${name}`}
to={`/p/${projectName}/feature-view/${name}`}
>
{name} {(item.type === "ondemand" && <EuiBadge>ondemand</EuiBadge>) || (item.type === "stream" && <EuiBadge>stream</EuiBadge>)}
</EuiCustomLink>
Expand Down
4 changes: 2 additions & 2 deletions ui/src/pages/feature-views/RegularFeatureViewOverviewTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ const RegularFeatureViewOverviewTab = ({
<EuiBadge
color="primary"
onClick={() => {
navigate(`${process.env.PUBLIC_URL || ""}/p/${projectName}/entity/${entity}`);
navigate(`/p/${projectName}/entity/${entity}`);
}}
onClickAriaLabel={entity}
data-test-sub="testExample1"
Expand Down Expand Up @@ -134,7 +134,7 @@ const RegularFeatureViewOverviewTab = ({
tags={data.spec.tags}
createLink={(key, value) => {
return (
`${process.env.PUBLIC_URL || ""}/p/${projectName}/feature-view?` +
`/p/${projectName}/feature-view?` +
encodeSearchQueryString(`${key}:${value}`)
);
}}
Expand Down
4 changes: 2 additions & 2 deletions ui/src/pages/feature-views/StreamFeatureViewOverviewTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ const StreamFeatureViewOverviewTab = ({
</EuiText>
<EuiTitle size="s">
<EuiCustomLink
href={`${process.env.PUBLIC_URL || ""}/p/${projectName}/data-source/${inputGroup?.name}`}
to={`${process.env.PUBLIC_URL || ""}/p/${projectName}/data-source/${inputGroup?.name}`}
href={`/p/${projectName}/data-source/${inputGroup?.name}`}
to={`/p/${projectName}/data-source/${inputGroup?.name}`}
>
{inputGroup?.name}
</EuiCustomLink>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ const FeatureViewProjectionDisplayPanel = (featureViewProjection: RequestDataDis
</EuiText>
<EuiTitle size="s">
<EuiCustomLink
href={`${process.env.PUBLIC_URL || ""}/p/${projectName}/feature-view/${featureViewProjection.featureViewName}`}
to={`${process.env.PUBLIC_URL || ""}/p/${projectName}/feature-view/${featureViewProjection.featureViewName}`}
href={`/p/${projectName}/feature-view/${featureViewProjection.featureViewName}`}
to={`/p/${projectName}/feature-view/${featureViewProjection.featureViewName}`}
>
{featureViewProjection?.featureViewName}
</EuiCustomLink>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ const RequestDataDisplayPanel = ({
</EuiText>
<EuiTitle size="s">
<EuiCustomLink
href={`${process.env.PUBLIC_URL || ""}/p/${projectName}/data-source/${requestDataSource?.name}`}
to={`${process.env.PUBLIC_URL || ""}/p/${projectName}/data-source/${requestDataSource?.name}`}
href={`/p/${projectName}/data-source/${requestDataSource?.name}`}
to={`/p/${projectName}/data-source/${requestDataSource?.name}`}
>
{requestDataSource?.name}
</EuiCustomLink>
Expand Down
4 changes: 2 additions & 2 deletions ui/src/pages/features/FeatureOverviewTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ const FeatureOverviewTab = () => {
<EuiDescriptionListTitle>FeatureView</EuiDescriptionListTitle>
<EuiDescriptionListDescription>
<EuiCustomLink
href={`${process.env.PUBLIC_URL || ""}/p/${projectName}/feature-view/${FeatureViewName}`}
to={`${process.env.PUBLIC_URL || ""}/p/${projectName}/feature-view/${FeatureViewName}`}>
href={`/p/${projectName}/feature-view/${FeatureViewName}`}
to={`/p/${projectName}/feature-view/${FeatureViewName}`}>
{FeatureViewName}
</EuiCustomLink>
</EuiDescriptionListDescription>
Expand Down
4 changes: 2 additions & 2 deletions ui/src/pages/saved-data-sets/DatasetsListingTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ const DatasetsListingTable = ({ datasets }: DatasetsListingTableProps) => {
render: (name: string) => {
return (
<EuiCustomLink
href={`${process.env.PUBLIC_URL || ""}/p/${projectName}/data-set/${name}`}
to={`${process.env.PUBLIC_URL || ""}/p/${projectName}/data-set/${name}`}
href={`/p/${projectName}/data-set/${name}`}
to={`/p/${projectName}/data-set/${name}`}
>
{name}
</EuiCustomLink>
Expand Down

0 comments on commit 53ab87d

Please sign in to comment.