From f84098554a3d50ec02255603bb0a145b3aa0c6b2 Mon Sep 17 00:00:00 2001 From: Clemens Date: Wed, 13 Jul 2016 18:16:31 +0200 Subject: added code editor and file upload --- web/src/js/ducks/flows.js | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'web/src/js/ducks') diff --git a/web/src/js/ducks/flows.js b/web/src/js/ducks/flows.js index f0b09530..36274f39 100644 --- a/web/src/js/ducks/flows.js +++ b/web/src/js/ducks/flows.js @@ -117,6 +117,14 @@ export function update(flow, data) { return { type: REQUEST_ACTION } } +export function update_content(flow, file) { + const body = new FormData() + body.append('file', file) + fetchApi(`/flows/${flow.id}/response/content`, {method: 'post', body} ) + return { type: REQUEST_ACTION } +} + + /** * @public */ -- cgit v1.2.3 From 121079934e705ae91a983c0ea5858b5483941d7f Mon Sep 17 00:00:00 2001 From: Clemens Date: Wed, 13 Jul 2016 20:18:04 +0200 Subject: make file out ouf string to combine flow content updates via editor and fileupload --- web/src/js/ducks/flows.js | 2 ++ 1 file changed, 2 insertions(+) (limited to 'web/src/js/ducks') diff --git a/web/src/js/ducks/flows.js b/web/src/js/ducks/flows.js index 36274f39..8815db25 100644 --- a/web/src/js/ducks/flows.js +++ b/web/src/js/ducks/flows.js @@ -119,6 +119,8 @@ export function update(flow, data) { export function update_content(flow, file) { const body = new FormData() + if (typeof file !== File) + file = new Blob([file], {type: 'plain/text'}) body.append('file', file) fetchApi(`/flows/${flow.id}/response/content`, {method: 'post', body} ) return { type: REQUEST_ACTION } -- cgit v1.2.3 From baac6c4693d140bd42be22fea8b0c784cda61cdd Mon Sep 17 00:00:00 2001 From: Clemens Date: Wed, 13 Jul 2016 20:44:35 +0200 Subject: gzip issue --- web/src/js/ducks/flows.js | 1 + 1 file changed, 1 insertion(+) (limited to 'web/src/js/ducks') diff --git a/web/src/js/ducks/flows.js b/web/src/js/ducks/flows.js index 8815db25..1dc88c67 100644 --- a/web/src/js/ducks/flows.js +++ b/web/src/js/ducks/flows.js @@ -123,6 +123,7 @@ export function update_content(flow, file) { file = new Blob([file], {type: 'plain/text'}) body.append('file', file) fetchApi(`/flows/${flow.id}/response/content`, {method: 'post', body} ) + update(flow, {response: {headers: [['Content-Encoding', '']]} } ) return { type: REQUEST_ACTION } } -- cgit v1.2.3 From 5f3782dd5fb8be4c196f57cb07fd1cc2fd6b2f56 Mon Sep 17 00:00:00 2001 From: Clemens Date: Thu, 14 Jul 2016 23:01:34 +0200 Subject: change way to edit --- web/src/js/ducks/flows.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'web/src/js/ducks') diff --git a/web/src/js/ducks/flows.js b/web/src/js/ducks/flows.js index 1dc88c67..3dd21016 100644 --- a/web/src/js/ducks/flows.js +++ b/web/src/js/ducks/flows.js @@ -117,13 +117,12 @@ export function update(flow, data) { return { type: REQUEST_ACTION } } -export function update_content(flow, file) { +export function updateContent(flow, file, type) { const body = new FormData() if (typeof file !== File) file = new Blob([file], {type: 'plain/text'}) body.append('file', file) - fetchApi(`/flows/${flow.id}/response/content`, {method: 'post', body} ) - update(flow, {response: {headers: [['Content-Encoding', '']]} } ) + fetchApi(`/flows/${flow.id}/${type}/content`, {method: 'post', body} ) return { type: REQUEST_ACTION } } -- cgit v1.2.3 From 48728af43ad746d70ef3e251dc28b75028dea1e6 Mon Sep 17 00:00:00 2001 From: Clemens Date: Tue, 19 Jul 2016 12:23:20 +0200 Subject: moved flow editor state to redux --- web/src/js/ducks/flows.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'web/src/js/ducks') diff --git a/web/src/js/ducks/flows.js b/web/src/js/ducks/flows.js index 3dd21016..eea91924 100644 --- a/web/src/js/ducks/flows.js +++ b/web/src/js/ducks/flows.js @@ -14,10 +14,12 @@ export const RECEIVE = 'FLOWS_RECEIVE' export const REQUEST_ACTION = 'FLOWS_REQUEST_ACTION' export const UNKNOWN_CMD = 'FLOWS_UNKNOWN_CMD' export const FETCH_ERROR = 'FLOWS_FETCH_ERROR' +export const SET_MODIFIED_FLOW_CONTENT = "FLOWS_SET_MODIFIED_FLOW" const defaultState = { list: undefined, views: undefined, + modifiedFlow: {headers: "", content: ""} } export default function reduce(state = defaultState, action) { @@ -51,6 +53,12 @@ export default function reduce(state = defaultState, action) { list, views: reduceViews(state.views, viewsActions.receive(list)), } + case SET_MODIFIED_FLOW_CONTENT: + return{ + ...state, + modifiedFlow: {...state.modifiedFlow, content: action.content} + } + default: return { @@ -61,6 +69,17 @@ export default function reduce(state = defaultState, action) { } } +/** + * @public + */ +export function setModifiedFlowContent(content) { + return { + type: SET_MODIFIED_FLOW_CONTENT, + content + } +} + + /** * @public */ -- cgit v1.2.3 From 281f20ef1e9ac33a7e210ba562eb2914f6d187e6 Mon Sep 17 00:00:00 2001 From: Clemens Date: Tue, 19 Jul 2016 16:13:26 +0200 Subject: added flow_content update --- web/src/js/ducks/ui.js | 43 ++++++++++++++++++++++++++++++++++++++----- 1 file changed, 38 insertions(+), 5 deletions(-) (limited to 'web/src/js/ducks') diff --git a/web/src/js/ducks/ui.js b/web/src/js/ducks/ui.js index f745f0af..ccd17eb6 100644 --- a/web/src/js/ducks/ui.js +++ b/web/src/js/ducks/ui.js @@ -9,6 +9,9 @@ export const UPDATE_QUERY = 'UI_UPDATE_QUERY' export const SELECT_TAB = 'UI_SELECT_TAB' export const SET_PROMPT = 'UI_SET_PROMPT' export const SET_DISPLAY_LARGE = 'UI_SET_DISPLAY_LARGE' +export const OPEN_FLOW_EDITOR= 'UI_OPEN_FLOW_EDITOR' +export const CLOSE_FLOW_EDITOR = 'UI_CLOSE_FLOW_EDITOR' +export const SET_MODIFIED_FLOW_CONTENT = 'UI_SET_MODIFIED_FLOW' const defaultState = { activeMenu: 'Start', @@ -18,7 +21,9 @@ const defaultState = { promptOpen: false, contentView: 'ViewAuto', query: {}, - panel: 'request' + panel: 'request', + modifiedFlow: {headers: "", content: ""}, + isFlowEditorOpen: false } export default function reducer(state = defaultState, action) { @@ -31,9 +36,10 @@ export default function reducer(state = defaultState, action) { } case flowsActions.SELECT: + let s = {...state, isFlowEditorOpen: false} if (action.flowIds.length && !state.isFlowSelected) { return { - ...state, + ...s, displayLarge: false, activeMenu: 'Flow', isFlowSelected: true, @@ -46,14 +52,14 @@ export default function reducer(state = defaultState, action) { activeMenu = 'Start' } return { - ...state, + ...s, activeMenu, isFlowSelected: false, } } return { - ...state, + ...s, displayLarge: false, } @@ -78,6 +84,7 @@ export default function reducer(state = defaultState, action) { case SELECT_TAB: return { ...state, + isFlowEditorOpen: false, panel: action.panel } @@ -92,7 +99,21 @@ export default function reducer(state = defaultState, action) { ...state, displayLarge: action.displayLarge, } - + case OPEN_FLOW_EDITOR: + return { + ...state, + isFlowEditorOpen: true + } + case CLOSE_FLOW_EDITOR: + return { + ...state, + isFlowEditorOpen: false + } + case SET_MODIFIED_FLOW_CONTENT: + return{ + ...state, + modifiedFlow: {...state.modifiedFlow, content: action.content} + } default: return state } @@ -126,6 +147,18 @@ export function setDisplayLarge(displayLarge) { return { type: SET_DISPLAY_LARGE, displayLarge } } +export function openFlowEditor(){ + return { type: OPEN_FLOW_EDITOR } +} + +export function closeFlowEditor(){ + return { type: CLOSE_FLOW_EDITOR } +} + +export function setModifiedFlowContent(content) { + return { type: SET_MODIFIED_FLOW_CONTENT, content } +} + export function onKeyDown(e) { if (e.ctrlKey) { return () => { -- cgit v1.2.3