Skip to content

Commit

Permalink
Filter improvement calculation (#368)
Browse files Browse the repository at this point in the history
* Clean console

* Clean code

* Filter able to calculate the filter by themself

* test

* Update logger

* Update workflow

* Fix based on the E2E error
  • Loading branch information
meomancer authored Jan 22, 2025
1 parent 7647ee1 commit 5ea2bdf
Show file tree
Hide file tree
Showing 30 changed files with 333 additions and 1,857 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ on:
push:
branches: [ main ]
pull_request:
branches: [ main, version-2.0.0 ]
branches: [ main, version-2.0.0, Filter-improvement ]

jobs:
flake8_py3:
Expand Down Expand Up @@ -97,11 +97,11 @@ jobs:
matrix:
test_suite: [
{ name: "Backend Tests", script: "make devweb-test" },
{ name: "E2E Tests: Project Creation", path: "tests/project_creation", workers: 2, script_load : "make load-test-data" },
{ name: "E2E Tests: Project View", path: "tests/project_view", workers: 3, script_load : "make load-test-data" },
{ name: "E2E Tests: Admin List", path: "tests/admin_list", workers: 3, script_load : "make load-test-data" },
{ name: "E2E Tests: Admin Edit", path: "tests/admin_edit", workers: 3, script_load : "make load-test-data" },
{ name: "E2E Tests: Admin List Filter", path: "tests/admin_filter", workers: 3, script_load : "make load-test-data-for-filter" }
{ name: "E2E Tests: Project Creation", path: "tests/project_creation", workers: 2, script_load: "make load-test-data" },
{ name: "E2E Tests: Project View", path: "tests/project_view", workers: 3, script_load: "make load-test-data" },
{ name: "E2E Tests: Admin List", path: "tests/admin_list", workers: 3, script_load: "make load-test-data" },
{ name: "E2E Tests: Admin Edit", path: "tests/admin_edit", workers: 3, script_load: "make load-test-data" },
{ name: "E2E Tests: Admin List Filter", path: "tests/admin_filter", workers: 3, script_load: "make load-test-data-for-filter" }
]
env:
APP_IMAGE: kartoza/geosight
Expand Down
1 change: 1 addition & 0 deletions django_project/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"@babel/preset-react": "^7.16.7",
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.6",
"@types/jquery": "^3.5.32",
"@types/lodash": "^4.17.14",
"@types/mapbox__mapbox-gl-draw": "^1.4.8",
"@types/mapbox-gl": "^3.4.1",
"@types/pluralize": "^0.0.33",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,12 @@
* __date__ = '16/01/2025'
* __copyright__ = ('Copyright 2023, Unicef')
*/
import React, { memo } from "react";
import React, { memo, useCallback } from "react";
import { useDispatch, useSelector } from "react-redux";
import { FilterGroupDataProps } from "./types.d";
import FilterGroup from "./FilterGroup";
import FilterGroup from "./Group";
import { INIT_DATA } from "../../../utils/queryExtraction";
import { Actions } from "../../../store/dashboard";
import FilterControlFiltering from "./FilterControlFiltering";

import './style.scss';

Expand All @@ -42,6 +41,18 @@ const FilterControl = ({ isAdmin }: Props) => {
Actions.Filters.update({ ...filter })
)
}

// UpdateFilter callbacks
const updateFilter = useCallback((data: string[]) => {
if (data === undefined) {
dispatcher(Actions.FilteredGeometries.update(null))
} else if (data === null) {
dispatcher(Actions.FilteredGeometries.update([]))
} else {
dispatcher(Actions.FilteredGeometries.update(data))
}
}, []);

return <FilterGroup
/* Query global */
query={filter}
Expand All @@ -50,6 +61,7 @@ const FilterControl = ({ isAdmin }: Props) => {
/* Is master */
isMaster={true}
isAdmin={isAdmin}
updateFilter={updateFilter}
/>
};

Expand All @@ -66,7 +78,6 @@ const FilterContent = memo(({ isAdmin }: Props) => {
<FilterControl
isAdmin={filtersAllowModify ? filtersAllowModify : isAdmin}
/>
<FilterControlFiltering/>
</div>;
});

Expand Down

This file was deleted.

Loading

0 comments on commit 5ea2bdf

Please sign in to comment.