Applying Work Item template to an existing work item - tfs

I used the Process Editor to create a new State for User Story work items (the state of Proposed). When I create a new story it works fine, the User Story is created and the initial state is Proposed, just like I want it.
However when I open an existing User Story work item (one created before I made the change), it doesn't have the Proposed state as an option, and furthermore it will not accept it if I type Proposed in the State field.
Does this mean that any changes made to a Work Item Template will only apply for new work items going forward?

The proposed state is not in the dropdown, most likely because there is no transition from the current state of the work item to the proposed state.
Could you verify this?

Related

Editing single item in useFieldArray

I'm using and loving react-hook-form. I've run across an issue where I have a list of items (let's say in the left column), then when you click on any item it will display an edit component for the selected item in the right column. The issue is when I switch between items, nested array values don't seem to update the data correctly.
I think I understand that because a new edit component isn't created for each parent item (I'm just passing the selected index down) the nested useFieldArray in the edit component still references the first parent item. If that's the case, I'm not exactly sure how to make sure a new useFieldArray is created for each item that gets selected.
Here's a codesandbox replicating the issue:
https://codesandbox.io/s/dreamy-brattain-r74lx
Any help is much appreciated.
I think you can just map over the childItems prop of your watched item inside your <Details /> component instead of using fields. As you are using watch the <Details /> will be re-rendered after appending a new child item.
If your <Details /> component should get more complex i would also suggest to use useWatch here instead of passing watch. Check this quote from the documentation for useWatch:
Behaves similarly to the watch API, however, this will isolate
re-rendering at the component level and potentially result in better
performance for your application.
Here is an example using useWatch:

Best approach to get count of workitems state transitions?

I need to create a dashboard widget for Azure DevOps that shows number of work items of a specified type, that transitioned from one state to another.
It looks like the Updates endpoint is my best bet, but that means that I would have to iterate over all of the updates of workitems for the specified type and then determine if it contains the state transition I'm looking for, e.g. Closed to Open.
https://learn.microsoft.com/en-us/rest/api/azure/devops/wit/updates/list?view=azure-devops-server-rest-5.0
The Analytics extension looked promising, but it looks like I would need to query the Revisions dataset, and that doesn't contain the old and new values.
https://learn.microsoft.com/en-us/azure/devops/report/extend-analytics/wit-analytics?view=azure-devops
The use case is to show the number of bugs that were closed then reopened in the last 90 days. I thought that I would make the work item type and from and to states configurable.
Any ideas or suggestions much appreciated!
Best approach to get count of workitems state transitions?
At this moment, we could not query the History with State changed from one state to another state on Web UI directly.
As workaround, we could add a custom field in our custom process that gets set the value to true when workitems state change from Closed to New:
Then add a Rules to set the value of the custom field to True if the workitems state change from Closed to New:
Finally, we could query the workitems with following conditions:
BTW, if you want to get those workitems which state already changed from Closed to New before use above custom filed and rules, I am afraid you have to use Rest API to query the work items that in specified type:
https://learn.microsoft.com/en-us/rest/api/vsts/wit/wiql/query%20by%20wiql
Then loop the work items list to get all revisions for every work item with Revision - List API:
https://learn.microsoft.com/en-us/rest/api/vsts/wit/revisions/list
There is a article for TFS TFS SDK: Work Item History Visualizer using TFS API, you can check it for some more details.
Hope this helps.
You may do it through PowerBI. Calculate time-in-state for an existing Analytics view
Or as you said iterate over all of the updates of workitems.

XUL: Multiple reuse of an overlay in same file?

I'm developing a Firefox extension. There is a menu X which I need to show in both Tools menu and Context menu. Tools menu item and Context menu item are defined in same file but menu X in another file.
As I'm reusing menu X by id only last use of it is effective. How can I reuse it multiple time in same file without redundancy?
It can be done using XBL.
I haven't found a good solution either. The approach is rather to define the menu in the overlay only once and then clone it in your "load" event handler. You can then insert the clone at the second location. You have to be careful because ID attributes have to stay unique - so if your menu uses ID attributes you will have to additionally rewrite them. Ugly, I know.
IDs are, per definitionem, unique. That means you can't share the menuitem but you can share the code that gets executed when the action is invoked. One way to achieve this is to use commands.

jQuery Sortable todo List

I'm trying to build a todo list. http://d2burke.com/exp/todo/
I want my user to be able to mark items as complete, at which point the item is dropped down to the 'Complete' list, and vice versa. I also want each of these lists to be independently sortable.
I'm using a basic custom method to move the items back and forth, and I've used jQueryUI Sortable to sort them.
All of these things I've been able to accomplish; however, it doesn't seem as though the site (the DOM?) is registering that the items were moved from one list to the other. If I mark one item as 'Complete' it physically moves down...and becomes sortable in the 'Complete' list, but I'm echoing out the current positions in serialized format (because I'm going to record the order in a db) and the app doesn't seem to recognize that the item has moved.
I'd like to force the app to recalculate the list of items when an item is marked complete, or incomplete.
Help?
I looks to me like you should look at the resfresh methods of of the sortable: http://jqueryui.com/demos/sortable/
I would start with .refresh() too see if that also recalculates the positions. I assume it does but if not you might need to trigger the other one too.
There are few things that stand out that I would comment on:-
1) When you 'move' an item, you are moving more than you intend - the moved item has a 'tbody' around it - your code is very fragile, depending on parent.parent... which will be a nightmare to maintain.
2) You have various parent.parent constructs - lose these switch to '.closest()' to search up the tree to the class of item you wan to operate on.
3) You are doing things with binding/unbinding - lose them and switch to '$(document.body).on(,...)' then jquery will add/remove events automatically based on your selector - link once and forget.
Once this is done the bugs may go away - if not it will still be clearer so possible to debug properly!
Regards
ps. If it were me, I think I'd link the two list so they are sortable together, and toggle the completed flag if an item is moved from one list to the other.
This way the user has two ways of changing the status and jquery will do all the donkey work as you are simply sorting a normal linked list.

TFS: batch updating of work items in web version of TeamExporer

In the web version of team explorer I've selected few work items (they are pretty similar: same type, assigned to me, are in same state). When I selected them and clicked "Edit Work Items" new window appeared with text:
State () cannot change the state
() To change the state or reason, selected work items must be of the same type and state
What is wrong in my case? Those items are of the same type and state. Why I can't update them?
Thanks.
Any thoughts are welcome.
Hard to say without more information. I should point out that you can't "bypass" a state transition that's required by your work item type. For example, you probably can't move a bug directly from "Active" to "Closed" without first setting its state to "Resolved."

Resources