diff --git a/pkg/api/index.go b/pkg/api/index.go index 5e66015471b..79d35c4bf75 100644 --- a/pkg/api/index.go +++ b/pkg/api/index.go @@ -164,7 +164,15 @@ func (hs *HTTPServer) getNavTree(c *models.ReqContext, hasEditPerm bool) ([]*dto {Text: "Divider", Divider: true, Id: "divider", HideFromTabs: true}, {Text: "Manage", Id: "manage-dashboards", Url: setting.AppSubUrl + "/dashboards", Icon: "sitemap"}, {Text: "Playlists", Id: "playlists", Url: setting.AppSubUrl + "/playlists", Icon: "presentation-play"}, - {Text: "Snapshots", Id: "snapshots", Url: setting.AppSubUrl + "/dashboard/snapshots", Icon: "camera"}, + } + + if c.IsSignedIn { + dashboardChildNavs = append(dashboardChildNavs, &dtos.NavLink{ + Text: "Snapshots", + Id: "snapshots", + Url: setting.AppSubUrl + "/dashboard/snapshots", + Icon: "camera", + }) } navTree = append(navTree, &dtos.NavLink{ diff --git a/public/app/features/manage-dashboards/components/SnapshotListTable.tsx b/public/app/features/manage-dashboards/components/SnapshotListTable.tsx index 2aa5d13f622..744f4c890b5 100644 --- a/public/app/features/manage-dashboards/components/SnapshotListTable.tsx +++ b/public/app/features/manage-dashboards/components/SnapshotListTable.tsx @@ -1,7 +1,6 @@ import React, { FC, useState, useCallback, useEffect } from 'react'; import { ConfirmModal, Button, LinkButton } from '@grafana/ui'; import { getBackendSrv } from '@grafana/runtime'; -import { noop } from 'rxjs'; import { Snapshot } from '../types'; interface Props { @@ -28,11 +27,12 @@ export const SnapshotListTable: FC = ({ url }) => { const doRemoveSnapshot = useCallback( async (snapshot: Snapshot) => { - setSnapshots(snapshots.filter(ss => ss.key !== snapshot.key)); + const filteredSnapshots = snapshots.filter(ss => ss.key !== snapshot.key); + setSnapshots(filteredSnapshots); await getBackendSrv() .delete(`/api/snapshots/${snapshot.key}`) - .then(noop, () => { - setSnapshots(snapshots.concat(snapshot)); + .catch(() => { + setSnapshots(snapshots); }); }, [snapshots] @@ -59,9 +59,9 @@ export const SnapshotListTable: FC = ({ url }) => { - {snapshots.map((snapshot, key) => { + {snapshots.map(snapshot => { return ( - + {snapshot.name} diff --git a/public/app/features/playlist/partials/playlists.html b/public/app/features/playlist/partials/playlists.html index 291fb1822f2..fccba3e0f9c 100644 --- a/public/app/features/playlist/partials/playlists.html +++ b/public/app/features/playlist/partials/playlists.html @@ -2,7 +2,7 @@
-
+
New playlist @@ -13,11 +13,12 @@ Name - + - - {{playlist.name}} + + {{playlist.name}} + {{playlist.name}}
- +
+ +
+
+
There are no playlists created yet
+

Unfortunately you don't have permission to create playlists.

+
+