diff --git a/pkg/api/api.go b/pkg/api/api.go index 75d9cf3b763..4f57e1815e9 100644 --- a/pkg/api/api.go +++ b/pkg/api/api.go @@ -114,8 +114,11 @@ func (hs *HTTPServer) registerRoutes() { r.Get("/admin/orgs", authorizeInOrg(reqGrafanaAdmin, ac.UseGlobalOrg, ac.OrgsAccessEvaluator), hs.Index) r.Get("/admin/orgs/edit/:id", authorizeInOrg(reqGrafanaAdmin, ac.UseGlobalOrg, ac.OrgsAccessEvaluator), hs.Index) r.Get("/admin/stats", authorize(reqGrafanaAdmin, ac.EvalPermission(ac.ActionServerStatsRead)), hs.Index) - r.Get("/admin/storage/*", reqGrafanaAdmin, hs.Index) r.Get("/admin/ldap", authorize(reqGrafanaAdmin, ac.EvalPermission(ac.ActionLDAPStatusRead)), hs.Index) + if hs.Features.IsEnabled(featuremgmt.FlagStorage) { + r.Get("/admin/storage", reqSignedIn, hs.Index) + r.Get("/admin/storage/*", reqSignedIn, hs.Index) + } r.Get("/styleguide", reqSignedIn, hs.Index) r.Get("/live", reqGrafanaAdmin, hs.Index) diff --git a/pkg/services/navtree/models.go b/pkg/services/navtree/models.go index 276318892c2..d1de2fbc52c 100644 --- a/pkg/services/navtree/models.go +++ b/pkg/services/navtree/models.go @@ -245,6 +245,8 @@ func ApplyAdminIA(root *NavTreeRoot) { adminNodeLinks = append(adminNodeLinks, accessNode) } + adminNodeLinks = AppendIfNotNil(adminNodeLinks, root.FindById("storage")) + if len(adminNodeLinks) > 0 { orgAdminNode.Children = adminNodeLinks } else { diff --git a/pkg/services/store/service.go b/pkg/services/store/service.go index fc17c6b85b1..bc77c693ea4 100644 --- a/pkg/services/store/service.go +++ b/pkg/services/store/service.go @@ -592,8 +592,7 @@ func (s *standardStorageService) getWorkflowOptions(ctx context.Context, user *u Workflows: make([]workflowInfo, 0), } - scope, _ := splitFirstSegment(path) - root, _ := s.tree.getRoot(user.OrgID, scope) + root, _ := s.tree.getRoot(user.OrgID, path) if root == nil { return options, fmt.Errorf("can not read") } diff --git a/public/app/features/dashboard/components/SaveDashboard/forms/SaveToStorageForm.tsx b/public/app/features/dashboard/components/SaveDashboard/forms/SaveToStorageForm.tsx index 052f293733c..5b1c71d2532 100644 --- a/public/app/features/dashboard/components/SaveDashboard/forms/SaveToStorageForm.tsx +++ b/public/app/features/dashboard/components/SaveDashboard/forms/SaveToStorageForm.tsx @@ -96,7 +96,8 @@ export function SaveToStorageForm(props: Props) { } setSaving(true); - let uid = saveModel.clone.uid; + // Save dashboard without the UID + let { uid, ...body } = saveModel.clone; if (isNew || isCopy) { uid = path; if (!uid.endsWith('-dash.json')) { @@ -104,7 +105,7 @@ export function SaveToStorageForm(props: Props) { } } const rsp = await getGrafanaStorage().write(uid, { - body: saveModel.clone, + body, kind: 'dashboard', title: data.title, message: data.message, diff --git a/public/app/features/storage/RootView.tsx b/public/app/features/storage/RootView.tsx index d667758fdcc..e1c56fe1ee4 100644 --- a/public/app/features/storage/RootView.tsx +++ b/public/app/features/storage/RootView.tsx @@ -133,9 +133,6 @@ function getTags(v: StorageInfo) { if (v.builtin) { tags.push('Builtin'); } - if (!v.editable) { - tags.push('Read only'); - } // Error if (!v.ready) { diff --git a/public/app/features/storage/StoragePage.tsx b/public/app/features/storage/StoragePage.tsx index 5e94332cd56..dfd86c879cb 100644 --- a/public/app/features/storage/StoragePage.tsx +++ b/public/app/features/storage/StoragePage.tsx @@ -149,7 +149,7 @@ export default function StoragePage(props: Props) { // Lets only apply permissions to folders (for now) if (isFolder) { - opts.push({ what: StorageView.Perms, text: 'Permissions' }); + // opts.push({ what: StorageView.Perms, text: 'Permissions' }); } else { // TODO: only if the file exists in a storage engine with opts.push({ what: StorageView.History, text: 'History' }); @@ -181,7 +181,7 @@ export default function StoragePage(props: Props) { {canViewDashboard && ( - + Dashboard )}