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

fix: locked dims not array #491

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
8c5b0c7
chore(translations): sync Chinese translations from transifex (master)
dhis2-bot Oct 23, 2019
bbc8ebf
chore(translations): sync Vietnamese translations from transifex (mas…
dhis2-bot Oct 23, 2019
c37f5a2
chore(translations): sync Urdu translations from transifex (master)
dhis2-bot Oct 23, 2019
a63b9ec
chore(translations): sync Ukrainian translations from transifex (master)
dhis2-bot Oct 23, 2019
cdce03b
chore(translations): sync Tajik translations from transifex (master)
dhis2-bot Oct 23, 2019
8e8e467
chore(translations): sync TetumTetun translations from transifex (mas…
dhis2-bot Oct 23, 2019
a9c2ace
chore(translations): sync Swedish translations from transifex (master)
dhis2-bot Oct 23, 2019
e0d1207
chore(translations): sync PortugueseBrazil translations from transife…
dhis2-bot Oct 23, 2019
21f72cb
chore(translations): sync Portuguese translations from transifex (mas…
dhis2-bot Oct 23, 2019
9af084b
chore(translations): sync Pushto translations from transifex (master)
dhis2-bot Oct 23, 2019
e1531d0
chore(translations): sync Burmese translations from transifex (master)
dhis2-bot Oct 23, 2019
b0c23c8
chore(translations): sync Lao translations from transifex (master)
dhis2-bot Oct 23, 2019
754984e
chore(translations): sync Indonesian translations from transifex (mas…
dhis2-bot Oct 23, 2019
3e5ab95
chore(translations): sync French translations from transifex (master)
dhis2-bot Oct 23, 2019
ee07b7b
chore(translations): sync PersianAfghanistan translations from transi…
dhis2-bot Oct 23, 2019
5f8ec50
chore(translations): sync Spanish translations from transifex (master)
dhis2-bot Oct 23, 2019
6067063
chore(translations): sync Danish translations from transifex (master)
dhis2-bot Oct 23, 2019
2941ee9
chore(translations): sync Arabic translations from transifex (master)
dhis2-bot Oct 23, 2019
4bcb913
chore(translations): sync Russian translations from transifex (master)
dhis2-bot Oct 24, 2019
74edb3c
chore(deps): upgrade d2-i18n(-generate) deps (master) (#359)
varl Oct 24, 2019
8c0ed13
fix: changed height to min-height for the axes area (#361)
martinkrulltott Nov 5, 2019
dd8b563
updated analytics repo (#363)
martinkrulltott Nov 5, 2019
204fe7a
fix: use axisName instead of axisKey
janhenrikoverland Nov 5, 2019
d6ba4a3
refactor: use dimension menu from @dhis2/analytics (#364)
janhenrikoverland Nov 11, 2019
a3dbb9f
feat: use layout rules for add-to-layout ui (#362)
janhenrikoverland Nov 11, 2019
26d12c6
fix: use shared vis types (#368)
martinkrulltott Nov 14, 2019
91847d2
Fix: Implement disallowed dims from Analytics UI rules (#370)
martinkrulltott Nov 14, 2019
22c36e2
fix: map is not vis type (#371)
martinkrulltott Nov 15, 2019
c96ac09
fix: changed incorrect prop types and tests (#372)
martinkrulltott Nov 15, 2019
e6c7fa6
chore(translations): sync Chinese translations from transifex (master)
dhis2-bot Nov 19, 2019
ecbf268
chore(translations): sync Vietnamese translations from transifex (mas…
dhis2-bot Nov 19, 2019
f95ef04
chore(translations): sync Ukrainian translations from transifex (master)
dhis2-bot Nov 19, 2019
6b76689
chore(translations): sync Tajik translations from transifex (master)
dhis2-bot Nov 19, 2019
3ed9dcb
chore(translations): sync TetumTetun translations from transifex (mas…
dhis2-bot Nov 19, 2019
c6d5f76
chore(translations): sync Swedish translations from transifex (master)
dhis2-bot Nov 19, 2019
782e55a
chore(translations): sync Russian translations from transifex (master)
dhis2-bot Nov 19, 2019
41c2f38
chore(translations): sync PortugueseBrazil translations from transife…
dhis2-bot Nov 19, 2019
bf94c6d
chore(translations): sync Portuguese translations from transifex (mas…
dhis2-bot Nov 19, 2019
a9d70dd
chore(translations): sync Pushto translations from transifex (master)
dhis2-bot Nov 19, 2019
a251cc0
chore(translations): sync Burmese translations from transifex (master)
dhis2-bot Nov 19, 2019
f0a73e7
chore(translations): sync Lao translations from transifex (master)
dhis2-bot Nov 19, 2019
613e818
chore(translations): sync French translations from transifex (master)
dhis2-bot Nov 19, 2019
84e30cf
chore(translations): sync PersianAfghanistan translations from transi…
dhis2-bot Nov 19, 2019
c3c5753
chore(translations): sync Spanish translations from transifex (master)
dhis2-bot Nov 19, 2019
7fa8693
chore(translations): sync Arabic translations from transifex (master)
dhis2-bot Nov 19, 2019
ded0ee9
fix: use max items rule (#373)
martinkrulltott Nov 20, 2019
883304f
fix: use locked dimensions rule from analytics (#444)
janhenrikoverland Nov 20, 2019
b75967a
fix: rename axis name constants (#445)
janhenrikoverland Nov 21, 2019
445f1d8
fix: rules dim handling (#446)
martinkrulltott Nov 21, 2019
26a95e8
fix: added icons to tooltip for warning and locked (#447)
martinkrulltott Nov 21, 2019
231bcd8
fix: @dhis2/analytics 2.6.11 (#448)
janhenrikoverland Nov 21, 2019
ca55b7e
fix: tooltip message (#449)
janhenrikoverland Nov 21, 2019
888bf95
chore(translations): sync Chinese translations from transifex [skip c…
dhis2-bot Nov 25, 2019
429c51e
fix: dimension dialog update validation (#486)
martinkrulltott Nov 25, 2019
334fc6d
chore(translations): sync Vietnamese translations from transifex [ski…
dhis2-bot Nov 25, 2019
3a04c1c
chore(translations): sync Urdu translations from transifex [skip ci] …
dhis2-bot Nov 25, 2019
f85f6f4
chore(translations): sync Ukrainian translations from transifex [skip…
dhis2-bot Nov 25, 2019
d7394bd
chore(translations): sync Tajik translations from transifex [skip ci]…
dhis2-bot Nov 25, 2019
71d6495
chore(translations): sync TetumTetun translations from transifex [ski…
dhis2-bot Nov 25, 2019
6637c27
chore(translations): sync Swedish translations from transifex [skip c…
dhis2-bot Nov 25, 2019
ecc4ca9
chore(translations): sync Russian translations from transifex [skip c…
dhis2-bot Nov 25, 2019
585466b
chore(translations): sync PortugueseBrazil translations from transife…
dhis2-bot Nov 25, 2019
cffffd7
chore(translations): sync Portuguese translations from transifex [ski…
dhis2-bot Nov 25, 2019
5c3cd0e
chore(translations): sync Pushto translations from transifex [skip ci…
dhis2-bot Nov 25, 2019
8e955e6
chore(translations): sync Burmese translations from transifex [skip c…
dhis2-bot Nov 25, 2019
36848ef
chore(translations): sync Lao translations from transifex [skip ci] (…
dhis2-bot Nov 25, 2019
96bfb58
chore(translations): sync Indonesian translations from transifex [ski…
dhis2-bot Nov 25, 2019
e92b7ed
chore(translations): sync French translations from transifex [skip ci…
dhis2-bot Nov 25, 2019
c71bd5d
chore(translations): sync PersianAfghanistan translations from transi…
dhis2-bot Nov 25, 2019
18a9fcf
chore(translations): sync Spanish translations from transifex [skip c…
dhis2-bot Nov 25, 2019
a7bd319
chore(translations): sync Arabic translations from transifex [skip ci…
dhis2-bot Nov 25, 2019
9969e61
fix: gauge now follows the behaviour of single value instead of pie (…
martinkrulltott Nov 26, 2019
188f651
refactor: major refactor of Chip.js (#488)
martinkrulltott Nov 27, 2019
0742d44
fix: implemented new locked dims fn from Analytics
martinkrulltott Nov 27, 2019
211763f
fix: updated names to match latest version of Analytics
martinkrulltott Nov 27, 2019
5751a1f
fix: Updated Analytics dep to v2.6.12
martinkrulltott Nov 28, 2019
e7f236f
fix: merge with epic branch
janhenrikoverland Nov 28, 2019
7f3d42c
fix: merge conflict
janhenrikoverland Nov 28, 2019
a2bb1bb
fix: changed maxNumberOfItemsPerAxis const name
martinkrulltott Nov 28, 2019
799befa
fix: unescape i18n param
janhenrikoverland Nov 28, 2019
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
10 changes: 5 additions & 5 deletions packages/app/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: 2019-11-21T07:25:38.180Z\n"
"PO-Revision-Date: 2019-11-21T07:25:38.180Z\n"
"POT-Creation-Date: 2019-11-28T10:06:38.807Z\n"
"PO-Revision-Date: 2019-11-28T10:06:38.807Z\n"

msgid "Rename successful"
msgstr ""
Expand Down Expand Up @@ -98,13 +98,13 @@ msgstr ""
msgid "Interpretations"
msgstr ""

msgid "{{dimensionName}} is locked to {{axisName}} for {{visTypeName}}"
msgid "{{total}} of {{axisMaxNumberOfItems}} selected"
msgstr ""

msgid "{{total}} of {{maxNumberOfItemsPerAxis}} selected"
msgid "{{total}} selected"
msgstr ""

msgid "{{total}} selected"
msgid "{{dimensionName}} is locked to {{axisName}} for {{visTypeName}}"
msgstr ""

msgid "Move to"
Expand Down
5 changes: 1 addition & 4 deletions packages/app/i18n/ru.po
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Translators:
# Viktor Varland <[email protected]>, 2019
# phil_dhis2, 2019
#
#
msgid ""
msgstr ""
"Project-Id-Version: i18next-conv\n"
Expand Down Expand Up @@ -315,9 +315,6 @@ msgstr ""
msgid "Single value"
msgstr ""

msgid "Open as Map"
msgstr ""

msgid "Reporting rate"
msgstr "Показатель отчетности"

Expand Down
23 changes: 22 additions & 1 deletion packages/app/i18n/sv.po
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Translators:
# Viktor Varland <[email protected]>, 2019
# phil_dhis2, 2019
#
#
msgid ""
msgstr ""
"Project-Id-Version: i18next-conv\n"
Expand Down Expand Up @@ -105,6 +105,27 @@ msgstr ""
msgid "Interpretations"
msgstr "tolkningar"

msgid "{{dimensionName}} is locked to {{axisName}} for {{visTypeName}}"
msgstr ""

msgid "{{total}} of {{maxNumberOfItemsPerAxis}} selected"
msgstr ""

msgid "{{total}} selected"
msgstr ""

msgid "Move to"
msgstr ""

msgid "Remove"
msgstr "Avlägsna"

msgid "None selected"
msgstr ""

msgid "Only '{{name}}' in use"
msgstr ""

msgid "Only '{{number}}' in use"
msgstr ""

Expand Down
5 changes: 4 additions & 1 deletion packages/app/i18n/uk.po
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Translators:
# Viktor Varland <[email protected]>, 2019
# phil_dhis2, 2019
#
#
msgid ""
msgstr ""
"Project-Id-Version: i18next-conv\n"
Expand Down Expand Up @@ -126,6 +126,9 @@ msgstr ""
msgid "Only '{{name}}' in use"
msgstr ""

msgid "Only '{{number}}' in use"
msgstr ""

msgid "Unsaved chart"
msgstr ""

Expand Down
13 changes: 8 additions & 5 deletions packages/app/i18n/ur.po
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Translators:
# Viktor Varland <[email protected]>, 2019
#
#
msgid ""
msgstr ""
"Project-Id-Version: i18next-conv\n"
Expand Down Expand Up @@ -113,11 +113,14 @@ msgstr ""
msgid "{{total}} selected"
msgstr ""

msgid "Move to"
msgstr "پر منتقل"
msgid "Error validating layout"
msgstr ""

msgid "None selected"
msgstr "کوئی بھی منتخب نہیں"
msgid "Create a new visualization by adding dimensions to the layout"
msgstr ""

msgid "Chart error"
msgstr ""

msgid "Only '{{name}}' in use"
msgstr ""
Expand Down
5 changes: 4 additions & 1 deletion packages/app/i18n/vi.po
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Translators:
# Viktor Varland <[email protected]>, 2019
# phil_dhis2, 2019
#
#
msgid ""
msgstr ""
"Project-Id-Version: i18next-conv\n"
Expand Down Expand Up @@ -117,6 +117,9 @@ msgstr ""
msgid "Move to"
msgstr ""

msgid "Remove"
msgstr "Tháo ra"

msgid "None selected"
msgstr ""

Expand Down
2 changes: 1 addition & 1 deletion packages/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"webpack-bundle-analyzer": "^3.0.3"
},
"dependencies": {
"@dhis2/analytics": "^2.6.11",
"@dhis2/analytics": "^2.6.12",
"@dhis2/d2-i18n": "^1.0.6",
"@dhis2/d2-ui-core": "^6.2.1",
"@dhis2/d2-ui-file-menu": "^6.2.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
DIMENSION_ID_DATA,
DIMENSION_ID_PERIOD,
DIMENSION_ID_ORGUNIT,
getMaxNumberOfItemsPerAxis,
getAxisMaxNumberOfItems,
getDisplayNameByVisType,
filterOutFixedDimensions,
} from '@dhis2/analytics';
Expand Down Expand Up @@ -213,19 +213,19 @@ export class DialogManager extends Component {
const visType = type;
const numberOfItems = selectedItems.length;

const maxNumberOfItemsPerAxis = getMaxNumberOfItemsPerAxis(
const axisMaxNumberOfItems = getAxisMaxNumberOfItems(
visType,
axisId
);

const hasMaxNumberOfItemsRule = !!maxNumberOfItemsPerAxis;
const hasMaxNumberOfItemsRule = !!axisMaxNumberOfItems;

if (
hasMaxNumberOfItemsRule &&
numberOfItems > maxNumberOfItemsPerAxis
numberOfItems > axisMaxNumberOfItems
) {
infoBoxMessage =
maxNumberOfItemsPerAxis === 1
axisMaxNumberOfItems === 1
? i18n.t(
`'{{visualiationType}}' is intended to show a single data item. Only the first item will be used and saved.`,
{
Expand All @@ -240,12 +240,12 @@ export class DialogManager extends Component {
visualiationType: getDisplayNameByVisType(
visType
),
maxNumber: maxNumberOfItemsPerAxis,
maxNumber: axisMaxNumberOfItems,
}
);

selectedItems.forEach((item, index) => {
item.isActive = index < maxNumberOfItemsPerAxis;
item.isActive = index < axisMaxNumberOfItems;
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jest.mock('@dhis2/analytics', () => {
[periodId]: {},
[ouId]: {},
},
getMaxNumberOfItemsPerAxis: () => {},
getAxisMaxNumberOfItems: () => {},
filterOutFixedDimensions: () => [],
getAxisName: () => {},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
DimensionsPanel,
DimensionMenu,
getDisallowedDimensions,
getLockedDimensions,
getAllLockedDimensionIds,
} from '@dhis2/analytics';

import DialogManager from './Dialogs/DialogManager';
Expand Down Expand Up @@ -108,7 +108,7 @@ const getDisallowedDimensionsMemo = createSelector(

const getLockedDimensionsMemo = createSelector(
[sGetUiType],
type => getLockedDimensions(type)
type => getAllLockedDimensionIds(type)
);

const mapStateToProps = state => {
Expand Down
29 changes: 14 additions & 15 deletions packages/app/src/components/Layout/Chip.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import LockIcon from '@material-ui/icons/Lock';
import i18n from '@dhis2/d2-i18n';
import {
FIXED_DIMENSIONS,
getMaxNumberOfItemsPerAxis,
hasTooManyItemsPerAxis,
getLockedDimensionAxis,
getAxisMaxNumberOfItems,
hasAxisTooManyItems,
getAxisPerLockedDimension,
getDisplayNameByVisType,
getAxisName,
} from '@dhis2/analytics';
Expand Down Expand Up @@ -44,12 +44,11 @@ class Chip extends React.Component {

timeout = null;

isLocked = getLockedDimensionAxis(
this.props.type,
this.props.dimensionId
).includes(this.props.axisId);
isLocked =
getAxisPerLockedDimension(this.props.type, this.props.dimensionId) ===
this.props.axisId;

maxNumberOfItemsPerAxis = getMaxNumberOfItemsPerAxis(
axisMaxNumberOfItems = getAxisMaxNumberOfItems(
this.props.type,
this.props.axisId
);
Expand Down Expand Up @@ -99,11 +98,11 @@ class Chip extends React.Component {
const numberOfItems = this.props.items.length;

const getItemsLabel =
!!this.maxNumberOfItemsPerAxis &&
numberOfItems > this.maxNumberOfItemsPerAxis
? i18n.t(`{{total}} of {{maxNumberOfItemsPerAxis}} selected`, {
!!this.axisMaxNumberOfItems &&
numberOfItems > this.axisMaxNumberOfItems
? i18n.t(`{{total}} of {{axisMaxNumberOfItems}} selected`, {
total: numberOfItems,
maxNumberOfItemsPerAxis: this.maxNumberOfItemsPerAxis,
axisMaxNumberOfItems: this.axisMaxNumberOfItems,
})
: i18n.t('{{total}} selected', {
total: numberOfItems,
Expand Down Expand Up @@ -137,8 +136,8 @@ class Chip extends React.Component {
);

renderTooltip = () => {
const activeItemIds = !!this.maxNumberOfItemsPerAxis
? this.props.items.slice(0, this.maxNumberOfItemsPerAxis)
const activeItemIds = !!this.axisMaxNumberOfItems
? this.props.items.slice(0, this.axisMaxNumberOfItems)
: this.props.items;

const lockedLabel = this.isLocked
Expand Down Expand Up @@ -181,7 +180,7 @@ class Chip extends React.Component {
>
<div style={styles.iconWrapper}>{this.renderChipIcon()}</div>
{this.renderChipLabel()}
{hasTooManyItemsPerAxis(
{hasAxisTooManyItems(
this.props.type,
this.props.axisId,
this.props.items.length
Expand Down
3 changes: 1 addition & 2 deletions packages/app/src/components/Layout/Tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,10 @@ import { styles } from './styles/Tooltip.style';

const labels = {
noneSelected: i18n.t('None selected'),
onlyOneInUse: name => i18n.t("Only '{{name}}' in use", { name }),
onlyOneInUse: name => i18n.t("Only '{{- name}}' in use", { name }),
onlyLimitedNumberInUse: number =>
i18n.t("Only '{{number}}' in use", { number }),
};

export class Tooltip extends React.Component {
renderTooltip = (names, warning) => (
<Popper
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"main": "./build/index.js",
"license": "BSD-3-Clause",
"dependencies": {
"@dhis2/analytics": "^2.6.11",
"@dhis2/analytics": "^2.6.12",
"@material-ui/core": "^3.1.2",
"lodash-es": "^4.17.11",
"react": "^16.6.0",
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,10 @@
react-beautiful-dnd "^10.1.1"
styled-jsx "^3.2.1"

"@dhis2/analytics@^2.6.11":
version "2.6.11"
resolved "https://registry.yarnpkg.com/@dhis2/analytics/-/analytics-2.6.11.tgz#ef04418f655de7f2c9639da4f0e0608b7b711ebf"
integrity sha512-COxLvHfkDuRgCqEwbZH9I62lTB1IBiv0+fFBibIGdAt1b+qcYvmxph7Z8WxWld55aq0oXuXGtvw+goMSFyn2LQ==
"@dhis2/analytics@^2.6.12":
version "2.6.12"
resolved "https://registry.yarnpkg.com/@dhis2/analytics/-/analytics-2.6.12.tgz#0d34b604bbee16c2a9f4091551170811d7d7c8d1"
integrity sha512-cNtZvioufUWnd3ZNEwKnKnjnaieR5Rsl5TubLxnsLbOcVuEPQAmqXrQHqMRUXypl7yjxf1g/QHFDimfPRQAopA==
dependencies:
"@dhis2/d2-i18n" "^1.0.4"
"@dhis2/d2-ui-org-unit-dialog" "^6.3.0"
Expand Down