From eeb56a86a6d750dc1e80f11c0a1b56e8de34e8b9 Mon Sep 17 00:00:00 2001 From: github-actions Date: Sun, 17 Sep 2023 20:29:20 +0200 Subject: [PATCH] Fix 1x1 widget error --- vss-extension-dev.json | 2 +- widget_1x1/widget_1x1.html | 25 ++++++++++--------------- 2 files changed, 11 insertions(+), 16 deletions(-) diff --git a/vss-extension-dev.json b/vss-extension-dev.json index 53a7313..f4713a9 100644 --- a/vss-extension-dev.json +++ b/vss-extension-dev.json @@ -1,7 +1,7 @@ { "manifestVersion": 1, "id": "GHAzDoWidget-DEV", - "version": "0.0.1.66", + "version": "0.0.1.67", "public": false, "name": "Advanced Security dashboard Widgets [DEV]", "description": "[DEV] GitHub Advanced Security for Azure DevOps dashboard widgets", diff --git a/widget_1x1/widget_1x1.html b/widget_1x1/widget_1x1.html index fae54bf..1298b90 100644 --- a/widget_1x1/widget_1x1.html +++ b/widget_1x1/widget_1x1.html @@ -17,21 +17,16 @@ { WidgetHelpers.IncludeWidgetStyles(); VSS.register("GHAzDoWidget.1x1", function () { - try { - const webContext = VSS.getWebContext(); - const project = webContext.project; - const organization = webContext.account.name; - const projectId = project.id; - // convert project.name to url encoding - const projectName = project.name.replace(/ /g, "%20").replace(/&/g, "%26"); - - consoleLog('project id: ' + projectId); - consoleLog('project name: ' + projectName); - consoleLog('organization name: ' + organization); - } - catch (err) { - consoleLog(`Error getting the web context: ${err}`); - } + const webContext = VSS.getWebContext(); + const project = webContext.project; + const organization = webContext.account.name; + const projectId = project.id; + // convert project.name to url encoding + const projectName = project.name.replace(/ /g, "%20").replace(/&/g, "%26"); + + consoleLog('project id: ' + projectId); + consoleLog('project name: ' + projectName); + consoleLog('organization name: ' + organization); async function loadWidget(widgetSettings) { consoleLog(`WidgetSettings inside loadWidget_1x1: ${JSON.stringify(widgetSettings)}`);