Folders: Convert between unstructured and legacy (#99504)
This commit is contained in:
@@ -28,6 +28,10 @@ type Folder struct {
|
||||
ParentUID string `json:"parentUid,omitempty"`
|
||||
// the parent folders starting from the root going down
|
||||
Parents []Folder `json:"parents,omitempty"`
|
||||
|
||||
// When the folder belongs to a repository
|
||||
// NOTE: this is only populated when folders are managed by unified storage
|
||||
Repository string `json:"repository,omitempty"`
|
||||
}
|
||||
|
||||
type FolderSearchHit struct {
|
||||
@@ -35,4 +39,8 @@ type FolderSearchHit struct {
|
||||
UID string `json:"uid" xorm:"uid"`
|
||||
Title string `json:"title"`
|
||||
ParentUID string `json:"parentUid,omitempty"`
|
||||
|
||||
// When the folder belongs to a repository
|
||||
// NOTE: this is only populated when folders are managed by unified storage
|
||||
Repository string `json:"repository,omitempty"`
|
||||
}
|
||||
|
||||
+6
-4
@@ -94,10 +94,11 @@ func (hs *HTTPServer) GetFolders(c *contextmodel.ReqContext) response.Response {
|
||||
hits := make([]dtos.FolderSearchHit, 0)
|
||||
for _, f := range folders {
|
||||
hits = append(hits, dtos.FolderSearchHit{
|
||||
ID: f.ID, // nolint:staticcheck
|
||||
UID: f.UID,
|
||||
Title: f.Title,
|
||||
ParentUID: f.ParentUID,
|
||||
ID: f.ID, // nolint:staticcheck
|
||||
UID: f.UID,
|
||||
Title: f.Title,
|
||||
ParentUID: f.ParentUID,
|
||||
Repository: f.Repository,
|
||||
})
|
||||
metrics.MFolderIDsAPICount.WithLabelValues(metrics.GetFolders).Inc()
|
||||
}
|
||||
@@ -425,6 +426,7 @@ func (hs *HTTPServer) newToFolderDto(c *contextmodel.ReqContext, f *folder.Folde
|
||||
Version: f.Version,
|
||||
AccessControl: acMetadata,
|
||||
ParentUID: f.ParentUID,
|
||||
Repository: f.Repository,
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user