From 36d7d44bb4ad8a194df92ce2114ef1d5d61b25c8 Mon Sep 17 00:00:00 2001 From: Danny Date: Mon, 6 Mar 2023 10:01:26 -0800 Subject: [PATCH] Corso: Exchange: Details: add parentpath (#2690) Parent Path field added to `Exchange` Backup Details --- - Only Exchange mail will display the path for backup details. #### Does this PR need a docs update or release note? - [x] :no_entry: No #### Type of change - [x] :sunflower: Feature - [x] :broom: Tech Debt/Cleanup #### Issue(s) * closes #2352 #### Test Plan - [x] :zap: Unit test --- .../connector/exchange/exchange_data_collection.go | 2 ++ src/pkg/backup/details/details.go | 5 +++-- src/pkg/backup/details/details_test.go | 13 +++++++------ 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/internal/connector/exchange/exchange_data_collection.go b/src/internal/connector/exchange/exchange_data_collection.go index 74eda30fa..fe06c317d 100644 --- a/src/internal/connector/exchange/exchange_data_collection.go +++ b/src/internal/connector/exchange/exchange_data_collection.go @@ -7,6 +7,7 @@ import ( "bytes" "context" "io" + "strings" "sync" "sync/atomic" "time" @@ -266,6 +267,7 @@ func (col *Collection) streamItems(ctx context.Context, errs *fault.Bus) { } info.Size = int64(len(data)) + info.ParentPath = strings.Join(col.fullPath.Folders(), "/") col.data <- &Stream{ id: id, diff --git a/src/pkg/backup/details/details.go b/src/pkg/backup/details/details.go index 74ce380d2..a70343d61 100644 --- a/src/pkg/backup/details/details.go +++ b/src/pkg/backup/details/details.go @@ -516,6 +516,7 @@ type ExchangeInfo struct { ItemType ItemType `json:"itemType,omitempty"` Sender string `json:"sender,omitempty"` Subject string `json:"subject,omitempty"` + ParentPath string `json:"parentPath,omitempty"` Received time.Time `json:"received,omitempty"` EventStart time.Time `json:"eventStart,omitempty"` EventEnd time.Time `json:"eventEnd,omitempty"` @@ -538,7 +539,7 @@ func (i ExchangeInfo) Headers() []string { return []string{"Contact Name"} case ExchangeMail: - return []string{"Sender", "Subject", "Received"} + return []string{"Sender", "Folder", "Subject", "Received"} } return []string{} @@ -562,7 +563,7 @@ func (i ExchangeInfo) Values() []string { case ExchangeMail: return []string{ - i.Sender, i.Subject, + i.Sender, i.ParentPath, i.Subject, common.FormatTabularDisplayTime(i.Received), } } diff --git a/src/pkg/backup/details/details_test.go b/src/pkg/backup/details/details_test.go index 2ea7e414c..45adc053e 100644 --- a/src/pkg/backup/details/details_test.go +++ b/src/pkg/backup/details/details_test.go @@ -91,15 +91,16 @@ func (suite *DetailsUnitSuite) TestDetailsEntry_HeadersValues() { LocationRef: "locationref", ItemInfo: ItemInfo{ Exchange: &ExchangeInfo{ - ItemType: ExchangeMail, - Sender: "sender", - Subject: "subject", - Received: now, + ItemType: ExchangeMail, + Sender: "sender", + ParentPath: "Parent", + Subject: "subject", + Received: now, }, }, }, - expectHs: []string{"ID", "Sender", "Subject", "Received"}, - expectVs: []string{"deadbeef", "sender", "subject", nowStr}, + expectHs: []string{"ID", "Sender", "Folder", "Subject", "Received"}, + expectVs: []string{"deadbeef", "sender", "Parent", "subject", nowStr}, }, { name: "sharepoint info",