From fb2b4bf4d9109898cd845541a707971afc194435 Mon Sep 17 00:00:00 2001 From: Patryk Gudalewicz Date: Wed, 29 Mar 2023 15:33:19 +0200 Subject: [PATCH] Adding drilldown markdown URLs --- createDash.py | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/createDash.py b/createDash.py index 8f98072..2e8d1d2 100644 --- a/createDash.py +++ b/createDash.py @@ -157,7 +157,7 @@ def get_dataExplorerTileSloThreshold(sloThresholdValuesAndColor): dataExplorerTileThreshold = [ { "value": value1, "color": color1 }, { "value": value2, "color": color2 }, { "value": value3, "color": color3 } ] return dataExplorerTileThreshold -def get_DataExplorerTile_Markdown(name_short, department, bounds, detailDashboardUrl_EMEA,detailDashboardUrl_NA, detailDashboardUrl_CN, docURL ): +def get_DataExplorerTile_Markdown(name_short, department, bounds, detailDashboardUrl_EMEA,detailDashboardUrl_NA, detailDashboardUrl_CN, docURL, slourl_EMEA, slourl_NA, slourl_CN ): # dataExplorerTile_Markdown = { # "name": "Markdown", # "tileType": "MARKDOWN", @@ -167,13 +167,20 @@ def get_DataExplorerTile_Markdown(name_short, department, bounds, detailDashboar # "markdown": "___________\n## " + name_short + "\n\n" + department + " | --> [EMEA](" + detailDashboardUrl_EMEA + ") [NA](" + detailDashboardUrl_NA + ") [CN](" + detailDashboardUrl_CN + ")\n [Documentation](" + docURL + ")" # } #without team links + markdown = "___________\n## " + name_short + "\n\n" + department + " [Documentation](" + docURL + ") \n" + if(slourl_EMEA): + markdown = markdown + "[EMEA]("+slourl_EMEA+") " + if(slourl_NA): + markdown = markdown + "[NA]("+slourl_NA+") " + if(slourl_CN): + markdown = markdown + "[CN]("+slourl_CN+") " dataExplorerTile_Markdown = { "name": "Markdown", "tileType": "MARKDOWN", "configured": "true", "bounds": bounds, "tileFilter": {}, - "markdown": "___________\n## " + name_short + "\n\n" + department + " \n[Documentation](" + docURL + ")" + "markdown": markdown } return dataExplorerTile_Markdown @@ -329,9 +336,17 @@ def main(slo_path): timeframe_ytd = "-3d" slo_graphThreshold_SingleValue = get_dataExplorerTileSloThreshold(configuration["thresholds"]["single_value"]) slo_graphThreshold_Graph = get_dataExplorerTileSloThreshold(configuration["thresholds"]["graph_value"]) - + emeaslourl = "" + naslourl = "" + cnslourl = "" if len(configuration["hubs"]) > 0: - dashboard_json.append(get_DataExplorerTile_Markdown(slo_display, slo_department, get_bounds(((boundindex)*(3)) , 0 , 7 , 3), configuration["ops_dashboard"]["emea"], configuration["ops_dashboard"]["na"], configuration["ops_dashboard"]["cn"],configuration["doc_url"])) + if(configuration["ids"]["emea"]): + emeaslourl = hub_config["euprod"]["remote_url"] + "/ui/slo?id="+configuration["ids"]["emea"] + if(configuration["ids"]["na"]): + naslourl = hub_config["naprod"]["remote_url"] + "/ui/slo?id="+configuration["ids"]["na"] + if(configuration["ids"]["cn"]): + cnslourl = hub_config["cnprod"]["remote_url"] + "/ui/slo?id="+configuration["ids"]["cn"] + dashboard_json.append(get_DataExplorerTile_Markdown(slo_display, slo_department, get_bounds(((boundindex)*(3)) , 0 , 7 , 3), configuration["ops_dashboard"]["emea"], configuration["ops_dashboard"]["na"], configuration["ops_dashboard"]["cn"],configuration["doc_url"],emeaslourl,naslourl,cnslourl)) for hub,tiles in configuration["hubs"].items(): if 'actual' in tiles["tiles"]: dashboard_json.append(get_DataExplorerTile_SingleValue(slo_name, configuration["metric"], hub_config[hub]["remote_url"], get_bounds(((boundindex)*(3)) , 7 + hub_config[hub]["offset"] , 4 , 3), timeframe_actual, slo_graphThreshold_SingleValue))