mirror of
https://github.com/grafana/grafana.git
synced 2025-08-03 00:42:03 +08:00
Chore: Deprecate FolderID in LibraryElementDTO (#77471)
* Chore: Deprecate FolderID in LibraryElementDTO * chore: fix formatting of deprecation comment * chore: revert deprecation comment formatting * chore: regen specs
This commit is contained in:
@ -81,6 +81,7 @@ func (l *LibraryElementService) createHandler(c *contextmodel.ReqContext) respon
|
||||
return toLibraryElementError(err, "Failed to create library element")
|
||||
}
|
||||
|
||||
// nolint:staticcheck
|
||||
if element.FolderID != 0 {
|
||||
folder, err := l.folderService.Get(c.Req.Context(), &folder.GetFolderQuery{OrgID: c.SignedInUser.GetOrgID(), ID: &element.FolderID, SignedInUser: c.SignedInUser})
|
||||
if err != nil {
|
||||
@ -223,6 +224,7 @@ func (l *LibraryElementService) patchHandler(c *contextmodel.ReqContext) respons
|
||||
return toLibraryElementError(err, "Failed to update library element")
|
||||
}
|
||||
|
||||
// nolint:staticcheck
|
||||
if element.FolderID != 0 {
|
||||
folder, err := l.folderService.Get(c.Req.Context(), &folder.GetFolderQuery{OrgID: c.SignedInUser.GetOrgID(), ID: &element.FolderID, SignedInUser: c.SignedInUser})
|
||||
if err != nil {
|
||||
|
@ -69,8 +69,9 @@ type LibraryElementWithMeta struct {
|
||||
|
||||
// LibraryElementDTO is the frontend DTO for entities.
|
||||
type LibraryElementDTO struct {
|
||||
ID int64 `json:"id"`
|
||||
OrgID int64 `json:"orgId"`
|
||||
ID int64 `json:"id"`
|
||||
OrgID int64 `json:"orgId"`
|
||||
// Deprecated: use FolderUID instead
|
||||
FolderID int64 `json:"folderId"`
|
||||
FolderUID string `json:"folderUid"`
|
||||
UID string `json:"uid"`
|
||||
|
@ -638,7 +638,7 @@ func toLibraryElement(t *testing.T, res model.LibraryElementDTO) libraryElement
|
||||
return libraryElement{
|
||||
ID: res.ID,
|
||||
OrgID: res.OrgID,
|
||||
FolderID: res.FolderID,
|
||||
FolderID: res.FolderID, // nolint:staticcheck
|
||||
UID: res.UID,
|
||||
Name: res.Name,
|
||||
Type: res.Type,
|
||||
@ -785,7 +785,7 @@ func scenarioWithLibraryPanel(t *testing.T, desc string, fn func(t *testing.T, s
|
||||
Result: libraryPanel{
|
||||
ID: resp.ID,
|
||||
OrgID: resp.OrgID,
|
||||
FolderID: resp.FolderID,
|
||||
FolderID: resp.FolderID, // nolint:staticcheck
|
||||
UID: resp.UID,
|
||||
Name: resp.Name,
|
||||
Type: resp.Type,
|
||||
|
@ -15761,6 +15761,7 @@
|
||||
"type": "string"
|
||||
},
|
||||
"folderId": {
|
||||
"description": "Deprecated: use FolderUID instead",
|
||||
"type": "integer",
|
||||
"format": "int64"
|
||||
},
|
||||
|
@ -6673,6 +6673,7 @@
|
||||
"type": "string"
|
||||
},
|
||||
"folderId": {
|
||||
"description": "Deprecated: use FolderUID instead",
|
||||
"format": "int64",
|
||||
"type": "integer"
|
||||
},
|
||||
|
Reference in New Issue
Block a user