Commit Graph

10 Commits

Author SHA1 Message Date
Felix Edel 7e131757a5
UI: Avoid empty state being shown before data is fetched
When opening the builds page there is a short moment when an empty state
pattern is shown before the data is actually fetched. This happens for
the build itself ("Build not found") and for the tab contents like logs,
task summary and console information ("This build does not provide any
..."). The same applies for the buildset page on initial load.

Interestingly, this moment is extremely short in chrome (so you can't
even see it without actually pausing the state transitions with the
redux developer tools), but in firefox it's much longer so you usually
see it when opening the page.

To avoid this from happen, this change does two things.
1. It splits the build, manifest, output, hosts and errorIds into
   separate fields of the state. This allows us to fetch as much in
   parallel as possible without always waiting for the actual build to
   be present. To simplify the usage in the Build page react component,
   we use the mapStateToProps() function to combine all those values
   into a single build object.

2. Unfortunately, this is not enough as some information like the logs
   rely on the manifest entries and the build.log_url to be present. To
   still distinguish between a "unknown" value (e.g. the build or
   manifest wasn't fetched yet or is currently fetching but we don't
   know if it will be found) and a "non-existing" value (e.g. the build
   or manifest could not be found after fetching), we use the difference
   between undefined and null. In JavaScript tongue, every variable is
   undefined that hasn't assigned a value yet (though we could also
   assign undefined explicitly). The null value on the other hand is
   used to say "I define this variable and explicitly set it to an empty
   value".

   Thus, we explictly set every entity we didn't found to null in the
   reducer functions and check for (undefined || isFetching) instead to
   show the spinner animation. This way, the page always starts with the
   fetching animation and only switches to showing the result or an
   empty state depending on if the entity could be found or not.

Change-Id: I800dfe71128bb00638a51cea0d9be9be623bd923
2020-11-04 09:19:07 +01:00
Felix Edel 97810c00b1
Add redux integration tests for build actions
This also moves the build "slice" of our redux state into an
initialState variable that allow using the same state for testing.

We should move the others slices to the initialState later on as well.

Change-Id: Id1a476a3b82df530a859732f8dab9ef7c11939e5
2020-10-14 08:20:57 +02:00
Felix Edel 67b341af10
Avoid state mutations in build reducers
When updating the redux state one should not directly touch the state
but rather create a copy of the object first, so redux can efficiently
check if anything has changed and the UI components should be updated.

This avoids mutating the state.builds property directly and uses the
spread operators instead to copy the builds dictionary and replace (or
enhance) the data of the build in question.

Since the build reducers are doing rather simple state changes, I also
decided to drop the usage of the immutability-helper library here and
use plain JavaScript instead as I find this much more readable and
straightforward.

Change-Id: I88c68fed99b21bc9a3682e952499fb4fdf74e2d0
2020-10-14 08:20:56 +02:00
Zuul daf21fc0b1 Merge "web: add buildset page" 2019-08-09 12:15:46 +00:00
Tristan Cacqueray 5049023d41 web: add buildset page
This change adds a new page to display a single buildset with its
associated builds.

Change-Id: I664d0db06456c906cfabb6a2b1da613d9aebf419
2019-08-08 22:20:39 +00:00
Tristan Cacqueray e72cb47515 web: refactor the errorsIds into the build action
This change refactors the Console component to avoid processing
build data in the rendering container.

Change-Id: Ice895b3e4f34a0c3c3369269e3e398de7764e7a3
2019-08-08 15:05:18 -07:00
James E. Blair c035bc69ba Render console in js
This uses ListView to render the build console log in an
interactive manner.

Change-Id: Ib81a23cd60b515b1448f48c6c359d8f828fa4ec7
2019-08-07 08:50:36 -07:00
James E. Blair 8fdc387c83 Add log browsing to build page
This looks for a zuul_manifest artifact, and if it is present,
it fetches it and shows a tree view of logs.  Text logs are
displayed in-app with some basic line anchoring.

Part of the implementation of
https://zuul-ci.org/docs/zuul/developer/specs/logs.html

es6 added to .eslint to allow use of Promise.

Change-Id: Ib04d013b4118005ba66a91d2bec0b0c429d12863
2019-07-24 09:25:13 -07:00
Tristan Cacqueray 2f8a1be7c9 web: add errors from the job-output to the build page
This change updates the build page to fetch the job-output.json file
and display the failed tasks. Logserver needs to enables CORS
header for the zuul-web service.

Change-Id: Ied9d1bb6489f608bc5402a98c8ae3a24b37b91e2
2018-12-14 08:33:48 +00:00
Tristan Cacqueray 342c29c994 web: refactor build page to use a reducer
This change updates the build page component to dispatch reducer
action instead of direct axios call. This enables using the generic
error reducers as well as keeping the builds in the store to avoid
repeated query.

Change-Id: I705514e5fa32ec2d81a5b0ca9c5ebb7d8ac6ac2a
2018-12-14 08:33:48 +00:00