Grouping templating polishing10 (#2276)
# What this PR does - Description of Alert Manager info box was changed - Fix for filtering Escalation chains in Integration - Alt text for Image template - Conditional result for Template was fixed
This commit is contained in:
parent
0177301bb8
commit
9e15fe6875
3 changed files with 18 additions and 18 deletions
|
|
@ -18,7 +18,7 @@ Alerts from Grafana Alertmanager are automatically routed to this integration.
|
|||
<br>Click <a href='{{dict_item.contact_point_url}}' target='_blank'>here</a>
|
||||
to open contact point, and
|
||||
<a href='{{dict_item.routes_url}}' target='_blank'>here</a>
|
||||
to open routes for {{dict_item.alertmanager_name}} Alertmanager.
|
||||
to open Notification policy for {{dict_item.alertmanager_name}} Alertmanager.
|
||||
{% endfor %}
|
||||
{% if not is_finished_alerting_setup %}
|
||||
<br>Creating contact points and routes for other alertmanagers...
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ import {
|
|||
Icon,
|
||||
Tooltip,
|
||||
ConfirmModal,
|
||||
Select,
|
||||
LoadingPlaceholder,
|
||||
} from '@grafana/ui';
|
||||
import cn from 'classnames/bind';
|
||||
|
|
@ -26,13 +25,13 @@ import TooltipBadge from 'components/TooltipBadge/TooltipBadge';
|
|||
import { WithContextMenu } from 'components/WithContextMenu/WithContextMenu';
|
||||
import { ChatOpsConnectors } from 'containers/AlertRules/parts';
|
||||
import EscalationChainSteps from 'containers/EscalationChainSteps/EscalationChainSteps';
|
||||
import GSelect from 'containers/GSelect/GSelect';
|
||||
import styles from 'containers/IntegrationContainers/ExpandedIntegrationRouteDisplay/ExpandedIntegrationRouteDisplay.module.scss';
|
||||
import TeamName from 'containers/TeamName/TeamName';
|
||||
import { WithPermissionControlTooltip } from 'containers/WithPermissionControl/WithPermissionControlTooltip';
|
||||
import { AlertReceiveChannel } from 'models/alert_receive_channel/alert_receive_channel.types';
|
||||
import { AlertTemplatesDTO } from 'models/alert_templates';
|
||||
import { ChannelFilter } from 'models/channel_filter/channel_filter.types';
|
||||
import { EscalationChain } from 'models/escalation_chain/escalation_chain.types';
|
||||
import CommonIntegrationHelper from 'pages/integration_2/CommonIntegration2.helper';
|
||||
import { MONACO_INPUT_HEIGHT_SMALL, MONACO_OPTIONS } from 'pages/integration_2/Integration2.config';
|
||||
import IntegrationHelper from 'pages/integration_2/Integration2.helper';
|
||||
|
|
@ -195,20 +194,15 @@ const ExpandedIntegrationRouteDisplay: React.FC<ExpandedIntegrationRouteDisplayP
|
|||
Escalation chain
|
||||
</InlineLabel>
|
||||
<WithPermissionControlTooltip userAction={UserActions.IntegrationsWrite}>
|
||||
<Select
|
||||
isSearchable
|
||||
<GSelect
|
||||
showSearch
|
||||
width={'auto'}
|
||||
menuShouldPortal
|
||||
modelName="escalationChainStore"
|
||||
className={cx('select', 'control')}
|
||||
placeholder="Select escalation chain"
|
||||
isLoading={isRefreshingEscalationChains}
|
||||
displayField="name"
|
||||
onChange={onEscalationChainChange}
|
||||
options={Object.keys(escalationChainStore.items).map(
|
||||
(eschalationChainId: EscalationChain['id']) => ({
|
||||
value: escalationChainStore.items[eschalationChainId].id,
|
||||
label: escalationChainStore.items[eschalationChainId].name,
|
||||
})
|
||||
)}
|
||||
value={channelFilter.escalation_chain}
|
||||
getOptionLabel={(item: SelectableValue) => {
|
||||
return (
|
||||
|
|
@ -221,7 +215,7 @@ const ExpandedIntegrationRouteDisplay: React.FC<ExpandedIntegrationRouteDisplayP
|
|||
</>
|
||||
);
|
||||
}}
|
||||
></Select>
|
||||
/>
|
||||
</WithPermissionControlTooltip>
|
||||
|
||||
<Tooltip placement={'top'} content={'Reload list'}>
|
||||
|
|
@ -279,7 +273,7 @@ const ExpandedIntegrationRouteDisplay: React.FC<ExpandedIntegrationRouteDisplayP
|
|||
openNotification('Route has been deleted');
|
||||
}
|
||||
|
||||
function onEscalationChainChange({ value }) {
|
||||
function onEscalationChainChange(value) {
|
||||
alertReceiveChannelStore
|
||||
.saveChannelFilter(channelFilterId, {
|
||||
escalation_chain: value,
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ const TemplatePreview = observer((props: TemplatePreviewProps) => {
|
|||
setResult(data);
|
||||
if (data?.preview === 'True') {
|
||||
setConditionalResult({ isResult: true, value: 'True' });
|
||||
} else if (data?.preview === 'False') {
|
||||
} else if (templateName.includes('route') || templateName.includes('condition')) {
|
||||
setConditionalResult({ isResult: true, value: 'False' });
|
||||
} else {
|
||||
setConditionalResult({ isResult: false, value: undefined });
|
||||
|
|
@ -87,7 +87,7 @@ const TemplatePreview = observer((props: TemplatePreviewProps) => {
|
|||
<>
|
||||
{conditionalResult?.isResult ? (
|
||||
<Text type={conditionalResult.value === 'True' ? 'success' : 'danger'}>
|
||||
{conditionalResult.isResult ? (
|
||||
{conditionalResult.value === 'True' ? (
|
||||
<VerticalGroup>
|
||||
<HorizontalGroup>
|
||||
<Icon name="check" size="lg" /> {conditionalResult.value}
|
||||
|
|
@ -101,7 +101,7 @@ const TemplatePreview = observer((props: TemplatePreviewProps) => {
|
|||
<div
|
||||
className={cx('message')}
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: sanitize(result.preview || ''),
|
||||
__html: sanitize(result.preview),
|
||||
}}
|
||||
/>
|
||||
</HorizontalGroup>
|
||||
|
|
@ -113,7 +113,13 @@ const TemplatePreview = observer((props: TemplatePreviewProps) => {
|
|||
<>
|
||||
{templateName.includes('image') ? (
|
||||
<div className={cx('image-result')}>
|
||||
<img src={result.preview} />
|
||||
<img
|
||||
src={result.preview}
|
||||
onError={(e) => {
|
||||
const target = e.target as HTMLImageElement;
|
||||
target.alt = result.preview || 'No image found';
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
) : (
|
||||
<div
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue