Move the v1 explorer to explorer/legacy

This is a bulk rename of all the old explorer code into
`explorer/legacy`. Now that the timeline explorer exists, I intend to
prioritize development on that going forwards. Once the timeline
explorer is as good as the old explorer at decomposing a node's sources
of cred, I will remove the legacy explorer entirely.

Test plan: `yarn test`
This commit is contained in:
Dandelion Mané 2019-07-11 02:17:08 +01:00
parent 5dc7f440ce
commit 93ceb9ca05
27 changed files with 118 additions and 118 deletions

View File

@ -2,19 +2,19 @@
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 {RepoId} from "../core/repoId";
import {type NodeAddressT} from "../core/graph";
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 {RepoId} from "../../core/repoId";
import {type NodeAddressT} from "../../core/graph";
import {PagerankTable} from "./pagerankTable/Table";
import {WeightConfig} from "./weights/WeightConfig";
import {WeightsFileManager} from "./weights/WeightsFileManager";
import {type Weights, defaultWeights} from "../analysis/weights";
import {Prefix as GithubPrefix} from "../plugins/github/nodes";
import {WeightConfig} from "../weights/WeightConfig";
import {WeightsFileManager} from "../weights/WeightsFileManager";
import {type Weights, defaultWeights} from "../../analysis/weights";
import {Prefix as GithubPrefix} from "../../plugins/github/nodes";
import {
createStateTransitionMachine,
type AppState,
@ -22,7 +22,7 @@ import {
initialState,
} from "./state";
import {StaticExplorerAdapterSet} from "./adapters/explorerAdapterSet";
import {userNodeType} from "../plugins/github/declaration";
import {userNodeType} from "../../plugins/github/declaration";
const credOverviewUrl =
"https://discourse.sourcecred.io/t/a-gentle-introduction-to-cred/20";

View File

@ -3,10 +3,10 @@
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 {Graph} from "../../core/graph";
import {makeRepoId} from "../../core/repoId";
import {Assets} from "../../webutil/assets";
import testLocalStore from "../../webutil/testLocalStore";
import {
DynamicExplorerAdapterSet,
StaticExplorerAdapterSet,
@ -15,9 +15,9 @@ import {
import {PagerankTable} from "./pagerankTable/Table";
import {createApp, LoadingIndicator, ProjectDetail} from "./App";
require("../webutil/testUtil").configureEnzyme();
require("../../webutil/testUtil").configureEnzyme();
describe("explorer/App", () => {
describe("explorer/legacy/App", () => {
function example() {
let setState, getState;
const loadGraph = jest.fn();

View File

@ -1,10 +1,10 @@
// @flow
import {type Node as ReactNode} from "react";
import {Graph, type NodeAddressT} from "../../core/graph";
import type {Assets} from "../../webutil/assets";
import type {RepoId} from "../../core/repoId";
import type {PluginDeclaration} from "../../analysis/pluginDeclaration";
import {Graph, type NodeAddressT} from "../../../core/graph";
import type {Assets} from "../../../webutil/assets";
import type {RepoId} from "../../../core/repoId";
import type {PluginDeclaration} from "../../../analysis/pluginDeclaration";
export interface StaticExplorerAdapter {
declaration(): PluginDeclaration;

View File

@ -11,18 +11,18 @@
* be paramterized over the adapter choice.
*/
import {Graph, type NodeAddressT, type EdgeAddressT} from "../../core/graph";
import {NodeTrie, EdgeTrie} from "../../core/trie";
import type {NodeAndEdgeTypes} from "../../analysis/types";
import {combineTypes} from "../../analysis/pluginDeclaration";
import type {Assets} from "../../webutil/assets";
import type {RepoId} from "../../core/repoId";
import {Graph, type NodeAddressT, type EdgeAddressT} from "../../../core/graph";
import {NodeTrie, EdgeTrie} from "../../../core/trie";
import type {NodeAndEdgeTypes} from "../../../analysis/types";
import {combineTypes} from "../../../analysis/pluginDeclaration";
import type {Assets} from "../../../webutil/assets";
import type {RepoId} from "../../../core/repoId";
import type {
StaticExplorerAdapter,
DynamicExplorerAdapter,
} from "./explorerAdapter";
import type {EdgeType, NodeType} from "../../analysis/types";
import type {EdgeType, NodeType} from "../../../analysis/types";
export class StaticExplorerAdapterSet {
_adapters: $ReadOnlyArray<StaticExplorerAdapter>;

View File

@ -1,13 +1,13 @@
// @flow
import {NodeAddress, EdgeAddress, Graph} from "../../core/graph";
import {FactorioStaticAdapter} from "../../plugins/demo/explorerAdapter";
import {NodeAddress, EdgeAddress, Graph} from "../../../core/graph";
import {FactorioStaticAdapter} from "../../../plugins/demo/explorerAdapter";
import {StaticExplorerAdapterSet} from "./explorerAdapterSet";
import {Assets} from "../../webutil/assets";
import {makeRepoId} from "../../core/repoId";
import * as NullUtil from "../../util/null";
import {Assets} from "../../../webutil/assets";
import {makeRepoId} from "../../../core/repoId";
import * as NullUtil from "../../../util/null";
describe("explorer/adapters/explorerAdapterSet", () => {
describe("explorer/legacy/adapters/explorerAdapterSet", () => {
describe("StaticExplorerAdapterSet", () => {
function example() {
const x = new FactorioStaticAdapter();

View File

@ -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";

View File

@ -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("explorer/pagerankTable/Aggregation", () => {
describe("explorer/legacy/pagerankTable/Aggregation", () => {
describe("AggregationRowList", () => {
it("instantiates AggregationRows for each aggregation", async () => {
const {adapters, pnd, sharedProps} = await example();

View File

@ -1,11 +1,11 @@
// @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 type {NodeAddressT} from "../../../core/graph";
import type {Connection} from "../../../core/attribution/graphToMarkovChain";
import type {ScoredConnection} from "../../../analysis/pagerankNodeDecomposition";
import {DynamicExplorerAdapterSet} from "../adapters/explorerAdapterSet";
import {TableRow} from "./TableRow";
import {NodeRow} from "./Node";

View File

@ -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("explorer/pagerankTable/Connection", () => {
describe("explorer/legacy/pagerankTable/Connection", () => {
describe("ConnectionRowList", () => {
async function setup(maxEntriesPerList: number = 123) {
let {sharedProps} = await example();

View File

@ -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 {
MIN_SLIDER,
@ -12,7 +12,7 @@ import {
formatWeight,
sliderToWeight,
weightToSlider,
} from "../weights/WeightSlider";
} from "../../weights/WeightSlider";
import {nodeDescription, type SharedProps} from "./shared";

View File

@ -3,7 +3,7 @@
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 {
@ -11,18 +11,18 @@ import {
MAX_SLIDER,
sliderToWeight,
weightToSlider,
} from "../weights/WeightSlider";
} from "../../weights/WeightSlider";
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("explorer/pagerankTable/Node", () => {
describe("explorer/legacy/pagerankTable/Node", () => {
describe("NodeRowList", () => {
function sortedByScore(nodes: $ReadOnlyArray<NodeAddressT>, pnd) {
return sortBy(nodes, (node) => -NullUtil.get(pnd.get(node)).score);

View File

@ -3,14 +3,14 @@
import React from "react";
import sortBy from "lodash.sortby";
import {WeightConfig} from "../weights/WeightConfig";
import {WeightsFileManager} from "../weights/WeightsFileManager";
import {NodeAddress, type NodeAddressT} from "../../core/graph";
import type {PagerankNodeDecomposition} from "../../analysis/pagerankNodeDecomposition";
import {WeightConfig} from "../../weights/WeightConfig";
import {WeightsFileManager} from "../../weights/WeightsFileManager";
import {NodeAddress, type NodeAddressT} from "../../../core/graph";
import type {PagerankNodeDecomposition} from "../../../analysis/pagerankNodeDecomposition";
import {DynamicExplorerAdapterSet} from "../adapters/explorerAdapterSet";
import type {DynamicExplorerAdapter} from "../adapters/explorerAdapter";
import {NodeRowList} from "./Node";
import {type NodeType} from "../../analysis/types";
import {type NodeType} from "../../../analysis/types";
type PagerankTableProps = {|
+pnd: PagerankNodeDecomposition,

View File

@ -3,16 +3,16 @@
import React from "react";
import {shallow} from "enzyme";
import {NodeAddress} from "../../core/graph";
import {NodeAddress} from "../../../core/graph";
import {PagerankTable} from "./Table";
import {example, COLUMNS} from "./sharedTestUtils";
import {NodeRowList} from "./Node";
import {WeightConfig} from "../weights/WeightConfig";
import {type NodeType} from "../../analysis/types";
import {WeightConfig} from "../../weights/WeightConfig";
import {type NodeType} from "../../../analysis/types";
require("../../webutil/testUtil").configureEnzyme();
describe("explorer/pagerankTable/Table", () => {
require("../../../webutil/testUtil").configureEnzyme();
describe("explorer/legacy/pagerankTable/Table", () => {
describe("PagerankTable", () => {
async function setup(defaultNodeType?: NodeType) {
const {

View File

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

View File

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

View File

@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`explorer/pagerankTable/TableRow depth parameter changes the color, but not the indentation 1`] = `
exports[`explorer/legacy/pagerankTable/TableRow depth parameter changes the color, but not the indentation 1`] = `
Object {
"buttonStyle": Object {
"marginLeft": 20,
@ -14,7 +14,7 @@ Object {
}
`;
exports[`explorer/pagerankTable/TableRow depth parameter changes the color, but not the indentation 2`] = `
exports[`explorer/legacy/pagerankTable/TableRow depth parameter changes the color, but not the indentation 2`] = `
Object {
"buttonStyle": Object {
"marginLeft": 20,
@ -28,7 +28,7 @@ Object {
}
`;
exports[`explorer/pagerankTable/TableRow depth parameter changes the color, but not the indentation 3`] = `
exports[`explorer/legacy/pagerankTable/TableRow depth parameter changes the color, but not the indentation 3`] = `
Object {
"buttonStyle": Object {
"marginLeft": 20,
@ -42,7 +42,7 @@ Object {
}
`;
exports[`explorer/pagerankTable/TableRow indent parameter changes the button indentation 1`] = `
exports[`explorer/legacy/pagerankTable/TableRow indent parameter changes the button indentation 1`] = `
Object {
"buttonStyle": Object {
"marginLeft": 5,
@ -56,7 +56,7 @@ Object {
}
`;
exports[`explorer/pagerankTable/TableRow indent parameter changes the button indentation 2`] = `
exports[`explorer/legacy/pagerankTable/TableRow indent parameter changes the button indentation 2`] = `
Object {
"buttonStyle": Object {
"marginLeft": 20,
@ -70,7 +70,7 @@ Object {
}
`;
exports[`explorer/pagerankTable/TableRow indent parameter changes the button indentation 3`] = `
exports[`explorer/legacy/pagerankTable/TableRow indent parameter changes the button indentation 3`] = `
Object {
"buttonStyle": Object {
"marginLeft": 35,

View File

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

View File

@ -1,7 +1,7 @@
// @flow
import {EdgeAddress, NodeAddress, type NodeAddressT} from "../../core/graph";
import * as NullUtil from "../../util/null";
import {EdgeAddress, NodeAddress, type NodeAddressT} from "../../../core/graph";
import * as NullUtil from "../../../util/null";
import {
aggregateByNodeType,
aggregateByConnectionType,
@ -11,9 +11,9 @@ import {
fallbackEdgeType,
fallbackNodeType,
} from "./aggregate";
import {type NodeType} from "../../analysis/types";
import {type NodeType} from "../../../analysis/types";
describe("explorer/pagerankTable/aggregate", () => {
describe("explorer/legacy/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

View File

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

View File

@ -2,9 +2,9 @@
import React from "react";
import {type NodeAddressT} from "../../core/graph";
import {pagerank} from "../../analysis/pagerank";
import {dynamicExplorerAdapterSet} from "../../plugins/demo/explorerAdapter";
import {type NodeAddressT} from "../../../core/graph";
import {pagerank} from "../../../analysis/pagerank";
import {dynamicExplorerAdapterSet} from "../../../plugins/demo/explorerAdapter";
import type {SharedProps} from "./shared";
export const COLUMNS = () => ["Description", "", "Cred"];

View File

@ -2,23 +2,23 @@
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 type {NodeAndEdgeTypes} from "../analysis/types";
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 {NodeAndEdgeTypes} from "../../analysis/types";
import {
type PagerankNodeDecomposition,
type PagerankOptions,
pagerank,
} from "../analysis/pagerank";
} from "../../analysis/pagerank";
import {
StaticExplorerAdapterSet,
DynamicExplorerAdapterSet,
} from "./adapters/explorerAdapterSet";
import type {Weights} from "../analysis/weights";
import {weightsToEdgeEvaluator} from "../analysis/weightsToEdgeEvaluator";
import type {Weights} from "../../analysis/weights";
import {weightsToEdgeEvaluator} from "../../analysis/weightsToEdgeEvaluator";
/*
This models the UI states of the credExplorer/App as a state machine.

View File

@ -6,11 +6,11 @@ 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 {defaultWeights} 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 {defaultWeights} from "../../analysis/weights";
import {
StaticExplorerAdapterSet,
DynamicExplorerAdapterSet,
@ -18,9 +18,9 @@ import {
import type {
PagerankNodeDecomposition,
PagerankOptions,
} from "../analysis/pagerank";
} from "../../analysis/pagerank";
describe("explorer/state", () => {
describe("explorer/legacy/state", () => {
function example(startingState: AppState) {
const stateContainer = {appState: startingState};
const getState = () => stateContainer.appState;

View File

@ -3,9 +3,9 @@
import React from "react";
import type {Assets} from "../webutil/assets";
import {StaticExplorerAdapterSet} from "../explorer/adapters/explorerAdapterSet";
import {StaticExplorerAdapterSet} from "../explorer/legacy/adapters/explorerAdapterSet";
import {StaticExplorerAdapter as GithubAdapter} from "../plugins/github/explorerAdapter";
import {AppPage} from "../explorer/App";
import {AppPage} from "../explorer/legacy/App";
import type {RepoId} from "../core/repoId";
function homepageStaticAdapters(): StaticExplorerAdapterSet {

View File

@ -5,8 +5,8 @@ import {declaration} from "./declaration";
import type {
StaticExplorerAdapter,
DynamicExplorerAdapter,
} from "../../explorer/adapters/explorerAdapter";
import {StaticExplorerAdapterSet} from "../../explorer/adapters/explorerAdapterSet";
} from "../../explorer/legacy/adapters/explorerAdapter";
import {StaticExplorerAdapterSet} from "../../explorer/legacy/adapters/explorerAdapterSet";
import {Assets} from "../../webutil/assets";
import {type RepoId, makeRepoId} from "../../core/repoId";
import {NodeAddress, type NodeAddressT} from "../../core/graph";

View File

@ -2,7 +2,7 @@
import type {
StaticExplorerAdapter as IStaticExplorerAdapter,
DynamicExplorerAdapter as IDynamicExplorerAdapter,
} from "../../explorer/adapters/explorerAdapter";
} from "../../explorer/legacy/adapters/explorerAdapter";
import {Graph} from "../../core/graph";
import * as N from "./nodes";
import {description} from "./render";

View File

@ -4,7 +4,7 @@ import pako from "pako";
import type {
StaticExplorerAdapter as IStaticExplorerAdapter,
DynamicExplorerAdapter as IDynamicExplorerAdapter,
} from "../../explorer/adapters/explorerAdapter";
} from "../../explorer/legacy/adapters/explorerAdapter";
import {type Graph, NodeAddress} from "../../core/graph";
import {createGraph} from "./createGraph";
import * as N from "./nodes";