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: custom calculations (DHIS2-13871) #1370

Merged
merged 159 commits into from
Apr 24, 2023
Merged
Show file tree
Hide file tree
Changes from 156 commits
Commits
Show all changes
159 commits
Select commit Hold shift + click to select a range
7243fd8
feat: initial commit, WIP
martinkrulltott Nov 4, 2022
fa8c60f
fix: style changes
martinkrulltott Nov 7, 2022
f37668a
fix: open as modal, more content and style changes
martinkrulltott Nov 7, 2022
7acacaa
feat: add dimension type calculation
martinkrulltott Nov 14, 2022
00da222
Merge branch 'master' into feat/DHIS2-13871-custom-calculations
martinkrulltott Nov 15, 2022
367b611
feat: add expression validation
martinkrulltott Nov 15, 2022
3fb517b
chore: merge branch 'feat/DHIS2-13871-custom-calculations'
martinkrulltott Nov 15, 2022
8674b82
fix: bump app-runtime to latest, for content-type fix
martinkrulltott Nov 17, 2022
a783091
fix: extract calc modal to own comp, impl data flow for calc
martinkrulltott Nov 17, 2022
7096632
fix: pass calc props
martinkrulltott Nov 17, 2022
09e4c7d
chore: merge branch 'master' into feat/DHIS2-13871-custom-calculations
martinkrulltott Nov 18, 2022
b094d67
fix: disable save btn when formula isnt validated
martinkrulltott Nov 18, 2022
ffe952e
fix: remove test string
martinkrulltott Nov 18, 2022
2fa54e8
fix: save disabled when no name is provided
martinkrulltott Nov 21, 2022
778eefa
fix: auto-select saved calc (WIP)
martinkrulltott Nov 23, 2022
e283fde
fix: implement onSelet directly instead of going through onChange
martinkrulltott Nov 24, 2022
b5fd6ad
fix: show formula in tooltip
martinkrulltott Nov 25, 2022
ea7cc19
chore: add comment and test data
martinkrulltott Nov 25, 2022
221a61c
feat: implement real endpoints for loading and saving calcs
martinkrulltott Dec 1, 2022
bd71598
fix: await id from response + impl delete button
martinkrulltott Dec 2, 2022
1e1b110
Merge branch 'master' into feat/DHIS2-13871-custom-calculations
martinkrulltott Dec 2, 2022
10f467a
fix: remove validation when formula is dirty
martinkrulltott Dec 2, 2022
b376bd8
refactor: rename to currentCalculation
martinkrulltott Dec 2, 2022
b56a919
refactor: move apiValidateExpression to component
martinkrulltott Dec 2, 2022
dfd7057
refactor: formula -> expression
martinkrulltott Dec 2, 2022
74f25b2
refactor: simplify the validation callback
martinkrulltott Dec 2, 2022
a8f8c20
refactor: getExpressionStatus() -> expressionStatus
martinkrulltott Dec 2, 2022
660e46d
Merge branch 'master' into feat/DHIS2-13871-custom-calculations
martinkrulltott Dec 5, 2022
9aa5da0
fix: add error handling to mutations
martinkrulltott Dec 5, 2022
523a363
fix: show prompt before deleting
martinkrulltott Dec 5, 2022
0617983
fix: new design WIP with IntersectionDetector
martinkrulltott Jan 12, 2023
4c81032
fix: more new design WIP
martinkrulltott Jan 17, 2023
b935866
chore: typo in prev commit
martinkrulltott Jan 17, 2023
37df6bf
fix: add min-height to content
martinkrulltott Jan 17, 2023
fa4d92e
fix: readd the text field for writing expressions
martinkrulltott Jan 19, 2023
373778f
Merge branch 'master' into feat/DHIS2-13871-custom-calculations
martinkrulltott Jan 19, 2023
e7d6522
fix: set shortName when name is set
martinkrulltott Jan 19, 2023
b59d165
fix: style changes to the calculation modal
martinkrulltott Jan 19, 2023
ce7bb71
fix: style changes to the calc modal and chips
martinkrulltott Jan 20, 2023
d9206f5
fix: math operator selector
martinkrulltott Jan 20, 2023
75399b7
fix: generate string from user input WIP
martinkrulltott Jan 20, 2023
de8ffb6
fix: temp use prompt for number input
martinkrulltott Jan 22, 2023
46f04e2
fix: parse expression parts to individual components
martinkrulltott Jan 22, 2023
09fff43
fix: proper styling for the formula field parts
martinkrulltott Jan 23, 2023
470a6b2
fix: change expression to array of objects
martinkrulltott Jan 23, 2023
bf58a37
chore: add todo comment
martinkrulltott Jan 23, 2023
48459be
refactor: break out logic to own fn for jest tests
martinkrulltott Jan 23, 2023
4ecb8d5
fix: select and remove formula parts
martinkrulltott Jan 24, 2023
42b1d72
fix: fetch expression prop for dimensions
martinkrulltott Jan 24, 2023
b9b7410
fix: position the formula buttons properly
martinkrulltott Jan 24, 2023
4805fd3
fix: add simple client side validation
martinkrulltott Jan 24, 2023
9a47c86
fix: error message for empty formula
martinkrulltott Jan 25, 2023
192a2e4
fix: add feature toggling
martinkrulltott Jan 27, 2023
0060262
chore: add breaking change message
martinkrulltott Jan 30, 2023
5cd26ae
Merge branch 'master' into feat/DHIS2-13871-custom-calculations
martinkrulltott Jan 31, 2023
657727f
fix: save metadata on calculation save
martinkrulltott Jan 31, 2023
2cb1b0b
fix: add needed properties for story and add required onClick prop
jenniferarnesen Feb 2, 2023
acf249f
fix: add proper fetch logic (#1415)
edoardo Feb 6, 2023
36124b5
chore: remove comment, log fetch error
edoardo Feb 6, 2023
7c090ce
Merge branch 'master' into feat/DHIS2-13871-custom-calculations
martinkrulltott Feb 7, 2023
b5a9a00
chore: remove debug log
edoardo Feb 7, 2023
78182a9
fix: remove debug coloring on scroll detector, fix z-index
edoardo Feb 7, 2023
13286ab
refactor: remove renderParts fn
martinkrulltott Feb 8, 2023
aaf76d0
chore: add dataTest
martinkrulltott Feb 10, 2023
b4ecc62
Merge branch 'master' into feat/DHIS2-13871-custom-calculations
martinkrulltott Feb 13, 2023
1fa4052
feat: dnd for custom calculations (#1416)
jenniferarnesen Feb 14, 2023
eaab29e
fix: if item is disabled then it shouldnt be draggable
jenniferarnesen Feb 14, 2023
e239634
Merge branch 'master' into feat/DHIS2-13871-custom-calculations
martinkrulltott Feb 20, 2023
10a1d34
fix: use id from response when saving a new edi
martinkrulltott Feb 22, 2023
2286c01
fix: include expression when selecting items
martinkrulltott Feb 23, 2023
7fe4133
chore: move test output
martinkrulltott Feb 23, 2023
ef31730
Merge branch 'master' into feat/DHIS2-13871-custom-calculations
martinkrulltott Feb 23, 2023
ed171ce
chore: en.pot from merging with master
martinkrulltott Feb 23, 2023
25be1f9
feat: cache param for expression dimension items (DHIS2-13871) (#1433)
janhenrikoverland Feb 27, 2023
271a598
Merge branch 'master' into feat/DHIS2-13871-custom-calculations
janhenrikoverland Feb 27, 2023
986227c
fix: double-click in the input should set focus, not delete the item
jenniferarnesen Feb 28, 2023
6c3631e
fix: receive metadata for expression items
martinkrulltott Feb 28, 2023
50e2372
chore: update story and tests with DEOs
martinkrulltott Feb 28, 2023
4353d8f
fix: revert metadata changes
martinkrulltott Feb 28, 2023
a374489
fix: fetch metadata in CalculationModal
martinkrulltott Mar 1, 2023
b17094b
fix: wait for metadata before rendering
martinkrulltott Mar 1, 2023
12a8e1b
fix: add a proper loading spinner
martinkrulltott Mar 1, 2023
62f4bd0
fix: use default values to avoid crash
martinkrulltott Mar 1, 2023
b0ae55d
fix: increase debounce time to 500ms
martinkrulltott Mar 1, 2023
8e0ef69
fix: DEOs should look and act like DEs (#1441)
jenniferarnesen Mar 2, 2023
1b6ef47
fix: add placeholder to the formula field
martinkrulltott Mar 3, 2023
09e6d12
fix: vertically center the placeholder content
martinkrulltott Mar 3, 2023
7d9563a
test: adapt jest tests to the new error message
martinkrulltott Mar 3, 2023
fc1ac20
fix: remove double border
martinkrulltott Mar 10, 2023
da75d7e
fix: add dense prop to calc label
martinkrulltott Mar 10, 2023
189bbbd
fix: change number label
martinkrulltott Mar 10, 2023
3fe84b7
chore: en.pot updates
martinkrulltott Mar 10, 2023
4d6f82a
fix: allow decimal numbers in formula
martinkrulltott Mar 10, 2023
0a5dbc3
fix: add hover style to math operators
martinkrulltott Mar 10, 2023
ee10559
fix: catch () in the validation
martinkrulltott Mar 10, 2023
5d436a2
fix: add pointer cursor to edit icon
martinkrulltott Mar 10, 2023
a52bb83
fix: edit icon position and height
martinkrulltott Mar 10, 2023
95c724f
fix: add tooltip to data elements in formula
jenniferarnesen Mar 10, 2023
06b1137
Merge branch 'master' into feat/DHIS2-13871-custom-calculations
martinkrulltott Mar 13, 2023
b1a763d
fix: remove option tooltip text and n/a props
martinkrulltott Mar 13, 2023
a224d11
fix: move group selects to a single row
martinkrulltott Mar 14, 2023
a6d20a0
fix: move the label input section to the bottom right
martinkrulltott Mar 14, 2023
e7b242d
Merge branch 'master' into feat/DHIS2-13871-custom-calculations
martinkrulltott Mar 17, 2023
0994b76
fix: add label max length to prevent backend crash for shortName
martinkrulltott Mar 20, 2023
9d62e83
chore: move test output
martinkrulltott Mar 20, 2023
82c2f47
fix: increase height of dimension list so modal heights match
martinkrulltott Mar 21, 2023
34d88fa
fix: vertical align chip label in formula
martinkrulltott Mar 21, 2023
ab49751
fix: show "No data" message instead of empty list
edoardo Mar 21, 2023
e7313bf
chore: update pot file
edoardo Mar 21, 2023
c9485e8
fix: reset page/next page to avoid mixing results
edoardo Mar 22, 2023
0c5b319
fix: fix issues with loading, results, message display sequence
edoardo Mar 22, 2023
74ec757
fix: use OfflineTooltip to get the tooltip on mac too
jenniferarnesen Mar 23, 2023
a3ac9ad
fix: remove box shadow from formula items
martinkrulltott Mar 23, 2023
37220c8
fix: increase height of dimension list so modal heights match v2
martinkrulltott Mar 23, 2023
7a27e9a
fix: remove not found message when loading
edoardo Mar 23, 2023
4b7af63
fix: prevent scrolling while dragging
jenniferarnesen Mar 23, 2023
56e6b83
Merge branch 'feat/DHIS2-13871-custom-calculations' of github.com:dhi…
jenniferarnesen Mar 24, 2023
d59f72f
fix: no dragging if user is focused in the number input
jenniferarnesen Mar 24, 2023
50e9d46
fix: increase visibility of dragging item with border and full opacity
jenniferarnesen Mar 24, 2023
63e5aee
fix: use same border-radius as chips
jenniferarnesen Mar 24, 2023
d03bea4
fix: prevent data fetching when there are no ids
martinkrulltott Mar 24, 2023
04b60dc
fix: share styling between operator, formulaItem and draggingItem
jenniferarnesen Mar 27, 2023
b844431
fix: prevent infinite render in case where no calculation is provided
jenniferarnesen Mar 27, 2023
42ea76d
fix: only visible chip should be drag handle in the DataElementSelector
jenniferarnesen Mar 28, 2023
cd303f9
fix: oops, replace debugging color
jenniferarnesen Mar 28, 2023
1c45e14
fix: restore highlight color on formula items
jenniferarnesen Mar 28, 2023
56569e6
fix: last formula item draggable area no longer extends past visible …
jenniferarnesen Mar 28, 2023
0253cbe
fix: add story for no data
jenniferarnesen Mar 28, 2023
69006b0
fix: move all Calculation components to subfolder of DataDimension
jenniferarnesen Mar 28, 2023
7787e74
fix: minor cleanup
jenniferarnesen Mar 29, 2023
92fbfb0
fix: export DIMENSION_TYPE_EXPRESSION_DIMENSION_ITEM
martinkrulltott Mar 29, 2023
bf2e5ba
Merge branch 'feat/DHIS2-13871-custom-calculations' of https://github…
martinkrulltott Mar 30, 2023
020b6ca
chore: remove obsolete todo comment
martinkrulltott Mar 30, 2023
2a21d49
fix: increase number padding
martinkrulltott Mar 31, 2023
016557c
fix: consistent padding for Number in the operator list, dragitem and…
jenniferarnesen Mar 31, 2023
0a37c4d
fix: only number is empty DHIS2-15054
martinkrulltott Mar 31, 2023
d62db7f
refactor: extract getItemIdsFromExpression to own fn
martinkrulltott Apr 3, 2023
efbc27a
fix: avoid error when re-saving DHIS2-15051
martinkrulltott Apr 3, 2023
f5d5c5e
fix: adjust space below check formula button (DHIS2-15045)
martinkrulltott Apr 11, 2023
84d0cb5
fix: disable check button while validating (DHIS2-15046)
martinkrulltott Apr 11, 2023
5179e5d
fix: add loading/disabled state for various buttons + refactor: move …
martinkrulltott Apr 11, 2023
f104eef
fix: move remove button, always visible, use prop secondary (DHIS2-15…
martinkrulltott Apr 12, 2023
fe1df81
fix: add prop secondary to cancel button (DHIS2-15099)
martinkrulltott Apr 12, 2023
9fa957a
fix: move delete button (DHIS2-15057)
martinkrulltott Apr 12, 2023
d3e7b30
fix: prevent validate button from jumping when loading
martinkrulltott Apr 12, 2023
9a154f3
fix: conditionally hide the EDI edit button based on access (DHIS2-15…
martinkrulltott Apr 12, 2023
68d8f40
fix: add auto checking formula, disable buttons and formula interacti…
martinkrulltott Apr 13, 2023
f3d9ebb
fix: change label to name
martinkrulltott Apr 14, 2023
c99ad9a
fix: pass id correctly to delete fn (DHIS2-15132)
martinkrulltott Apr 18, 2023
eb92bc9
fix: pass expression on save (DHIS2-15131)
martinkrulltott Apr 18, 2023
ff9c426
fix: change label to less generic name (DHIS2-15135)
martinkrulltott Apr 18, 2023
0d05ee0
fix: use grab cursor on item being dragged
jenniferarnesen Apr 18, 2023
ac9489d
fix: add hover style for edit button (DHIS2-15134)
martinkrulltott Apr 18, 2023
9697506
fix: disable consec math op validation to allow use of negative values
martinkrulltott Apr 18, 2023
0a0f399
Merge branch 'master' into feat/DHIS2-13871-custom-calculations
janhenrikoverland Apr 20, 2023
771ceea
Merge branch 'master' into feat/DHIS2-13871-custom-calculations
martinkrulltott Apr 24, 2023
751503c
chore: remove output text
martinkrulltott Apr 24, 2023
f8fb1e2
test: add data-test props
martinkrulltott Apr 24, 2023
d729e1f
Merge branch 'master' into feat/DHIS2-13871-custom-calculations
martinkrulltott Apr 24, 2023
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
125 changes: 104 additions & 21 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-03-10T10:41:22.719Z\n"
"PO-Revision-Date: 2023-03-10T10:41:22.719Z\n"
"POT-Creation-Date: 2023-04-18T08:41:27.838Z\n"
"PO-Revision-Date: 2023-04-18T08:41:27.838Z\n"

msgid "view only"
msgstr "view only"
Expand Down Expand Up @@ -73,27 +73,92 @@ msgstr "This app could not retrieve required data."
msgid "Network error"
msgstr "Network error"

msgid "Data Type"
msgstr "Data Type"
msgid "Data / Edit calculation"
msgstr "Data / Edit calculation"

msgid "All types"
msgstr "All types"
msgid "Data / New calculation"
msgstr "Data / New calculation"

msgid "Remove item"
msgstr "Remove item"

msgid "Check formula"
msgstr "Check formula"

msgid "Calculation name"
msgstr "Calculation name"

msgid "Shown in table headers and chart axes/legends"
msgstr "Shown in table headers and chart axes/legends"

msgid "Delete calculation"
msgstr "Delete calculation"

msgid "Cancel"
msgstr "Cancel"

msgid "The calculation can only be saved with a valid formula"
msgstr "The calculation can only be saved with a valid formula"

msgid "Add a name to save this calculation"
msgstr "Add a name to save this calculation"

msgid "Save calculation"
msgstr "Save calculation"

msgid ""
"Are you sure you want to delete this calculation? It may be used by other "
"visualizations."
msgstr ""
"Are you sure you want to delete this calculation? It may be used by other "
"visualizations."

msgid "Yes, delete"
msgstr "Yes, delete"

msgid "Totals only"
msgstr "Totals only"

msgid "Details only"
msgstr "Details only"

msgid "Loading"
msgstr "Loading"

msgid "Data elements"
msgstr "Data elements"

msgid "Search by data element name"
msgstr "Search by data element name"

msgid "No data elements found for \"{{- searchTerm}}\""
msgstr "No data elements found for \"{{- searchTerm}}\""

msgid "No data elements found"
msgstr "No data elements found"

msgid ""
"Drag items here, or double click in the list, to start building a "
"calculation formula"
msgstr ""
"Drag items here, or double click in the list, to start building a "
"calculation formula"

msgid "Math operators"
msgstr "Math operators"

msgid "Data Type"
msgstr "Data Type"

msgid "All types"
msgstr "All types"

msgid "Disaggregation"
msgstr "Disaggregation"

msgid "No data"
msgstr "No data"

msgid "Loading"
msgstr "Loading"

msgid "Search by data item name"
msgstr "Search by data item name"

Expand All @@ -106,9 +171,6 @@ msgstr "Selected Items"
msgid "No indicators found"
msgstr "No indicators found"

msgid "No data elements found"
msgstr "No data elements found"

msgid "No data sets found"
msgstr "No data sets found"

Expand All @@ -121,9 +183,6 @@ msgstr "No program indicators found"
msgid "No indicators found for \"{{- searchTerm}}\""
msgstr "No indicators found for \"{{- searchTerm}}\""

msgid "No data elements found for \"{{- searchTerm}}\""
msgstr "No data elements found for \"{{- searchTerm}}\""

msgid "No data sets found for \"{{- searchTerm}}\""
msgstr "No data sets found for \"{{- searchTerm}}\""

Expand All @@ -136,6 +195,9 @@ msgstr "No program indicators found for \"{{- searchTerm}}\""
msgid "Nothing found for \"{{- searchTerm}}\""
msgstr "Nothing found for \"{{- searchTerm}}\""

msgid "Calculation"
msgstr "Calculation"

msgid "Metric type"
msgstr "Metric type"

Expand Down Expand Up @@ -203,9 +265,6 @@ msgstr "Delete {{fileType}}"
msgid "This {{fileType}} and related interpretations will be deleted. Continue?"
msgstr "This {{fileType}} and related interpretations will be deleted. Continue?"

msgid "Cancel"
msgstr "Cancel"

msgid "Delete"
msgstr "Delete"

Expand Down Expand Up @@ -881,9 +940,6 @@ msgstr "No indicator groups found"
msgid "Loading indicator groups"
msgstr "Loading indicator groups"

msgid "Data elements"
msgstr "Data elements"

msgid "Data element group"
msgstr "Data element group"

Expand Down Expand Up @@ -929,6 +985,33 @@ msgstr "Program indicators"
msgid "Program indicator"
msgstr "Program indicator"

msgid "Calculations"
msgstr "Calculations"

msgid "Number"
msgstr "Number"

msgid "Formula is empty. Add items to the formula from the lists on the left."
msgstr "Formula is empty. Add items to the formula from the lists on the left."

msgid "Consecutive math operators"
msgstr "Consecutive math operators"

msgid "Consecutive data elements"
msgstr "Consecutive data elements"

msgid "Starts or ends with a math operator"
msgstr "Starts or ends with a math operator"

msgid "Empty parentheses"
msgstr "Empty parentheses"

msgid "Missing right parenthesis )"
msgstr "Missing right parenthesis )"

msgid "Missing left parenthesis ("
msgstr "Missing left parenthesis ("

msgid "Extra Small"
msgstr "Extra Small"

Expand Down
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,12 @@
"dependencies": {
"@dhis2/d2-ui-rich-text": "^7.4.0",
"@dhis2/multi-calendar-dates": "1.0.0",
"@dnd-kit/core": "^6.0.7",
"@dnd-kit/sortable": "^7.0.2",
"@dnd-kit/utilities": "^3.2.1",
"@react-hook/debounce": "^4.0.0",
"classnames": "^2.3.1",
"crypto-js": "^4.1.1",
"d2-utilizr": "^0.2.16",
"d3-color": "^1.2.3",
"highcharts": "^10.2.0",
Expand Down
Loading