Pull `credExplorer` into its own top-level module (#971)

Currently, the cred explorer is a submodule of `app`. This is somewhat
confusing, as `app` is essentially our homepage, and the explorer is a
standalone React application which happens to get embedded in our
homepage. This commit pulls the explorer from `app/credExplorer/` into
`explorer/`, which is a better organization.

The `app/adapters` were actually only used by the cred explorer, so
those files have been moved to `explorer/adapters`. We should rename
them from "App Adapters" to "Explorer Adapters", but I didn't do that in
this commit so as to minimize the (already substantial) size of the
change.

Also, we should rename `app/` to `homepage/` in a subsequent commit.

I encountered a nasty Flow bug, which I fixed with help from @wchargin.
The result is extra annotations on the demo and fallback dynamic
adapters (so that the `static()` method is type annotated).

Test plan: This change is massive, but it's just a rename. `yarn test`
suffices.
This commit is contained in:
Dandelion Mané 2018-11-01 10:16:42 -07:00 committed by GitHub
parent c997f4e1ec
commit 604db14879
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
48 changed files with 158 additions and 161 deletions

View File

@ -38,7 +38,7 @@ const routeData /*: $ReadOnlyArray<RouteDatum> */ = [
path: "/prototype/", path: "/prototype/",
contents: { contents: {
type: "PAGE", type: "PAGE",
component: () => require("./credExplorer/App").default, component: () => require("../explorer/App").default,
}, },
title: "SourceCred prototype", title: "SourceCred prototype",
navTitle: "Prototype", navTitle: "Prototype",

View File

@ -6,7 +6,7 @@ import stringify from "json-stable-stringify";
import mkdirp from "mkdirp"; import mkdirp from "mkdirp";
import path from "path"; import path from "path";
import * as RepoIdRegistry from "../app/credExplorer/repoIdRegistry"; import * as RepoIdRegistry from "../explorer/repoIdRegistry";
import {repoIdToString, stringToRepoId, type RepoId} from "../core/repoId"; import {repoIdToString, stringToRepoId, type RepoId} from "../core/repoId";
import dedent from "../util/dedent"; import dedent from "../util/dedent";
import type {Command} from "./command"; import type {Command} from "./command";

View File

@ -7,7 +7,7 @@ import tmp from "tmp";
import {run} from "./testUtil"; import {run} from "./testUtil";
import load, {help} from "./load"; import load, {help} from "./load";
import * as RepoIdRegistry from "../app/credExplorer/repoIdRegistry"; import * as RepoIdRegistry from "../explorer/repoIdRegistry";
import {stringToRepoId} from "../core/repoId"; import {stringToRepoId} from "../core/repoId";
jest.mock("../tools/execDependencyGraph", () => jest.fn()); jest.mock("../tools/execDependencyGraph", () => jest.fn());

View File

@ -2,25 +2,25 @@
import React from "react"; import React from "react";
import type {Assets} from "../../webutil/assets"; import type {Assets} from "../webutil/assets";
import type {LocalStore} from "../../webutil/localStore"; import type {LocalStore} from "../webutil/localStore";
import CheckedLocalStore from "../../webutil/checkedLocalStore"; import CheckedLocalStore from "../webutil/checkedLocalStore";
import BrowserLocalStore from "../../webutil/browserLocalStore"; import BrowserLocalStore from "../webutil/browserLocalStore";
import Link from "../../webutil/Link"; import Link from "../webutil/Link";
import {defaultStaticAdapters} from "../adapters/defaultPlugins"; import {defaultStaticAdapters} from "./adapters/defaultPlugins";
import {PagerankTable} from "./pagerankTable/Table"; import {PagerankTable} from "./pagerankTable/Table";
import type {WeightedTypes} from "../../analysis/weights"; import type {WeightedTypes} from "../analysis/weights";
import {defaultWeightsForAdapterSet} from "./weights/weights"; import {defaultWeightsForAdapterSet} from "./weights/weights";
import RepositorySelect from "./RepositorySelect"; import RepositorySelect from "./RepositorySelect";
import {Prefix as GithubPrefix} from "../../plugins/github/nodes"; import {Prefix as GithubPrefix} from "../plugins/github/nodes";
import { import {
createStateTransitionMachine, createStateTransitionMachine,
type AppState, type AppState,
type StateTransitionMachineInterface, type StateTransitionMachineInterface,
uninitializedState, uninitializedState,
} from "./state"; } from "./state";
import {StaticAdapterSet} from "../adapters/adapterSet"; import {StaticAdapterSet} from "./adapters/adapterSet";
export default class AppPage extends React.Component<{|+assets: Assets|}> { export default class AppPage extends React.Component<{|+assets: Assets|}> {
static _LOCAL_STORE = new CheckedLocalStore( static _LOCAL_STORE = new CheckedLocalStore(

View File

@ -3,23 +3,23 @@
import React from "react"; import React from "react";
import {shallow} from "enzyme"; import {shallow} from "enzyme";
import {Graph} from "../../core/graph"; import {Graph} from "../core/graph";
import {makeRepoId} from "../../core/repoId"; import {makeRepoId} from "../core/repoId";
import {Assets} from "../../webutil/assets"; import {Assets} from "../webutil/assets";
import testLocalStore from "../../webutil/testLocalStore"; import testLocalStore from "../webutil/testLocalStore";
import {DynamicAdapterSet, StaticAdapterSet} from "../adapters/adapterSet"; import {DynamicAdapterSet, StaticAdapterSet} from "./adapters/adapterSet";
import {FactorioStaticAdapter} from "../../plugins/demo/appAdapter"; import {FactorioStaticAdapter} from "../plugins/demo/appAdapter";
import {defaultWeightsForAdapter} from "./weights/weights"; import {defaultWeightsForAdapter} from "./weights/weights";
import RepositorySelect from "./RepositorySelect"; import RepositorySelect from "./RepositorySelect";
import {PagerankTable} from "./pagerankTable/Table"; import {PagerankTable} from "./pagerankTable/Table";
import {createApp, LoadingIndicator} from "./App"; import {createApp, LoadingIndicator} from "./App";
import {uninitializedState} from "./state"; import {uninitializedState} from "./state";
import {Prefix as GithubPrefix} from "../../plugins/github/nodes"; import {Prefix as GithubPrefix} from "../plugins/github/nodes";
require("../../webutil/testUtil").configureEnzyme(); require("../webutil/testUtil").configureEnzyme();
describe("app/credExplorer/App", () => { describe("explorer/App", () => {
function example() { function example() {
let setState, getState; let setState, getState;
const setRepoId = jest.fn(); const setRepoId = jest.fn();

View File

@ -4,12 +4,12 @@ import React, {type Node} from "react";
import sortBy from "lodash.sortby"; import sortBy from "lodash.sortby";
import deepEqual from "lodash.isequal"; import deepEqual from "lodash.isequal";
import * as NullUtil from "../../util/null"; import * as NullUtil from "../util/null";
import type {LocalStore} from "../../webutil/localStore"; import type {LocalStore} from "../webutil/localStore";
import type {Assets} from "../../webutil/assets"; import type {Assets} from "../webutil/assets";
import {fromJSON, REPO_ID_REGISTRY_API} from "./repoIdRegistry"; import {fromJSON, REPO_ID_REGISTRY_API} from "./repoIdRegistry";
import {type RepoId, stringToRepoId, repoIdToString} from "../../core/repoId"; import {type RepoId, stringToRepoId, repoIdToString} from "../core/repoId";
export const REPO_ID_KEY = "selectedRepository"; export const REPO_ID_KEY = "selectedRepository";
export type Status = export type Status =

View File

@ -2,8 +2,8 @@
import React from "react"; import React from "react";
import {shallow, mount} from "enzyme"; import {shallow, mount} from "enzyme";
import * as NullUtil from "../../util/null"; import * as NullUtil from "../util/null";
import testLocalStore from "../../webutil/testLocalStore"; import testLocalStore from "../webutil/testLocalStore";
import RepositorySelect, { import RepositorySelect, {
PureRepositorySelect, PureRepositorySelect,
LocalStoreRepositorySelect, LocalStoreRepositorySelect,
@ -11,19 +11,19 @@ import RepositorySelect, {
type Status, type Status,
REPO_ID_KEY, REPO_ID_KEY,
} from "./RepositorySelect"; } from "./RepositorySelect";
import {Assets} from "../../webutil/assets"; import {Assets} from "../webutil/assets";
import { import {
toJSON, toJSON,
type RepoIdRegistry, type RepoIdRegistry,
REPO_ID_REGISTRY_API, REPO_ID_REGISTRY_API,
} from "./repoIdRegistry"; } from "./repoIdRegistry";
import {makeRepoId} from "../../core/repoId"; import {makeRepoId} from "../core/repoId";
require("../../webutil/testUtil").configureEnzyme(); require("../webutil/testUtil").configureEnzyme();
require("../../webutil/testUtil").configureAphrodite(); require("../webutil/testUtil").configureAphrodite();
describe("app/credExplorer/RepositorySelect", () => { describe("explorer/RepositorySelect", () => {
beforeEach(() => { beforeEach(() => {
fetch.resetMocks(); fetch.resetMocks();
}); });

View File

@ -12,7 +12,7 @@ import {
import {Assets} from "../../webutil/assets"; import {Assets} from "../../webutil/assets";
import {makeRepoId} from "../../core/repoId"; import {makeRepoId} from "../../core/repoId";
describe("app/adapters/adapterSet", () => { describe("explorer/adapters/adapterSet", () => {
describe("StaticAdapterSet", () => { describe("StaticAdapterSet", () => {
function example() { function example() {
const x = new FactorioStaticAdapter(); const x = new FactorioStaticAdapter();

View File

@ -1,10 +1,7 @@
// @flow // @flow
import {fallbackDeclaration} from "../../analysis/fallbackDeclaration"; import {fallbackDeclaration} from "../../analysis/fallbackDeclaration";
import type { import type {StaticAppAdapter, DynamicAppAdapter} from "./appAdapter";
StaticAppAdapter,
DynamicAppAdapter,
} from "../../app/adapters/appAdapter";
import {Assets} from "../../webutil/assets"; import {Assets} from "../../webutil/assets";
import {type RepoId} from "../../core/repoId"; import {type RepoId} from "../../core/repoId";
import {Graph, NodeAddress, type NodeAddressT} from "../../core/graph"; import {Graph, NodeAddress, type NodeAddressT} from "../../core/graph";
@ -28,7 +25,7 @@ export class FallbackDynamicAdapter implements DynamicAppAdapter {
return `[fallback]: ${NodeAddress.toString(x)}`; return `[fallback]: ${NodeAddress.toString(x)}`;
} }
static() { static(): FallbackStaticAdapter {
return new FallbackStaticAdapter(); return new FallbackStaticAdapter();
} }
} }

View File

@ -1,9 +1,9 @@
// @flow // @flow
import React from "react"; import React from "react";
import * as NullUtil from "../../../util/null"; import * as NullUtil from "../../util/null";
import type {NodeAddressT} from "../../../core/graph"; import type {NodeAddressT} from "../../core/graph";
import {ConnectionRowList} from "./Connection"; import {ConnectionRowList} from "./Connection";
import {aggregateFlat, type FlatAggregation, aggregationKey} from "./aggregate"; import {aggregateFlat, type FlatAggregation, aggregationKey} from "./aggregate";

View File

@ -3,9 +3,9 @@
import React from "react"; import React from "react";
import {shallow} from "enzyme"; import {shallow} from "enzyme";
import * as NullUtil from "../../../util/null"; import * as NullUtil from "../../util/null";
import {NodeAddress, EdgeAddress} from "../../../core/graph"; import {NodeAddress, EdgeAddress} from "../../core/graph";
import type {EdgeType, NodeType} from "../../../analysis/types"; import type {EdgeType, NodeType} from "../../analysis/types";
import { import {
AggregationRowList, AggregationRowList,
AggregationRow, AggregationRow,
@ -16,11 +16,11 @@ import {Badge} from "./shared";
import {example} from "./sharedTestUtils"; import {example} from "./sharedTestUtils";
import {aggregateFlat, type FlatAggregation} from "./aggregate"; import {aggregateFlat, type FlatAggregation} from "./aggregate";
import {TableRow} from "./TableRow"; import {TableRow} from "./TableRow";
import {nodes as factorioNodes} from "../../../plugins/demo/graph"; import {nodes as factorioNodes} from "../../plugins/demo/graph";
require("../../../webutil/testUtil").configureEnzyme(); require("../../webutil/testUtil").configureEnzyme();
describe("app/credExplorer/pagerankTable/Aggregation", () => { describe("explorer/pagerankTable/Aggregation", () => {
describe("AggregationRowList", () => { describe("AggregationRowList", () => {
it("instantiates AggregationRows for each aggregation", async () => { it("instantiates AggregationRows for each aggregation", async () => {
const {adapters, pnd} = await example(); const {adapters, pnd} = await example();

View File

@ -1,12 +1,12 @@
// @flow // @flow
import React from "react"; import React from "react";
import * as NullUtil from "../../../util/null"; import * as NullUtil from "../../util/null";
import type {NodeAddressT} from "../../../core/graph"; import type {NodeAddressT} from "../../core/graph";
import type {Connection} from "../../../core/attribution/graphToMarkovChain"; import type {Connection} from "../../core/attribution/graphToMarkovChain";
import type {ScoredConnection} from "../../../analysis/pagerankNodeDecomposition"; import type {ScoredConnection} from "../../analysis/pagerankNodeDecomposition";
import {DynamicAdapterSet} from "../../adapters/adapterSet"; import {DynamicAdapterSet} from "../adapters/adapterSet";
import {TableRow} from "./TableRow"; import {TableRow} from "./TableRow";
import {NodeRow} from "./Node"; import {NodeRow} from "./Node";

View File

@ -2,18 +2,18 @@
import React from "react"; import React from "react";
import {shallow} from "enzyme"; import {shallow} from "enzyme";
import * as NullUtil from "../../../util/null"; import * as NullUtil from "../../util/null";
import type {Connection} from "../../../core/attribution/graphToMarkovChain"; import type {Connection} from "../../core/attribution/graphToMarkovChain";
import {ConnectionRowList, ConnectionRow, ConnectionView} from "./Connection"; import {ConnectionRowList, ConnectionRow, ConnectionView} from "./Connection";
import {example} from "./sharedTestUtils"; import {example} from "./sharedTestUtils";
import {TableRow} from "./TableRow"; import {TableRow} from "./TableRow";
import {NodeRow} from "./Node"; import {NodeRow} from "./Node";
import {nodes as factorioNodes} from "../../../plugins/demo/graph"; import {nodes as factorioNodes} from "../../plugins/demo/graph";
require("../../../webutil/testUtil").configureEnzyme(); require("../../webutil/testUtil").configureEnzyme();
describe("app/credExplorer/pagerankTable/Connection", () => { describe("explorer/pagerankTable/Connection", () => {
describe("ConnectionRowList", () => { describe("ConnectionRowList", () => {
async function setup(maxEntriesPerList: number = 100000) { async function setup(maxEntriesPerList: number = 100000) {
const {adapters, pnd} = await example(); const {adapters, pnd} = await example();

View File

@ -2,9 +2,9 @@
import React from "react"; import React from "react";
import sortBy from "lodash.sortby"; import sortBy from "lodash.sortby";
import * as NullUtil from "../../../util/null"; import * as NullUtil from "../../util/null";
import {type NodeAddressT} from "../../../core/graph"; import {type NodeAddressT} from "../../core/graph";
import {TableRow} from "./TableRow"; import {TableRow} from "./TableRow";
import {nodeDescription, type SharedProps} from "./shared"; import {nodeDescription, type SharedProps} from "./shared";

View File

@ -3,20 +3,20 @@
import React from "react"; import React from "react";
import {shallow} from "enzyme"; import {shallow} from "enzyme";
import sortBy from "lodash.sortby"; import sortBy from "lodash.sortby";
import * as NullUtil from "../../../util/null"; import * as NullUtil from "../../util/null";
import {TableRow} from "./TableRow"; import {TableRow} from "./TableRow";
import {AggregationRowList} from "./Aggregation"; import {AggregationRowList} from "./Aggregation";
import type {NodeAddressT} from "../../../core/graph"; import type {NodeAddressT} from "../../core/graph";
import {nodeDescription} from "./shared"; import {nodeDescription} from "./shared";
import {example} from "./sharedTestUtils"; import {example} from "./sharedTestUtils";
import {NodeRowList, NodeRow, type NodeRowProps} from "./Node"; import {NodeRowList, NodeRow, type NodeRowProps} from "./Node";
import {nodes as factorioNodes} from "../../../plugins/demo/graph"; import {nodes as factorioNodes} from "../../plugins/demo/graph";
require("../../../webutil/testUtil").configureEnzyme(); require("../../webutil/testUtil").configureEnzyme();
describe("app/credExplorer/pagerankTable/Node", () => { describe("explorer/pagerankTable/Node", () => {
describe("NodeRowList", () => { describe("NodeRowList", () => {
function sortedByScore(nodes: $ReadOnlyArray<NodeAddressT>, pnd) { function sortedByScore(nodes: $ReadOnlyArray<NodeAddressT>, pnd) {
return sortBy(nodes, (node) => -NullUtil.get(pnd.get(node)).score); return sortBy(nodes, (node) => -NullUtil.get(pnd.get(node)).score);

View File

@ -2,14 +2,14 @@
import React from "react"; import React from "react";
import sortBy from "lodash.sortby"; import sortBy from "lodash.sortby";
import * as NullUtil from "../../../util/null"; import * as NullUtil from "../../util/null";
import {type NodeAddressT, NodeAddress} from "../../../core/graph"; import {type NodeAddressT, NodeAddress} from "../../core/graph";
import type {PagerankNodeDecomposition} from "../../../analysis/pagerankNodeDecomposition"; import type {PagerankNodeDecomposition} from "../../analysis/pagerankNodeDecomposition";
import {DynamicAdapterSet} from "../../adapters/adapterSet"; import {DynamicAdapterSet} from "../adapters/adapterSet";
import type {DynamicAppAdapter} from "../../adapters/appAdapter"; import type {DynamicAppAdapter} from "../adapters/appAdapter";
import {FALLBACK_NAME} from "../../../analysis/fallbackDeclaration"; import {FALLBACK_NAME} from "../../analysis/fallbackDeclaration";
import type {WeightedTypes} from "../../../analysis/weights"; import type {WeightedTypes} from "../../analysis/weights";
import {WeightConfig} from "../weights/WeightConfig"; import {WeightConfig} from "../weights/WeightConfig";
import {NodeRowList} from "./Node"; import {NodeRowList} from "./Node";

View File

@ -3,17 +3,17 @@
import React from "react"; import React from "react";
import {shallow} from "enzyme"; import {shallow} from "enzyme";
import {NodeAddress, type NodeAddressT} from "../../../core/graph"; import {NodeAddress, type NodeAddressT} from "../../core/graph";
import {PagerankTable} from "./Table"; import {PagerankTable} from "./Table";
import {example, COLUMNS} from "./sharedTestUtils"; import {example, COLUMNS} from "./sharedTestUtils";
import {NodeRowList} from "./Node"; import {NodeRowList} from "./Node";
import {WeightConfig} from "../weights/WeightConfig"; import {WeightConfig} from "../weights/WeightConfig";
import {defaultWeightsForAdapter} from "../weights/weights"; import {defaultWeightsForAdapter} from "../weights/weights";
import {FactorioStaticAdapter} from "../../../plugins/demo/appAdapter"; import {FactorioStaticAdapter} from "../../plugins/demo/appAdapter";
require("../../../webutil/testUtil").configureEnzyme(); require("../../webutil/testUtil").configureEnzyme();
describe("app/credExplorer/pagerankTable/Table", () => { describe("explorer/pagerankTable/Table", () => {
describe("PagerankTable", () => { describe("PagerankTable", () => {
async function setup(defaultNodeFilter?: NodeAddressT) { async function setup(defaultNodeFilter?: NodeAddressT) {
const {pnd, adapters, weightedTypes} = await example(); const {pnd, adapters, weightedTypes} = await example();

View File

@ -5,9 +5,9 @@ import {shallow} from "enzyme";
import {TableRow, PaddingRow} from "./TableRow"; import {TableRow, PaddingRow} from "./TableRow";
import {COLUMNS} from "./sharedTestUtils"; import {COLUMNS} from "./sharedTestUtils";
require("../../../webutil/testUtil").configureEnzyme(); require("../../webutil/testUtil").configureEnzyme();
describe("app/credExplorer/pagerankTable/TableRow", () => { describe("explorer/pagerankTable/TableRow", () => {
function example() { function example() {
return shallow( return shallow(
<TableRow <TableRow

View File

@ -1,8 +1,8 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`app/credExplorer/pagerankTable/Table PagerankTable has a filter select with expected label text 1`] = `"Filter by node type: "`; exports[`explorer/pagerankTable/Table PagerankTable has a filter select with expected label text 1`] = `"Filter by node type: "`;
exports[`app/credExplorer/pagerankTable/Table PagerankTable has a filter select with expected option groups 1`] = ` exports[`explorer/pagerankTable/Table PagerankTable has a filter select with expected option groups 1`] = `
Array [ Array [
Object { Object {
"style": undefined, "style": undefined,

View File

@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`app/credExplorer/pagerankTable/TableRow depth parameter changes the color, but not the indentation 1`] = ` exports[`explorer/pagerankTable/TableRow depth parameter changes the color, but not the indentation 1`] = `
Object { Object {
"buttonStyle": Object { "buttonStyle": Object {
"marginLeft": 20, "marginLeft": 20,
@ -13,7 +13,7 @@ Object {
} }
`; `;
exports[`app/credExplorer/pagerankTable/TableRow depth parameter changes the color, but not the indentation 2`] = ` exports[`explorer/pagerankTable/TableRow depth parameter changes the color, but not the indentation 2`] = `
Object { Object {
"buttonStyle": Object { "buttonStyle": Object {
"marginLeft": 20, "marginLeft": 20,
@ -26,7 +26,7 @@ Object {
} }
`; `;
exports[`app/credExplorer/pagerankTable/TableRow depth parameter changes the color, but not the indentation 3`] = ` exports[`explorer/pagerankTable/TableRow depth parameter changes the color, but not the indentation 3`] = `
Object { Object {
"buttonStyle": Object { "buttonStyle": Object {
"marginLeft": 20, "marginLeft": 20,
@ -39,7 +39,7 @@ Object {
} }
`; `;
exports[`app/credExplorer/pagerankTable/TableRow indent parameter changes the button indentation 1`] = ` exports[`explorer/pagerankTable/TableRow indent parameter changes the button indentation 1`] = `
Object { Object {
"buttonStyle": Object { "buttonStyle": Object {
"marginLeft": 5, "marginLeft": 5,
@ -52,7 +52,7 @@ Object {
} }
`; `;
exports[`app/credExplorer/pagerankTable/TableRow indent parameter changes the button indentation 2`] = ` exports[`explorer/pagerankTable/TableRow indent parameter changes the button indentation 2`] = `
Object { Object {
"buttonStyle": Object { "buttonStyle": Object {
"marginLeft": 20, "marginLeft": 20,
@ -65,7 +65,7 @@ Object {
} }
`; `;
exports[`app/credExplorer/pagerankTable/TableRow indent parameter changes the button indentation 3`] = ` exports[`explorer/pagerankTable/TableRow indent parameter changes the button indentation 3`] = `
Object { Object {
"buttonStyle": Object { "buttonStyle": Object {
"marginLeft": 35, "marginLeft": 35,

View File

@ -2,10 +2,10 @@
import sortBy from "lodash.sortby"; import sortBy from "lodash.sortby";
import stringify from "json-stable-stringify"; import stringify from "json-stable-stringify";
import * as MapUtil from "../../../util/map"; import * as MapUtil from "../../util/map";
import {NodeTrie, EdgeTrie} from "../../../core/trie"; import {NodeTrie, EdgeTrie} from "../../core/trie";
import type {EdgeType, NodeType} from "../../../analysis/types"; import type {EdgeType, NodeType} from "../../analysis/types";
import type {ScoredConnection} from "../../../analysis/pagerankNodeDecomposition"; import type {ScoredConnection} from "../../analysis/pagerankNodeDecomposition";
// Sorted by descending `summary.score` // Sorted by descending `summary.score`
export type FlatAggregations = $ReadOnlyArray<FlatAggregation>; export type FlatAggregations = $ReadOnlyArray<FlatAggregation>;

View File

@ -1,7 +1,7 @@
// @flow // @flow
import {EdgeAddress, NodeAddress} from "../../../core/graph"; import {EdgeAddress, NodeAddress} from "../../core/graph";
import * as NullUtil from "../../../util/null"; import * as NullUtil from "../../util/null";
import { import {
aggregateByNodeType, aggregateByNodeType,
aggregateByConnectionType, aggregateByConnectionType,
@ -10,7 +10,7 @@ import {
aggregationKey, aggregationKey,
} from "./aggregate"; } from "./aggregate";
describe("app/credExplorer/pagerankTable/aggregate", () => { describe("explorer/pagerankTable/aggregate", () => {
// TODO: If making major modifications to these tests, consider switching // TODO: If making major modifications to these tests, consider switching
// from the hand-maintained connections and types, and instead use the demo // from the hand-maintained connections and types, and instead use the demo
// adadpters from app/adapters/demoAdapters // adadpters from app/adapters/demoAdapters

View File

@ -5,11 +5,11 @@ import {
type EdgeAddressT, type EdgeAddressT,
type NodeAddressT, type NodeAddressT,
NodeAddress, NodeAddress,
} from "../../../core/graph"; } from "../../core/graph";
import {DynamicAdapterSet} from "../../adapters/adapterSet"; import {DynamicAdapterSet} from "../adapters/adapterSet";
import type {PagerankNodeDecomposition} from "../../../analysis/pagerankNodeDecomposition"; import type {PagerankNodeDecomposition} from "../../analysis/pagerankNodeDecomposition";
export function nodeDescription( export function nodeDescription(
address: NodeAddressT, address: NodeAddressT,

View File

@ -1,8 +1,8 @@
// @flow // @flow
import {pagerank} from "../../../analysis/pagerank"; import {pagerank} from "../../analysis/pagerank";
import {defaultWeightsForAdapterSet} from "../weights/weights"; import {defaultWeightsForAdapterSet} from "../weights/weights";
import {dynamicAdapterSet} from "../../../plugins/demo/appAdapter"; import {dynamicAdapterSet} from "../../plugins/demo/appAdapter";
export const COLUMNS = () => ["Description", "", "Cred"]; export const COLUMNS = () => ["Description", "", "Cred"];

View File

@ -4,8 +4,8 @@
// and is read by the RepositorySelect component // and is read by the RepositorySelect component
// (src/app/credExplorer/RepositorySelect.js) // (src/app/credExplorer/RepositorySelect.js)
import deepEqual from "lodash.isequal"; import deepEqual from "lodash.isequal";
import {toCompat, fromCompat, type Compatible} from "../../util/compat"; import {toCompat, fromCompat, type Compatible} from "../util/compat";
import type {RepoId} from "../../core/repoId"; import type {RepoId} from "../core/repoId";
export const REPO_ID_REGISTRY_FILE = "repositoryRegistry.json"; export const REPO_ID_REGISTRY_FILE = "repositoryRegistry.json";
export const REPO_ID_REGISTRY_API = "/api/v1/data/repositoryRegistry.json"; export const REPO_ID_REGISTRY_API = "/api/v1/data/repositoryRegistry.json";

View File

@ -8,10 +8,10 @@ import {
type RepoIdRegistry, type RepoIdRegistry,
} from "./repoIdRegistry"; } from "./repoIdRegistry";
import {makeRepoId} from "../../core/repoId"; import {makeRepoId} from "../core/repoId";
describe("app/credExplorer/repoIdRegistry", () => { describe("explorer/repoIdRegistry", () => {
describe("to/fromJSON compose on", () => { describe("fromJSON compose on", () => {
function checkExample(x: RepoIdRegistry) { function checkExample(x: RepoIdRegistry) {
expect(fromJSON(toJSON(x))).toEqual(x); expect(fromJSON(toJSON(x))).toEqual(x);
expect(toJSON(fromJSON(toJSON(x)))).toEqual(toJSON(x)); expect(toJSON(fromJSON(toJSON(x)))).toEqual(toJSON(x));

View File

@ -2,19 +2,19 @@
import deepEqual from "lodash.isequal"; import deepEqual from "lodash.isequal";
import {Graph, type NodeAddressT} from "../../core/graph"; import {Graph, type NodeAddressT} from "../core/graph";
import type {Assets} from "../../webutil/assets"; import type {Assets} from "../webutil/assets";
import type {RepoId} from "../../core/repoId"; import type {RepoId} from "../core/repoId";
import {type EdgeEvaluator} from "../../analysis/pagerank"; import {type EdgeEvaluator} from "../analysis/pagerank";
import { import {
type PagerankNodeDecomposition, type PagerankNodeDecomposition,
type PagerankOptions, type PagerankOptions,
pagerank, pagerank,
} from "../../analysis/pagerank"; } from "../analysis/pagerank";
import {StaticAdapterSet, DynamicAdapterSet} from "../adapters/adapterSet"; import {StaticAdapterSet, DynamicAdapterSet} from "./adapters/adapterSet";
import type {WeightedTypes} from "../../analysis/weights"; import type {WeightedTypes} from "../analysis/weights";
import {weightsToEdgeEvaluator} from "../../analysis/weightsToEdgeEvaluator"; import {weightsToEdgeEvaluator} from "../analysis/weightsToEdgeEvaluator";
/* /*
This models the UI states of the credExplorer/App as a state machine. This models the UI states of the credExplorer/App as a state machine.

View File

@ -7,20 +7,20 @@ import {
type GraphWithAdapters, type GraphWithAdapters,
} from "./state"; } from "./state";
import {Graph, NodeAddress} from "../../core/graph"; import {Graph, NodeAddress} from "../core/graph";
import {Assets} from "../../webutil/assets"; import {Assets} from "../webutil/assets";
import {makeRepoId, type RepoId} from "../../core/repoId"; import {makeRepoId, type RepoId} from "../core/repoId";
import {type EdgeEvaluator} from "../../analysis/pagerank"; import {type EdgeEvaluator} from "../analysis/pagerank";
import type {WeightedTypes} from "../../analysis/weights"; import type {WeightedTypes} from "../analysis/weights";
import {defaultWeightsForAdapterSet} from "./weights/weights"; import {defaultWeightsForAdapterSet} from "./weights/weights";
import {StaticAdapterSet, DynamicAdapterSet} from "../adapters/adapterSet"; import {StaticAdapterSet, DynamicAdapterSet} from "./adapters/adapterSet";
import type { import type {
PagerankNodeDecomposition, PagerankNodeDecomposition,
PagerankOptions, PagerankOptions,
} from "../../analysis/pagerank"; } from "../analysis/pagerank";
import {staticAdapterSet} from "../../plugins/demo/appAdapter"; import {staticAdapterSet} from "../plugins/demo/appAdapter";
describe("app/credExplorer/state", () => { describe("explorer/state", () => {
function example(startingState: AppState) { function example(startingState: AppState) {
const stateContainer = {appState: startingState}; const stateContainer = {appState: startingState};
const getState = () => stateContainer.appState; const getState = () => stateContainer.appState;

View File

@ -3,7 +3,7 @@
import React from "react"; import React from "react";
import {WeightSlider, type Props as WeightSliderProps} from "./WeightSlider"; import {WeightSlider, type Props as WeightSliderProps} from "./WeightSlider";
import type {WeightedEdgeType} from "../../../analysis/weights"; import type {WeightedEdgeType} from "../../analysis/weights";
export class EdgeTypeConfig extends React.Component<{ export class EdgeTypeConfig extends React.Component<{
+weightedType: WeightedEdgeType, +weightedType: WeightedEdgeType,

View File

@ -5,11 +5,11 @@ import {shallow} from "enzyme";
import {WeightSlider} from "./WeightSlider"; import {WeightSlider} from "./WeightSlider";
import {EdgeTypeConfig, EdgeWeightSlider} from "./EdgeTypeConfig"; import {EdgeTypeConfig, EdgeWeightSlider} from "./EdgeTypeConfig";
import {assemblesEdgeType} from "../../../plugins/demo/declaration"; import {assemblesEdgeType} from "../../plugins/demo/declaration";
require("../../../webutil/testUtil").configureEnzyme(); require("../../webutil/testUtil").configureEnzyme();
describe("app/credExplorer/weights/EdgeTypeConfig", () => { describe("explorer/weights/EdgeTypeConfig", () => {
describe("EdgeTypeConfig", () => { describe("EdgeTypeConfig", () => {
function example() { function example() {
const onChange = jest.fn(); const onChange = jest.fn();

View File

@ -2,7 +2,7 @@
import React from "react"; import React from "react";
import {WeightSlider} from "./WeightSlider"; import {WeightSlider} from "./WeightSlider";
import type {WeightedNodeType} from "../../../analysis/weights"; import type {WeightedNodeType} from "../../analysis/weights";
export class NodeTypeConfig extends React.Component<{ export class NodeTypeConfig extends React.Component<{
+weightedType: WeightedNodeType, +weightedType: WeightedNodeType,

View File

@ -5,11 +5,11 @@ import {shallow} from "enzyme";
import {WeightSlider} from "./WeightSlider"; import {WeightSlider} from "./WeightSlider";
import {NodeTypeConfig} from "./NodeTypeConfig"; import {NodeTypeConfig} from "./NodeTypeConfig";
import {inserterNodeType} from "../../../plugins/demo/declaration"; import {inserterNodeType} from "../../plugins/demo/declaration";
require("../../../webutil/testUtil").configureEnzyme(); require("../../webutil/testUtil").configureEnzyme();
describe("app/credExplorer/weights/NodeTypeConfig", () => { describe("explorer/weights/NodeTypeConfig", () => {
describe("NodeTypeConfig", () => { describe("NodeTypeConfig", () => {
function example() { function example() {
const onChange = jest.fn(); const onChange = jest.fn();

View File

@ -2,16 +2,16 @@
import React from "react"; import React from "react";
import deepEqual from "lodash.isequal"; import deepEqual from "lodash.isequal";
import * as MapUtil from "../../../util/map"; import * as MapUtil from "../../util/map";
import {NodeTypeConfig} from "./NodeTypeConfig"; import {NodeTypeConfig} from "./NodeTypeConfig";
import {EdgeTypeConfig} from "./EdgeTypeConfig"; import {EdgeTypeConfig} from "./EdgeTypeConfig";
import {StaticAppAdapter} from "../../adapters/appAdapter"; import {StaticAppAdapter} from "../adapters/appAdapter";
import {styledVariable} from "./EdgeTypeConfig"; import {styledVariable} from "./EdgeTypeConfig";
import type { import type {
WeightedTypes, WeightedTypes,
WeightedEdgeType, WeightedEdgeType,
WeightedNodeType, WeightedNodeType,
} from "../../../analysis/weights"; } from "../../analysis/weights";
export type Props = {| export type Props = {|
+adapter: StaticAppAdapter, +adapter: StaticAppAdapter,

View File

@ -6,24 +6,24 @@ import {PluginWeightConfig} from "./PluginWeightConfig";
import { import {
inserterNodeType, inserterNodeType,
assemblesEdgeType, assemblesEdgeType,
} from "../../../plugins/demo/declaration"; } from "../../plugins/demo/declaration";
import {FactorioStaticAdapter} from "../../../plugins/demo/appAdapter"; import {FactorioStaticAdapter} from "../../plugins/demo/appAdapter";
import { import {
fallbackNodeType, fallbackNodeType,
fallbackEdgeType, fallbackEdgeType,
} from "../../../analysis/fallbackDeclaration"; } from "../../analysis/fallbackDeclaration";
import {NodeTypeConfig} from "./NodeTypeConfig"; import {NodeTypeConfig} from "./NodeTypeConfig";
import {EdgeTypeConfig} from "./EdgeTypeConfig"; import {EdgeTypeConfig} from "./EdgeTypeConfig";
import { import {
type WeightedTypes, type WeightedTypes,
defaultWeightedNodeType, defaultWeightedNodeType,
defaultWeightedEdgeType, defaultWeightedEdgeType,
} from "../../../analysis/weights"; } from "../../analysis/weights";
import {defaultWeightsForAdapter} from "./weights"; import {defaultWeightsForAdapter} from "./weights";
require("../../../webutil/testUtil").configureEnzyme(); require("../../webutil/testUtil").configureEnzyme();
describe("app/credExplorer/weights/PluginWeightConfig", () => { describe("explorer/weights/PluginWeightConfig", () => {
describe("PluginWeightConfig", () => { describe("PluginWeightConfig", () => {
function example() { function example() {
const onChange = jest.fn(); const onChange = jest.fn();

View File

@ -1,13 +1,13 @@
// @flow // @flow
import React from "react"; import React from "react";
import * as NullUtil from "../../../util/null"; import * as NullUtil from "../../util/null";
import * as MapUtil from "../../../util/map"; import * as MapUtil from "../../util/map";
import type {StaticAdapterSet} from "../../adapters/adapterSet"; import type {StaticAdapterSet} from "../adapters/adapterSet";
import type {WeightedTypes} from "../../../analysis/weights"; import type {WeightedTypes} from "../../analysis/weights";
import {PluginWeightConfig} from "./PluginWeightConfig"; import {PluginWeightConfig} from "./PluginWeightConfig";
import {FALLBACK_NAME} from "../../../analysis/fallbackDeclaration"; import {FALLBACK_NAME} from "../../analysis/fallbackDeclaration";
type Props = {| type Props = {|
+adapters: StaticAdapterSet, +adapters: StaticAdapterSet,

View File

@ -6,15 +6,15 @@ import {PluginWeightConfig} from "./PluginWeightConfig";
import { import {
FactorioStaticAdapter, FactorioStaticAdapter,
staticAdapterSet, staticAdapterSet,
} from "../../../plugins/demo/appAdapter"; } from "../../plugins/demo/appAdapter";
import {inserterNodeType} from "../../../plugins/demo/declaration"; import {inserterNodeType} from "../../plugins/demo/declaration";
import {FALLBACK_NAME} from "../../../analysis/fallbackDeclaration"; import {FALLBACK_NAME} from "../../analysis/fallbackDeclaration";
import {defaultWeightsForAdapterSet, defaultWeightsForAdapter} from "./weights"; import {defaultWeightsForAdapterSet, defaultWeightsForAdapter} from "./weights";
import {WeightConfig} from "./WeightConfig"; import {WeightConfig} from "./WeightConfig";
require("../../../webutil/testUtil").configureEnzyme(); require("../../webutil/testUtil").configureEnzyme();
describe("app/credExplorer/weights/WeightConfig", () => { describe("explorer/weights/WeightConfig", () => {
describe("WeightConfig", () => { describe("WeightConfig", () => {
function example() { function example() {
const onChange = jest.fn(); const onChange = jest.fn();

View File

@ -5,9 +5,9 @@ import {shallow} from "enzyme";
import {WeightSlider, formatWeight} from "./WeightSlider"; import {WeightSlider, formatWeight} from "./WeightSlider";
require("../../../webutil/testUtil").configureEnzyme(); require("../../webutil/testUtil").configureEnzyme();
describe("app/credExplorer/weights/WeightSlider", () => { describe("explorer/weights/WeightSlider", () => {
describe("WeightSlider", () => { describe("WeightSlider", () => {
function example() { function example() {
const onChange = jest.fn(); const onChange = jest.fn();

View File

@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`app/credExplorer/weights/EdgeTypeConfig EdgeWeightSlider renders the name along with some Greek characters 1`] = ` exports[`explorer/weights/EdgeTypeConfig EdgeWeightSlider renders the name along with some Greek characters 1`] = `
<React.Fragment> <React.Fragment>
<span <span
style={ style={

View File

@ -4,9 +4,9 @@ import {
type WeightedTypes, type WeightedTypes,
combineWeights, combineWeights,
defaultWeightsForDeclaration, defaultWeightsForDeclaration,
} from "../../../analysis/weights"; } from "../../analysis/weights";
import type {StaticAppAdapter} from "../../adapters/appAdapter"; import type {StaticAppAdapter} from "../adapters/appAdapter";
import type {StaticAdapterSet} from "../../adapters/adapterSet"; import type {StaticAdapterSet} from "../adapters/adapterSet";
export function defaultWeightsForAdapter( export function defaultWeightsForAdapter(
adapter: StaticAppAdapter adapter: StaticAppAdapter

View File

@ -4,14 +4,14 @@ import {defaultWeightsForAdapter, defaultWeightsForAdapterSet} from "./weights";
import { import {
defaultWeightsForDeclaration, defaultWeightsForDeclaration,
combineWeights, combineWeights,
} from "../../../analysis/weights"; } from "../../analysis/weights";
import {declaration} from "../../../plugins/demo/declaration"; import {declaration} from "../../plugins/demo/declaration";
import { import {
FactorioStaticAdapter, FactorioStaticAdapter,
staticAdapterSet, staticAdapterSet,
} from "../../../plugins/demo/appAdapter"; } from "../../plugins/demo/appAdapter";
describe("app/credExplorer/weights/weights", () => { describe("explorer/weights/weights", () => {
describe("defaultWeightsForAdapter", () => { describe("defaultWeightsForAdapter", () => {
it("works on the demo adapter", () => { it("works on the demo adapter", () => {
const adapter = new FactorioStaticAdapter(); const adapter = new FactorioStaticAdapter();

View File

@ -5,8 +5,8 @@ import {declaration} from "./declaration";
import type { import type {
StaticAppAdapter, StaticAppAdapter,
DynamicAppAdapter, DynamicAppAdapter,
} from "../../app/adapters/appAdapter"; } from "../../explorer/adapters/appAdapter";
import {StaticAdapterSet} from "../../app/adapters/adapterSet"; import {StaticAdapterSet} from "../../explorer/adapters/adapterSet";
import {Assets} from "../../webutil/assets"; import {Assets} from "../../webutil/assets";
import {type RepoId, makeRepoId} from "../../core/repoId"; import {type RepoId, makeRepoId} from "../../core/repoId";
import {NodeAddress, type NodeAddressT} from "../../core/graph"; import {NodeAddress, type NodeAddressT} from "../../core/graph";
@ -17,7 +17,7 @@ export class FactorioStaticAdapter implements StaticAppAdapter {
declaration(): PluginDeclaration { declaration(): PluginDeclaration {
return declaration; return declaration;
} }
async load(assets: Assets, repoId: RepoId): Promise<FactorioDynamicAdapter> { async load(assets: Assets, repoId: RepoId) {
const result: FactorioDynamicAdapter = new FactorioDynamicAdapter(); const result: FactorioDynamicAdapter = new FactorioDynamicAdapter();
if (this.loadingMock) { if (this.loadingMock) {
return this.loadingMock(assets, repoId).then(() => result); return this.loadingMock(assets, repoId).then(() => result);
@ -33,7 +33,7 @@ export class FactorioDynamicAdapter implements DynamicAppAdapter {
nodeDescription(x: NodeAddressT) { nodeDescription(x: NodeAddressT) {
return `[factorio]: ${NodeAddress.toString(x)}`; return `[factorio]: ${NodeAddress.toString(x)}`;
} }
static() { static(): FactorioStaticAdapter {
return new FactorioStaticAdapter(); return new FactorioStaticAdapter();
} }
} }

View File

@ -2,7 +2,7 @@
import type { import type {
StaticAppAdapter as IStaticAppAdapter, StaticAppAdapter as IStaticAppAdapter,
DynamicAppAdapter as IDynamicAppAdapter, DynamicAppAdapter as IDynamicAppAdapter,
} from "../../app/adapters/appAdapter"; } from "../../explorer/adapters/appAdapter";
import {Graph} from "../../core/graph"; import {Graph} from "../../core/graph";
import * as N from "./nodes"; import * as N from "./nodes";
import {description} from "./render"; import {description} from "./render";

View File

@ -4,7 +4,7 @@ import pako from "pako";
import type { import type {
StaticAppAdapter as IStaticAppAdapter, StaticAppAdapter as IStaticAppAdapter,
DynamicAppAdapter as IDynamicAppAdapter, DynamicAppAdapter as IDynamicAppAdapter,
} from "../../app/adapters/appAdapter"; } from "../../explorer/adapters/appAdapter";
import {type Graph, NodeAddress} from "../../core/graph"; import {type Graph, NodeAddress} from "../../core/graph";
import {createGraph} from "./createGraph"; import {createGraph} from "./createGraph";
import * as N from "./nodes"; import * as N from "./nodes";