我想制作一个 VSTS 扩展,可以在加载页面时隐藏快速添加面板积压项目。
快速添加面板待办事项
该扩展是针对 TFS 2015 更新 2 进行的。
我已经运行了这段代码,但没有任何反应。
(动作.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"
}
}
]
}
查看浏览器的控制台窗口时,我没有看到扩展已加载。所以我认为我使用的目标有问题。
所以我最大的问题是我无法理解应该如何指定目标。
我一直在查看与此页面相关的教程(https://www.visualstudio.com/en-us/integrate/extensions/reference/targets/overview)并尝试了它们,我可以让它们工作。但没有提到如何自定义TFS webaccess的UI。至少没有什么可以用于我的情况。
Thanks
Edit
感谢 jessehouwing,这个问题已得到解答堆栈溢出帖子