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

feat: external GeoJSON URL layer in DHIS2 Maps (DHIS2-15981) #3012

Closed
wants to merge 75 commits into from
Closed
Show file tree
Hide file tree
Changes from 44 commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
f1f685b
feat: feature service dialog
turban Nov 10, 2022
2c59fad
Feature service layer
turban Nov 11, 2022
8565b70
feat: feature profile
turban Nov 14, 2022
8396e27
chore: refactor
turban Nov 14, 2022
00778e8
chore: refactor
turban Nov 14, 2022
8dfe94a
chore: refactor
turban Nov 14, 2022
093f17c
feat: feature style
turban Nov 15, 2022
b34dac0
chore: code clean
turban Nov 15, 2022
8222a5e
feat: feature service
turban Dec 5, 2022
58d742e
chore: fix merge conflicts
turban Oct 17, 2023
91135fe
chore: fix merge conflicts
turban Oct 17, 2023
b3ae4b1
feat: geojson url layer
turban Oct 17, 2023
e24cbc4
chore: bug fix#
turban Oct 17, 2023
8a1781d
feat: feature layer data table
turban Oct 18, 2023
7bc44d0
feat: feature style tab
turban Oct 18, 2023
0f045f4
feat: feature layer styling
turban Oct 18, 2023
e7f2b46
chore: code cleaning
turban Oct 18, 2023
37cf528
chore: localize
turban Oct 18, 2023
9a754c3
chore: linting fixes
turban Oct 18, 2023
39767f1
fix: values from number fields must be integers for the mapping engine
jenniferarnesen Oct 20, 2023
e67cd30
fix: use correct data type in table
jenniferarnesen Oct 20, 2023
ec5dc98
Merge branch 'dev' into feat/geojson
jenniferarnesen Oct 23, 2023
c4c3417
Merge branch 'dev' into feat/geojson
jenniferarnesen Oct 24, 2023
3ca2dcc
fix: latest maps-gl with fix for line style
jenniferarnesen Oct 24, 2023
454c391
chore: temporarily add geosjon files
jenniferarnesen Oct 25, 2023
234c532
fix: cannot use <> as child of Table
jenniferarnesen Oct 25, 2023
1fbff03
chore: temporarily add new data table
jenniferarnesen Oct 26, 2023
c600386
chore: use the external layer config from extermalMapLayers api
jenniferarnesen Oct 30, 2023
fd98496
chore: need to preserve id when its a basemap
jenniferarnesen Oct 30, 2023
2b2d640
fix: manage the feature style for saved and new maps
jenniferarnesen Oct 30, 2023
ad33f7e
chore: keep featureStyle out of config while in app
jenniferarnesen Nov 1, 2023
2beede7
Merge branch 'dev' into feat/geojson
jenniferarnesen Nov 6, 2023
fb64852
chore: remove commented code
jenniferarnesen Nov 6, 2023
54bd94c
chore: remove temp geojson file - all in gh-pages now
jenniferarnesen Nov 6, 2023
7290228
fix: add layer name workaround
jenniferarnesen Nov 6, 2023
78191dc
chore: handle API route url and external urls with error handling
jenniferarnesen Nov 7, 2023
cf4f96d
chore: move featureStyle tweak to cleanLayerConfig
jenniferarnesen Nov 7, 2023
79df51c
chore: remove unused constants
jenniferarnesen Nov 10, 2023
ab5148c
chore: remove loaders/layers that got readded during merge
jenniferarnesen Nov 10, 2023
905814b
chore: use constants
jenniferarnesen Nov 10, 2023
f847d9b
chore: undo unintentional changes
jenniferarnesen Nov 10, 2023
758ff4c
chore: layer.id should be removed for all layers
jenniferarnesen Nov 10, 2023
543cba1
chore: update DetailsPanel tests
jenniferarnesen Nov 13, 2023
14021b4
chore: add tests for createExternalOverlayLayer
jenniferarnesen Nov 13, 2023
1847dbb
chore: clean up unused code and remove forwardRef from dialog
jenniferarnesen Nov 13, 2023
5c99911
chore: name improvement
jenniferarnesen Nov 13, 2023
ac23525
chore: cleanup
jenniferarnesen Nov 13, 2023
d968639
Merge branch 'dev' into feat/geojson
jenniferarnesen Nov 15, 2023
cecf1d3
Merge branch 'dev' into feat/geojson
jenniferarnesen Nov 16, 2023
f33ac62
chore: i18n
jenniferarnesen Nov 16, 2023
79912a2
chore: dataTable ee and facility layers
jenniferarnesen Nov 20, 2023
72f17b7
chore: more datatable work
jenniferarnesen Nov 27, 2023
ec7352c
chore: handle crosscut jwt expired
jenniferarnesen Dec 5, 2023
960b41d
Merge branch 'dev' into feat/geojson
jenniferarnesen Dec 5, 2023
5e8e661
chore: localization
jenniferarnesen Dec 5, 2023
8816c60
Merge branch 'feat/geojson' of github.com:dhis2/maps-app into feat/ge…
jenniferarnesen Dec 5, 2023
e28a941
chore: no width to hidden search icon
jenniferarnesen Dec 5, 2023
2834d85
chore: cleanup unused code and add type to event datatable
jenniferarnesen Dec 7, 2023
7e7c297
Merge branch 'dev' into feat/geojson
jenniferarnesen Dec 8, 2023
e95294c
chore: localization
jenniferarnesen Dec 9, 2023
f12753e
chore: not supporting External layer yet
jenniferarnesen Dec 9, 2023
80ba738
Merge branch 'dev' into feat/geojson
jenniferarnesen Dec 20, 2023
fed4806
Merge branch 'feat/geojson' of github.com:dhis2/maps-app into feat/ge…
jenniferarnesen Dec 21, 2023
13a484f
chore: use UI Data Table
jenniferarnesen Dec 21, 2023
de162e7
chore: test onMouseOver and onMouseOut
jenniferarnesen Dec 22, 2023
27919db
chore: upgrade ui for row hover effect
jenniferarnesen Dec 27, 2023
36a3593
fix: improve hover states and add consistent spacing [UX-161] (#3121)
cooper-joe Jan 26, 2024
d816a67
Merge branch 'dev' into feat/geojson
jenniferarnesen Feb 15, 2024
338c0c4
fix: small adjustment to patch based on code in file
jenniferarnesen Feb 15, 2024
d807d59
fix: generate new webpack patch and remove unused components
jenniferarnesen Feb 15, 2024
4a4423d
fix: update en.pot
jenniferarnesen Feb 15, 2024
0883f00
fix: remove unused files and add geojson header function
jenniferarnesen Feb 15, 2024
27bb56f
fix: remove unused component
jenniferarnesen Feb 15, 2024
741dd25
fix: rename fn
jenniferarnesen Feb 15, 2024
0a313ae
chore: en.pot file
jenniferarnesen Feb 16, 2024
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
34 changes: 29 additions & 5 deletions i18n/en.pot
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ msgstr ""
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
"POT-Creation-Date: 2023-10-23T12:55:26.288Z\n"
"PO-Revision-Date: 2023-10-23T12:55:26.288Z\n"
"POT-Creation-Date: 2023-11-07T12:11:11.385Z\n"
"PO-Revision-Date: 2023-11-07T12:11:11.385Z\n"

msgid "Untitled map, {{date}}"
msgstr "Untitled map, {{date}}"
Expand Down Expand Up @@ -161,6 +161,12 @@ msgstr "Type"
msgid "Data table is not supported when events are grouped on the server."
msgstr "Data table is not supported when events are grouped on the server."

msgid "Sort by {{column}}"
msgstr "Sort by {{column}}"

msgid "Search"
msgstr "Search"

msgid "Items"
msgstr "Items"

Expand Down Expand Up @@ -245,6 +251,9 @@ msgstr "org unit"
msgid "Earth Engine"
msgstr "Earth Engine"

msgid "feature"
msgstr "feature"

msgid "Edit {{name}} layer"
msgstr "Edit {{name}} layer"

Expand Down Expand Up @@ -376,6 +385,18 @@ msgstr "Radius in meters"
msgid "Buffer can't be combined with associated geometry."
msgstr "Buffer can't be combined with associated geometry."

msgid "Fill color"
msgstr "Fill color"

msgid "Line/stroke color"
msgstr "Line/stroke color"

msgid "Line/stroke width"
msgstr "Line/stroke width"

msgid "Point size"
msgstr "Point size"

msgid "Labels"
msgstr "Labels"

Expand Down Expand Up @@ -469,9 +490,6 @@ msgstr "Display Tracked Entity relationships"
msgid "Tracked entity style"
msgstr "Tracked entity style"

msgid "Point size"
msgstr "Point size"

msgid "Related entity style"
msgstr "Related entity style"

Expand All @@ -484,6 +502,9 @@ msgstr "No relationship types were found for tracked entity type {{type}}"
msgid "Relationship type"
msgstr "Relationship type"

msgid "Feature profile"
msgstr "Feature profile"

msgid "Remove filter"
msgstr "Remove filter"

Expand Down Expand Up @@ -587,6 +608,9 @@ msgstr "Group"
msgid "Filters"
msgstr "Filters"

msgid "Failed to load map layer \"{{layername}}\" with url: {{layerurl}}"
msgstr "Failed to load map layer \"{{layername}}\" with url: {{layerurl}}"

msgid "Drill up one level"
msgstr "Drill up one level"

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"@dhis2/app-service-alerts": "^3.9.4",
"@dhis2/app-service-datastore": "^1.0.0-beta.3",
"@dhis2/d2-i18n": "^1.1.1",
"@dhis2/maps-gl": "^3.8.5",
"@dhis2/maps-gl": "^3.8.6",
"@dhis2/ui": "^8.13.15",
"@krakenjs/post-robot": "^11.0.0",
"@reportportal/agent-js-cypress": "^5.1.4",
Expand Down
Binary file added public/images/featurelayer.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions src/actions/feature.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,12 @@ export const highlightFeature = (payload) => ({
type: types.FEATURE_HIGHLIGHT,
payload,
})

export const setFeatureProfile = (payload) => ({
type: types.FEATURE_PROFILE_SET,
payload,
})

export const closeFeatureProfile = () => ({
type: types.FEATURE_PROFILE_CLOSE,
})
6 changes: 6 additions & 0 deletions src/actions/layerEdit.js
Original file line number Diff line number Diff line change
Expand Up @@ -358,3 +358,9 @@ export const setNoDataColor = (color) => ({
type: types.LAYER_EDIT_NO_DATA_COLOR_SET,
payload: color,
})

// Set feature style
export const setFeatureStyle = (payload) => ({
type: types.LAYER_EDIT_FEATURE_STYLE_SET,
payload,
})
18 changes: 16 additions & 2 deletions src/components/app/DetailsPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,35 @@ import cx from 'classnames'
import PropTypes from 'prop-types'
import React from 'react'
import { useSelector } from 'react-redux'
import FeatureProfile from '../feature/FeatureProfile.js'
import Interpretations from '../interpretations/Interpretations.js'
import OrgUnitProfile from '../orgunits/OrgUnitProfile.js'
import styles from './styles/DetailsPanel.module.css'

const DetailsPanel = ({ interpretationsRenderCount }) => {
const detailsPanelOpen = useSelector((state) => state.ui.rightPanelOpen)
const viewOrgUnitProfile = useSelector((state) => state.orgUnitProfile)
const viewFeatureProfile = useSelector((state) => !!state.featureProfile)
const interpretationId = useSelector((state) => state.interpretation?.id)

const getContent = () => {
if (interpretationId || (detailsPanelOpen && !viewOrgUnitProfile)) {
if (
interpretationId ||
(detailsPanelOpen && !viewOrgUnitProfile && !viewFeatureProfile)
) {
return <Interpretations renderCount={interpretationsRenderCount} />
}

return detailsPanelOpen ? <OrgUnitProfile /> : null
if (detailsPanelOpen) {
if (viewOrgUnitProfile) {
return <OrgUnitProfile />
}
if (viewFeatureProfile) {
return <FeatureProfile />
}
}

return null
}

return (
Expand Down
8 changes: 0 additions & 8 deletions src/components/app/FileMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,6 @@ const FileMenu = ({ onFileMenuAction }) => {
defaultBasemapId: defaultBasemap,
})

if (config.mapViews) {
config.mapViews.forEach((view) => delete view.id)
}

await saveMapMutate({
id: map.id,
data: config,
Expand Down Expand Up @@ -141,10 +137,6 @@ const FileMenu = ({ onFileMenuAction }) => {

delete config.id

if (config.mapViews) {
config.mapViews.forEach((view) => delete view.id)
}

const response = await saveAsNewMapMutate({
data: config,
})
Expand Down
202 changes: 97 additions & 105 deletions src/components/app/__tests__/Detailspanel.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,121 +22,113 @@ jest.mock(
}
)

describe('DetailsPanel', () => {
test('renders InterpretationsPanel when has interpretationId, has orgUnitProfile and panel is open', () => {
const store = {
interpretation: { id: 'abc123' },
orgUnitProfile: 'xyzpdq',
ui: { rightPanelOpen: true },
}

const { container } = render(
<Provider store={mockStore(store)}>
<DetailsPanel interpretationsRenderCount={1} />
</Provider>
)
expect(container).toMatchSnapshot()
})
test('renders InterpretationsPanel when has interpretationId, has orgUnitProfile and panel is closed', () => {
const store = {
interpretation: { id: 'abc123' },
orgUnitProfile: 'xyzpdq',
ui: { rightPanelOpen: false },
jest.mock(
'../../feature/FeatureProfile.js',
() =>
function MockFeatureProfile() {
return <div>Feature Profile</div>
}
)

const { container } = render(
<Provider store={mockStore(store)}>
<DetailsPanel interpretationsRenderCount={1} />
</Provider>
)
expect(container).toMatchSnapshot()
})
test('renders InterpretationsPanel when has interpretationId, no orgUnitProfile and panel is open', () => {
const store = {
interpretation: { id: 'abc123' },
const interpretation = { id: 'myinterpretation' }
const orgUnitProfile = 'myorgunit'
const featureProfile = 'myfeature'
const uiWithPanelOpen = { rightPanelOpen: true }
const uiWithPanelClosed = { rightPanelOpen: false }

const testCases = [
{
store: {
interpretation,
orgUnitProfile,
featureProfile,
ui: uiWithPanelOpen,
},
expected: 'Interpretations',
},
{
store: {
interpretation,
orgUnitProfile,
featureProfile,
ui: uiWithPanelClosed,
},
expected: 'Interpretations',
},
{
store: {
interpretation,
orgUnitProfile: null,
ui: { rightPanelOpen: true },
}

const { container } = render(
<Provider store={mockStore(store)}>
<DetailsPanel interpretationsRenderCount={1} />
</Provider>
)
expect(container).toMatchSnapshot()
})

test('renders InterpretationsPanel when has interpretationId, no orgUnitProfile and panel is closed', () => {
const store = {
interpretation: { id: 'abc123' },
featureProfile: null,
ui: uiWithPanelOpen,
},
expected: 'Interpretations',
},
{
store: {
interpretation,
orgUnitProfile: null,
ui: { rightPanelOpen: false },
}

const { container } = render(
<Provider store={mockStore(store)}>
<DetailsPanel interpretationsRenderCount={1} />
</Provider>
)
expect(container).toMatchSnapshot()
})

test('renders OrgUnitProfile when no interpretationId, has orgUnitProfile and panel is open', () => {
const store = {
featureProfile: null,
ui: uiWithPanelClosed,
},
expected: 'Interpretations',
},
{
store: {
interpretation: {},
orgUnitProfile: 'xyzpdq',
ui: { rightPanelOpen: true },
}

const { container } = render(
<Provider store={mockStore(store)}>
<DetailsPanel interpretationsRenderCount={1} />
</Provider>
)
expect(container).toMatchSnapshot()
})

test('renders null when no interpretationId, has orgUnitProfile, and panel closed', () => {
const store = {
orgUnitProfile: null,
featureProfile: null,
ui: uiWithPanelOpen,
},
expected: 'Interpretations',
},
{
store: {
interpretation: {},
orgUnitProfile: 'xyzpdq',
ui: { rightPanelOpen: false },
}

const { container } = render(
<Provider store={mockStore(store)}>
<DetailsPanel interpretationsRenderCount={1} />
</Provider>
)
expect(container).toMatchSnapshot()
})
test('renders InterpretationsPanel when no interpretationId, no orgUnitProfile and panel open', () => {
const store = {
orgUnitProfile,
featureProfile,
ui: uiWithPanelOpen,
},
expected: 'OrgUnitProfile',
},
{
store: {
interpretation: {},
orgUnitProfile: null,
ui: { rightPanelOpen: true },
}

const { container } = render(
<Provider store={mockStore(store)}>
<DetailsPanel interpretationsRenderCount={1} />
</Provider>
)
expect(container).toMatchSnapshot()
})

test('renders null when no interpretationId, no orgUnitProfile, and panel closed', () => {
const store = {
featureProfile,
ui: uiWithPanelOpen,
},
expected: 'FeatureProfile',
},
{
store: {
interpretation: {},
orgUnitProfile,
featureProfile: null,
ui: uiWithPanelClosed,
},
expected: 'null',
},
{
store: {
interpretation: {},
orgUnitProfile: null,
ui: { rightPanelOpen: false },
}
featureProfile: null,
ui: uiWithPanelClosed,
},
expected: 'null',
},
]

const { container } = render(
<Provider store={mockStore(store)}>
<DetailsPanel interpretationsRenderCount={1} />
</Provider>
)
expect(container).toMatchSnapshot()
describe('DetailsPanel', () => {
testCases.forEach(({ store, expected }) => {
test(`renders ${expected} when interpretation=${store.interpretation.id}, orgUnitProfile=${store.orgUnitProfile}, featureProfile=${store.featureProfile} and panelOpen=${store.ui.rightPanelOpen}`, () => {
const { container } = render(
<Provider store={mockStore(store)}>
<DetailsPanel />
</Provider>
)
expect(container).toMatchSnapshot()
})
})
})
Loading
Loading