如何使用 VSTS 扩展隐藏快速添加面板积压项目?

How to hide quick add panel Backlogs Items using VSTS extension?

我想制作一个 VSTS 扩展,可以在加载页面时隐藏快速添加面板积压项。

quick add panel backlog items

扩展是针对 TFS 2015 更新 2。

我有 运行 这段代码,但没有任何反应。

(action.html)

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Action Sample</title>
</head>
<body>
    <script src="scripts/jquery-2.2.3.min.js"></script> 
    <script src="scripts/VSS.SDK.min.js"></script> 
    <script>
      VSS.init();
      var menuContributionHandler = (function () {
      "use strict";
         return {
         execute: function (actionContext) {
             console.log("extension running...");
             $(".panel-region").hide();
             console.log("extension running...Done");                 
         }
     };
 }());

 // Associate the menuContributionHandler object with the "myAction" menu contribution from the manifest.
     VSS.register("myAction", menuContributionHandler);
    </script>
    <div>
        The end user doesn't see the content on this page.
        It is only in the background to handle the contributed menu item being clicked.
</div>
</body>

(vss-extension.json)

{
 "manifestVersion": 1,
 "id": "targetWork",
 "version": "0.1.18",
 "name": "targetWork",
 "description": "targetWork.",
 "publisher": "ms-samples",
 "public": false,
 "categories": [
   "Developer samples"
 ],
 "links": {
   "learn": {
     "uri": "https://github.com/Microsoft/vso-extension-samples"
   }
 },
 "icons": {
   "default": "images/fabrikam-logo.png"
 },
 "targets": [
   {
     "id": "Microsoft.VisualStudio.Services"
   }
 ],
 "branding": {
   "color": "rgb(190, 39, 3)",
   "theme": "dark"
 },
 "files": [
   {
     "path": "scripts",
     "addressable": true
   },
   {
     "path": "images",
     "addressable": true
   },
   {
   "path": "action.html",
         "addressable": true
       }
     ],
     "contributions": [
       {
         "id": "myAction",
         "type": "ms.vss-web.action",
         "description": "Run in Hello hub action",
         "targets": [
           "ms.vss-work-web.work-item-context-menu",
           "ms.vss-work-web.backlog-board-card-item-menu",
           ".work-hub-group",
           "ms.vss-web.project-hub-groups-collection",
           ".backlogs"
         ],
         "properties": {
           "text": "Run in Hello hub",
           "title": "Run in Hello hub",
           "icon": "images/icon.png",
           "groupId": "Explore",
           "uri": "action.html"
         }
       }
     ]
   }

我在查看浏览器的控制台 window 时没有看到扩展已加载。所以我认为我对目标的使用有问题。

所以我最大的问题是我不明白应该如何指定目标。

我一直在查看与此页面相关的教程 (https://www.visualstudio.com/en-us/integrate/extensions/reference/targets/overview) 并试用了它们,我可以让它们工作。但是没有提到如何自定义TFS webaccess 的UI。至少没有什么可以用于我的情况。

谢谢

编辑

感谢 jessehouwing,此问题已在

上得到解答

新样式扩展(市场)是沙盒化的,只能按预期方式扩展 UI,例如添加按钮、菜单项、选项卡,但它们更改现有 UI 的方法非常非常有限。让他们访问完整的 DOM 将允许他们突破他们的安全上下文并通过使用现有功能来使用提升的权限。

你想做的是still possible with the "Legacy Extensions".