Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function selectTimePointFromHash(timepoints: ITacoTimePoint[]) {
if (hash.has(AppConstants.HASH_PROPS.TIME_POINTS) === false) {
return;
}
const selectedTPKeys: string[] = hash.getProp(AppConstants.HASH_PROPS.TIME_POINTS).split(',');
const selectedTimePoints = timepoints.filter((d) => selectedTPKeys.indexOf(d.key) > -1);
const showDetailView = hash.getInt(AppConstants.HASH_PROPS.DETAIL_VIEW);
selectTimePoint(...selectedTimePoints);
if (selectedTimePoints.length === 2 && showDetailView === 1) {
hash.setInt(AppConstants.HASH_PROPS.DETAIL_VIEW, showDetailView);
events.fire(AppConstants.EVENT_OPEN_DETAIL_VIEW, selectedTimePoints);
} else {
hash.removeProp(AppConstants.HASH_PROPS.DETAIL_VIEW);
}
}
private loadDetailView(selection:ITacoTimePoint[]) {
if(selection.length !== 2) {
return;
}
hash.setInt(AppConstants.HASH_PROPS.DETAIL_VIEW, 1);
events.fire(AppConstants.EVENT_OPEN_DIFF_HEATMAP, selection.map((d) => d.item));
events.fire(AppConstants.EVENT_DATASET_SELECTED_LEFT, selection[0].item);
events.fire(AppConstants.EVENT_DATASET_SELECTED_RIGHT, selection[1].item);
this.$node.select('button').attr('disabled', 'disabled').classed('loading', true);
}
}