restores miner tab

This commit is contained in:
@wwwjim 2020-09-27 09:38:20 -07:00
parent a4cc0b67d9
commit f9993d5bd4
9 changed files with 82 additions and 137 deletions

View File

@ -159,6 +159,14 @@ export const generate = ({ library = [], slates = [] }) => [
filecoin: true,
children: null,
},
{
id: "V1_NAVIGATION_MINERS",
decorator: "MINERS",
name: "Trusted miners",
pageTitle: "Trusted miners",
filecoin: true,
children: null,
},
],
},
{

View File

@ -559,6 +559,7 @@ export const Miners = (props) => (
stroke="currentColor"
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth="1.5"
>
<path d="m2.561 23.207a1 1 0 0 1 -1.415 0l-.353-.353a1 1 0 0 1 0-1.414l13.016-13.018 1.768 1.768z" />
<path d="m23.5 16.879a17 17 0 0 0 -16.379-16.379.5.5 0 0 0 -.24.948 33.1 33.1 0 0 1 7.526 4.963l-.951.951a.5.5 0 0 0 0 .707l2.474 2.475a.5.5 0 0 0 .707 0l.952-.951a33.076 33.076 0 0 1 4.962 7.526.5.5 0 0 0 .949-.24z" />

View File

@ -32,6 +32,7 @@ import ScenePublicSlate from "~/scenes/ScenePublicSlate";
import SceneArchive from "~/scenes/SceneArchive";
import SceneMakeFilecoinDeal from "~/scenes/SceneMakeFilecoinDeal";
import SceneEncryptedData from "~/scenes/SceneEncryptedData";
import SceneMiners from "~/scenes/SceneMiners";
// NOTE(jim):
// Sidebars each have a decorator and can be shown to with _handleAction
@ -94,6 +95,7 @@ const SCENES = {
FILECOIN: <SceneArchive />,
MAKE_DEAL: <SceneMakeFilecoinDeal />,
ENCRYPTED: <SceneEncryptedData />,
MINERS: <SceneMiners />,
};
export default class ApplicationPage extends React.Component {

View File

@ -24,6 +24,7 @@ const IconMap = {
SETTINGS: <SVG.Settings height="20px" />,
DIRECTORY: <SVG.Directory height="20px" />,
FILECOIN: <SVG.Wallet height="20px" />,
MINERS: <SVG.Miners height="20px" />,
};
const STYLES_NAVIGATION = css`

View File

@ -89,7 +89,7 @@ export default class SidebarFilecoinArchive extends React.Component {
fontSize: Constants.typescale.lvl3,
}}
>
Make storage deal
Archive your data
</System.P>
<System.P style={{ marginTop: 24 }}>

View File

@ -23,6 +23,8 @@ let mounted = false;
export default class SceneArchive extends React.Component {
state = {
networkViewer: null,
allow_automatic_data_storage: this.props.viewer
.allow_automatic_data_storage,
allow_encrypted_data_storage: this.props.viewer
.allow_encrypted_data_storage,
};
@ -54,6 +56,7 @@ export default class SceneArchive extends React.Component {
await Actions.updateViewer({
data: {
allow_automatic_data_storage: this.state.allow_automatic_data_storage,
allow_encrypted_data_storage: this.state.allow_encrypted_data_storage,
},
});
@ -94,7 +97,7 @@ export default class SceneArchive extends React.Component {
return (
<ScenePage>
<ScenePageHeader title="Filecoin: archiving and logs">
<ScenePageHeader title="Filecoin">
Use this section to archive all of your data on to Filecoin through a
storage deal. Once you make a storage deal, you can view the logs
here. <br />
@ -111,7 +114,7 @@ export default class SceneArchive extends React.Component {
})
}
>
Make storage deal
Archive your data
</System.ButtonPrimary>
<System.DescriptionGroup
@ -120,6 +123,16 @@ export default class SceneArchive extends React.Component {
description="You may not want others to be able to read your data on the network."
/>
<System.CheckBox
style={{ marginTop: 24 }}
name="allow_automatic_data_storage"
value={this.state.allow_automatic_data_storage}
onChange={this._handleCheckboxChange}
>
Allow Slate to make archive storage deals on your behalf to the
Filecoin Network. You will get a receipt in the Filecoin section.
</System.CheckBox>
<System.CheckBox
style={{ marginTop: 24 }}
name="allow_encrypted_data_storage"
@ -139,31 +152,6 @@ export default class SceneArchive extends React.Component {
</System.ButtonSecondary>
</div>
<Section
title="Trusted miners"
style={{ minWidth: "auto", marginTop: 48 }}
onAction={this.props.onAction}
>
<System.Table
data={{
columns: [
{
key: "miner",
name: "Miner ID",
width: "100%",
},
],
rows: this.state.networkViewer.powerInfo.defaultStorageConfig.cold.filecoin.trustedMinersList.map(
(miner) => {
return {
miner,
};
}
),
}}
/>
</Section>
<Section
title="Archive deal logs"
style={{ minWidth: "auto", marginTop: 48 }}

View File

@ -356,31 +356,6 @@ export default class SceneMakeFilecoinDeal extends React.Component {
onChange={this._handleChange}
/>
<Section
title="Targeted miners (read only)"
style={{ marginTop: 48, maxWidth: 688, minWidth: "auto" }}
onAction={this.props.onAction}
>
<System.Table
data={{
columns: [
{
key: "miner",
name: "Miner ID",
width: "100%",
},
],
rows: this.state.settings_cold_default_trusted_miners.map(
(miner) => {
return {
miner,
};
}
),
}}
/>
</Section>
<System.ButtonPrimary
style={{ marginTop: 48 }}
onClick={this._handleArchive}

View File

@ -7,82 +7,76 @@ import { css } from "@emotion/react";
import Section from "~/components/core/Section";
import ScenePage from "~/components/core/ScenePage";
import ScenePageHeader from "~/components/core/ScenePageHeader";
let mounted = false;
export default class SceneMiners extends React.Component {
state = {};
state = { miners: [] };
_handleChange = (e) => {
this.setState({ [e.target.name]: e.target.value });
};
async componentDidMount() {
if (mounted) {
return null;
}
mounted = true;
let miners = [];
try {
const response = await fetch(
"https://sentinel.slate.host/api/static-global-miners"
);
const json = await response.json();
const sources = json.data.buckets;
sources.forEach((group) => {
miners = [
...group.minerAddresses.map((name) => {
return { location: group.name, name };
}),
...miners,
];
});
} catch (e) {}
this.setState({ miners });
}
componentWillUnmount() {
mounted = false;
}
render() {
return (
<ScenePage>
<System.H1>Miners</System.H1>
<Section
onAction={this.props.onAction}
onNavigateTo={this.props.onNavigateTo}
title="Recent"
buttons={[
{
name: "Add miner",
type: "ACTION",
value: "ACTION_ADD_MINERS",
},
{
name: "Export",
type: "DOWNLOAD",
value: "CSV_ALL_MINERS",
},
]}>
<ScenePageHeader title="Trusted miners">
Whenever you make a deal against the Filecoin Network, Slate works
with Textile's infrastructure to find the best possible miner to store
your data. Here is the list of miners.
</ScenePageHeader>
<Section title="Miners" style={{ maxWidth: 688, minWidth: "auto" }}>
<System.Table
data={{
columns: [
{
key: "availability",
name: "Availability",
width: "100px",
type: "MINER_AVAILABILITY",
},
{ key: "miner", name: "Miner", width: "100%" },
{ key: "miner-id", name: "Miner ID" },
{ key: "location", name: "Location", type: "LOCATION" },
{
key: "reputation-score",
name: "Reputation score",
tooltip: "Reputation score explainer",
width: "144px",
key: "miner",
name: "Miner",
width: "100%",
},
{
key: "storage-available",
name: "Availble storage",
width: "120px",
},
{
key: "storage-proven",
name: "Proven storage",
tooltip: "Proven storage explainer",
width: "144px",
},
],
rows: [
{
id: 1,
availability: 1,
miner: "Example Miner A",
"miner-id": "t44444",
location: 1,
"reputation-score": 80,
"storage-available": Strings.bytesToSize(244000),
"storage-proven": Strings.bytesToSize(22000),
key: "location",
name: "Location",
width: "188px",
},
],
rows: this.state.miners.map((miner) => {
return {
miner: miner.name,
location: miner.location,
};
}),
}}
selectedRowId={this.state.table_miners}
onNavigateTo={this.props.onNavigateTo}
onAction={this.props.onAction}
onChange={this._handleChange}
name="table_miners"
/>
</Section>
</ScenePage>

View File

@ -144,30 +144,6 @@ export default class SceneSettings extends React.Component {
{this.state.networkViewer ? (
<React.Fragment>
<Section
title="Trusted miners"
style={{ marginTop: 48, maxWidth: 688, minWidth: "auto" }}
>
<System.Table
data={{
columns: [
{
key: "miner",
name: "Miner ID",
width: "100%",
},
],
rows: this.state.settings_cold_default_trusted_miners.map(
(miner) => {
return {
miner,
};
}
),
}}
/>
</Section>
{/*<div css={STYLES_GROUP} style={{ marginTop: 48 }}>
<div css={STYLES_LEFT}>
<System.DescriptionGroup