MCPcopy Index your code
hub / github.com/microsoft/SandDance / setInsight

Method setInsight

packages/sanddance-explorer/src/explorer.tsx:391–426  ·  view source on GitHub ↗
(historyAction: HistoryAction, newState: Partial<UIState> = {}, partialInsight: Partial<SandDance.specs.Insight> = this.viewer.getInsight(), rebaseFilter = false)

Source from the content-addressed store, hash-verified

389 }
390
391 public setInsight(historyAction: HistoryAction, newState: Partial<UIState> = {}, partialInsight: Partial<SandDance.specs.Insight> = this.viewer.getInsight(), rebaseFilter = false) {
392 const selectedItemIndex = { ...this.state.selectedItemIndex };
393 selectedItemIndex[DataScopeId.AllData] = 0;
394 selectedItemIndex[DataScopeId.FilteredData] = 0;
395 selectedItemIndex[DataScopeId.SelectedData] = 0;
396 const historicInsight: Partial<HistoricInsight> = {
397 chart: null,
398 scheme: null,
399 columns: null,
400 filter: null,
401 rebaseFilter,
402 ...partialInsight,
403 };
404 const state: Partial<UIState> = {
405 filteredData: null,
406 selectedItemIndex,
407 search: createInputSearch(historicInsight.filter),
408 ...newState,
409 };
410 const changeInsight = () => {
411 this.getColorContext = null;
412 this.changeInsight(historicInsight, historyAction, state);
413 };
414 const currentFilter = this.viewer.getInsight().filter;
415 if (rebaseFilter && currentFilter && historicInsight.filter) {
416 if (SandDance.searchExpression.startsWith(historicInsight.filter, currentFilter)) {
417 changeInsight();
418 } else {
419 this.viewer.reset()
420 .then(() => new Promise((resolve, reject) => { setTimeout(resolve, this.viewer.options.transitionDurations.scope); }))
421 .then(changeInsight);
422 }
423 } else {
424 changeInsight();
425 }
426 }
427
428 private handleReviveSnapshot(snapshot: Snapshot, selectedSnapshotIndex: number) {
429 let handled = false;

Callers 1

reviveSnapshotMethod · 0.95

Calls 3

createInputSearchFunction · 0.70
getInsightMethod · 0.45
resetMethod · 0.45

Tested by

no test coverage detected