diff --git a/CHANGELOG.md b/CHANGELOG.md index 4e29043..b6862de 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## [Unreleased] +- Allow the user to save or upload weight settings (#1150) - Allow tweaking weights on a per-node basis (#1143) - Add the `pagerank` command (#1114) - Add the `clear` command (#1111) diff --git a/src/explorer/App.js b/src/explorer/App.js index 8d9df53..6d30658 100644 --- a/src/explorer/App.js +++ b/src/explorer/App.js @@ -12,6 +12,7 @@ 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 { @@ -108,6 +109,14 @@ export function createApp( }} /> ); + const weightFileManager = ( + { + this.setState({weights}); + }} + /> + ); let pagerankTable; if (appState.type === "PAGERANK_EVALUATED") { const adapters = appState.graphWithAdapters.adapters; @@ -117,6 +126,7 @@ export function createApp( defaultNodeType={userNodeType} adapters={adapters} weightConfig={weightConfig} + weightFileManager={weightFileManager} manualWeights={this.state.weights.nodeManualWeights} onManualWeightsChange={(addr: NodeAddressT, weight: number) => this.setState(({weights}) => { diff --git a/src/explorer/pagerankTable/Table.js b/src/explorer/pagerankTable/Table.js index ea10d6b..20a5cf5 100644 --- a/src/explorer/pagerankTable/Table.js +++ b/src/explorer/pagerankTable/Table.js @@ -4,6 +4,7 @@ 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 {DynamicExplorerAdapterSet} from "../adapters/explorerAdapterSet"; @@ -19,6 +20,7 @@ type PagerankTableProps = {| +manualWeights: Map, +onManualWeightsChange: (NodeAddressT, number) => void, +weightConfig: React$Element, + +weightFileManager: React$Element, |}; type PagerankTableState = {| selectedNodeTypePrefix: NodeAddressT, @@ -45,6 +47,7 @@ export class PagerankTable extends React.PureComponent<
{this.renderFilterSelect()} + {this.props.weightFileManager}