如何使用VSTS扩展名隐藏快速添加面板积压项目? [英] How to hide quick add panel Backlogs Items using VSTS extension?

查看:36
本文介绍了如何使用VSTS扩展名隐藏快速添加面板积压项目?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想做一个VSTS扩展,可以在加载页面时隐藏快速添加面板的待办事项.

I want to make an VSTS extension that can hide the quick add panel backlog items when loading the page.

快速添加面板待办事项

已针对TFS 2015更新2进行了扩展.

The extension is made to target TFS 2015 update 2.

我已经运行了这段代码,但没有任何反应.

I have run this code but nothing happens.

(action.html)

(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)

(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"
         }
       }
     ]
   }

在浏览器的控制台窗口中没有看到加载的扩展程序.所以我认为我使用目标有问题.

I don't see that extension is loaded when looking at console window of the browser. So I think that there is something wrong with my use of targets.

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

So my biggest issue is that I can't understand how the target should be specified.

我一直在查看与此页面相关的收费表( https://www.visualstudio.com/zh-cn/integrate/extensions/reference/targets/overview ),并对其进行了尝试,我可以使它们正常工作.但是没有提及如何自定义TFS Web访问的UI.至少我没有什么可以使用的案例.

I have been looking at the toturials related to this page(https://www.visualstudio.com/en-us/integrate/extensions/reference/targets/overview) and tried them out and I can get them to work. But nothing mentioned about how to customize the UI of TFS webaccess. At least nothing that I can use for my case.

谢谢

修改

由于jessehouwing,此问题已在

Thanks to jessehouwing, this question has been answered on this stackoverflow post

推荐答案

新样式扩展(市场)已被沙盒化,并且只能以预期的方式扩展UI,例如添加按钮,菜单项,标签,但是它们更改现有UI的方式非常有限.授予他们访问完整DOM的权限将使他们脱离安全上下文并通过使用现有功能使用提升的权限.

The new style extensions (marketplace) are sandboxed and can only extend the UI in the way intended, e.g. add buttons, menu items, tabs, but they have very, very limited ways of changing the existing UI. Giving them access to the full DOM would allow them to break out of their security context and use elevated permissions by using existing features.

您要执行的操作是 旧版扩展程序"..

这篇关于如何使用VSTS扩展名隐藏快速添加面板积压项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆