mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
FolderPicker: Remove useNewForms from FolderPicker (#31485)
* FolderPicker: Remove useNewForms from FolderPicker * Updated snapshot
This commit is contained in:
parent
119963ada2
commit
c41b559063
@ -18,7 +18,6 @@ export interface Props {
|
|||||||
dashboardId?: any;
|
dashboardId?: any;
|
||||||
initialTitle?: string;
|
initialTitle?: string;
|
||||||
initialFolderId?: number;
|
initialFolderId?: number;
|
||||||
useNewForms?: boolean;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
interface State {
|
interface State {
|
||||||
@ -46,7 +45,6 @@ export class FolderPicker extends PureComponent<Props, State> {
|
|||||||
enableReset: false,
|
enableReset: false,
|
||||||
initialTitle: '',
|
initialTitle: '',
|
||||||
enableCreateNew: false,
|
enableCreateNew: false,
|
||||||
useNewForms: false,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
componentDidMount = async () => {
|
componentDidMount = async () => {
|
||||||
@ -148,41 +146,21 @@ export class FolderPicker extends PureComponent<Props, State> {
|
|||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { folder } = this.state;
|
const { folder } = this.state;
|
||||||
const { enableCreateNew, useNewForms } = this.props;
|
const { enableCreateNew } = this.props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div aria-label={selectors.components.FolderPicker.container}>
|
<div aria-label={selectors.components.FolderPicker.container}>
|
||||||
{useNewForms && (
|
<AsyncSelect
|
||||||
<AsyncSelect
|
loadingMessage="Loading folders..."
|
||||||
loadingMessage="Loading folders..."
|
defaultOptions
|
||||||
defaultOptions
|
defaultValue={folder}
|
||||||
defaultValue={folder}
|
value={folder}
|
||||||
value={folder}
|
allowCustomValue={enableCreateNew}
|
||||||
allowCustomValue={enableCreateNew}
|
loadOptions={this.debouncedSearch}
|
||||||
loadOptions={this.debouncedSearch}
|
onChange={this.onFolderChange}
|
||||||
onChange={this.onFolderChange}
|
onCreateOption={this.createNewFolder}
|
||||||
onCreateOption={this.createNewFolder}
|
menuPosition="fixed"
|
||||||
menuPosition="fixed"
|
/>
|
||||||
/>
|
|
||||||
)}
|
|
||||||
{!useNewForms && (
|
|
||||||
<div className="gf-form-inline">
|
|
||||||
<div className="gf-form">
|
|
||||||
<label className="gf-form-label width-7">Folder</label>
|
|
||||||
<AsyncSelect
|
|
||||||
loadingMessage="Loading folders..."
|
|
||||||
defaultOptions
|
|
||||||
defaultValue={folder}
|
|
||||||
value={folder}
|
|
||||||
className={'width-20'}
|
|
||||||
allowCustomValue={enableCreateNew}
|
|
||||||
loadOptions={this.debouncedSearch}
|
|
||||||
onChange={this.onFolderChange}
|
|
||||||
onCreateOption={this.createNewFolder}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -4,29 +4,16 @@ exports[`FolderPicker should render 1`] = `
|
|||||||
<div
|
<div
|
||||||
aria-label="Folder picker select container"
|
aria-label="Folder picker select container"
|
||||||
>
|
>
|
||||||
<div
|
<AsyncSelect
|
||||||
className="gf-form-inline"
|
allowCustomValue={false}
|
||||||
>
|
defaultOptions={true}
|
||||||
<div
|
defaultValue={Object {}}
|
||||||
className="gf-form"
|
loadOptions={[Function]}
|
||||||
>
|
loadingMessage="Loading folders..."
|
||||||
<label
|
menuPosition="fixed"
|
||||||
className="gf-form-label width-7"
|
onChange={[Function]}
|
||||||
>
|
onCreateOption={[Function]}
|
||||||
Folder
|
value={Object {}}
|
||||||
</label>
|
/>
|
||||||
<AsyncSelect
|
|
||||||
allowCustomValue={false}
|
|
||||||
className="width-20"
|
|
||||||
defaultOptions={true}
|
|
||||||
defaultValue={Object {}}
|
|
||||||
loadOptions={[Function]}
|
|
||||||
loadingMessage="Loading folders..."
|
|
||||||
onChange={[Function]}
|
|
||||||
onCreateOption={[Function]}
|
|
||||||
value={Object {}}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
@ -84,7 +84,6 @@ export const GeneralSettings: React.FC<Props> = ({ dashboard }) => {
|
|||||||
</Field>
|
</Field>
|
||||||
<Field label="Folder">
|
<Field label="Folder">
|
||||||
<FolderPicker
|
<FolderPicker
|
||||||
useNewForms={true}
|
|
||||||
initialTitle={dashboard.meta.folderTitle}
|
initialTitle={dashboard.meta.folderTitle}
|
||||||
initialFolderId={dashboard.meta.folderId}
|
initialFolderId={dashboard.meta.folderId}
|
||||||
onChange={onFolderChange}
|
onChange={onFolderChange}
|
||||||
|
@ -109,7 +109,6 @@ export const SaveDashboardAsForm: React.FC<SaveDashboardFormProps & { isNew?: bo
|
|||||||
initialFolderId={dashboard.meta.folderId}
|
initialFolderId={dashboard.meta.folderId}
|
||||||
initialTitle={dashboard.meta.folderTitle}
|
initialTitle={dashboard.meta.folderTitle}
|
||||||
enableCreateNew
|
enableCreateNew
|
||||||
useNewForms
|
|
||||||
/>
|
/>
|
||||||
</Field>
|
</Field>
|
||||||
<Field label="Copy tags">
|
<Field label="Copy tags">
|
||||||
|
@ -68,7 +68,6 @@ export const ImportDashboardForm: FC<Props> = ({
|
|||||||
<InputControl
|
<InputControl
|
||||||
as={FolderPicker}
|
as={FolderPicker}
|
||||||
name="folder"
|
name="folder"
|
||||||
useNewForms
|
|
||||||
enableCreateNew
|
enableCreateNew
|
||||||
initialFolderId={initialFolderId}
|
initialFolderId={initialFolderId}
|
||||||
control={control}
|
control={control}
|
||||||
|
@ -59,7 +59,7 @@ export const MoveToFolderModal: FC<Props> = ({ results, onMoveItems, isOpen, onD
|
|||||||
Move the {selectedDashboards.length} selected dashboard{selectedDashboards.length === 1 ? '' : 's'} to the
|
Move the {selectedDashboards.length} selected dashboard{selectedDashboards.length === 1 ? '' : 's'} to the
|
||||||
following folder:
|
following folder:
|
||||||
</p>
|
</p>
|
||||||
<FolderPicker onChange={(f) => setFolder(f as FolderInfo)} useNewForms />
|
<FolderPicker onChange={(f) => setFolder(f as FolderInfo)} />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<HorizontalGroup justify="center">
|
<HorizontalGroup justify="center">
|
||||||
|
@ -48,7 +48,6 @@ export const plugin = new PanelPlugin<DashListOptions>(DashList)
|
|||||||
return (
|
return (
|
||||||
<FolderPicker
|
<FolderPicker
|
||||||
initialFolderId={props.value}
|
initialFolderId={props.value}
|
||||||
useNewForms
|
|
||||||
initialTitle="All"
|
initialTitle="All"
|
||||||
enableReset={true}
|
enableReset={true}
|
||||||
onChange={({ id }) => props.onChange(id)}
|
onChange={({ id }) => props.onChange(id)}
|
||||||
|
Loading…
Reference in New Issue
Block a user