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

Commit

Permalink
Create new getAttributes methods in genericActions #1357
Browse files Browse the repository at this point in the history
  • Loading branch information
wiadev committed Nov 29, 2017
1 parent 8521f7f commit 55a13af
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
20 changes: 20 additions & 0 deletions src/actions/GenericActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,26 @@ export function getData(
);
}

/**
*
* @param {*} entity - entity should always be `documentView`
* @param {*} windowId
* @param {*} viewId
* @param {*} rowId
*/
export function getAttributes(
entity, windowId, viewId, rowId
) {
return axios.get(
config.API_URL +
'/' + entity +
'/' + windowId +
(viewId ? '/' + viewId : '') +
(rowId ? '/' + rowId : '') +
'/attributes'
);
}

export function createInstance(entity, docType, docId, tabId, subentity) {
return axios.post(
config.API_URL +
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
getAttributes
} 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 getAttributes(entity, windowType, viewId, selected[0]);
}).then(response => {
DLWrapperSetData(response.data.fieldsByName, response.data.id);
}).catch(() => {});
Expand Down

0 comments on commit 55a13af

Please sign in to comment.