Skip to content
This repository has been archived by the owner on Dec 13, 2020. It is now read-only.

Commit

Permalink
Merge pull request #1392 from metasfresh/dev-1357
Browse files Browse the repository at this point in the history
new getAttributes methods #1357
  • Loading branch information
teosarca committed Nov 30, 2017
2 parents 27c5bd3 + e0eed6c commit af74af7
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 5 deletions.
19 changes: 19 additions & 0 deletions src/actions/GenericActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,25 @@ export function getData(
);
}

/**
*
* @param {*} windowId
* @param {*} viewId
* @param {*} rowId
*/
export function getViewAttributes (
windowId, viewId, rowId
) {
return axios.get(
config.API_URL +
'/documentView'+
'/' + windowId +
'/' + viewId +
'/' + rowId +
'/attributes'
);
}

export function createInstance(entity, docType, docId, tabId, subentity) {
return axios.post(
config.API_URL +
Expand Down
6 changes: 4 additions & 2 deletions src/actions/WindowActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -472,13 +472,15 @@ export function patch(
viewId,
isEdit
}).then(response => {
let data = response.data instanceof Array ?
response.data : [response.data];
dispatch(mapDataToState(
response.data, isModal, rowId, id, windowType, isAdvanced
data, isModal, rowId, id, windowType, isAdvanced
));

dispatch(indicatorState('saved'));

return response.data;
return data;
}).catch(() => {
getData(
entity, windowType, id, tabId, rowId, null, null, isAdvanced,
Expand Down
5 changes: 2 additions & 3 deletions src/components/app/SelectionAttributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import counterpart from 'counterpart';

import {
initLayout,
getData
getViewAttributes
} from '../../actions/GenericActions';

import RawWidget from '../widget/RawWidget';
Expand Down Expand Up @@ -38,11 +38,10 @@ class SelectionAttributes extends Component {
windowType, viewId, selected, entity, DLWrapperSetData,
DLWrapperSetLayout
} = this.props;

initLayout(entity, windowType, selected[0], null, viewId)
.then(response => {
DLWrapperSetLayout(response.data.elements);
return getData(entity, windowType, viewId, selected[0]);
return getViewAttributes(windowType, viewId, selected[0]);
}).then(response => {
DLWrapperSetData(response.data.fieldsByName, response.data.id);
}).catch(() => {});
Expand Down

0 comments on commit af74af7

Please sign in to comment.