From e68fe19487f6cb61333613f7d302992b5d56c23b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dandelion=20Man=C3=A9?= Date: Wed, 15 Aug 2018 22:22:21 -0700 Subject: [PATCH] Rename cred explorer table columns (#680) The 'Score' column is renamed to 'Cred' (and its prop is renamed as well). The column which shows how a connection or aggregation contributes to a node's cred, as a percentage, has been rendered nameless. It is pretty self explanatory, and the previous name ("Connection") was meaningless. Test plan: Unit tests, also I inspected the frontend. --- CHANGELOG.md | 1 + .../credExplorer/pagerankTable/Aggregation.js | 2 +- .../pagerankTable/Aggregation.test.js | 4 ++-- src/app/credExplorer/pagerankTable/Connection.js | 2 +- .../pagerankTable/Connection.test.js | 4 ++-- src/app/credExplorer/pagerankTable/Node.js | 2 +- src/app/credExplorer/pagerankTable/Node.test.js | 4 ++-- src/app/credExplorer/pagerankTable/Table.js | 4 ++-- src/app/credExplorer/pagerankTable/TableRow.js | 12 ++++++------ .../credExplorer/pagerankTable/TableRow.test.js | 16 ++++++++-------- .../pagerankTable/sharedTestUtils.js | 2 +- 11 files changed, 27 insertions(+), 26 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 53d9688..b21891f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,4 +5,5 @@ - Aggregate over connection types in the cred explorer (#502) - Support hosting SourceCred instances at arbitrary gateways, not just the root of a domain (#643) - Display version string in the app's footer +- Rename cred explorer table columns (#680) diff --git a/src/app/credExplorer/pagerankTable/Aggregation.js b/src/app/credExplorer/pagerankTable/Aggregation.js index f9dec8a..acad041 100644 --- a/src/app/credExplorer/pagerankTable/Aggregation.js +++ b/src/app/credExplorer/pagerankTable/Aggregation.js @@ -66,7 +66,7 @@ export class AggregationRow extends React.PureComponent { indent={1} showPadding={false} connectionProportion={connectionProportion} - score={score} + cred={score} description={} > { const {row} = await setup(); expect(row.props().showPadding).toBe(false); }); - it("with the aggregation score", async () => { + it("with the aggregation score as its cred", async () => { const {row, aggregation} = await setup(); - expect(row.props().score).toBe(aggregation.summary.score); + expect(row.props().cred).toBe(aggregation.summary.score); }); it("with the aggregation's contribution proportion", async () => { const {row, target, aggregation, sharedProps} = await setup(); diff --git a/src/app/credExplorer/pagerankTable/Connection.js b/src/app/credExplorer/pagerankTable/Connection.js index c7baf9b..207ba7e 100644 --- a/src/app/credExplorer/pagerankTable/Connection.js +++ b/src/app/credExplorer/pagerankTable/Connection.js @@ -72,7 +72,7 @@ export class ConnectionRow extends React.PureComponent { description={connectionView} connectionProportion={connectionProportion} showPadding={false} - score={connectionScore} + cred={connectionScore} > { const {row} = await setup(); expect(row.props().showPadding).toBe(false); }); - it("with the connection score", async () => { + it("with the connection score as its cred", async () => { const {row, scoredConnection} = await setup(); - expect(row.props().score).toBe(scoredConnection.connectionScore); + expect(row.props().cred).toBe(scoredConnection.connectionScore); }); it("with the connectionProportion", async () => { const {row, target, scoredConnection, sharedProps} = await setup(); diff --git a/src/app/credExplorer/pagerankTable/Node.js b/src/app/credExplorer/pagerankTable/Node.js index 3730082..b1617f2 100644 --- a/src/app/credExplorer/pagerankTable/Node.js +++ b/src/app/credExplorer/pagerankTable/Node.js @@ -58,7 +58,7 @@ export class NodeRow extends React.PureComponent { showPadding={showPadding} description={description} connectionProportion={null} - score={score} + cred={score} > { const {row: row1} = await setup({showPadding: false}); expect(row1.props().showPadding).toBe(false); }); - it("with the node's score", async () => { + it("with the node's score as its cred", async () => { const {row, node, sharedProps} = await setup(); const score = NullUtil.get(sharedProps.pnd.get(node)).score; - expect(row.props().score).toBe(score); + expect(row.props().cred).toBe(score); }); it("with no connectionProportion", async () => { const {row} = await setup(); diff --git a/src/app/credExplorer/pagerankTable/Table.js b/src/app/credExplorer/pagerankTable/Table.js index d7caab3..9f07ff3 100644 --- a/src/app/credExplorer/pagerankTable/Table.js +++ b/src/app/credExplorer/pagerankTable/Table.js @@ -116,8 +116,8 @@ export class PagerankTable extends React.PureComponent< Description - Connection - Score + + Cred diff --git a/src/app/credExplorer/pagerankTable/TableRow.js b/src/app/credExplorer/pagerankTable/TableRow.js index ac7567f..2c87dda 100644 --- a/src/app/credExplorer/pagerankTable/TableRow.js +++ b/src/app/credExplorer/pagerankTable/TableRow.js @@ -11,8 +11,8 @@ type TableRowProps = {| +description: ReactNode, // What proportion should be formatted in the connection column +connectionProportion: ?number, - // The score to format and display - +score: number, + // The cred amount to format and display + +cred: number, // Children to show when the row is expanded +children: ReactNode, +showPadding: boolean, @@ -21,8 +21,8 @@ type TableRowState = {| expanded: boolean, |}; -export function scoreDisplay(score: number) { - return score.toFixed(2); +export function credDisplay(cred: number) { + return cred.toFixed(2); } export class TableRow extends React.PureComponent< @@ -39,7 +39,7 @@ export class TableRow extends React.PureComponent< indent, description, connectionProportion, - score, + cred, children, showPadding, } = this.props; @@ -71,7 +71,7 @@ export class TableRow extends React.PureComponent< {percent} - {scoreDisplay(score)} + {credDisplay(cred)} {expanded && children} diff --git a/src/app/credExplorer/pagerankTable/TableRow.test.js b/src/app/credExplorer/pagerankTable/TableRow.test.js index d234042..23d32fd 100644 --- a/src/app/credExplorer/pagerankTable/TableRow.test.js +++ b/src/app/credExplorer/pagerankTable/TableRow.test.js @@ -15,7 +15,7 @@ describe("app/credExplorer/pagerankTable/TableRow", () => { indent={1} description={} connectionProportion={0.5} - score={133.7} + cred={133.7} children={
} showPadding={false} /> @@ -30,7 +30,7 @@ describe("app/credExplorer/pagerankTable/TableRow", () => { showPadding={false} description={} connectionProportion={0.5} - score={133.7} + cred={133.7} children={
} /> ); @@ -48,7 +48,7 @@ describe("app/credExplorer/pagerankTable/TableRow", () => { showPadding={false} description={} connectionProportion={0.5} - score={133.7} + cred={133.7} children={
} /> ); @@ -88,7 +88,7 @@ describe("app/credExplorer/pagerankTable/TableRow", () => { expect(el.find("td")).toHaveLength(COLUMNS().length); }); it("displays formatted connectionPercentage in the correct column", () => { - const index = COLUMNS().indexOf("Connection"); + const index = COLUMNS().indexOf(""); expect(index).not.toEqual(-1); const td = example() .find("td") @@ -96,15 +96,15 @@ describe("app/credExplorer/pagerankTable/TableRow", () => { expect(td.text()).toEqual("50.00%"); }); it("displays empty column when connectionProportion not set", () => { - const index = COLUMNS().indexOf("Connection"); + const index = COLUMNS().indexOf(""); expect(index).not.toEqual(-1); const el = example(); el.setProps({connectionProportion: null}); const td = el.find("td").at(index); expect(td.text()).toEqual(""); }); - it("displays formatted score in the correct column", () => { - const index = COLUMNS().indexOf("Score"); + it("displays formatted cred in the correct column", () => { + const index = COLUMNS().indexOf("Cred"); expect(index).not.toEqual(-1); const td = example() .find("td") @@ -131,7 +131,7 @@ describe("app/credExplorer/pagerankTable/TableRow", () => { indent={1} description={} connectionProportion={0.5} - score={133.7} + cred={133.7} children={
} showPadding={true} /> diff --git a/src/app/credExplorer/pagerankTable/sharedTestUtils.js b/src/app/credExplorer/pagerankTable/sharedTestUtils.js index 5bc3ec1..f57d07a 100644 --- a/src/app/credExplorer/pagerankTable/sharedTestUtils.js +++ b/src/app/credExplorer/pagerankTable/sharedTestUtils.js @@ -6,7 +6,7 @@ import {StaticAdapterSet, DynamicAdapterSet} from "../../adapters/adapterSet"; import type {DynamicPluginAdapter} from "../../adapters/pluginAdapter"; import {pagerank} from "../../../core/attribution/pagerank"; -export const COLUMNS = () => ["Description", "Connection", "Score"]; +export const COLUMNS = () => ["Description", "", "Cred"]; export async function example() { const graph = new Graph();