forked from Kitware/visualizer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(Redux): Allow Visualizer to be embedded inside another redux app
- Loading branch information
Showing
4 changed files
with
82 additions
and
71 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { getActiveStore, dispatch, actions } from './redux'; | ||
import behaviorOnChange from './behavior'; | ||
|
||
export default function setup(session) { | ||
// Keep track of any server notification | ||
session.subscribe('pv.time.change', (args) => { | ||
const index = args[0].timeStep; | ||
setImmediate(() => { | ||
dispatch(actions.time.storeTime(index)); | ||
const state = getActiveStore().getState(); | ||
if (state.active.source && state.active.source !== '0') { | ||
// Update proxy data for info tab... | ||
// FIXME implement a lighter implementation on the server side... | ||
dispatch(actions.proxies.fetchProxy(state.active.source)); | ||
} | ||
}); | ||
}); | ||
|
||
// Fetch data | ||
dispatch(actions.proxies.fetchPipeline()); | ||
dispatch(actions.proxies.fetchAvailableProxies()); | ||
dispatch(actions.proxies.fetchSettingProxy()); | ||
dispatch(actions.time.fetchTime()); | ||
dispatch(actions.files.fetchServerDirectory('.')); | ||
|
||
// Fetch heavy data after full initialization | ||
setTimeout(() => { | ||
dispatch(actions.colors.fetchColorMapImages()); | ||
}, 2000); | ||
|
||
|
||
// Attach default behavior | ||
getActiveStore().subscribe(() => { | ||
const state = getActiveStore().getState(); | ||
behaviorOnChange(state, dispatch); | ||
}); | ||
} |