Coder Social home page Coder Social logo

microsoft / azure-devops-extension-cascading-picklist Goto Github PK

View Code? Open in Web Editor NEW
19.0 11.0 27.0 2.13 MB

Azure DevOps extension to enable cascading picklists on the work item form

License: MIT License

JavaScript 19.64% TypeScript 79.89% HTML 0.46%
azure-devops azure-devops-extension azure-boards

azure-devops-extension-cascading-picklist's Introduction

Cascading Picklists Extension

This extension can be found in the Azure DevOps Marketplace.

Note that the extension is only supported on Azure DevOps Service. Is it is currently not supported on-prem yet due to a missing API.

Cascading Picklists

This extension uses the ms.vss-work-web.work-item-form contribution point that enables you to build a cascading picklist on the work item form. Cascading picklists are made up of two seperate fields. The parent field and a child field. The parent picklist will contain a list of values, that when a value is selected, will display the values in the child list.

image

Create a picklist

First, create a picklist of parent values. Second, create a picklist of child values. This child picklist will contain all possible values. We will configure how those values get displayed in the extension configuration.

image

Configure

Once both picklists have been created and configured, you can configure what child picklist values will be displayed. You do this by going to the "Cascading Lists" Hub in project settings. From here, configure the value for the parent picklist, so that when selected, the child values will be displayed.

image

Config example:

{
  "version": 1,
  "cascades": {
      "Custom.MajorRelease": {
          "Release Blue": {
              "Custom.MinorRelease": [
                  "Blue.1",
                  "Blue.2",
                  "Blue.3"
              ]
          },
          "Release Red": {
              "Custom.MinorRelease": [
                  "Red.A",
                  "Red.B",
                  "Red.C"
              ]
          }
      }
  }
}

Tips

  1. You must know the refname of the custom picklist fields. You can use List Fields REST API if you need help finding the value.

  2. The values setup in the picklist and the values in the configuration must be an exact match. There is no validation to check or correct spelling mistakes in the values.

Get started with Extensions

Building and testing the extension requires following.

  1. Download and install NodeJS
  2. Install tfx-cli
npm i -g tfx-cli

Install dev prerequisites

npm install

Create vsix to deploy on test environment

npm run build

Run the extension server locally

Execute following commands in two separate Command Prompts. Denote that in order to test extenstion locally, you need to have certificate and key in the project root called private.crt and private.key.

npm run watch
npm run serve-dev

Publish the dev extension to marketplace

Follow the instructions here:

Package, publish, unpublish, and install Azure DevOps extensions

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

azure-devops-extension-cascading-picklist's People

Contributors

aminti avatar byagent avatar danhellem avatar daxaholic avatar dependabot[bot] avatar madkoo avatar martinams avatar microsoft-github-policy-service[bot] avatar microsoftopensource avatar molausson avatar msftgits avatar navneet-g avatar obvioussean avatar vadim-kovalyov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

azure-devops-extension-cascading-picklist's Issues

Not working - Options Disappearing

I was able to install and configure the cascading list extension but it does not seem to work. I first based the second picklist on the System.State field value and then I tried it based on a custom field value. Neither of them worked. Here is the config file for the one using the custom field.

The Custom.059c9d15-c6e7-4ec9-8015-9f5cb685bfa2 is defined as a picklist with Test1, Test2, Test3, and Test4 as its values.

If I test it multiple times, the cascading picklist values will disappear altogether.

{
“version”: “1”,
“cascades”: {
“Custom.HideStatePicklist”: {
“New”: {
“Custom.059c9d15-c6e7-4ec9-8015-9f5cb685bfa2”: [
“Test1”
]
},
“Active”: {
“Custom.059c9d15-c6e7-4ec9-8015-9f5cb685bfa2”: [
“Test2”
]
},
“Resolved”: {
“Custom.059c9d15-c6e7-4ec9-8015-9f5cb685bfa2”: [
“Test3”
]
},
“Closed”: {
“Custom.059c9d15-c6e7-4ec9-8015-9f5cb685bfa2”: [
“Test3”
]
}
}
}
}

Update json configuration usign API

We're considering to use this control to populate two comboboxes: one combobox should contains the list of products and the other one the lists of version; with this control we'd like to manage the relationship between products and versions.

We've execute some test with positive results, now we’d like complete the update of the information programmatically.

In order to update the combobox values, we've found DevOps API Web,
https://docs.microsoft.com/en-us/rest/api/azure/devops/processdefinitions/lists/update?view=azure-devops-rest-4.1

I'd like to ask if it’s available some APIs to update the json file with the relationship between comboboxes values.

Could you provide me some information?

Thank you
Maurizio

Can child lists be freely entered

When the child list enters a value that does not exist in JSON, the value will be cleared. Is there a way to manually enter a value that does not exist,Let the drop-down box only be used as a prompt.

List Config disappears

I saved my configuration in my Azure DevOps Project. Tested it. It works wonderfully. Then, two days later configuration reverted to the default config. Not sure what is happening or what I am not doing. Please help. I save a backup now to quickly replace. This has happened twice.

Functionality of cascading lists is disrupted by the New Boards Hubs public preview

We are using ADO extension Cascading Lists for displaying field options controlled by another field. It was working well until recent UI upgrades of ADO. All options would be displayed regardless what was picked in control field.

After some discussion and research, we found out that New Boards Hubs public preview might be impacting some ADO extensions. Once we turned it off from preview features, this extension for Cascading Lists was back to normal behaviors.

Hopefully, the issue or conflict between New Boards Hubs and this extension Cascading Lists can be resolved soon so that we won't miss experience of new functionalities of ADO.

Updaing the JSON in Config File via API??

Is there anyway to update the JSON in the config file from code? Our team is making sure that any picklist value that changes can be automatically remapped. Is there an API built to access the config file?

How can we auto update cascading list config

Hi Team
Can you please suggest is there any way (or REST API) through which we can auto update the cascading list config file. Any help in this regard would be grateful.
Thank you
Chary

Workitemtype system fields Question

Hello,

For PBI and bug, I am trying to derive different values based on the system.state values like below. For some reason it is showing all for both WIT's. Please help

{
  "version": 1,
  "cascades": {
    "System.WorkItemType": {
      "Product Backlog Item": {
        "System.State": {
          "New": {
            "Custom.SubState": [
              "Ready for Grooming",
              "Ready for Implementation"
            ]
          },
          "Committed": {
            "Custom.SubState": [
              "Blocked",
              "In Code Review",
              "In Dev testing",
              "Merged"
            ]
          },
          "Done": {
            "Custom.SubState": ["Completed"]
          }
        }
      },
      "Bug": {
        "System.State": {
          "New": {
            "Custom.SubState": ["Ready for Implementation"]
          },
          "Committed": {
            "Custom.SubState": [
              "Blocked",
              "In Code Review",
              "In Dev testing",
              "Merged",
              "Needs More Info",
              "Pending Information from Customer"
            ]
          },
          "Done": {
            "Custom.SubState": ["Completed"]
          }
        }
      }
    }
  }
}

Getting error - this.workItemService.filterAllowedFieldValues is not a function

I am trying to use this extension on-promise, I have replicated the exact steps to run, however, I got the below error, I am using the latest Azure DevOps Server Version Dev17.M153.5

Uncaught (in promise) TypeError: this.workItemService.filterAllowedFieldValues is not a function
at e. (cascading.service.ts:137)
at global.js:20
at Object.next (global.js:20)
at global.js:20
at new Promise ()
at n (global.js:20)
at cascading.service.ts:136
at Array.map ()
at e. (cascading.service.ts:136)
at global.js:20

Please help!

Cascading List

Installed the extension but I don't see the Cascading List option from anywhere on my project or account. Where exactly is the Cascading List supposed to show up?

Delay in refreshing the 2nd picklist

Hello,

I am using your Cascading list extension (thank you, btw) and noticed that there is a delay when updating 2nd list from the cascading list. Here is scenario:

  1. Select Value1 from List1
  2. List2 shows all values instead just showing values associated with Value1 from List1
  3. Then, I select any value from List2
  4. Click on some other field on the form
  5. Then, go back to List2 picklist and now I see only values associated with Value1 from List1 as expected

Is this by design? Is there a way to avoid this delay and extra click? I got no other extensions installed in the org except for this extension.

example isn't working in Azure Devops Server 2019

Hi -
I'm trying to get the example working on our installation of Azure DevOps.

Working on our Bug types:

Created new picklist (string) field named "MajorRelease" (no spaces) with values "Release Blue" and "Release Red"

cascading-sheet-major-rel

Created another picklist (string) field named "MinorRelease" (no spaces) with values "Blue.1", "Blue.2", "Blue.3", "Red.A", "Red.B" and "Red.C".

cascading-sheet-minor-rel
Pasted the sample JSON into the Cascading Lists Config for our project settings, and saved the configuration.

Opened a new window, created a new bug, and i can see the two new fields. Under Major Release, I select "Release Blue", and then under Minor Release, i expect to only see the Blue items listed, but instead I see all 6 items (red and blue).

cascading-sheet-not-working

Enabling Preview of New Board Hubs results in cascading list not working

Hello there,

When New Board Hub preview is enabled in Chrome, Version 118.0.5993.89 (Official Build) (64-bit) the cascade list functionality does not work. I know there was a previous submission on this that was closed. I am available to demonstrate after 11/2 (due to taking holiday).

Ability to write changes to audit log

Hi there,
As a previous commenter noted, there is no way to lock down the JSON file from modifications from anyone who has access. If the file can't be locked down, would it be possible to write any changes to the audit log, so that we can at least find out who modifies the file?

Need way to protect JSON config file from being edited by non-admins

We have discovered that any user in Azure DevOps can make changes to the JSON config file and save them. We would like to limit this capability to only those users in the admin group. We would like to prevent unauthorized/unapproved changes to the cascading picklists. Is there currently any way to do this?

Cascading List rules not working on cards on Boards unless the Work Item is opened

I have Cascading List rules set to alter a picker list based on State, and it works fine when the Work Items are open and State is changed. It doesn't work on the same field on the Board when the Work Item is dragged and dropped between swimlanes. The State changes on the card but the picker with the rules on doesn't and shows all the values, until the Work Item card is opened and closed and only then it loads the rules.

Cascading list delays even without other extensions

Hello,

I am using your Cascading list extension. Thank you for a great value add!

I have noticed delays in the list updating when creating workitem. When I try to create the workitem through the boards create workitem there is no delay.

Is there a way to avoid this delay?

Not able to query childlist values from the REST DevOps API using a parent picklist value

Using the example supplied and instructions from the Readme, "You can use List Fields REST API if you need help finding the value.", its not clear how I can query for the child picklist based on a supplied parent picklist value.
i.e. If I request from the API and pass value 'Release Blue', I want the response to return allowed values ['Blue1','Blue2','Blue3']

{
"version": 1,
"cascades": {
"Custom.MajorRelease": {
"Release Blue": {
"Custom.MinorRelease": [
"Blue.1",
"Blue.2",
"Blue.3"
]
},
"Release Red": {
"Custom.MinorRelease": [
"Red.A",
"Red.B",
"Red.C"
]
}
}
}
}

Can I control a picklist based off of two fields?

Great feature!

Is it possible to structure JSON in a way that would control a field's lookup options based off the values of two fields?

For example if I have 3 fields: ProductLine, RequestCategory, RequestType. Can I get different lists of RequestTypes based on both the ProductLine and RequestCategory values?

If not, could you suggest where in the code would have to change to support that? Happy to give it a try and submit a PR if it would help. But not being a javascript expert some guidance would be great.

Thanks!

Values at runtime

Can the JSON be supplied dynamically. Because to add a new value one need to every time do the steps and deploy.

Need to use 2 set of cascades in the same work item

I need to customize a WIT in such a way where I have, for example:

Field MajorRelease
Field MinorRelease
Field BusinessUnit
Field AreaSite

And I need to configure cascading from MajorRelease to MinorRelease, and from BusinessUnit to AreaSite

I've created the JSON as:
JSONToReportIssue.txt

Additionally, I need to use some special characters in some values, as spanish letters with tilde (á, é, í, ó, ú), ñ or &.

Could you guys please tell me if this is not feasible due to some current limitation of this extension, or if I could apply any change in what I am currently doing?

Thanks

Support for API response

Here we need to configure a JSON file first to get the cascading effect. But we have a running API service for the same purpose. How can we bind the API response for this extension instead of Config JSON.

This is much required for me.

Are cascading lists between three fields supported

Are cascading lists between three fields supported? In the example below, the Service Teams and RequestType fields cascade as expected. But the third field, RequestSubType displays all the values:

{
"version": "1.0",
"cascades": {
"Custom.ServiceTeam": {
"Service Team 1": {
"Custom.RequestType": [
"Blue.ServiceA",
"Blue.ServiceB",
"Blue.ServiceC"
]
},
"Service Team 2": {
"Custom.RequestType": [
"Red.Service1",
"Red.Service2",
"Red.Service3"
]
}
},
"Custom.RequestType": {
"Blue.ServiceA": {
"Custom.RequestSubType": [
"List A",
"List B",
"List C"
]
},
"Custom.RequestType": {
"Red.Service1": {
"Custom.RequestSubType": [
"List 1",
"List 2",
"List 3"
]
}
}
}
}

automate the child picklist value when dropdown having one value

Hi,

If i change parent picklist and if there’s only one value in child picklist, how can we populate child field directly instead of appending that value to child dropdown.

There are lot of fields in my form where cascading needs to be done so instead of selecting single value from child dropdown can’t we populate directly.

Thanks in advance

Configuration entry disapear

Hello,
everything is good but I want to update a list dependency. unfortunately I don't see anymore the entry cascading lists 👎
somebody have an idea?
(we use azure devops)

have a nice day
Yohan

Filter main picklist by project

Here at the company we have several projects in DevOps and a unique process template.

Following the example of the extension with the fields Custom.MajorRelease and Custom.MinorRelease today we have different values between the projects for Custom.MajorRelase.

Custom.MajorRelease is configured with these values:

    Release Blue
    Release Red
    Release Orange
    Release Green

And the distribution of these values among the projects would have to be this way:

PROJECT A

   Custom.MajorRelease
       Release Blue
       Release Red

PROJECT B

   Custom.MajorRelease
       Release Orange
       Release Green

For this we configure the JSON of the projects as below. It turns out that Custom.MajorRelease always returns all registered values and does not filter only the values that are in JSON.

PROJECT A

Custom.MajorRelease
   Release Blue
   Release Red

{
  "version": 1,
  "cascades": {
      "Custom.MajorRelease": {
          "Release Blue": {
              "Custom.MinorRelease": [
                  "Blue.1",
                  "Blue.2",
                  "Blue.3"
              ]
          },
          "Release Red": {
              "Custom.MinorRelease": [
                  "Red.A",
                  "Red.B",
                  "Red.C"
              ]
          }
      }
  }
}

----

PROJECT B

Custom.MajorRelease
   Release Orange
   Release Green

{
  "version": 1,
  "cascades": {
      "Custom.MajorRelease": {
          "Release Orange": {
              "Custom.MinorRelease": [
                  "Orange.1",
                  "Orange.2",
                  "Orange.3"
              ]
          },
          "Release Green": {
              "Custom.MinorRelease": [
                  "Green.A",
                  "Green.B",
                  "Green.C"
              ]
          }
      }
  }
}

Is there a way to make this value filter between projects? If there is no way, would that be an interesting improvement for the extension?

Thanks!

Do we have a possibility for nested Cascading list?

Requirement: I have four dropdown list (Region, Country, Enterprise, Business) in Feature work item type.
When I select Region “NA”, associated Country dropdown should be populated,
when I select country, associated Enterprise dropdown should be populated,
when I select Enterprise, associated Business dropdown should be populated.

Problem: I believe Cascading is between two fields only. Do we have nested cascading list extension? If not, is it possible to have 2 sets of cascading lists in the Feature Work Item type. That is, One cascading list for Region and Country and another one for Enterprise and Business. Please consider this as priority. I am premium customer for Microsoft Azure DevOps and I need to build this functionality to stand a new team. Thanks in advance!

Custom Rules break Second Cascading Lists

We have a cascading list setup for 4 fields:

Product
ProductEntity

Product2
ProductEntity2

Without any Custom Rules setup for the Work Item Type, both cascading lists work perfectly fine!
We then add a custom rule to make a third field (Database ID) required if Product 1 is set to a specific value. Cascading list still works fine.
As soon as we add custom rules to make the third field required (database id) when Product 2 is selected, the cascading list completely breaks and you see all values. If we disable the rule, it works again.

any ideas to why rules are breaking the lists and what can be done about it?

Can I control two fields based off the picklist selection of another?

Thanks - I love this feature! Is it possible to control the lookup options for two fields based on the value selected in another field? For example, I have 3 fields: CustomMake, CustomModel, and CustomColor. I would like to control the picklist options of CustomModel and CustomColor based on the value selected in CustomMake.

I'm very new to JSON (like started yesterday) and gave it a try below, but couldn't get it to work. Is this supported?

{
"version": "1.0",
"cascades": {
"Custom.Make": {
"Ford": {
"Custom.Model": [
"F-150",
"Mustang"
],
"Custom.Color": [
"Red",
"Blue"
]
},
"Dodge": {
"Custom.Model": [
"RAM",
"Viper"
],
"Custom.Color": [
"Green",
"Black"
]
}
}
}
}

Thanks!

Question about the data storage

Reading through the code, I noticed that you guys use the Microsoft Extension Data Storage to store these notes, using a mix of the API and the SDK to save, get, and set them. (is that right?). https://docs.microsoft.com/en-us/azure/devops/extend/develop/data-storage?view=azure-devops

I had a question on the data storage. Is there a limit to how much data can be stored in there? What if our cascading list (theoretically) grows very large? Why do you guys use a mix of the API and the SDK? Why not just one over the other?

Does it support triggering on hidden field?

Hello Team,

Does the control/extension work on a hidden field control on the form as parent field?

Also how can I make it work on System.State field?

Can we have separate confirmation for each work item type?

Empty the pick list options upon changing the parent field

I managed to have 3 fields for cascading pick list extension, I'm having a trouble in clearing the pick list options. Let's say, there are 3 fields. I changed 1st field value, second field value got changed and the pick list options got refreshed- this is expected. But for 3rd field field value and options are still there - which should be refreshed (field and options should be empty).

Is this possible to fix quickly?

Configuration on org. level

Please consider allowing configuration of the JSON rules that drive how the cascading picklist works on org. level.

We have many projects but only a few processes, setting this config on each project is unfortunately a showstopper.

incorrect work on board

I linked custom filed (example Status) with work item state, but work isn't correct (i can move anywhere work items).
General task - restrict change state
My config (example):
"ToDo": {
"Custom.Status": [
"ToDo"
]
},
"In progress": {
"Custom.Status": [
"Puse",
"Analytic",
"Dev",
"Other"
]
},

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.