add channel message item info to details (#4092)
#### Does this PR need a docs update or release note? - [x] ⛔ No #### Type of change - [x] 🌻 Feature #### Issue(s) * #3989 #### Test Plan - [x] ⚡ Unit test - [x] 💚 E2E
This commit is contained in:
parent
af5d98e182
commit
719d6b98cd
@ -1,9 +1,11 @@
|
|||||||
package details
|
package details
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/alcionai/clues"
|
"github.com/alcionai/clues"
|
||||||
|
"github.com/dustin/go-humanize"
|
||||||
|
|
||||||
"github.com/alcionai/corso/src/internal/common/dttm"
|
"github.com/alcionai/corso/src/internal/common/dttm"
|
||||||
"github.com/alcionai/corso/src/pkg/path"
|
"github.com/alcionai/corso/src/pkg/path"
|
||||||
@ -45,8 +47,12 @@ type GroupsInfo struct {
|
|||||||
Size int64 `json:"size,omitempty"`
|
Size int64 `json:"size,omitempty"`
|
||||||
|
|
||||||
// Channels Specific
|
// Channels Specific
|
||||||
ChannelName string `json:"channelName,omitempty"`
|
ChannelName string `json:"channelName,omitempty"`
|
||||||
ChannelID string `json:"channelID,omitempty"`
|
ChannelID string `json:"channelID,omitempty"`
|
||||||
|
LastResponseAt time.Time `json:"lastResponseAt,omitempty"`
|
||||||
|
MessageCreator string `json:"messageCreator,omitempty"`
|
||||||
|
MessagePreview string `json:"messagePreview,omitempty"`
|
||||||
|
ReplyCount int `json:"replyCount,omitempty"`
|
||||||
|
|
||||||
// SharePoint specific
|
// SharePoint specific
|
||||||
DriveName string `json:"driveName,omitempty"`
|
DriveName string `json:"driveName,omitempty"`
|
||||||
@ -58,16 +64,42 @@ type GroupsInfo struct {
|
|||||||
// Headers returns the human-readable names of properties in a SharePointInfo
|
// Headers returns the human-readable names of properties in a SharePointInfo
|
||||||
// for printing out to a terminal in a columnar display.
|
// for printing out to a terminal in a columnar display.
|
||||||
func (i GroupsInfo) Headers() []string {
|
func (i GroupsInfo) Headers() []string {
|
||||||
return []string{"Created", "Modified"}
|
switch i.ItemType {
|
||||||
|
case SharePointLibrary:
|
||||||
|
return []string{"ItemName", "Library", "ParentPath", "Size", "Owner", "Created", "Modified"}
|
||||||
|
case TeamsChannelMessage:
|
||||||
|
return []string{"Message", "Channel", "Replies", "Creator", "Created", "Last Response"}
|
||||||
|
}
|
||||||
|
|
||||||
|
return []string{}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Values returns the values matching the Headers list for printing
|
// Values returns the values matching the Headers list for printing
|
||||||
// out to a terminal in a columnar display.
|
// out to a terminal in a columnar display.
|
||||||
func (i GroupsInfo) Values() []string {
|
func (i GroupsInfo) Values() []string {
|
||||||
return []string{
|
switch i.ItemType {
|
||||||
dttm.FormatToTabularDisplay(i.Created),
|
case SharePointLibrary:
|
||||||
dttm.FormatToTabularDisplay(i.Modified),
|
return []string{
|
||||||
|
i.ItemName,
|
||||||
|
i.DriveName,
|
||||||
|
i.ParentPath,
|
||||||
|
humanize.Bytes(uint64(i.Size)),
|
||||||
|
i.Owner,
|
||||||
|
dttm.FormatToTabularDisplay(i.Created),
|
||||||
|
dttm.FormatToTabularDisplay(i.Modified),
|
||||||
|
}
|
||||||
|
case TeamsChannelMessage:
|
||||||
|
return []string{
|
||||||
|
i.MessagePreview,
|
||||||
|
i.ChannelName,
|
||||||
|
strconv.Itoa(i.ReplyCount),
|
||||||
|
i.MessageCreator,
|
||||||
|
dttm.FormatToTabularDisplay(i.Created),
|
||||||
|
dttm.FormatToTabularDisplay(i.Modified),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return []string{}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (i *GroupsInfo) UpdateParentPath(newLocPath *path.Builder) {
|
func (i *GroupsInfo) UpdateParentPath(newLocPath *path.Builder) {
|
||||||
|
|||||||
@ -37,6 +37,9 @@ const (
|
|||||||
|
|
||||||
// Folder Management(30x)
|
// Folder Management(30x)
|
||||||
FolderItem ItemType = 306
|
FolderItem ItemType = 306
|
||||||
|
|
||||||
|
// Groups/Teams(40x)
|
||||||
|
TeamsChannelMessage ItemType = 401
|
||||||
)
|
)
|
||||||
|
|
||||||
func UpdateItem(item *ItemInfo, newLocPath *path.Builder) {
|
func UpdateItem(item *ItemInfo, newLocPath *path.Builder) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user