Skip to content

Commit ac0f237

Browse files
committed
fix: UI working behind base url
Signed-off-by: Hai Nguyen <quanghai.ng1512@gmail.com>
1 parent d377218 commit ac0f237

22 files changed

+59
-55
lines changed

sdk/python/feast/ui_server.py

+4-9
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,9 @@
1313

1414
def get_app(
1515
store: "feast.FeatureStore",
16-
get_registry_dump: Callable,
1716
project_id: str,
1817
registry_ttl_secs: int,
19-
host: str,
20-
port: int,
18+
root_path: str = ""
2119
):
2220
app = FastAPI()
2321

@@ -62,7 +60,7 @@ def shutdown_event():
6260
"name": "Project",
6361
"description": "Test project",
6462
"id": project_id,
65-
"registryPath": "/registry",
63+
"registryPath": f"{root_path}/registry",
6664
}
6765
]
6866
}
@@ -105,11 +103,8 @@ def start_server(
105103
):
106104
app = get_app(
107105
store,
108-
get_registry_dump,
109106
project_id,
110107
registry_ttl_sec,
111-
host,
112-
port,
108+
root_path,
113109
)
114-
assert root_path is not None
115-
uvicorn.run(app, host=host, port=port, root_path=root_path)
110+
uvicorn.run(app, host=host, port=port)

ui/src/FeastUISansProviders.tsx

+4-2
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ const FeastUISansProviders = ({
6262
isCustom: true,
6363
}
6464
: { projectsListPromise: defaultProjectListPromise(), isCustom: false };
65+
66+
const BASE_URL = process.env.PUBLIC_URL
6567

6668
return (
6769
<EuiProvider colorMode="light">
@@ -74,9 +76,9 @@ const FeastUISansProviders = ({
7476
>
7577
<ProjectListContext.Provider value={projectListContext}>
7678
<Routes>
77-
<Route path="/" element={<Layout />}>
79+
<Route path={BASE_URL + "/"} element={<Layout />}>
7880
<Route index element={<RootProjectSelectionPage />} />
79-
<Route path="/p/:projectName/*" element={<NoProjectGuard />}>
81+
<Route path={BASE_URL + "/p/:projectName/*"} element={<NoProjectGuard />}>
8082
<Route index element={<ProjectOverviewPage />} />
8183
<Route path="data-source/" element={<DatasourceIndex />} />
8284
<Route

ui/src/components/FeaturesInServiceDisplay.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ const FeaturesInServiceList = ({ featureViews }: FeatureViewsListInterace) => {
2929
render: (name: string) => {
3030
return (
3131
<EuiCustomLink
32-
href={`/p/${projectName}/feature-view/${name}`}
33-
to={`/p/${projectName}/feature-view/${name}`}
32+
href={`${process.env.PUBLIC_URL}/p/${projectName}/feature-view/${name}`}
33+
to={`${process.env.PUBLIC_URL}/p/${projectName}/feature-view/${name}`}
3434
>
3535
{name}
3636
</EuiCustomLink>

ui/src/components/FeaturesListDisplay.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ const FeaturesList = ({
2121
field: "name",
2222
render: (item: string) => (
2323
<EuiCustomLink
24-
href={`/p/${projectName}/feature-view/${featureViewName}/feature/${item}`}
25-
to={`/p/${projectName}/feature-view/${featureViewName}/feature/${item}`}
24+
href={`${process.env.PUBLIC_URL}/p/${projectName}/feature-view/${featureViewName}/feature/${item}`}
25+
to={`${process.env.PUBLIC_URL}/p/${projectName}/feature-view/${featureViewName}/feature/${item}`}
2626
>
2727
{item}
2828
</EuiCustomLink>

ui/src/components/ObjectsCountStats.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ const ObjectsCountStats = () => {
5555
<EuiFlexItem>
5656
<EuiStat
5757
style={statStyle}
58-
onClick={() => navigate(`/p/${projectName}/feature-service`)}
58+
onClick={() => navigate(`${process.env.PUBLIC_URL}/p/${projectName}/feature-service`)}
5959
description="Feature Services→"
6060
title={data.featureServices}
6161
reverse
@@ -65,7 +65,7 @@ const ObjectsCountStats = () => {
6565
<EuiStat
6666
style={statStyle}
6767
description="Feature Views→"
68-
onClick={() => navigate(`/p/${projectName}/feature-view`)}
68+
onClick={() => navigate(`${process.env.PUBLIC_URL}/p/${projectName}/feature-view`)}
6969
title={data.featureViews}
7070
reverse
7171
/>
@@ -74,7 +74,7 @@ const ObjectsCountStats = () => {
7474
<EuiStat
7575
style={statStyle}
7676
description="Entities→"
77-
onClick={() => navigate(`/p/${projectName}/entity`)}
77+
onClick={() => navigate(`${process.env.PUBLIC_URL}/p/${projectName}/entity`)}
7878
title={data.entities}
7979
reverse
8080
/>
@@ -83,7 +83,7 @@ const ObjectsCountStats = () => {
8383
<EuiStat
8484
style={statStyle}
8585
description="Data Sources→"
86-
onClick={() => navigate(`/p/${projectName}/data-source`)}
86+
onClick={() => navigate(`${process.env.PUBLIC_URL}/p/${projectName}/data-source`)}
8787
title={data.dataSources}
8888
reverse
8989
/>

ui/src/components/ProjectSelector.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const ProjectSelector = () => {
2222

2323
const basicSelectId = useGeneratedHtmlId({ prefix: "basicSelect" });
2424
const onChange = (e: React.ChangeEvent<HTMLSelectElement>) => {
25-
navigate(`/p/${e.target.value}`);
25+
navigate(`${process.env.PUBLIC_URL}/p/${e.target.value}`);
2626
};
2727

2828
return (

ui/src/index.tsx

+7
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,13 @@ ReactDOM.render(
9797
reactQueryClient={queryClient}
9898
feastUIConfigs={{
9999
tabsRegistry: tabsRegistry,
100+
projectListPromise: fetch(process.env.PUBLIC_URL + "/projects-list.json", {
101+
headers: {
102+
"Content-Type": "application/json",
103+
},
104+
}).then((res) => {
105+
return res.json();
106+
})
100107
}}
101108
/>
102109
</React.StrictMode>,

ui/src/pages/RootProjectSelectionPage.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ const RootProjectSelectionPage = () => {
2222
useEffect(() => {
2323
if (data && data.default) {
2424
// If a default is set, redirect there.
25-
navigate(`/p/${data.default}`);
25+
navigate(`${process.env.PUBLIC_URL}/p/${data.default}`);
2626
}
2727

2828
if (data && data.projects.length === 1) {
2929
// If there is only one project, redirect there.
30-
navigate(`/p/${data.projects[0].id}`);
30+
navigate(`${process.env.PUBLIC_URL}/p/${data.projects[0].id}`);
3131
}
3232
}, [data, navigate]);
3333

@@ -39,7 +39,7 @@ const RootProjectSelectionPage = () => {
3939
title={`${item.name}`}
4040
description={item?.description || ""}
4141
onClick={() => {
42-
navigate(`/p/${item.id}`);
42+
navigate(`${process.env.PUBLIC_URL}/p/${item.id}`);
4343
}}
4444
/>
4545
</EuiFlexItem>

ui/src/pages/Sidebar.tsx

+6-6
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,15 @@ const SideNav = () => {
6060
name: "Home",
6161
id: htmlIdGenerator("basicExample")(),
6262
onClick: () => {
63-
navigate(`/p/${projectName}/`);
63+
navigate(`${process.env.PUBLIC_URL}/p/${projectName}/`);
6464
},
6565
items: [
6666
{
6767
name: dataSourcesLabel,
6868
id: htmlIdGenerator("dataSources")(),
6969
icon: <EuiIcon type={DataSourceIcon16} />,
7070
onClick: () => {
71-
navigate(`/p/${projectName}/data-source`);
71+
navigate(`${process.env.PUBLIC_URL}/p/${projectName}/data-source`);
7272
},
7373
isSelected: useMatchSubpath("data-source"),
7474
},
@@ -77,7 +77,7 @@ const SideNav = () => {
7777
id: htmlIdGenerator("entities")(),
7878
icon: <EuiIcon type={EntityIcon16} />,
7979
onClick: () => {
80-
navigate(`/p/${projectName}/entity`);
80+
navigate(`${process.env.PUBLIC_URL}/p/${projectName}/entity`);
8181
},
8282
isSelected: useMatchSubpath("entity"),
8383
},
@@ -86,7 +86,7 @@ const SideNav = () => {
8686
id: htmlIdGenerator("featureView")(),
8787
icon: <EuiIcon type={FeatureViewIcon16} />,
8888
onClick: () => {
89-
navigate(`/p/${projectName}/feature-view`);
89+
navigate(`${process.env.PUBLIC_URL}/p/${projectName}/feature-view`);
9090
},
9191
isSelected: useMatchSubpath("feature-view"),
9292
},
@@ -95,7 +95,7 @@ const SideNav = () => {
9595
id: htmlIdGenerator("featureService")(),
9696
icon: <EuiIcon type={FeatureServiceIcon16} />,
9797
onClick: () => {
98-
navigate(`/p/${projectName}/feature-service`);
98+
navigate(`${process.env.PUBLIC_URL}/p/${projectName}/feature-service`);
9999
},
100100
isSelected: useMatchSubpath("feature-service"),
101101
},
@@ -104,7 +104,7 @@ const SideNav = () => {
104104
id: htmlIdGenerator("savedDatasets")(),
105105
icon: <EuiIcon type={DatasetIcon16} />,
106106
onClick: () => {
107-
navigate(`/p/${projectName}/data-set`);
107+
navigate(`${process.env.PUBLIC_URL}/p/${projectName}/data-set`);
108108
},
109109
isSelected: useMatchSubpath("data-set"),
110110
},

ui/src/pages/data-sources/DataSourcesListingTable.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ const DatasourcesListingTable = ({
2121
render: (name: string) => {
2222
return (
2323
<EuiCustomLink
24-
href={`/p/${projectName}/data-source/${name}`}
25-
to={`/p/${projectName}/data-source/${name}`}
24+
href={`${process.env.PUBLIC_URL}/p/${projectName}/data-source/${name}`}
25+
to={`${process.env.PUBLIC_URL}/p/${projectName}/data-source/${name}`}
2626
>
2727
{name}
2828
</EuiCustomLink>

ui/src/pages/entities/EntitiesListingTable.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ const EntitiesListingTable = ({ entities }: EntitiesListingTableProps) => {
2121
render: (name: string) => {
2222
return (
2323
<EuiCustomLink
24-
href={`/p/${projectName}/entity/${name}`}
25-
to={`/p/${projectName}/entity/${name}`}
24+
href={`${process.env.PUBLIC_URL}/p/${projectName}/entity/${name}`}
25+
to={`${process.env.PUBLIC_URL}/p/${projectName}/entity/${name}`}
2626
>
2727
{name}
2828
</EuiCustomLink>

ui/src/pages/entities/FeatureViewEdgesList.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ const FeatureViewEdgesList = ({ fvNames }: FeatureViewEdgesListInterace) => {
5454
render: (name: string) => {
5555
return (
5656
<EuiCustomLink
57-
href={`/p/${projectName}/feature-view/${name}`}
58-
to={`/p/${projectName}/feature-view/${name}`}
57+
href={`${process.env.PUBLIC_URL}/p/${projectName}/feature-view/${name}`}
58+
to={`${process.env.PUBLIC_URL}/p/${projectName}/feature-view/${name}`}
5959
>
6060
{name}
6161
</EuiCustomLink>

ui/src/pages/feature-services/FeatureServiceListingTable.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ const FeatureServiceListingTable = ({
3131
render: (name: string) => {
3232
return (
3333
<EuiCustomLink
34-
href={`/p/${projectName}/feature-service/${name}`}
35-
to={`/p/${projectName}/feature-service/${name}`}
34+
href={`${process.env.PUBLIC_URL}/p/${projectName}/feature-service/${name}`}
35+
to={`${process.env.PUBLIC_URL}/p/${projectName}/feature-service/${name}`}
3636
>
3737
{name}
3838
</EuiCustomLink>

ui/src/pages/feature-services/FeatureServiceOverviewTab.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ const FeatureServiceOverviewTab = () => {
109109
tags={data.spec.tags}
110110
createLink={(key, value) => {
111111
return (
112-
`/p/${projectName}/feature-service?` +
112+
`${process.env.PUBLIC_URL}/p/${projectName}/feature-service?` +
113113
encodeSearchQueryString(`${key}:${value}`)
114114
);
115115
}}
@@ -133,7 +133,7 @@ const FeatureServiceOverviewTab = () => {
133133
color="primary"
134134
onClick={() => {
135135
navigate(
136-
`/p/${projectName}/entity/${entity.name}`
136+
`${process.env.PUBLIC_URL}/p/${projectName}/entity/${entity.name}`
137137
);
138138
}}
139139
onClickAriaLabel={entity.name}

ui/src/pages/feature-views/ConsumingFeatureServicesList.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ const ConsumingFeatureServicesList = ({
1919
render: (name: string) => {
2020
return (
2121
<EuiCustomLink
22-
href={`/p/${projectName}/feature-service/${name}`}
23-
to={`/p/${projectName}/feature-service/${name}`}
22+
href={`${process.env.PUBLIC_URL}/p/${projectName}/feature-service/${name}`}
23+
to={`${process.env.PUBLIC_URL}/p/${projectName}/feature-service/${name}`}
2424
>
2525
{name}
2626
</EuiCustomLink>

ui/src/pages/feature-views/FeatureViewListingTable.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ const FeatureViewListingTable = ({
3232
render: (name: string, item: genericFVType) => {
3333
return (
3434
<EuiCustomLink
35-
href={`/p/${projectName}/feature-view/${name}`}
36-
to={`/p/${projectName}/feature-view/${name}`}
35+
href={`${process.env.PUBLIC_URL}/p/${projectName}/feature-view/${name}`}
36+
to={`${process.env.PUBLIC_URL}/p/${projectName}/feature-view/${name}`}
3737
>
3838
{name} {(item.type === "ondemand" && <EuiBadge>ondemand</EuiBadge>) || (item.type === "stream" && <EuiBadge>stream</EuiBadge>)}
3939
</EuiCustomLink>

ui/src/pages/feature-views/RegularFeatureViewOverviewTab.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ const RegularFeatureViewOverviewTab = ({
9696
<EuiBadge
9797
color="primary"
9898
onClick={() => {
99-
navigate(`/p/${projectName}/entity/${entity}`);
99+
navigate(`${process.env.PUBLIC_URL}/p/${projectName}/entity/${entity}`);
100100
}}
101101
onClickAriaLabel={entity}
102102
data-test-sub="testExample1"
@@ -134,7 +134,7 @@ const RegularFeatureViewOverviewTab = ({
134134
tags={data.spec.tags}
135135
createLink={(key, value) => {
136136
return (
137-
`/p/${projectName}/feature-view?` +
137+
`${process.env.PUBLIC_URL}/p/${projectName}/feature-view?` +
138138
encodeSearchQueryString(`${key}:${value}`)
139139
);
140140
}}

ui/src/pages/feature-views/StreamFeatureViewOverviewTab.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,8 @@ const StreamFeatureViewOverviewTab = ({
9696
</EuiText>
9797
<EuiTitle size="s">
9898
<EuiCustomLink
99-
href={`/p/${projectName}/data-source/${inputGroup?.name}`}
100-
to={`/p/${projectName}/data-source/${inputGroup?.name}`}
99+
href={`${process.env.PUBLIC_URL}/p/${projectName}/data-source/${inputGroup?.name}`}
100+
to={`${process.env.PUBLIC_URL}/p/${projectName}/data-source/${inputGroup?.name}`}
101101
>
102102
{inputGroup?.name}
103103
</EuiCustomLink>

ui/src/pages/feature-views/components/FeatureViewProjectionDisplayPanel.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ const FeatureViewProjectionDisplayPanel = (featureViewProjection: RequestDataDis
3131
</EuiText>
3232
<EuiTitle size="s">
3333
<EuiCustomLink
34-
href={`/p/${projectName}/feature-view/${featureViewProjection.featureViewName}`}
35-
to={`/p/${projectName}/feature-view/${featureViewProjection.featureViewName}`}
34+
href={`${process.env.PUBLIC_URL}/p/${projectName}/feature-view/${featureViewProjection.featureViewName}`}
35+
to={`${process.env.PUBLIC_URL}/p/${projectName}/feature-view/${featureViewProjection.featureViewName}`}
3636
>
3737
{featureViewProjection?.featureViewName}
3838
</EuiCustomLink>

ui/src/pages/feature-views/components/RequestDataDisplayPanel.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ const RequestDataDisplayPanel = ({
3838
</EuiText>
3939
<EuiTitle size="s">
4040
<EuiCustomLink
41-
href={`/p/${projectName}/data-source/${requestDataSource?.name}`}
42-
to={`/p/${projectName}/data-source/${requestDataSource?.name}`}
41+
href={`${process.env.PUBLIC_URL}/p/${projectName}/data-source/${requestDataSource?.name}`}
42+
to={`${process.env.PUBLIC_URL}/p/${projectName}/data-source/${requestDataSource?.name}`}
4343
>
4444
{requestDataSource?.name}
4545
</EuiCustomLink>

ui/src/pages/features/FeatureOverviewTab.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ const FeatureOverviewTab = () => {
6363
<EuiDescriptionListTitle>FeatureView</EuiDescriptionListTitle>
6464
<EuiDescriptionListDescription>
6565
<EuiCustomLink
66-
href={`/p/${projectName}/feature-view/${FeatureViewName}`}
67-
to={`/p/${projectName}/feature-view/${FeatureViewName}`}>
66+
href={`${process.env.PUBLIC_URL}/p/${projectName}/feature-view/${FeatureViewName}`}
67+
to={`${process.env.PUBLIC_URL}/p/${projectName}/feature-view/${FeatureViewName}`}>
6868
{FeatureViewName}
6969
</EuiCustomLink>
7070
</EuiDescriptionListDescription>

ui/src/pages/saved-data-sets/DatasetsListingTable.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ const DatasetsListingTable = ({ datasets }: DatasetsListingTableProps) => {
2020
render: (name: string) => {
2121
return (
2222
<EuiCustomLink
23-
href={`/p/${projectName}/data-set/${name}`}
24-
to={`/p/${projectName}/data-set/${name}`}
23+
href={`${process.env.PUBLIC_URL}/p/${projectName}/data-set/${name}`}
24+
to={`${process.env.PUBLIC_URL}/p/${projectName}/data-set/${name}`}
2525
>
2626
{name}
2727
</EuiCustomLink>

0 commit comments

Comments
 (0)