Commit Graph

39 Commits

Author SHA1 Message Date
James E. Blair a9688d6185 Use tenant-status endpoint to show the bell
We currently fetch all of the config errors in order to decide whether or
not to show the bell icon in the web ui (which indicates that there are
errors).  We recently added a tenant-status endpoint which returns a simple
error count instead of the entire data structure.  Use that to decide
whether to show the bell instead.

This builds on the previous change that fetches the config errors on-demand
rather than storing them in the redux store.  With that change and this
combined, we no longer need to store the errors in redux.  Instead we will
store the error count in redux so we only have to fetch it once when
switching tenants.

Change-Id: I3dfd911af9ba55dd55ca3649ee5ecf6edaa3581a
2023-11-28 09:47:14 -08:00
Jeremy Stanley 29abf0ff0c Use moment-timezone for moment's tz method
After updating to the latest version of moment, many pages in the
Zuul web dashboard are observed to raise a TypeError about
"ne.utc(...).tz is not a function" which seems to correspond to the
recent moment library update in change
Id9d0cdec6d6a39542e8248c8690d8a94018296b5. Apparently, use of tz
needs explicit importing of moment from the separate moment-timezone
library, so the prior working state of these scripts likely had
something to do with global state and import order.

The moment-timezone library does not provide a duration method, so
use the plain moment library for that.

Change-Id: Ib75eb65cc29261f010df8c9ab8c15d6491205079
Co-Authored-By: James E. Blair <jim@acmegating.com>
2023-11-27 07:17:23 -08:00
James E. Blair b63fc7bed6 Web: remove config error drawer
This changes the bell icon at the top to link directly to the
config-errors page.

Currently, the bell icon opens a notification drawer which shows
one rendition of a list of config errors, and if the user clicks
on any error, it navigates to the config-errors page which shows
another rendition.

Rather than having two ways of viewing config errors, let's just
have one.

Change-Id: I630fb2311ec5fa47c8a0dbf8a838c4e0453f32e1
2023-05-31 17:37:59 -07:00
Matthieu Huin d3f5b9890e GUI: Add tenant dropdown to top menu
On a non whitelabeled setup, allow a user to jump from one tenant to
another without having to go back to the tenants page.
On a whitelabeled setup, make the tenant item non-clickable (the click
doesn't do anything anyway).

Change-Id: I94d27445c65ed5c3f8d02fae9d47d426528d2332
2023-02-02 15:41:18 +01:00
James E. Blair 9d2e1339ff Support authz for read-only web access
This updates the web UI to support the requirement for authn/z
for read-only access.

If authz is required for read access, we will automatically redirect.
If we return and still aren't authorized, we will display an
"Authorization required" page (rather than continuing and popping up
API error notifications).

The API methods are updated to send an authorization token whenever
one is present.

Change-Id: I31c13c943d05819b4122fcbcf2eaf41515c5b1d9
2022-10-25 20:22:42 -07:00
James E. Blair c2f2891bd3 Show login button any time auth is available
We currently only show the login button when in the context of a
tenant.  Now that we have an auth context for the "root" level of
a multi-tenant zuul, show the login button there as well.

Change-Id: Ic1d39951a0cf481c6fac4700ba9bb9338478cd7c
2022-10-25 20:19:42 -07:00
James E. Blair 90d8d8fc4b Web: always set redux auth and wait for it
Currently we only set the auth redux property within the tenant
scope.  But we're going to extend authentication to outside the
tenant scope (to optionally restrict access to the tenant list).
To accommodate that, we will always update the auth property in
redux any time our tenant changes (including when it changes to
undefined), and we will wait until we have finished auth configuration
before rendering any pages in the app.

This is effectively a no-op change from the end-user point of view,
except that we may wait just a bit longer (for the /api/tenant/info
endpoint to return) before showing an initial page for a tenant.

Change-Id: I18e74fa205f75a7b020bf23c8652226e5170d88b
2022-10-25 20:19:41 -07:00
James E. Blair 25c948d2a0 Linger on auth_callback page until login is complete
Verifying the auth token and obtaining user metadata involves some
async HTTP requests in the background.  If we remove the auth callback
information from the window location too soon, then the UserManager
will not complete the login process.  This currently generally works
because this process tends to complete before the /info and /tenant/info
calls to Zuul.  However, future changes to support a read-only
authentication requirement will need to alter this sequence.

This approach is more robust and easier to follow.  Essentially the
sequence is:
* Return from IdP to /auth_callback
* If /auth_callback is in our location, short-circuit normal rendering
  and render only the AuthCallbackPage
* When background processing is complete, onSignIn will be called and
  we will set the user.redirect property in redux.
* AuthCallbackPage has an effect callback on user.redirect which will
  cause it to perform the redirect away from auth_callback once
  signin is complete.

This process leaves the AuthCallbackPage on the screen a little longer,
so this change updates it to use the newer EmptyPage and Spinner elements
that we have been using elsewhere, so if users see it, it appears more
intentional.

Change-Id: I206c020626c7fd73e58efc29dd50376203679721
2022-10-25 20:19:40 -07:00
James E. Blair eb330c4605 Hide components in whitelabel tenants
There is no /api/tenant/$tenant/components URL, so hide the
"Components" link in the page header when the web ui is accessing
a whitelabel tenant.

Change-Id: I707bf03489016264ce6a37b4eb005e9680de90a2
2022-10-25 20:19:38 -07:00
Ian Wienand 2c9610de2d
web: remove unused class from brand tag
Change Ib1b6be1b554b30ce7a7d2aacae476cefbed63782 modified the CSS so
that this inherits via <Page>; this explicit class isn't needed any
more.

Change-Id: I36dd2869c4b95eea57d3cd8024311606429bf025
2022-09-14 07:58:52 +10:00
Ian Wienand 1470360e7c
web: move navbar to tertiary
This was suggested and written by Joachim Schuler in [1].  It moves
the top navbar as a "tertiary" option to the page header.  This bar is
always visible and doesn't roll-up into the "top" area.  This means we
can drop the more complex grid layout that is trying to keep this bar
always visible for some much more simple styling.

As this moves the navbar location the link matching is updated to find
new elements.

[1] https://github.com/patternfly/patternfly-react/issues/7960#issuecomment-1244017295

Change-Id: I4a61a1e246ca4fe0d96f630a06be7f0264782723
2022-09-13 11:24:31 +10:00
Ian Wienand 1fb585b479
web: fix logo CSS
This was suggsted and written by Joachim Schuler in [1].  It is
probably a bug that due to asynchronous loading of CSS rules our
logo-height rule here sometimes comes and goes.  However, putting this
in a zuul-page class both seems to fix this (I always see the logo
now) and is just generally a nicer way to organise things.

[1] https://github.com/patternfly/patternfly-react/issues/7960#issuecomment-1244017295

Change-Id: Ib1b6be1b554b30ce7a7d2aacae476cefbed63782
2022-09-13 10:14:15 +10:00
Matthieu Huin c82619174c web UI: allow a privileged user to re-enqueue a change
Add a "re-enqueue" action command on a Buildset page, displayed only
if the currently logged in user is an admin on the tenant. By
clicking this command, the user can re-enqueue the change with
the same parameters as the buildset.

Redux: turned the API error notifications into a more generic
notification system, that can now include success notifications.

Change-Id: I05b6b3deb912b121df8de207944d9ec26e7c92d1
2021-11-18 16:40:47 +00:00
Matthieu Huin b13ff51dda web UI: user login with OpenID Connect
Under the hood, this uses AuthProvider as supplied by oidc-react.
Most of the theory is explained in the comment in ZuulAuthProvider.jsx

The benefit of doing this is that we allow the AuthProvider and
userManager to handle the callback logic, so we don't need to
handle the callback logic ourselves.  A callback page is still required
though in order to deal with the parameters passed in a successful
redirection from the Identity Provider.

The challenge in using these classes as-is is that our authority
endpoints (eg, the IDP itself) may change from one tenant to
the next; these classes aren't set up for that.  So we need to be
careful about how and when we change those authority URLs.

In terms of functionalities: if the default realm's authentication driver
is set to "OpenIDConnect", display a "Sign in" button. If the the user
is logged in, redirect to the last page visited prior to logging in;
fetch user authorizations and add them to the redux store; display the
user's preferred username in the upper right corner. Clicking on the
user icon in the right corner displays a modal with user information
such as the user's zuul-client configuration, and a sign out button.

Clicking on the sign out button removes user information from the
store (note that it does not log the user out from the Identity Provider).

Add some basic documentation explaining how to configure Zuul with
Google's authentication, and with a Keycloak server.

(This squashes https://review.opendev.org/c/zuul/zuul/+/816208 into
https://review.opendev.org/c/zuul/zuul/+/734082 )

Co-authored-by: James E. Blair <jim@acmegating.com>

Change-Id: I31e71f2795f3f7c4253d0d5b8ed309bfd7d4f98e
2021-11-18 16:39:17 +01:00
Felix Edel 7c6af60a5d UI: Add components page
This adds a new page /components that lists all components which are
retieved from the /components API endpoint.

For the look and feel this page has a similar design like the builds and
buildsets pages.

Change-Id: I38b3a9b456b71e49f02712b63417a905a0aa1397
2021-10-26 14:50:08 -07:00
Sorin Sbarnea ebad14f1f9 Consolidate js/jsx indentation
Previously indentation was not checked at all and in order to avoid
reviewers time with style checks, we can enforce it with eslint.

Current js/jsx changes were made by: yarn lint-fix

Note this this change can easily become outdated so we need to
coordinate and merge it quickly as each rebase would loose previous
votes.

Change-Id: I85883fc8db924ad4ce9acad5acdd42aed7e4d0e4
2020-11-20 09:39:31 +00:00
Ian Wienand 91d56f87cf
web: Fix error modal contents
We seem to be putting the actual error message as the header and the
title (the project + error file) as the body.  Swap them around.

The error is preformatted text with embedded newlines.  Wrap it in a
<pre> with pre-wrap so it displays correctly.

Change-Id: I9fafafe38a2b24ac8558f97000225f7b53fab9bf
2020-09-14 14:50:16 +02:00
Felix Edel c3e77b6d47
Use Modal to show config errors and fix scrolling
Since we introduced PF4 together with the Drawer component to show the
config errors, we are not able to scroll the page by using the keyboard.
So far, no workaround really did the trick and every one came with
another drawback in different areas.

So we decided to ditch the Drawer component and use a Modal as
replacement. This should still serve the use case as we have "something
popping up when clicking on the bell icon", but this something doesn't
break the layout and/or the scrolling behaviour.

Additionally this change removes the "height: 100%" CSS rule on the root
element. In combination with the removed drawer this should restore the
scrolling behaviour via keyboard without introducing any further
drawbacks like wrong tabbing or focus behaviour.

For additional background information on this topic, please refer to the
changes [1], [2] and [3]. There is also a PF4 issue on Github available
[4].

[1] https://review.opendev.org/#/c/743239/
[2] https://review.opendev.org/#/c/743917/
[3] https://review.opendev.org/#/c/742759/
[4] https://github.com/patternfly/patternfly-react/issues/4624

Change-Id: I45df9cabc96d2d7fb4ddebdf1c72d0dd8a3adfd2
2020-09-14 14:50:12 +02:00
Sorin Sbarnea 1ecbe58474 Add user preferences dialog
In order to avoid cluttering Zuul UI with user preferences in various
places, we introduce a simple config dialog.

This moves "auto reload" option to the preferences panel.

Change-Id: I7201d9e021c99f8e5a936dc98efe3c9d563fbcbc
Co-Authored-By: James E. Blair <jeblair@redhat.com>
2020-07-30 13:51:09 +01:00
Zuul ee7e6ea820 Merge "Keep active nav links highlighted while browsing the page" 2020-07-21 17:39:56 +00:00
Zuul e83585a459 Merge "Fix brand logo link for dashboards deployed on a sub-url" 2020-07-21 15:28:26 +00:00
Felix Edel 8fec6cc703
Consolidate summary, logs and console on a single build page
So far, these three tabs were split up in three different Pages to allow
each page being reachable via a different URL (rather than a #<tab>
anchor which is usually used for tabs). This makes changing the builds
page much more difficult as we have keep all three files in sync.

React-router allows a Route to pass custom props to the component that
is rendered when the Route matches a certain URL. We can use this
functionality to provide the active tab via a property for each route
using to the BuildPage component.

This change keeps the way the tabs are working, but maps all three URLs
to a single component with different props to show the activate tab.

Change-Id: Icb5729d759bafdfc396ea3642c8c6c71b3461d00
2020-07-15 09:06:04 +02:00
Felix Edel 3ef75401d5
Keep active nav links highlighted while browsing the page
So far, the highlighting of the active navigation item vanished when
clicking somewhere on the page. AFAIK this behaviour was unchanged with
PF4.

Fix this behaviour by using a NavLink component with the correct PF4 CSS
class for an active nav item.

The nav items will be highlighted as long as the user doesn't switch to
a sub page (e.g. /builds -> /build/12345). Once switched, the
highlighting will again vanish as the path doesn't match the route's
path rule anylonger (/build/12345 != /builds/*).

Change-Id: Id17de4086ee567703ba6c8cae124b131d3ef072c
2020-07-14 11:08:48 +02:00
Felix Edel 4c99dd353f
Fix brand logo link for dashboards deployed on a sub-url
When the zuul dashboard is deployed on a sub-url, the link on the Zuul
logo did not take the basepath into account.

Fix this by using a Link component instead of a simple <a href...> as
the <a> tag is not aware of any react-router configuration.

Change-Id: Id856d75e88b7731c8326b84619ceaf51a3275426
2020-07-14 10:15:18 +02:00
Zuul 7e88626bed Merge "PF4: Update "fetching info ..." and refresh animation" 2020-07-13 17:03:17 +00:00
Felix Edel 497a7042ad
Fix property validation for isKebabDropdownOpen in App.jsx
Change-Id: If454f98212949f2ac5a3873b98411ce5c0c71ad6
2020-07-13 10:51:48 +02:00
Felix Edel ed9d0446d5
PF4: Update "fetching info ..." and refresh animation
Currently the "refresh" animations look quite different depending on the
page and the type of event (refresh button, initial page load, ...).

This tries to make a start by updating the "Fetching info ..." animation
(shown on initial page load) with Patternfly's "empty state" pattern [1]
in combination with an animated spinner.

For "Refreshable" pages, a similar animation is used in the upper right
corner (like before) but with an updated spinner and icon. By using a
dedicated React component rather than a base class, the "refresh" button
can be more nicely integrated into the layout of the page/container and
it doesn't look "out of scope" for the refreshable component.

For the API page I've removed the refresh completely since it wasn't
implemented at all.

[1] https://www.patternfly.org/v4/documentation/react/components/emptystate

Change-Id: I2274c212f14aece27ff49bfc7900d9b1a0fd01d0
2020-07-10 15:18:04 +02:00
Felix Edel 65653bcd01
Introduce Patternfly 4
Since Patternfly 4 (PF4) is a complete rewrite of the framework that
doesn't require bootstrap and comes with a new npm package, it's
possible to include both side-by-side in a project.

This change includes the necessary PF4 packages and updates the header,
navbar, drawer (shows the config errors) and global page layout with PF4
components. Once this is done, we should be able to update the other
components step by step to PF4.

Points to keep in mind for the migration phase:
  1. Some Patternfly 3 CSS rules are overridden by Patternfly 4
     wildcards, mostly (re)setting the padding and margin of various
     elements to 0.

     To fix this unwanted behaviour, there is a pf4-migration.css file
     included were we can keep track on those rules and ensure that the
     old padding and margin values are re-applied after Patternfly 4 is
     imported.

Change-Id: I77b81fa0f97fe718207ba5a506cee300371c693b
2020-07-07 11:16:48 +02:00
Andy Ladjadj 86eba8b05d Add new timezone selector in web interface
- the default value keep UTC
 - the timezone is saved in cookie in zuul_timezone_string
 - the render format is YYYY-MM-DD HH:mm:ss

Change-Id: Ib4ac2af4194ac2722c5574577661f4ddda8cc398
2020-05-20 16:54:54 -05:00
Tristan Cacqueray 85616c4c09 web: add OpenAPI documentation
This change adds a swagger description of the REST API. The description is
rendered in the sphinx user documentations and in the web interface.

Change-Id: I753524f40a09874dab5952f14ab17025525bbab9
2019-06-12 22:35:13 +02:00
Tristan Cacqueray 8690de59c6 web: add ErrorBoundary
This change adds an ErrorBoundary container for the page content to
display an error message instead of a blank page when a rendering
error occurs.

Change-Id: Ifb41e3c67fc89be7f9264bfa4a23b3ba734c9cec
2019-03-25 01:17:26 +00:00
Tristan Cacqueray f312f68ec6 web: add error reducer and info toast notification
This change adds a new error reducer to manage error from API calls.
The info actions retries failed info request after 5 seconds.

Change-Id: Ieb2b66a2847650788d9bf68080ab208855941f24
2018-12-02 05:56:38 +00:00
Tristan Cacqueray 17144c2a46 web: refactor info and tenant reducers action
This change adds info fetch state action type and simplifies the main App
by using the new info attributes.

Change-Id: I2cfd3f6ae605051e11f58272e62925d8f97e4ac9
2018-12-02 05:43:25 +00:00
Tristan Cacqueray 76867ca14a web: break the reducers module into logical units
This change applies best practices to split the current reducers module
in logical unit. Each reducer and its actions are moved into different
modules to ease further refactor and follow-up tests.

Change-Id: I75cc41ca3d31a61046868aafbc84505de661a99d
2018-12-02 01:05:02 +00:00
Tristan Cacqueray 35734e4d3c web: add config-errors notifications drawer
This change adds a Notification drawer to display the config errors and
a dedicated config-errors web interface.

Change-Id: I5cfc608219e26848a20f14e6c99bdb166ac67121
2018-10-11 03:02:30 +00:00
Tristan Cacqueray b5d574a10a web: fix hamburger menu collapse
This change fixes the hambuger menu when the dashboard is rendered on
a small screen.

Change-Id: I02f004a02c83c7a83698d96d0bc503ac5ba9a4da
2018-10-10 03:47:02 +00:00
Tristan Cacqueray 68d1189871
Revert "Revert "web: rewrite interface in react""
This reverts commit 3dba813c64.

Change-Id: I233797a9b4e3485491c49675da2c2efbdba59449
2018-10-06 10:42:31 -05:00
James E. Blair 3dba813c64 Revert "web: rewrite interface in react"
Revert "Fix publish-openstack-javascript-content"

This reverts commit ca199eb9db.
This reverts commit 1082faae95.

This appears to remove the tarball publishing system that we rely on.

Change-Id: Id746fb826dfc01b157c5b772adc1d2991ddcd93a
2018-09-29 11:51:43 -07:00
Tristan Cacqueray 1082faae95 web: rewrite interface in react
This change rewrites the web interface using React:
http://lists.zuul-ci.org/pipermail/zuul-discuss/2018-August/000528.html

Depends-On: https://review.openstack.org/591964
Change-Id: Ic6c33102ac3da69ebd0b8e9c6c8b431d51f3cfd4
Co-Authored-By: Monty Taylor <mordred@inaugust.com>
Co-Authored-By: James E. Blair <jeblair@redhat.com>
2018-09-27 02:14:46 +00:00