3
0
mirror of https://github.com/grafana/grafana.git synced 2025-02-13 09:05:45 -06:00

FolderPicker: Remove useNewForms from FolderPicker ()

* FolderPicker: Remove useNewForms from FolderPicker

* Updated snapshot
This commit is contained in:
Torkel Ödegaard 2021-02-26 08:42:00 +01:00 committed by GitHub
parent 119963ada2
commit c41b559063
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 24 additions and 63 deletions
public/app
core/components/Select
features
dashboard/components
DashboardSettings
SaveDashboard/forms
manage-dashboards/components
search/components
plugins/panel/dashlist

View File

@ -18,7 +18,6 @@ export interface Props {
dashboardId?: any;
initialTitle?: string;
initialFolderId?: number;
useNewForms?: boolean;
}
interface State {
@ -46,7 +45,6 @@ export class FolderPicker extends PureComponent<Props, State> {
enableReset: false,
initialTitle: '',
enableCreateNew: false,
useNewForms: false,
};
componentDidMount = async () => {
@ -148,41 +146,21 @@ export class FolderPicker extends PureComponent<Props, State> {
render() {
const { folder } = this.state;
const { enableCreateNew, useNewForms } = this.props;
const { enableCreateNew } = this.props;
return (
<div aria-label={selectors.components.FolderPicker.container}>
{useNewForms && (
<AsyncSelect
loadingMessage="Loading folders..."
defaultOptions
defaultValue={folder}
value={folder}
allowCustomValue={enableCreateNew}
loadOptions={this.debouncedSearch}
onChange={this.onFolderChange}
onCreateOption={this.createNewFolder}
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>
)}
<AsyncSelect
loadingMessage="Loading folders..."
defaultOptions
defaultValue={folder}
value={folder}
allowCustomValue={enableCreateNew}
loadOptions={this.debouncedSearch}
onChange={this.onFolderChange}
onCreateOption={this.createNewFolder}
menuPosition="fixed"
/>
</div>
);
}

View File

@ -4,29 +4,16 @@ exports[`FolderPicker should render 1`] = `
<div
aria-label="Folder picker select container"
>
<div
className="gf-form-inline"
>
<div
className="gf-form"
>
<label
className="gf-form-label width-7"
>
Folder
</label>
<AsyncSelect
allowCustomValue={false}
className="width-20"
defaultOptions={true}
defaultValue={Object {}}
loadOptions={[Function]}
loadingMessage="Loading folders..."
onChange={[Function]}
onCreateOption={[Function]}
value={Object {}}
/>
</div>
</div>
<AsyncSelect
allowCustomValue={false}
defaultOptions={true}
defaultValue={Object {}}
loadOptions={[Function]}
loadingMessage="Loading folders..."
menuPosition="fixed"
onChange={[Function]}
onCreateOption={[Function]}
value={Object {}}
/>
</div>
`;

View File

@ -84,7 +84,6 @@ export const GeneralSettings: React.FC<Props> = ({ dashboard }) => {
</Field>
<Field label="Folder">
<FolderPicker
useNewForms={true}
initialTitle={dashboard.meta.folderTitle}
initialFolderId={dashboard.meta.folderId}
onChange={onFolderChange}

View File

@ -109,7 +109,6 @@ export const SaveDashboardAsForm: React.FC<SaveDashboardFormProps & { isNew?: bo
initialFolderId={dashboard.meta.folderId}
initialTitle={dashboard.meta.folderTitle}
enableCreateNew
useNewForms
/>
</Field>
<Field label="Copy tags">

View File

@ -68,7 +68,6 @@ export const ImportDashboardForm: FC<Props> = ({
<InputControl
as={FolderPicker}
name="folder"
useNewForms
enableCreateNew
initialFolderId={initialFolderId}
control={control}

View File

@ -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
following folder:
</p>
<FolderPicker onChange={(f) => setFolder(f as FolderInfo)} useNewForms />
<FolderPicker onChange={(f) => setFolder(f as FolderInfo)} />
</div>
<HorizontalGroup justify="center">

View File

@ -48,7 +48,6 @@ export const plugin = new PanelPlugin<DashListOptions>(DashList)
return (
<FolderPicker
initialFolderId={props.value}
useNewForms
initialTitle="All"
enableReset={true}
onChange={({ id }) => props.onChange(id)}