Skip to content

Commit e2a03b5

Browse files
committed
Merge branch 'develop'
2 parents 82bfd1c + 17644ec commit e2a03b5

File tree

18 files changed

+308
-201
lines changed

18 files changed

+308
-201
lines changed

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ jobs:
8080
sbom: true
8181

8282
- name: Update DockerHub Description
83-
uses: peter-evans/dockerhub-description@v4
83+
uses: peter-evans/dockerhub-description@v5
8484
if: github.ref_type == 'tag'
8585
with:
8686
username: ${{ secrets.DOCKERHUB_USERNAME }}

package-lock.json

Lines changed: 26 additions & 76 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "data-rentgen",
3-
"version": "0.4.0",
3+
"version": "0.4.1",
44
"private": true,
55
"type": "module",
66
"description": "Frontend for Data.Rentgen",
@@ -38,7 +38,7 @@
3838
},
3939
"devDependencies": {
4040
"@eslint/compat": "^1.4.0",
41-
"@eslint/js": "^9.36.0",
41+
"@eslint/js": "^9.37.0",
4242
"@rollup/plugin-alias": "^5.1.1",
4343
"@svgr/plugin-svgo": "^8.1.0",
4444
"@types/jest": "^29.5.14",
@@ -47,7 +47,7 @@
4747
"@types/react-dom": "^18.3.5",
4848
"@types/react-syntax-highlighter": "^15.5.13",
4949
"@vitejs/plugin-react": "^4.7.0",
50-
"eslint": "^9.36.0",
50+
"eslint": "^9.37.0",
5151
"eslint-plugin-compat": "^6.0.2",
5252
"eslint-plugin-react": "^7.37.4",
5353
"husky": "^9.1.7",

src/components/dataset/DatasetRaList.tsx

Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,20 @@
11
import { ReactElement } from "react";
2-
import {
3-
List,
4-
TextField,
5-
DatagridConfigurable,
6-
SearchInput,
7-
minLength,
8-
useTranslate,
9-
} from "react-admin";
2+
import { List, TextField, DatagridConfigurable } from "react-admin";
103
import { ListActions } from "@/components/base";
114
import {
125
LocationRaNameWithLinkField,
136
LocationRaTypeWithIconField,
147
} from "@/components/location";
8+
import DatasetRaListFilters from "./DatasetRaListFilters";
159

1610
const DatasetRaList = (): ReactElement => {
17-
const translate = useTranslate();
18-
19-
const datasetFilters = [
20-
<SearchInput
21-
key="search_query"
22-
source="search_query"
23-
alwaysOn
24-
validate={minLength(3)}
25-
placeholder={translate(
26-
"resources.datasets.filters.search_query.placeholder",
27-
)}
28-
/>,
29-
];
30-
3111
return (
3212
<List
33-
actions={<ListActions />}
34-
filters={datasetFilters}
13+
actions={
14+
<ListActions>
15+
<DatasetRaListFilters />
16+
</ListActions>
17+
}
3518
resource="datasets"
3619
storeKey={false}
3720
>
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import { FilterLiveForm, minLength } from "react-admin";
2+
3+
import { Box, InputAdornment } from "@mui/material";
4+
import SearchIcon from "@mui/icons-material/Search";
5+
import { TextInput } from "react-admin";
6+
import { LocationRaTypeFilter } from "@/components/location";
7+
8+
const DatasetRaListFilters = () => {
9+
return (
10+
<FilterLiveForm>
11+
<Box display="flex" alignItems="flex-end">
12+
<Box component="span" mr={2} sx={{ flex: "0.2" }}>
13+
<LocationRaTypeFilter />
14+
</Box>
15+
16+
<Box component="span" mr={2} sx={{ flex: "0.3 1 1" }}>
17+
{/* Not using SearchInput here because it doesn't match styles with other filters */}
18+
<TextInput
19+
source="search_query"
20+
InputProps={{
21+
endAdornment: (
22+
<InputAdornment position="end">
23+
<SearchIcon color="disabled" />
24+
</InputAdornment>
25+
),
26+
}}
27+
validate={minLength(3)}
28+
label="resources.datasets.filters.search_query.label"
29+
helperText="resources.datasets.filters.search_query.helperText"
30+
/>
31+
</Box>
32+
</Box>
33+
</FilterLiveForm>
34+
);
35+
};
36+
37+
export default DatasetRaListFilters;

src/components/job/JobRaListFilters.tsx

Lines changed: 28 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,43 @@
1-
import { minLength, useTranslate } from "react-admin";
1+
import { FilterLiveForm, minLength, useTranslate } from "react-admin";
22

3-
import { useForm, FormProvider } from "react-hook-form";
43
import { Box, Button, InputAdornment } from "@mui/material";
54
import SearchIcon from "@mui/icons-material/Search";
6-
import { TextInput, useListContext } from "react-admin";
7-
import { useEffect } from "react";
5+
import { TextInput } from "react-admin";
86
import JobTypeRaFilter from "./JobRaTypeFilter";
9-
10-
type JobRaListFilterValues = {
11-
job_type?: string[];
12-
search_query?: string;
13-
};
7+
import { LocationRaTypeFilter } from "../location";
148

159
const JobRaListFilters = () => {
1610
const translate = useTranslate();
17-
const { filterValues, setFilters } = useListContext();
18-
const form = useForm({ defaultValues: filterValues });
19-
20-
const submit = form.handleSubmit((formValues: JobRaListFilterValues) => {
21-
if (Object.keys(formValues).length > 0) {
22-
setFilters(formValues);
23-
}
24-
});
25-
26-
// fill up filters just after opening the page
27-
useEffect(() => {
28-
submit();
29-
}, []);
3011

3112
return (
32-
<FormProvider {...form}>
33-
<form onSubmit={submit}>
34-
<Box display="flex" alignItems="flex-end">
35-
<Box component="span" mr={2}>
36-
<JobTypeRaFilter />
37-
</Box>
13+
<FilterLiveForm>
14+
<Box display="flex" alignItems="flex-end">
15+
<Box component="span" mr={2} sx={{ flex: "0.2" }}>
16+
<LocationRaTypeFilter />
17+
</Box>
3818

39-
<Box component="span" mr={2} sx={{ flex: "0.3 1 1" }}>
40-
{/* Not using SearchInput here because it doesn't match styles with other filters */}
41-
<TextInput
42-
source="search_query"
43-
InputProps={{
44-
endAdornment: (
45-
<InputAdornment position="end">
46-
<SearchIcon color="disabled" />
47-
</InputAdornment>
48-
),
49-
}}
50-
validate={minLength(3)}
51-
label="resources.jobs.filters.search_query.label"
52-
helperText="resources.jobs.filters.search_query.helperText"
53-
/>
54-
</Box>
19+
<Box component="span" mr={2} sx={{ flex: "0.2" }}>
20+
<JobTypeRaFilter />
21+
</Box>
5522

56-
<Box component="span" mb={4}>
57-
<Button
58-
variant="outlined"
59-
color="primary"
60-
type="submit"
61-
>
62-
{translate("resources.jobs.filters.apply_button")}
63-
</Button>
64-
</Box>
23+
<Box component="span" mr={2} sx={{ flex: "0.3 1 1" }}>
24+
{/* Not using SearchInput here because it doesn't match styles with other filters */}
25+
<TextInput
26+
source="search_query"
27+
InputProps={{
28+
endAdornment: (
29+
<InputAdornment position="end">
30+
<SearchIcon color="disabled" />
31+
</InputAdornment>
32+
),
33+
}}
34+
validate={minLength(3)}
35+
label="resources.jobs.filters.search_query.label"
36+
helperText="resources.jobs.filters.search_query.helperText"
37+
/>
6538
</Box>
66-
</form>
67-
</FormProvider>
39+
</Box>
40+
</FilterLiveForm>
6841
);
6942
};
7043

src/components/lineage/LineageFilters.tsx

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,15 @@ type LineageFilterValues = {
2727
granularity?: string;
2828
include_column_lineage?: boolean;
2929
};
30+
type LineageFilterKeys = keyof LineageFilterValues;
31+
const lineageFilterKeys: LineageFilterKeys[] = [
32+
"since",
33+
"until",
34+
"depth",
35+
"direction",
36+
"granularity",
37+
"include_column_lineage",
38+
];
3039

3140
type LineageFiltersProps = {
3241
onSubmit: (values: LineageFilterValues) => void;
@@ -76,10 +85,20 @@ const LineageFilters = ({
7685
granularities.includes(choice.id),
7786
);
7887

79-
const submit = form.handleSubmit((formValues: LineageFilterValues) => {
80-
listParamsActions.setFilters(formValues);
81-
onSubmit(formValues);
82-
});
88+
const submit = form.handleSubmit(
89+
(formValues: LineageFilterValues & { [key: string]: any }) => {
90+
const keys = Object.keys(formValues);
91+
const validKeys = lineageFilterKeys.filter((key) =>
92+
keys.includes(key),
93+
);
94+
const validValues = validKeys.reduce(
95+
(acc, key) => ({ ...acc, [key]: formValues[key] }),
96+
{},
97+
);
98+
listParamsActions.setFilters(validValues);
99+
onSubmit(validValues);
100+
},
101+
);
83102

84103
// draw lineage just after opening the page
85104
useEffect(() => {

src/components/location/LocationRaList.tsx

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,21 @@ import {
33
List,
44
TextField,
55
DatagridConfigurable,
6-
SearchInput,
7-
minLength,
8-
useTranslate,
96
WithRecord,
107
WrapperField,
118
} from "react-admin";
129
import { ListActions } from "@/components/base";
1310
import LocationIconWithType from "./LocationIconWithType";
11+
import LocationRaListFilters from "./LocationRaListFilters";
1412

1513
const LocationRaList = (): ReactElement => {
16-
const translate = useTranslate();
17-
18-
const locationFilters = [
19-
<SearchInput
20-
key="search_query"
21-
source="search_query"
22-
alwaysOn
23-
validate={minLength(3)}
24-
placeholder={translate(
25-
"resources.locations.filters.search_query.placeholder",
26-
)}
27-
/>,
28-
];
29-
3014
return (
3115
<List
32-
actions={<ListActions />}
33-
filters={locationFilters}
16+
actions={
17+
<ListActions>
18+
<LocationRaListFilters />
19+
</ListActions>
20+
}
3421
resource="locations"
3522
storeKey={false}
3623
>
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import { FilterLiveForm, minLength } from "react-admin";
2+
3+
import { Box, InputAdornment } from "@mui/material";
4+
import SearchIcon from "@mui/icons-material/Search";
5+
import { TextInput } from "react-admin";
6+
import LocationRaTypeFilter from "./LocationRaTypeFilter";
7+
8+
const LocationRaListFilters = () => {
9+
return (
10+
<FilterLiveForm>
11+
<Box display="flex" alignItems="flex-end">
12+
<Box component="span" mr={2} sx={{ flex: "0.2" }}>
13+
<LocationRaTypeFilter />
14+
</Box>
15+
16+
<Box component="span" mr={2} sx={{ flex: "0.5 1 1" }}>
17+
{/* Not using SearchInput here because it doesn't match styles with other filters */}
18+
<TextInput
19+
source="search_query"
20+
InputProps={{
21+
endAdornment: (
22+
<InputAdornment position="end">
23+
<SearchIcon color="disabled" />
24+
</InputAdornment>
25+
),
26+
}}
27+
validate={minLength(3)}
28+
label="resources.locations.filters.search_query.label"
29+
helperText="resources.locations.filters.search_query.helperText"
30+
/>
31+
</Box>
32+
</Box>
33+
</FilterLiveForm>
34+
);
35+
};
36+
37+
export default LocationRaListFilters;
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import { LocationTypesResponseV1 } from "@/dataProvider/types";
2+
import { ReactElement, useEffect, useState } from "react";
3+
import { SelectArrayInput, useDataProvider, useTranslate } from "react-admin";
4+
import { getDefaultLocationType } from "./LocationType";
5+
6+
const LocationRaTypeFilter = (): ReactElement => {
7+
const dataProvider = useDataProvider();
8+
const translate = useTranslate();
9+
10+
const [locationTypes, setLocationTypes] = useState<string[]>([]);
11+
12+
useEffect(() => {
13+
dataProvider
14+
.getLocationTypes({})
15+
.then((response: LocationTypesResponseV1) => {
16+
setLocationTypes(response.location_types);
17+
});
18+
}, [dataProvider]);
19+
20+
const locationTypesRepr = locationTypes.map((locationType) => {
21+
return {
22+
id: locationType,
23+
name: translate(
24+
`resources.locations.types.${locationType.toLocaleLowerCase()}`,
25+
{ _: getDefaultLocationType(locationType) },
26+
),
27+
};
28+
});
29+
30+
return (
31+
<SelectArrayInput
32+
source="location_type"
33+
choices={locationTypesRepr}
34+
label="resources.locations.filters.location_type.label"
35+
helperText="resources.locations.filters.location_type.helperText"
36+
/>
37+
);
38+
};
39+
40+
export default LocationRaTypeFilter;

0 commit comments

Comments
 (0)