VSTS仪表板小部件getWorkItem可选参数展开 [英] VSTS Dashboard Widget getWorkItem optional parameter expand

查看:71
本文介绍了VSTS仪表板小部件getWorkItem可选参数展开的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写用于但是,使用getWorkItem()函数时遇到问题.我想在给定的 Epic 下获得所有功能 id (我已经知道了史诗ID).我相信,如果将getWorkItem()的 expand 参数设置为全部",我将获得所有功能及其各自ID的列表.不幸的是,我不知道如何定义expand参数的类型",以及如何将其作为值正确传递给getWorkItem()函数.

However I am running into a problem when using the getWorkItem() function. I want to get the ids of all the Features under a given Epic (I already know the epic ID). I am confident that if I set the expand paremeter of getWorkItem() to "All" I will get a list of all the Features and their respective ids. Unfortunately I do not know how to define the "type" of expand parameter and how to properly pass it as a value to the getWorkItem() function.

这是我的代码:

VSS.require(["VSS/Service", "TFS/Dashboards/WidgetHelpers", "TFS/WorkItemTracking/RestClient"],
        function (VSS_Service, WidgetHelpers, TFS_Wit_WebApi) {
            WidgetHelpers.IncludeWidgetStyles();
            VSS.register("myapp", function () {
                var fetchData = function (widgetSettings) {
                    const epicID = 123456;
                    // Get a WIT client to make REST calls to VSTS
                    return VSS_Service.getCollectionClient(TFS_Wit_WebApi.WorkItemTrackingHttpClient).getWorkItem(123456, null, null, All).
                        then(
                            //Successful retrieval of workItems
                            function (workItems) {
                                $('#myText').text(JSON.stringify(workItems));
                                console.log(workItems);
                                // Use the widget helper and return success as Widget Status
                                return WidgetHelpers.WidgetStatusHelper.Success();
                            },
                            function (error) {
                                // Use the widget helper and return failure as Widget Status
                                return WidgetHelpers.WidgetStatusHelper.Failure(error.message);
                            });
                }

这是展开 它说明了值可以是什么,但没有说明如何将其传递给getWorkItem()函数.

Here is the VSTS reference for expand It explains what the values can be, but doesn't say how to pass it into the getWorkItem() function.

我想将函数的可选扩展参数设置为全部",但不知道其类型以及如何正确定义和使用它.

I would like to set the optional expand parameter of the function to "All" but don't know its type and how to properly define and use it.

推荐答案

基于

Based on the source code, it is the enum, so you can specify the integer (e.g. 4) in getWorkItem function.

export enum WorkItemExpand {
    None = 0,
    Relations = 1,
    Fields = 2,
    Links = 3,
    All = 4,
}

这篇关于VSTS仪表板小部件getWorkItem可选参数展开的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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