Skip to content
This repository has been archived by the owner on Apr 4, 2023. It is now read-only.

Plugin management #162

Merged
merged 4 commits into from
May 31, 2019
Merged

Plugin management #162

merged 4 commits into from
May 31, 2019

Conversation

vitaliy-guliy
Copy link
Contributor

@vitaliy-guliy vitaliy-guliy commented Apr 8, 2019

What does this PR do?

  • Displays a dedicated view with list of available plugins
  • Installs / uninstalls a plugin by simple mouse click
  • Displays installed plugins in separate list
  • Allows the user to install a plugin from custom registry
  • Installs VS Code extension using a command or drag and drop

Screenshot from 2019-04-05 16-39-18

Video demonstrating the feature
https://www.youtube.com/watch?v=2_GPZb1_Hew

What issues does this PR fix or reference?

eclipse-che/che#12932

Signed-off-by: Vitaliy Gulyy vgulyy@redhat.com

@@ -42,4 +45,4 @@
"backend": "lib/node/che-backend-module"
}
]
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Fix line ending please.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done


bindViewContribution(bind, ChePluginViewContribution);

bind(ChePluginWidget).toSelf();
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe it should be singleton?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed. Thanks.

// const { yaml } = require('js-yaml');
const yaml = require('js-yaml');

export interface ChePluginMetadataInternal {
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe ChePluginMetadataInternal extends ChePluginMetadata?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is another ChePluginMetadata defined in common/che-protocol

return getPluginsRequest.data;
}

return [];
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe throw an error instead of empty array?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Has been reworked

}

private installedPlugins: string[] = [
'org.eclipse.che.editor.theia:1.0.0',
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should get this information from workspace config attributes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, it's only draft for now

this.title.closable = true;
this.addClass('theia-plugins');

this.node.tabIndex = -1;
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we use '-1' for the tabIndex(not 0)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed. Thanks!

@slemeur
Copy link

slemeur commented Apr 9, 2019

Very cool @vitaliy-guliy !

Can we also take the opportunity to improve a little bit the formatting of each "plugin row" ?
Few feedbacks:

  • Use a single font size, for title and description (the one from description). Difference will be applied with the bold style.
  • Use the same font size in the install/installed buttons that for the author of the plugin
  • Reduce the space between title and description, description and author
  • Left alignement for all fields
  • Display "Install" and "Installed" buttons always at the same position. I think where you have the "Install" button works better.

@vitaliy-guliy
Copy link
Contributor Author

@slemeur Yes, sure. I will add a screenshot here with updates

@slemeur
Copy link

slemeur commented Apr 10, 2019

Thanks @vitaliy-guliy

@vitaliy-guliy
Copy link
Contributor Author

vitaliy-guliy commented Apr 12, 2019

@slemeur WDYT?

latest

The space between title and description is reduced a bit. But I reserved space for description to be able to show 3 lines of text.
I'm thinking about displaying plugin type somewhere as a label. Where do you prefer to show it?
I have two options: above or under the description.

@benoitf
Copy link
Contributor

benoitf commented May 6, 2019

hello, what os the status of this PR ?

@benoitf
Copy link
Contributor

benoitf commented May 6, 2019

ci-build is failing and ECA check as well

@monaka
Copy link
Member

monaka commented May 6, 2019

@benoitf Looks same as I reported in my comment.
CI build server may be broken.

@monaka
Copy link
Member

monaka commented May 7, 2019

FYI

I tried to build this PR branch on my CI server.
It looks a version mismatch happened.

https://dev.azure.com/pizzafactory/camino/_build/results?buildId=670

Step 17/40 : RUN yarn
 ---> Running in f87813b46e5d
yarn install v1.12.3
[1/5] Validating package.json...
error parent@0.0.0: The engine "node" is incompatible with this module. Expected version ">=10.2.0". Got "8.15.0"‌
error Found incompatible module‌
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.‌
The command '/bin/sh -c yarn' returned a non-zero code: 1

@monaka
Copy link
Member

monaka commented May 9, 2019

FYI

Looks ECA rejection is caused commit-id 7e6cf42 250bcc2.

@monaka
Copy link
Member

monaka commented May 9, 2019

FYI

Build failures I repoted above will be fixed after rebasing or merging from the master branch. (I checked by hand)

@vitaliy-guliy vitaliy-guliy changed the title Che Plugins View Plugin management May 28, 2019
Signed-off-by: Vitaliy Gulyy <vgulyy@redhat.com>
@vitaliy-guliy vitaliy-guliy marked this pull request as ready for review May 29, 2019 13:30
@vitaliy-guliy vitaliy-guliy removed the request for review from tolusha May 29, 2019 13:30
@vitaliy-guliy
Copy link
Contributor Author

Too much things has been reworked. PR is ready to review.

@@ -0,0 +1,177 @@
/********************************************************************************
* Copyright (C) 2018 Red Hat, Inc. and others.
Copy link
Contributor

Choose a reason for hiding this comment

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

Fix year, please, for all files...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Signed-off-by: Vitaliy Guliy <vgulyy@redhat.com>
// @builtin
// @enabled
// @disabled
hasType(filter: string, type: string) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Minor: apply, please, return type :boolean. But up to you.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. Thanks


const registry = this.registryList.find(r => r.uri === uri);
if (registry === undefined) {
instance.registryList.push({
Copy link
Contributor

Choose a reason for hiding this comment

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

In the two lines upper you used this.registryList:
const registry = this.registryList.find(r => r.uri === uri);
Could you do the same this.registryList.push({ and remove const instance = this;?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

private getIdPublisher(input: string): string {
if (input.startsWith('ext install ')) {
// check for 'ext install rebornix.Ruby'
return input.substring('ext install '.length);
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be nice to trim 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.

This is intentional decision. Space is a part of a prefix of the command.
The first command has a space at the end, the second command has a slash.

        if (input.startsWith('ext install ')) {
            // check for 'ext install rebornix.Ruby'
            return input.substring('ext install '.length);
        } else if (input.startsWith('vscode:extension/')) {
            // check for 'vscode:extension/rebornix.Ruby'
            return input.substring('vscode:extension/'.length);
        }

Copy link
Contributor

@mmorhun mmorhun left a comment

Choose a reason for hiding this comment

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

If you need to merge it ASAP you may ignore my comments for now and handle them in the following PR

return plugins;
}

private determinePluginType(meta: PluginMetadata): string {
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe use literals type or enum as return value?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It could be any string

const metadata = await this.hostedPluginServer.getDeployedMetadata();

const plugins: ChePluginMetadata[] = await Promise.all(
metadata.map(async (meta: PluginMetadata) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Here is a synchronous function in map method. I seem you don't need promises here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Has been reworked. Thanks!

category: 'string',
latestUpdateDate: 'string',

// Plugin KEY. Used to set in workpsace configuration
Copy link
Contributor

Choose a reason for hiding this comment

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

typo: workpsace -> workspace

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed. Thanks!


const prefs = this.chePluginPreferences['chePlugins.repositories'];
if (prefs) {
const instance = this;
Copy link
Contributor

Choose a reason for hiding this comment

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

You don't need to save this as instance because an arrow function doesn't have its own this, and this of surrounding scope is used.

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's already fixed. Thanks!

try {
// add the plugin to workspace configuration
await this.chePluginService.addPlugin(plugin.key);
await this.delay(1000);
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you explain why do you need a delay here?

Copy link
Contributor Author

@vitaliy-guliy vitaliy-guliy May 31, 2019

Choose a reason for hiding this comment

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

It's already removed. No delay anymore :=))

}

try {
const workpsaceSettings: WorkspaceSettings = await this.cheApiService.getWorkspaceSettings();
Copy link
Contributor

Choose a reason for hiding this comment

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

typo: workpsaceSettings -> workspaceSettings

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed. Thanks!

@vitaliy-guliy
Copy link
Contributor Author

If you need to merge it ASAP you may ignore my comments for now and handle them in the following PR

I have to fix everything. No options here.

Signed-off-by: Vitaliy Guliy <vgulyy@redhat.com>
Signed-off-by: Vitaliy Guliy <vgulyy@redhat.com>
@vitaliy-guliy vitaliy-guliy merged commit cd45d3d into master May 31, 2019
@vitaliy-guliy vitaliy-guliy deleted the plugins-view branch May 31, 2019 13:15
monaka referenced this pull request in PizzaFactory/che-theia Jun 14, 2019
* Makes it possible to install a plugin from Theia

Signed-off-by: Vitaliy Gulyy <vgulyy@redhat.com>

* Update year in license

Signed-off-by: Vitaliy Guliy <vgulyy@redhat.com>

* PR feebbacks

Signed-off-by: Vitaliy Guliy <vgulyy@redhat.com>

* Solving PR feedbacks

Signed-off-by: Vitaliy Guliy <vgulyy@redhat.com>
vinokurig pushed a commit that referenced this pull request Apr 6, 2021
…ins (#162)

* Use eclipse/che-remote-plugin-runner-java11:next image for java based plugins

Signed-off-by: Valeriy Svydenko <vsvydenk@redhat.com>

* Revert changes to use Java8 for sonarlint plugin

Signed-off-by: Valeriy Svydenko <vsvydenk@redhat.com>

* Set up memory limit for apache-camel plugin

Signed-off-by: Valeriy Svydenko <vsvydenk@redhat.com>

* Set up memory limit for sonarlint plugin

Signed-off-by: Valeriy Svydenko <vsvydenk@redhat.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants