TFS ms.vss-work-web - 来自 "board" 的通知

TFS ms.vss-work-web - notifications from "board"

我目前正在开发 Team Foundation Server 2017 的扩展。

扩展最终应该能够做的是将工作项移动到特定状态,然后在某处调用 Web 服务。

但是我 运行 遇到了一个问题,似乎无法在不同泳道之间移动工作项时进行订阅。

我当前的清单文件 (vss-extension.json) 如下所示:

 {
    "manifestVersion": 1,
    "id": "xxxx-mes-assyst-plugin",
    "version": "0.1.6",
    "name": "xxxx MES Assyst plugin",
    "description": "Connects to MES Teams assyst",
    "publisher": "xxxx-System-A-S",
    "targets": [
        {
            "id": "Microsoft.VisualStudio.Services"
            }
        ],
    "icons": {
        "default": "images/logo.png"
     },
    "contributions": [
    {
        "id": "sample-work-item-form-notifications",
        "type": "ms.vss-work-web.work-item-notifications",
        "description": "Gets events about the current work item form",
        "targets": [
            "ms.vss-work-web.work-item-form"
        ],
        "properties": {
            "uri": "workItemNotifications.html"
        }
    }],
    "scopes": [
        "vso.work",
        "vso.work_write"  
    ],
    "files": [
        {
            "path": "workItemNotifications.html", "addressable": true
        },
        {
            "path": "scripts", "addressable": true
        },
        {
            "path": "images", "addressable": true
        },
        {
            "path": "sdk/scripts", "addressable": true
        }
    ]
}

我的 workItemNotifications.html 如下所示:

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>Work item extension page sample</title>
</head>

<body>
    <script src="sdk/scripts/VSS.SDK.js"></script>

    <script>
        VSS.init({
            explicitNotifyLoaded: true,
            usePlatformScripts: true
        });

        VSS.ready(function () {
            // Register a listener for the work item page contribution.
            VSS.register(VSS.getContribution().id, function (context) {
                return {
                    // Called when the active work item is modified
                    onFieldChanged: function(args) {
                        console.log("onFieldChanged");
                        console.log("----------- ARGS -----------");
                        console.log(args);
                    },

                    // Called when a new work item is being loaded in the UI
                    onLoaded: function (args) {
                        console.log("onLoaded");
                        console.log("----------- ARGS -----------");
                        console.log(args);
                    },

                    // Called when the active work item is being unloaded in the UI
                    onUnloaded: function (args) {
                        console.log("onUnloaded");
                        console.log("----------- ARGS -----------");
                        console.log(args);
                    },

                    // Called after the work item has been saved
                    onSaved: function (args) {
                       console.log("onSaved");
                       console.log("----------- ARGS -----------");
                       console.log(args);
                    },

                    // Called when the work item is reset to its unmodified state (undo)
                    onReset: function (args) {
                        console.log("onReset");
                        console.log("----------- ARGS -----------");
                        console.log(args);
                    },

                    // Called when the work item has been refreshed from the server
                    onRefreshed: function (args) {
                       console.log("onRefreshed");
                       console.log("----------- ARGS -----------");
                       console.log(args);
                    }
                }
            });

            VSS.notifyLoadSucceeded();    
        });
     </script>
</body>
</html>  

每当工作项表单发生更改时,此代码都有效,但是我想订阅通道之间工作项 moving/changing 状态的事件。

我尝试添加一个像 "ms.vss-work-web.backlog-item-notifications" 这样的目标 - 它刚刚返回并出错,因为它不是一个有效的目标。

有人知道怎么做吗?

恐怕无法通过 VSTS Extension 实现,因为据我所知,board 面板中的工作项没有贡献目标。正如 Nicolai 在评论中提到的那样,解决方法是创建一个 Web 服务来订阅 VSTS 服务挂钩以跟踪工作项的更改。