2017TFSワークアイテムフォームにボタンがあります。ダイアログが開くはずです。
このMicrosoftドキュメント(https://docs.microsoft.com/en-us/vsts/extend/develop/using-host-dialog)を使用して、次のコードを作成しました。
$(us_button[0]).click(function(){
VSS.getService(VSS.ServiceIds.Dialog).then(function(dialogService) {
var extensionCtx = VSS.getExtensionContext();
// Build absolute contribution ID for dialogContent
var contributionId = extensionCtx.publisherId + "." + extensionCtx.extensionId + ".info";
// Show dialog
var dialogOptions = {
title: "My Dialog",
width: 800,
height: 600
};
dialogService.openDialog(contributionId, dialogOptions);
});
});
またinfo
、Microsoftのガイドが示唆しているように、マニフェストに要素を追加しました。
ウィンドウは開きますが、ページが読み込まれることはありませんinfo.html
。デバッグが言うのは(no stack) null
。だけです。
マニフェストファイル:
{
"manifestVersion": 1,
"id": "usButton",
"version": "1.0.56",
"name": "usButton",
"publisher": "Logrocon",
"icons": {
"default": "img/logo.png"
},
"targets": [
{
"id": "Microsoft.VisualStudio.Services"
}
],
"tags": [
"Work Item",
"Work Item control"
],
"files": [
{
"path": "img",
"addressable": true
},
{
"path": "dist",
"addressable": true
},
{
"path": "scripts/main.js",
"contentType": "text/javascript",
"addressable": true
},
{
"path": "info.html",
"addressable": true
},
{
"path": "usButton.html",
"addressable": true
}
],
"categories": [
"Plan and track"
],
"scopes": [
"vso.work_write"
],
"contributions": [
{
"id": "usButton",
"type": "ms.vss-work-web.work-item-form-control",
"targets": [
"ms.vss-work-web.work-item-form"
],
"properties": {
"name": "usButton",
"uri": "usButton.html",
"height": 40,
"inputs": [
{
"id": "FieldAppTestBtn",
"description": "Autocalculate Remaining Work.",
"type": "WorkItemField",
"properties": {
"workItemFieldTypes": ["Double"]
},
"validation": {
"dataType": "String",
"isRequired": true
}
}
]
}
},
{
"id": "info",
"targets": [],
"description": "The content to be displayed in the dialog",
"type": "ms.vss-web.control",
"properties": {
"uri": "info.html"
}
}
]
}
run VSS.init()
info.htmlに拡張SDKとメソッドをインポートしませんでした。以下に更新してから、再試行してください。
<!DOCTYPE html>
<html style="background-color:inherit;height:100%;">
<head>
<title>Continious delivery actions</title>
<script src="dist/VSS.SDK.min.js"></script>
</head>
<body style="background-color:inherit;height:100%;">
<div><table><tr><td>ID</td><td>Поле</td><td>Значение</td></tr></table></div>
<script>
VSS.init();
</script>
</body>
</html>
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加