Make artifacts dropdown refetch list on show at 'Pipelines'
What does this MR do and why?
Why
At 'Pipelines' artifacts dropdown content is loaded only once regardless live-update. Thus at least two use cases are negatively affected:
- When live-update shifts pipelines_list, view elements are reused, so some dropdown may list other pipeline's artifacts after having been shown once;
- During a long-time multi-artifact pipeline, one can't poll a dropdown for currently available artifacts.
Page refresh solves both cases, but is inconsistent with live-update.
What
This MR makes dropdown refetch its list on each show.
Changes introduced by this branch:
-
@show.once
is changed to@show
to makefetchArtifacts
called every time on show; - The old list in
fetchArtifacts
is preserved to be presented in case of a request failure; - A watcher for
pipelineId
: the pipeline bound to the row may change between the last successful fetch and the new failed one, so we set the old list if it hasn't and an empty list otherwise; - A warning about old list is appended as a dropdown footer in case of a failure (+new string at 'gitlab.pot');
- The current list in
fetchArtifacts
is cleared before updated to prevent the old content to be shown in dropdown while loading; -
hasError
is cleared infetchArtifacts
before the request to exclude warning/error messages while loading; - New specs added for the following cases: a refetch in progress, a successful refetch with a new list, a failed refetch, a change of pipeline ID.
Screenshots or screen recordings
Videos
Screenshots
How to set up and validate locally
Steps to reproduce the bug:
- Create a project, configure CI to generate artifacts (e.g. RoR template project fits perfectly);
- In a browser open a new tab, visit '<project>/Build/Pipelines' page;
- Click 'Run pipeline', then 'Run pipeline';
- Wait for the pipeline to finish;
- Visit 'Pipelines' page again;
- Click the 'Download artifacts' button, note that the dropdown progress ring spinned a bit;
- Once artifacts are listed, remember their URL-s (job numbers will be sufficient);
- Leave the tab, open another tab, visit 'Pipelines' there;
- Click 'Run pipeline', then 'Run pipeline';
- Switch to the first tab;
- Wait until live-update inserts the new pipeline to the top of the list;
- Click the 'Download artifacts' button of the new pipeline, note that the progress ring doesn't appear anymore;
- Check new artifacts and their URL-s - artifacts are listed before corresponding jobs are finished, and job numbers are the same, as for an older pipeline.
If you see the spinner every time in 12 and see correct job numbers linked in 13, then you may consider the bug fixed.
Actually, the bug is easily reproduced even at GitLab.org's 'Pipelines' page: find a pipeline with some artifacts built, open/close its dropdown, dont't close the tab, but leave it be. Come back a bit later and check out the same row - it'll still show the same artifacts, despite all pipelines you've searched through most likely have gone.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #367955