Repository navigation
Keep the rows of the submit dialog in its view model - #183
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
WorklogPreviewItemwas the last view model type passing through an orchestrator.WorklogSubmissionOrchestratorbuilt the rows of the dialog, wrote errors into them, inverted their selection and even formatted the total. The submit and retry paths also each kept their own copy of the row handling.What changes
LoadPreviewAsyncreturns the days from the service, andSubmitAsynctakesWorklogDtoand returns aSubmissionOutcome. Retry is the same call with fewer worklogs, soRetryFailedAsyncgoes, along withResetItems,InvertSelection,SelectAll,FormatDurationandPreviewLoadResult.SubmissionOutcomenow says what the provider answered:Delivered, the status message and the errors by position. Whether any row has failed is for the view model to work out.SubmitWorklogViewModelbuilds the rows and shows the results on them, with oneSubmitRowsAsyncfor both Submit and Retry.WorklogPreviewItemgetsFromWorklog,DateHeader,ToWorklogandClearError.Orchestrators_DoNotUseViewModelsnow also forbids theWorkTracker.Avalonia.ViewModelsnamespace, which this makes possible.The rules stay the same:
One difference that the dialog can't reach: Retry with nothing to send used to report success with an empty message, and it now sends nothing and leaves the status alone. The button is disabled in that state.
Testing
SubmitWorklogViewModelTests, where they go through the commands. There are 8 fewer tests overall, because some asserted things that no longer exist, such as helpers skipping date headers, and others were covered twice.0m. I sent nothing.