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

Commit

Permalink
Import types explicitly to guard against typos at bundling time
Browse files Browse the repository at this point in the history
Issue #1361
  • Loading branch information
pablosichert committed Jan 13, 2018
1 parent 981d230 commit dbb5057
Show file tree
Hide file tree
Showing 2 changed files with 121 additions and 60 deletions.
91 changes: 61 additions & 30 deletions src/actions/WindowActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,38 @@ import SockJs from "sockjs-client";

import Stomp from "stompjs/lib/stomp.min.js";

import * as types from "../constants/ActionTypes";
import {
ACTIVATE_TAB,
ADD_NEW_ROW,
ADD_ROW_DATA,
ALLOW_SHORTCUT,
CHANGE_INDICATOR_STATE,
CLEAR_MASTER_DATA,
CLOSE_MODAL,
CLOSE_PROCESS_MODAL,
CLOSE_RAW_MODAL,
DELETE_ROW,
DISABLE_SHORTCUT,
INIT_DATA_SUCCESS,
INIT_LAYOUT_SUCCESS,
NO_CONNECTION,
OPEN_MODAL,
OPEN_RAW_MODAL,
SELECT_TABLE_ITEMS,
SET_LATEST_NEW_DOCUMENT,
SORT_TAB,
UNSELECT_TAB,
UPDATE_DATA_FIELD_PROPERTY,
UPDATE_DATA_INCLUDED_TABS_INFO,
UPDATE_DATA_PROPERTY,
UPDATE_DATA_SAVE_STATUS,
UPDATE_DATA_VALID_STATUS,
UPDATE_MODAL,
UPDATE_ROW_FIELD_PROPERTY,
UPDATE_ROW_PROPERTY,
UPDATE_ROW_STATUS
} from "../constants/ActionTypes";

import {
addNotification,
setNotificationProgress,
Expand All @@ -18,7 +49,7 @@ import { getWindowBreadcrumb } from "./MenuActions";

export function setLatestNewDocument(id) {
return {
type: types.SET_LATEST_NEW_DOCUMENT,
type: SET_LATEST_NEW_DOCUMENT,
id: id
};
}
Expand All @@ -36,48 +67,48 @@ export function discardNewDocument({ windowType, documentId } = {}) {

export function openRawModal(windowType, viewId) {
return {
type: types.OPEN_RAW_MODAL,
type: OPEN_RAW_MODAL,
windowType: windowType,
viewId: viewId
};
}

export function closeRawModal() {
return {
type: types.CLOSE_RAW_MODAL
type: CLOSE_RAW_MODAL
};
}

export function allowShortcut() {
return {
type: types.ALLOW_SHORTCUT
type: ALLOW_SHORTCUT
};
}

export function disableShortcut() {
return {
type: types.DISABLE_SHORTCUT
type: DISABLE_SHORTCUT
};
}

export function activateTab(scope, tabId) {
return {
type: types.ACTIVATE_TAB,
type: ACTIVATE_TAB,
scope,
tabId
};
}

export function unselectTab(scope) {
return {
type: types.UNSELECT_TAB,
type: UNSELECT_TAB,
scope
};
}

export function initLayoutSuccess(layout, scope) {
return {
type: types.INIT_LAYOUT_SUCCESS,
type: INIT_LAYOUT_SUCCESS,
layout: layout,
scope: scope
};
Expand All @@ -100,29 +131,29 @@ export function initDataSuccess({
saveStatus,
scope,
standardActions,
type: types.INIT_DATA_SUCCESS,
type: INIT_DATA_SUCCESS,
validStatus,
websocket
};
}

export function clearMasterData() {
return {
type: types.CLEAR_MASTER_DATA
type: CLEAR_MASTER_DATA
};
}

export function addRowData(data, scope) {
return {
type: types.ADD_ROW_DATA,
type: ADD_ROW_DATA,
data,
scope
};
}

export function sortTab(scope, tabId, field, asc) {
return {
type: types.SORT_TAB,
type: SORT_TAB,
scope,
tabId,
field,
Expand All @@ -132,7 +163,7 @@ export function sortTab(scope, tabId, field, asc) {

export function updateRowStatus(scope, tabid, rowid, saveStatus) {
return {
type: types.UPDATE_ROW_STATUS,
type: UPDATE_ROW_STATUS,
scope,
tabid,
rowid,
Expand All @@ -142,7 +173,7 @@ export function updateRowStatus(scope, tabid, rowid, saveStatus) {

export function updateDataProperty(property, value, scope) {
return {
type: types.UPDATE_DATA_PROPERTY,
type: UPDATE_DATA_PROPERTY,
property,
value,
scope
Expand All @@ -151,23 +182,23 @@ export function updateDataProperty(property, value, scope) {

export function updateDataSaveStatus(scope, saveStatus) {
return {
type: types.UPDATE_DATA_SAVE_STATUS,
type: UPDATE_DATA_SAVE_STATUS,
scope,
saveStatus
};
}

export function updateDataValidStatus(scope, validStatus) {
return {
type: types.UPDATE_DATA_VALID_STATUS,
type: UPDATE_DATA_VALID_STATUS,
scope,
validStatus
};
}

export function updateRowProperty(property, item, tabid, rowid, scope) {
return {
type: types.UPDATE_ROW_PROPERTY,
type: UPDATE_ROW_PROPERTY,
property,
item,
tabid,
Expand All @@ -178,15 +209,15 @@ export function updateRowProperty(property, item, tabid, rowid, scope) {

export function updateDataIncludedTabsInfo(scope, includedTabsInfo) {
return {
type: types.UPDATE_DATA_INCLUDED_TABS_INFO,
type: UPDATE_DATA_INCLUDED_TABS_INFO,
scope,
includedTabsInfo
};
}

export function addNewRow(item, tabid, rowid, scope) {
return {
type: types.ADD_NEW_ROW,
type: ADD_NEW_ROW,
item: item,
tabid: tabid,
rowid: rowid,
Expand All @@ -211,7 +242,7 @@ export function discardNewRow({ windowType, documentId, tabId, rowId } = {}) {

export function deleteRow(tabid, rowid, scope) {
return {
type: types.DELETE_ROW,
type: DELETE_ROW,
tabid: tabid,
rowid: rowid,
scope: scope
Expand All @@ -220,7 +251,7 @@ export function deleteRow(tabid, rowid, scope) {

export function updateDataFieldProperty(property, item, scope) {
return {
type: types.UPDATE_DATA_FIELD_PROPERTY,
type: UPDATE_DATA_FIELD_PROPERTY,
property: property,
item: item,
scope: scope
Expand All @@ -229,7 +260,7 @@ export function updateDataFieldProperty(property, item, scope) {

export function updateRowFieldProperty(property, item, tabid, rowid, scope) {
return {
type: types.UPDATE_ROW_FIELD_PROPERTY,
type: UPDATE_ROW_FIELD_PROPERTY,
property: property,
item: item,
tabid: tabid,
Expand All @@ -240,7 +271,7 @@ export function updateRowFieldProperty(property, item, tabid, rowid, scope) {

export function noConnection(status) {
return {
type: types.NO_CONNECTION,
type: NO_CONNECTION,
status: status
};
}
Expand All @@ -262,7 +293,7 @@ export function openModal(
childViewSelectedIds
) {
return {
type: types.OPEN_MODAL,
type: OPEN_MODAL,
windowType: windowType,
modalType: type,
tabId: tabId,
Expand All @@ -282,19 +313,19 @@ export function openModal(

export function closeProcessModal() {
return {
type: types.CLOSE_PROCESS_MODAL
type: CLOSE_PROCESS_MODAL
};
}

export function closeModal() {
return {
type: types.CLOSE_MODAL
type: CLOSE_MODAL
};
}

export function updateModal(rowId, dataId) {
return {
type: types.UPDATE_MODAL,
type: UPDATE_MODAL,
rowId,
dataId
};
Expand All @@ -304,7 +335,7 @@ export function updateModal(rowId, dataId) {

export function indicatorState(state) {
return {
type: types.CHANGE_INDICATOR_STATE,
type: CHANGE_INDICATOR_STATE,
state: state
};
}
Expand All @@ -313,7 +344,7 @@ export function indicatorState(state) {

export function selectTableItems({ ids, windowType, viewId }) {
return {
type: types.SELECT_TABLE_ITEMS,
type: SELECT_TABLE_ITEMS,
payload: { ids, windowType, viewId }
};
}
Expand Down
Loading

0 comments on commit dbb5057

Please sign in to comment.