mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Panel/DashList: Fetch folders with View permission (#32406)
Closes #31357
This commit is contained in:
parent
5b2a419df8
commit
a98fd22e34
@ -18,6 +18,7 @@ export interface Props {
|
|||||||
dashboardId?: any;
|
dashboardId?: any;
|
||||||
initialTitle?: string;
|
initialTitle?: string;
|
||||||
initialFolderId?: number;
|
initialFolderId?: number;
|
||||||
|
permissionLevel?: 'View' | 'Edit';
|
||||||
}
|
}
|
||||||
|
|
||||||
interface State {
|
interface State {
|
||||||
@ -40,11 +41,12 @@ export class FolderPicker extends PureComponent<Props, State> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
static defaultProps = {
|
static defaultProps: Partial<Props> = {
|
||||||
rootName: 'General',
|
rootName: 'General',
|
||||||
enableReset: false,
|
enableReset: false,
|
||||||
initialTitle: '',
|
initialTitle: '',
|
||||||
enableCreateNew: false,
|
enableCreateNew: false,
|
||||||
|
permissionLevel: 'Edit',
|
||||||
};
|
};
|
||||||
|
|
||||||
componentDidMount = async () => {
|
componentDidMount = async () => {
|
||||||
@ -52,11 +54,11 @@ export class FolderPicker extends PureComponent<Props, State> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
getOptions = async (query: string) => {
|
getOptions = async (query: string) => {
|
||||||
const { rootName, enableReset, initialTitle } = this.props;
|
const { rootName, enableReset, initialTitle, permissionLevel } = this.props;
|
||||||
const params = {
|
const params = {
|
||||||
query,
|
query,
|
||||||
type: 'dash-folder',
|
type: 'dash-folder',
|
||||||
permission: 'Edit',
|
permission: permissionLevel,
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO: move search to BackendSrv interface
|
// TODO: move search to BackendSrv interface
|
||||||
|
@ -49,6 +49,7 @@ export const plugin = new PanelPlugin<DashListOptions>(DashList)
|
|||||||
initialFolderId={props.value}
|
initialFolderId={props.value}
|
||||||
initialTitle="All"
|
initialTitle="All"
|
||||||
enableReset={true}
|
enableReset={true}
|
||||||
|
permissionLevel="View"
|
||||||
onChange={({ id }) => props.onChange(id)}
|
onChange={({ id }) => props.onChange(id)}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user