Public Dashboards: Add audit table (#54508)

This PR adds an audit table for public dashboards allowing a user to view all public dashboards on an instance of grafana. The public dashboards team is working on a proposal for adding RBAC support to the audit table for 9.3

Co-authored-by: juanicabanas <juan.cabanas@grafana.com>
This commit is contained in:
Jeff Levin
2022-10-12 21:36:05 -08:00
committed by GitHub
parent c7c640d903
commit cc27214dca
20 changed files with 516 additions and 44 deletions

View File

@@ -1,4 +1,4 @@
import React, { FC, ReactNode } from 'react';
import React, { FC, ReactNode, useContext, useEffect } from 'react';
import { connect, ConnectedProps } from 'react-redux';
import { useLocation } from 'react-router-dom';
@@ -13,6 +13,7 @@ import {
useForceUpdate,
Tag,
ToolbarButtonRow,
ModalsContext,
} from '@grafana/ui';
import { AppChromeUpdate } from 'app/core/components/AppChrome/AppChromeUpdate';
import { NavToolbarSeparator } from 'app/core/components/AppChrome/NavToolbarSeparator';
@@ -51,6 +52,7 @@ export interface OwnProps {
hideTimePicker: boolean;
folderTitle?: string;
title: string;
shareModalActiveTab?: string;
onAddPanel: () => void;
}
@@ -76,6 +78,7 @@ type Props = OwnProps & ConnectedProps<typeof connector>;
export const DashNav = React.memo<Props>((props) => {
const forceUpdate = useForceUpdate();
const { chrome } = useGrafana();
const { showModal, hideModal } = useContext(ModalsContext);
// We don't really care about the event payload here only that it triggeres a re-render of this component
useBusEvent(props.dashboard.events, DashboardMetaChangedEvent);
@@ -128,6 +131,25 @@ export const DashNav = React.memo<Props>((props) => {
return playlistSrv.isPlaying;
};
// Open/Close
useEffect(() => {
const dashboard = props.dashboard;
const shareModalActiveTab = props.shareModalActiveTab;
const { canShare } = dashboard.meta;
if (canShare && shareModalActiveTab) {
// automagically open modal
showModal(ShareModal, {
dashboard,
onDismiss: hideModal,
activeTab: shareModalActiveTab,
});
}
return () => {
hideModal();
};
}, [showModal, hideModal, props.dashboard, props.shareModalActiveTab]);
const renderLeftActions = () => {
const { dashboard, kioskMode } = props;
const { canStar, canShare, isStarred } = dashboard.meta;