Skip to content
This repository has been archived by the owner on Dec 26, 2022. It is now read-only.

Commit

Permalink
Internal 172 canvas bug (#180)
Browse files Browse the repository at this point in the history
* graphql query fixes

* extended DGraph TTL to 13 months

* remove console.log

* cargo update
  • Loading branch information
andrea-grapl authored Jul 23, 2020
1 parent 1e603a1 commit 6bb2b0b
Show file tree
Hide file tree
Showing 4 changed files with 362 additions and 272 deletions.
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ services:
- "IS_LOCAL=True"
- MG_ALPHAS=master_graph:9080
- GRAPL_LOG_LEVEL=${GRAPL_LOG_LEVEL:-ERROR}
- GRAPL_DGRAPH_TTL_S=${GRAPL_DGRAPH_TTL_S:-600}
- GRAPL_DGRAPH_TTL_S=${GRAPL_DGRAPH_TTL_S:-31536000}
- GRAPL_TTL_DELETE_BATCH_SIZE=${GRAPL_TTL_DELETE_BATCH_SIZE:-10}
tty: true
links:
Expand Down
17 changes: 13 additions & 4 deletions src/js/graphql_endpoint/modules/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ const getLensByName = async (dg_client, lensName) => {
uid,
dgraph_type: dgraph.type,
lens_type,
scope {
scope @filter(has(node_key)) {
uid,
dgraph_type: dgraph.type,
expand(_all_)
Expand Down Expand Up @@ -364,13 +364,17 @@ const getRisksFromNode = async (dg_client, nodeUid) => {
const query = `
query all($a: string)
{
all(func: uid($a))
all(func: uid($a)) @cascade
{
uid,
dgraph_type: dgraph.type
node_key
risks {
uid,
uid
dgraph_type: dgraph.type
expand(_all_),
node_key
analyzer_name
risk_score
}
}
}`;
Expand Down Expand Up @@ -416,8 +420,13 @@ const handleLensScope = async (parent, args) => {
const lens_name = args.lens_name;

const lens = await getLensByName(dg_client, lens_name);
lens["scope"] = lens["scope"] || [];

for (const node of lens["scope"]) {
// node.uid = parseInt(node.uid, 16);
if(!node.dgraph_type){
console.warn("No DGraph Type", node)
}
// for every node in our lens scope, get its neighbors

const nodeEdges = await getNeighborsFromNode(dg_client, node["uid"]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@

ORIGIN_OVERRIDE = os.environ.get("ORIGIN_OVERRIDE", None)

LOGGER.debug("Origin: ", origin)
LOGGER.debug("Origin: ", ORIGIN)
app = Chalice(app_name="model-plugin-deployer")


Expand Down
Loading

0 comments on commit 6bb2b0b

Please sign in to comment.