[TAV-375] Fix view race condition for cancelled runs.

When cancelling a run the views were getting confused because the run was
instantly marked as cancelled. This meant that the views would stop refreshing
even though some work was still being done, such as log retrieval, and leave
them in a paused state.

This fix marks the run for cancelling but only actually sets the state as
cancelled when it really is.

Tests are included to stop the other race conditions associated with this
process from creeping back in.
[TAV-376] Fix final view refresh when run has no outputs.

If a run has no outputs then the refresh wasn't being done..