mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
* Add transformation add modal and use it * Hook up saving * Add transformation vars to var list, show added transformations * Form validation * Remove type assertion, start building out transformation data in helper (WIP) * Style expression better, add delete logic * Add ability to edit, additional styling on transformation card in helper * simplify styling, conditionally run edit set up logic * Keep more field information in function, integrate it with new editor * Show default label on collapsed section, use deleteButton for confirmation of deleting transformations * Change transformation add calculations from function to hook, add label to collapsed header, add transformation tooltip * Make correlation and editor dirty state distinctive and integrate, WIP * Track action pane for more detailed messaging/actions * Better cancel modal logic * Remove changes to adminsitration transformation editor * Remove debugging line * Remove unneeded comment * Add in logic for closing editor mode * Add tests for modal logic * Use state to build vars list for helper * WIP * Fix labels and dirty state * Fix bad message and stop exiting mode if discard action is performed * Fix tests * Update to not use unstable component and tweak default label
37 lines
967 B
TypeScript
37 lines
967 B
TypeScript
import { css } from '@emotion/css';
|
|
import React from 'react';
|
|
|
|
import { Button, Modal } from '@grafana/ui';
|
|
|
|
interface UnsavedChangesModalProps {
|
|
message: string;
|
|
onDiscard: () => void;
|
|
onCancel: () => void;
|
|
onSave: () => void;
|
|
}
|
|
|
|
export const CorrelationUnsavedChangesModal = ({ onSave, onDiscard, onCancel, message }: UnsavedChangesModalProps) => {
|
|
return (
|
|
<Modal
|
|
isOpen={true}
|
|
title={`Unsaved changes to correlation`}
|
|
onDismiss={onCancel}
|
|
icon="exclamation-triangle"
|
|
className={css({ width: '600px' })}
|
|
>
|
|
<h5>{message}</h5>
|
|
<Modal.ButtonRow>
|
|
<Button variant="secondary" onClick={onCancel} fill="outline">
|
|
Cancel
|
|
</Button>
|
|
<Button variant="destructive" onClick={onDiscard}>
|
|
Continue without saving
|
|
</Button>
|
|
<Button variant="primary" onClick={onSave}>
|
|
Save correlation
|
|
</Button>
|
|
</Modal.ButtonRow>
|
|
</Modal>
|
|
);
|
|
};
|