View File Name : AlertTab.tsx
}
confirmText="Delete alert"
onDismiss={onDismiss}
onConfirm={() => {
delete panel.alert;
panel.thresholds = [];
if (this.panelCtrl) {
this.panelCtrl.alertState = null;
this.panelCtrl.render();
}
this.component?.digest();
onDismiss();
}}
/>
);
};
renderStateHistory = () => {
if (!this.state.showStateHistory) {
return null;
}
const { panel, dashboard } = this.props;
const onDismiss = () => this.onToggleModal('showStateHistory');
return (
this.panelCtrl?.refresh()} />
);
};
render() {
const { alert, transformations } = this.props.panel;
const { validationMessage } = this.state;
const hasTransformations = transformations && transformations.length > 0;
if (!alert && validationMessage) {
return
;
}
const model = {
title: 'Panel has no alert rule defined',
buttonIcon: 'bell' as const,
onClick: this.onAddAlert,
buttonTitle: 'Create Alert',
};
return (
<>
{alert && hasTransformations && (
)}
(this.element = element)} />
{alert && (
)}
{!alert && !validationMessage && }
{this.renderTestRule()}
{this.renderDeleteConfirmation()}
{this.renderStateHistory()}
>
);
}
}
const mapStateToProps: MapStateToProps
= (state, props) => {
return {
angularPanelComponent: getPanelStateForModel(state, props.panel)?.angularComponent,
};
};
const mapDispatchToProps: MapDispatchToProps = {};
export const AlertTab = connect(mapStateToProps, mapDispatchToProps)(UnConnectedAlertTab);