Skip to content

Commit

Permalink
Reset color schema after new search and persist color schema if runni…
Browse files Browse the repository at this point in the history
…ng new advanced search
  • Loading branch information
aleksbobic committed Aug 22, 2022
1 parent f63b687 commit fa1548c
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ function SearchBar(props) {
initialValues={{ search: '' }}
onSubmit={values => {
store.core.setCurrentGraph('overview');
store.graphInstance.setNodeColorScheme('component');
store.search.useDataset(selectedDataset);
store.core.resetVisibleDimensions();
store.workflow.resetWorkflow();
Expand Down
31 changes: 26 additions & 5 deletions app/src/stores/GraphStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,18 @@ export class GraphStore {
generateNodeMaterial = (meshBasicMaterialTemplate, node) => {
const material = meshBasicMaterialTemplate.clone();

switch (
this.store.graphInstance.nodeColorScheme[
const currentGraphColorSchemas = Object.keys(
this.store.graphInstance.nodeColorSchemeColors[
this.store.core.currentGraph
]
) {
);

const selectedColorSchemaAttribute =
this.store.graphInstance.nodeColorScheme[
this.store.core.currentGraph
];

switch (selectedColorSchemaAttribute) {
case 'type':
material.color.set(
this.store.graphInstance.nodeColorSchemeColors[
Expand All @@ -149,7 +156,21 @@ export class GraphStore {
material.color.set(node.color);
break;
default:
material.color.set('white');
if (
currentGraphColorSchemas.includes(
selectedColorSchemaAttribute
)
) {
material.color.set(
this.store.graphInstance.nodeColorSchemeColors[
this.store.core.currentGraph
][selectedColorSchemaAttribute][
node.properties[selectedColorSchemaAttribute]
]
);
} else {
material.color.set('white');
}
break;
}

Expand Down Expand Up @@ -466,7 +487,7 @@ export class GraphStore {
this.store.search.setSearchIsEmpty(true);
} else {
this.store.search.newNodeTypes = response.meta.new_dimensions;
console.log(response);
// console.log(response);
if (graphType === 'overview') {
// Handle overview graph data
this.graphData.meta.query = query;
Expand Down

0 comments on commit fa1548c

Please sign in to comment.