@configuratorware/configurator-admingui 1.35.0 → 1.35.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) {
@@ -198,7 +200,7 @@ var formFields = [{
198
200
  }
199
201
  }, {
200
202
  name: 'images',
201
- label: 'Item View image',
203
+ label: "designcontainer.imageUploadLabel",
202
204
  type: FileInput,
203
205
  accept: '.png,.jpg',
204
206
  openEnabled: false,
@@ -5,12 +5,18 @@ require("../../../../App/i18n").use({
5
5
  designviews: 'Designviews',
6
6
  designview: {
7
7
  addButtonLabel: 'Add Designview'
8
+ },
9
+ designcontainer: {
10
+ imageUploadLabel: "Background image of the designarea"
8
11
  }
9
12
  },
10
13
  de: {
11
14
  designviews: 'Designansichten',
12
15
  designview: {
13
16
  addButtonLabel: 'Designansichten hinzufügen'
17
+ },
18
+ designcontainer: {
19
+ imageUploadLabel: "Hintergrundbild der Designfläche"
14
20
  }
15
21
  }
16
22
  }, true);
@@ -31,7 +31,7 @@ var columns = [{
31
31
  var listParams = {
32
32
  entity: 'questionTree',
33
33
  orderdir: 'asc',
34
- addButtonLabel: 'item.addButtonLabel'
34
+ addButtonLabel: 'addButtonLabel'
35
35
  };
36
36
 
37
37
  var _default = (0, _DefaultConnectedList["default"])(columns, listParams, _Actions.FINDER_LIST_KEY, _Actions["default"].listAction, _Actions["default"].detailsAction, _Actions["default"].hideDetails, _Actions["default"].showDetails, _Actions["default"].createEntity, _Actions["default"].deleteEntities);
@@ -99,8 +99,9 @@ actions.postData = function () {
99
99
  text = text.replace(/"'/g, '"');
100
100
  text = text.replace(/'/g, '"'); // fix fieldnames wrapped in single quotes - json only allows for double quotes
101
101
 
102
- text = text.replace(/(['"])?([a-zA-Z0-9_]+)(['"])?:([^\/])/g, '"$2":$4');
102
+ text = JSON.stringify(eval(text));
103
103
  } catch (e) {
104
+ console.log(e);
104
105
  console.log('error doing json replacements');
105
106
  }
106
107
 
@@ -2,9 +2,11 @@
2
2
 
3
3
  require("../../App/i18n").use({
4
4
  en: {
5
- questionTree: 'Question Tree'
5
+ questionTree: 'Question Tree',
6
+ addButtonLabel: 'Add Question Tree'
6
7
  },
7
8
  de: {
8
- questionTree: 'Fragebaum'
9
+ questionTree: 'Fragebaum',
10
+ addButtonLabel: 'Fragebaum hinzufügen'
9
11
  }
10
12
  }, true);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@configuratorware/configurator-admingui",
3
- "version": "1.35.0",
3
+ "version": "1.35.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.35.0",
32
+ "redhotmagma-visualization": "1.35.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) {
@@ -114,7 +115,7 @@ const formFields = [
114
115
  },
115
116
  {
116
117
  name: 'images',
117
- label: 'Item View image',
118
+ label: `designcontainer.imageUploadLabel`,
118
119
  type: FileInput,
119
120
  accept: '.png,.jpg',
120
121
  openEnabled: false,
@@ -5,12 +5,18 @@ require('../../../../App/i18n').use(
5
5
  designview: {
6
6
  addButtonLabel: 'Add Designview',
7
7
  },
8
+ designcontainer: {
9
+ imageUploadLabel: "Background image of the designarea",
10
+ },
8
11
  },
9
12
  de: {
10
13
  designviews: 'Designansichten',
11
14
  designview: {
12
15
  addButtonLabel: 'Designansichten hinzufügen',
13
16
  },
17
+ designcontainer: {
18
+ imageUploadLabel: "Hintergrundbild der Designfläche",
19
+ },
14
20
  },
15
21
  },
16
22
  true
@@ -18,7 +18,7 @@ const columns = [
18
18
  const listParams = {
19
19
  entity: 'questionTree',
20
20
  orderdir: 'asc',
21
- addButtonLabel: 'item.addButtonLabel',
21
+ addButtonLabel: 'addButtonLabel',
22
22
  };
23
23
 
24
24
  import generateConnectedList from '../../../Components/DefaultConnectedList';
@@ -45,6 +45,7 @@ actions.postData = () => (dispatch, getState) => {
45
45
  const questionTreeId = result.data.id;
46
46
  state.data.data.value.forEach((treeFile) => {
47
47
  const languageId = languages.findIndex((language) => language.iso === treeFile.language) + 1;
48
+
48
49
  if (languageId > 0 && treeFile.fileName.name) {
49
50
  filesToUpload.push({
50
51
  value: treeFile.fileName,
@@ -61,7 +62,6 @@ actions.postData = () => (dispatch, getState) => {
61
62
  dispatch(originalPostDataAction());
62
63
  return;
63
64
  }
64
-
65
65
  const reader = new FileReader();
66
66
  reader.onload = function(fileContent) {
67
67
  let text = reader.result;
@@ -73,8 +73,9 @@ actions.postData = () => (dispatch, getState) => {
73
73
  text = text.replace(/"'/g, '"');
74
74
  text = text.replace(/'/g, '"');
75
75
  // fix fieldnames wrapped in single quotes - json only allows for double quotes
76
- text = text.replace(/(['"])?([a-zA-Z0-9_]+)(['"])?:([^\/])/g, '"$2":$4');
76
+ text = JSON.stringify(eval(text));
77
77
  } catch (e) {
78
+ console.log(e)
78
79
  console.log('error doing json replacements')
79
80
  }
80
81
  uploadFile(file.value.name, text, file.languageId, questionTreeId, dispatch, resolve, () => {
@@ -2,9 +2,11 @@ require('../../App/i18n').use(
2
2
  {
3
3
  en: {
4
4
  questionTree: 'Question Tree',
5
+ addButtonLabel: 'Add Question Tree',
5
6
  },
6
7
  de: {
7
8
  questionTree: 'Fragebaum',
9
+ addButtonLabel: 'Fragebaum hinzufügen'
8
10
  },
9
11
  },
10
12
  true