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

Desktop: Resolves #6143: Show installed plugins in Help - About Joplin #7711

Merged
merged 7 commits into from
Feb 8, 2023

Conversation

julien-me
Copy link
Contributor

Resolves #6143

This PR lists in Help > About Joplin every installed plugin. If more than 20 plugins are installed then only the first 20 plugins are shown followed by .... However when clicking on Copy the full list is always copied.

Here's some screenshots when there are 0, 1, 5, 21 plugins installed.
plugin-list-no-plugin
plugin-list-one-plugin
plugin-list-five-plugin
plugin-list-twenty-one-plugin

@github-actions
Copy link
Contributor

github-actions bot commented Feb 3, 2023

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

@julien-me
Copy link
Contributor Author

I have read the CLA Document and I hereby sign the CLA

@tessus tessus added the desktop All desktop platforms label Feb 3, 2023
Copy link
Collaborator

@tessus tessus left a comment

Choose a reason for hiding this comment

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

Nicely done. Test cases, the fact that ellipsis are shown when more than 20 plugins are enabled, it shows that you did your homework.

Thanks for this PR.

Copy link
Owner

@laurent22 laurent22 left a comment

Choose a reason for hiding this comment

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

Looks very good, thank you!

In general when modifying something under /lib or any shared package, you should also check how it's used across platforms. In that particular case, this function is also used on the CLI app (joplin version command), so could you check please that it's still working?

packages/lib/versionInfo.ts Outdated Show resolved Hide resolved
@julien-me
Copy link
Contributor Author

In general when modifying something under /lib or any shared package, you should also check how it's used across platforms. In that particular case, this function is also used on the CLI app (joplin version command), so could you check please that it's still working?

They are not listed.

I started app-cli then used the command :version.

I can see that app-desktop writes to ~/.config/joplindev-desktop on my computer and app-cli writes to ~/.config/joplindev. I guess that's why plugins installed via the desktop application don't appear in the CLI application.

Is this expected? Or is there a way to install plugins from the CLI application?

@laurent22
Copy link
Owner

laurent22 commented Feb 6, 2023

They are not listed.

Sorry what do you mean by this? What is not listed?

And no, plugins are not supported on the CLI app at the moment

Edit: Ok I guess you mean plugins are not listed and that's normal. But does the command work at all? I'm wondering because versionInfo now has a dependency to the plugin service, but plugins are not supported on CLI. (it's half supported because we use it for testing but that's it)

@julien-me
Copy link
Contributor Author

They are not listed.

Sorry what do you mean by this? What is not listed?

And no, plugins are not supported on the CLI app at the moment

Edit: Ok I guess you mean plugins are not listed and that's normal. But does the command work at all? I'm wondering because versionInfo now has a dependency to the plugin service, but plugins are not supported on CLI. (it's half supported because we use it for testing but that's it)

I understand now. Yes it works.

Here is a screenshot:
cli-versioninfo-show-plugins-branch

@laurent22
Copy link
Owner

Hmm, ok it works by chance then because the plugin service is not setup on CLI, yet it's used in your updated function. Instead of having versionInfo.ts loads PluginService directly, would it be possible to pass the plugins as a dependency to versionInfo() (in the same way the packageInfo is currently passed)? And on CLI you'd pass an empty array for instance.

In the context where versionInfo() is called there's state.pluginService.plugins. Does it already contain the necessary info, and if so can you use this? I think it may have been attempted before and it didn't work, so maybe you could add whatever extra info is needed to this array?

@julien-me
Copy link
Contributor Author

state.pluginService.plugins doesn't seem to contain what we need. But I remember a previous PR attempt that passed PluginService.instance().plugins to versionInfo().

I think that would work.

@laurent22
Copy link
Owner

But I remember a previous PR attempt that passed PluginService.instance().plugins to versionInfo().

Ok let's do that. That way we can pass an empty array on CLI

@julien-me
Copy link
Contributor Author

I updated the code to pass a Plugins object to versionInfo().

@laurent22
Copy link
Owner

There's a TypeScript error in ErrorBoundary.tsx

@julien-me
Copy link
Contributor Author

There's a TypeScript error in ErrorBoundary.tsx

Fixed.

@laurent22
Copy link
Owner

Thanks! For info we removed the TypeScript build from the precommit hook because it's too slow. So it means before committing you need to check the output of yarn run watch to see if there's any error in there

@laurent22
Copy link
Owner

That's great, thanks @julien-me for implementing this!

@laurent22 laurent22 merged commit 631c41a into laurent22:dev Feb 8, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Feb 8, 2023
@laurent22
Copy link
Owner

@julien-me, since this change the tests now print the version information. Please could you remove these console statements?


jest.mock('./registry');

const info = jest.spyOn(console, 'info').mockImplementation(() => {});
Copy link
Owner

Choose a reason for hiding this comment

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

In fact I'm not sure why this is needed? In general we don't want code to print to the console, as that should only be used for debugging

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 added that to remove console logs during the tests. There was no test for versionInfo() until now but as soon as I added tests, the statement in versionInfo() was polluting the test output.

Copy link
Owner

Choose a reason for hiding this comment

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

That makes sense, but I guess now it can be removed? Or is versionInfo() still printing something?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes it can be removed. versionInfo() doesn't print anything anymore.

Copy link
Owner

Choose a reason for hiding this comment

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

Ok great, if you could remove it then and create a pull request with it that would be perfect

@@ -32,9 +68,11 @@ export default function versionInfo(packageInfo: any) {
console.info(gitInfo);
Copy link
Owner

Choose a reason for hiding this comment

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

I have now removed this statement as part of the "no-console" rule that was just added. I assume it was safe to remove?

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 do not know the original intent of that line but it seems to me that it is safe to remove.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
desktop All desktop platforms
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Desktop: Show installed plugins in Help - About Joplin
3 participants