import { css } from '@emotion/css'; import React, { useState } from 'react'; import { GrafanaTheme2 } from '@grafana/data'; import { getBackendSrv } from '@grafana/runtime'; import { Button, CodeEditor, Modal, useTheme2 } from '@grafana/ui'; export const ExportStartButton = () => { const styles = getStyles(useTheme2()); const [open, setOpen] = useState(false); const [body, setBody] = useState({ format: 'git', git: {}, }); const onDismiss = () => setOpen(false); const doStart = () => { getBackendSrv() .post('/api/admin/export', body) .then((v) => { console.log('GOT', v); onDismiss(); }); }; return ( <> { setBody(JSON.parse(text)); // force JSON? }} /> Start Cancel setOpen(true)} variant="primary"> Export > ); }; const getStyles = (theme: GrafanaTheme2) => { return { wrap: css` border: 2px solid #111; `, }; };