mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Chore: Deprecate FolderID in CreateLibraryElementComand (#77403)
* Chore: Deprecate FolderID in CreateLibraryElementComand * chore: add remaining nolint comments * chore: regen specs to include deprecation notice
This commit is contained in:
@@ -62,6 +62,7 @@ func (l *LibraryElementService) createHandler(c *contextmodel.ReqContext) respon
|
||||
|
||||
if cmd.FolderUID != nil {
|
||||
if *cmd.FolderUID == "" {
|
||||
// nolint:staticcheck
|
||||
cmd.FolderID = 0
|
||||
generalFolderUID := ac.GeneralFolderUID
|
||||
cmd.FolderUID = &generalFolderUID
|
||||
@@ -70,6 +71,7 @@ func (l *LibraryElementService) createHandler(c *contextmodel.ReqContext) respon
|
||||
if err != nil || folder == nil {
|
||||
return response.ErrOrFallback(http.StatusBadRequest, "failed to get folder", err)
|
||||
}
|
||||
// nolint:staticcheck
|
||||
cmd.FolderID = folder.ID
|
||||
}
|
||||
}
|
||||
|
||||
@@ -175,6 +175,7 @@ func (l *LibraryElementService) createLibraryElement(c context.Context, signedIn
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
// nolint:staticcheck
|
||||
if err := l.requireEditPermissionsOnFolder(c, signedInUser, cmd.FolderID); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -252,7 +252,7 @@ func getCreateVariableCommand(folderID int64, name string) model.CreateLibraryEl
|
||||
|
||||
func getCreateCommandWithModel(folderID int64, name string, kind model.LibraryElementKind, byteModel []byte) model.CreateLibraryElementCommand {
|
||||
command := model.CreateLibraryElementCommand{
|
||||
FolderID: folderID,
|
||||
FolderID: folderID, // nolint:staticcheck
|
||||
Name: name,
|
||||
Model: byteModel,
|
||||
Kind: int64(kind),
|
||||
|
||||
@@ -192,6 +192,8 @@ var (
|
||||
// swagger:model
|
||||
type CreateLibraryElementCommand struct {
|
||||
// ID of the folder where the library element is stored.
|
||||
//
|
||||
// Deprecated: use FolderUID instead
|
||||
FolderID int64 `json:"folderId"`
|
||||
// UID of the folder where the library element is stored.
|
||||
FolderUID *string `json:"folderUid"`
|
||||
|
||||
Reference in New Issue
Block a user