Skip to content
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

Use card view for remote management #403

Merged
merged 1 commit into from
Nov 29, 2023

Conversation

tomasmatus
Copy link
Member

@tomasmatus tomasmatus commented Aug 8, 2023

Follows up on #339

Old design:

image

New:

image

Pixel test changes: https://cockpit-logs.us-east-1.linodeobjects.com/pull-403-20231124-162305-47d51597-fedora-coreos/log.html


OSTree: Redesign with new features: status, clean up, reset, and pin

The OSTree page for software updates has been redesigned and includes several new features.

Update status is now listed in the "Status" card, and details about the current OSTree repository and branch are visible in the "OSTree source" card:

image

Unused deployments and package cache can be removed in using the "clean up" action.
image

A new "Reset" feature has been added, which can remove layered and overriden packages.

reset modal dialog

Deployments can be pinned to persist even when new deployments trigger an auto-cleanup and unpinned.

screenshot showing a pinned deployment

@tomasmatus
Copy link
Member Author

tomasmatus commented Aug 8, 2023

A few things to discuss:

  1. I changed branches select to a dropdown menu, some repositories have too many branches available and radio buttons weren't ideal option.
    ostree_rebase_modal
    for example here's fedora repo:
    ostree_too_many_branches

  2. For now I kept the option to add another gpg key in edit modal -- I am not sure how required this is and if it's something we should keep/drop

  3. When remote refs not available error is shown current repository has no branches. In this case I followed old design but I was wondering if there's something smarter we should do instead of displaying error in a dropdown, such as hide the option to select branch but that might be too confusing.
    ostree_branch_remote_refs_missing

This error likely isn't encountered often (if at all) when using official repositories.

Small note at the end - some features from the redesign (#176) aren't implemented yet. I need to figure out how to see if update includes bugfixes. Cleanup, reset, pin should come sometimes soon.

@tomasmatus tomasmatus force-pushed the page-redesign branch 2 times, most recently from b4e0fa3 to 27537be Compare August 9, 2023 11:23
Copy link
Member

@garrett garrett left a comment

Choose a reason for hiding this comment

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

Thanks for implementing this!

It's not like the design, however.

The design is like this:

image

The branches are all exposed as radio buttons, as they should usually only be between 1 - 3 items. When something is 2 - 4 items, it should be a group of radios, not a dropdown. Dropdowns are better for > 5 items. When it's 1 item, then it should just be text, not a widget.

Additionally, the vertical space seems excessive?

Here's what one branch and the error state (which has a disabled button, as it cannot be used) would look like:

image

@garrett
Copy link
Member

garrett commented Aug 9, 2023

CoreOS only has 3 branches (next, stable, testing), not all the ones you listed (Silverblue, Sercea, etc.).

You're not going to switch architecture (going from x86_64 to s390, arm, etc. is a bad idea) and you shouldn't switch distributions (CoreOS to Silverblue or vice versa isn't a good idea in most cases).

@garrett
Copy link
Member

garrett commented Aug 9, 2023

Additionally, the vertical spacing isn't right in this screenshot:

image

(There's too much vertical space between the top two cards and the big bottom card.)

The vertical gap should be the same as the horizontal gap, such as in the mockup:

OStree page

src/deploymentModals.jsx Fixed Show fixed Hide fixed
garrett
garrett previously requested changes Oct 5, 2023
Copy link
Member

@garrett garrett left a comment

Choose a reason for hiding this comment

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

Looks great! 👍

We should definitely filter the list and make it radios instead of a dropdown, but as we discussed in IRC Matrix, that can be a follow-up.

I also hit a bug where rebasing doesn't have a confirmation. It just rebases (without proper progress, and is uncancelable) and then instantly reboots when done. This needs fixing, but it's something unrelated. (It's why it took me longer to review this. Whoops! Sorry.)

I'd approve it (with the understanding there will be a PR to solve the above dropdown issue), but I have some questions about using custom CSS instead of PF helpers (and also possibly a PF Flex component instead of CSS).

src/ostree.scss Outdated Show resolved Hide resolved
src/ostree.scss Outdated Show resolved Hide resolved
@tomasmatus
Copy link
Member Author

I also hit a bug where rebasing doesn't have a confirmation. It just rebases (without proper progress, and is uncancelable) and then instantly reboots when done.

It's probably a good idea to add confirmation dialog for this. It may also be useful for rolling back and deleting previous deployments

@tomasmatus
Copy link
Member Author

@garrett I added confirmation dialog for Updating, Rebasing and Roll backing:
image

I'm not sure if the confirm button should be red/yellow as this action is quite radical but at least there won't be any unexpected system reboots :)

@tomasmatus tomasmatus requested a review from jelly October 11, 2023 14:06
@garrett
Copy link
Member

garrett commented Oct 11, 2023

So:

  1. Having some kind of confirmation modal is a good idea.
  2. The modal should provide specific information, such as the version being rebased to (and possibly from, although I guess that doesn't matter as much), and possibly how long ago it was released.
  3. It currently doesn't use our standard reboot modal (with a time delay and messaging). Other parts of Cockpit, including the reboot button (but not only). Use this. I think PackageKit does too and would be a good idea to refer to for the OSTree page?

So, perhaps rework this PR to be like the first mockup here?

image

The second mockup is what it might look like if we had our scheduling from the standard reboot modal.

@garrett
Copy link
Member

garrett commented Oct 11, 2023

Perhaps it should be a warning. And I think PF would suggest an icon there too.

image

@jelly
Copy link
Member

jelly commented Nov 1, 2023

Few things I noticed which might be unrelated:

No loading for rebase modal

So you go from an error message to we have a list of things to pick from:
Screenshot from 2023-11-01 13-52-23

image

Cleanup modal

I would be surprised if this goes past @garrett, the action button name feels wrong as one of the options is "Temporary files". Maybe this should be Clean up or Delete? Looking at design guidelines I'd go for Cleanup, that seems to fit the pattern.

image

Warning icon missing?

image

Same comment as above basically.

Deleting your only deployment is an option in the UI but won't work for obvious reasons

image

See the error in console: error: Cannot undeploy currently booted deployment 0

Pinning unstaged deployment

image

See the error in console: error: Cannot pin staged deployment

To reproduce rpm-ostree install git or maybe something smaller :)

Copy link
Member

@jelly jelly left a comment

Choose a reason for hiding this comment

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

With limited OSTree experience, overall it looks quite good. There are some things I noticed which we might want to improve.

src/deploymentModals.jsx Show resolved Hide resolved
src/deploymentModals.jsx Outdated Show resolved Hide resolved
src/deploymentModals.jsx Outdated Show resolved Hide resolved
@garrett
Copy link
Member

garrett commented Nov 14, 2023

Overall, great catches and suggestions! Thanks!

Details below:

Cleanup modal

It's never "cleanup" for the verb. It would be "clean up".

Cleanup is a noun only (or sometimes an adjective in baseball)... and even then, it's usually slang or informal:
https://www.wordnik.com/words/cleanup

Additionally, it feels like this modal grew in scope and the language hasn't caught up. It's fine, and I'm glad it covers all these items.

We might want to drop the description and make the heading "Remove temporary files" and make the action "Clean up".

Additionally, if someone went to this dialog, they probably want to clean things. So I'd suggest having a default of temporary files and RPM repo metadata preselected. Pending deployment and rollback deployment can change things, but the other two items would have no effect on the system (other than re-dowloading some files).

Warning icon missing?

Yep. It should have the warning icon in the title.

Deleting your only deployment is an option in the UI but won't work for obvious reasons

It should not be an option in the UI.

Pinning unstaged deployment

Right, you shouldn't be able to pin an unstaged deployment. But you should be able to pin the current one. (On the command line, if you have a staged deployment, then it's ostree admin pin 1 instead of ostree admin pin 0, as 0 is the new deployment.)

@tomasmatus
Copy link
Member Author

Everything mentioned above should be addressed now.

Reset modal now has warning icon
reset_modal_with_icon

Rebase modal has a loading indicator
rebase_repository_loading_branches

Changed text in clean up modal (first two options are selected by default)
Cleanup_modal_rename

@jelly
Copy link
Member

jelly commented Nov 21, 2023

Probably unrelated to these changes if you run rpm-ostree install and click on refresh the page breaks.

test/check-ostree Outdated Show resolved Hide resolved
src/ostree.jsx Outdated Show resolved Hide resolved
src/ostree.jsx Outdated Show resolved Hide resolved
src/deploymentModals.jsx Outdated Show resolved Hide resolved
src/ostree.jsx Outdated Show resolved Hide resolved
src/ostree.jsx Show resolved Hide resolved
src/ostree.jsx Show resolved Hide resolved
src/repositoryModals.jsx Outdated Show resolved Hide resolved
@jelly
Copy link
Member

jelly commented Nov 23, 2023

This ID no longer exists so needs to be updated:

Traceback (most recent call last):
  File "/work/bots/make-checkout-workdir/test/check-ostree", line 215, in testOstree
    b.assert_pixels("#repo-remote-toolbar", "remote-toolbar")
  File "/work/bots/make-checkout-workdir/test/common/testlib.py", line 1197, in assert_pixels
    self.assert_pixels_in_current_layout(selector, key, ignore=ignore,
  File "/work/bots/make-checkout-workdir/test/common/testlib.py", line 1022, in assert_pixels_in_current_layout
    self.call_js_func('ph_scrollIntoViewIfNeeded', scroll_into_view or selector)
  File "/work/bots/make-checkout-workdir/test/common/testlib.py", line 344, in call_js_func
    return self.eval_js("%s(%s)" % (func, ','.join(map(jsquote, args))))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/work/bots/make-checkout-workdir/test/common/testlib.py", line 325, in eval_js
    self.raise_cdp_exception("eval_js", code, result["exceptionDetails"])
  File "/work/bots/make-checkout-workdir/test/common/testlib.py", line 305, in raise_cdp_exception
    raise Error("%s(%s): %s" % (func, arg, msg))
testlib.Error: eval_js(ph_scrollIntoViewIfNeeded("#repo-remote-toolbar")): Uncaught

Comment on lines +51 to +52
if (deleteTemporaryFiles) {
cleanupFlags.push("base");
Copy link
Member

Choose a reason for hiding this comment

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

Take away from coverage, this and below could be tested if possible.

// remove all overlayed packages
resetFlags["no-layering"] = { t: "b", v: true };
}
if (removeOverrides) {
Copy link
Member

Choose a reason for hiding this comment

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

This is also untested, could be interesting if trivial.

@jelly
Copy link
Member

jelly commented Nov 24, 2023

P.S. this also needs a release-note but that can happen Monday/Tuesday

@tomasmatus tomasmatus force-pushed the page-redesign branch 2 times, most recently from 9bde110 to 47d5159 Compare November 24, 2023 16:22
@jelly
Copy link
Member

jelly commented Nov 28, 2023

Pushed the pixel tests as they look ok to me.

@jelly jelly force-pushed the page-redesign branch 2 times, most recently from 30a3544 to 91f0c34 Compare November 28, 2023 14:47
Copy link
Member

@jelly jelly left a comment

Choose a reason for hiding this comment

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

Thanks!

Comment on lines +66 to +69
.catch(ex => {
console.warn(ex);
setError(ex.message);
setButtonLoading(false);
Copy link
Contributor

Choose a reason for hiding this comment

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

These 4 added lines are not executed by any test. Details

const actions = [
<Button key="cleanup-accept"
variant="primary"
isDisabled={buttonLoading || (!deleteTemporaryFiles && !deleteRPMmetadata && !deletePendingDeployments && !deleteRollbackDeployments)}
Copy link
Contributor

Choose a reason for hiding this comment

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

This added line is not executed by any test. Details

Comment on lines +97 to +99
<Alert variant="danger"
isInline
title={error}
Copy link
Contributor

Choose a reason for hiding this comment

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

These 3 added lines are not executed by any test. Details

<Checkbox label={_("Temporary files")}
key="temporary-files"
id="temporary-files-checkbox"
onChange={(_, isChecked) => setDeleteTemporaryFiles(isChecked)}
Copy link
Contributor

Choose a reason for hiding this comment

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

This added line is not executed by any test. Details

<Checkbox label={_("RPM repo metadata")}
key="rpm-repo-metadata"
id="rpm-repo-metadata-checkbox"
onChange={(_, isChecked) => setDeleteRPMmetadata(isChecked)}
Copy link
Contributor

Choose a reason for hiding this comment

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

This added line is not executed by any test. Details

onChange={(_ev, url) => setNewRepoURL(url)}
/>
<FormHelper fieldId="new-remote-url"
helperTextInvalid={(hasValidation && !newRepoURL.trim().length) && _("Please provide a valid URL")}
Copy link
Contributor

Choose a reason for hiding this comment

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

This added line is not executed by any test. Details

>
<TextInput id="edit-remote-url"
value={newURL}
onChange={(_ev, url) => setNewURL(url)}
Copy link
Contributor

Choose a reason for hiding this comment

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

This added line is not executed by any test. Details

Comment on lines +330 to +331
if (newBranches.includes(origin.branch)) {
setSelectedBranch(origin.branch);
Copy link
Contributor

Choose a reason for hiding this comment

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

These 2 added lines are not executed by any test. Details

</Select>
)
: (
<Text>{availableRemotes[0]}</Text>
Copy link
Contributor

Choose a reason for hiding this comment

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

This added line is not executed by any test. Details

onClose={Dialogs.close}
actions={actions}
>
{error && <Alert variant="danger" isInline title={error} />}
Copy link
Contributor

Choose a reason for hiding this comment

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

This added line is not executed by any test. Details

@martinpitt martinpitt merged commit 7c6271c into cockpit-project:main Nov 29, 2023
6 checks passed
@martinpitt martinpitt mentioned this pull request Nov 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants