Skip to content

Commit

Permalink
Merge pull request #565 from Terralego/sort-list-view
Browse files Browse the repository at this point in the history
Add source & report status filtering on list view
  • Loading branch information
submarcos authored Feb 5, 2024
2 parents edd80c9 + 3f414c0 commit da72cc9
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 2 deletions.
3 changes: 2 additions & 1 deletion public/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,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 @@ -402,7 +402,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

0 comments on commit da72cc9

Please sign in to comment.