Panel/DashList: Fetch folders with View permission (#32406)

Closes #31357
This commit is contained in:
kay delaney 2021-03-29 11:11:51 +01:00 committed by GitHub
parent 5b2a419df8
commit a98fd22e34
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

View File

@ -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<Props, State> {
});
}
static defaultProps = {
static defaultProps: Partial<Props> = {
rootName: 'General',
enableReset: false,
initialTitle: '',
enableCreateNew: false,
permissionLevel: 'Edit',
};
componentDidMount = async () => {
@ -52,11 +54,11 @@ export class FolderPicker extends PureComponent<Props, State> {
};
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

View File

@ -49,6 +49,7 @@ export const plugin = new PanelPlugin<DashListOptions>(DashList)
initialFolderId={props.value}
initialTitle="All"
enableReset={true}
permissionLevel="View"
onChange={({ id }) => props.onChange(id)}
/>
);