From 3d64268058030fbfc794bcfe87289523c24d00ec Mon Sep 17 00:00:00 2001 From: "@wwwjim" Date: Fri, 24 Jul 2020 09:35:00 -0700 Subject: [PATCH] storage deals: override each time the user makes filecoin deal --- pages/api/data/storage-deal.js | 7 ++++++- scenes/SceneDeals.js | 15 ++++----------- scenes/SceneFilesFolder.js | 10 +++++----- 3 files changed, 15 insertions(+), 17 deletions(-) diff --git a/pages/api/data/storage-deal.js b/pages/api/data/storage-deal.js index 2044cf5a..251408cc 100644 --- a/pages/api/data/storage-deal.js +++ b/pages/api/data/storage-deal.js @@ -6,6 +6,8 @@ import * as Strings from "~/node_common/utilities"; import * as Powergate from "~/node_common/powergate"; import * as LibraryManager from "~/node_common/managers/library"; +import { ffsOptions } from "@textile/powergate-client"; + const initCORS = MW.init(MW.CORS); const initAuth = MW.init(MW.RequireCookieAuthentication); @@ -31,7 +33,10 @@ export default async (req, res) => { const PG = Powergate.get(user); let jobId; try { - const Deal = await PG.ffs.pushStorageConfig(cid); + const Deal = await PG.ffs.pushStorageConfig( + cid, + ffsOptions.withOverride(true) + ); jobId = Deal && Deal.jobId ? Deal.jobId : null; } catch (e) { console.log(e); diff --git a/scenes/SceneDeals.js b/scenes/SceneDeals.js index e32f8f38..0784ae33 100644 --- a/scenes/SceneDeals.js +++ b/scenes/SceneDeals.js @@ -38,6 +38,7 @@ export default class SceneDeals extends React.Component { }; render() { + console.log(this.props); return ( Deals @@ -49,23 +50,16 @@ export default class SceneDeals extends React.Component { { key: "address", name: "Address", - width: "196px", + width: "248px", }, { key: "rootCid", name: "Root CID", - width: "196px", - }, - { - key: "status", - name: "Status", - type: "STORAGE_DEAL_STATUS", - width: "104px", + width: "100%", }, { key: "time", name: "Time", - width: "100%", }, ], rows: this.props.viewer.storageList.map((each) => { @@ -96,12 +90,11 @@ export default class SceneDeals extends React.Component { { key: "rootCid", name: "Root CID", - width: "248px", + width: "100%", }, { key: "time", name: "Time", - width: "100%", }, ], rows: this.props.viewer.retrievalList.map((each) => { diff --git a/scenes/SceneFilesFolder.js b/scenes/SceneFilesFolder.js index a98e417a..e3eba7d3 100644 --- a/scenes/SceneFilesFolder.js +++ b/scenes/SceneFilesFolder.js @@ -9,12 +9,12 @@ import { css } from "@emotion/react"; import Section from "~/components/core/Section"; import ScenePage from "~/components/core/ScenePage"; +const POLLING_INTERVAL = 10000; + export default class SceneFilesFolder extends React.Component { _interval; loop = async () => { - console.log("checking"); - let jobs = []; this.props.viewer.library[0].children.forEach((d) => { @@ -27,7 +27,7 @@ export default class SceneFilesFolder extends React.Component { } }); - console.log(jobs); + console.log({ jobs }); const response = await Actions.checkCIDStatus(jobs); @@ -35,11 +35,11 @@ export default class SceneFilesFolder extends React.Component { await this.props.onRehydrate(); } - this._interval = window.setTimeout(this.loop, 5000); + this._interval = window.setTimeout(this.loop, POLLING_INTERVAL); }; componentDidMount() { - this._interval = window.setTimeout(this.loop, 5000); + this.loop(); } componentWillUnmount() {