Skip to content

Commit

Permalink
fix: update DDO UI (#1889)
Browse files Browse the repository at this point in the history
* update DDO UI

* remove typo
  • Loading branch information
LexLuthr authored Mar 11, 2024
1 parent 9018571 commit 018898b
Show file tree
Hide file tree
Showing 4 changed files with 126 additions and 12 deletions.
43 changes: 33 additions & 10 deletions gql/resolver_directdeals.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,19 @@ package gql

import (
"context"
"time"

"github.com/filecoin-project/boost/db"
gqltypes "github.com/filecoin-project/boost/gql/types"
"github.com/filecoin-project/boost/storagemarket/sealingpipeline"
"github.com/filecoin-project/boost/storagemarket/types"
"github.com/filecoin-project/boost/storagemarket/types/dealcheckpoints"
verifreg9types "github.com/filecoin-project/go-state-types/builtin/v9/verifreg"
lapi "github.com/filecoin-project/lotus/api"
"github.com/filecoin-project/lotus/api/v1api"
ltypes "github.com/filecoin-project/lotus/chain/types"
sealing "github.com/filecoin-project/lotus/storage/pipeline"
"github.com/graph-gophers/graphql-go"
"time"
)

type directDealResolver struct {
Expand All @@ -17,6 +23,7 @@ type directDealResolver struct {
dealsDB *db.DealsDB
logsDB *db.LogsDB
spApi sealingpipeline.API
fullNode v1api.FullNode
}

type directDealListResolver struct {
Expand Down Expand Up @@ -86,6 +93,7 @@ func (r *resolver) DirectDeals(ctx context.Context, args dealsArgs) (*directDeal
dealsDB: r.dealsDB,
logsDB: r.logsDB,
spApi: r.spApi,
fullNode: r.fullNode,
})
}

Expand Down Expand Up @@ -213,7 +221,7 @@ func (dr *directDealResolver) message(ctx context.Context, checkpoint dealcheckp
case dealcheckpoints.AddedPiece:
return "Announcing"
case dealcheckpoints.IndexedAndAnnounced:
return dr.sealingState(ctx)
return "Indexed and Announced"
case dealcheckpoints.Complete:
switch dr.Err {
case "":
Expand All @@ -232,14 +240,22 @@ func (dr *directDealResolver) sealingState(ctx context.Context) string {
log.Warnw("error getting sealing status for sector", "sector", dr.SectorID, "error", err)
return "Sealer: Sealing"
}
return "Sealer: " + string(si.State)
// TODO: How to check that deal is in sector?
//for _, d := range si.Deals {
// if d == dr.DirectDataEntry.ChainDealID {
// return "Sealer: " + string(si.State)
// }
//}
//return fmt.Sprintf("Sealer: failed - deal not found in sector %d", si.SectorID)
if si.State != lapi.SectorState(sealing.Proving) {
return "Sealer: " + string(si.State)
}

claim, err := dr.fullNode.StateGetClaim(ctx, dr.Provider, verifreg9types.ClaimId(dr.AllocationID()), ltypes.EmptyTSK)
if err != nil {
log.Warnw("error getting status for claim", "claim", dr.AllocationID(), "error", err)
return "Sealer: " + string(si.State)
}
if claim == nil {
return "Sealer: " + string(si.State) + "(No claim found)"
}
if claim.Sector != dr.SectorID {
return "Sealer: " + string(si.State) + "(Sector mismatch)"
}
return "Sealer: " + string(si.State) + "(Claim verified)"
}

func (dr *directDealResolver) Logs(ctx context.Context) ([]*logsResolver, error) {
Expand All @@ -254,3 +270,10 @@ func (dr *directDealResolver) Logs(ctx context.Context) ([]*logsResolver, error)
}
return logResolvers, nil
}

func (dr *directDealResolver) SealingState(ctx context.Context) string {
if dr.DirectDeal.Checkpoint < dealcheckpoints.AddedPiece {
return "To be sealed"
}
return dr.sealingState(ctx)
}
1 change: 1 addition & 0 deletions gql/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ type DirectDeal {
Sector: Sector!
Message: String!
Logs: [DealLog]!
SealingState: String!
}

type DirectDealList {
Expand Down
93 changes: 91 additions & 2 deletions react/src/DirectDeals.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ import columnsGapImg from './bootstrap-icons/icons/columns-gap.svg'
import './Deals.css'
import {Pagination} from "./Pagination";
import {DealActions, IsPaused, IsOfflineWaitingForData} from "./DealDetail";
import {SearchBox} from "./Deals";
import {SealingStatusInfo, SearchBox} from "./Deals";
import {Info} from "./Info";

const dealsBasePath = '/direct-deals'

Expand Down Expand Up @@ -140,7 +141,8 @@ function DirectDealsContent() {
<th>Deal ID</th>
<th>Allocation ID</th>
<th>Client</th>
<th>State</th>
<th>Sealing State<SealingStatusInfo/></th>
<th>Deal State<DDODealStatusInfo/></th>
</tr>

{deals.map(deal => (
Expand Down Expand Up @@ -188,6 +190,13 @@ function DealRow(props) {
<td className={'client ' + (isContractAddress(deal.ClientAddress) ? 'contract' : '')}>
<ShortClientAddress address={deal.ClientAddress} />
</td>
<td className="sealing">
<div className="message-content">
<span className="message-text">
{deal.SealingState}
</span>
</div>
</td>
<td className="message">
<div className="message-content">
<span className="message-text">
Expand Down Expand Up @@ -245,3 +254,83 @@ export function DirectDealsCount(props) {
function scrollTop() {
window.scrollTo({ top: 0, behavior: "smooth" })
}

function DDODealStatusInfo(props) {
return <span className="deal-status-info">
<Info>
The deal can be in one of the following states:
<p>
<i>Transfer Queued</i><br/>
<span>
The storage deal proposal has been accepted, and Boost is
about to start the data transfer.
</span>
</p>
<p>
<i>Awaiting Offline Data Import</i><br/>
<span>
The client has made an offline deal proposal, and Boost is
waiting for the Storage Provider operator to import the deal
data.
</span>
</p>
<p>
<i>Transferring</i><br/>
<span>
The data for the deal is transferring.
</span>
</p>
<p>
<i>Transfer Complete</i><br/>
<span>
The data transfer is complete and Boost is verifying the data matches commp.
</span>
</p>
<p>
<i>Ready to Publish</i><br/>
<span>
The deal is in the batch publish queue, ready to be published.
</span>
</p>
<p>
<i>Awaiting Publish Confirmation</i><br/>
<span>
Boost sent a publish deal message for the deal and is waiting for on-chain confirmation.
</span>
</p>
<p>
<i>Adding to Sector</i><br/>
<span>
Boost is handing the deal off to the lotus-miner sealing subsystem
to be added to a sector.
</span>
</p>
<p>
<i>Indexing</i><br/>
<span>
Boost is indexing the deal in the Local Index Directory(LID)
and will be announcing the deal to the network so that clients know where to retrieve it from.
</span>
</p>
<p>
<i>IndexedAndAnnounced</i><br/>
<span>
The deal has been indexed locally and announced to the network indexers.
</span>
</p>
<p>
<i>Complete</i><br/>
<span>
The deal process has finished execution.
</span>
</p>
<p>
<i>Cancelled</i><br/>
<span>
The deal was cancelled.
</span>
</p>
</Info>
</span>
}

1 change: 1 addition & 0 deletions react/src/gql.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ const DirectDealsListQuery = gql`
Offset
Length
}
SealingState
}
totalCount
more
Expand Down

0 comments on commit 018898b

Please sign in to comment.