Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add source & report status filtering on list view #565

Merged
merged 2 commits into from
Feb 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion public/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,8 @@
"refresh": {
"accepted": "Refresh accepted",
"notAllowed": "Refresh not possible"
}
},
"updated": "Last update"
},
"edit": {
"refresh": "Refresh data",
Expand Down
3 changes: 2 additions & 1 deletion public/locales/fr/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,8 @@
"refresh": {
"accepted": "Actualisation acceptée",
"notAllowed": "Actualisation impossible"
}
},
"updated": "Dernière mise à jour"
},
"edit": {
"refresh": "Actualiser les données",
Expand Down
15 changes: 15 additions & 0 deletions src/modules/RA/DataSource/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,18 @@ export const scrTypes = {
[EPSG3857]: 'EPSG:3857 - WGS 84 / Pseudo-Mercator',
};
export const fieldSCRChoices = typesToChoices(scrTypes);

export const sourceStatusTypes = {
0: 'datasource.refreshStatus.syncNeeded',
1: 'datasource.refreshStatus.pending',
2: 'datasource.refreshStatus.done',
};
export const sourceStatusChoices = typesToChoices(sourceStatusTypes);

export const reportStatusTypes = {
0: 'datasource.refreshStatus.success',
1: 'datasource.refreshStatus.error',
2: 'datasource.refreshStatus.warning',
3: 'datasource.refreshStatus.pending',
};
export const reportStatusChoices = typesToChoices(reportStatusTypes);
18 changes: 18 additions & 0 deletions src/modules/RA/DataSource/views/List.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import {
geomTypeChoices,
sourceTypes,
sourceTypeChoices,
sourceStatusChoices,
reportStatusChoices,
} from '..';
import CommonBulkActionButtons
from '../../../../components/react-admin/CommonBulkActionButtons';
Expand All @@ -39,6 +41,16 @@ const ListFilters = props => (
label="datasource.form.geometry"
choices={geomTypeChoices}
/>
<SelectInput
source="status"
label="datasource.form.status"
choices={sourceStatusChoices}
/>
<SelectInput
source="report__status"
label="datasource.form.report.title"
choices={reportStatusChoices}
/>
</Filter>
);

Expand Down Expand Up @@ -74,6 +86,12 @@ export const DataSourceList = props => (
<StatusChip sourceId={id} status={{ status, report }} />
}
/>
<FunctionField
source="updated_at"
label="datasource.form.updated"
render={({ updated_at: updatedAt }) => new Date(updatedAt).toLocaleDateString()}
/>

<CustomCloneButton endpoint={RES_DATASOURCE} label="" />
</Datagrid>
</List>
Expand Down