From 846f13e2a139f24a2f9361cfefc084d8843efb37 Mon Sep 17 00:00:00 2001 From: Roman Nikitenko Date: Thu, 31 Oct 2019 15:16:54 +0200 Subject: [PATCH 1/7] Provide ability to edit URL in the preview panel Signed-off-by: Roman Nikitenko --- .../eclipse-che-theia-plugin-ext/package.json | 1 + .../src/browser/che-frontend-module.ts | 7 +- .../browser/che-mini-browser-open-handler.ts | 19 ++++ yarn.lock | 99 +++++++++++++++++++ 4 files changed, 125 insertions(+), 1 deletion(-) create mode 100644 extensions/eclipse-che-theia-plugin-ext/src/browser/che-mini-browser-open-handler.ts diff --git a/extensions/eclipse-che-theia-plugin-ext/package.json b/extensions/eclipse-che-theia-plugin-ext/package.json index fa9170f0db..d82194c237 100644 --- a/extensions/eclipse-che-theia-plugin-ext/package.json +++ b/extensions/eclipse-che-theia-plugin-ext/package.json @@ -16,6 +16,7 @@ "@eclipse-che/plugin": "0.0.1", "@eclipse-che/workspace-client": "latest", "@theia/core": "next", + "@theia/mini-browser": "next", "@theia/plugin-ext": "next", "axios": "0.18.1", "js-yaml": "3.13.1" diff --git a/extensions/eclipse-che-theia-plugin-ext/src/browser/che-frontend-module.ts b/extensions/eclipse-che-theia-plugin-ext/src/browser/che-frontend-module.ts index 81a6699feb..4f9a06e428 100644 --- a/extensions/eclipse-che-theia-plugin-ext/src/browser/che-frontend-module.ts +++ b/extensions/eclipse-che-theia-plugin-ext/src/browser/che-frontend-module.ts @@ -36,8 +36,10 @@ import { ChePluginMenu } from './plugin/che-plugin-menu'; import { ChePluginCommandContribution } from './plugin/che-plugin-command-contribution'; import { bindChePluginPreferences } from './plugin/che-plugin-preferences'; import { CheSideCarContentReaderRegistryImpl, CheSideCarResourceResolver } from './che-sidecar-resource'; +import { CheMiniBrowserOpenHandler } from './che-mini-browser-open-handler'; +import { MiniBrowserOpenHandler } from '@theia/mini-browser/lib/browser/mini-browser-open-handler'; -export default new ContainerModule(bind => { +export default new ContainerModule((bind, unbind, isBound, rebind) => { bind(CheApiProvider).toSelf().inSingletonScope(); bind(MainPluginApiProvider).toService(CheApiProvider); @@ -84,4 +86,7 @@ export default new ContainerModule(bind => { bind(CheSideCarContentReaderRegistry).to(CheSideCarContentReaderRegistryImpl).inSingletonScope(); bind(CheSideCarResourceResolver).toSelf().inSingletonScope(); bind(ResourceResolver).toService(CheSideCarResourceResolver); + + bind(CheMiniBrowserOpenHandler).toSelf().inSingletonScope(); + rebind(MiniBrowserOpenHandler).to(CheMiniBrowserOpenHandler).inSingletonScope(); }); diff --git a/extensions/eclipse-che-theia-plugin-ext/src/browser/che-mini-browser-open-handler.ts b/extensions/eclipse-che-theia-plugin-ext/src/browser/che-mini-browser-open-handler.ts new file mode 100644 index 0000000000..c601751967 --- /dev/null +++ b/extensions/eclipse-che-theia-plugin-ext/src/browser/che-mini-browser-open-handler.ts @@ -0,0 +1,19 @@ +/********************************************************************* + * Copyright (c) 2019 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + **********************************************************************/ + +import { MiniBrowserOpenerOptions, MiniBrowserOpenHandler } from '@theia/mini-browser/lib/browser/mini-browser-open-handler'; + +export class CheMiniBrowserOpenHandler extends MiniBrowserOpenHandler { + + protected async getOpenPreviewProps(startPage: string): Promise { + const miniBrowserOpenerOptions = await super.getOpenPreviewProps(startPage); + return { ...miniBrowserOpenerOptions, toolbar: 'show' }; + } +} diff --git a/yarn.lock b/yarn.lock index c37139cc2a..5e833e2daf 100644 --- a/yarn.lock +++ b/yarn.lock @@ -976,6 +976,22 @@ resolved "https://registry.yarnpkg.com/@sindresorhus/is/-/is-0.7.0.tgz#9a06f4f137ee84d7df0460c1fdb1135ffa6c50fd" integrity sha512-ONhaKPIufzzrlNbqtWFFd+jlnemX6lJAgq9ZeiZtS7I1PIf/la7CW4m83rTXRnVnsMbW2k56pGYu7AUFJD9Pow== +"@theia/application-package@0.12.0-next.8dae8636": + version "0.12.0-next.8dae8636" + resolved "https://registry.yarnpkg.com/@theia/application-package/-/application-package-0.12.0-next.8dae8636.tgz#bef355363190870807c06467c520f4d9218ec675" + integrity sha512-bZPPofs5b39fbYwNqs0yzJ53vKu48AAmD++ILui0lVHbPqWctrMonV+8FOnA6KdJmIxe9LptzXchJcmQaLL3lg== + dependencies: + "@types/fs-extra" "^4.0.2" + "@types/request" "^2.0.3" + "@types/semver" "^5.4.0" + "@types/write-json-file" "^2.2.1" + changes-stream "^2.2.0" + fs-extra "^4.0.2" + is-electron "^2.1.0" + request "^2.82.0" + semver "^5.4.1" + write-json-file "^2.2.0" + "@theia/application-package@0.12.0-next.f255f5a8": version "0.12.0-next.f255f5a8" resolved "https://registry.yarnpkg.com/@theia/application-package/-/application-package-0.12.0-next.f255f5a8.tgz#92707881978fc027fcf5aae587e3f34874be5ed0" @@ -1063,6 +1079,52 @@ ws "^5.2.2" yargs "^11.1.0" +"@theia/core@0.12.0-next.8dae8636": + version "0.12.0-next.8dae8636" + resolved "https://registry.yarnpkg.com/@theia/core/-/core-0.12.0-next.8dae8636.tgz#6f427120443357415b899b182ef72345b687b040" + integrity sha512-XnIkVnvtcirxfXXJ/3I0y9vwBCUlHvqOhwMJglpb9wmYA6KmTLFGIqMzQqaLmLATH47yqzjTJmtJfiQb3yhR8g== + dependencies: + "@babel/runtime" "^7.5.5" + "@phosphor/widgets" "^1.5.0" + "@primer/octicons-react" "^9.0.0" + "@theia/application-package" "0.12.0-next.8dae8636" + "@types/body-parser" "^1.16.4" + "@types/bunyan" "^1.8.0" + "@types/express" "^4.16.0" + "@types/fs-extra" "^4.0.2" + "@types/lodash.debounce" "4.0.3" + "@types/lodash.throttle" "^4.1.3" + "@types/react" "^16.4.1" + "@types/react-dom" "^16.0.6" + "@types/react-virtualized" "^9.18.3" + "@types/route-parser" "^0.1.1" + "@types/ws" "^5.1.2" + "@types/yargs" "^11.1.0" + ajv "^6.5.3" + body-parser "^1.17.2" + es6-promise "^4.2.4" + express "^4.16.3" + file-icons-js "^1.0.3" + font-awesome "^4.7.0" + fs-extra "^4.0.2" + fuzzy "^0.1.3" + inversify "^5.0.1" + lodash.debounce "^4.0.8" + lodash.throttle "^4.1.1" + nsfw "^1.2.2" + perfect-scrollbar "^1.3.0" + react "^16.4.1" + react-dom "^16.4.1" + react-virtualized "^9.20.0" + reconnecting-websocket "^3.0.7" + reflect-metadata "^0.1.10" + route-parser "^0.0.5" + vscode-languageserver-types "^3.15.0-next" + vscode-uri "^1.0.8" + vscode-ws-jsonrpc "^0.1.1" + ws "^7.1.2" + yargs "^11.1.0" + "@theia/core@0.12.0-next.f255f5a8", "@theia/core@next": version "0.12.0-next.f255f5a8" resolved "https://registry.yarnpkg.com/@theia/core/-/core-0.12.0-next.f255f5a8.tgz#b0246f9d3c6478a1e669b5be70b613cda03f1a47" @@ -1175,6 +1237,32 @@ fuzzy "^0.1.3" vscode-ripgrep "^1.2.4" +"@theia/filesystem@0.12.0-next.8dae8636": + version "0.12.0-next.8dae8636" + resolved "https://registry.yarnpkg.com/@theia/filesystem/-/filesystem-0.12.0-next.8dae8636.tgz#062220ac896d78e72da6ce84dcfa0f7a0fc2a741" + integrity sha512-okLu9FqMMx+Lv/6NiQAuXyfwWU5/68AzCMqF4uvaN1S1bqk55ygNfnLhHVJwnx9+3dNN2W/J9ljya68FuDyO3g== + dependencies: + "@theia/application-package" "0.12.0-next.8dae8636" + "@theia/core" "0.12.0-next.8dae8636" + "@types/body-parser" "^1.17.0" + "@types/rimraf" "^2.0.2" + "@types/tar-fs" "^1.16.1" + "@types/touch" "0.0.1" + "@types/uuid" "^3.4.3" + body-parser "^1.18.3" + drivelist "^6.4.3" + http-status-codes "^1.3.0" + iconv-lite "0.4.23" + jschardet "1.6.0" + minimatch "^3.0.4" + mv "^2.1.1" + rimraf "^2.6.2" + tar-fs "^1.16.2" + touch "^3.1.0" + trash "^4.0.1" + uuid "^3.2.1" + zip-dir "^1.0.2" + "@theia/filesystem@0.12.0-next.f255f5a8": version "0.12.0-next.f255f5a8" resolved "https://registry.yarnpkg.com/@theia/filesystem/-/filesystem-0.12.0-next.f255f5a8.tgz#c22ed82f84c9dc9668bb6e529079c46d142464a2" @@ -1319,6 +1407,17 @@ mime-types "^2.1.18" pdfobject "^2.0.201604172" +"@theia/mini-browser@next": + version "0.12.0-next.8dae8636" + resolved "https://registry.yarnpkg.com/@theia/mini-browser/-/mini-browser-0.12.0-next.8dae8636.tgz#b7c646bff68ac2eca4481e420c429b58b1ed7caf" + integrity sha512-8Jq+guCdnUwCCRb8a9sKzP2B1OJ7L9mfZPmi+KM3ael+O8EGNLBMKeSA940r2DBe2lBc8vIcuOOd6j66pO9Svw== + dependencies: + "@theia/core" "0.12.0-next.8dae8636" + "@theia/filesystem" "0.12.0-next.8dae8636" + "@types/mime-types" "^2.1.0" + mime-types "^2.1.18" + pdfobject "^2.0.201604172" + "@theia/monaco@0.12.0-next.f255f5a8": version "0.12.0-next.f255f5a8" resolved "https://registry.yarnpkg.com/@theia/monaco/-/monaco-0.12.0-next.f255f5a8.tgz#d5ff8450c5e26b8f2061adeb0845f66f9919bb3f" From bcf1c25f5cf4619dda0bed114bb372336507b7da Mon Sep 17 00:00:00 2001 From: Artem Zatsarynnyi Date: Mon, 4 Nov 2019 18:29:34 +0200 Subject: [PATCH 2/7] Add Dockerfile for OpenShift Connector plugin v0.1.1 (#529) * Add Dockerfile for OpenShift Connector plugin v0.1.1 Signed-off-by: Artem Zatsarynnyi --- build.include | 2 + .../Dockerfile | 47 +++++++++++++++++++ .../build.sh | 15 ++++++ .../etc/entrypoint.sh | 28 +++++++++++ 4 files changed, 92 insertions(+) create mode 100644 dockerfiles/remote-plugin-openshift-connector-0.1.1/Dockerfile create mode 100755 dockerfiles/remote-plugin-openshift-connector-0.1.1/build.sh create mode 100755 dockerfiles/remote-plugin-openshift-connector-0.1.1/etc/entrypoint.sh diff --git a/build.include b/build.include index 112afa865c..a4a7b8692f 100644 --- a/build.include +++ b/build.include @@ -79,6 +79,7 @@ DOCKER_FILES_LOCATIONS=( dockerfiles/remote-plugin-openshift-connector-0.0.17 dockerfiles/remote-plugin-openshift-connector-0.0.21 dockerfiles/remote-plugin-openshift-connector-0.1.0 + dockerfiles/remote-plugin-openshift-connector-0.1.1 dockerfiles/remote-plugin-camelk-0.0.9 dockerfiles/remote-plugin-dependency-analytics-0.0.12 dockerfiles/remote-plugin-dependency-analytics-0.0.13 @@ -104,6 +105,7 @@ PUBLISH_IMAGES_LIST=( eclipse/che-remote-plugin-openshift-connector-0.0.17 eclipse/che-remote-plugin-openshift-connector-0.0.21 eclipse/che-remote-plugin-openshift-connector-0.1.0 + eclipse/che-remote-plugin-openshift-connector-0.1.1 eclipse/che-remote-plugin-camelk-0.0.9 eclipse/che-remote-plugin-dependency-analytics-0.0.12 eclipse/che-remote-plugin-dependency-analytics-0.0.13 diff --git a/dockerfiles/remote-plugin-openshift-connector-0.1.1/Dockerfile b/dockerfiles/remote-plugin-openshift-connector-0.1.1/Dockerfile new file mode 100644 index 0000000000..a833fcf8ab --- /dev/null +++ b/dockerfiles/remote-plugin-openshift-connector-0.1.1/Dockerfile @@ -0,0 +1,47 @@ +# Copyright (c) 2019 Red Hat, Inc. +# This program and the accompanying materials are made +# available under the terms of the Eclipse Public License 2.0 +# which is available at https://www.eclipse.org/legal/epl-2.0/ +# +# SPDX-License-Identifier: EPL-2.0 +# +# Contributors: +# Red Hat, Inc. - initial API and implementation + +FROM alpine:3.10.2 + +ENV HOME=/home/theia + +RUN mkdir /projects ${HOME} && \ + # Change permissions to let any arbitrary user + for f in "${HOME}" "/etc/passwd" "/projects"; do \ + echo "Changing permissions on ${f}" && chgrp -R 0 ${f} && \ + chmod -R g+rwX ${f}; \ + done + +ENV GLIBC_VERSION=2.30-r0 \ + ODO_VERSION=v1.0.0 \ + OC_VERSION=v3.11.0 \ + OC_TAG=0cbc58b \ + KUBECTL_VERSION=v1.16.2 + +# plugin executes the commands relying on Bash +RUN apk add --update --no-cache bash && \ + # install glibc compatibility layer package for Alpine Linux + # see https://github.com/openshift/origin/issues/18942 for the details + wget -O glibc-${GLIBC_VERSION}.apk https://github.com/andyshinn/alpine-pkg-glibc/releases/download/${GLIBC_VERSION}/glibc-${GLIBC_VERSION}.apk && \ + apk --update --allow-untrusted add glibc-${GLIBC_VERSION}.apk && \ + rm -f glibc-${GLIBC_VERSION}.apk && \ + # install oc + wget -O- https://github.com/openshift/origin/releases/download/${OC_VERSION}/openshift-origin-client-tools-${OC_VERSION}-${OC_TAG}-linux-64bit.tar.gz | tar xvz -C /usr/local/bin --strip 1 && \ + # install odo + wget -O /usr/local/bin/odo https://mirror.openshift.com/pub/openshift-v4/clients/odo/${ODO_VERSION}/odo-linux-amd64 && \ + chmod +x /usr/local/bin/odo && \ + # install kubectl + wget -O /usr/local/bin/kubectl https://storage.googleapis.com/kubernetes-release/release/${KUBECTL_VERSION}/bin/linux/amd64/kubectl && \ + chmod +x /usr/local/bin/kubectl + +ADD etc/entrypoint.sh /entrypoint.sh + +ENTRYPOINT [ "/entrypoint.sh" ] +CMD ${PLUGIN_REMOTE_ENDPOINT_EXECUTABLE} diff --git a/dockerfiles/remote-plugin-openshift-connector-0.1.1/build.sh b/dockerfiles/remote-plugin-openshift-connector-0.1.1/build.sh new file mode 100755 index 0000000000..ec0c9faa73 --- /dev/null +++ b/dockerfiles/remote-plugin-openshift-connector-0.1.1/build.sh @@ -0,0 +1,15 @@ +#!/bin/bash +# +# Copyright (c) 2019 Red Hat, Inc. +# This program and the accompanying materials are made +# available under the terms of the Eclipse Public License 2.0 +# which is available at https://www.eclipse.org/legal/epl-2.0/ +# +# SPDX-License-Identifier: EPL-2.0 +# + +base_dir=$(cd "$(dirname "$0")"; pwd) +. "${base_dir}"/../build.include + +init --name:remote-plugin-openshift-connector-0.1.1 "$@" +build diff --git a/dockerfiles/remote-plugin-openshift-connector-0.1.1/etc/entrypoint.sh b/dockerfiles/remote-plugin-openshift-connector-0.1.1/etc/entrypoint.sh new file mode 100755 index 0000000000..d9769b86e1 --- /dev/null +++ b/dockerfiles/remote-plugin-openshift-connector-0.1.1/etc/entrypoint.sh @@ -0,0 +1,28 @@ +#!/bin/sh +# +# Copyright (c) 2018-2018 Red Hat, Inc. +# This program and the accompanying materials are made +# available under the terms of the Eclipse Public License 2.0 +# which is available at https://www.eclipse.org/legal/epl-2.0/ +# +# SPDX-License-Identifier: EPL-2.0 +# +# Contributors: +# Red Hat, Inc. - initial API and implementation +# + +set -e + +export USER_ID=$(id -u) +export GROUP_ID=$(id -g) + +if ! whoami >/dev/null 2>&1; then + echo "${USER_NAME:-user}:x:${USER_ID}:0:${USER_NAME:-user} user:${HOME}:/bin/sh" >> /etc/passwd +fi + +# Grant access to projects volume in case of non root user with sudo rights +if [ "${USER_ID}" -ne 0 ] && command -v sudo >/dev/null 2>&1 && sudo -n true > /dev/null 2>&1; then + sudo chown "${USER_ID}:${GROUP_ID}" /projects +fi + +exec "$@" From a3302d1611326a661245003f66e369d56d69d871 Mon Sep 17 00:00:00 2001 From: Oleksii Orel Date: Sun, 3 Nov 2019 19:59:08 +0200 Subject: [PATCH 3/7] fix a resize failed error in the browser console Signed-off-by: Oleksii Orel --- .../src/browser/terminal-widget/remote-terminal-widget.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/eclipse-che-theia-terminal/src/browser/terminal-widget/remote-terminal-widget.ts b/extensions/eclipse-che-theia-terminal/src/browser/terminal-widget/remote-terminal-widget.ts index 3fce041206..2ef9df8028 100644 --- a/extensions/eclipse-che-theia-terminal/src/browser/terminal-widget/remote-terminal-widget.ts +++ b/extensions/eclipse-che-theia-terminal/src/browser/terminal-widget/remote-terminal-widget.ts @@ -261,7 +261,7 @@ export class RemoteTerminalWidget extends TerminalWidgetImpl { const cols = this.term.cols; const rows = this.term.rows; - if (this.termServer) { + if (this.termServer && this.termServer.resize) { this.termServer.resize({ id: this.terminalId, cols, rows }); } } From 9991c06c07ef55e9ef0a296af66259889bedf071 Mon Sep 17 00:00:00 2001 From: Mykola Morhun Date: Tue, 5 Nov 2019 10:20:55 +0200 Subject: [PATCH 4/7] Fix terminal not found error on terminal start (#531) Signed-off-by: Mykola.Morhun --- .../browser/terminal-widget/remote-terminal-widget.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/extensions/eclipse-che-theia-terminal/src/browser/terminal-widget/remote-terminal-widget.ts b/extensions/eclipse-che-theia-terminal/src/browser/terminal-widget/remote-terminal-widget.ts index 2ef9df8028..a398bf9b1a 100644 --- a/extensions/eclipse-che-theia-terminal/src/browser/terminal-widget/remote-terminal-widget.ts +++ b/extensions/eclipse-che-theia-terminal/src/browser/terminal-widget/remote-terminal-widget.ts @@ -158,6 +158,14 @@ export class RemoteTerminalWidget extends TerminalWidgetImpl { await this.connectSocket(this.terminalId); } + get cwd(): Promise { + // It is not possible to retrieve current working directory of a terminal process which is run via exec mechanism. + // But we have to override this method to avoid requesting wrong terminal backend. + // Returning empty cwd will result in some features not working in some cases (for example opening files in editor by + // relative link from terminal with exec backend), however it will prevent some errors. + return Promise.resolve(new URI()); + } + get processId(): Promise { return (async () => { if (!IBaseTerminalServer.validateId(this.terminalId)) { @@ -186,8 +194,8 @@ export class RemoteTerminalWidget extends TerminalWidgetImpl { socket.onmessage = ev => this.write(ev.data); this.toDispose.push(Disposable.create(() => { - socket.close(); this.term.off('data', sendListener); + socket.close(); })); this.isOpen = true; From af1260445f47d8162707396d52906b737d8e9731 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Pupier?= Date: Mon, 4 Nov 2019 16:03:00 +0100 Subject: [PATCH 5/7] feat(core) Use a newer Kamel executable for the latest VS Code Camel K Tooling extension eclipse/che#15086 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Aurélien Pupier --- build.include | 2 ++ .../remote-plugin-camelk-0.0.10/Dockerfile | 15 +++++++++++++++ dockerfiles/remote-plugin-camelk-0.0.10/build.sh | 15 +++++++++++++++ 3 files changed, 32 insertions(+) create mode 100644 dockerfiles/remote-plugin-camelk-0.0.10/Dockerfile create mode 100755 dockerfiles/remote-plugin-camelk-0.0.10/build.sh diff --git a/build.include b/build.include index a4a7b8692f..e61af45a42 100644 --- a/build.include +++ b/build.include @@ -81,6 +81,7 @@ DOCKER_FILES_LOCATIONS=( dockerfiles/remote-plugin-openshift-connector-0.1.0 dockerfiles/remote-plugin-openshift-connector-0.1.1 dockerfiles/remote-plugin-camelk-0.0.9 + dockerfiles/remote-plugin-camelk-0.0.10 dockerfiles/remote-plugin-dependency-analytics-0.0.12 dockerfiles/remote-plugin-dependency-analytics-0.0.13 ) @@ -107,6 +108,7 @@ PUBLISH_IMAGES_LIST=( eclipse/che-remote-plugin-openshift-connector-0.1.0 eclipse/che-remote-plugin-openshift-connector-0.1.1 eclipse/che-remote-plugin-camelk-0.0.9 + eclipse/che-remote-plugin-camelk-0.0.10 eclipse/che-remote-plugin-dependency-analytics-0.0.12 eclipse/che-remote-plugin-dependency-analytics-0.0.13 ) diff --git a/dockerfiles/remote-plugin-camelk-0.0.10/Dockerfile b/dockerfiles/remote-plugin-camelk-0.0.10/Dockerfile new file mode 100644 index 0000000000..ff225957e7 --- /dev/null +++ b/dockerfiles/remote-plugin-camelk-0.0.10/Dockerfile @@ -0,0 +1,15 @@ +# Copyright (c) 2019 Red Hat, Inc. +# This program and the accompanying materials are made +# available under the terms of the Eclipse Public License 2.0 +# which is available at https://www.eclipse.org/legal/epl-2.0/ +# +# SPDX-License-Identifier: EPL-2.0 +# +# Contributors: +# Red Hat, Inc. - initial API and implementation +FROM ${BUILD_ORGANIZATION}/che-remote-plugin-kubernetes-tooling-1.0.0:${BUILD_TAG} + +ENV KAMEL_VERSION 1.0.0-M3 + +RUN curl -L https://github.com/apache/camel-k/releases/download/${KAMEL_VERSION}/camel-k-client-${KAMEL_VERSION}-linux-64bit.tar.gz | tar -C /usr/local/bin -xz \ + && chmod +x /usr/local/bin/kamel diff --git a/dockerfiles/remote-plugin-camelk-0.0.10/build.sh b/dockerfiles/remote-plugin-camelk-0.0.10/build.sh new file mode 100755 index 0000000000..c924be06f2 --- /dev/null +++ b/dockerfiles/remote-plugin-camelk-0.0.10/build.sh @@ -0,0 +1,15 @@ +#!/bin/bash +# +# Copyright (c) 2019 Red Hat, Inc. +# This program and the accompanying materials are made +# available under the terms of the Eclipse Public License 2.0 +# which is available at https://www.eclipse.org/legal/epl-2.0/ +# +# SPDX-License-Identifier: EPL-2.0 +# + +base_dir=$(cd "$(dirname "$0")"; pwd) +. "${base_dir}"/../build.include + +init --name:remote-plugin-camelk-0.0.10 "$@" +build From 727bc2d9ff7531a7a466a1d485ce675e9510b531 Mon Sep 17 00:00:00 2001 From: Vitaliy Gulyy Date: Thu, 7 Nov 2019 14:08:37 +0200 Subject: [PATCH 6/7] Omit git history, increase timeout (#534) Signed-off-by: Vitaliy Guliy --- generator/src/init-sources.ts | 13 +- generator/src/repository.ts | 19 +-- .../tests/init-sources/init-sources.spec.ts | 126 +++++++++++++++--- 3 files changed, 131 insertions(+), 27 deletions(-) diff --git a/generator/src/init-sources.ts b/generator/src/init-sources.ts index a4fe719d02..4b3e1a6c1f 100644 --- a/generator/src/init-sources.ts +++ b/generator/src/init-sources.ts @@ -53,6 +53,11 @@ export class InitSources { */ private globalDevDependencies = new Map(); + /** + * Will clone sources keeping or omiting the history + */ + private keepHistory: boolean = true; + /** * Constructor */ @@ -62,7 +67,13 @@ export class InitSources { readonly cheTheiaFolder: string, readonly assemblyFolder: string, readonly theiaVersion: string) { + } + /** + * Keep or omit git history when cloning sources + */ + set keepGitHistory(value: boolean) { + this.keepHistory = value; } /** @@ -272,7 +283,7 @@ export class InitSources { } else { Logger.info(`Cloning ${extension.source}...`); const repository = new Repository(extension.source); - extension.clonedDir = await repository.clone(this.cheTheiaFolder, repository.getRepositoryName(), extension.checkoutTo); + extension.clonedDir = await repository.clone(this.cheTheiaFolder, repository.getRepositoryName(), extension.checkoutTo, this.keepHistory); } } diff --git a/generator/src/repository.ts b/generator/src/repository.ts index 2d0b52e226..21819a310d 100644 --- a/generator/src/repository.ts +++ b/generator/src/repository.ts @@ -43,18 +43,21 @@ export class Repository { * @param checkoutFolder the CWD / directory where to launch the clone operation * @param dest the destination folder of the clone * @param checkoutTo the optional branch/tag to use when cloning + * @param keepHistory the optional flag to keep / omit git history */ - public async clone(checkoutFolder: string, dest: string, checkoutTo?: string): Promise { + public async clone(checkoutFolder: string, dest: string, checkoutTo?: string, keepHistory: boolean = true): Promise { const commandTheiaFolder = new Command(checkoutFolder); - await commandTheiaFolder.exec(`git clone ${this.uri} ${dest}`); - const clonedDir = path.resolve(checkoutFolder, dest); - if (checkoutTo) { - // need to change checkout - const commandClonedDir = new Command(clonedDir); - await commandClonedDir.exec(`git checkout -f ${checkoutTo}`); - } + // Use -b to clone the specific branch + let opts = checkoutTo ? `-b ${checkoutTo}` : ''; + + // Use --single-branch and --depth to omit git history + opts += keepHistory ? '' : ' --single-branch --depth 1'; + await commandTheiaFolder.exec(`git clone ${opts} ${this.uri} ${dest}`); + + const clonedDir = path.resolve(checkoutFolder, dest); return clonedDir; } + } diff --git a/generator/tests/init-sources/init-sources.spec.ts b/generator/tests/init-sources/init-sources.spec.ts index 06878ed414..dfcc85cb64 100644 --- a/generator/tests/init-sources/init-sources.spec.ts +++ b/generator/tests/init-sources/init-sources.spec.ts @@ -21,6 +21,9 @@ import { YargsMockup } from "../cdn.spec"; describe("Test Extensions", () => { + // Increase timeout to 30 seconds + jest.setTimeout(30000); + const THEIA_DUMMY_VERSION = '1.2.3'; const rootFolder = process.cwd(); const assemblyExamplePath = path.resolve(rootFolder, "tests/init-sources/assembly-example"); @@ -46,7 +49,6 @@ describe("Test Extensions", () => { sourceExtension2Tmp = path.resolve(rootFolderTmp, 'source-code2'); extensionYamlTmp = path.resolve(rootFolderTmp, 'extensions.yml'); - await fs.ensureDir(rootFolderTmp); await fs.ensureDir(packagesFolderTmp); await fs.ensureDir(pluginsFolderTmp); @@ -69,7 +71,6 @@ describe("Test Extensions", () => { cp.execSync('git config --local user.email user@example.com', { cwd: path }); cp.execSync(`git add ${path}`, { cwd: path }); cp.execSync(`git commit -m "Init repo"`, { cwd: path }); - } afterEach(() => { @@ -77,10 +78,14 @@ describe("Test Extensions", () => { fs.removeSync(rootFolderTmp); }); - test("test init sources generator", async () => { - - const initSources = new InitSources(assemblyExamplePath, packagesFolderTmp, pluginsFolderTmp, cheTheiaFolderTmp, assemblyFolderTmp, THEIA_DUMMY_VERSION); + const initSources = new InitSources( + assemblyExamplePath, + packagesFolderTmp, + pluginsFolderTmp, + cheTheiaFolderTmp, + assemblyFolderTmp, + THEIA_DUMMY_VERSION); const yamlExtensionsContent = { sources: [ @@ -98,6 +103,7 @@ describe("Test Extensions", () => { const yml = json2yaml.stringify(yamlExtensionsContent); fs.writeFileSync(extensionYamlTmp, yml); + initSources.keepGitHistory = false; await initSources.generate(extensionYamlTmp); // need to perform checks @@ -135,18 +141,29 @@ describe("Test Extensions", () => { expect(assemblyPackage.dependencies['@che-theia/sample1']).toBe('0.1.2'); expect(assemblyPackage.dependencies['@che-theia/sample2']).toBe('6.7.8'); expect(assemblyPackage.dependencies['@che-theia/extension-example2']).toBe('9.8.7'); - - }); test('extension with empty dependencies', async () => { - const initSources = new InitSources(assemblyExamplePath, packagesFolderTmp, pluginsFolderTmp, cheTheiaFolderTmp, assemblyFolderTmp, THEIA_DUMMY_VERSION); + const initSources = new InitSources( + assemblyExamplePath, + packagesFolderTmp, + pluginsFolderTmp, + cheTheiaFolderTmp, + assemblyFolderTmp, + THEIA_DUMMY_VERSION); + await initSources.updateDependencies({ extSymbolicLinks: [path.resolve(rootFolder, "tests/init-sources/extension-empty")] } as ISource, false); expect(true).toBeTruthy(); }); test('extensions with dev mode', async () => { - const initSources = new InitSources(assemblyExamplePath, packagesFolderTmp, pluginsFolderTmp, cheTheiaFolderTmp, assemblyFolderTmp, THEIA_DUMMY_VERSION); + const initSources = new InitSources( + assemblyExamplePath, + packagesFolderTmp, + pluginsFolderTmp, + cheTheiaFolderTmp, + assemblyFolderTmp, + THEIA_DUMMY_VERSION); const yamlExtensionsContent = { sources: [ @@ -164,6 +181,7 @@ describe("Test Extensions", () => { const yml = json2yaml.stringify(yamlExtensionsContent); fs.writeFileSync(extensionYamlTmp, yml); + initSources.keepGitHistory = false; await initSources.generate(extensionYamlTmp, true); // check symlink are ok as well @@ -174,7 +192,13 @@ describe("Test Extensions", () => { }); test('use provided extensions', async () => { - const initSources = new InitSources(assemblyExamplePath, packagesFolderTmp, pluginsFolderTmp, cheTheiaFolderTmp, assemblyFolderTmp, THEIA_DUMMY_VERSION); + const initSources = new InitSources( + assemblyExamplePath, + packagesFolderTmp, + pluginsFolderTmp, + cheTheiaFolderTmp, + assemblyFolderTmp, + THEIA_DUMMY_VERSION); const yamlExtensionsContent = { sources: [ @@ -192,6 +216,7 @@ describe("Test Extensions", () => { const yml = json2yaml.stringify(yamlExtensionsContent); fs.writeFileSync(extensionYamlTmp, yml); + initSources.keepGitHistory = false; await initSources.readConfigurationAndGenerate(extensionYamlTmp, false); const ext1Folder1Link = await fs.readlink(path.join(packagesFolderTmp, `${InitSources.PREFIX_PACKAGES_EXTENSIONS}folder1`)); @@ -201,13 +226,28 @@ describe("Test Extensions", () => { }); test('use default extensions', async () => { - const initSources = new InitSources(assemblyExamplePath, packagesFolderTmp, pluginsFolderTmp, cheTheiaFolderTmp, assemblyFolderTmp, THEIA_DUMMY_VERSION); + const initSources = new InitSources( + assemblyExamplePath, + packagesFolderTmp, + pluginsFolderTmp, + cheTheiaFolderTmp, + assemblyFolderTmp, + THEIA_DUMMY_VERSION); + + initSources.keepGitHistory = false; await initSources.readConfigurationAndGenerate(undefined, false); + expect(fs.readdirSync(packagesFolderTmp).length).toBeGreaterThan(0); }); test('use provided extensions with dev mode', async () => { - const initSources = new InitSources(assemblyExamplePath, packagesFolderTmp, pluginsFolderTmp, cheTheiaFolderTmp, assemblyFolderTmp, THEIA_DUMMY_VERSION); + const initSources = new InitSources( + assemblyExamplePath, + packagesFolderTmp, + pluginsFolderTmp, + cheTheiaFolderTmp, + assemblyFolderTmp, + THEIA_DUMMY_VERSION); const yamlExtensionsContent = { sources: [ @@ -225,6 +265,7 @@ describe("Test Extensions", () => { const yml = json2yaml.stringify(yamlExtensionsContent); fs.writeFileSync(extensionYamlTmp, yml); + initSources.keepGitHistory = false; await initSources.readConfigurationAndGenerate(extensionYamlTmp, true); const ext1Folder1Link = await fs.readlink(path.join(packagesFolderTmp, `${InitSources.PREFIX_PACKAGES_EXTENSIONS}folder1`)); @@ -234,7 +275,14 @@ describe("Test Extensions", () => { }); test('use default extensions with dev mode', async () => { - const initSources = new InitSources(assemblyExamplePath, packagesFolderTmp, pluginsFolderTmp, cheTheiaFolderTmp, assemblyFolderTmp, THEIA_DUMMY_VERSION); + const initSources = new InitSources( + assemblyExamplePath, + packagesFolderTmp, + pluginsFolderTmp, + cheTheiaFolderTmp, + assemblyFolderTmp, + THEIA_DUMMY_VERSION); + let generateCalled = false; let configurationContent = undefined; initSources.generate = jest.fn(async (path: string) => { @@ -242,6 +290,7 @@ describe("Test Extensions", () => { configurationContent = fs.readFileSync(path).toString(); }); + initSources.keepGitHistory = false; await initSources.readConfigurationAndGenerate(undefined, true); expect(generateCalled).toBe(true); @@ -249,7 +298,14 @@ describe("Test Extensions", () => { }); test('throw error if path to configuration does not exist', async () => { - const initSources = new InitSources(assemblyExamplePath, packagesFolderTmp, pluginsFolderTmp, cheTheiaFolderTmp, assemblyFolderTmp, THEIA_DUMMY_VERSION); + const initSources = new InitSources( + assemblyExamplePath, + packagesFolderTmp, + pluginsFolderTmp, + cheTheiaFolderTmp, + assemblyFolderTmp, + THEIA_DUMMY_VERSION); + try { await initSources.readConfigurationAndGenerate('some/path/foo/bar.yaml', false); } catch (e) { @@ -259,7 +315,14 @@ describe("Test Extensions", () => { }); test('default extension uri is unreachable', async () => { - const initSources = new InitSources(assemblyExamplePath, packagesFolderTmp, pluginsFolderTmp, cheTheiaFolderTmp, assemblyFolderTmp, THEIA_DUMMY_VERSION); + const initSources = new InitSources( + assemblyExamplePath, + packagesFolderTmp, + pluginsFolderTmp, + cheTheiaFolderTmp, + assemblyFolderTmp, + THEIA_DUMMY_VERSION); + let uri: string = InitSources.DEFAULT_EXTENSIONS_URI; try { (InitSources)['DEFAULT_EXTENSIONS_URI'] = 'https://foobarfoo.com/foo/bar'; @@ -287,8 +350,15 @@ describe("Test Extensions", () => { default: false, }); }); + test('use extensions and plugins', async () => { - const initSources = new InitSources(assemblyExamplePath, packagesFolderTmp, pluginsFolderTmp, cheTheiaFolderTmp, assemblyFolderTmp, THEIA_DUMMY_VERSION); + const initSources = new InitSources( + assemblyExamplePath, + packagesFolderTmp, + pluginsFolderTmp, + cheTheiaFolderTmp, + assemblyFolderTmp, + THEIA_DUMMY_VERSION); const yamlExtensionsContent = { sources: [ @@ -307,6 +377,7 @@ describe("Test Extensions", () => { const yml = json2yaml.stringify(yamlExtensionsContent); fs.writeFileSync(extensionYamlTmp, yml); + initSources.keepGitHistory = false; await initSources.readConfigurationAndGenerate(extensionYamlTmp, false); const ext1Folder1Link = await fs.readlink(path.join(packagesFolderTmp, `${InitSources.PREFIX_PACKAGES_EXTENSIONS}folder1`)); @@ -322,9 +393,18 @@ describe("Test Extensions", () => { }); test('aliases replace with local source folder', async () => { - const initSources = new InitSources(assemblyExamplePath, packagesFolderTmp, pluginsFolderTmp, cheTheiaFolderTmp, assemblyFolderTmp, THEIA_DUMMY_VERSION); + const initSources = new InitSources( + assemblyExamplePath, + packagesFolderTmp, + pluginsFolderTmp, + cheTheiaFolderTmp, + assemblyFolderTmp, + THEIA_DUMMY_VERSION); + const aliases = ['https://github.com/eclipse/che-theia=../che-theia', 'key1=value1', '../test=https://github.com/eclipse/che-theia']; + initSources.initSourceLocationAliases(aliases); + expect(initSources.sourceLocationAliases.get('https://github.com/eclipse/che-theia')).toBe('../che-theia'); expect(initSources.sourceLocationAliases.get('../test')).toBe('https://github.com/eclipse/che-theia'); expect(initSources.sourceLocationAliases.get('test')).toBeUndefined(); @@ -342,8 +422,18 @@ describe("Test Extensions", () => { extSymbolicLinks: [], pluginSymbolicLinks: [] }; - const initSources = new InitSources(assemblyExamplePath, packagesFolderTmp, pluginsFolderTmp, cheTheiaFolderTmp, assemblyFolderTmp, THEIA_DUMMY_VERSION); + + const initSources = new InitSources( + assemblyExamplePath, + packagesFolderTmp, + pluginsFolderTmp, + cheTheiaFolderTmp, + assemblyFolderTmp, + THEIA_DUMMY_VERSION); + + initSources.keepGitHistory = false; initSources.clone(source); + expect(source.clonedDir).toBe(sourceExtension1Tmp); }) }); From dd0f1b6ac38b75f3af29eb057600c28064d7a3b0 Mon Sep 17 00:00:00 2001 From: Vitaliy Gulyy Date: Thu, 7 Nov 2019 17:18:46 +0200 Subject: [PATCH 7/7] Fix notification in Plugins view (#535) * Fix notification in Plugins view Signed-off-by: che * Fix notification text in Plugins view Signed-off-by: Vitaliy Guliy --- .../src/browser/plugin/che-plugin-widget.tsx | 9 ++++--- .../src/browser/style/che-plugins.css | 25 ++++++++++++++++--- 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/extensions/eclipse-che-theia-plugin-ext/src/browser/plugin/che-plugin-widget.tsx b/extensions/eclipse-che-theia-plugin-ext/src/browser/plugin/che-plugin-widget.tsx index 975784f930..64a578ab3b 100644 --- a/extensions/eclipse-che-theia-plugin-ext/src/browser/plugin/che-plugin-widget.tsx +++ b/extensions/eclipse-che-theia-plugin-ext/src/browser/plugin/che-plugin-widget.tsx @@ -199,13 +199,14 @@ export class ChePluginWidget extends ReactWidget { const notificationStyle = this.hidingRestartWorkspaceNotification ? 'notification hiding' : 'notification'; return
-
-   - Click here to apply changes and restart your workspace +
+
+
Click here to apply changes and restart your workspace
-
+
diff --git a/extensions/eclipse-che-theia-plugin-ext/src/browser/style/che-plugins.css b/extensions/eclipse-che-theia-plugin-ext/src/browser/style/che-plugins.css index d4b484a2c4..fe790b7910 100644 --- a/extensions/eclipse-che-theia-plugin-ext/src/browser/style/che-plugins.css +++ b/extensions/eclipse-che-theia-plugin-ext/src/browser/style/che-plugins.css @@ -50,14 +50,31 @@ top: 9px; right: 28px; height: 28px; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; line-height: 28px; - padding-left: 9px; + overflow: hidden; cursor: pointer; } +.notification-message-icon { + position: absolute; + left: 0px; + top: 0px; + width: 28px; + height: 28px; + text-align: center; +} + +.notification-message-text { + position: absolute; + left: 28px; + right: 0px; + top: 0px; + bottom: 0px; + white-space: nowrap; + text-overflow: ellipsis; + overflow: hidden; +} + .che-plugins-notification .notification:hover { background-color: var(--theia-success-color1); }