@dhis2/analytics 26.1.4 → 26.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -32,9 +32,8 @@ const createCalculationMutation = {
32
32
  };
33
33
  exports.createCalculationMutation = createCalculationMutation;
34
34
  const updateCalculationMutation = {
35
- type: 'update',
35
+ type: 'json-patch',
36
36
  resource: 'expressionDimensionItems',
37
- partial: true,
38
37
  id: _ref3 => {
39
38
  let {
40
39
  id
@@ -46,11 +45,19 @@ const updateCalculationMutation = {
46
45
  name,
47
46
  expression
48
47
  } = _ref4;
49
- return {
50
- name,
51
- shortName: name,
52
- expression
53
- };
48
+ return [{
49
+ op: 'add',
50
+ path: '/name',
51
+ value: name
52
+ }, {
53
+ op: 'add',
54
+ path: '/shortName',
55
+ value: name
56
+ }, {
57
+ op: 'add',
58
+ path: '/expression',
59
+ value: expression
60
+ }];
54
61
  }
55
62
  };
56
63
  exports.updateCalculationMutation = updateCalculationMutation;
@@ -15,6 +15,21 @@ var _utils = require("./utils.js");
15
15
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
16
16
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
17
17
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18
+ const formatPayload = (name, description) => {
19
+ const payload = [{
20
+ op: 'add',
21
+ path: '/name',
22
+ value: name
23
+ }];
24
+ if (description) {
25
+ payload.push({
26
+ op: 'add',
27
+ path: '/description',
28
+ value: description
29
+ });
30
+ }
31
+ return payload;
32
+ };
18
33
  const getMutation = type => ({
19
34
  resource: (0, _utils.endpointFromFileType)(type),
20
35
  id: _ref => {
@@ -23,17 +38,13 @@ const getMutation = type => ({
23
38
  } = _ref;
24
39
  return id;
25
40
  },
26
- type: 'update',
27
- partial: true,
41
+ type: 'json-patch',
28
42
  data: _ref2 => {
29
43
  let {
30
44
  name,
31
45
  description
32
46
  } = _ref2;
33
- return {
34
- name,
35
- description
36
- };
47
+ return formatPayload(name, description);
37
48
  }
38
49
  });
39
50
  const RenameDialog = _ref3 => {
@@ -70,7 +81,8 @@ const RenameDialog = _ref3 => {
70
81
  });
71
82
  };
72
83
  return /*#__PURE__*/_react.default.createElement(_ui.Modal, {
73
- onClose: onClose
84
+ onClose: onClose,
85
+ dataTest: "file-menu-rename-modal"
74
86
  }, /*#__PURE__*/_react.default.createElement(_style.default, {
75
87
  id: _FileMenuStyles.modalStyles.__hash
76
88
  }, _FileMenuStyles.modalStyles), /*#__PURE__*/_react.default.createElement(_ui.ModalTitle, null, _index.default.t('Rename {{fileType}}', {
@@ -87,7 +99,8 @@ const RenameDialog = _ref3 => {
87
99
  value
88
100
  } = _ref4;
89
101
  return setName(value);
90
- }
102
+ },
103
+ dataTest: "file-menu-rename-modal-name"
91
104
  }), /*#__PURE__*/_react.default.createElement(_ui.TextAreaField, {
92
105
  label: _index.default.t('Description'),
93
106
  disabled: loading,
@@ -98,15 +111,18 @@ const RenameDialog = _ref3 => {
98
111
  value
99
112
  } = _ref5;
100
113
  return setDescription(value);
101
- }
114
+ },
115
+ dataTest: "file-menu-rename-modal-description"
102
116
  }))), /*#__PURE__*/_react.default.createElement(_ui.ModalActions, null, /*#__PURE__*/_react.default.createElement(_ui.ButtonStrip, null, /*#__PURE__*/_react.default.createElement(_ui.Button, {
103
117
  onClick: onClose,
104
118
  disabled: loading,
105
- secondary: true
119
+ secondary: true,
120
+ dataTest: "file-menu-rename-modal-cancel"
106
121
  }, _index.default.t('Cancel')), /*#__PURE__*/_react.default.createElement(_ui.Button, {
107
122
  onClick: renameObject,
108
123
  disabled: loading,
109
- primary: true
124
+ primary: true,
125
+ dataTest: "file-menu-rename-modal-rename"
110
126
  }, _index.default.t('Rename')))));
111
127
  };
112
128
  exports.RenameDialog = RenameDialog;
@@ -29,7 +29,7 @@ const colorSets = {
29
29
  colors: ['#a8bf24', '#518cc3', '#d74554', '#ff9e21', '#968f8f', '#ba3ba1', '#ffda54', '#45beae', '#b98037', '#676767', '#6b2dd4', '#47792c', '#fcbdbd', '#830000', '#a5ffc0', '#000078', '#817c00', '#bdf023', '#fffac4']
30
30
  },
31
31
  [COLOR_SET_BASIC]: {
32
- colors: ['#348F41', '#9F2241', '#DDDDDD', '#B4A269']
32
+ colors: ['#348F41', '#9F2241', '#B4A269', '#EBEEF3', '#58595B', '#1A5632']
33
33
  },
34
34
  [COLOR_SET_EXTENDED]: {
35
35
  colors: ['#194F90', '#AE1857', '#5B7E96', '#FFB71B', '#1DCAD3', '#FF5C35', '#8F4899', '#DAE343', '#385CAD', '#E81F76', '#009383', '#522B39']
@@ -24,9 +24,8 @@ export const createCalculationMutation = {
24
24
  }
25
25
  };
26
26
  export const updateCalculationMutation = {
27
- type: 'update',
27
+ type: 'json-patch',
28
28
  resource: 'expressionDimensionItems',
29
- partial: true,
30
29
  id: _ref3 => {
31
30
  let {
32
31
  id
@@ -38,11 +37,19 @@ export const updateCalculationMutation = {
38
37
  name,
39
38
  expression
40
39
  } = _ref4;
41
- return {
42
- name,
43
- shortName: name,
44
- expression
45
- };
40
+ return [{
41
+ op: 'add',
42
+ path: '/name',
43
+ value: name
44
+ }, {
45
+ op: 'add',
46
+ path: '/shortName',
47
+ value: name
48
+ }, {
49
+ op: 'add',
50
+ path: '/expression',
51
+ value: expression
52
+ }];
46
53
  }
47
54
  };
48
55
  export const deleteCalculationMutation = {
@@ -6,6 +6,21 @@ import React, { useMemo, useState } from 'react';
6
6
  import i18n from '../../locales/index.js';
7
7
  import { modalStyles } from './FileMenu.styles.js';
8
8
  import { supportedFileTypes, endpointFromFileType, labelForFileType } from './utils.js';
9
+ const formatPayload = (name, description) => {
10
+ const payload = [{
11
+ op: 'add',
12
+ path: '/name',
13
+ value: name
14
+ }];
15
+ if (description) {
16
+ payload.push({
17
+ op: 'add',
18
+ path: '/description',
19
+ value: description
20
+ });
21
+ }
22
+ return payload;
23
+ };
9
24
  const getMutation = type => ({
10
25
  resource: endpointFromFileType(type),
11
26
  id: _ref => {
@@ -14,17 +29,13 @@ const getMutation = type => ({
14
29
  } = _ref;
15
30
  return id;
16
31
  },
17
- type: 'update',
18
- partial: true,
32
+ type: 'json-patch',
19
33
  data: _ref2 => {
20
34
  let {
21
35
  name,
22
36
  description
23
37
  } = _ref2;
24
- return {
25
- name,
26
- description
27
- };
38
+ return formatPayload(name, description);
28
39
  }
29
40
  });
30
41
  export const RenameDialog = _ref3 => {
@@ -61,7 +72,8 @@ export const RenameDialog = _ref3 => {
61
72
  });
62
73
  };
63
74
  return /*#__PURE__*/React.createElement(Modal, {
64
- onClose: onClose
75
+ onClose: onClose,
76
+ dataTest: "file-menu-rename-modal"
65
77
  }, /*#__PURE__*/React.createElement(_JSXStyle, {
66
78
  id: modalStyles.__hash
67
79
  }, modalStyles), /*#__PURE__*/React.createElement(ModalTitle, null, i18n.t('Rename {{fileType}}', {
@@ -78,7 +90,8 @@ export const RenameDialog = _ref3 => {
78
90
  value
79
91
  } = _ref4;
80
92
  return setName(value);
81
- }
93
+ },
94
+ dataTest: "file-menu-rename-modal-name"
82
95
  }), /*#__PURE__*/React.createElement(TextAreaField, {
83
96
  label: i18n.t('Description'),
84
97
  disabled: loading,
@@ -89,15 +102,18 @@ export const RenameDialog = _ref3 => {
89
102
  value
90
103
  } = _ref5;
91
104
  return setDescription(value);
92
- }
105
+ },
106
+ dataTest: "file-menu-rename-modal-description"
93
107
  }))), /*#__PURE__*/React.createElement(ModalActions, null, /*#__PURE__*/React.createElement(ButtonStrip, null, /*#__PURE__*/React.createElement(Button, {
94
108
  onClick: onClose,
95
109
  disabled: loading,
96
- secondary: true
110
+ secondary: true,
111
+ dataTest: "file-menu-rename-modal-cancel"
97
112
  }, i18n.t('Cancel')), /*#__PURE__*/React.createElement(Button, {
98
113
  onClick: renameObject,
99
114
  disabled: loading,
100
- primary: true
115
+ primary: true,
116
+ dataTest: "file-menu-rename-modal-rename"
101
117
  }, i18n.t('Rename')))));
102
118
  };
103
119
  RenameDialog.propTypes = {
@@ -14,7 +14,7 @@ export const colorSets = {
14
14
  colors: ['#a8bf24', '#518cc3', '#d74554', '#ff9e21', '#968f8f', '#ba3ba1', '#ffda54', '#45beae', '#b98037', '#676767', '#6b2dd4', '#47792c', '#fcbdbd', '#830000', '#a5ffc0', '#000078', '#817c00', '#bdf023', '#fffac4']
15
15
  },
16
16
  [COLOR_SET_BASIC]: {
17
- colors: ['#348F41', '#9F2241', '#DDDDDD', '#B4A269']
17
+ colors: ['#348F41', '#9F2241', '#B4A269', '#EBEEF3', '#58595B', '#1A5632']
18
18
  },
19
19
  [COLOR_SET_EXTENDED]: {
20
20
  colors: ['#194F90', '#AE1857', '#5B7E96', '#FFB71B', '#1DCAD3', '#FF5C35', '#8F4899', '#DAE343', '#385CAD', '#E81F76', '#009383', '#522B39']
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhis2/analytics",
3
- "version": "26.1.4",
3
+ "version": "26.1.6",
4
4
  "main": "./build/cjs/index.js",
5
5
  "module": "./build/es/index.js",
6
6
  "exports": {