Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug reported in #46 #48

Merged
merged 1 commit into from
Jun 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/src/components/feature/settings/Settings.component.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ function Settings() {
const renderDimensionsToggle = () => {
const tags = [
...Object.keys(store.search.nodeTypes),
...store.search.newNodeTypes
...Object.keys(store.search.newNodeTypes)
].map((property, index) => (
<Tag
key={index}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,9 @@ function FileUploadModal() {
...Object.keys(
store.search.nodeTypes
),
...store.search.newNodeTypes
...Object.keys(
store.search.newNodeTypes
)
].map(entry => (
<option
key={`chart_selection_show_only_${entry}`}
Expand Down
4 changes: 3 additions & 1 deletion app/src/stores/GraphStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,9 @@ export class GraphStore {
this.store.graphInstance.generateSchemeColorsFromArray(
[
...Object.keys(this.store.search.nodeTypes),
...this.store.search.newNodeTypes
...Object.keys(
this.store.search.newNodeTypes
)
],
'type'
);
Expand Down
37 changes: 22 additions & 15 deletions app/src/stores/SchemaStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export class SchemaStore {
const graph = new dagre.graphlib.Graph()
.setDefaultEdgeLabel(() => ({}))
.setGraph({
rankdir: this.schemaContainsLinks(schema) ? 'TB' : 'LR',
rankdir: 'LR',
align: 'UL'
});

Expand Down Expand Up @@ -123,12 +123,17 @@ export class SchemaStore {
};

getOverviewNodeProperties = () => {
if (this.store.search.nodeTypes[this.store.search.anchor] !== 'list') {
return Object.entries(this.store.search.nodeTypes)
const data = {
...this.store.search.newNodeTypes,
...this.store.search.nodeTypes
};

if (data[this.store.search.anchor] !== 'list') {
return Object.entries(data)
.filter(
entry =>
entry[0] !== this.store.search.anchor &&
this.store.search.nodeTypes[entry[0]] !== 'list'
data[entry[0]] !== 'list'
)
.map(entry => entry[0]);
}
Expand All @@ -150,7 +155,7 @@ export class SchemaStore {

const features = [
...Object.keys(this.store.search.nodeTypes),
...this.store.search.newNodeTypes
...Object.keys(this.store.search.newNodeTypes)
];
const anchor = this.store.search.anchor;

Expand Down Expand Up @@ -195,15 +200,12 @@ export class SchemaStore {
position: 'left',
features: [
...Object.keys(this.store.search.nodeTypes),
...this.store.search.newNodeTypes
...Object.keys(this.store.search.newNodeTypes)
].filter(
feature =>
!this.store.search.links.includes(feature)
),
properties: [
...this.getOverviewNodeProperties(),
...this.store.search.newNodeTypes
],
properties: [...this.getOverviewNodeProperties()],
addedProperties: this.overviewDataNodeProperties,
setAnchor: this.setAnchor,
addProperty: this.addProperty,
Expand All @@ -227,14 +229,14 @@ export class SchemaStore {
position: 'right',
features: [
...Object.keys(this.store.search.nodeTypes),
...this.store.search.newNodeTypes
...Object.keys(this.store.search.newNodeTypes)
].filter(
feature =>
!this.store.search.links.includes(feature)
),
properties: [
...Object.keys(this.store.search.nodeTypes),
...this.store.search.newNodeTypes
...Object.keys(this.store.search.newNodeTypes)
],
addedProperties: this.overviewDataNodeProperties,
setAnchor: this.setAnchor,
Expand Down Expand Up @@ -341,7 +343,7 @@ export class SchemaStore {
position: 'both',
features: [
...Object.keys(this.store.search.nodeTypes),
...this.store.search.newNodeTypes
...Object.keys(this.store.search.newNodeTypes)
].filter(feature => !this.store.search.links.includes(feature)),
anchor: this.store.search.anchor
},
Expand Down Expand Up @@ -651,8 +653,13 @@ export class SchemaStore {
};

getPossibleConnections = (source, target) => {
const src_type = this.store.search.nodeTypes[source];
const tar_type = this.store.search.nodeTypes[target];
const types = {
...this.store.search.nodeTypes,
...this.store.search.newNodeTypes
};

const src_type = types[source];
const tar_type = types[target];

if (src_type === 'list' && tar_type === 'list') {
return ['M:N', '1:1'];
Expand Down
15 changes: 13 additions & 2 deletions server/app/routes/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,14 @@ def get_new_features(query):
return [get_new_features(entry) for entry in query["queries"]]

if "newFeatureName" in query.keys():
return [query["newFeatureName"]] + get_new_features(query["query"])
if query["action"] == "count array":
return [
{"feature": query["newFeatureName"], "type": "integer"}
] + get_new_features(query["query"])
elif query["action"] == "extract keywords":
return [
{"feature": query["newFeatureName"], "type": "list"}
] + get_new_features(query["query"])

if "query" not in query and "queries" not in query:
return []
Expand Down Expand Up @@ -243,7 +250,11 @@ def search(
)
results = convert_query_to_df(es_query, search)
else:
new_dimensions = get_new_features(json.loads(query))
new_dimensions = {
entry["feature"]: entry["type"]
for entry in get_new_features(json.loads(query))
}
print(f"\n\n\n query action is {new_dimensions}")
results = generate_advanced_query(json.loads(query), search)

if len(results.index) == 0:
Expand Down