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:
parent
c997f4e1ec
commit
604db14879
|
@ -38,7 +38,7 @@ const routeData /*: $ReadOnlyArray<RouteDatum> */ = [
|
|||
path: "/prototype/",
|
||||
contents: {
|
||||
type: "PAGE",
|
||||
component: () => require("./credExplorer/App").default,
|
||||
component: () => require("../explorer/App").default,
|
||||
},
|
||||
title: "SourceCred prototype",
|
||||
navTitle: "Prototype",
|
||||
|
|
|
@ -6,7 +6,7 @@ import stringify from "json-stable-stringify";
|
|||
import mkdirp from "mkdirp";
|
||||
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 dedent from "../util/dedent";
|
||||
import type {Command} from "./command";
|
||||
|
|
|
@ -7,7 +7,7 @@ import tmp from "tmp";
|
|||
import {run} from "./testUtil";
|
||||
import load, {help} from "./load";
|
||||
|
||||
import * as RepoIdRegistry from "../app/credExplorer/repoIdRegistry";
|
||||
import * as RepoIdRegistry from "../explorer/repoIdRegistry";
|
||||
import {stringToRepoId} from "../core/repoId";
|
||||
|
||||
jest.mock("../tools/execDependencyGraph", () => jest.fn());
|
||||
|
|
|
@ -2,25 +2,25 @@
|
|||
|
||||
import React from "react";
|
||||
|
||||
import type {Assets} from "../../webutil/assets";
|
||||
import type {LocalStore} from "../../webutil/localStore";
|
||||
import CheckedLocalStore from "../../webutil/checkedLocalStore";
|
||||
import BrowserLocalStore from "../../webutil/browserLocalStore";
|
||||
import Link from "../../webutil/Link";
|
||||
import type {Assets} from "../webutil/assets";
|
||||
import type {LocalStore} from "../webutil/localStore";
|
||||
import CheckedLocalStore from "../webutil/checkedLocalStore";
|
||||
import BrowserLocalStore from "../webutil/browserLocalStore";
|
||||
import Link from "../webutil/Link";
|
||||
|
||||
import {defaultStaticAdapters} from "../adapters/defaultPlugins";
|
||||
import {defaultStaticAdapters} from "./adapters/defaultPlugins";
|
||||
import {PagerankTable} from "./pagerankTable/Table";
|
||||
import type {WeightedTypes} from "../../analysis/weights";
|
||||
import type {WeightedTypes} from "../analysis/weights";
|
||||
import {defaultWeightsForAdapterSet} from "./weights/weights";
|
||||
import RepositorySelect from "./RepositorySelect";
|
||||
import {Prefix as GithubPrefix} from "../../plugins/github/nodes";
|
||||
import {Prefix as GithubPrefix} from "../plugins/github/nodes";
|
||||
import {
|
||||
createStateTransitionMachine,
|
||||
type AppState,
|
||||
type StateTransitionMachineInterface,
|
||||
uninitializedState,
|
||||
} from "./state";
|
||||
import {StaticAdapterSet} from "../adapters/adapterSet";
|
||||
import {StaticAdapterSet} from "./adapters/adapterSet";
|
||||
|
||||
export default class AppPage extends React.Component<{|+assets: Assets|}> {
|
||||
static _LOCAL_STORE = new CheckedLocalStore(
|
|
@ -3,23 +3,23 @@
|
|||
import React from "react";
|
||||
import {shallow} from "enzyme";
|
||||
|
||||
import {Graph} from "../../core/graph";
|
||||
import {makeRepoId} from "../../core/repoId";
|
||||
import {Assets} from "../../webutil/assets";
|
||||
import testLocalStore from "../../webutil/testLocalStore";
|
||||
import {DynamicAdapterSet, StaticAdapterSet} from "../adapters/adapterSet";
|
||||
import {FactorioStaticAdapter} from "../../plugins/demo/appAdapter";
|
||||
import {Graph} from "../core/graph";
|
||||
import {makeRepoId} from "../core/repoId";
|
||||
import {Assets} from "../webutil/assets";
|
||||
import testLocalStore from "../webutil/testLocalStore";
|
||||
import {DynamicAdapterSet, StaticAdapterSet} from "./adapters/adapterSet";
|
||||
import {FactorioStaticAdapter} from "../plugins/demo/appAdapter";
|
||||
import {defaultWeightsForAdapter} from "./weights/weights";
|
||||
|
||||
import RepositorySelect from "./RepositorySelect";
|
||||
import {PagerankTable} from "./pagerankTable/Table";
|
||||
import {createApp, LoadingIndicator} from "./App";
|
||||
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() {
|
||||
let setState, getState;
|
||||
const setRepoId = jest.fn();
|
|
@ -4,12 +4,12 @@ import React, {type Node} from "react";
|
|||
import sortBy from "lodash.sortby";
|
||||
import deepEqual from "lodash.isequal";
|
||||
|
||||
import * as NullUtil from "../../util/null";
|
||||
import type {LocalStore} from "../../webutil/localStore";
|
||||
import type {Assets} from "../../webutil/assets";
|
||||
import * as NullUtil from "../util/null";
|
||||
import type {LocalStore} from "../webutil/localStore";
|
||||
import type {Assets} from "../webutil/assets";
|
||||
|
||||
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 type Status =
|
|
@ -2,8 +2,8 @@
|
|||
import React from "react";
|
||||
import {shallow, mount} from "enzyme";
|
||||
|
||||
import * as NullUtil from "../../util/null";
|
||||
import testLocalStore from "../../webutil/testLocalStore";
|
||||
import * as NullUtil from "../util/null";
|
||||
import testLocalStore from "../webutil/testLocalStore";
|
||||
import RepositorySelect, {
|
||||
PureRepositorySelect,
|
||||
LocalStoreRepositorySelect,
|
||||
|
@ -11,19 +11,19 @@ import RepositorySelect, {
|
|||
type Status,
|
||||
REPO_ID_KEY,
|
||||
} from "./RepositorySelect";
|
||||
import {Assets} from "../../webutil/assets";
|
||||
import {Assets} from "../webutil/assets";
|
||||
|
||||
import {
|
||||
toJSON,
|
||||
type RepoIdRegistry,
|
||||
REPO_ID_REGISTRY_API,
|
||||
} from "./repoIdRegistry";
|
||||
import {makeRepoId} from "../../core/repoId";
|
||||
import {makeRepoId} from "../core/repoId";
|
||||
|
||||
require("../../webutil/testUtil").configureEnzyme();
|
||||
require("../../webutil/testUtil").configureAphrodite();
|
||||
require("../webutil/testUtil").configureEnzyme();
|
||||
require("../webutil/testUtil").configureAphrodite();
|
||||
|
||||
describe("app/credExplorer/RepositorySelect", () => {
|
||||
describe("explorer/RepositorySelect", () => {
|
||||
beforeEach(() => {
|
||||
fetch.resetMocks();
|
||||
});
|
|
@ -12,7 +12,7 @@ import {
|
|||
import {Assets} from "../../webutil/assets";
|
||||
import {makeRepoId} from "../../core/repoId";
|
||||
|
||||
describe("app/adapters/adapterSet", () => {
|
||||
describe("explorer/adapters/adapterSet", () => {
|
||||
describe("StaticAdapterSet", () => {
|
||||
function example() {
|
||||
const x = new FactorioStaticAdapter();
|
|
@ -1,10 +1,7 @@
|
|||
// @flow
|
||||
|
||||
import {fallbackDeclaration} from "../../analysis/fallbackDeclaration";
|
||||
import type {
|
||||
StaticAppAdapter,
|
||||
DynamicAppAdapter,
|
||||
} from "../../app/adapters/appAdapter";
|
||||
import type {StaticAppAdapter, DynamicAppAdapter} from "./appAdapter";
|
||||
import {Assets} from "../../webutil/assets";
|
||||
import {type RepoId} from "../../core/repoId";
|
||||
import {Graph, NodeAddress, type NodeAddressT} from "../../core/graph";
|
||||
|
@ -28,7 +25,7 @@ export class FallbackDynamicAdapter implements DynamicAppAdapter {
|
|||
return `[fallback]: ${NodeAddress.toString(x)}`;
|
||||
}
|
||||
|
||||
static() {
|
||||
static(): FallbackStaticAdapter {
|
||||
return new FallbackStaticAdapter();
|
||||
}
|
||||
}
|
|
@ -1,9 +1,9 @@
|
|||
// @flow
|
||||
|
||||
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 {aggregateFlat, type FlatAggregation, aggregationKey} from "./aggregate";
|
|
@ -3,9 +3,9 @@
|
|||
import React from "react";
|
||||
import {shallow} from "enzyme";
|
||||
|
||||
import * as NullUtil from "../../../util/null";
|
||||
import {NodeAddress, EdgeAddress} from "../../../core/graph";
|
||||
import type {EdgeType, NodeType} from "../../../analysis/types";
|
||||
import * as NullUtil from "../../util/null";
|
||||
import {NodeAddress, EdgeAddress} from "../../core/graph";
|
||||
import type {EdgeType, NodeType} from "../../analysis/types";
|
||||
import {
|
||||
AggregationRowList,
|
||||
AggregationRow,
|
||||
|
@ -16,11 +16,11 @@ import {Badge} from "./shared";
|
|||
import {example} from "./sharedTestUtils";
|
||||
import {aggregateFlat, type FlatAggregation} from "./aggregate";
|
||||
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", () => {
|
||||
it("instantiates AggregationRows for each aggregation", async () => {
|
||||
const {adapters, pnd} = await example();
|
|
@ -1,12 +1,12 @@
|
|||
// @flow
|
||||
|
||||
import React from "react";
|
||||
import * as NullUtil from "../../../util/null";
|
||||
import * as NullUtil from "../../util/null";
|
||||
|
||||
import type {NodeAddressT} from "../../../core/graph";
|
||||
import type {Connection} from "../../../core/attribution/graphToMarkovChain";
|
||||
import type {ScoredConnection} from "../../../analysis/pagerankNodeDecomposition";
|
||||
import {DynamicAdapterSet} from "../../adapters/adapterSet";
|
||||
import type {NodeAddressT} from "../../core/graph";
|
||||
import type {Connection} from "../../core/attribution/graphToMarkovChain";
|
||||
import type {ScoredConnection} from "../../analysis/pagerankNodeDecomposition";
|
||||
import {DynamicAdapterSet} from "../adapters/adapterSet";
|
||||
import {TableRow} from "./TableRow";
|
||||
import {NodeRow} from "./Node";
|
||||
|
|
@ -2,18 +2,18 @@
|
|||
|
||||
import React from "react";
|
||||
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 {example} from "./sharedTestUtils";
|
||||
import {TableRow} from "./TableRow";
|
||||
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", () => {
|
||||
async function setup(maxEntriesPerList: number = 100000) {
|
||||
const {adapters, pnd} = await example();
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
import React from "react";
|
||||
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 {nodeDescription, type SharedProps} from "./shared";
|
|
@ -3,20 +3,20 @@
|
|||
import React from "react";
|
||||
import {shallow} from "enzyme";
|
||||
import sortBy from "lodash.sortby";
|
||||
import * as NullUtil from "../../../util/null";
|
||||
import * as NullUtil from "../../util/null";
|
||||
import {TableRow} from "./TableRow";
|
||||
import {AggregationRowList} from "./Aggregation";
|
||||
|
||||
import type {NodeAddressT} from "../../../core/graph";
|
||||
import type {NodeAddressT} from "../../core/graph";
|
||||
|
||||
import {nodeDescription} from "./shared";
|
||||
import {example} from "./sharedTestUtils";
|
||||
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", () => {
|
||||
function sortedByScore(nodes: $ReadOnlyArray<NodeAddressT>, pnd) {
|
||||
return sortBy(nodes, (node) => -NullUtil.get(pnd.get(node)).score);
|
|
@ -2,14 +2,14 @@
|
|||
|
||||
import React from "react";
|
||||
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 {PagerankNodeDecomposition} from "../../../analysis/pagerankNodeDecomposition";
|
||||
import {DynamicAdapterSet} from "../../adapters/adapterSet";
|
||||
import type {DynamicAppAdapter} from "../../adapters/appAdapter";
|
||||
import {FALLBACK_NAME} from "../../../analysis/fallbackDeclaration";
|
||||
import type {WeightedTypes} from "../../../analysis/weights";
|
||||
import {type NodeAddressT, NodeAddress} from "../../core/graph";
|
||||
import type {PagerankNodeDecomposition} from "../../analysis/pagerankNodeDecomposition";
|
||||
import {DynamicAdapterSet} from "../adapters/adapterSet";
|
||||
import type {DynamicAppAdapter} from "../adapters/appAdapter";
|
||||
import {FALLBACK_NAME} from "../../analysis/fallbackDeclaration";
|
||||
import type {WeightedTypes} from "../../analysis/weights";
|
||||
import {WeightConfig} from "../weights/WeightConfig";
|
||||
|
||||
import {NodeRowList} from "./Node";
|
|
@ -3,17 +3,17 @@
|
|||
import React from "react";
|
||||
import {shallow} from "enzyme";
|
||||
|
||||
import {NodeAddress, type NodeAddressT} from "../../../core/graph";
|
||||
import {NodeAddress, type NodeAddressT} from "../../core/graph";
|
||||
|
||||
import {PagerankTable} from "./Table";
|
||||
import {example, COLUMNS} from "./sharedTestUtils";
|
||||
import {NodeRowList} from "./Node";
|
||||
import {WeightConfig} from "../weights/WeightConfig";
|
||||
import {defaultWeightsForAdapter} from "../weights/weights";
|
||||
import {FactorioStaticAdapter} from "../../../plugins/demo/appAdapter";
|
||||
import {FactorioStaticAdapter} from "../../plugins/demo/appAdapter";
|
||||
|
||||
require("../../../webutil/testUtil").configureEnzyme();
|
||||
describe("app/credExplorer/pagerankTable/Table", () => {
|
||||
require("../../webutil/testUtil").configureEnzyme();
|
||||
describe("explorer/pagerankTable/Table", () => {
|
||||
describe("PagerankTable", () => {
|
||||
async function setup(defaultNodeFilter?: NodeAddressT) {
|
||||
const {pnd, adapters, weightedTypes} = await example();
|
|
@ -5,9 +5,9 @@ import {shallow} from "enzyme";
|
|||
import {TableRow, PaddingRow} from "./TableRow";
|
||||
|
||||
import {COLUMNS} from "./sharedTestUtils";
|
||||
require("../../../webutil/testUtil").configureEnzyme();
|
||||
require("../../webutil/testUtil").configureEnzyme();
|
||||
|
||||
describe("app/credExplorer/pagerankTable/TableRow", () => {
|
||||
describe("explorer/pagerankTable/TableRow", () => {
|
||||
function example() {
|
||||
return shallow(
|
||||
<TableRow
|
|
@ -1,8 +1,8 @@
|
|||
// 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 [
|
||||
Object {
|
||||
"style": undefined,
|
|
@ -1,6 +1,6 @@
|
|||
// 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 {
|
||||
"buttonStyle": Object {
|
||||
"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 {
|
||||
"buttonStyle": Object {
|
||||
"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 {
|
||||
"buttonStyle": Object {
|
||||
"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 {
|
||||
"buttonStyle": Object {
|
||||
"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 {
|
||||
"buttonStyle": Object {
|
||||
"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 {
|
||||
"buttonStyle": Object {
|
||||
"marginLeft": 35,
|
|
@ -2,10 +2,10 @@
|
|||
|
||||
import sortBy from "lodash.sortby";
|
||||
import stringify from "json-stable-stringify";
|
||||
import * as MapUtil from "../../../util/map";
|
||||
import {NodeTrie, EdgeTrie} from "../../../core/trie";
|
||||
import type {EdgeType, NodeType} from "../../../analysis/types";
|
||||
import type {ScoredConnection} from "../../../analysis/pagerankNodeDecomposition";
|
||||
import * as MapUtil from "../../util/map";
|
||||
import {NodeTrie, EdgeTrie} from "../../core/trie";
|
||||
import type {EdgeType, NodeType} from "../../analysis/types";
|
||||
import type {ScoredConnection} from "../../analysis/pagerankNodeDecomposition";
|
||||
|
||||
// Sorted by descending `summary.score`
|
||||
export type FlatAggregations = $ReadOnlyArray<FlatAggregation>;
|
|
@ -1,7 +1,7 @@
|
|||
// @flow
|
||||
|
||||
import {EdgeAddress, NodeAddress} from "../../../core/graph";
|
||||
import * as NullUtil from "../../../util/null";
|
||||
import {EdgeAddress, NodeAddress} from "../../core/graph";
|
||||
import * as NullUtil from "../../util/null";
|
||||
import {
|
||||
aggregateByNodeType,
|
||||
aggregateByConnectionType,
|
||||
|
@ -10,7 +10,7 @@ import {
|
|||
aggregationKey,
|
||||
} from "./aggregate";
|
||||
|
||||
describe("app/credExplorer/pagerankTable/aggregate", () => {
|
||||
describe("explorer/pagerankTable/aggregate", () => {
|
||||
// TODO: If making major modifications to these tests, consider switching
|
||||
// from the hand-maintained connections and types, and instead use the demo
|
||||
// adadpters from app/adapters/demoAdapters
|
|
@ -5,11 +5,11 @@ import {
|
|||
type EdgeAddressT,
|
||||
type NodeAddressT,
|
||||
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(
|
||||
address: NodeAddressT,
|
|
@ -1,8 +1,8 @@
|
|||
// @flow
|
||||
|
||||
import {pagerank} from "../../../analysis/pagerank";
|
||||
import {pagerank} from "../../analysis/pagerank";
|
||||
import {defaultWeightsForAdapterSet} from "../weights/weights";
|
||||
import {dynamicAdapterSet} from "../../../plugins/demo/appAdapter";
|
||||
import {dynamicAdapterSet} from "../../plugins/demo/appAdapter";
|
||||
|
||||
export const COLUMNS = () => ["Description", "", "Cred"];
|
||||
|
|
@ -4,8 +4,8 @@
|
|||
// and is read by the RepositorySelect component
|
||||
// (src/app/credExplorer/RepositorySelect.js)
|
||||
import deepEqual from "lodash.isequal";
|
||||
import {toCompat, fromCompat, type Compatible} from "../../util/compat";
|
||||
import type {RepoId} from "../../core/repoId";
|
||||
import {toCompat, fromCompat, type Compatible} from "../util/compat";
|
||||
import type {RepoId} from "../core/repoId";
|
||||
|
||||
export const REPO_ID_REGISTRY_FILE = "repositoryRegistry.json";
|
||||
export const REPO_ID_REGISTRY_API = "/api/v1/data/repositoryRegistry.json";
|
|
@ -8,10 +8,10 @@ import {
|
|||
type RepoIdRegistry,
|
||||
} from "./repoIdRegistry";
|
||||
|
||||
import {makeRepoId} from "../../core/repoId";
|
||||
import {makeRepoId} from "../core/repoId";
|
||||
|
||||
describe("app/credExplorer/repoIdRegistry", () => {
|
||||
describe("to/fromJSON compose on", () => {
|
||||
describe("explorer/repoIdRegistry", () => {
|
||||
describe("fromJSON compose on", () => {
|
||||
function checkExample(x: RepoIdRegistry) {
|
||||
expect(fromJSON(toJSON(x))).toEqual(x);
|
||||
expect(toJSON(fromJSON(toJSON(x)))).toEqual(toJSON(x));
|
|
@ -2,19 +2,19 @@
|
|||
|
||||
import deepEqual from "lodash.isequal";
|
||||
|
||||
import {Graph, type NodeAddressT} from "../../core/graph";
|
||||
import type {Assets} from "../../webutil/assets";
|
||||
import type {RepoId} from "../../core/repoId";
|
||||
import {type EdgeEvaluator} from "../../analysis/pagerank";
|
||||
import {Graph, type NodeAddressT} from "../core/graph";
|
||||
import type {Assets} from "../webutil/assets";
|
||||
import type {RepoId} from "../core/repoId";
|
||||
import {type EdgeEvaluator} from "../analysis/pagerank";
|
||||
import {
|
||||
type PagerankNodeDecomposition,
|
||||
type PagerankOptions,
|
||||
pagerank,
|
||||
} from "../../analysis/pagerank";
|
||||
} from "../analysis/pagerank";
|
||||
|
||||
import {StaticAdapterSet, DynamicAdapterSet} from "../adapters/adapterSet";
|
||||
import type {WeightedTypes} from "../../analysis/weights";
|
||||
import {weightsToEdgeEvaluator} from "../../analysis/weightsToEdgeEvaluator";
|
||||
import {StaticAdapterSet, DynamicAdapterSet} from "./adapters/adapterSet";
|
||||
import type {WeightedTypes} from "../analysis/weights";
|
||||
import {weightsToEdgeEvaluator} from "../analysis/weightsToEdgeEvaluator";
|
||||
|
||||
/*
|
||||
This models the UI states of the credExplorer/App as a state machine.
|
|
@ -7,20 +7,20 @@ import {
|
|||
type GraphWithAdapters,
|
||||
} from "./state";
|
||||
|
||||
import {Graph, NodeAddress} from "../../core/graph";
|
||||
import {Assets} from "../../webutil/assets";
|
||||
import {makeRepoId, type RepoId} from "../../core/repoId";
|
||||
import {type EdgeEvaluator} from "../../analysis/pagerank";
|
||||
import type {WeightedTypes} from "../../analysis/weights";
|
||||
import {Graph, NodeAddress} from "../core/graph";
|
||||
import {Assets} from "../webutil/assets";
|
||||
import {makeRepoId, type RepoId} from "../core/repoId";
|
||||
import {type EdgeEvaluator} from "../analysis/pagerank";
|
||||
import type {WeightedTypes} from "../analysis/weights";
|
||||
import {defaultWeightsForAdapterSet} from "./weights/weights";
|
||||
import {StaticAdapterSet, DynamicAdapterSet} from "../adapters/adapterSet";
|
||||
import {StaticAdapterSet, DynamicAdapterSet} from "./adapters/adapterSet";
|
||||
import type {
|
||||
PagerankNodeDecomposition,
|
||||
PagerankOptions,
|
||||
} from "../../analysis/pagerank";
|
||||
import {staticAdapterSet} from "../../plugins/demo/appAdapter";
|
||||
} from "../analysis/pagerank";
|
||||
import {staticAdapterSet} from "../plugins/demo/appAdapter";
|
||||
|
||||
describe("app/credExplorer/state", () => {
|
||||
describe("explorer/state", () => {
|
||||
function example(startingState: AppState) {
|
||||
const stateContainer = {appState: startingState};
|
||||
const getState = () => stateContainer.appState;
|
|
@ -3,7 +3,7 @@
|
|||
import React from "react";
|
||||
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<{
|
||||
+weightedType: WeightedEdgeType,
|
|
@ -5,11 +5,11 @@ import {shallow} from "enzyme";
|
|||
|
||||
import {WeightSlider} from "./WeightSlider";
|
||||
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", () => {
|
||||
function example() {
|
||||
const onChange = jest.fn();
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
import React from "react";
|
||||
import {WeightSlider} from "./WeightSlider";
|
||||
import type {WeightedNodeType} from "../../../analysis/weights";
|
||||
import type {WeightedNodeType} from "../../analysis/weights";
|
||||
|
||||
export class NodeTypeConfig extends React.Component<{
|
||||
+weightedType: WeightedNodeType,
|
|
@ -5,11 +5,11 @@ import {shallow} from "enzyme";
|
|||
|
||||
import {WeightSlider} from "./WeightSlider";
|
||||
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", () => {
|
||||
function example() {
|
||||
const onChange = jest.fn();
|
|
@ -2,16 +2,16 @@
|
|||
|
||||
import React from "react";
|
||||
import deepEqual from "lodash.isequal";
|
||||
import * as MapUtil from "../../../util/map";
|
||||
import * as MapUtil from "../../util/map";
|
||||
import {NodeTypeConfig} from "./NodeTypeConfig";
|
||||
import {EdgeTypeConfig} from "./EdgeTypeConfig";
|
||||
import {StaticAppAdapter} from "../../adapters/appAdapter";
|
||||
import {StaticAppAdapter} from "../adapters/appAdapter";
|
||||
import {styledVariable} from "./EdgeTypeConfig";
|
||||
import type {
|
||||
WeightedTypes,
|
||||
WeightedEdgeType,
|
||||
WeightedNodeType,
|
||||
} from "../../../analysis/weights";
|
||||
} from "../../analysis/weights";
|
||||
|
||||
export type Props = {|
|
||||
+adapter: StaticAppAdapter,
|
|
@ -6,24 +6,24 @@ import {PluginWeightConfig} from "./PluginWeightConfig";
|
|||
import {
|
||||
inserterNodeType,
|
||||
assemblesEdgeType,
|
||||
} from "../../../plugins/demo/declaration";
|
||||
import {FactorioStaticAdapter} from "../../../plugins/demo/appAdapter";
|
||||
} from "../../plugins/demo/declaration";
|
||||
import {FactorioStaticAdapter} from "../../plugins/demo/appAdapter";
|
||||
import {
|
||||
fallbackNodeType,
|
||||
fallbackEdgeType,
|
||||
} from "../../../analysis/fallbackDeclaration";
|
||||
} from "../../analysis/fallbackDeclaration";
|
||||
import {NodeTypeConfig} from "./NodeTypeConfig";
|
||||
import {EdgeTypeConfig} from "./EdgeTypeConfig";
|
||||
import {
|
||||
type WeightedTypes,
|
||||
defaultWeightedNodeType,
|
||||
defaultWeightedEdgeType,
|
||||
} from "../../../analysis/weights";
|
||||
} from "../../analysis/weights";
|
||||
import {defaultWeightsForAdapter} from "./weights";
|
||||
|
||||
require("../../../webutil/testUtil").configureEnzyme();
|
||||
require("../../webutil/testUtil").configureEnzyme();
|
||||
|
||||
describe("app/credExplorer/weights/PluginWeightConfig", () => {
|
||||
describe("explorer/weights/PluginWeightConfig", () => {
|
||||
describe("PluginWeightConfig", () => {
|
||||
function example() {
|
||||
const onChange = jest.fn();
|
|
@ -1,13 +1,13 @@
|
|||
// @flow
|
||||
|
||||
import React from "react";
|
||||
import * as NullUtil from "../../../util/null";
|
||||
import * as MapUtil from "../../../util/map";
|
||||
import * as NullUtil from "../../util/null";
|
||||
import * as MapUtil from "../../util/map";
|
||||
|
||||
import type {StaticAdapterSet} from "../../adapters/adapterSet";
|
||||
import type {WeightedTypes} from "../../../analysis/weights";
|
||||
import type {StaticAdapterSet} from "../adapters/adapterSet";
|
||||
import type {WeightedTypes} from "../../analysis/weights";
|
||||
import {PluginWeightConfig} from "./PluginWeightConfig";
|
||||
import {FALLBACK_NAME} from "../../../analysis/fallbackDeclaration";
|
||||
import {FALLBACK_NAME} from "../../analysis/fallbackDeclaration";
|
||||
|
||||
type Props = {|
|
||||
+adapters: StaticAdapterSet,
|
|
@ -6,15 +6,15 @@ import {PluginWeightConfig} from "./PluginWeightConfig";
|
|||
import {
|
||||
FactorioStaticAdapter,
|
||||
staticAdapterSet,
|
||||
} from "../../../plugins/demo/appAdapter";
|
||||
import {inserterNodeType} from "../../../plugins/demo/declaration";
|
||||
import {FALLBACK_NAME} from "../../../analysis/fallbackDeclaration";
|
||||
} from "../../plugins/demo/appAdapter";
|
||||
import {inserterNodeType} from "../../plugins/demo/declaration";
|
||||
import {FALLBACK_NAME} from "../../analysis/fallbackDeclaration";
|
||||
import {defaultWeightsForAdapterSet, defaultWeightsForAdapter} from "./weights";
|
||||
import {WeightConfig} from "./WeightConfig";
|
||||
|
||||
require("../../../webutil/testUtil").configureEnzyme();
|
||||
require("../../webutil/testUtil").configureEnzyme();
|
||||
|
||||
describe("app/credExplorer/weights/WeightConfig", () => {
|
||||
describe("explorer/weights/WeightConfig", () => {
|
||||
describe("WeightConfig", () => {
|
||||
function example() {
|
||||
const onChange = jest.fn();
|
|
@ -5,9 +5,9 @@ import {shallow} from "enzyme";
|
|||
|
||||
import {WeightSlider, formatWeight} from "./WeightSlider";
|
||||
|
||||
require("../../../webutil/testUtil").configureEnzyme();
|
||||
require("../../webutil/testUtil").configureEnzyme();
|
||||
|
||||
describe("app/credExplorer/weights/WeightSlider", () => {
|
||||
describe("explorer/weights/WeightSlider", () => {
|
||||
describe("WeightSlider", () => {
|
||||
function example() {
|
||||
const onChange = jest.fn();
|
|
@ -1,6 +1,6 @@
|
|||
// 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>
|
||||
<span
|
||||
style={
|
|
@ -4,9 +4,9 @@ import {
|
|||
type WeightedTypes,
|
||||
combineWeights,
|
||||
defaultWeightsForDeclaration,
|
||||
} from "../../../analysis/weights";
|
||||
import type {StaticAppAdapter} from "../../adapters/appAdapter";
|
||||
import type {StaticAdapterSet} from "../../adapters/adapterSet";
|
||||
} from "../../analysis/weights";
|
||||
import type {StaticAppAdapter} from "../adapters/appAdapter";
|
||||
import type {StaticAdapterSet} from "../adapters/adapterSet";
|
||||
|
||||
export function defaultWeightsForAdapter(
|
||||
adapter: StaticAppAdapter
|
|
@ -4,14 +4,14 @@ import {defaultWeightsForAdapter, defaultWeightsForAdapterSet} from "./weights";
|
|||
import {
|
||||
defaultWeightsForDeclaration,
|
||||
combineWeights,
|
||||
} from "../../../analysis/weights";
|
||||
import {declaration} from "../../../plugins/demo/declaration";
|
||||
} from "../../analysis/weights";
|
||||
import {declaration} from "../../plugins/demo/declaration";
|
||||
import {
|
||||
FactorioStaticAdapter,
|
||||
staticAdapterSet,
|
||||
} from "../../../plugins/demo/appAdapter";
|
||||
} from "../../plugins/demo/appAdapter";
|
||||
|
||||
describe("app/credExplorer/weights/weights", () => {
|
||||
describe("explorer/weights/weights", () => {
|
||||
describe("defaultWeightsForAdapter", () => {
|
||||
it("works on the demo adapter", () => {
|
||||
const adapter = new FactorioStaticAdapter();
|
|
@ -5,8 +5,8 @@ import {declaration} from "./declaration";
|
|||
import type {
|
||||
StaticAppAdapter,
|
||||
DynamicAppAdapter,
|
||||
} from "../../app/adapters/appAdapter";
|
||||
import {StaticAdapterSet} from "../../app/adapters/adapterSet";
|
||||
} from "../../explorer/adapters/appAdapter";
|
||||
import {StaticAdapterSet} from "../../explorer/adapters/adapterSet";
|
||||
import {Assets} from "../../webutil/assets";
|
||||
import {type RepoId, makeRepoId} from "../../core/repoId";
|
||||
import {NodeAddress, type NodeAddressT} from "../../core/graph";
|
||||
|
@ -17,7 +17,7 @@ export class FactorioStaticAdapter implements StaticAppAdapter {
|
|||
declaration(): PluginDeclaration {
|
||||
return declaration;
|
||||
}
|
||||
async load(assets: Assets, repoId: RepoId): Promise<FactorioDynamicAdapter> {
|
||||
async load(assets: Assets, repoId: RepoId) {
|
||||
const result: FactorioDynamicAdapter = new FactorioDynamicAdapter();
|
||||
if (this.loadingMock) {
|
||||
return this.loadingMock(assets, repoId).then(() => result);
|
||||
|
@ -33,7 +33,7 @@ export class FactorioDynamicAdapter implements DynamicAppAdapter {
|
|||
nodeDescription(x: NodeAddressT) {
|
||||
return `[factorio]: ${NodeAddress.toString(x)}`;
|
||||
}
|
||||
static() {
|
||||
static(): FactorioStaticAdapter {
|
||||
return new FactorioStaticAdapter();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
import type {
|
||||
StaticAppAdapter as IStaticAppAdapter,
|
||||
DynamicAppAdapter as IDynamicAppAdapter,
|
||||
} from "../../app/adapters/appAdapter";
|
||||
} from "../../explorer/adapters/appAdapter";
|
||||
import {Graph} from "../../core/graph";
|
||||
import * as N from "./nodes";
|
||||
import {description} from "./render";
|
||||
|
|
|
@ -4,7 +4,7 @@ import pako from "pako";
|
|||
import type {
|
||||
StaticAppAdapter as IStaticAppAdapter,
|
||||
DynamicAppAdapter as IDynamicAppAdapter,
|
||||
} from "../../app/adapters/appAdapter";
|
||||
} from "../../explorer/adapters/appAdapter";
|
||||
import {type Graph, NodeAddress} from "../../core/graph";
|
||||
import {createGraph} from "./createGraph";
|
||||
import * as N from "./nodes";
|
||||
|
|
Loading…
Reference in New Issue