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

Commit

Permalink
REFACTOR after linting
Browse files Browse the repository at this point in the history
  • Loading branch information
damianprzygodzki committed Feb 15, 2017
1 parent fe7807b commit fc4f8d4
Show file tree
Hide file tree
Showing 63 changed files with 823 additions and 823 deletions.
36 changes: 18 additions & 18 deletions src/actions/AppActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ export function loginSuccess() {
client.subscribe(topic.data, msg => {
const notification = JSON.parse(msg.body);

if(notification.eventType === "Read"){
if(notification.eventType === 'Read'){
dispatch(updateNotification(notification.notification, notification.unreadCount));
}else if(notification.eventType === "New"){
}else if(notification.eventType === 'New'){
dispatch(newNotification(notification.notification, notification.unreadCount));
const notif = notification.notification;
if(notif.important){
dispatch(addNotification("Important notification", notif.message, 5000, "primary"))
dispatch(addNotification('Important notification', notif.message, 5000, 'primary'))
}
}
});
Expand Down Expand Up @@ -77,13 +77,13 @@ export function browseViewRequest(viewId, page, pageLength, orderBy, windowType)

export function createViewRequest(windowType, viewType, pageLength, filters, refDocType = null, refDocId = null){
return () => axios.post(config.API_URL + '/documentView/' + windowType, {
"documentType": windowType,
"viewType": viewType,
"referencing": (refDocType && refDocId) ? {
"documentType": refDocType,
"documentId": refDocId
'documentType': windowType,
'viewType': viewType,
'referencing': (refDocType && refDocId) ? {
'documentType': refDocType,
'documentId': refDocId
}: null,
"filters": filters
'filters': filters
});
}

Expand All @@ -107,7 +107,7 @@ export function deleteNotification(id){
export function updateUri(pathname, query, prop, value) {
return (dispatch) => {
let url = pathname;
url += "?";
url += '?';

// add new prop
// or overwrite existing
Expand All @@ -116,7 +116,7 @@ export function updateUri(pathname, query, prop, value) {
const queryKeys = Object.keys(query);

for(let i = 0; i < queryKeys.length; i++){
url += queryKeys[i] + "=" + query[queryKeys[i]] + (queryKeys.length - 1 !== i ? "&": "");
url += queryKeys[i] + '=' + query[queryKeys[i]] + (queryKeys.length - 1 !== i ? '&': '');
}

dispatch(replace(url));
Expand Down Expand Up @@ -159,13 +159,13 @@ export function markAsRead(id) {

export function getAttributesInstance(attrType, tmpId, docType, docId, tabId, rowId, fieldName) {
return () => axios.post(config.API_URL + '/' + attrType, {
"templateId": tmpId,
"source": {
"documentType": docType,
"documentId": docId,
"tabid": tabId,
"rowId": rowId,
"fieldName": fieldName
'templateId': tmpId,
'source': {
'documentType': docType,
'documentId': docId,
'tabid': tabId,
'rowId': rowId,
'fieldName': fieldName
}
});
}
Expand Down
108 changes: 54 additions & 54 deletions src/actions/GenericActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ export function initLayout(
return () => axios.get(
config.API_URL +
'/' + entity + '/' + docType +
(docId ? "/" + docId : "") +
(tabId ? "/" + tabId : "") +
(subentity ? "/" + subentity : "") +
(docId ? '/' + docId : '') +
(tabId ? '/' + tabId : '') +
(subentity ? '/' + subentity : '') +
'/layout' +
(isAdvanced ? "?advanced=true" : "") +
(list ? "?viewType=" + list : "") +
(supportTree ? "&supportTree=true" : "")
(isAdvanced ? '?advanced=true' : '') +
(list ? '?viewType=' + list : '') +
(supportTree ? '&supportTree=true' : '')
);
}

Expand All @@ -25,12 +25,12 @@ export function getData(
config.API_URL +
'/' + entity +
'/' + docType +
(docId ? "/" + docId : "") +
(tabId ? "/" + tabId : "") +
(rowId ? "/" + rowId : "") +
(subentity ? "/" + subentity : "") +
(subentityId ? "/" + subentityId : "") +
(isAdvanced ? "?advanced=true" : "")
(docId ? '/' + docId : '') +
(tabId ? '/' + tabId : '') +
(rowId ? '/' + rowId : '') +
(subentity ? '/' + subentity : '') +
(subentityId ? '/' + subentityId : '') +
(isAdvanced ? '?advanced=true' : '')
);
}

Expand All @@ -40,19 +40,19 @@ export function createInstance(entity, docType, docId, tabId, subentity) {
'/' + entity +
'/' + docType +
'/' + docId +
(tabId ? "/" + tabId : "") +
(subentity ? "/" + subentity : "")
(tabId ? '/' + tabId : '') +
(subentity ? '/' + subentity : '')
);
}

export function patchRequest(
entity, docType, docId = "NEW", tabId, rowId, property, value, subentity,
entity, docType, docId = 'NEW', tabId, rowId, property, value, subentity,
subentityId, isAdvanced, viewId
) {

let payload = [];

if (docId === "NEW") {
if (docId === 'NEW') {
payload = [];
} else if (Array.isArray(property) && value !== undefined) {
property.map(item => {
Expand All @@ -75,14 +75,14 @@ export function patchRequest(
return () => axios.patch(
config.API_URL +
'/' + entity +
(docType ? "/" + docType : "") +
(viewId ? "/" + viewId : "") +
(docId ? "/" + docId : "") +
(tabId ? "/" + tabId : "") +
(rowId ? "/" + rowId : "") +
(subentity ? "/" + subentity : "") +
(subentityId ? "/" + subentityId : "") +
(isAdvanced ? "?advanced=true" : ""), payload);
(docType ? '/' + docType : '') +
(viewId ? '/' + viewId : '') +
(docId ? '/' + docId : '') +
(tabId ? '/' + tabId : '') +
(rowId ? '/' + rowId : '') +
(subentity ? '/' + subentity : '') +
(subentityId ? '/' + subentityId : '') +
(isAdvanced ? '?advanced=true' : ''), payload);
}

export function completeRequest(
Expand All @@ -91,12 +91,12 @@ export function completeRequest(
return () => axios.post(
config.API_URL +
'/' + entity + '/' +
(docType ? "/" + docType : "") +
(docId ? "/" + docId : "") +
(tabId ? "/" + tabId : "") +
(rowId ? "/" + rowId : "") +
(subentity ? "/" + subentity : "") +
(subentityId ? "/" + subentityId : "") +
(docType ? '/' + docType : '') +
(docId ? '/' + docId : '') +
(tabId ? '/' + tabId : '') +
(rowId ? '/' + rowId : '') +
(subentity ? '/' + subentity : '') +
(subentityId ? '/' + subentityId : '') +
'/complete'
);
}
Expand All @@ -108,13 +108,13 @@ export function autocompleteRequest(
return () => axios.get(
config.API_URL +
'/' + entity +
(docType ? "/" + docType : "") +
(viewId ? "/" + viewId : "") +
(docId ? "/" + docId : "") +
(tabId ? "/" + tabId : "") +
(rowId ? "/" + rowId : "") +
(subentity ? "/" + subentity : "") +
(subentityId ? "/" + subentityId : "") +
(docType ? '/' + docType : '') +
(viewId ? '/' + viewId : '') +
(docId ? '/' + docId : '') +
(tabId ? '/' + tabId : '') +
(rowId ? '/' + rowId : '') +
(subentity ? '/' + subentity : '') +
(subentityId ? '/' + subentityId : '') +
'/attribute/' + propertyName +
'/typeahead' + '?query=' + encodeURIComponent(query)
);
Expand All @@ -126,13 +126,13 @@ export function dropdownRequest(
return () => axios.get(
config.API_URL +
'/' + entity +
(docType ? "/" + docType : "") +
(viewId ? "/" + viewId : "") +
(docId ? "/" + docId : "") +
(tabId ? "/" + tabId : "") +
(rowId ? "/" + rowId : "") +
(subentity ? "/" + subentity : "") +
(subentityId ? "/" + subentityId : "") +
(docType ? '/' + docType : '') +
(viewId ? '/' + viewId : '') +
(docId ? '/' + docId : '') +
(tabId ? '/' + tabId : '') +
(rowId ? '/' + rowId : '') +
(subentity ? '/' + subentity : '') +
(subentityId ? '/' + subentityId : '') +
'/attribute/' + propertyName +
'/dropdown'
);
Expand All @@ -144,19 +144,19 @@ export function deleteRequest(
return () => axios.delete(
config.API_URL +
'/' + entity +
(docType ? "/" + docType : "") +
(docId ? "/" + docId : "") +
(tabId ? "/" + tabId : "") +
(subentity ? "/" + subentity : "") +
(subentityId ? "/" + subentityId : "") +
(ids ? "?ids=" + ids : "")
(docType ? '/' + docType : '') +
(docId ? '/' + docId : '') +
(tabId ? '/' + tabId : '') +
(subentity ? '/' + subentity : '') +
(subentityId ? '/' + subentityId : '') +
(ids ? '?ids=' + ids : '')
);
}

export function actionsRequest(entity, type, id, selected){
let query = "";
let query = '';
for (let item of selected) {
query+=","+item;
query+=','+item;
}
query = query.substring(1);

Expand All @@ -166,7 +166,7 @@ export function actionsRequest(entity, type, id, selected){
type + '/' +
id +
'/actions'+
(selected.length > 0 && entity=="documentView" ? "?selectedIds="+ query :"")
(selected.length > 0 && entity=='documentView' ? '?selectedIds='+ query :'')
);
}

Expand Down Expand Up @@ -200,6 +200,6 @@ export function openFile(entity, docType, docId, fileType, fileId) {
fileType + '/' +
fileId;

window.open(url, "_blank");
window.open(url, '_blank');
}
}
4 changes: 2 additions & 2 deletions src/actions/ListActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export function quickActionsRequest(windowId, viewId, selectedIds) {
config.API_URL + '/documentView/' +
windowId + '/' + viewId +
'/quickActions' +
(selectedIds && selectedIds.length ? "?selectedIds=" + selectedIds : "")
(selectedIds && selectedIds.length ? '?selectedIds=' + selectedIds : '')
);
}

Expand All @@ -53,6 +53,6 @@ export function selectionAttributes(windowId, viewId, selectedIds) {
config.API_URL + '/documentView/' +
windowId + '/' + viewId +
'/quickActions' +
(selectedIds && selectedIds.length ? "?selectedIds=" + selectedIds : "")
(selectedIds && selectedIds.length ? '?selectedIds=' + selectedIds : '')
);
}
14 changes: 7 additions & 7 deletions src/actions/MenuActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export function nodePathsRequest(nodeId, limit) {
config.API_URL +
'/menu/node?nodeId=' + nodeId +
'&depth=2' +
(limit ? '&childrenLimit=' + limit : "")
(limit ? '&childrenLimit=' + limit : '')
);
}

Expand All @@ -68,7 +68,7 @@ export function queryPathsRequest(query, limit, child) {
return () => axios.get(
config.API_URL +
'/menu/queryPaths?nameQuery=' + query +
(limit ? '&childrenLimit=' + limit : "") +
(limit ? '&childrenLimit=' + limit : '') +
(child ? '&childrenInclusive=true':'')
);
}
Expand All @@ -77,20 +77,20 @@ export function rootRequest(limit) {
return () => axios.get(
config.API_URL +
'/menu/root?depth=10' +
(limit ? '&childrenLimit=' + limit : ""));
(limit ? '&childrenLimit=' + limit : ''));
}

export function getRootBreadcrumb() {
return (dispatch) => {
dispatch(rootRequest(6)).then(root => {
dispatch(setHomeMenu({nodeId: "0", children: root.data}));
dispatch(setHomeMenu({nodeId: '0', children: root.data}));
});
}
}

export function getWindowBreadcrumb(id){
return dispatch => {
dispatch(elementPathRequest("window", id)).then(response => {
dispatch(elementPathRequest('window', id)).then(response => {
let req = 0;
let pathData = flattenOneLine(response.data);

Expand Down Expand Up @@ -124,14 +124,14 @@ export function getWindowBreadcrumb(id){

// UTILITIES

export function flattenLastElem(node, prop = "children") {
export function flattenLastElem(node, prop = 'children') {
let result = [];

if(!!node[prop]){
node[prop].map(child => {
const flat = flattenLastElem(child);

if(typeof flat === "object"){
if(typeof flat === 'object'){
result = result.concat(flat);
}else{
result.push(flattenLastElem(child));
Expand Down
Loading

0 comments on commit fc4f8d4

Please sign in to comment.