-
+
Template editor
diff --git a/grafana-plugin/src/containers/TemplatePreview/TemplatePreview.module.css b/grafana-plugin/src/containers/TemplatePreview/TemplatePreview.module.css
index 5f2ecb4a..41af313f 100644
--- a/grafana-plugin/src/containers/TemplatePreview/TemplatePreview.module.css
+++ b/grafana-plugin/src/containers/TemplatePreview/TemplatePreview.module.css
@@ -13,3 +13,8 @@
.message code {
white-space: break-spaces;
}
+
+.image-result img {
+ max-width: 100%;
+ max-height: 100%;
+}
diff --git a/grafana-plugin/src/containers/TemplatePreview/TemplatePreview.tsx b/grafana-plugin/src/containers/TemplatePreview/TemplatePreview.tsx
index f2172173..e268ef25 100644
--- a/grafana-plugin/src/containers/TemplatePreview/TemplatePreview.tsx
+++ b/grafana-plugin/src/containers/TemplatePreview/TemplatePreview.tsx
@@ -60,7 +60,6 @@ const TemplatePreview = observer((props: TemplatePreviewProps) => {
}, 1000);
useEffect(handleTemplateBodyChange, [templateBody, payload]);
- // onResult(result);
return result ? (
<>
@@ -93,12 +92,20 @@ const TemplatePreview = observer((props: TemplatePreviewProps) => {
)}
) : (
-
+ <>
+ {templateName.includes('image') ? (
+
+

+
+ ) : (
+
') || ''),
+ }}
+ />
+ )}
+ >
)}
>
) : (
diff --git a/grafana-plugin/src/containers/TemplatesAlertGroupsList/TemplatesAlertGroupsList.module.css b/grafana-plugin/src/containers/TemplatesAlertGroupsList/TemplatesAlertGroupsList.module.css
index 29df3d90..e66b1ba4 100644
--- a/grafana-plugin/src/containers/TemplatesAlertGroupsList/TemplatesAlertGroupsList.module.css
+++ b/grafana-plugin/src/containers/TemplatesAlertGroupsList/TemplatesAlertGroupsList.module.css
@@ -27,6 +27,15 @@
padding-left: 0;
}
+.alert-groups-list-item {
+ cursor: pointer;
+ margin-bottom: 8px;
+}
+
+.alert-groups-list-item:hover {
+ background-color: var(--background-secondary);
+}
+
.alert-groups-editor {
width: 100%;
}
diff --git a/grafana-plugin/src/containers/TemplatesAlertGroupsList/TemplatesAlertGroupsList.tsx b/grafana-plugin/src/containers/TemplatesAlertGroupsList/TemplatesAlertGroupsList.tsx
index 26cc233b..b58d1988 100644
--- a/grafana-plugin/src/containers/TemplatesAlertGroupsList/TemplatesAlertGroupsList.tsx
+++ b/grafana-plugin/src/containers/TemplatesAlertGroupsList/TemplatesAlertGroupsList.tsx
@@ -37,6 +37,12 @@ const TemplatesAlertGroupsList = (props: TemplatesAlertGroupsListProps) => {
.then((result) => setAlertGroupsList(result.slice(0, 30)));
}, []);
+ const getCodeEditorHeight = () => {
+ const mainDiv = document.getElementById('content-container-id');
+ const height = mainDiv?.getBoundingClientRect().height - 59;
+ return `${height}px`;
+ };
+
const getChangeHandler = () => {
return debounce((value: string) => {
onEditPayload(value);
@@ -65,7 +71,7 @@ const TemplatesAlertGroupsList = (props: TemplatesAlertGroupsListProps) => {
};
return (
-
+
{selectedAlertPayload ? (
<>
{isEditMode ? (
@@ -83,7 +89,7 @@ const TemplatesAlertGroupsList = (props: TemplatesAlertGroupsListProps) => {
{
value={JSON.stringify(selectedAlertPayload, null, 4)}
data={undefined}
disabled
- height={'85vh'}
+ height={getCodeEditorHeight()}
onChange={getChangeHandler()}
showLineNumbers
useAutoCompleteList={false}
@@ -147,7 +153,7 @@ const TemplatesAlertGroupsList = (props: TemplatesAlertGroupsListProps) => {
data={templates}
monacoOptions={MONACO_PAYLOAD_OPTIONS}
showLineNumbers={false}
- height={'85vh'}
+ height={getCodeEditorHeight()}
onChange={getChangeHandler()}
/>
@@ -175,10 +181,12 @@ const TemplatesAlertGroupsList = (props: TemplatesAlertGroupsListProps) => {
<>
{alertGroupsList.map((alertGroup) => {
return (
-
-
+
getAlertGroupPayload(alertGroup.pk)}
+ className={cx('alert-groups-list-item')}
+ >
+ {getAlertGroupName(alertGroup)}
);
})}
diff --git a/grafana-plugin/src/pages/integration_2/Integration2.tsx b/grafana-plugin/src/pages/integration_2/Integration2.tsx
index c09110c7..17c2b7d5 100644
--- a/grafana-plugin/src/pages/integration_2/Integration2.tsx
+++ b/grafana-plugin/src/pages/integration_2/Integration2.tsx
@@ -1059,7 +1059,7 @@ const IntegrationHeader: React.FC
= ({
if (
!alertReceiveChannel.is_available_for_integration_heartbeat ||
- alertReceiveChannel.heartbeat?.last_heartbeat_time_verbal === null
+ !alertReceiveChannel.heartbeat?.last_heartbeat_time_verbal
) {
return null;
}