{
if (correlationDetails?.postConfirmAction !== undefined) {
const { exploreId, action, changeDatasourceUid } = correlationDetails?.postConfirmAction;
if (action === CORRELATION_EDITOR_POST_CONFIRM_ACTION.CLOSE_PANE) {
closePane(exploreId);
} else if (
action === CORRELATION_EDITOR_POST_CONFIRM_ACTION.CHANGE_DATASOURCE &&
changeDatasourceUid !== undefined
) {
changeDatasourcePostAction(exploreId, changeDatasourceUid);
}
dispatch(changeCorrelationEditorDetails({ isExiting: false }));
} else {
// exit correlations mode
// if we are discarding the in progress correlation, reset everything
// this modal only shows if the editorMode is false, so we just need to update the dirty state
dispatch(
changeCorrelationEditorDetails({
editorMode: false,
correlationDirty: false,
isExiting: false,
})
);
}
}}
onCancel={() => {
// if we are cancelling the exit, set the editor mode back to true and hide the prompt
dispatch(changeCorrelationEditorDetails({ isExiting: false }));
setSaveMessage(undefined);
}}
onSave={() => {
saveCorrelationPostAction(false);
}}
message={saveMessage}
/>
)}
>
);
};
const getStyles = (theme: GrafanaTheme2) => {
const contrastColor = theme.colors.getContrastText(theme.colors.primary.main);
const lighterBackgroundColor = colorManipulator.lighten(theme.colors.primary.main, 0.1);
const darkerBackgroundColor = colorManipulator.darken(theme.colors.primary.main, 0.2);
const disabledColor = colorManipulator.darken(contrastColor, 0.2);
return {
correlationEditorTop: css({
backgroundColor: theme.colors.primary.main,
marginTop: '3px',
padding: theme.spacing(1),
}),
iconColor: css({
color: contrastColor,
}),
buttonColor: css({
color: contrastColor,
borderColor: contrastColor,
'&:hover': {
color: contrastColor,
borderColor: contrastColor,
backgroundColor: lighterBackgroundColor,
},
}),
// important needed to override disabled state styling
disabledButtonColor: css({
color: `${disabledColor} !important`,
backgroundColor: `${darkerBackgroundColor} !important`,
}),
};
};