Skip to content

[dashboard] Fix feedback when triggering prebuilds #5731

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from

Conversation

jankeromnes
Copy link
Contributor

@jankeromnes jankeromnes commented Sep 17, 2021

Description

Related Issue(s)

Fixes #5374

How to test

  1. Add a Project
  2. Trigger a Prebuild by clicking on Trigger Prebuild

Between the click and the moment a new Prebuild appears, there should be a visible clue that something is indeed actually happening behind the scenes (otherwise, users might think that the click didn't work).

Release Notes

NONE

/uncc

@roboquat
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

Approval requirements bypassed by manually added approval.

This pull-request has been approved by:

Associated issue: #5374

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

1 similar comment
@roboquat
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

Approval requirements bypassed by manually added approval.

This pull-request has been approved by:

Associated issue: #5374

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@gtsiolis gtsiolis added component: dashboard feature: prebuilds feature: teams and projects [DEPRECATED] Please, use feature: organizations or feature: projects labels instead. team: webapp Issue belongs to the WebApp team labels Sep 17, 2021
@jankeromnes jankeromnes force-pushed the jx/trigger-prebuild-feedback branch from 838f091 to 838e415 Compare September 17, 2021 13:55
@jankeromnes
Copy link
Contributor Author

jankeromnes commented Sep 17, 2021

Thanks for the new spinner @gtsiolis! Happy that it works equally well on light and dark, thus we can remove the extra theme-switching logic 😌

LIGHT DARK
Screenshot 2021-09-17 at 16 07 38 Screenshot 2021-09-17 at 16 07 58
Screenshot 2021-09-17 at 16 08 31 Screenshot 2021-09-17 at 16 09 05

(Note: This is a drive-by fix, not really related to the Trigger Prebuild button 😇)

@jankeromnes jankeromnes force-pushed the jx/trigger-prebuild-feedback branch from 838e415 to 3456d2c Compare September 21, 2021 06:40
@roboquat roboquat added size/M and removed size/S labels Sep 21, 2021
@jankeromnes
Copy link
Contributor Author

jankeromnes commented Sep 21, 2021

Okay, calling this ready for review (even if this could still be improved).

Current state of this PR

When you click on Trigger Prebuild in the Prebuilds page, the button gets disabled and receives a spinner:

NOT TRIGGERED TRIGGERED
Screenshot 2021-09-21 at 12 09 38 Screenshot 2021-09-21 at 12 10 28

Then, when any one of these things happens (first one wins), the button gets re-enabled and removes the spinner:
a. A new prebuild is successfully triggered
b. There was already a prebuild for the latest commit on the default branch (so no new prebuild was triggered)
c. An error happens while triggering the prebuild
d. The button remained spinning for 30 seconds but nothing happened (UI timeout)

Caveats:

  • For b. there no visible feedback that a prebuild already existed. We could either add a visible feedback (e.g. highlight the latest prebuild), or change the server behavior (forcefully trigger a new prebuild even if a successful one already exists), see Rerunning Prebuild does nothing #5771 and relevant Slack thread (internal)
  • For c. and d. there is no visible feedback that something went wrong (but the error is logged to the Console). What should the UI do in this case? Show an window.alert() message? Or a toast notification?

@jankeromnes jankeromnes marked this pull request as ready for review September 21, 2021 10:20
getGitpodService().server.triggerPrebuild(project.id, branchName),
new Promise((_, reject) => setTimeout(() => reject(new Error('Timed out while waiting for new prebuild')), 30000)),
]) as StartPrebuildResult;
console.log('Successfully triggerred!', result);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note to self: Maybe I should remove this debug log.

@svenefftinge
Copy link
Member

The spinner also starts when I "rerun prebuild" on one of the branches. I think it would be better if the indicator is set on the actual entry in the list. I.e. signal something before "Running" is shown.
Also not sure if we discussed this already, but the context-free, global "Trigger Prebuild" button leaves me wondering on what branch the prebuild will run. I'd vote for removing that button (cc @gtsiolis)

@jankeromnes
Copy link
Contributor Author

jankeromnes commented Sep 21, 2021

Good points, thanks @svenefftinge!

  • For Trigger Prebuild, we could also add a "fantom Prebuild" entry (e.g. an empty/skeleton list item with some pending animation)
  • If we make Rerun Prebuild actually replace an older Prebuild, we could optimistically replace the Prebuild state just in the UI (e.g. "cosmetically" change "Ready" or "Failed" to "Pending" before even hearing back from the server, then actually adjust the UI when the server responds -- the Configurator does something similar to immediately respond to Run Prebuild clicks)

@gtsiolis
Copy link
Contributor

gtsiolis commented Sep 21, 2021

Looking at this now! 👀

Copy link
Contributor

@gtsiolis gtsiolis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @jankeromnes! Left some comments below! 💭

@@ -150,7 +165,7 @@ export default function () {
<div className="py-3 pl-3">
<DropDown prefix="Prebuild Status: " contextMenuWidth="w-32" entries={statusFilterEntries()} />
</div>
<button disabled={!project} onClick={() => triggerPrebuild(null)} className="ml-2">Trigger Prebuild</button>
<button disabled={!project || isPrebuildPending} onClick={() => triggerPrebuild(null)} className="ml-2 flex items-center space-x-2"><span>Trigger Prebuild</span>{isPrebuildPending && <img className="h-4 w-4 animate-spin filter brightness-150" src={Spinner} />}</button>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: What do you think of placing the spinner on the left of the label? Spinner placement is a minor issue and we could go with any approach but I remember discussing something similar with the GitLab team in the past in https://gitlab.com/gitlab-org/gitlab/-/merge_requests/26035#note_297307469. Cross-posting below the relevant comment for visibility within our team:

... regarding spinner placement, although there is not an strict established pattern or design guideline about this, it's mostly related to a) usability (screen reading) and b) LTR (left-to-right) v. RTL (right-to-left) languages where user interfaces should be mirrored to ensure content is easy to understand.

Since we currently only support LTR languages, there's no need to also add a component variant with the spinner on the right side. Once and if there is support for RTL languages we should consider adding a component variant with the spinner placed on the right.

BEFORE AFTER
spinner-before spinner-after

@@ -150,7 +165,7 @@ export default function () {
<div className="py-3 pl-3">
<DropDown prefix="Prebuild Status: " contextMenuWidth="w-32" entries={statusFilterEntries()} />
</div>
<button disabled={!project} onClick={() => triggerPrebuild(null)} className="ml-2">Trigger Prebuild</button>
<button disabled={!project || isPrebuildPending} onClick={() => triggerPrebuild(null)} className="ml-2 flex items-center space-x-2"><span>Trigger Prebuild</span>{isPrebuildPending && <img className="h-4 w-4 animate-spin filter brightness-150" src={Spinner} />}</button>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: Changing the state of this button whenever someone triggers an arbitrary prebuild form the prebuilds list, as mentioned in #5731 (comment), can be confusing to the user. I'd suggest to keep the state of the button intact instead.

@@ -244,7 +259,7 @@ export function PrebuildInstanceStatus(props: { prebuildInstance?: WorkspaceInst
<span>PENDING</span>
</div>;
details = <div className="flex space-x-1 items-center text-gray-400">
<img className="h-4 w-4 animate-spin" src={props.isDark ? SpinnerDark : Spinner} />
<img className="h-4 w-4 animate-spin" src={Spinner} />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thought: Friendly reminder to come back to this if we ever adjust the spinner color used for light and dark themes. 🌔

@@ -150,7 +165,7 @@ export default function () {
<div className="py-3 pl-3">
<DropDown prefix="Prebuild Status: " contextMenuWidth="w-32" entries={statusFilterEntries()} />
</div>
<button disabled={!project} onClick={() => triggerPrebuild(null)} className="ml-2">Trigger Prebuild</button>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: Regarding the removal of the global Trigger Prebuild button mentioned in #5731 (comment) (Cc @svenefftinge), the linked issue (#5374) in the PR description contains some more context behind this:

From #5374 (comment):

In terms of UX, this button could trigger a modal to confirm prebuild on the default branch. Possible improvements could include selecting a different branch, passing an env var for a prebuild, etc.

From #5374 (comment):

We could skip this and remove the button for this iteration if you think it’s redundant. The idea behind this is that for projects that the latest prebuild failed and you’d like to retry or all the prebuilds have been removed after two weeks, someone could trigger a prebuild from the dashboard.

However, if we want to ship this sooner and we have the bandwidth to add a fix here, showing a spinner + disabling the button on click as you mentioned in #5374 (comment) sounds optimal. 🎯

I refrained from suggesting this earlier as there are also a few more places where a loading button component variant could be used for consistency, like the git integration modal, but we can progressively add it there later. ➿

🍊 🍊 🍊 🍊

Adding below some early design drafts how the confirmation modal could look like when triggering a prebuild from the global trigger prebuild button. Let me know if this does not look interesting or useful here. Using a modal here could allow us in the future to provide a way to insert one-time variables for a prebuild which, etc.

Run Prebuild Run Prebuild with Branch Selection
run-1 run-2

🍋 🍋 🍋 🍋

Regarding the replacement of an existing prebuild upon triggering a new prebuild mentioned in #5731 (comment) (Cc @jankeromnes), I'd think that ideally we'd never replace a prebuild but cancel the previous one and creating a new one. Maybe this is currently not technically possible or something we're interested in? 💭

@jankeromnes
Copy link
Contributor Author

jankeromnes commented Sep 21, 2021

Thanks again for the reviews! 🙏

After several discussions, let's close this for now, and instead focus on #5791 😇

(I'll save the small Spinner-fix commit and add it to another PR)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved component: dashboard feature: prebuilds feature: teams and projects [DEPRECATED] Please, use feature: organizations or feature: projects labels instead. release-note-none size/M team: webapp Issue belongs to the WebApp team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

No feedback when triggering prebuilds
4 participants