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

UX: improve UI of software update page & display more info. #214

Merged
merged 20 commits into from
Jul 8, 2024

Conversation

vinothkannans
Copy link
Contributor

@vinothkannans vinothkannans commented May 2, 2024

This PR will refresh the software update page so that self-hosters can more easily understand the plugins they have installed and which plugins need updates, and so that they are able to quickly and easily update them (or update everything).

Before

Screenshot 2024-05-02 at 9 49 18 AM

After

Screenshot 2024-05-02 at 9 47 35 AM

This PR will refresh the software update page so that self-hosters can more easily understand the plugins they have installed and which plugins need updates, and so that they are able to quickly and easily update them (or update everything).
@martin-brennan martin-brennan self-requested a review May 2, 2024 04:26
Copy link
Contributor

@martin-brennan martin-brennan left a comment

Choose a reason for hiding this comment

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

This is looking really great so far 👌

I wonder if we could add a general system spec for this update system? Even if to start with for this PR we made an extremely basic one that navigated us to this page and confirmed the top Discourse row of the update list has the expected version and details. A spec that actually tests the update process itself and also plugin details would be amazing, but it could be quite tricky 🤔

I think we could probably link these commit hashes to their relevant repos too -- just keep them the same grey text style though

2024-05-03_11-20

@@ -1,62 +1,72 @@
<tr>
<tr class="repo {{if @repo.hasNewVersion 'new-version'}}">
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you please convert this component to a .gjs component while you are at it?

return this.plugin.nameTitleized;
}

let name = this.name
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm just wondering why you need this other stuff? Everything on this page is either Discourse or a plugin isn't it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I needed this since the docker_manager plugin is a hidden plugin and I was fetching plugin information only for the visible plugins. It's no longer the case after the commit 662fee0

get author() {
if (this.plugin) {
return this.plugin.author;
} else if (this.name === "docker_manager") {
Copy link
Contributor

Choose a reason for hiding this comment

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

This is unnecessary -- docker_manager is an official plugin owned by us, so it should do this by default with this.plugin.author:

https://github.com/discourse/discourse/blob/792e66966c3006ec4abe9746d1554a44fcbe0c2c/app/assets/javascripts/admin/addon/models/admin-plugin.js#L88-L94

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same as #214 (comment). I needed this since the docker_manager plugin is a hidden plugin and I was fetching plugin information only for the visible plugins. It's no longer the case after the commit 662fee0

<div class="updates-heading">
<h3>{{i18n "admin.docker.update_title"}}</h3>
{{#unless this.outdated}}
<button
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not use DButton for this? This one has currently got slightly different styling to the Update buttons in the list

@@ -21,6 +21,13 @@ def repos
official: Plugin::Metadata::OFFICIAL_PLUGINS.include?(r.name),
}

plugin = Discourse.visible_plugins.find { |p| p.path == "#{r.path}/plugin.rb" }
Copy link
Contributor

Choose a reason for hiding this comment

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

Need to be careful with this...the page errors completely on the client if you give it a wrong path:

2024-05-03_11-46

Copy link
Contributor

Choose a reason for hiding this comment

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

Or maybe this is an existing problem -- either way we should account for this.

Copy link
Contributor Author

@vinothkannans vinothkannans Jul 7, 2024

Choose a reason for hiding this comment

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

This is fixed by the commit 8449511. Now it will redirect to the 404 page if plugin not found

admin/assets/javascripts/discourse/helpers/commit-url.js Outdated Show resolved Hide resolved
admin/assets/javascripts/discourse/helpers/commit-url.js Outdated Show resolved Hide resolved
admin/assets/javascripts/discourse/helpers/commit-url.js Outdated Show resolved Hide resolved
import { helper as buildHelper } from "@ember/component/helper";
import { htmlSafe } from "@ember/template";

export default buildHelper(function (params) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think in this case you need buildHelper. I think you could do:

export default function commitUrl(cssClass, version, prettyVersion, url) {
}

Then you can get rid of your const line below too

@vinothkannans
Copy link
Contributor Author

@martin-brennan all the requested changes are now completed.

Copy link
Contributor

@martin-brennan martin-brennan left a comment

Choose a reason for hiding this comment

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

Sorry but we recently changed the plugins list in core to:

  1. Remove the title link
  2. Add an external link icon to "Learn more"

Can you please bring this page up to date with those changes before merge?

image


This is probably a preexisting issue, but if you set UNICORN_WORKERS=1 (I had this on randomly) we fail an upgrade gracefully but we also encounter this error, can you please fix this to do to_i on num_workers_spun_down?

/home/mb/repos/docker_manager/lib/docker_manager/upgrader.rb:148:in `rescue in upgrade': undefined method `positive?' for nil:NilClass (NoMethodError)

    if num_workers_spun_down.positive? && !reloaded
                            ^^^^^^^^^^
	from /home/mb/repos/docker_manager/lib/docker_manager/upgrader.rb:140:in `upgrade'
	from /home/mb/repos/docker_manager/scripts/docker_manager_upgrade.rb:19:in `block in <main>'
	from /home/mb/repos/docker_manager/scripts/docker_manager_upgrade.rb:6:in `fork'
	from /home/mb/repos/docker_manager/scripts/docker_manager_upgrade.rb:6:in `<main>'

Also not sure why but for me locally unicorn_launcher_pid and unicorn_master_pid was always blank, see:

ps aux | rg unicorn
mb         66728  0.2  0.0 107068 28424 pts/3    S+   12:37   0:00 ruby /home/mb/repos/discourse/bin/unicorn
mb         66733 10.2  1.2 2412700 395968 pts/3  Sl+  12:37   0:09 unicorn master -N -c /home/mb/repos/discourse/config/unicorn.conf.rb
mb         67511  1.8  1.2 2447908 413020 pts/3  Sl+  12:37   0:01 unicorn worker[0] -N -c /home/mb/repos/discourse/config/unicorn.conf.rb
mb         67514  1.8  1.2 2447756 413660 pts/3  Sl+  12:37   0:01 unicorn worker[1] -N -c /home/mb/repos/discourse/config/unicorn.conf.rb
mb         67519  1.7  1.2 2446984 414316 pts/3  Sl+  12:37   0:01 unicorn worker[2] -N -c /home/mb/repos/discourse/config/unicorn.conf.rb
mb         68883  0.0  0.0   9696  6400 pts/5    S+   12:39   0:00 rg unicorn

Anyway though that could be fixed in a separate PR if needed, the main fix is to just change the list a bit to have the correct new format then we can merge this 🎉

@vinothkannans vinothkannans merged commit e29c6b1 into main Jul 8, 2024
5 checks passed
@vinothkannans vinothkannans deleted the updates-page branch July 8, 2024 18:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants