nick-myers / azure-devops-board-cards

Azure DevOps Extension for printing work items to place on physical boards
MIT License
8 stars 4 forks source link

Select iteration path for printing: selection of iteration works intermittently #19

Open primaju opened 5 years ago

primaju commented 5 years ago

Describe the bug Regardless which iteration path for printing is selected. Page footer returns "Printing selected work item types in @CurrentIteration with 0 work items." and popup appears with the text "No work items were returned, please check the options selected and that work items are assigend to the iteration". Although after some time it works for a single selection and then stops again.

Azure DevOps Server 2019.1

To Reproduce Steps to reproduce the behavior:

  1. Go to 'Sprints'
  2. Click on 'Print'
  3. Message with no items popup
  4. Select different iteration
  5. Same message with the same footer appears disregarding selection of iteration

Expected behavior It is expected to return items and the footer below should not show "Printing selected work item types in @CurrentIteration with 0 work items.", the selected iteration is not represented

Screenshots There is no way to present a screenshot

Desktop (please complete the following information):

Additional context It seems that the query is stuck or cached and selection of the iteration is not preserved during the postback. After some investigation it looks like the dataService.setValue for userIterationPath is set but lost after reload let iteration = dataService.getValue("userIterationPath", {scopeType: "User"}); is not getting the value.

nick-myers commented 5 years ago

@primaju thank you for the issue report - are you able to post the content of the browser console when this happens. I'll take a look at the code getting the data.

primaju commented 5 years ago

@nick-myers

Here it is: 1: VSS ready board-cards.html:867 2: Registering backlog tab object board-cards.html:867 3: Checking whether document is ready board-cards.html:867 4: checkReady() board-cards.html:867 5: Document readyState = complete board-cards.html:867 6: Requiring VSS and TFS clients board-cards.html:867 7: Main function started board-cards.html:867 8: Document ready state = complete board-cards.html:867 9: getIteration() board-cards.html:867 10: getUsersSavedAreaPath() board-cards.html:867 11: checkForSavedAreaPath() board-cards.html:867 12: User does not have a saved area path. A 404 is expected when userAreaPath is requested board-cards.html:867 13: setPrintHeader() board-cards.html:867 14: getIterations() board-cards.html:867 15: insertIterationSelectHeader() board-cards.html:867 16: getWorkItemTypes() board-cards.html:867 17: insertWorkItemSelectHeader() board-cards.html:867 18: checkForSavedWorkItemTypes() board-cards.html:867 19: addUpdateButton() board-cards.html:867 20: getAreaPaths() board-cards.html:867 21: checkForSavedAreaPath() board-cards.html:867 22: getUsersSavedAreaPath() board-cards.html:867 23: checkForSavedAreaPath() board-cards.html:867 24: User does not have a saved area path. A 404 is expected when userAreaPath is requested board-cards.html:867 25: insertAreaPathSectionHeader() board-cards.html:867 26: displayPrintSizeOptions() board-cards.html:867 27: getCardSize() board-cards.html:867 28: displayFieldOptions() board-cards.html:867 29: getUserFields() board-cards.html:867 30: Contents of userFields is... board-cards.html:88 Array(2) board-cards.html:867 31: User has fields to display: 2 board-cards.html:867 32: userFields prior to entering for loop is: board-cards.html:157 Array(2) board-cards.html:867 33: addUpdateFieldsButton() board-cards.html:867 34: Trying to displayWorkItems() board-cards.html:867 35: displayWorkItems() board-cards.html:867 36: sheetCount is: 0 board-cards.html:867 37: iterationChunk is: [System.IterationPath] = '\Sprint3' board-cards.html:867 38: queryString is: SELECT [System.Id] FROM WorkItems WHERE [System.IterationPath] = '\Sprint3' board-cards.html:867 39: checkForSavedWorkItemTypes() board-cards.html:867 40: User does not have any saved work item types board-cards.html:867 41: User does not have a saved Area Path board-cards.html:867 42: getWorkItemIds() board-cards.html:867 43: getWorkItemIds has found: 889,890,891,892,897,898,899,901,1528,1529 board-cards.html:867 44: Passing workItemIds: 889,890,891,892,897,898,899,901,1528,1529 to getWorkItemDetails() board-cards.html:867 45: getWorkItemDetails() board-cards.html:867 46: Work Item Details: [object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object] board-cards.html:867 47: numberOfWorkItems is: 10 board-cards.html:867 48: selectedCardSize is: small board-cards.html:867 49: styleType is: user-story board-cards.html:867 50: className is: workItem user-story 889 0 small board-cards.html:867 51: No relations board-cards.html:867 52: styleType is: user-story board-cards.html:867 53: className is: workItem user-story 890 1 small board-cards.html:867 54: No relations board-cards.html:867 55: styleType is: user-story board-cards.html:867 56: className is: workItem user-story 891 2 small board-cards.html:867 57: No relations board-cards.html:867 58: styleType is: bug board-cards.html:867 59: className is: workItem bug 892 3 small board-cards.html:867 60: No relations board-cards.html:867 61: styleType is: user-story board-cards.html:867 62: className is: workItem user-story 897 4 small board-cards.html:867 63: styleType is: bug board-cards.html:867 64: className is: workItem bug 898 5 small board-cards.html:867 65: No relations board-cards.html:867 66: styleType is: bug board-cards.html:867 67: className is: workItem bug 899 6 small board-cards.html:867 68: No relations board-cards.html:867 69: styleType is: bug board-cards.html:867 70: className is: workItem bug 901 7 small board-cards.html:867 71: styleType is: bug board-cards.html:867 72: className is: workItem bug 1528 8 small board-cards.html:867 73: No relations board-cards.html:867 74: styleType is: bug board-cards.html:867 75: className is: workItem bug 1529 9 small board-cards.html:867 76: No relations board-cards.html:867 77: 0 parents fetched board-cards.html:867 78: appendCountOfWorkItems() board-cards.html:867 79: displayPrint() board-cards.html:867 80: displayMain() board-cards.html:867 81: removeLoader() board-cards.html:867 82: loaderExists board-cards.html:867 83: triggerPrint()

after looking to the code of the solution board-cards.html source I could see that code dataService.setValue('userAreaPath', linkId, {scopeType: 'User'}). is never waited to execute because reload is hit before and page does not wait for value to be set.

I would suggest adding extra then block and add location.reload(true); there, or update onclick funtion to async and add await for VSS.getService