Skip to content

Commit bda64cd

Browse files
fix: Resolve UI build warnings
fix: Resolve UI build warnings (#6529) (cherry picked from commit abe92af) Signed-off-by: Francisco Javier Arceo <farceo@redhat.com>
1 parent b9d5ba1 commit bda64cd

15 files changed

Lines changed: 52 additions & 97 deletions

ui/src/components/PermissionsDisplay.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,9 @@ import {
33
EuiBadge,
44
EuiFlexGroup,
55
EuiFlexItem,
6-
EuiPanel,
76
EuiText,
8-
EuiTitle,
9-
EuiHorizontalRule,
107
EuiToolTip,
118
} from "@elastic/eui";
12-
import { formatPermissions } from "../utils/permissionUtils";
139

1410
interface PermissionsDisplayProps {
1511
permissions: any[] | undefined;

ui/src/components/RegistrySearch.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import React, {
33
useRef,
44
forwardRef,
55
useImperativeHandle,
6+
useCallback,
67
} from "react";
78
import {
89
EuiText,
@@ -17,8 +18,6 @@ import {
1718
} from "@elastic/eui";
1819
import EuiCustomLink from "./EuiCustomLink";
1920

20-
import { css } from "@emotion/react";
21-
2221
const searchResultsStyles = {
2322
searchResults: {
2423
marginTop: "8px",
@@ -68,11 +67,11 @@ const RegistrySearch = forwardRef<RegistrySearchRef, RegistrySearchProps>(
6867
const [searchText, setSearchText] = useState("");
6968
const inputRef = useRef<HTMLInputElement | null>(null);
7069

71-
const focusSearchInput = () => {
70+
const focusSearchInput = useCallback(() => {
7271
if (inputRef.current) {
7372
inputRef.current.focus();
7473
}
75-
};
74+
}, []);
7675

7776
useImperativeHandle(
7877
ref,

ui/src/custom-tabs/TabsRegistryContext.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import FeatureCustomTabLoadingWrapper from "../utils/custom-tabs/FeatureCustomTa
1616
import DataSourceCustomTabLoadingWrapper from "../utils/custom-tabs/DataSourceCustomTabLoadingWrapper";
1717
import EntityCustomTabLoadingWrapper from "../utils/custom-tabs/EntityCustomTabLoadingWrapper";
1818
import DatasetCustomTabLoadingWrapper from "../utils/custom-tabs/DatasetCustomTabLoadingWrapper";
19-
import CurlGeneratorTab from "../pages/feature-views/CurlGeneratorTab";
2019

2120
import {
2221
RegularFeatureViewCustomTabRegistrationInterface,

ui/src/pages/Layout.tsx

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -54,55 +54,6 @@ const Layout = () => {
5454
// Load unfiltered data for global search (across all projects)
5555
const { data: globalData } = useLoadRegistry(globalRegistryPath);
5656

57-
// Categories for page-level search (filtered to current project)
58-
const categories = data
59-
? [
60-
{
61-
name: "Data Sources",
62-
data: data.objects.dataSources || [],
63-
getLink: (item: any) => `/p/${projectName}/data-source/${item.name}`,
64-
},
65-
{
66-
name: "Entities",
67-
data: data.objects.entities || [],
68-
getLink: (item: any) => `/p/${projectName}/entity/${item.name}`,
69-
},
70-
{
71-
name: "Features",
72-
data: data.allFeatures || [],
73-
getLink: (item: any) => {
74-
const featureView = item?.featureView;
75-
return featureView
76-
? `/p/${projectName}/feature-view/${featureView}/feature/${item.name}`
77-
: "#";
78-
},
79-
},
80-
{
81-
name: "Feature Views",
82-
data: data.mergedFVList || [],
83-
getLink: (item: any) => `/p/${projectName}/feature-view/${item.name}`,
84-
},
85-
{
86-
name: "Label Views",
87-
data: data.objects.labelViews || [],
88-
getLink: (item: any) => {
89-
const lvName = item?.name || item?.spec?.name;
90-
return `/p/${projectName}/label-view/${lvName}`;
91-
},
92-
},
93-
{
94-
name: "Feature Services",
95-
data: data.objects.featureServices || [],
96-
getLink: (item: any) => {
97-
const serviceName = item?.name || item?.spec?.name;
98-
return serviceName
99-
? `/p/${projectName}/feature-service/${serviceName}`
100-
: "#";
101-
},
102-
},
103-
]
104-
: [];
105-
10657
// Helper function to extract project ID from an item
10758
const getProjectId = (item: any): string => {
10859
// Try different possible locations for the project field

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

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import {
66
EuiTitle,
77
EuiHorizontalRule,
88
EuiCodeBlock,
9-
EuiSpacer,
109
EuiFlexGroup,
1110
EuiFlexItem,
1211
EuiBadge,
@@ -161,11 +160,17 @@ const FeatureViewVersionsTab = ({
161160
const registryQuery = useLoadRegistry(registryUrl, projectName);
162161
const [expandedRows, setExpandedRows] = useState<Record<number, boolean>>({});
163162

164-
const records =
165-
registryQuery.data?.objects?.featureViewVersionHistory?.records?.filter(
166-
(r: feast.core.IFeatureViewVersionRecord) =>
167-
r.featureViewName === featureViewName,
168-
) || [];
163+
const records = useMemo(
164+
() =>
165+
registryQuery.data?.objects?.featureViewVersionHistory?.records?.filter(
166+
(r: feast.core.IFeatureViewVersionRecord) =>
167+
r.featureViewName === featureViewName,
168+
) || [],
169+
[
170+
registryQuery.data?.objects?.featureViewVersionHistory?.records,
171+
featureViewName,
172+
],
173+
);
169174

170175
const decodedVersions: DecodedVersion[] = useMemo(
171176
() => records.map(decodeVersionProto),

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import {
44
EuiBasicTable,
55
EuiPanel,
66
EuiSpacer,
7-
EuiText,
87
EuiTitle,
98
} from "@elastic/eui";
109
import { useParams } from "react-router-dom";

ui/src/pages/label-views/BatchUploadTab.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { useParams } from "react-router-dom";
33
import {
44
EuiPanel,
55
EuiTitle,
6-
EuiHorizontalRule,
76
EuiForm,
87
EuiFormRow,
98
EuiButton,
@@ -18,7 +17,6 @@ import {
1817
EuiFilePicker,
1918
EuiBasicTable,
2019
EuiBasicTableColumn,
21-
EuiIcon,
2220
EuiCodeBlock,
2321
} from "@elastic/eui";
2422
import RegistryPathContext from "../../contexts/RegistryPathContext";
@@ -28,7 +26,7 @@ const BatchUploadTab = () => {
2826
const { labelViewName } = useParams();
2927
const registryUrl = useContext(RegistryPathContext);
3028
const name = labelViewName || "";
31-
const { isLoading, isSuccess, data } = useLoadLabelView(name);
29+
const { isLoading, data } = useLoadLabelView(name);
3230

3331
const [fileData, setFileData] = useState<any[] | null>(null);
3432
const [fileName, setFileName] = useState<string>("");

ui/src/pages/label-views/ClassificationMethod.tsx

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
import React, { useState, useContext, useEffect } from "react";
1+
import React, {
2+
useState,
3+
useContext,
4+
useEffect,
5+
useCallback,
6+
useMemo,
7+
} from "react";
28
import { useParams } from "react-router-dom";
39
import {
410
EuiCallOut,
@@ -7,7 +13,6 @@ import {
713
EuiFlexItem,
814
EuiButton,
915
EuiPanel,
10-
EuiTitle,
1116
EuiText,
1217
EuiLoadingSpinner,
1318
EuiBasicTable,
@@ -45,17 +50,23 @@ const ClassificationMethod = () => {
4550
const [pageSize, setPageSize] = useState(25);
4651

4752
const spec = data?.object?.spec || data?.spec || {};
48-
const labelFields: { name: string; valueType?: string }[] =
49-
spec.features || [];
50-
const entities: string[] = spec.entityColumns?.length
51-
? spec.entityColumns.map((ec: { name: string }) => ec.name)
52-
: spec.entities || [];
53+
const labelFields: { name: string; valueType?: string }[] = useMemo(
54+
() => spec.features || [],
55+
[spec.features],
56+
);
57+
const entities: string[] = useMemo(
58+
() =>
59+
spec.entityColumns?.length
60+
? spec.entityColumns.map((ec: { name: string }) => ec.name)
61+
: spec.entities || [],
62+
[spec.entityColumns, spec.entities],
63+
);
5364

5465
const configuredValues = annotationConfig?.label_values || {};
5566
const fieldRoles = annotationConfig?.field_roles || {};
5667
const labelWidgets = annotationConfig?.label_widgets || {};
5768

58-
const fetchLabels = async () => {
69+
const fetchLabels = useCallback(async () => {
5970
setIsLoading(true);
6071
setError(null);
6172
try {
@@ -84,13 +95,13 @@ const ClassificationMethod = () => {
8495
} finally {
8596
setIsLoading(false);
8697
}
87-
};
98+
}, [labelViewName, registryUrl]);
8899

89100
useEffect(() => {
90101
if (labelViewName) {
91102
fetchLabels();
92103
}
93-
}, [labelViewName]);
104+
}, [labelViewName, fetchLabels]);
94105

95106
const handleFieldChange = (rowId: string, field: string, value: string) => {
96107
setRows((prev) =>
@@ -186,7 +197,7 @@ const ClassificationMethod = () => {
186197
URL.revokeObjectURL(url);
187198
};
188199

189-
const filteredRows = React.useMemo(() => {
200+
const filteredRows = useMemo(() => {
190201
if (!searchQuery.trim()) return rows;
191202
const q = searchQuery.toLowerCase();
192203
return rows.filter((row) =>
@@ -198,12 +209,12 @@ const ClassificationMethod = () => {
198209
);
199210
}, [rows, searchQuery]);
200211

201-
const paginatedRows = React.useMemo(() => {
212+
const paginatedRows = useMemo(() => {
202213
const start = pageIndex * pageSize;
203214
return filteredRows.slice(start, start + pageSize);
204215
}, [filteredRows, pageIndex, pageSize]);
205216

206-
const uniqueValuesForField = React.useMemo(() => {
217+
const uniqueValuesForField = useMemo(() => {
207218
const result: Record<string, string[]> = {};
208219
labelFields.forEach((field) => {
209220
const values = new Set<string>();

ui/src/pages/label-views/EntityFormMethod.tsx

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import {
99
EuiPanel,
1010
EuiTitle,
1111
EuiText,
12-
EuiLoadingSpinner,
1312
EuiFormRow,
1413
EuiFieldText,
1514
EuiFieldNumber,
@@ -35,11 +34,17 @@ const EntityFormMethod = ({ annotationConfig }: EntityFormMethodProps) => {
3534
const { data } = useLoadLabelView(labelViewName || "");
3635

3736
const spec = data?.object?.spec || data?.spec || {};
38-
const entities: string[] = spec.entityColumns?.length
39-
? spec.entityColumns.map((ec: { name: string }) => ec.name)
40-
: spec.entities || [];
41-
const labelFields: { name: string; valueType?: string }[] =
42-
spec.features || [];
37+
const entities: string[] = useMemo(
38+
() =>
39+
spec.entityColumns?.length
40+
? spec.entityColumns.map((ec: { name: string }) => ec.name)
41+
: spec.entities || [],
42+
[spec.entityColumns, spec.entities],
43+
);
44+
const labelFields: { name: string; valueType?: string }[] = useMemo(
45+
() => spec.features || [],
46+
[spec.features],
47+
);
4348

4449
const fieldRoles = annotationConfig.field_roles;
4550
const labelValues = annotationConfig.label_values;

ui/src/pages/label-views/IntegrationsTab.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { useParams } from "react-router-dom";
33
import {
44
EuiPanel,
55
EuiTitle,
6-
EuiHorizontalRule,
76
EuiText,
87
EuiLoadingSpinner,
98
EuiCallOut,
@@ -12,8 +11,6 @@ import {
1211
EuiFlexGroup,
1312
EuiFlexItem,
1413
EuiBadge,
15-
EuiCopy,
16-
EuiButton,
1714
EuiIcon,
1815
} from "@elastic/eui";
1916
import RegistryPathContext from "../../contexts/RegistryPathContext";

0 commit comments

Comments
 (0)