Corso: Exchange: Details: add parentpath (#2690)

<!-- Insert PR description-->
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

#### Type of change

<!--- Please check the type of change your PR introduces: --->
- [x] 🌻 Feature
- [x] 🧹 Tech Debt/Cleanup

#### Issue(s)

<!-- Can reference multiple issues. Use one of the following "magic words" - "closes, fixes" to auto-close the Github issue. -->
* closes #2352<issue>

#### Test Plan


- [x]  Unit test
This commit is contained in:
Danny 2023-03-06 10:01:26 -08:00 committed by GitHub
parent fc26ff3207
commit 36d7d44bb4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 8 deletions

View File

@ -7,6 +7,7 @@ import (
"bytes" "bytes"
"context" "context"
"io" "io"
"strings"
"sync" "sync"
"sync/atomic" "sync/atomic"
"time" "time"
@ -266,6 +267,7 @@ func (col *Collection) streamItems(ctx context.Context, errs *fault.Bus) {
} }
info.Size = int64(len(data)) info.Size = int64(len(data))
info.ParentPath = strings.Join(col.fullPath.Folders(), "/")
col.data <- &Stream{ col.data <- &Stream{
id: id, id: id,

View File

@ -516,6 +516,7 @@ type ExchangeInfo struct {
ItemType ItemType `json:"itemType,omitempty"` ItemType ItemType `json:"itemType,omitempty"`
Sender string `json:"sender,omitempty"` Sender string `json:"sender,omitempty"`
Subject string `json:"subject,omitempty"` Subject string `json:"subject,omitempty"`
ParentPath string `json:"parentPath,omitempty"`
Received time.Time `json:"received,omitempty"` Received time.Time `json:"received,omitempty"`
EventStart time.Time `json:"eventStart,omitempty"` EventStart time.Time `json:"eventStart,omitempty"`
EventEnd time.Time `json:"eventEnd,omitempty"` EventEnd time.Time `json:"eventEnd,omitempty"`
@ -538,7 +539,7 @@ func (i ExchangeInfo) Headers() []string {
return []string{"Contact Name"} return []string{"Contact Name"}
case ExchangeMail: case ExchangeMail:
return []string{"Sender", "Subject", "Received"} return []string{"Sender", "Folder", "Subject", "Received"}
} }
return []string{} return []string{}
@ -562,7 +563,7 @@ func (i ExchangeInfo) Values() []string {
case ExchangeMail: case ExchangeMail:
return []string{ return []string{
i.Sender, i.Subject, i.Sender, i.ParentPath, i.Subject,
common.FormatTabularDisplayTime(i.Received), common.FormatTabularDisplayTime(i.Received),
} }
} }

View File

@ -91,15 +91,16 @@ func (suite *DetailsUnitSuite) TestDetailsEntry_HeadersValues() {
LocationRef: "locationref", LocationRef: "locationref",
ItemInfo: ItemInfo{ ItemInfo: ItemInfo{
Exchange: &ExchangeInfo{ Exchange: &ExchangeInfo{
ItemType: ExchangeMail, ItemType: ExchangeMail,
Sender: "sender", Sender: "sender",
Subject: "subject", ParentPath: "Parent",
Received: now, Subject: "subject",
Received: now,
}, },
}, },
}, },
expectHs: []string{"ID", "Sender", "Subject", "Received"}, expectHs: []string{"ID", "Sender", "Folder", "Subject", "Received"},
expectVs: []string{"deadbeef", "sender", "subject", nowStr}, expectVs: []string{"deadbeef", "sender", "Parent", "subject", nowStr},
}, },
{ {
name: "sharepoint info", name: "sharepoint info",