remove general folder in legacy api
This commit is contained in:
@@ -2174,13 +2174,18 @@ func (dr *DashboardServiceImpl) unstructuredToLegacyDashboardWithUsers(item *uns
|
||||
dashVersion := obj.GetGeneration()
|
||||
spec["version"] = dashVersion
|
||||
|
||||
folderUID := obj.GetFolder()
|
||||
if folderUID == folder.GeneralFolderUID {
|
||||
folderUID = "" // empty in legacy API
|
||||
}
|
||||
|
||||
title, _, _ := unstructured.NestedString(spec, "title")
|
||||
out := dashboards.Dashboard{
|
||||
OrgID: orgID,
|
||||
ID: obj.GetDeprecatedInternalID(), // nolint:staticcheck
|
||||
UID: uid,
|
||||
Slug: slugify.Slugify(title),
|
||||
FolderUID: obj.GetFolder(),
|
||||
FolderUID: folderUID,
|
||||
Version: int(dashVersion),
|
||||
Data: simplejson.NewFromAny(spec),
|
||||
APIVersion: strings.TrimPrefix(item.GetAPIVersion(), dashboardv0.GROUP+"/"),
|
||||
|
||||
@@ -1089,13 +1089,13 @@ func TestIntegrationDashboardServicePermissions(t *testing.T) {
|
||||
|
||||
resp, err := postDashboard(t, grafanaListedAddr, "viewer", "viewer", dashboardPayload)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, http.StatusForbidden, resp.StatusCode)
|
||||
require.Equal(t, http.StatusForbidden, resp.StatusCode)
|
||||
err = resp.Body.Close()
|
||||
require.NoError(t, err)
|
||||
|
||||
resp, err = postDashboard(t, grafanaListedAddr, "editor", "editor", dashboardPayload)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, http.StatusOK, resp.StatusCode)
|
||||
require.Equal(t, http.StatusOK, resp.StatusCode)
|
||||
err = resp.Body.Close()
|
||||
require.NoError(t, err)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user