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

Commit

Permalink
Merge branch 'dev-252' of git.jazzy.pro:metasfresh/meta-frontend into…
Browse files Browse the repository at this point in the history
… dev-252
  • Loading branch information
Dunkat committed Feb 14, 2017
2 parents b3df2ea + 53e741a commit 8347793
Show file tree
Hide file tree
Showing 22 changed files with 336 additions and 147 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"react-dnd": "~2.1.4",
"react-dnd-html5-backend": "~2.1.2",
"react-dom": "~15.4.2",
"react-dropzone": "~3.9.2",
"react-onclickoutside": "~5.3.3",
"react-redux": "~4.4.5",
"react-router": "~2.5.1",
Expand Down
8 changes: 5 additions & 3 deletions src/actions/GenericActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ export function getData(
) {
return () => axios.get(
config.API_URL +
'/' + entity + '/' +
docType + '/' +
'/' + entity +
'/' + docType +
(docId ? "/" + docId : "") +
(tabId ? "/" + tabId : "") +
(rowId ? "/" + rowId : "") +
Expand All @@ -37,7 +37,9 @@ export function getData(
export function createInstance(entity, docType, docId, tabId, subentity) {
return () => axios.post(
config.API_URL +
'/' + entity + '/' + docType + '/' + docId +
'/' + entity +
'/' + docType +
'/' + docId +
(tabId ? "/" + tabId : "") +
(subentity ? "/" + subentity : "")
);
Expand Down
58 changes: 38 additions & 20 deletions src/actions/WindowActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ import {
initLayout,
getData,
patchRequest,
printRequest
printRequest,
createInstance
} from './GenericActions';

import {
Expand Down Expand Up @@ -179,11 +180,17 @@ export function createWindow(windowType, docId = "NEW", tabId, rowId, isModal =
docId = "NEW";
}


// this chain is really important,
// to do not re-render widgets on init
return dispatch(initWindow(windowType, docId, tabId, rowId, isAdvanced))
.then(response => {

if (docId == "NEW" && !isModal) {
// redirect immedietely
return dispatch(push("/window/" + windowType + "/" + response.data[0].id));
}

let elem = 0;

response.data.forEach((value, index) => {
Expand All @@ -192,11 +199,6 @@ export function createWindow(windowType, docId = "NEW", tabId, rowId, isModal =
}
});

if (docId == "NEW" && !isModal) {
dispatch(clearListProps());
dispatch(replace("/window/" + windowType + "/" + response.data[0].id));
}

docId = response.data[elem].id;
const preparedData = parseToDisplay(response.data[elem].fields);

Expand All @@ -210,23 +212,25 @@ export function createWindow(windowType, docId = "NEW", tabId, rowId, isModal =
if (!isModal) {
dispatch(getWindowBreadcrumb(windowType));
}
}).then(() =>
dispatch(initLayout('window', windowType, tabId, null, null, isAdvanced))
).then(response =>
dispatch(initLayoutSuccess(response.data, getScope(isModal)))
).then(response => {
let tabTmp = {};

response.layout.tabs && response.layout.tabs.map(tab => {
tabTmp[tab.tabid] = {};
dispatch(getTab(tab.tabid, windowType, docId)).then(res => {
tabTmp[tab.tabid] = res;
dispatch(addRowData(tabTmp, getScope(isModal)));
})
})

dispatch(initLayout('window', windowType, tabId, null, null, isAdvanced)
).then(response =>
dispatch(initLayoutSuccess(response.data, getScope(isModal)))
).then(response => {
let tabTmp = {};

response.layout.tabs && response.layout.tabs.map(tab => {
tabTmp[tab.tabid] = {};
dispatch(getTab(tab.tabid, windowType, docId)).then(res => {
tabTmp[tab.tabid] = res;
dispatch(addRowData(tabTmp, getScope(isModal)));
})
}
)
}).catch((err) => {
dispatch(addNotification("Error", err.response.data.error, 5000, "error"));
});
});
}
}

Expand Down Expand Up @@ -361,6 +365,20 @@ export function updateProperty(property, value, tabid, rowid, isModal) {
}
}

export function attachFileAction(windowType, docId, data){
return dispatch => {
dispatch(addNotification('Attachment', 'Uploading attachment', 5000, 'primary'));

return axios.post(`${config.API_URL}/window/${windowType}/${docId}/attachments`, data)
.then(() => {
dispatch(addNotification('Attachment', 'Uploading attachment succeeded.', 5000, 'primary'))
})
.catch(() => {
dispatch(addNotification('Attachment', 'Uploading attachment error.', 5000, 'error'))
})
}
}

// PROCESS ACTIONS

export function createProcess(processType, viewId, type, ids) {
Expand Down
2 changes: 1 addition & 1 deletion src/assets/css/datetime.css
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
width: 260px;
padding: 0;
margin-top: 3px;
z-index: 99999 !important;
z-index: 99 !important;
background: #fff;
border: 1px solid $brand-light-color;
border-radius: 3px;
Expand Down
9 changes: 6 additions & 3 deletions src/assets/css/font-meta.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
font-family: "meta";
src:url("fonts/meta.eot");
src:url("fonts/meta.eot?#iefix") format("embedded-opentype"),
url("fonts/meta.woff") format("woff"),
url("fonts/meta.ttf") format("truetype"),
url("fonts/meta.svg#meta") format("svg");
url("fonts/meta.woff") format("woff"),
url("fonts/meta.ttf") format("truetype"),
url("fonts/meta.svg#meta") format("svg");
font-weight: normal;
font-style: normal;

Expand Down Expand Up @@ -197,3 +197,6 @@
.meta-icon-accept:before {
content: "\30";
}
.meta-icon-upload-1:before {
content: "\31";
}
Binary file modified src/assets/css/fonts/meta.eot
Binary file not shown.
Loading

0 comments on commit 8347793

Please sign in to comment.