forked from grafana.jool/grafana-jool
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
781 B
30 lines
781 B
import React, { useMemo, useState } from 'react';
|
|
import { Modal } from '@grafana/ui';
|
|
import { StateHistory } from '../components/rules/StateHistory';
|
|
|
|
function useStateHistoryModal(alertId: string) {
|
|
const [showModal, setShowModal] = useState<boolean>(false);
|
|
|
|
const StateHistoryModal = useMemo(
|
|
() => (
|
|
<Modal
|
|
isOpen={showModal}
|
|
onDismiss={() => setShowModal(false)}
|
|
closeOnBackdropClick={true}
|
|
closeOnEscape={true}
|
|
title="State history"
|
|
>
|
|
<StateHistory alertId={alertId} />
|
|
</Modal>
|
|
),
|
|
[alertId, showModal]
|
|
);
|
|
|
|
return {
|
|
StateHistoryModal,
|
|
showStateHistoryModal: () => setShowModal(true),
|
|
hideStateHistoryModal: () => setShowModal(false),
|
|
};
|
|
}
|
|
|
|
export { useStateHistoryModal };
|
|
|