Skip to content

Commit

Permalink
Adapt UD and wsmaster to new plugin notation (#13204)
Browse files Browse the repository at this point in the history
Signed-off-by: Oleksandr Garagatyi <ogaragat@redhat.com>
  • Loading branch information
Oleksandr Garagatyi authored May 2, 2019
1 parent 6c8e201 commit 35ce354
Show file tree
Hide file tree
Showing 68 changed files with 942 additions and 599 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -551,8 +551,8 @@ che.singleport.wildcard_domain.ipless=false

# Docker image of Che plugin broker app that resolves workspace tooling configuration and copies
# plugins dependencies to a workspace
che.workspace.plugin_broker.init.image=eclipse/che-init-plugin-broker:v0.15.4
che.workspace.plugin_broker.unified.image=eclipse/che-unified-plugin-broker:v0.15.4
che.workspace.plugin_broker.init.image=eclipse/che-init-plugin-broker:v0.16
che.workspace.plugin_broker.unified.image=eclipse/che-unified-plugin-broker:v0.16

# Docker image of Che plugin broker app that resolves workspace tooling configuration and copies
# plugins dependencies to a workspace
Expand All @@ -564,7 +564,7 @@ che.workspace.plugin_broker.wait_timeout_min=3
# Workspace tooling plugins registry endpoint. Should be a valid HTTP URL.
# Example: http://che-plugin-registry-eclipse-che.192.168.65.2.nip.io
# In case Che plugins tooling is not needed value 'NULL' should be used
che.workspace.plugin_registry_url=https://che-plugin-registry.openshift.io
che.workspace.plugin_registry_url=https://che-plugin-registry.openshift.io/v2

# Configures in which way secure servers will be protected with authentication.
# Suitable values:
Expand Down Expand Up @@ -624,24 +624,24 @@ che.wsagent.cors.enabled=true
## Factory defaults.
# Editor and plugin which will be used for factories which are created from remote git repository
# which doesn't contain any Che-specific workspace descriptors (like .devfile of .factory.json)
che.factory.default_editor=org.eclipse.che.editor.theia:1.0.0
che.factory.default_editor=eclipse/che-theia/1.0.0
# multiple plugins must be comma-separated, for example:
# pluginFooName:pluginFooVersion,pluginBarName:pluginBarVersion
che.factory.default_plugins=che-machine-exec-plugin:0.0.1
# pluginFooPublisher/pluginFooName/pluginFooVersion,pluginBarPublisher/pluginBarName/pluginBarVersion
che.factory.default_plugins=eclipse/che-machine-exec-plugin/0.0.1

## Devfile settings

# Devfile defaults
#
# Default Editor that should be provisioned into Devfile if there is no other Editor specified
# Format is `editorId:editorVersion` value.
# Default Editor that should be provisioned into Devfile if there is no specified Editor
# Format is `editorPublisher/editorName/editorVersion` value.
# `NULL` or absence of value means that default editor should not be provisioned.
che.workspace.devfile.default_editor=org.eclipse.che.editor.theia:1.0.0
che.workspace.devfile.default_editor=eclipse/che-theia/1.0.0

# Default Plugins which should be provisioned for Default Editor.
# All the plugins from this list that are not explicitly mentioned in the user-defined devfile
# will be provisioned but only when the default editor is used or if the user-defined editor is
# the same as the default one (even if in different version).
# Format is comma-separated `pluginId:pluginVersion` values, for example
# che-theia-exec-plugin:0.0.1,che-theia-terminal-plugin:0.0.1
che.workspace.devfile.default_editor.plugins=che-machine-exec-plugin:0.0.1
# Format is comma-separated `pluginPublisher/pluginName/pluginVersion` values, for example
# eclipse/che-theia-exec-plugin/0.0.1,eclipse/che-theia-terminal-plugin/0.0.1
che.workspace.devfile.default_editor.plugins=eclipse/che-machine-exec-plugin/0.0.1
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ public interface Command {
/**
* {@link Command} attribute which indicates in which plugin command must be run. If specified
* plugin has multiple containers then first containers should be used. Attribute value has the
* following format: `{PLUGIN_ID}:{PLUGIN_VERSION}`. For example: org.eclipse.sample-plugin:0.0.1
* following format: `{PLUGIN_PUBLISHER}/{PLUGIN_NAME}/{PLUGIN_VERSION}`. For example:
* eclipse/sample-plugin/0.0.1
*/
String PLUGIN_ATTRIBUTE = "plugin";

Expand Down
4 changes: 2 additions & 2 deletions cypress-tests/cypress/fixtures/workspace/che-7-preview.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
"commands": [],
"name": "wksp-ncvb",
"attributes": {
"editor": "org.eclipse.che.editor.theia:1.0.0",
"plugins": "che-machine-exec-plugin:0.0.1"
"editor": "eclipse/che-theia/1.0.0",
"plugins": "eclipse/che-machine-exec-plugin/0.0.1"
},
"links": []
}
4 changes: 2 additions & 2 deletions dashboard/.devfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ projects:
tools:
- name: theia-editor
type: cheEditor
id: org.eclipse.che.editor.theia:master
id: eclipse/che-theia/master
- name: exec-plugin
type: chePlugin
id: che-machine-exec-plugin:0.0.1
id: eclipse/che-machine-exec-plugin/0.0.1
- name: dash-dev
type: dockerimage
image: 'eclipse/che-dashboard-dev:nightly'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
* Red Hat, Inc. - initial API and implementation
*/
'use strict';
import {IPlugin, PluginRegistry} from '../../../../components/api/plugin-registry.factory';
import { IPlugin, PluginRegistry } from '../../../../components/api/plugin-registry.factory';
import IWorkspaceConfig = che.IWorkspaceConfig;
import {CheNotification} from '../../../../components/notification/che-notification.factory';
import { CheNotification } from '../../../../components/notification/che-notification.factory';

const PLUGIN_SEPARATOR = ',';
const PLUGIN_VERSION_SEPARATOR = ':';
Expand All @@ -35,7 +35,7 @@ export class WorkspaceEditorsController {
onChange: Function;
isLoading: boolean;

editorOrderBy = 'name';
editorOrderBy = 'displayName';
editors: Array<IPlugin> = [];
selectedEditor: string = '';
editorFilter: any;
Expand All @@ -46,7 +46,7 @@ export class WorkspaceEditorsController {
* Default constructor that is using resource
*/
constructor(pluginRegistry: PluginRegistry, cheListHelperFactory: che.widget.ICheListHelperFactory, $scope: ng.IScope,
cheNotification: CheNotification) {
cheNotification: CheNotification) {
this.pluginRegistry = pluginRegistry;
this.cheNotification = cheNotification;

Expand All @@ -57,7 +57,7 @@ export class WorkspaceEditorsController {
cheListHelperFactory.removeHelper(helperId);
});

this.editorFilter = {name: ''};
this.editorFilter = { displayName: '' };

const deRegistrationFn = $scope.$watch(() => {
return this.workspaceConfig;
Expand Down Expand Up @@ -87,7 +87,7 @@ export class WorkspaceEditorsController {
if (item.type === EDITOR_TYPE) {
this.editors.push(item);
};
});
});

this.updateEditors();
}, (error: any) => {
Expand All @@ -102,8 +102,8 @@ export class WorkspaceEditorsController {
* @param str {string} a string to filter projects names
*/
onSearchChanged(str: string): void {
this.editorFilter.name = str;
this.cheListHelper.applyFilter('name', this.editorFilter);
this.editorFilter.displayName = str;
this.cheListHelper.applyFilter('displayName', this.editorFilter);
}

/**
Expand All @@ -112,13 +112,11 @@ export class WorkspaceEditorsController {
* @param {IPlugin} plugin
*/
updateEditor(plugin: IPlugin): void {
let name = plugin.id + PLUGIN_VERSION_SEPARATOR + plugin.version;

if (plugin.type === EDITOR_TYPE) {
this.selectedEditor = plugin.isEnabled ? name : '';
this.selectedEditor = plugin.isEnabled ? plugin.id : '';
this.workspaceConfig.attributes.editor = this.selectedEditor;
}

this.cleanupInstallers();
this.onChange();
}
Expand All @@ -127,9 +125,9 @@ export class WorkspaceEditorsController {
* Clean up all the installers in all machines, when plugin is selected.
*/
cleanupInstallers(): void {
let defaultEnv : string = this.workspaceConfig.defaultEnv;
let machines : any = this.workspaceConfig.environments[defaultEnv].machines;
let machineNames : Array<string> = Object.keys(machines);
let defaultEnv: string = this.workspaceConfig.defaultEnv;
let machines: any = this.workspaceConfig.environments[defaultEnv].machines;
let machineNames: Array<string> = Object.keys(machines);
machineNames.forEach((machineName: string) => {
machines[machineName].installers = [];
});
Expand All @@ -141,9 +139,9 @@ export class WorkspaceEditorsController {
private updateEditors(): void {
// get selected plugins from workspace configuration attribute - "editor":
this.selectedEditor = this.workspaceConfig && this.workspaceConfig.attributes && this.workspaceConfig.attributes.editor ?
this.workspaceConfig.attributes.editor : '';
this.workspaceConfig.attributes.editor : '';

// check each editor's enabled state:
// check each editor's enabled state:
this.editors.forEach((editor: IPlugin) => {
editor.isEnabled = this.isEditorEnabled(editor);
});
Expand All @@ -157,8 +155,6 @@ export class WorkspaceEditorsController {
* @returns {boolean} the editor's enabled state
*/
private isEditorEnabled(editor: IPlugin): boolean {
// name in the format: id:version
let name = editor.id + PLUGIN_VERSION_SEPARATOR + editor.version;
return name === this.selectedEditor;
return editor.id === this.selectedEditor;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
che-column-title="Enable"></che-list-header-column>
<che-list-header-column flex="25" layout="column" layout-align="center start"
che-sort-value="workspaceEditorsController.editorOrderBy"
che-sort-item="name"
che-sort-item="displayName"
che-column-title="Editor"></che-list-header-column>
<che-list-header-column flex="15" layout="column" layout-align="center start"
che-column-title="Version"></che-list-header-column>
Expand All @@ -26,12 +26,12 @@
<che-list class="plugins-list" flex
ng-if="workspaceEditorsController.editors && workspaceEditorsController.editors.length > 0">
<div class="plugin-item"
ng-repeat="editor in workspaceEditorsController.editors | orderBy:[workspaceEditorsController.editorOrderBy, 'name' ]">
ng-repeat="editor in workspaceEditorsController.editors | orderBy:[workspaceEditorsController.editorOrderBy, 'displayName' ]">
<che-list-item flex>
<div flex="100"
layout="row"
layout-align="start stretch"
plugin-item-name="{{editor.name}}"
plugin-item-name="{{editor.displayName}}"
plugin-item-version="{{editor.version}}"
class="che-list-item-row">
<div layout="row" layout-align="center center" class="che-list-item-checkbox"></div>
Expand All @@ -41,12 +41,13 @@
<md-switch ng-model="editor.isEnabled"
ng-change="workspaceEditorsController.updateEditor(editor)"
aria-label="editor"
plugin-switch="{{editor.name}}">
plugin-switch="{{editor.displayName}}">
</md-switch>
</div>
<!-- Name -->
<div flex="25">
<span class="che-list-item-name" plugin-name="{{editor.name}}">{{editor.name}}</span>
<span class="che-list-item-name" plugin-name="{{editor.name}}">{{editor.displayName}}</span>
<span ng-if="editor.publisher" class="che-list-item-secondary">({{editor.publisher}} publisher)</span>
</div>
<!-- Version -->
<div flex="15">
Expand All @@ -67,4 +68,3 @@
</span>
</div>
</div>

Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
* Red Hat, Inc. - initial API and implementation
*/
'use strict';
import {IPlugin, PluginRegistry} from '../../../../components/api/plugin-registry.factory';
import { IPlugin, PluginRegistry } from '../../../../components/api/plugin-registry.factory';
import IWorkspaceConfig = che.IWorkspaceConfig;
import {CheNotification} from '../../../../components/notification/che-notification.factory';
import { CheNotification } from '../../../../components/notification/che-notification.factory';

const PLUGIN_SEPARATOR = ',';
const PLUGIN_VERSION_SEPARATOR = ':';
Expand All @@ -35,7 +35,7 @@ export class WorkspacePluginsController {
onChange: Function;
isLoading: boolean;

pluginOrderBy = 'name';
pluginOrderBy = 'displayName';
plugins: Array<IPlugin> = [];
selectedPlugins: Array<string> = [];

Expand All @@ -47,7 +47,7 @@ export class WorkspacePluginsController {
* Default constructor that is using resource
*/
constructor(pluginRegistry: PluginRegistry, cheListHelperFactory: che.widget.ICheListHelperFactory, $scope: ng.IScope,
cheNotification: CheNotification) {
cheNotification: CheNotification) {
this.pluginRegistry = pluginRegistry;
this.cheNotification = cheNotification;

Expand All @@ -58,7 +58,7 @@ export class WorkspacePluginsController {
cheListHelperFactory.removeHelper(helperId);
});

this.pluginFilter = {name: ''};
this.pluginFilter = { displayName: '' };

const deRegistrationFn = $scope.$watch(() => {
return this.workspaceConfig;
Expand Down Expand Up @@ -88,7 +88,7 @@ export class WorkspacePluginsController {
if (item.type !== EDITOR_TYPE) {
this.plugins.push(item);
}
});
});

this.updatePlugins();
}, (error: any) => {
Expand All @@ -103,8 +103,8 @@ export class WorkspacePluginsController {
* @param str {string} a string to filter projects names
*/
onSearchChanged(str: string): void {
this.pluginFilter.name = str;
this.cheListHelper.applyFilter('name', this.pluginFilter);
this.pluginFilter.displayName = str;
this.cheListHelper.applyFilter('displayName', this.pluginFilter);
}

/**
Expand All @@ -113,13 +113,11 @@ export class WorkspacePluginsController {
* @param {IPlugin} plugin
*/
updatePlugin(plugin: IPlugin): void {
let name = plugin.id + PLUGIN_VERSION_SEPARATOR + plugin.version;

if (plugin.type !== EDITOR_TYPE) {
if (plugin.isEnabled) {
this.selectedPlugins.push(name);
this.selectedPlugins.push(plugin.id);
} else {
this.selectedPlugins.splice(this.selectedPlugins.indexOf(name), 1);
this.selectedPlugins.splice(this.selectedPlugins.indexOf(plugin.id), 1);
}
this.workspaceConfig.attributes.plugins = this.selectedPlugins.join(PLUGIN_SEPARATOR);
}
Expand All @@ -132,9 +130,9 @@ export class WorkspacePluginsController {
* Clean up all the installers in all machines, when plugin is selected.
*/
cleanupInstallers(): void {
let defaultEnv : string = this.workspaceConfig.defaultEnv;
let machines : any = this.workspaceConfig.environments[defaultEnv].machines;
let machineNames : Array<string> = Object.keys(machines);
let defaultEnv: string = this.workspaceConfig.defaultEnv;
let machines: any = this.workspaceConfig.environments[defaultEnv].machines;
let machineNames: Array<string> = Object.keys(machines);
machineNames.forEach((machineName: string) => {
machines[machineName].installers = [];
});
Expand All @@ -151,7 +149,7 @@ export class WorkspacePluginsController {
this.plugins.forEach((plugin: IPlugin) => {
plugin.isEnabled = this.isPluginEnabled(plugin);
});
this.cheListHelper.setList(this.plugins, 'name');
this.cheListHelper.setList(this.plugins, 'displayName');
}

/**
Expand All @@ -160,8 +158,6 @@ export class WorkspacePluginsController {
* @returns {boolean} the plugin's enabled state
*/
private isPluginEnabled(plugin: IPlugin): boolean {
// name in the format: id:version
let name = plugin.id + PLUGIN_VERSION_SEPARATOR + plugin.version;
return this.selectedPlugins.indexOf(name) >= 0;
return this.selectedPlugins.indexOf(plugin.id) >= 0
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</div>
<div che-multi-transclude-part="che-list-search">
<che-list-header-search placeholder="Search"
query="workspacePluginsController.pluginFilter.name"
query="workspacePluginsController.pluginFilter.displayName"
on-change="workspacePluginsController.onSearchChanged(query)"></che-list-header-search>
</div>
</che-list-header-additional-parts>
Expand All @@ -23,7 +23,7 @@
che-column-title="Enable"></che-list-header-column>
<che-list-header-column flex="25" layout="column" layout-align="center start"
che-sort-value="workspacePluginsController.pluginOrderBy"
che-sort-item="name"
che-sort-item="displayName"
che-column-title="Plugin"></che-list-header-column>
<che-list-header-column flex="15" layout="column" layout-align="center start"
che-column-title="Version"></che-list-header-column>
Expand All @@ -36,12 +36,12 @@
<che-list class="plugins-list" flex
ng-if="workspacePluginsController.plugins && workspacePluginsController.plugins.length > 0">
<div class="plugin-item"
ng-repeat="plugin in workspacePluginsController.cheListHelper.getVisibleItems() | orderBy:[workspacePluginsController.pluginOrderBy, 'name' ]">
ng-repeat="plugin in workspacePluginsController.cheListHelper.getVisibleItems() | orderBy:[workspacePluginsController.pluginOrderBy, 'displayName' ]">
<che-list-item flex>
<div flex="100"
layout="row"
layout-align="start stretch"
plugin-item-name="{{plugin.name}}"
plugin-item-name="{{plugin.displayName}}"
plugin-item-version="{{plugin.version}}"
class="che-list-item-row">
<div layout="row" layout-align="center center" class="che-list-item-checkbox"></div>
Expand All @@ -51,12 +51,13 @@
<md-switch ng-model="plugin.isEnabled"
ng-change="workspacePluginsController.updatePlugin(plugin)"
aria-label="plugin"
plugin-switch="{{plugin.name}}">
plugin-switch="{{plugin.displayName}}">
</md-switch>
</div>
<!-- Name -->
<div flex="25">
<span class="che-list-item-name" plugin-name="{{plugin.name}}">{{plugin.name}}</span>
<span class="che-list-item-name" plugin-name="{{plugin.displayName}}">{{plugin.displayName}}</span>
<span ng-if="plugin.publisher" class="che-list-item-secondary">({{plugin.publisher}} publisher)</span>
</div>
<!-- Version -->
<div flex="15">
Expand Down
Loading

0 comments on commit 35ce354

Please sign in to comment.