-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: update local index directory ui
- Loading branch information
Showing
19 changed files
with
1,003 additions
and
386 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
package gql | ||
|
||
import ( | ||
"context" | ||
gqltypes "github.com/filecoin-project/boost/gql/types" | ||
"github.com/graph-gophers/graphql-go" | ||
) | ||
|
||
type sectorStateResolver struct { | ||
SectorNumber int32 | ||
Status string | ||
Unsealed bool | ||
DealCount int32 | ||
Active bool | ||
DealWeight gqltypes.BigInt | ||
VerifiedPower gqltypes.BigInt | ||
Expiration gqltypes.Uint64 | ||
OnChain bool | ||
} | ||
|
||
type sectorsListResolver struct { | ||
TotalCount int32 | ||
Sectors []*sectorStateResolver | ||
More bool | ||
At graphql.Time | ||
} | ||
|
||
type sectorsArgs struct { | ||
Cursor graphql.NullInt // SectorNumber | ||
Offset graphql.NullInt | ||
Limit graphql.NullInt | ||
} | ||
|
||
// query: sectorsList(cursor, offset, limit) SectorsList | ||
func (r *resolver) SectorsList(ctx context.Context, args sectorsArgs) (*sectorsListResolver, error) { | ||
offset := 0 | ||
if args.Offset.Set && args.Offset.Value != nil && *args.Offset.Value > 0 { | ||
offset = int(*args.Offset.Value) | ||
} | ||
|
||
limit := 10 | ||
if args.Limit.Set && args.Limit.Value != nil && *args.Limit.Value > 0 { | ||
limit = int(*args.Limit.Value) | ||
} | ||
|
||
snapshot, err := r.sectorsList.Snapshot(ctx, offset, limit) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
resolvers := make([]*sectorStateResolver, 0, len(snapshot.List)) | ||
for _, sector := range snapshot.List { | ||
resolvers = append(resolvers, §orStateResolver{ | ||
SectorNumber: int32(sector.SectorNumber), | ||
Status: sector.State.String(), | ||
Unsealed: sector.Unsealed, | ||
DealCount: int32(len(sector.Deals)), | ||
Active: sector.Active, | ||
DealWeight: gqltypes.BigInt{Int: sector.DealWeight}, | ||
VerifiedPower: gqltypes.BigInt{Int: sector.VerifiedPower}, | ||
Expiration: gqltypes.Uint64(sector.Expiration), | ||
OnChain: sector.OnChain, | ||
}) | ||
} | ||
|
||
return §orsListResolver{ | ||
TotalCount: int32(snapshot.TotalCount), | ||
Sectors: resolvers, | ||
More: snapshot.More, | ||
At: graphql.Time{Time: snapshot.At}, | ||
}, nil | ||
} | ||
|
||
// mutation: sectorsListRefresh() | ||
func (r *resolver) SectorsListRefresh(ctx context.Context) (bool, error) { | ||
return true, r.sectorsList.Refresh(ctx) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
.block-stats th { | ||
text-align: left; | ||
} | ||
|
||
.block-stats td, .block-stats th { | ||
padding: 0.5em 1em; | ||
} | ||
|
||
.lid-graphs { | ||
margin-top: 2em; | ||
width: 100%; | ||
} | ||
|
||
.lid-graphs td { | ||
vertical-align: top; | ||
} | ||
|
||
.storage-chart { | ||
padding: 1em; | ||
} | ||
|
||
.storage-chart .indexed, .storage-chart .unsealed, .storage-chart .active { | ||
background-color: rgb(44, 123, 229); | ||
} | ||
|
||
.storage-chart .flagged { | ||
background-color: rgb(166, 197, 247); | ||
} | ||
|
||
.storage-chart .sealed, .storage-chart .inactive { | ||
background-color: #b3b3b3; | ||
} | ||
|
||
.storage-fields td { | ||
padding: 0.5em 1em; | ||
font-weight: normal; | ||
} | ||
|
||
.sectors-list-link p, .flagged-pieces-link p { | ||
padding: 1em; | ||
} | ||
|
||
.sectors-list-link a, .flagged-pieces-link a { | ||
margin-left: 1em; | ||
} |
Oops, something went wrong.