@configuratorware/configurator-admingui 1.37.1 → 1.37.3
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.
- package/Screens/Designer/SubScreens/DesignAreas/Reducers/Actions.js +14 -8
- package/Screens/Designer/SubScreens/Designviews/Reducers/Actions.js +5 -5
- package/package.json +2 -2
- package/src/Screens/Designer/SubScreens/DesignAreas/Reducers/Actions.js +16 -9
- package/src/Screens/Designer/SubScreens/Designviews/Reducers/Actions.js +5 -5
|
@@ -110,25 +110,31 @@ var postData = function postData() {
|
|
|
110
110
|
|
|
111
111
|
|
|
112
112
|
return dispatch(DesignAreaActions.postData(true)).then(function (res) {
|
|
113
|
+
var designAreaId = res.data.id;
|
|
113
114
|
var files = designAreasData.data.designProductionMethods.value.map(function (dp) {
|
|
114
|
-
return
|
|
115
|
+
return {
|
|
116
|
+
file: (0, _get["default"])(dp, 'mask.maskFile', null),
|
|
117
|
+
dpId: dp.id
|
|
118
|
+
};
|
|
115
119
|
}).filter(function (dp) {
|
|
116
|
-
return dp;
|
|
120
|
+
return dp.file;
|
|
117
121
|
});
|
|
118
122
|
var designAreaFile = designAreasData.data.mask.value.maskFile;
|
|
119
|
-
designAreaFile && files.push(
|
|
120
|
-
|
|
123
|
+
designAreaFile && files.push({
|
|
124
|
+
file: designAreaFile
|
|
125
|
+
});
|
|
126
|
+
files.map(function (_ref) {
|
|
127
|
+
var file = _ref.file,
|
|
128
|
+
dpId = _ref.dpId;
|
|
121
129
|
var data = new FormData();
|
|
122
130
|
data.append('mask', file);
|
|
123
131
|
|
|
124
132
|
try {
|
|
125
|
-
|
|
133
|
+
return _Api["default"].request({
|
|
126
134
|
method: 'POST',
|
|
127
|
-
url: "design_areas/".concat(
|
|
135
|
+
url: dpId ? "design_areas/".concat(designAreaId, "/design_production_methods/").concat(dpId, "/upload_mask") : "design_areas/".concat(designAreaId, "/upload_mask"),
|
|
128
136
|
data: data
|
|
129
137
|
});
|
|
130
|
-
|
|
131
|
-
return result;
|
|
132
138
|
} catch (e) {
|
|
133
139
|
throw e;
|
|
134
140
|
}
|
|
@@ -138,8 +138,8 @@ var DesignViewActions = (0, _Actions2.generateDefaultActions)(LIST_KEY, DATA_KEY
|
|
|
138
138
|
var CREATOR_VIEW_URL = 'creator_views';
|
|
139
139
|
var CreatorViewActions = (0, _Actions2.generateDefaultActions)(LIST_KEY, DATA_KEY, REDUCER_NAME, CREATOR_VIEW_URL);
|
|
140
140
|
|
|
141
|
-
var
|
|
142
|
-
return (0, _get["default"])(designerData, 'data.visualizationMode.value.validForConfigurationModes', []).indexOf('creator+designer') !== -1
|
|
141
|
+
var isCreatorDesignerMode = function isCreatorDesignerMode(designerData) {
|
|
142
|
+
return (0, _get["default"])(designerData, 'data.visualizationMode.value.validForConfigurationModes', []).indexOf('creator+designer') !== -1;
|
|
143
143
|
};
|
|
144
144
|
|
|
145
145
|
var listAction = function listAction(params) {
|
|
@@ -155,7 +155,7 @@ var listAction = function listAction(params) {
|
|
|
155
155
|
limit: 1000
|
|
156
156
|
});
|
|
157
157
|
|
|
158
|
-
if (
|
|
158
|
+
if (isCreatorDesignerMode(designerData)) {
|
|
159
159
|
dispatch(CreatorViewActions.listAction(_objectSpread(_objectSpread({}, paramsWithLimit), {}, {
|
|
160
160
|
filters: _objectSpread(_objectSpread({}, filters), {}, {
|
|
161
161
|
'creatorview.item.id': id
|
|
@@ -235,7 +235,7 @@ var postData = function postData() {
|
|
|
235
235
|
var _getState4 = getState(),
|
|
236
236
|
designerData = _getState4.designerData;
|
|
237
237
|
|
|
238
|
-
if (
|
|
238
|
+
if (isCreatorDesignerMode(designerData)) {
|
|
239
239
|
return dispatch(CreatorViewActions.postData(true));
|
|
240
240
|
} else {
|
|
241
241
|
return dispatch(DesignViewActions.postData(true));
|
|
@@ -252,7 +252,7 @@ var detailsAction = function detailsAction() {
|
|
|
252
252
|
var _getState5 = getState(),
|
|
253
253
|
designerData = _getState5.designerData;
|
|
254
254
|
|
|
255
|
-
if (
|
|
255
|
+
if (isCreatorDesignerMode(designerData)) {
|
|
256
256
|
return dispatch(CreatorViewActions.detailsAction.apply(CreatorViewActions, args));
|
|
257
257
|
} else {
|
|
258
258
|
return dispatch(DesignViewActions.detailsAction.apply(DesignViewActions, args));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@configuratorware/configurator-admingui",
|
|
3
|
-
"version": "1.37.
|
|
3
|
+
"version": "1.37.3",
|
|
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.37.
|
|
32
|
+
"redhotmagma-visualization": "1.37.3",
|
|
33
33
|
"redux": "^4.1.0",
|
|
34
34
|
"redux-logger": "^3.0.6",
|
|
35
35
|
"redux-persist": "^5.10.0",
|
|
@@ -17,8 +17,13 @@ const listAction = params => (dispatch, getState) => {
|
|
|
17
17
|
const { designerData } = getState();
|
|
18
18
|
const id = designerData.data.id.value;
|
|
19
19
|
const filters = (params && params.filters) || {};
|
|
20
|
-
const paramsWithLimit = {...params, offset: 0, limit: 1000}
|
|
21
|
-
dispatch(
|
|
20
|
+
const paramsWithLimit = { ...params, offset: 0, limit: 1000 };
|
|
21
|
+
dispatch(
|
|
22
|
+
DesignAreaActions.listAction({
|
|
23
|
+
...paramsWithLimit,
|
|
24
|
+
filters: { ...filters, 'designarea.item.id': id },
|
|
25
|
+
})
|
|
26
|
+
);
|
|
22
27
|
};
|
|
23
28
|
const invalidateList = () => (dispatch, getState) => {
|
|
24
29
|
const { entity } = getState();
|
|
@@ -54,21 +59,23 @@ const postData = () => (dispatch, getState) => {
|
|
|
54
59
|
const { designAreasData } = getState();
|
|
55
60
|
// to save uploaded images
|
|
56
61
|
return dispatch(DesignAreaActions.postData(true)).then(res => {
|
|
62
|
+
const designAreaId = res.data.id;
|
|
57
63
|
const files = designAreasData.data.designProductionMethods.value
|
|
58
|
-
.map(dp => get(dp, 'mask.maskFile', null))
|
|
59
|
-
.filter(dp => dp);
|
|
64
|
+
.map(dp => ({ file: get(dp, 'mask.maskFile', null), dpId: dp.id }))
|
|
65
|
+
.filter(dp => dp.file);
|
|
60
66
|
const designAreaFile = designAreasData.data.mask.value.maskFile;
|
|
61
|
-
designAreaFile && files.push(designAreaFile);
|
|
62
|
-
files.map(file => {
|
|
67
|
+
designAreaFile && files.push({ file: designAreaFile });
|
|
68
|
+
files.map(({ file, dpId }) => {
|
|
63
69
|
const data = new FormData();
|
|
64
70
|
data.append('mask', file);
|
|
65
71
|
try {
|
|
66
|
-
|
|
72
|
+
return Api.request({
|
|
67
73
|
method: 'POST',
|
|
68
|
-
url:
|
|
74
|
+
url: dpId
|
|
75
|
+
? `design_areas/${designAreaId}/design_production_methods/${dpId}/upload_mask`
|
|
76
|
+
: `design_areas/${designAreaId}/upload_mask`,
|
|
69
77
|
data,
|
|
70
78
|
});
|
|
71
|
-
return result;
|
|
72
79
|
} catch (e) {
|
|
73
80
|
throw e;
|
|
74
81
|
}
|
|
@@ -88,10 +88,10 @@ const CREATOR_VIEW_URL = 'creator_views';
|
|
|
88
88
|
|
|
89
89
|
const CreatorViewActions = generateDefaultActions(LIST_KEY, DATA_KEY, REDUCER_NAME, CREATOR_VIEW_URL);
|
|
90
90
|
|
|
91
|
-
const
|
|
91
|
+
const isCreatorDesignerMode = designerData =>
|
|
92
92
|
get(designerData, 'data.visualizationMode.value.validForConfigurationModes', []).indexOf(
|
|
93
93
|
'creator+designer'
|
|
94
|
-
) !== -1
|
|
94
|
+
) !== -1;
|
|
95
95
|
|
|
96
96
|
const listAction = params => (dispatch, getState) => {
|
|
97
97
|
const { designerData } = getState();
|
|
@@ -99,7 +99,7 @@ const listAction = params => (dispatch, getState) => {
|
|
|
99
99
|
const filters = (params && params.filters) || {};
|
|
100
100
|
const paramsWithLimit = {...params, offset: 0, limit: 1000}
|
|
101
101
|
|
|
102
|
-
if (
|
|
102
|
+
if (isCreatorDesignerMode(designerData)) {
|
|
103
103
|
dispatch(
|
|
104
104
|
CreatorViewActions.listAction({ ...paramsWithLimit, filters: { ...filters, 'creatorview.item.id': id } })
|
|
105
105
|
);
|
|
@@ -157,7 +157,7 @@ const removeDesignArea = identifier => (dispatch, getState) => {
|
|
|
157
157
|
|
|
158
158
|
const postData = () => (dispatch, getState) => {
|
|
159
159
|
const { designerData } = getState();
|
|
160
|
-
if (
|
|
160
|
+
if (isCreatorDesignerMode(designerData)) {
|
|
161
161
|
return dispatch(CreatorViewActions.postData(true));
|
|
162
162
|
} else {
|
|
163
163
|
return dispatch(DesignViewActions.postData(true));
|
|
@@ -166,7 +166,7 @@ const postData = () => (dispatch, getState) => {
|
|
|
166
166
|
|
|
167
167
|
const detailsAction = (...args) => (dispatch, getState) => {
|
|
168
168
|
const { designerData } = getState();
|
|
169
|
-
if (
|
|
169
|
+
if (isCreatorDesignerMode(designerData)) {
|
|
170
170
|
return dispatch(CreatorViewActions.detailsAction(...args));
|
|
171
171
|
} else {
|
|
172
172
|
return dispatch(DesignViewActions.detailsAction(...args));
|