From a98fd22e34e859fc7b15197e85242a53243c7661 Mon Sep 17 00:00:00 2001 From: kay delaney <45561153+kaydelaney@users.noreply.github.com> Date: Mon, 29 Mar 2021 11:11:51 +0100 Subject: [PATCH] Panel/DashList: Fetch folders with View permission (#32406) Closes #31357 --- public/app/core/components/Select/FolderPicker.tsx | 8 +++++--- public/app/plugins/panel/dashlist/module.tsx | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/public/app/core/components/Select/FolderPicker.tsx b/public/app/core/components/Select/FolderPicker.tsx index eb849e7d803..f204a35da05 100644 --- a/public/app/core/components/Select/FolderPicker.tsx +++ b/public/app/core/components/Select/FolderPicker.tsx @@ -18,6 +18,7 @@ export interface Props { dashboardId?: any; initialTitle?: string; initialFolderId?: number; + permissionLevel?: 'View' | 'Edit'; } interface State { @@ -40,11 +41,12 @@ export class FolderPicker extends PureComponent { }); } - static defaultProps = { + static defaultProps: Partial = { rootName: 'General', enableReset: false, initialTitle: '', enableCreateNew: false, + permissionLevel: 'Edit', }; componentDidMount = async () => { @@ -52,11 +54,11 @@ export class FolderPicker extends PureComponent { }; getOptions = async (query: string) => { - const { rootName, enableReset, initialTitle } = this.props; + const { rootName, enableReset, initialTitle, permissionLevel } = this.props; const params = { query, type: 'dash-folder', - permission: 'Edit', + permission: permissionLevel, }; // TODO: move search to BackendSrv interface diff --git a/public/app/plugins/panel/dashlist/module.tsx b/public/app/plugins/panel/dashlist/module.tsx index f9b51648004..78f1b293246 100644 --- a/public/app/plugins/panel/dashlist/module.tsx +++ b/public/app/plugins/panel/dashlist/module.tsx @@ -49,6 +49,7 @@ export const plugin = new PanelPlugin(DashList) initialFolderId={props.value} initialTitle="All" enableReset={true} + permissionLevel="View" onChange={({ id }) => props.onChange(id)} /> );