RestoreDashboards: add IsDeleted and PermanentlyDeleteDate to deleted search (#89283)

RestoreDashboards: add IsDeleted and PermanentlyDeleteDate to deleted items in Search
This commit is contained in:
Josh Hunt 2024-06-17 14:26:23 +01:00 committed by GitHub
parent e75fbe10ca
commit 51c0644e41
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 40 additions and 22 deletions

View File

@ -741,7 +741,9 @@ func makeQueryResult(query *dashboards.FindPersistedDashboardsQuery, res []dashb
hit.Tags = append(hit.Tags, item.Term)
}
if item.Deleted != nil {
hit.RemainingTrashAtAge = util.RemainingDaysUntil((*item.Deleted).Add(daysInTrash))
deletedDate := (*item.Deleted).Add(daysInTrash)
hit.IsDeleted = true
hit.PermanentlyDeleteDate = &deletedDate
}
}
return hitList

View File

@ -2,6 +2,7 @@ package model
import (
"strings"
"time"
)
// FilterWhere limits the set of dashboard IDs to the dashboards for
@ -62,22 +63,23 @@ const (
)
type Hit struct {
ID int64 `json:"id"`
UID string `json:"uid"`
Title string `json:"title"`
URI string `json:"uri"`
URL string `json:"url"`
Slug string `json:"slug"`
Type HitType `json:"type"`
Tags []string `json:"tags"`
IsStarred bool `json:"isStarred"`
FolderID int64 `json:"folderId,omitempty"` // Deprecated: use FolderUID instead
FolderUID string `json:"folderUid,omitempty"`
FolderTitle string `json:"folderTitle,omitempty"`
FolderURL string `json:"folderUrl,omitempty"`
SortMeta int64 `json:"sortMeta"`
SortMetaName string `json:"sortMetaName,omitempty"`
RemainingTrashAtAge string `json:"remainingTrashAtAge,omitempty"`
ID int64 `json:"id"`
UID string `json:"uid"`
Title string `json:"title"`
URI string `json:"uri"`
URL string `json:"url"`
Slug string `json:"slug"`
Type HitType `json:"type"`
Tags []string `json:"tags"`
IsStarred bool `json:"isStarred"`
FolderID int64 `json:"folderId,omitempty"` // Deprecated: use FolderUID instead
FolderUID string `json:"folderUid,omitempty"`
FolderTitle string `json:"folderTitle,omitempty"`
FolderURL string `json:"folderUrl,omitempty"`
SortMeta int64 `json:"sortMeta"`
SortMetaName string `json:"sortMetaName,omitempty"`
IsDeleted bool `json:"isDeleted"`
PermanentlyDeleteDate *time.Time `json:"permanentlyDeleteDate,omitempty"`
}
type HitList []*Hit

View File

@ -4703,11 +4703,15 @@
"type": "integer",
"format": "int64"
},
"isDeleted": {
"type": "boolean"
},
"isStarred": {
"type": "boolean"
},
"remainingTrashAtAge": {
"type": "string"
"permanentlyDeleteDate": {
"type": "string",
"format": "date-time"
},
"slug": {
"type": "string"
@ -7049,6 +7053,7 @@
}
},
"State": {
"description": "+enum",
"type": "string"
},
"Status": {
@ -7492,6 +7497,7 @@
}
},
"Type": {
"description": "+enum",
"type": "string"
},
"TypeMeta": {

View File

@ -15815,11 +15815,15 @@
"type": "integer",
"format": "int64"
},
"isDeleted": {
"type": "boolean"
},
"isStarred": {
"type": "boolean"
},
"remainingTrashAtAge": {
"type": "string"
"permanentlyDeleteDate": {
"type": "string",
"format": "date-time"
},
"slug": {
"type": "string"

View File

@ -6194,10 +6194,14 @@
"format": "int64",
"type": "integer"
},
"isDeleted": {
"type": "boolean"
},
"isStarred": {
"type": "boolean"
},
"remainingTrashAtAge": {
"permanentlyDeleteDate": {
"format": "date-time",
"type": "string"
},
"slug": {