mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
SaveDashboardForm: Remove deprecated Form usage (#84172)
* SaveDashboardForm: Remove deprecated Form usage * Update
This commit is contained in:
parent
0f6858709b
commit
d105323f15
@ -1,7 +1,8 @@
|
|||||||
import React, { useCallback, useState } from 'react';
|
import React, { useCallback, useState } from 'react';
|
||||||
|
|
||||||
import { selectors } from '@grafana/e2e-selectors';
|
import { selectors } from '@grafana/e2e-selectors';
|
||||||
import { Button, Field, Form, Modal, Input, Alert } from '@grafana/ui';
|
import { Button, Field, Modal, Input, Alert } from '@grafana/ui';
|
||||||
|
import { Form } from 'app/core/components/Form/Form';
|
||||||
|
|
||||||
import { RepeatRowSelect } from '../RepeatRowSelect/RepeatRowSelect';
|
import { RepeatRowSelect } from '../RepeatRowSelect/RepeatRowSelect';
|
||||||
|
|
||||||
|
@ -5,16 +5,12 @@ import { GrafanaTheme2 } from '@grafana/data';
|
|||||||
import { selectors } from '@grafana/e2e-selectors';
|
import { selectors } from '@grafana/e2e-selectors';
|
||||||
import { config } from '@grafana/runtime';
|
import { config } from '@grafana/runtime';
|
||||||
import { Dashboard } from '@grafana/schema';
|
import { Dashboard } from '@grafana/schema';
|
||||||
import { Button, Checkbox, Form, TextArea, useStyles2, Stack } from '@grafana/ui';
|
import { Button, Checkbox, TextArea, useStyles2, Stack } from '@grafana/ui';
|
||||||
import { DashboardModel } from 'app/features/dashboard/state';
|
import { DashboardModel } from 'app/features/dashboard/state';
|
||||||
|
|
||||||
import { GenAIDashboardChangesButton } from '../../GenAI/GenAIDashboardChangesButton';
|
import { GenAIDashboardChangesButton } from '../../GenAI/GenAIDashboardChangesButton';
|
||||||
import { SaveDashboardData, SaveDashboardOptions } from '../types';
|
import { SaveDashboardData, SaveDashboardOptions } from '../types';
|
||||||
|
|
||||||
interface FormDTO {
|
|
||||||
message: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export type SaveProps = {
|
export type SaveProps = {
|
||||||
dashboard: DashboardModel; // original
|
dashboard: DashboardModel; // original
|
||||||
isLoading: boolean;
|
isLoading: boolean;
|
||||||
@ -44,8 +40,9 @@ export const SaveDashboardForm = ({
|
|||||||
const styles = useStyles2(getStyles);
|
const styles = useStyles2(getStyles);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Form
|
<form
|
||||||
onSubmit={async (data: FormDTO) => {
|
onSubmit={async (event) => {
|
||||||
|
event.preventDefault();
|
||||||
if (!onSubmit) {
|
if (!onSubmit) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -58,9 +55,8 @@ export const SaveDashboardForm = ({
|
|||||||
setSaving(false);
|
setSaving(false);
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
|
style={{ maxWidth: 600 }}
|
||||||
>
|
>
|
||||||
{({ register, errors }) => {
|
|
||||||
return (
|
|
||||||
<Stack gap={2} direction="column" alignItems="flex-start">
|
<Stack gap={2} direction="column" alignItems="flex-start">
|
||||||
{hasTimeChanged && (
|
{hasTimeChanged && (
|
||||||
<Checkbox
|
<Checkbox
|
||||||
@ -133,9 +129,7 @@ export const SaveDashboardForm = ({
|
|||||||
{!saveModel.hasChanges && <div>No changes to save</div>}
|
{!saveModel.hasChanges && <div>No changes to save</div>}
|
||||||
</Stack>
|
</Stack>
|
||||||
</Stack>
|
</Stack>
|
||||||
);
|
</form>
|
||||||
}}
|
|
||||||
</Form>
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user