Skip to content

Commit

Permalink
fix: swap full axis dims to filter (#518)
Browse files Browse the repository at this point in the history
* When adding a dimension to a full axis, the current dimension will now be moved to an available axis (in most cases Filter) instead of getting swapped out
  • Loading branch information
martinkrulltott committed Dec 6, 2019
1 parent 241de69 commit a79e329
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion packages/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"redux-mock-store": "^1.5.3"
},
"dependencies": {
"@dhis2/analytics": "^2.6.13",
"@dhis2/analytics": "^2.6.16",
"@dhis2/d2-ui-core": "^6.2.1",
"@dhis2/d2-ui-file-menu": "^6.2.1",
"@dhis2/d2-ui-interpretations": "^6.2.1",
Expand Down
5 changes: 5 additions & 0 deletions packages/app/src/modules/layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
AXIS_ID_ROWS,
AXIS_ID_FILTERS,
getAxisMaxNumberOfDimensions,
getAvailableAxes,
} from '@dhis2/analytics'

// Names for dnd sources
Expand Down Expand Up @@ -72,6 +73,10 @@ export const getRetransfer = (layout, transfer, visType) => {

if (axisIsFull) {
retransfer[dimensionsAtDestination[0]] = sourceAxis
? sourceAxis
: getAvailableAxes(visType).find(
axis => !getAxisMaxNumberOfDimensions(visType, axis)
)
}
})

Expand Down
2 changes: 1 addition & 1 deletion packages/app/src/reducers/__tests__/ui.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ describe('reducer: ui', () => {
layout: {
columns: [otherId],
rows: [DIMENSION_ID_PERIOD],
filters: [DIMENSION_ID_ORGUNIT],
filters: [DIMENSION_ID_ORGUNIT, DIMENSION_ID_DATA],
},
}

Expand Down
2 changes: 1 addition & 1 deletion packages/app/src/reducers/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export default (state = DEFAULT_UI, action) => {
...getRetransfer(state.layout, action.value, state.type),
}

// Filter out transfered dimension ids (remove from source)
// Filter out transferred dimension ids (remove from source)
const newLayout = getFilteredLayout(
state.layout,
Object.keys(transfers)
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"module": "./build/es/lib.js",
"license": "BSD-3-Clause",
"dependencies": {
"@dhis2/analytics": "^2.6.13",
"@dhis2/analytics": "^2.6.16",
"@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 @@ -965,10 +965,10 @@
react-beautiful-dnd "^10.1.1"
styled-jsx "^3.2.1"

"@dhis2/analytics@^2.6.13":
version "2.6.13"
resolved "https://registry.yarnpkg.com/@dhis2/analytics/-/analytics-2.6.13.tgz#d01a3d95fb642d51cafec0e0f9b2b6647b38d39b"
integrity sha512-TWcmc0B+PUdAkwWB74smElo1j/6ATXtDsuHegtSjxB77vJXF2pTMyYhN8GmVWFBeC54cu/srCcuR1eHDDHL0KQ==
"@dhis2/analytics@^2.6.16":
version "2.6.16"
resolved "https://registry.yarnpkg.com/@dhis2/analytics/-/analytics-2.6.16.tgz#65a73f7f9a56afbad811522c0d5bc12450aa78be"
integrity sha512-ADv2WvUYGIN1pDOZlj+Dz4UTtSdgqPdQkkj35+snpWNPPeIEDn46vbY8eb/jkkgKdEljem9zC0Vxj1uKHtFBQQ==
dependencies:
"@dhis2/d2-i18n" "^1.0.4"
"@dhis2/d2-ui-org-unit-dialog" "^6.3.0"
Expand Down

0 comments on commit a79e329

Please sign in to comment.