mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Playlists: Remove API validation for empty playlists and remove redundant API call (#26982)
* Remove validation from empty playlists * Remove redundant API call Frontend used to call /api/playlists/:id/items directly after /api/playlists/:id but items are already included in the first response
This commit is contained in:
committed by
GitHub
parent
bb0f17ce59
commit
7ad1e3663c
@@ -1,8 +1,6 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/grafana/grafana/pkg/bus"
|
||||
"github.com/grafana/grafana/pkg/models"
|
||||
)
|
||||
@@ -26,18 +24,6 @@ func ValidateOrgPlaylist(c *models.ReqContext) {
|
||||
c.JsonApiErr(403, "You are not allowed to edit/view playlist", nil)
|
||||
return
|
||||
}
|
||||
|
||||
items, itemsErr := LoadPlaylistItemDTOs(id)
|
||||
|
||||
if itemsErr != nil {
|
||||
c.JsonApiErr(404, "Playlist items not found", err)
|
||||
return
|
||||
}
|
||||
|
||||
if len(items) == 0 && c.Context.Req.Method != http.MethodDelete {
|
||||
c.JsonApiErr(404, "Playlist is empty", itemsErr)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
func SearchPlaylists(c *models.ReqContext) Response {
|
||||
|
||||
@@ -46,14 +46,7 @@ export class PlaylistEditCtrl {
|
||||
.get('/api/playlists/' + playlistId)
|
||||
.then((result: any) => {
|
||||
this.playlist = result;
|
||||
})
|
||||
);
|
||||
|
||||
promiseToDigest(this.$scope)(
|
||||
getBackendSrv()
|
||||
.get('/api/playlists/' + playlistId + '/items')
|
||||
.then((result: any) => {
|
||||
this.playlistItems = result;
|
||||
this.playlistItems = result.items;
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user