Skip to content

Commit

Permalink
Merge in master
Browse files Browse the repository at this point in the history
  • Loading branch information
turban committed Mar 19, 2024
2 parents 5898aa1 + e155908 commit afe0a31
Show file tree
Hide file tree
Showing 8 changed files with 3,714 additions and 2,910 deletions.
22 changes: 22 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
## [100.5.1](https://github.com/dhis2/maps-app/compare/v100.5.0...v100.5.1) (2024-03-19)


### Bug Fixes

* like and unlike interpretation caused flashing in panel and thread [DHIS2-15825] ([#3156](https://github.com/dhis2/maps-app/issues/3156)) ([30f3547](https://github.com/dhis2/maps-app/commit/30f354749262098ae13c644e6c1862412ec8e499))

# [100.5.0](https://github.com/dhis2/maps-app/compare/v100.4.1...v100.5.0) (2024-03-18)


### Bug Fixes

* navigating by the changing url ignored download mode and interpretation id parameters ([#3125](https://github.com/dhis2/maps-app/issues/3125)) ([fcc5eaa](https://github.com/dhis2/maps-app/commit/fcc5eaa40bd29f257544f46d3961ec9d44d1caa5))
* **translations:** sync translations from transifex (dev) ([#3132](https://github.com/dhis2/maps-app/issues/3132)) ([7f5d178](https://github.com/dhis2/maps-app/commit/7f5d1780f4884e4b93a6c07cf37663f1b52943e5))
* improve hover states and add consistent spacing [UX-161] ([#3121](https://github.com/dhis2/maps-app/issues/3121)) ([3f9e667](https://github.com/dhis2/maps-app/commit/3f9e6672a39b92e9af86730a686d2c4ad9be7544))


### Features

* add ability to add GeoJSON URL external layers ([#3127](https://github.com/dhis2/maps-app/issues/3127)) ([fbdf0b0](https://github.com/dhis2/maps-app/commit/fbdf0b04442b127823f1a5ec8fb80b564eaf21fe)), closes [#3142](https://github.com/dhis2/maps-app/issues/3142) [#3144](https://github.com/dhis2/maps-app/issues/3144) [#3145](https://github.com/dhis2/maps-app/issues/3145) [#3149](https://github.com/dhis2/maps-app/issues/3149) [#3148](https://github.com/dhis2/maps-app/issues/3148) [#3147](https://github.com/dhis2/maps-app/issues/3147) [#3143](https://github.com/dhis2/maps-app/issues/3143) [#3151](https://github.com/dhis2/maps-app/issues/3151) [#3154](https://github.com/dhis2/maps-app/issues/3154)
* when rendering for push analytics, disable download button until map is rendered ([#3072](https://github.com/dhis2/maps-app/issues/3072)) ([4b1076c](https://github.com/dhis2/maps-app/commit/4b1076ce61866da09de14e8dbb178d3c82717a6c)), closes [#3121](https://github.com/dhis2/maps-app/issues/3121)

## [100.4.1](https://github.com/dhis2/maps-app/compare/v100.4.0...v100.4.1) (2024-02-26)


Expand Down
7 changes: 2 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: 2024-03-13T15:13:17.773Z\n"
"PO-Revision-Date: 2024-03-13T15:13:17.773Z\n"
"POT-Creation-Date: 2024-03-15T10:46:33.764Z\n"
"PO-Revision-Date: 2024-03-15T10:46:33.764Z\n"

msgid "Untitled map, {{date}}"
msgstr "Untitled map, {{date}}"
Expand Down Expand Up @@ -1338,9 +1338,6 @@ msgstr "Facilities"
msgid "Facilities: No coordinates found"
msgstr "Facilities: No coordinates found"

msgid "Url to geojson is invalid."
msgstr "Url to geojson is invalid."

msgid "There was a problem with this layer. Contact a system administrator."
msgstr "There was a problem with this layer. Contact a system administrator."

Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "maps-app",
"version": "100.4.1",
"version": "100.5.1",
"description": "DHIS2 Maps",
"license": "BSD-3-Clause",
"author": "Bjørn Sandvik",
Expand Down Expand Up @@ -39,13 +39,13 @@
"start-server-and-test": "^2.0.3"
},
"dependencies": {
"@dhis2/analytics": "^26.3.0",
"@dhis2/analytics": "^26.6.0",
"@dhis2/app-runtime": "3.9.4",
"@dhis2/app-runtime-adapter-d2": "^1.1.0",
"@dhis2/app-service-alerts": "3.9.4",
"@dhis2/app-service-datastore": "^1.0.0-beta.3",
"@dhis2/d2-i18n": "^1.1.3",
"@dhis2/maps-gl": "^3.9.0",
"@dhis2/maps-gl": "^3.9.1",
"@dhis2/ui": "^9.2.0",
"@krakenjs/post-robot": "^11.0.0",
"@reportportal/agent-js-cypress": "git+https://github.com/dhis2/agent-js-cypress.git#develop",
Expand Down
25 changes: 19 additions & 6 deletions src/components/layers/overlays/Layer.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import i18n from '@dhis2/d2-i18n'
import { Tooltip } from '@dhis2/ui'
import PropTypes from 'prop-types'
import React from 'react'
import styles from './styles/Layer.module.css'
Expand All @@ -14,12 +15,24 @@ const Layer = ({ layer, onClick }) => {
onClick={() => onClick(layer)}
data-test={dataTest}
>
{img ? (
<img src={img} className={styles.image} />
) : (
<div className={styles.noImage}>{i18n.t('External layer')}</div>
)}
<div className={styles.name}>{label}</div>
<Tooltip
placement="bottom"
content={label}
openDelay={300}
closeDelay={100}
className={styles.tooltip}
>
<div>
{img ? (
<img src={img} className={styles.image} />
) : (
<div className={styles.noImage}>
{i18n.t('External layer')}
</div>
)}
<div className={styles.name}>{label}</div>
</div>
</Tooltip>
</div>
)
}
Expand Down
3 changes: 3 additions & 0 deletions src/components/layers/overlays/styles/Layer.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,6 @@
.container:hover .name {
color: var(--colors-grey900);
}
.tooltip {
transform: translate(0px, -26px);
}
50 changes: 50 additions & 0 deletions src/util/__tests__/filter.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import { filterData } from '../filter.js'

describe('filterData', () => {
it('should return the original data if no filters are provided', () => {
const data = [{ a: 1 }, { a: 2 }, { a: 3 }]
expect(filterData(data)).toEqual(data)
})

it('should filter data based on a string filter', () => {
const data = [{ a: 'apple' }, { a: 'banana' }, { a: 'cherry' }]
const filters = { a: 'a' }
expect(filterData(data, filters)).toEqual([
{ a: 'apple' },
{ a: 'banana' },
])
})

it('should filter data based on a string filter where the value is considered numeric', () => {
const data = [{ a: '1' }, { a: '2' }, { a: '3' }]
const filters = { a: '2' }
expect(filterData(data, filters)).toEqual([{ a: '2' }])
})

// TODO the following tests fail because the code has a bug
it.skip('should filter data based on a numeric filter', () => {
const data = [{ a: 1 }, { a: 2 }, { a: 3 }]
const filters = { a: '>1' }
expect(filterData(data, filters)).toEqual([{ a: 2 }, { a: 3 }])
})

it.skip('should handle complex numeric filters', () => {
const data = [{ a: 1 }, { a: 2 }, { a: 3 }, { a: 4 }, { a: 5 }]
const filters = { a: '>1&<5' }
expect(filterData(data, filters)).toEqual([
{ a: 2 },
{ a: 3 },
{ a: 4 },
])
})

it('should handle multiple string filters', () => {
const data = [
{ a: 'apple', b: 'cow' },
{ a: 'banana', b: 'horse' },
{ a: 'cherry', b: 'dog' },
]
const filters = { a: 'a', b: 'r' }
expect(filterData(data, filters)).toEqual([{ a: 'banana', b: 'horse' }])
})
})
4 changes: 1 addition & 3 deletions src/util/filter.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import isNumeric from 'd2-utilizr/lib/isNumeric'

// Filters an array of object with a set of filters
export const filterData = (data, filters) => {
if (!filters) {
Expand All @@ -17,7 +15,7 @@ export const filterData = (data, filters) => {
const props = d.properties || d // GeoJSON or plain object
const value = props[field]

return isNumeric(value)
return typeof value === 'number'
? numericFilter(value, filter)
: stringFilter(value, filter)
})
Expand Down
Loading

0 comments on commit afe0a31

Please sign in to comment.