@configuratorware/configurator-admingui 1.34.1 → 1.34.2

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.
@@ -5,7 +5,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.dismissRequest = exports.deleteData = exports.postData = exports.fetchDataIfNeeded = exports.fetchData = exports.expiredResponse = exports.deleteRequest = exports.postRequest = exports.networkError = exports.receiveData = exports.requestData = exports.resetDidInvalidate = exports.invalidateSource = exports.RESET_DID_INVALIDATE = exports.EXPIRED_RESPONSE = exports.CANCEL_REQUEST = exports.DELETE_DATA = exports.POST_DATA = exports.HANDLED_NETWORK_ERROR = exports.NETWORK_ERROR = exports.INVALIDATE_SOURCE = exports.RECEIVE_DATA = exports.REQUEST_DATA = void 0;
8
+ exports.dismissRequest = exports.deleteData = exports.postData = exports.fetchDataIfNeeded = exports.fetchData = exports.expiredResponse = exports.deleteRequest = exports.postRequest = exports.networkError = exports.receiveData = exports.requestData = exports.resetSource = exports.resetDidInvalidate = exports.invalidateSource = exports.RESET_SOURCE = exports.RESET_DID_INVALIDATE = exports.EXPIRED_RESPONSE = exports.CANCEL_REQUEST = exports.DELETE_DATA = exports.POST_DATA = exports.HANDLED_NETWORK_ERROR = exports.NETWORK_ERROR = exports.INVALIDATE_SOURCE = exports.RECEIVE_DATA = exports.REQUEST_DATA = void 0;
9
9
 
10
10
  var _lodash = _interopRequireDefault(require("lodash"));
11
11
 
@@ -43,6 +43,8 @@ var EXPIRED_RESPONSE = 'EXPIRED_RESPONSE';
43
43
  exports.EXPIRED_RESPONSE = EXPIRED_RESPONSE;
44
44
  var RESET_DID_INVALIDATE = 'RESET_DID_INVALIDATE';
45
45
  exports.RESET_DID_INVALIDATE = RESET_DID_INVALIDATE;
46
+ var RESET_SOURCE = 'RESET_SOURCE';
47
+ exports.RESET_SOURCE = RESET_SOURCE;
46
48
 
47
49
  var invalidateSource = function invalidateSource(key) {
48
50
  return {
@@ -62,6 +64,15 @@ var resetDidInvalidate = function resetDidInvalidate(key) {
62
64
 
63
65
  exports.resetDidInvalidate = resetDidInvalidate;
64
66
 
67
+ var resetSource = function resetSource(key) {
68
+ return {
69
+ type: RESET_SOURCE,
70
+ key: key
71
+ };
72
+ };
73
+
74
+ exports.resetSource = resetSource;
75
+
65
76
  var requestData = function requestData(source, key) {
66
77
  return {
67
78
  type: REQUEST_DATA,
@@ -33,7 +33,7 @@ Object.defineProperty(exports, "HANDLED_NETWORK_ERROR", {
33
33
  return _Actions.HANDLED_NETWORK_ERROR;
34
34
  }
35
35
  });
36
- exports["default"] = exports.getMethods = exports.apiActionHandler = exports.handleNetworkErrorAction = exports.dispatchDeleteData = exports.dispatchPostData = exports.dispatchFetchData = void 0;
36
+ exports["default"] = exports.getMethods = exports.apiActionHandler = exports.handleNetworkErrorAction = exports.dispatchDeleteData = exports.dispatchPostData = exports.dispatchResetSource = exports.dispatchFetchData = void 0;
37
37
 
38
38
  var _Actions = require("./Actions");
39
39
 
@@ -45,6 +45,14 @@ var dispatchFetchData = function dispatchFetchData(dispatch) {
45
45
 
46
46
  exports.dispatchFetchData = dispatchFetchData;
47
47
 
48
+ var dispatchResetSource = function dispatchResetSource(dispatch) {
49
+ return function (key) {
50
+ return dispatch((0, _Actions.resetSource)(key));
51
+ };
52
+ };
53
+
54
+ exports.dispatchResetSource = dispatchResetSource;
55
+
48
56
  var dispatchPostData = function dispatchPostData(dispatch) {
49
57
  return function (key, source, data) {
50
58
  return dispatch((0, _Actions.postData)(source, data, key));
@@ -84,6 +84,11 @@ var data = function data() {
84
84
  isDeleted: action.ids
85
85
  });
86
86
 
87
+ case _Actions.RESET_SOURCE:
88
+ return _objectSpread(_objectSpread({}, state), {}, {
89
+ source: null
90
+ });
91
+
87
92
  default:
88
93
  return state;
89
94
  }
@@ -103,6 +108,7 @@ var dataBySource = function dataBySource() {
103
108
  case _Actions.CANCEL_REQUEST:
104
109
  case _Actions.EXPIRED_RESPONSE:
105
110
  case _Actions.RESET_DID_INVALIDATE:
111
+ case _Actions.RESET_SOURCE:
106
112
  return _objectSpread(_objectSpread({}, state), {}, _defineProperty({}, action.key, data(state[action.key], action)));
107
113
 
108
114
  default:
@@ -305,7 +305,9 @@ var generateDefaultActions = function generateDefaultActions(listKey, dataKey, r
305
305
  return dispatch(triggerUnsavedEntity()).then(function () {
306
306
  dispatch(unmountEntity());
307
307
  dispatch(initUnsavedEntity(reducerName));
308
- dispatch(mountNewEntity());
308
+ dispatch(mountNewEntity()); // source might still be set from last fetch, so reset it here
309
+
310
+ (0, _Helpers.dispatchResetSource)(dispatch)(dataKey);
309
311
  dispatch(loadDependencies());
310
312
  dispatch(showDetails());
311
313
  });
@@ -17,6 +17,8 @@ var _DefaultConnectedForm = _interopRequireWildcard(require("../../../../../Comp
17
17
 
18
18
  var _Actions = _interopRequireWildcard(require("../Reducers/Actions"));
19
19
 
20
+ var _Actions2 = require("../../../Reducers/Actions");
21
+
20
22
  var _File = _interopRequireDefault(require("../../../../../Components/FormFragments/File"));
21
23
 
22
24
  var _CircularProgress = _interopRequireDefault(require("@material-ui/core/CircularProgress"));
@@ -108,7 +110,7 @@ var FileInput = (0, _styles.withStyles)({
108
110
  return (0, _get["default"])(state[_Actions.REDUCER_NAME], 'source.item.identifier');
109
111
  });
110
112
  var itemId = (0, _reactRedux.useSelector)(function (state) {
111
- return (0, _get["default"])(state[_Actions.REDUCER_NAME], 'source.item.id');
113
+ return (0, _get["default"])(state[_Actions2.DESIGNER_REDUCER_NAME], 'source.id');
112
114
  });
113
115
  var colorGroupEntries = (0, _reactRedux.useSelector)(getGroupEntries('color'));
114
116
  var viewImages = (0, _reactRedux.useSelector)(function (state) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@configuratorware/configurator-admingui",
3
- "version": "1.34.1",
3
+ "version": "1.34.2",
4
4
  "license": "UNLICENSED",
5
5
  "private": false,
6
6
  "dependencies": {
@@ -29,7 +29,7 @@
29
29
  "react-redux-i18n": "^1.9.3",
30
30
  "react-router": "^3.2.6",
31
31
  "react-sortable-hoc": "^1.11.0",
32
- "redhotmagma-visualization": "1.34.1",
32
+ "redhotmagma-visualization": "1.34.2",
33
33
  "redux": "^4.1.0",
34
34
  "redux-logger": "^3.0.6",
35
35
  "redux-persist": "^5.10.0",
@@ -11,6 +11,7 @@ export const DELETE_DATA = 'DELETE_DATA';
11
11
  export const CANCEL_REQUEST = 'CANCEL_REQUEST';
12
12
  export const EXPIRED_RESPONSE = 'EXPIRED_RESPONSE';
13
13
  export const RESET_DID_INVALIDATE = 'RESET_DID_INVALIDATE';
14
+ export const RESET_SOURCE = 'RESET_SOURCE';
14
15
 
15
16
  export const invalidateSource = key => ({
16
17
  type: INVALIDATE_SOURCE,
@@ -22,6 +23,11 @@ export const resetDidInvalidate = key => ({
22
23
  key,
23
24
  });
24
25
 
26
+ export const resetSource = key => ({
27
+ type: RESET_SOURCE,
28
+ key,
29
+ });
30
+
25
31
  export const requestData = (source, key) => ({
26
32
  type: REQUEST_DATA,
27
33
  source,
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  fetchDataIfNeeded,
3
3
  invalidateSource,
4
+ resetSource,
4
5
  postData,
5
6
  deleteData,
6
7
  dismissRequest,
@@ -17,6 +18,10 @@ export const dispatchFetchData = dispatch => (key, source) => {
17
18
 
18
19
  export { invalidateSource };
19
20
 
21
+ export const dispatchResetSource = dispatch => key => {
22
+ return dispatch(resetSource(key));
23
+ };
24
+
20
25
  export const dispatchPostData = dispatch => (key, source, data) => {
21
26
  return dispatch(postData(source, data, key));
22
27
  };
@@ -8,6 +8,7 @@ import {
8
8
  CANCEL_REQUEST,
9
9
  EXPIRED_RESPONSE,
10
10
  RESET_DID_INVALIDATE,
11
+ RESET_SOURCE,
11
12
  } from './Actions';
12
13
 
13
14
  const data = (
@@ -81,6 +82,11 @@ const data = (
81
82
  didInvalidate: false,
82
83
  isDeleted: action.ids,
83
84
  };
85
+ case RESET_SOURCE:
86
+ return {
87
+ ...state,
88
+ source: null,
89
+ };
84
90
  default:
85
91
  return state;
86
92
  }
@@ -97,6 +103,7 @@ export const dataBySource = (state = {}, action) => {
97
103
  case CANCEL_REQUEST:
98
104
  case EXPIRED_RESPONSE:
99
105
  case RESET_DID_INVALIDATE:
106
+ case RESET_SOURCE:
100
107
  return {
101
108
  ...state,
102
109
  [action.key]: data(state[action.key], action),
@@ -80,6 +80,7 @@ import {
80
80
  dispatchPostData,
81
81
  dispatchDeleteData,
82
82
  invalidateSource,
83
+ dispatchResetSource,
83
84
  dismissRequest,
84
85
  } from '../Api/Helpers';
85
86
  import { RECEIVE_DATA, HANDLED_NETWORK_ERROR, NETWORK_ERROR } from '../Api/Actions';
@@ -221,6 +222,8 @@ export const generateDefaultActions = (listKey, dataKey, reducerName, url, ctx =
221
222
  dispatch(unmountEntity());
222
223
  dispatch(initUnsavedEntity(reducerName));
223
224
  dispatch(mountNewEntity());
225
+ // source might still be set from last fetch, so reset it here
226
+ dispatchResetSource(dispatch)(dataKey);
224
227
  dispatch(loadDependencies());
225
228
  dispatch(showDetails());
226
229
  });
@@ -3,6 +3,7 @@ import { useSelector } from 'react-redux';
3
3
  import get from 'lodash/get';
4
4
  import generateConnectedEdit, { CancelButton } from '../../../../../Components/DefaultConnectedForm';
5
5
  import Actions, { REDUCER_NAME } from '../Reducers/Actions';
6
+ import { DESIGNER_REDUCER_NAME } from '../../../Reducers/Actions';
6
7
  import File from '../../../../../Components/FormFragments/File';
7
8
  import CircularProgress from '@material-ui/core/CircularProgress';
8
9
  import { withStyles } from '@material-ui/core/styles';
@@ -41,7 +42,7 @@ const FileInput = withStyles({
41
42
  },
42
43
  })(({ value, onChange, classes, ...props }) => {
43
44
  const itemIdentifier = useSelector(state => get(state[REDUCER_NAME], 'source.item.identifier'));
44
- const itemId = useSelector(state => get(state[REDUCER_NAME], 'source.item.id'));
45
+ const itemId = useSelector(state => get(state[DESIGNER_REDUCER_NAME], 'source.id'));
45
46
  const colorGroupEntries = useSelector(getGroupEntries('color'));
46
47
  const viewImages = useSelector(state => get(state[REDUCER_NAME], 'viewImages'));
47
48
  if (colorGroupEntries.length) {