Chore: Restore folder properties (#58743)

* Chore: Fix folder URL

* Restore more folder properties

* Fixup
This commit is contained in:
Sofia Papagiannaki 2022-11-15 12:58:12 +02:00 committed by GitHub
parent 98dbc637cc
commit 93b4b9154e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 35 additions and 37 deletions

View File

@ -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),
}
}

View File

@ -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,
}
}