mirror of
https://github.com/grafana/grafana.git
synced 2025-02-15 10:03:33 -06:00
* Add and configure eslint-plugin-import * Fix the lint:ts npm command * Autofix + prettier all the files * Manually fix remaining files * Move jquery code in jest-setup to external file to safely reorder imports * Resolve issue caused by circular dependencies within Prometheus * Update .betterer.results * Fix missing // @ts-ignore * ignore iconBundle.ts * Fix missing // @ts-ignore
46 lines
1.1 KiB
TypeScript
46 lines
1.1 KiB
TypeScript
import { css } from '@emotion/css';
|
|
import React from 'react';
|
|
|
|
import { Button, Modal } from '@grafana/ui';
|
|
|
|
import { DashboardModel } from '../../state';
|
|
|
|
import { SaveDashboardButton } from './SaveDashboardButton';
|
|
|
|
interface UnsavedChangesModalProps {
|
|
dashboard: DashboardModel;
|
|
onDiscard: () => void;
|
|
onDismiss: () => void;
|
|
onSaveSuccess?: () => void;
|
|
}
|
|
|
|
export const UnsavedChangesModal: React.FC<UnsavedChangesModalProps> = ({
|
|
dashboard,
|
|
onSaveSuccess,
|
|
onDiscard,
|
|
onDismiss,
|
|
}) => {
|
|
return (
|
|
<Modal
|
|
isOpen={true}
|
|
title="Unsaved changes"
|
|
onDismiss={onDismiss}
|
|
icon="exclamation-triangle"
|
|
className={css`
|
|
width: 500px;
|
|
`}
|
|
>
|
|
<h5>Do you want to save your changes?</h5>
|
|
<Modal.ButtonRow>
|
|
<Button variant="secondary" onClick={onDismiss} fill="outline">
|
|
Cancel
|
|
</Button>
|
|
<Button variant="destructive" onClick={onDiscard}>
|
|
Discard
|
|
</Button>
|
|
<SaveDashboardButton dashboard={dashboard} onSaveSuccess={onSaveSuccess} />
|
|
</Modal.ButtonRow>
|
|
</Modal>
|
|
);
|
|
};
|