Skip to content

Commit

Permalink
Merge branch '24.x' into feat/truncated-pivot-table-title-with-toolti…
Browse files Browse the repository at this point in the history
…p-v24
  • Loading branch information
janhenrikoverland authored Aug 30, 2024
2 parents f84d6e7 + 74444aa commit 74a8241
Show file tree
Hide file tree
Showing 24 changed files with 2,380 additions and 303 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/copy-build-to-d2-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Copy build to d2-ci

on:
push:
branches-ignore:
- master
- next
- next-major
- alpha
- beta
- '[0-9]+.x'
- '[0-9]+.x.x'
- '[0-9]+.[0-9]+.x'

env:
GH_TOKEN: ${{secrets.DHIS2_BOT_GITHUB_TOKEN}}

jobs:
copy-to-d2-ci:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
token: ${{env.GH_TOKEN}}

- name: Set up Node.js
uses: actions/setup-node@v1
with:
node-version: 12.x

- name: Install dependencies
run: yarn install --frozen-lockfile

- name: Build package
run: yarn build

- name: Pack and unpack the build to a directory named 'package'
run: yarn pack --filename output.tgz && tar -xzf output.tgz

- name: Copy package to d2-ci
uses: dhis2/deploy-build@master
with:
build-dir: package
github-token: ${{env.GH_TOKEN}}
77 changes: 77 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,80 @@
## [24.10.13](https://github.com/dhis2/analytics/compare/v24.10.12...v24.10.13) (2024-06-27)


### Bug Fixes

* apply legend to all numeric and boolean types (DHIS2-17611) [24.x] ([#1687](https://github.com/dhis2/analytics/issues/1687)) ([9e3f166](https://github.com/dhis2/analytics/commit/9e3f1668aaef693393e5a7a46dc839f9aad5bce5))

## [24.10.12](https://github.com/dhis2/analytics/compare/v24.10.11...v24.10.12) (2024-06-25)


### Bug Fixes

* update multicalendar dep for translations (DHIS2-16904) ([#1686](https://github.com/dhis2/analytics/issues/1686)) ([65053e2](https://github.com/dhis2/analytics/commit/65053e2dd099799f5f4d10179784ebfcf0d0bbe3))

## [24.10.11](https://github.com/dhis2/analytics/compare/v24.10.10...v24.10.11) (2024-06-20)


### Bug Fixes

* **pivot-table:** use a scoped base selector and global sub selectors ([#1684](https://github.com/dhis2/analytics/issues/1684)) ([f7c8f16](https://github.com/dhis2/analytics/commit/f7c8f1671910743e3644d040ac0bb4358074b78f))

## [24.10.10](https://github.com/dhis2/analytics/compare/v24.10.9...v24.10.10) (2024-06-12)


### Bug Fixes

* separator for hundreds, thousands and millions is missing in the Pie charts (DHIS2-16172) 24.x ([#1679](https://github.com/dhis2/analytics/issues/1679)) ([f1f47ac](https://github.com/dhis2/analytics/commit/f1f47ac431d4234113ce1910d9f3a5610399734e))

## [24.10.9](https://github.com/dhis2/analytics/compare/v24.10.8...v24.10.9) (2024-06-04)


### Bug Fixes

* numbers are misaligned in pivot table (DHIS2-16900) ([#1671](https://github.com/dhis2/analytics/issues/1671)) ([7fc5321](https://github.com/dhis2/analytics/commit/7fc532122d7bd0f12b2dba1ce005fd7490d47137))

## [24.10.8](https://github.com/dhis2/analytics/compare/v24.10.7...v24.10.8) (2024-04-25)


### Bug Fixes

* single value size and position issues (DHIS2-15344) (DHIS2-13077) [24.x] ([#1646](https://github.com/dhis2/analytics/issues/1646)) ([f052741](https://github.com/dhis2/analytics/commit/f052741ca0f5eafc93094cf53b9bf89f7c7244c3))

## [24.10.7](https://github.com/dhis2/analytics/compare/v24.10.6...v24.10.7) (2024-04-22)


### Bug Fixes

* **interpretations:** plugin flashes when interacting with Interpretations modal ([#1653](https://github.com/dhis2/analytics/issues/1653)) ([17d8e12](https://github.com/dhis2/analytics/commit/17d8e12da54def840b9f329ffe93b635342c2d2c))

## [24.10.6](https://github.com/dhis2/analytics/compare/v24.10.5...v24.10.6) (2024-04-19)


### Bug Fixes

* **aboutAOUnit:** newlines missing in AO description ([#1656](https://github.com/dhis2/analytics/issues/1656)) ([8fe3a14](https://github.com/dhis2/analytics/commit/8fe3a14ec256f6eb2990fffcc092b1eea8911885)), closes [#1655](https://github.com/dhis2/analytics/issues/1655)

## [24.10.5](https://github.com/dhis2/analytics/compare/v24.10.4...v24.10.5) (2024-04-03)


### Bug Fixes

* avoid crash in DV with some chart types (DHIS2-15882) [24.x] ([#1651](https://github.com/dhis2/analytics/issues/1651)) ([68907d2](https://github.com/dhis2/analytics/commit/68907d2ef4dc1e200eeaa03c2b092229a68b9a99)), closes [#1582](https://github.com/dhis2/analytics/issues/1582)

## [24.10.4](https://github.com/dhis2/analytics/compare/v24.10.3...v24.10.4) (2024-04-02)


### Bug Fixes

* interpretations panel renders with flashing when liking or unliking an interpretation ([#1643](https://github.com/dhis2/analytics/issues/1643)) ([4148bf9](https://github.com/dhis2/analytics/commit/4148bf9ae1c8aa386abd7b2b7ad2c01636d8b06d)), closes [#1600](https://github.com/dhis2/analytics/issues/1600)

## [24.10.3](https://github.com/dhis2/analytics/compare/v24.10.2...v24.10.3) (2024-03-20)


### Bug Fixes

* show correct date and time in About AO Unit [DHIS2-15825, DHIS2-16365] [24.x] ([#1642](https://github.com/dhis2/analytics/issues/1642)) ([1c9068c](https://github.com/dhis2/analytics/commit/1c9068c9d153798ccbd61f6b916c1ee94ec122f8))

## [24.10.2](https://github.com/dhis2/analytics/compare/v24.10.1...v24.10.2) (2023-10-25)


Expand Down
48 changes: 29 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,8 @@
**master**
[![Test](https://github.com/dhis2/analytics/actions/workflows/node-test.yml/badge.svg)](https://github.com/dhis2/analytics/actions/workflows/node-test.yml) [![DHIS2: Release](https://github.com/dhis2/analytics/actions/workflows/node-publish.yml/badge.svg)](https://github.com/dhis2/analytics/actions/workflows/node-publish.yml)

**21.x**
[![Test](https://github.com/dhis2/analytics/actions/workflows/node-test.yml/badge.svg?branch=21.x)](https://github.com/dhis2/analytics/actions/workflows/node-test.yml) [![DHIS2: Release](https://github.com/dhis2/analytics/actions/workflows/node-publish.yml/badge.svg?branch=21.x)](https://github.com/dhis2/analytics/actions/workflows/node-publish.yml)

**20.x**
[![Test](https://github.com/dhis2/analytics/actions/workflows/node-test.yml/badge.svg?branch=20.x)](https://github.com/dhis2/analytics/actions/workflows/node-test.yml) [![DHIS2: Release](https://github.com/dhis2/analytics/actions/workflows/node-publish.yml/badge.svg?branch=20.x)](https://github.com/dhis2/analytics/actions/workflows/node-publish.yml)

**16.x**
[![Test](https://github.com/dhis2/analytics/actions/workflows/node-test.yml/badge.svg?branch=16.x)](https://github.com/dhis2/analytics/actions/workflows/node-test.yml) [![DHIS2: Release](https://github.com/dhis2/analytics/actions/workflows/node-publish.yml/badge.svg?branch=16.x)](https://github.com/dhis2/analytics/actions/workflows/node-publish.yml)

**11.0.x**
[![Test](https://github.com/dhis2/analytics/actions/workflows/node-test.yml/badge.svg?branch=11.0.x)](https://github.com/dhis2/analytics/actions/workflows/node-test.yml) [![DHIS2: Release](https://github.com/dhis2/analytics/actions/workflows/node-publish.yml/badge.svg?branch=11.0.x)](https://github.com/dhis2/analytics/actions/workflows/node-publish.yml)

**4.x**
[![Test](https://github.com/dhis2/analytics/actions/workflows/node-test.yml/badge.svg?branch=4.x)](https://github.com/dhis2/analytics/actions/workflows/node-test.yml) [![DHIS2: Release](https://github.com/dhis2/analytics/actions/workflows/node-publish.yml/badge.svg?branch=4.x)](https://github.com/dhis2/analytics/actions/workflows/node-publish.yml)

**2.4.x**
[![Test](https://github.com/dhis2/analytics/actions/workflows/node-test.yml/badge.svg?branch=2.4.x)](https://github.com/dhis2/analytics/actions/workflows/node-test.yml) [![DHIS2: Release](https://github.com/dhis2/analytics/actions/workflows/node-publish.yml/badge.svg?branch=2.4.x)](https://github.com/dhis2/analytics/actions/workflows/node-publish.yml)
**24.x**
[![Test](https://github.com/dhis2/analytics/actions/workflows/node-test.yml/badge.svg?branch=24.x)](https://github.com/dhis2/analytics/actions/workflows/node-test.yml) [![DHIS2: Release](https://github.com/dhis2/analytics/actions/workflows/node-publish.yml/badge.svg?branch=24.x)](https://github.com/dhis2/analytics/actions/workflows/node-publish.yml)

## Overview

Expand All @@ -28,22 +13,47 @@ The analytics library contains components and modules that are used in DHIS 2 an
- [dhis2/dashboards-app](https://github.com/dhis2/dashboards-app)
- [dhis2/data-visualizer-app](https://github.com/dhis2/data-visualizer-app)
- [dhis2/maps-app](https://github.com/dhis2/maps-app)
- [dhis2/line-listing-app](https://github.com/dhis2/line-listing-app)

[Module layout documentation](./docs/module-layout.md)

## Publishing

The analytics package is published to npm as @dhis2/analytics.

To publish, simply mark the commit using [semantic release terminology](https://github.com/angular/angular.js/blob/master/DEVELOPERS.md#-git-commit-guidelines) (see notes below for branch-specific restrictions). Once committed, github actions will take care of publishing the new version to npm.
To publish, mark the commit using [semantic release terminology](https://github.com/angular/angular.js/blob/master/DEVELOPERS.md#-git-commit-guidelines) (see notes below for branch-specific restrictions). Once committed, github actions will take care of publishing the new version to npm.

### master branch

The master branch follows semantic versioning according to spec.

### .x branches

Commits to .x branches (e.g. 16.x) cannot trigger a major version bump, even if it is technically a breaking change. This is because the next version has already been published. Additionally, branches that use .x for the patch version (e.g. 11.0.x, 2.4.x), cannot trigger a minor version bump. In the unlikely case that you need to commit a change that would trigger a version bump that's not possible, you will have to mark it to only trigger a patch or minor bump respectively, then make sure to update the apps that are locked to the .x version of analytics
Commits to .x branches (e.g. 24.x) cannot trigger a major version bump, even if it is technically a breaking change. This is because the next version has already been published. Additionally, branches that use .x for the patch version (e.g. 11.0.x, 2.4.x), cannot trigger a minor version bump. In the unlikely case that you need to commit a change that would trigger a version bump that's not possible, you will have to mark it to only trigger a patch or minor bump respectively, then make sure to update the apps that are locked to the .x version of analytics

## Publishing pre-release versions during app development

Builds for all non-production branches are automatically copied to [d2-ci/analytics](https://github.com/d2-ci/analytics) for use during development and testing, prior to production release.

To test changes in a development branch, change the analytics dependency of package.json of the app you are testing with. There are a few options:

1. point to a specific commit:

```
"dependencies": {
"@dhis2/analytics": "git+https://github.com/d2-ci/analytics.git#70249ebe8be39051fa10142f850de449e1ec488c",
...
}
```

2. point to a branch:

```
"dependencies": {
"@dhis2/analytics": "git+https://github.com/d2-ci/analytics.git#chore/some-chore",
...
}
```

## Report an issue

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": "@dhis2/analytics",
"version": "24.10.2",
"version": "24.10.13",
"main": "./build/cjs/index.js",
"module": "./build/es/index.js",
"exports": {
Expand Down Expand Up @@ -59,11 +59,11 @@
},
"dependencies": {
"@dhis2/d2-ui-rich-text": "^7.4.0",
"@dhis2/multi-calendar-dates": "1.0.0",
"@dhis2/multi-calendar-dates": "^1.2.2",
"classnames": "^2.3.1",
"d2-utilizr": "^0.2.16",
"d3-color": "^1.2.3",
"highcharts": "^10.2.0",
"highcharts": "^10.3.3",
"lodash": "^4.17.21",
"mathjs": "^9.4.2",
"react-beautiful-dnd": "^10.1.1",
Expand Down
18 changes: 14 additions & 4 deletions src/components/AboutAOUnit/AboutAOUnit.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import { useDataQuery, useDataMutation } from '@dhis2/app-runtime'
import {
useDataQuery,
useDataMutation,
useTimeZoneConversion,
} from '@dhis2/app-runtime'
import i18n from '@dhis2/d2-i18n'
import { Parser as RichTextParser } from '@dhis2/d2-ui-rich-text'
import {
Expand Down Expand Up @@ -57,6 +61,7 @@ const getUnsubscribeMutation = (type, id) => ({

const AboutAOUnit = forwardRef(({ type, id, renderId }, ref) => {
const [isExpanded, setIsExpanded] = useState(true)
const { fromServerDate } = useTimeZoneConversion()

const queries = useMemo(() => getQueries(type), [type])

Expand Down Expand Up @@ -188,6 +193,7 @@ const AboutAOUnit = forwardRef(({ type, id, renderId }, ref) => {
<div className="content">
<p
className={cx('detailLine', {
description: true,
noDescription: !data.ao.displayDescription,
})}
>
Expand All @@ -208,7 +214,7 @@ const AboutAOUnit = forwardRef(({ type, id, renderId }, ref) => {
<IconClock16 color={colors.grey700} />
{i18n.t('Last updated {{time}}', {
time: moment(
data.ao.lastUpdated
fromServerDate(data.ao.lastUpdated)
).fromNow(),
})}
</p>
Expand All @@ -219,15 +225,19 @@ const AboutAOUnit = forwardRef(({ type, id, renderId }, ref) => {
'Created {{time}} by {{author}}',
{
time: moment(
data.ao.created
fromServerDate(
data.ao.created
)
).fromNow(),
author: data.ao.createdBy
.displayName,
}
)
: i18n.t('Created {{time}}', {
time: moment(
data.ao.created
fromServerDate(
data.ao.created
)
).fromNow(),
})}
</p>
Expand Down
4 changes: 4 additions & 0 deletions src/components/AboutAOUnit/styles/AboutAOUnit.style.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ export default css`
flex-shrink: 0;
}
.description {
white-space: pre-line;
}
.noDescription {
color: ${colors.grey600};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
} from '@dhis2/ui'
import cx from 'classnames'
import PropTypes from 'prop-types'
import React, { useEffect, useState } from 'react'
import React, { useEffect, useState, useMemo } from 'react'
import css from 'styled-jsx/css'
import { InterpretationThread } from './InterpretationThread.js'
import { useModalContentWidth } from './useModalContentWidth.js'
Expand Down Expand Up @@ -82,7 +82,7 @@ const InterpretationModal = ({
})
const interpretation = data?.interpretation
const shouldRenderModalContent = !error && interpretation
const shouldCssHideModal = loading || isVisualizationLoading
const loadingInProgress = loading || isVisualizationLoading
const handleClose = () => {
if (isDirty) {
onInterpretationUpdate()
Expand All @@ -96,6 +96,13 @@ const InterpretationModal = ({
}
refetch({ id: interpretationId })
}

const onLikeToggled = ({ likedBy }) => {
setIsDirty(true)
interpretation.likedBy = likedBy
interpretation.likes = likedBy.length
}

const onInterpretationDeleted = () => {
setIsDirty(false)
onInterpretationUpdate()
Expand All @@ -108,9 +115,15 @@ const InterpretationModal = ({
}
}, [interpretationId, refetch])

const filters = useMemo(() => {
return {
relativePeriodDate: interpretation?.created,
}
}, [interpretation?.created])

return (
<>
{shouldCssHideModal && (
{loadingInProgress && (
<Layer>
<CenteredContent>
<CircularLoader />
Expand All @@ -121,7 +134,7 @@ const InterpretationModal = ({
fluid
onClose={handleClose}
className={cx(modalCSS.className, {
hidden: shouldCssHideModal,
hidden: loadingInProgress,
})}
dataTest="interpretation-modal"
>
Expand Down Expand Up @@ -155,10 +168,7 @@ const InterpretationModal = ({
<div className="row">
<div className="visualisation-wrap">
<VisualizationPlugin
filters={{
relativePeriodDate:
interpretation.created,
}}
filters={filters}
visualization={visualization}
onResponsesReceived={
onResponsesReceived
Expand All @@ -167,6 +177,7 @@ const InterpretationModal = ({
currentUser.settings
?.keyAnalysisDisplayProperty
}
isInModal={true}
/>
</div>
<div className="thread-wrap">
Expand All @@ -182,6 +193,7 @@ const InterpretationModal = ({
downloadMenuComponent={
downloadMenuComponent
}
onLikeToggled={onLikeToggled}
/>
</div>
</div>
Expand Down
Loading

0 comments on commit 74a8241

Please sign in to comment.