summaryrefslogtreecommitdiffstats
path: root/integrations
diff options
context:
space:
mode:
authorFotis Voutsas <fotis@netdata.cloud>2023-10-13 10:07:55 +0300
committerGitHub <noreply@github.com>2023-10-13 10:07:55 +0300
commit141647b2913a943ee6b25e9472a043417a51dd80 (patch)
tree69bb531bb0a47a1069ee5ceed9bccbb4bc5fb554 /integrations
parent07635ec614bc629132da3d0635e5cf0d55e72445 (diff)
Add icons to integrations markdown files (#16169)
Diffstat (limited to 'integrations')
-rw-r--r--integrations/gen_docs_integrations.py32
1 files changed, 26 insertions, 6 deletions
diff --git a/integrations/gen_docs_integrations.py b/integrations/gen_docs_integrations.py
index 892d0a65c4..d8006dd2aa 100644
--- a/integrations/gen_docs_integrations.py
+++ b/integrations/gen_docs_integrations.py
@@ -1,6 +1,7 @@
import json
import shutil
from pathlib import Path
+import re
# Dictionary responsible for making the symbolic links at the end of the script's run.
symlink_dict = {}
@@ -116,6 +117,25 @@ def read_integrations_js(path_to_file):
print("Exception", e)
+def create_overview(integration, filename):
+
+ split = re.split(r'(#.*\n)', integration['overview'], 1)
+
+ first_overview_part = split[1]
+ rest_overview_part = split[2]
+
+ if len(filename) > 0:
+ return f"""{first_overview_part}
+
+<img src="https://netdata.cloud/img/{filename}" width="150"/>
+
+{rest_overview_part}
+"""
+ else:
+ return f"""{first_overview_part}{rest_overview_part}
+"""
+
+
def build_readme_from_integration(integration, mode=''):
# COLLECTORS
if mode == 'collector':
@@ -127,6 +147,7 @@ def build_readme_from_integration(integration, mode=''):
learn_rel_path = generate_category_from_name(
integration['meta']['monitored_instance']['categories'][0].split("."), categories)
# build the markdown string
+
md = \
f"""<!--startmeta
meta_yaml: "{meta_yaml}"
@@ -136,8 +157,7 @@ learn_rel_path: "{learn_rel_path}"
message: "DO NOT EDIT THIS FILE DIRECTLY, IT IS GENERATED BY THE COLLECTOR'S metadata.yaml FILE"
endmeta-->
-{integration['overview']}
-"""
+{create_overview(integration, integration['meta']['monitored_instance']['icon_filename'])}"""
if integration['metrics']:
md += f"""
@@ -168,6 +188,7 @@ endmeta-->
meta_yaml = integration['edit_link'].replace("blob", "edit")
sidebar_label = integration['meta']['name']
learn_rel_path = generate_category_from_name(integration['meta']['categories'][0].split("."), categories)
+
# build the markdown string
md = \
f"""<!--startmeta
@@ -178,8 +199,7 @@ learn_rel_path: "Exporting"
message: "DO NOT EDIT THIS FILE DIRECTLY, IT IS GENERATED BY THE EXPORTER'S metadata.yaml FILE"
endmeta-->
-{integration['overview']}
-"""
+{create_overview(integration, integration['meta']['icon_filename'])}"""
if integration['setup']:
md += f"""
@@ -200,6 +220,7 @@ endmeta-->
meta_yaml = integration['edit_link'].replace("blob", "edit")
sidebar_label = integration['meta']['name']
learn_rel_path = generate_category_from_name(integration['meta']['categories'][0].split("."), categories)
+
# build the markdown string
md = \
f"""<!--startmeta
@@ -210,8 +231,7 @@ learn_rel_path: "{learn_rel_path.replace("notifications", "Alerting/Notification
message: "DO NOT EDIT THIS FILE DIRECTLY, IT IS GENERATED BY THE NOTIFICATION'S metadata.yaml FILE"
endmeta-->
-{integration['overview']}
-"""
+{create_overview(integration, integration['meta']['icon_filename'])}"""
if integration['setup']:
md += f"""