Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.then((proxy) => {
commit(Mutations.PROXY_DATA_SET, proxy);
commit(Mutations.PROXY_SELECTED_IDS_SET, [proxy.id]);
dispatch(Actions.PROXY_PIPELINE_FETCH);
dispatch(Actions.MODULES_ACTIVE_CLEAR);
// Make sure we pull the actual server values
dispatch(Actions.PROXY_DATA_FETCH, { proxyId: proxy.id });
})
.catch(console.error);
.then((proxy) => {
commit(Mutations.PROXY_DATA_SET, proxy);
commit(Mutations.PROXY_SELECTED_IDS_SET, [proxy.id]);
dispatch(Actions.PROXY_PIPELINE_FETCH);
dispatch(Actions.MODULES_ACTIVE_CLEAR);
// Make sure we pull the actual server values
dispatch(Actions.PROXY_DATA_FETCH, { proxyId: proxy.id });
})
.catch(console.error);
.then((proxy) => {
commit(Mutations.PROXY_DATA_SET, proxy);
commit(Mutations.PROXY_SELECTED_IDS_SET, [proxy.id]);
dispatch(Actions.PROXY_PIPELINE_FETCH);
dispatch(Actions.MODULES_ACTIVE_CLEAR);
// Make sure we pull the actual server values
dispatch(Actions.PROXY_DATA_FETCH, { proxyId: proxy.id });
})
.catch(console.error);
sources.forEach((proxy) => {
commit(Mutations.PROXY_SOURCE_TO_REPRESENTATION_SET, proxy);
// Fetch proxy data if not available
if (!state.proxyDataMap[proxy.id]) {
dispatch(Actions.PROXY_DATA_FETCH, { proxyId: proxy.id });
}
// Fetch proxy name if not available
if (!state.proxyNames[proxy.id]) {
dispatch(Actions.PROXY_NAME_FETCH, proxy.id);
}
// Fetch representation data if not available
if (!state.proxyDataMap[proxy.rep]) {
dispatch(Actions.PROXY_DATA_FETCH, { proxyId: proxy.rep });
}
// Fetch representation name if not available
if (!state.proxyNames[proxy.rep]) {
dispatch(Actions.PROXY_NAME_FETCH, proxy.rep);
}
});
function apply() {
if (this.create) {
return;
}
if (this.isNetworkBusy && !scheduledApply) {
scheduledApply = setTimeout(() => {
scheduledApply = null;
apply.apply(this);
}, 100);
}
if (this.isNetworkBusy < 3 && hasChange()) {
// console.log('apply', JSON.stringify(changeSet, null, 2));
store.dispatch(Actions.PROXY_UPDATE, changeSet);
store.dispatch(Actions.PROXY_DATA_FETCH, {
proxyId: this[`active${proxyType}Id`],
needUI: false,
});
}
}
export function createViewer(
container,
config = createConfigurationFromURLArgs()
) {
const store = createStore();
store.commit(Mutations.NETWORK_CONFIG_SET, config);
registerModules(store);
setInterval(() => store.dispatch(Actions.BUSY_UPDATE_PROGRESS, 1), 50);
// Fetch preset images
store.commit(Mutations.COLOR_PRESET_NAMES_SET, [
'Cool to Warm',
'Cool to Warm (Extended)',
'Rainbow Desaturated',
'Cold and Hot',
'erdc_rainbow_bright',
'2hot',
'erdc_iceFire_H',
'erdc_iceFire_L',
'Inferno (matplotlib)',
]);
/* eslint-disable no-new */
/**
* Sets the active proxy configuration to be used by createViewer.
*
* Once createViewer() is called, setActiveProxyConfiguration will do nothing.
* Proxy config precedence (decreasing order):
* createViewer param, active proxy config, Generic config
*/
function createConfigurationFromURLArgs(
addOn = { application: 'paraview-lite' }
) {
return Object.assign({}, vtkURLExtract.extractURLParameters(), addOn);
}
const store = createStore();
store.commit('PVL_NETWORK_CONFIG_SET', createConfigurationFromURLArgs());
registerModules(store);
setInterval(() => store.dispatch('PVL_BUSY_UPDATE_PROGRESS', 1), 50);
// Fetch preset images
store.commit('PVL_COLOR_PRESET_NAMES_SET', [
'Cool to Warm',
'Cool to Warm (Extended)',
'Rainbow Desaturated',
'Cold and Hot',
'erdc_rainbow_bright',
'2hot',
'erdc_iceFire_H',
'erdc_iceFire_L',
'Inferno (matplotlib)',
]);
new Vue({
name,
vectorComponent,
] = this.activeProxyData.colorBy.array;
const mode =
location && name.length && this.activeProxyData.colorBy.mode;
this.vectorComponent = vectorComponent;
// console.log(JSON.stringify(this.activeProxyData.colorBy, null, 2));
if (mode !== 'array') {
return SOLID_COLOR_ITEM;
}
// Fetch LookupTable for any array available
if (!this.lookupTables[name]) {
this.$store.dispatch(Actions.COLOR_FETCH_LOOKUP_IMAGE, name);
}
return {
text: name,
value: `${mode}${SEPARATOR}${location}${SEPARATOR}${name}`,
};
}
return SOLID_COLOR_ITEM;
},
representationItems() {
sources.forEach((proxy) => {
commit(Mutations.PROXY_SOURCE_TO_REPRESENTATION_SET, proxy);
// Fetch proxy data if not available
if (!state.proxyDataMap[proxy.id]) {
dispatch(Actions.PROXY_DATA_FETCH, { proxyId: proxy.id });
}
// Fetch proxy name if not available
if (!state.proxyNames[proxy.id]) {
dispatch(Actions.PROXY_NAME_FETCH, proxy.id);
}
// Fetch representation data if not available
if (!state.proxyDataMap[proxy.rep]) {
dispatch(Actions.PROXY_DATA_FETCH, { proxyId: proxy.rep });
}
// Fetch representation name if not available
if (!state.proxyNames[proxy.rep]) {
dispatch(Actions.PROXY_NAME_FETCH, proxy.rep);
}
});
function apply() {
if (this.create) {
return;
}
if (this.isNetworkBusy && !scheduledApply) {
scheduledApply = setTimeout(() => {
scheduledApply = null;
apply.apply(this);
}, 100);
}
if (this.isNetworkBusy < 3 && hasChange()) {
// console.log('apply', JSON.stringify(changeSet, null, 2));
store.dispatch(Actions.PROXY_UPDATE, changeSet);
store.dispatch(Actions.PROXY_DATA_FETCH, {
proxyId: this[`active${proxyType}Id`],
needUI: false,
});
}
}