diff options
author | Koren Lev <korenlev@gmail.com> | 2017-07-27 16:42:15 +0300 |
---|---|---|
committer | Koren Lev <korenlev@gmail.com> | 2017-07-27 16:42:15 +0300 |
commit | b88c78e3cf2bef22aa2f1c4d0bf305e303bc15f0 (patch) | |
tree | ffa30a6e1511d72562d8772b8700cda52b2752a1 /ui/imports/ui/actions | |
parent | b70483739d1f6f4f0d31987ed2e4d1e30d71d579 (diff) |
adding calipso ui
Change-Id: Ifa6f63daebb07f45580f747341960e898fdb00c4
Signed-off-by: Koren Lev <korenlev@gmail.com>
Diffstat (limited to 'ui/imports/ui/actions')
-rw-r--r-- | ui/imports/ui/actions/environment-panel.actions.js | 225 | ||||
-rw-r--r-- | ui/imports/ui/actions/graph-tooltip-window.actions.js | 30 | ||||
-rw-r--r-- | ui/imports/ui/actions/main-app.actions.js | 21 | ||||
-rw-r--r-- | ui/imports/ui/actions/navigation.js | 84 | ||||
-rw-r--r-- | ui/imports/ui/actions/search-interested-parties.js | 93 | ||||
-rw-r--r-- | ui/imports/ui/actions/tree-node.actions.js | 144 | ||||
-rw-r--r-- | ui/imports/ui/actions/vedge-info-window.actions.js | 41 |
7 files changed, 638 insertions, 0 deletions
diff --git a/ui/imports/ui/actions/environment-panel.actions.js b/ui/imports/ui/actions/environment-panel.actions.js new file mode 100644 index 0000000..fb7350c --- /dev/null +++ b/ui/imports/ui/actions/environment-panel.actions.js @@ -0,0 +1,225 @@ +///////////////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2017 Koren Lev (Cisco Systems), Yaron Yogev (Cisco Systems) and others / +// / +// All rights reserved. This program and the accompanying materials / +// are made available under the terms of the Apache License, Version 2.0 / +// which accompanies this distribution, and is available at / +// http://www.apache.org/licenses/LICENSE-2.0 / +///////////////////////////////////////////////////////////////////////////////////////// +//import * as R from 'ramda'; + +export const SET_ENV_NAME = 'SET_ENV_NAME'; +export const UPDATE_ENV_TREE_NODE = 'UPDATE_ENV_TREE_NODE'; +export const ADD_UPDATE_CHILDREN_ENV_TREE_NODE = 'ADD_UPDATE_CHILDREN_ENV_TREE_NODE'; +export const RESET_ENV_TREE_NODE_CHILDREN = 'RESET_ENV_TREE_NODE_CHILDREN'; +export const START_OPEN_ENV_TREE_NODE = 'START_OPEN_ENV_TREE_NODE'; +export const END_OPEN_ENV_TREE_NODE = 'END_OPEN_ENV_TREE_NODE'; +export const START_CLOSE_ENV_TREE_NODE = 'START_CLOSE_ENV_TREE_NODE'; +export const END_CLOSE_ENV_TREE_NODE = 'END_CLOSE_ENV_TREE_NODE'; +export const SET_ENV_CHILD_DETECTED_TREE_NODE = 'SET_ENV_CHILD_DETECTED_TREE_NODE'; +export const SET_ENV_SELECTED_NODE = 'SET_ENV_SELECTED_NODE'; +export const SET_ENV_ENV_ID = 'SET_ENV_ENV_ID'; +export const SET_ENV_SELECTED_NODE_INFO = 'SET_ENV_SELECTED_NODE_INFO'; +export const SET_ENV_AS_LOADED = 'SET_ENV_AS_LOADED'; +export const SET_ENV_AS_NOT_LOADED = 'SET_ENV_AS_NOT_LOADED'; +export const SET_ENV_SELECTED_NODE_AS_ENV = 'SET_ENV_SELECTED_NODE_AS_ENV'; +export const SET_SHOW_DASHBOARD = 'SET_SHOW_DASHBOARD'; +export const SET_SHOW_GRAPH = 'SET_SHOW_GRAPH'; +export const TOGGLE_ENV_SHOW = 'TOGGLE_ENV_SHOW'; +export const SET_ENV_POSITION_REPORT_IS_NEEDED_AS_ON = 'SET_ENV_POSITION_REPORT_IS_NEEDED_AS_ON'; +export const REPORT_ENV_NODE_POSITION_RETRIEVED = 'REPORT_ENV_NODE_POSITION_RETRIEVED'; +export const SET_ENV_SCROLL_TO_NODE_IS_NEEDED_AS_ON = 'SET_ENV_SCROLL_TO_NODE_IS_NEEDED_AS_ON'; +export const REPORT_ENV_SCROLL_TO_NODE_PERFORMED = 'REPORT_ENV_SCROLL_TO_NODE_PERFORMED'; +export const RESET_ENV_NEED_CHILD_DETECTION = 'RESET_ENV_NEED_CHILD_DETECTION'; + +export function setEnvName(envName) { + return { + type: SET_ENV_NAME, + payload: { + envName: envName + } + }; +} + +export function updateEnvTreeNode(nodeInfo) { + return { + type: UPDATE_ENV_TREE_NODE, + payload: { + nodeInfo: nodeInfo + } + }; +} + +export function addUpdateChildrenEnvTreeNode(nodePath, childrenInfo) { + return { + type: ADD_UPDATE_CHILDREN_ENV_TREE_NODE, + payload: { + nodePath: nodePath, + childrenInfo: childrenInfo + }, + }; +} + +export function resetEnvTreeNodeChildren(nodePath) { + return { + type: RESET_ENV_TREE_NODE_CHILDREN, + payload: { + nodePath: nodePath, + } + }; +} + +export function startOpenEnvTreeNode(nodePath) { + return { + type: START_OPEN_ENV_TREE_NODE, + payload: { + nodePath: nodePath, + } + }; +} + +export function endOpenEnvTreeNode(nodePath) { + return { + type: END_OPEN_ENV_TREE_NODE, + payload: { + nodePath: nodePath, + } + }; +} + +export function startCloseEnvTreeNode(nodePath) { + return { + type: START_CLOSE_ENV_TREE_NODE, + payload: { + nodePath: nodePath, + } + }; +} + +export function endCloseEnvTreeNode(nodePath) { + return { + type: END_CLOSE_ENV_TREE_NODE, + payload: { + nodePath: nodePath, + } + }; +} + +export function setEnvChildDetectedTreeNode(nodePath) { + return { + type: SET_ENV_CHILD_DETECTED_TREE_NODE, + payload: { + nodePath: nodePath + } + }; +} + +export function setEnvSelectedNode(nodeId, nodeType) { + return { + type: SET_ENV_SELECTED_NODE, + payload: { + nodeId: nodeId, + nodeType: nodeType + } + }; +} + +export function setEnvSelectedNodeAsEnv() { + return { + type: SET_ENV_SELECTED_NODE_AS_ENV, + }; +} + +export function setEnvEnvId(_id) { + return { + type: SET_ENV_ENV_ID, + payload: { + _id: _id + } + }; +} + +export function setEnvSelectedNodeInfo(nodeInfo) { + return { + type: SET_ENV_SELECTED_NODE_INFO, + payload: { + nodeInfo: nodeInfo + } + }; +} + +export function setEnvAsLoaded() { + return { + type: SET_ENV_AS_LOADED, + }; +} + +export function setEnvAsNotLoaded() { + return { + type: SET_ENV_AS_NOT_LOADED + }; +} + +export function setShowDashboard() { + return { + type: SET_SHOW_DASHBOARD + }; +} + +export function setShowGraph() { + return { + type: SET_SHOW_GRAPH + }; +} + +export function toggleEnvShow() { + return { + type: TOGGLE_ENV_SHOW + }; +} + +export function setEnvPositionReportIsNeededAsOn(nodePath) { + return { + type: SET_ENV_POSITION_REPORT_IS_NEEDED_AS_ON, + payload: { + nodePath: nodePath + } + }; +} + +export function reportEnvNodePositionRetrieved(nodePath, rect) { + return { + type: REPORT_ENV_NODE_POSITION_RETRIEVED, + payload: { + nodePath: nodePath, + rect: rect + } + }; +} + +export function setEnvScrollToNodeIsNeededAsOn(nodePath) { + return { + type: SET_ENV_SCROLL_TO_NODE_IS_NEEDED_AS_ON, + payload: { + nodePath: nodePath + } + }; +} + +export function reportEnvScrollToNodePerformed(nodePath) { + return { + type: REPORT_ENV_SCROLL_TO_NODE_PERFORMED, + payload: { + nodePath: nodePath + } + }; +} + +export function resetEnvNeedChildDetection(nodePath) { + return { + type: RESET_ENV_NEED_CHILD_DETECTION, + payload: { + nodePath: nodePath + } + }; +} diff --git a/ui/imports/ui/actions/graph-tooltip-window.actions.js b/ui/imports/ui/actions/graph-tooltip-window.actions.js new file mode 100644 index 0000000..08c48b6 --- /dev/null +++ b/ui/imports/ui/actions/graph-tooltip-window.actions.js @@ -0,0 +1,30 @@ +///////////////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2017 Koren Lev (Cisco Systems), Yaron Yogev (Cisco Systems) and others / +// / +// All rights reserved. This program and the accompanying materials / +// are made available under the terms of the Apache License, Version 2.0 / +// which accompanies this distribution, and is available at / +// http://www.apache.org/licenses/LICENSE-2.0 / +///////////////////////////////////////////////////////////////////////////////////////// +//import * as R from 'ramda'; + +export const ACTIVATE_GRAPH_TOOLTIP_WINDOW = 'ACTIVATE_GRAPH_TOOLTIP_WINDOW'; +export const CLOSE_GRAPH_TOOLTIP_WINDOW = 'CLOSE_GRAPH_TOOLTIP_WINDOW'; + +export function activateGraphTooltipWindow(label, attributes, left, top) { + return { + type: ACTIVATE_GRAPH_TOOLTIP_WINDOW, + payload: { + label: label, + attributes: attributes, + left: left, + top: top + } + }; +} + +export function closeGraphTooltipWindow() { + return { + type: CLOSE_GRAPH_TOOLTIP_WINDOW + }; +} diff --git a/ui/imports/ui/actions/main-app.actions.js b/ui/imports/ui/actions/main-app.actions.js new file mode 100644 index 0000000..1daafa1 --- /dev/null +++ b/ui/imports/ui/actions/main-app.actions.js @@ -0,0 +1,21 @@ +///////////////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2017 Koren Lev (Cisco Systems), Yaron Yogev (Cisco Systems) and others / +// / +// All rights reserved. This program and the accompanying materials / +// are made available under the terms of the Apache License, Version 2.0 / +// which accompanies this distribution, and is available at / +// http://www.apache.org/licenses/LICENSE-2.0 / +///////////////////////////////////////////////////////////////////////////////////////// +//import * as R from 'ramda'; + +export const SET_MAIN_APP_SELECTED_ENVIRONMENT = 'SET_MAIN_APP_SELECTED_ENVIRONMENT'; + +export function setMainAppSelectedEnvironment(_id, name) { + return { + type: SET_MAIN_APP_SELECTED_ENVIRONMENT, + payload: { + _id: _id, + name: name + } + }; +} diff --git a/ui/imports/ui/actions/navigation.js b/ui/imports/ui/actions/navigation.js new file mode 100644 index 0000000..06b1501 --- /dev/null +++ b/ui/imports/ui/actions/navigation.js @@ -0,0 +1,84 @@ +///////////////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2017 Koren Lev (Cisco Systems), Yaron Yogev (Cisco Systems) and others / +// / +// All rights reserved. This program and the accompanying materials / +// are made available under the terms of the Apache License, Version 2.0 / +// which accompanies this distribution, and is available at / +// http://www.apache.org/licenses/LICENSE-2.0 / +///////////////////////////////////////////////////////////////////////////////////////// +import * as R from 'ramda'; + +const SET_CURRENT_NODE = 'SET_CURRENT_NODE'; +const SET_CURRENT_NODE_FROM_TREE_CONTROL = 'SET_CURRENT_NODE_FROM_TREE_CONTROL'; + +function setCurrentNode(item) { + let nodeChain = convertToNodeChain(item.id_path, item.name_path); + R.last(nodeChain).item = item; + + return { + type: SET_CURRENT_NODE, + payload: { + nodeChain: nodeChain + } + }; +} + +function setCurrentNodeFromTreeControl (item) { + let nodeChain = convertToNodeChain(item.id_path, item.name_path); + R.last(nodeChain).item = item; + + return { + type: SET_CURRENT_NODE_FROM_TREE_CONTROL, + payload: { + nodeChain: nodeChain + } + }; +} + +function convertToNodeChain(idPath, namePath) { + let convert = R.pipe(R.split(), R.slice(1, Infinity)); + let paths = convert('/', idPath); + let names = convert('/', namePath); + let nodesData = R.zip(paths, names); + let nodeChain = R.map((nodeData) => { + return { + id: nodeData[0], + name: nodeData[1] + }; + }, nodesData); + + let parent = null; + + for (let i = 0; i < nodeChain.length; i++) { + let node = nodeChain[i]; + node.parent = parent; + node.fullIdPath = calcFullIdPath(node); + node.fullNamePath = calcFullNamePath(node); + parent = node; + } + + return nodeChain; +} + +function calcFullIdPath (node) { + if (R.isNil(node)) { return null; } + if (R.isNil(node.parent)) { return '/' + node.id; } + + let parentFullPath = calcFullIdPath(node.parent); + return parentFullPath + '/' + node.id; +} + +function calcFullNamePath (node) { + if (R.isNil(node)) { return null; } + if (R.isNil(node.parent)) { return '/' + node.name; } + + let parentFullPath = calcFullNamePath(node.parent); + return parentFullPath + '/' + node.name; +} + +export { + SET_CURRENT_NODE, + SET_CURRENT_NODE_FROM_TREE_CONTROL, + setCurrentNode, + setCurrentNodeFromTreeControl +}; diff --git a/ui/imports/ui/actions/search-interested-parties.js b/ui/imports/ui/actions/search-interested-parties.js new file mode 100644 index 0000000..1eb9b78 --- /dev/null +++ b/ui/imports/ui/actions/search-interested-parties.js @@ -0,0 +1,93 @@ +///////////////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2017 Koren Lev (Cisco Systems), Yaron Yogev (Cisco Systems) and others / +// / +// All rights reserved. This program and the accompanying materials / +// are made available under the terms of the Apache License, Version 2.0 / +// which accompanies this distribution, and is available at / +// http://www.apache.org/licenses/LICENSE-2.0 / +///////////////////////////////////////////////////////////////////////////////////////// +//import * as R from 'ramda'; + +const ADD_SEARCH_INTERESTED_PARTY = 'ADD_SEARCH_INTERESTED_PARTY'; +const REMOVE_SEARCH_INTERESTED_PARTY = 'REMOVE_SEARCH_INTERESTED_PARTY'; +const SET_SEARCH_TERM = 'SET_SEARCH_TERM'; +const SET_SEARCH_AUTO_COMPLETE_TERM = 'SET_SEARCH_AUTO_COMPLETE_TERM'; +const RESET_SEARCH_AUTO_COMPLETE_FUTURE = 'RESET_SEARCH_AUTO_COMPLETE_FUTURE'; +const SET_SEARCH_AUTO_COMPLETE_FUTURE = 'SET_SEARCH_AUTO_COMPLETE_FUTURE'; + +const AUTO_COMPLETE_DELAY = 300; // miliseconds. + +function addSearchInterestedParty(listener) { + return { + type: ADD_SEARCH_INTERESTED_PARTY, + payload: { + listener: listener + } + }; +} + +function removeSearchInterestedParty(listener) { + return { + type: REMOVE_SEARCH_INTERESTED_PARTY, + payload: { + listener: listener + } + }; +} + +function setSearchTerm(searchTerm) { + return { + type: SET_SEARCH_TERM, + payload: { + searchTerm: searchTerm + } + }; +} + +function setSearchAutoCompleteTerm(searchTerm) { + return { + type: SET_SEARCH_AUTO_COMPLETE_TERM, + payload: { + searchTerm: searchTerm + } + }; +} + +function resetSearchAutoCompleteFuture() { + return { + type: RESET_SEARCH_AUTO_COMPLETE_FUTURE, + }; +} + +function setSearchAutoCompleteFuture(futureId) { + return { + type: SET_SEARCH_AUTO_COMPLETE_FUTURE, + payload: { + futureId: futureId + } + }; +} + +function notifySearchAutoCompleteTermChanged(searchTerm) { + return (dispatch) => { + let autoCompleteFutureId = setTimeout(() => { + dispatch(resetSearchAutoCompleteFuture()); + dispatch(setSearchAutoCompleteTerm(searchTerm)); + }, AUTO_COMPLETE_DELAY); + dispatch(setSearchAutoCompleteFuture(autoCompleteFutureId)); + }; +} + +export { + ADD_SEARCH_INTERESTED_PARTY, + REMOVE_SEARCH_INTERESTED_PARTY, + SET_SEARCH_TERM, + SET_SEARCH_AUTO_COMPLETE_TERM, + RESET_SEARCH_AUTO_COMPLETE_FUTURE, + SET_SEARCH_AUTO_COMPLETE_FUTURE, + addSearchInterestedParty, + removeSearchInterestedParty, + setSearchTerm, + setSearchAutoCompleteTerm, + notifySearchAutoCompleteTermChanged +}; diff --git a/ui/imports/ui/actions/tree-node.actions.js b/ui/imports/ui/actions/tree-node.actions.js new file mode 100644 index 0000000..0fad8c9 --- /dev/null +++ b/ui/imports/ui/actions/tree-node.actions.js @@ -0,0 +1,144 @@ +///////////////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2017 Koren Lev (Cisco Systems), Yaron Yogev (Cisco Systems) and others / +// / +// All rights reserved. This program and the accompanying materials / +// are made available under the terms of the Apache License, Version 2.0 / +// which accompanies this distribution, and is available at / +// http://www.apache.org/licenses/LICENSE-2.0 / +///////////////////////////////////////////////////////////////////////////////////////// +//import * as R from 'ramda'; + +export const UPDATE_TREE_NODE_INFO = 'UPDATE_TREE_NODE_INFO'; +export const ADD_UPDATE_CHILDREN_TREE_NODE = 'ADD_UPDATE_CHILDREN_TREE_NODE'; +export const RESET_TREE_NODE_CHILDREN = 'RESET_TREE_NODE_CHILDREN'; +export const START_OPEN_TREE_NODE = 'START_OPEN_TREE_NODE'; +export const END_OPEN_TREE_NODE = 'END_OPEN_TREE_NODE'; +export const START_CLOSE_TREE_NODE = 'START_CLOSE_TREE_NODE'; +export const END_CLOSE_TREE_NODE = 'END_CLOSE_TREE_NODE'; +export const SET_CHILD_DETECTED_TREE_NODE = 'SET_CHILD_DETECTED_TREE_NODE'; +export const SET_POSITION_REPORT_IS_NEEDED_AS_ON = 'SET_POSITION_REPORT_IS_NEEDED_AS_ON'; +export const REPORT_NODE_POSITION_RETRIEVED = 'REPORT_NODE_POSITION_RETRIEVED'; +export const SET_SCROLL_TO_NODE_IS_NEEDED_AS_ON = 'SET_SCROLL_TO_NODE_IS_NEEDED_AS_ON'; +export const REPORT_SCROLL_TO_NODE_PERFORMED = 'REPORT_SCROLL_TO_NODE_PERFORMED'; +export const RESET_NEED_CHILD_DETECTION = 'RESET_NEED_CHILD_DETECTION'; + +export function updateTreeNodeInfo(nodeInfo, level) { + return { + type: UPDATE_TREE_NODE_INFO, + payload: { + nodeInfo: nodeInfo, + level: level + } + }; +} + +export function addUpdateChildrenTreeNode(nodePath, childrenInfo, level) { + return { + type: ADD_UPDATE_CHILDREN_TREE_NODE, + payload: { + nodePath: nodePath, + childrenInfo: childrenInfo, + level: level + }, + }; +} + +export function resetTreeNodeChildren(nodePath) { + return { + type: RESET_TREE_NODE_CHILDREN, + payload: { + nodePath: nodePath, + } + }; +} + +export function startOpenTreeNode(nodePath) { + return { + type: START_OPEN_TREE_NODE, + payload: { + nodePath: nodePath, + } + }; +} + +export function endOpenTreeNode(nodePath) { + return { + type: END_OPEN_TREE_NODE, + payload: { + nodePath: nodePath, + } + }; +} + +export function startCloseTreeNode(nodePath) { + return { + type: START_CLOSE_TREE_NODE, + payload: { + nodePath: nodePath, + } + }; +} + +export function endCloseTreeNode(nodePath) { + return { + type: END_CLOSE_TREE_NODE, + payload: { + nodePath: nodePath, + } + }; +} + +export function setChildDetectedTreeNode(nodePath) { + return { + type: SET_CHILD_DETECTED_TREE_NODE, + payload: { + nodePath: nodePath + } + }; +} + +export function setPositionReportIsNeededAsOn(nodePath) { + return { + type: SET_POSITION_REPORT_IS_NEEDED_AS_ON, + payload: { + nodePath: nodePath + } + }; +} + +export function reportNodePositionRetrieved(nodePath, rect) { + return { + type: REPORT_NODE_POSITION_RETRIEVED, + payload: { + nodePath: nodePath, + rect: rect + } + }; +} + +export function setScrollToNodeIsNeededAsOn(nodePath) { + return { + type: SET_SCROLL_TO_NODE_IS_NEEDED_AS_ON, + payload: { + nodePath: nodePath + } + }; +} + +export function reportScrollToNodePerformed(nodePath) { + return { + type: REPORT_SCROLL_TO_NODE_PERFORMED, + payload: { + nodePath: nodePath + } + }; +} + +export function resetNeedChildDetection(nodePath) { + return { + type: RESET_NEED_CHILD_DETECTION, + payload: { + nodePath: nodePath + } + }; +} diff --git a/ui/imports/ui/actions/vedge-info-window.actions.js b/ui/imports/ui/actions/vedge-info-window.actions.js new file mode 100644 index 0000000..0431648 --- /dev/null +++ b/ui/imports/ui/actions/vedge-info-window.actions.js @@ -0,0 +1,41 @@ +///////////////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2017 Koren Lev (Cisco Systems), Yaron Yogev (Cisco Systems) and others / +// / +// All rights reserved. This program and the accompanying materials / +// are made available under the terms of the Apache License, Version 2.0 / +// which accompanies this distribution, and is available at / +// http://www.apache.org/licenses/LICENSE-2.0 / +///////////////////////////////////////////////////////////////////////////////////////// +//import * as R from 'ramda'; + +export const ACTIVATE_VEDGE_INFO_WINDOW = 'ACTIVATE_VEDGE_INFO_WINDOW'; +export const CLOSE_VEDGE_INFO_WINDOW = 'CLOSE_VEDGE_INFO_WINDOW'; + +export function activateVedgeInfoWindow(node, left, top) { + // todo: remove. this is for debug + /* + node = { + _id: '0', + id: 'devstack-vpp1-VPP', + id_path: '', + name: 'devstack-vpp1-VPP', + name_path: '', + environment: 'Devstack-VPP' + }; + */ + + return { + type: ACTIVATE_VEDGE_INFO_WINDOW, + payload: { + node: node, + left: left, + top: top + } + }; +} + +export function closeVedgeInfoWindow() { + return { + type: CLOSE_VEDGE_INFO_WINDOW + }; +} |