add drive name to queue count observe

This commit is contained in:
ryanfkeepers 2023-03-15 16:13:52 -06:00
parent 353a9682f4
commit b79e06cfb0
5 changed files with 26 additions and 18 deletions

View File

@ -259,10 +259,12 @@ func createCollections(
Credentials: creds,
}
foldersComplete, closer := observe.MessageWithCompletion(ctx, observe.Bulletf(
"%s - %s",
observe.Safe(qp.Category.String()),
observe.PII(user)))
foldersComplete, closer := observe.MessageWithCompletion(
ctx,
observe.Bulletf(
"%s - %s",
observe.Safe(qp.Category.String()),
observe.PII(user)))
defer closer()
defer close(foldersComplete)

View File

@ -383,10 +383,15 @@ func (oc *Collection) populateItems(ctx context.Context, errs *fault.Bus) {
return
}
queuedPath := "/" + parentPathString
if oc.source == SharePointSource && len(oc.driveName) > 0 {
queuedPath = "/" + oc.driveName + queuedPath
}
folderProgress, colCloser := observe.ProgressWithCount(
ctx,
observe.ItemQueueMsg,
observe.PII("/"+parentPathString),
observe.PII(queuedPath),
int64(len(oc.driveItems)))
defer colCloser()
defer close(folderProgress)

View File

@ -154,9 +154,12 @@ func Message(ctx context.Context, msg cleanable) {
bar := progress.New(
-1,
mpb.NopStyle(),
mpb.PrependDecorators(
decor.Name(message, decor.WC{W: len(message) + 1, C: decor.DidentRight}),
),
mpb.PrependDecorators(decor.Name(
message,
decor.WC{
W: len(message) + 1,
C: decor.DidentRight,
})),
)
// Complete the bar immediately
@ -193,8 +196,7 @@ func MessageWithCompletion(
mpb.SpinnerStyle(frames...).PositionLeft(),
mpb.PrependDecorators(
decor.Name(message+":"),
decor.Elapsed(decor.ET_STYLE_GO, decor.WC{W: 8}),
),
decor.Elapsed(decor.ET_STYLE_GO, decor.WC{W: 8})),
mpb.BarFillerOnComplete("done"),
)
@ -248,8 +250,7 @@ func ItemProgress(
decor.Name(header, decor.WCSyncSpaceR),
decor.Name(iname.String(), decor.WCSyncSpaceR),
decor.CountersKibiByte(" %.1f/%.1f ", decor.WC{W: 8}),
decor.NewPercentage("%d ", decor.WC{W: 4}),
),
decor.NewPercentage("%d ", decor.WC{W: 4})),
}
if !cfg.keepBarsAfterComplete {
@ -295,8 +296,7 @@ func ProgressWithCount(
mpb.PrependDecorators(
decor.Name(header, decor.WCSyncSpaceR),
decor.Name(message.String()),
decor.Counters(0, " %d/%d "),
),
decor.Counters(0, " %d/%d ")),
}
if !cfg.keepBarsAfterComplete {

View File

@ -652,7 +652,7 @@ type SharePointInfo struct {
// Headers returns the human-readable names of properties in a SharePointInfo
// for printing out to a terminal in a columnar display.
func (i SharePointInfo) Headers() []string {
return []string{"ItemName", "Library", "ParentPath", "Size", "WebURL", "Created", "Modified"}
return []string{"ItemName", "Library", "ParentPath", "Size", "Owner", "Created", "Modified"}
}
// Values returns the values matching the Headers list for printing
@ -663,7 +663,7 @@ func (i SharePointInfo) Values() []string {
i.DriveName,
i.ParentPath,
humanize.Bytes(uint64(i.Size)),
i.WebURL,
i.Owner,
common.FormatTabularDisplayTime(i.Created),
common.FormatTabularDisplayTime(i.Modified),
}

View File

@ -119,19 +119,20 @@ func (suite *DetailsUnitSuite) TestDetailsEntry_HeadersValues() {
Size: 1000,
WebURL: "https://not.a.real/url",
DriveName: "aLibrary",
Owner: "user@email.com",
Created: now,
Modified: now,
},
},
},
expectHs: []string{"ID", "ItemName", "Library", "ParentPath", "Size", "WebURL", "Created", "Modified"},
expectHs: []string{"ID", "ItemName", "Library", "ParentPath", "Size", "Owner", "Created", "Modified"},
expectVs: []string{
"deadbeef",
"itemName",
"aLibrary",
"parentPath",
"1.0 kB",
"https://not.a.real/url",
"user@email.com",
nowStr,
nowStr,
},