From 094bbc9dcec73a4a3ced23eecd046673a39a0ef5 Mon Sep 17 00:00:00 2001 From: Nathan Evans Date: Wed, 22 Sep 2021 12:47:43 -0700 Subject: [PATCH] add comments about autolayout url --- src/api/layout.ts | 11 ++++++++++- src/constants.ts | 3 +++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/api/layout.ts b/src/api/layout.ts index 907dcb1..aa36e75 100644 --- a/src/api/layout.ts +++ b/src/api/layout.ts @@ -6,7 +6,7 @@ import { EdgeCollection } from '~/arquero' import { AUTOLAYOUT_URL } from '~/constants' /** - * Transforms and edge list to the POST payload JSON. + * Transforms an edge list to the POST payload JSON. * @param edges */ function edgesToPOST(edges: EdgeCollection) { @@ -26,6 +26,15 @@ function createPOSTBody(edges: EdgeCollection) { } } +/** + * This function invokes a service that uses graspologic autolayout. + * It can be configured by assigning the AUTOLAYOUT_URL environment variable + * at deployment time. If the variable is missing, the UMAP button will not be + * visible in the interface. + * See https://graspologic.readthedocs.io/en/latest/reference/layouts.html#automatic-graph-layout + * @param edges + * @returns + */ export async function umapLayout(edges: EdgeCollection) { const body = createPOSTBody(edges) return fetch(AUTOLAYOUT_URL, { diff --git a/src/constants.ts b/src/constants.ts index cb310dd..87eeaae 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -4,4 +4,7 @@ */ export const ROOT_COMMUNITY_ID = '-1' +/** + * This constant can be configured to point to a web service for graspologic autolayout. + */ export const AUTOLAYOUT_URL = process.env.AUTOLAYOUT_URL as string