mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Chore: Restore folder properties (#58743)
* Chore: Fix folder URL * Restore more folder properties * Fixup
This commit is contained in:
parent
98dbc637cc
commit
93b4b9154e
@ -227,30 +227,28 @@ func (hs *HTTPServer) newToFolderDto(c *models.ReqContext, g guardian.DashboardG
|
||||
|
||||
// Finding creator and last updater of the folder
|
||||
updater, creator := anonString, anonString
|
||||
/*
|
||||
if folder.CreatedBy > 0 {
|
||||
creator = hs.getUserLogin(c.Req.Context(), folder.CreatedBy)
|
||||
}
|
||||
if folder.UpdatedBy > 0 {
|
||||
updater = hs.getUserLogin(c.Req.Context(), folder.UpdatedBy)
|
||||
}
|
||||
*/
|
||||
if folder.CreatedBy > 0 {
|
||||
creator = hs.getUserLogin(c.Req.Context(), folder.CreatedBy)
|
||||
}
|
||||
if folder.UpdatedBy > 0 {
|
||||
updater = hs.getUserLogin(c.Req.Context(), folder.UpdatedBy)
|
||||
}
|
||||
|
||||
return dtos.Folder{
|
||||
Id: folder.ID,
|
||||
Uid: folder.UID,
|
||||
Title: folder.Title,
|
||||
//Url: folder.Url,
|
||||
//HasACL: folder.HasACL,
|
||||
CanSave: canSave,
|
||||
CanEdit: canEdit,
|
||||
CanAdmin: canAdmin,
|
||||
CanDelete: canDelete,
|
||||
CreatedBy: creator,
|
||||
Created: folder.Created,
|
||||
UpdatedBy: updater,
|
||||
Updated: folder.Updated,
|
||||
//Version: folder.Version,
|
||||
Id: folder.ID,
|
||||
Uid: folder.UID,
|
||||
Title: folder.Title,
|
||||
Url: folder.Url,
|
||||
HasACL: folder.HasACL,
|
||||
CanSave: canSave,
|
||||
CanEdit: canEdit,
|
||||
CanAdmin: canAdmin,
|
||||
CanDelete: canDelete,
|
||||
CreatedBy: creator,
|
||||
Created: folder.Created,
|
||||
UpdatedBy: updater,
|
||||
Updated: folder.Updated,
|
||||
Version: folder.Version,
|
||||
AccessControl: hs.getAccessControlMetadata(c, c.OrgID, dashboards.ScopeFoldersPrefix, folder.UID),
|
||||
}
|
||||
}
|
||||
|
@ -34,11 +34,11 @@ type Folder struct {
|
||||
|
||||
// TODO: validate if this field is required/relevant to folders.
|
||||
// currently there is no such column
|
||||
// Version int
|
||||
// Url string
|
||||
// UpdatedBy int64
|
||||
// CreatedBy int64
|
||||
// HasACL bool
|
||||
Version int
|
||||
Url string
|
||||
UpdatedBy int64
|
||||
CreatedBy int64
|
||||
HasACL bool
|
||||
}
|
||||
|
||||
type FolderDTO struct {
|
||||
@ -142,15 +142,15 @@ func (f *Folder) ToLegacyModel() *models.Folder {
|
||||
|
||||
func FromDashboard(dash *models.Dashboard) *Folder {
|
||||
return &Folder{
|
||||
ID: dash.Id,
|
||||
UID: dash.Uid,
|
||||
Title: dash.Title,
|
||||
//HasACL: dash.HasACL,
|
||||
//Url: dash.GetUrl(),
|
||||
//Version: dash.Version,
|
||||
Created: dash.Created,
|
||||
//CreatedBy: dash.CreatedBy,
|
||||
Updated: dash.Updated,
|
||||
//UpdatedBy: dash.UpdatedBy,
|
||||
ID: dash.Id,
|
||||
UID: dash.Uid,
|
||||
Title: dash.Title,
|
||||
HasACL: dash.HasACL,
|
||||
Url: models.GetFolderUrl(dash.Uid, dash.Slug),
|
||||
Version: dash.Version,
|
||||
Created: dash.Created,
|
||||
CreatedBy: dash.CreatedBy,
|
||||
Updated: dash.Updated,
|
||||
UpdatedBy: dash.UpdatedBy,
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user