All Projects → microsoft → vsts-extension-color-control

microsoft / vsts-extension-color-control

Licence: other
This is an example of a custom control extension for use in on-premise instances of Visual Studio Team Services on the work item form.

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language
CSS
56736 projects
HTML
75241 projects

Projects that are alternatives of or similar to vsts-extension-color-control

vsts-extension-multivalue-control
A work item form control which allows selection of multiple values.
Stars: ✭ 40 (+150%)
Mutual labels:  tfs, vsts, work-item-control, vsts-extension
wiql-editor
Search work items with wiql queries.
Stars: ✭ 30 (+87.5%)
Mutual labels:  tfs, vsts, vsts-extension
tfsaggregator
A server side plugin for Team Foundation Server (TFS) and Azure DevOps Server for performing various Work Item related calculations, create new Work Items and Links automatically.
Stars: ✭ 122 (+662.5%)
Mutual labels:  tfs, vsts
FlowViz
A Power BI template that provides easy to understand, actionable flow metrics and predictive analytics for your agile teams using Azure DevOps, Azure DevOps Server and/or TFS.
Stars: ✭ 150 (+837.5%)
Mutual labels:  vsts, vsts-extension
NewmanPostman VSTS Task
A task for Azure DevOps Pipelines to run newman tests.
Stars: ✭ 31 (+93.75%)
Mutual labels:  vsts, vsts-extension
gl-vsts-tasks-file-patch
Visual Studio Team Services Build and Release Management extensions that help you update files using JSON patch and similar syntax
Stars: ✭ 21 (+31.25%)
Mutual labels:  vsts, vsts-extension
az-devops-rice-extension
Azure DevOps extension that auto calculates RICE and stores it in a field.
Stars: ✭ 15 (-6.25%)
Mutual labels:  vsts, vsts-extension
azure-flutter-tasks
Easily build and deploy with latest Flutter build tasks for Azure DevOps Pipelines Tasks
Stars: ✭ 66 (+312.5%)
Mutual labels:  vsts, vsts-extension
vsts-extension-ts-seed-simple
Very simple seed project for developing a VSTS extension
Stars: ✭ 61 (+281.25%)
Mutual labels:  vsts, vsts-extension
TfsCmdlets
PowerShell Cmdlets for Azure DevOps and Team Foundation Server
Stars: ✭ 75 (+368.75%)
Mutual labels:  tfs, vsts
rust-azure-devops
[No longer maintain] 🦀 Rust extension for Azure DevOps
Stars: ✭ 26 (+62.5%)
Mutual labels:  vsts, vsts-extension
azure-boards-decompose
Azure Boards extension to quickly decompose work items into a valid hierarchy
Stars: ✭ 35 (+118.75%)
Mutual labels:  tfs, vsts
gl-vsts-tasks-yarn
Yarn Package Manager Visual Studio Team Services Build and Release Management extensions
Stars: ✭ 50 (+212.5%)
Mutual labels:  vsts, vsts-extension
github-tools-vsts
📦🚀 Create and modify GitHub Releases in Azure DevOps Build and Release Management
Stars: ✭ 24 (+50%)
Mutual labels:  vsts, vsts-extension
AzureDevOps-WSJF-Extension
Sample work item form extension that auto calculates WSJF (weighted shortest job first) per work item and stores it in a work item field
Stars: ✭ 21 (+31.25%)
Mutual labels:  vsts, vsts-extension
Task-Card-Creator
Small tool for printing task cards used for a Scrum board. Your physical Scrum board will look fantastic. Supports Team Foundation Server and Azure DevOps.
Stars: ✭ 25 (+56.25%)
Mutual labels:  tfs, vsts
haystack bio
Haystack: Epigenetic Variability and Transcription Factor Motifs Analysis Pipeline
Stars: ✭ 42 (+162.5%)
Mutual labels:  tfs
jest-trx-results-processor
Jest results processor for exporting into TRX files for Visual Studio
Stars: ✭ 23 (+43.75%)
Mutual labels:  vsts
juceSynths
Collection of JUCE synthesisers utilising the Maximilian library.
Stars: ✭ 78 (+387.5%)
Mutual labels:  vsts
DeploySsrs
Build-Release task for VSTS/TFS that manages Microsoft's SQL Server Reporting Services
Stars: ✭ 17 (+6.25%)
Mutual labels:  vsts

Custom Control for the Work Item Form

Learn how to build your own custom control for the work item form.

Usage

  1. Clone the repository.

  2. Open the Command Prompt and change to the directory where you cloned the project. For instance, if it is cloned in a folder called "extensions" and saved as "vsts-sample-wit-custom-control", you will navigate to the following command line.

     > cd C:\extensions\vsts-sample-wit-custom-control
    
  3. Run npm install to install required local dependencies.

  4. Run npm install -g grunt to install a global copy of grunt (unless it's already installed).

  5. Run grunt package-dev.

  6. In your browser, navigate to your local instance of TFS, http://YourTFSInstance:8080/tfs.

  7. Go to your personal Marketplace.

  8. Click the Marketplace icon in the upper righthand corner.

  9. Click "Browse local extensions" in the dropdown.

  10. Scroll down and click on the "Manage Extensions" widget.

  11. Click the button "Upload new extension".

  12. Browse to the .vsix file generated when you packaged your extension.

  13. Select the extension, and then click "Open". Click "Upload" when the button activates.

  14. Hover over the extension when it appears in the list, and click "Install".

You have now installed the extension inside your collection. You are now able to put the control on the work item form.

A work item type is defined by XML, including the layout of the work item form. As part of the walkthrough, you will add the control to the layout. Read more information on WebLayout XML. In this example, we will add the control to the Agile "user story".

  1. Open the Developer Command Prompt. Export the XML file to your desktop with command shown below.

    witadmin exportwitd /collection:CollectionURL /p:Project /n:TypeName /f:FileName
    
  2. This creates a file in the directory that you specified. Inside this file, navigate to the section called "Work Item Extensions". This section shows the documentation of the control such as the inputs and ids. All this information was defined in the manifest, vss-extension.json.

        <!--**********************************Work Item Extensions***************************
    

Extension: Name: color-form-control Id: ms-devlabs.color-form-control

Control contribution:
	Id: ms-devlabs.color-form-control.color-control-contribution
	Description: Add custom colors and labels for picklist fields.
	Inputs:
		Id: FieldName
		Description: The field must have allowed values.
		Type: WorkItemField
		Field Type: String; Integer
		Data Type: String
		IsRequired: true

		Id: Labels
		Description: 
		Data Type: String
		IsRequired: false

		Id: Colors
		Description: 
		Data Type: String
		IsRequired: false
```
  1. Add an extension tag below the "Work Item Extensions" section as shown below to make your control available to work item form.

       <!--**********************************Work Item Extensions***************************
       ...
    
       Note: For more information on work item extensions use the following topic:
       http://go.microsoft.com/fwlink/?LinkId=816513
       -->
    
       <Extensions>
           <Extension Id="ms-devlabs.color-form-control" />
       </Extensions>
  2. Find your extension ID in the "Work Item Extensions" section:

        <!--**********************************Work Item Extensions***************************
    

Extension: Name: color-form-control Id: ms-devlabs.color-form-control ... ```

  1. This extension is a contribution, so you add it with a contribution tag in place of the tag. This example adds the "ControlContribution" to the "Planning" group.

    <Page Id="Details">
    ...
        <Section>
        ...
            <Group Id="Planning">
            ...
                <ControlContribution Label="Priority" Id="ms-devlabs.color-form-control.color-control-contribution"
                    <Inputs>
                        <Input Id="FieldName" Value="Microsoft.VSTS.Common.Priority" />
                    </Inputs>
                </ControlContribution>
    
                <Control Label="Risk" Type="FieldControl" FieldName="Microsoft.VSTS.Common.Risk" />
  2. Finally, import this .xml file, using witadmin.

    witadmin importwitd /collection:CollectionURL /p:Project /f:FileName
    

Make changes to the control

If you make changes to your extension files, you need to compile the Typescript and create the .vsix file again (steps 4-7 in the "Package & Upload to the marketplace" section).

Instead of re-installing the extension, you can replace the extension with the new .vsix package. Right-click the extension in the "Manage Extensions" page and click "Update". You do not need to make changes to your XML file again.

Make API calls to the work item form service

Reading data from VSTS/TFS server is a common REST API task for a work item control. The VSS SDK provides a set of services for these REST APIs. To use the service, import it into the typescript file.

import * as VSSService from "VSS/Service";
import * as WitService from "TFS/WorkItemTracking/Services";
import * as ExtensionContracts from "TFS/WorkItemTracking/ExtensionContracts";
import * as Q from "q";

To enable Intellisense in Visual Studio Code, include the type definition file index.d.ts. Once you've added this definition file, it shows all functions available in the VSS SDK.

/// <reference path="../typings/index.d.ts" />

Commonly Needed

API Functions Usage
VSSService VSS.getConfiguration() Returns the XML which defines the work item type. Used in the sample to read the inputs of the control to describe its behavior.
WitService getService() Returns an instance of the server to make calls.
getFieldValue() Returns the field's current value.
setFieldValue() Returns the field's current value using your control.
getAllowedFieldValues() Returns the allowed values, or the items in a dropdown, of a field.

How to invoke methods on a service call

Create an instance of the work item service to get information about the work item. Use one of the service's functions to get information about the field. This example asks for the allowed values of a field.

WitService.WorkItemFormService.getservice().then(
        (service) => {
            service.getAllowedFieldValues(this._fieldName), (allowedValues: string[]) => {
                // do something
            }
        }
)

Recommendation: use Q with service calls

To wait on the response of multiple calls, you can use Q. This example shows how to ask for the allowed values and the current value associated with a field using the Q.spread function. You can make two parallel requests, and the code will not be executed until both services have returned a response.

WitService.WorkItemFormService.getService().then(
            (service) => {
                Q.spread<any, any>(
                    [service.getAllowedFieldValues(this._fieldName), service.getFieldValue(this._fieldName)],
                    (allowedValues: string[], currentValue: (string | number)) => {
                        //do something
                    }
                )
            }
)

Structure

/scripts            - Typescript code for extension
/img                - Image assets for extension and description
/typings            - Typescript typings

index.html          - Main entry point
vss-extension.json  - Extension manifest

Grunt

Five basic grunt tasks are defined:

  • build - Compiles TS files in scripts folder
  • package-dev - Builds the development version of the vsix package
  • package-release - Builds the release version of the vsix package
  • publish-dev - Publishes the development version of the extension to the marketplace using tfx-cli
  • publish-release - Publishes the release version of the extension to the marketplace using tfx-cli

VS Code

The included .vscode config allows you to open and build the project using VS Code.

Unit Testing

The project is setup for unit testing using mocha, chai, and the karma test runner. A simple example unit test is included in scripts/logic/messageHelper.tests.ts. To run tests just execute:

grunt test
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].