From 70edcb846d749ed851ed638942e7eb7bc486f54b Mon Sep 17 00:00:00 2001 From: Jean Pierre Date: Wed, 25 Aug 2021 02:30:39 +0000 Subject: [PATCH] Add action to copy share workspace link Add copy url action to share ws notification Consume new getWorkspaceUrl api Update supervisor-api-grpc --- extensions/gitpod-shared/package.json | 2 +- extensions/gitpod-shared/src/features.ts | 7 ++++++- extensions/yarn.lock | 8 ++++---- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/extensions/gitpod-shared/package.json b/extensions/gitpod-shared/package.json index 05b5c8a74915d8..d57e48c16012cd 100644 --- a/extensions/gitpod-shared/package.json +++ b/extensions/gitpod-shared/package.json @@ -16,7 +16,7 @@ }, "dependencies": { "@gitpod/gitpod-protocol": "main", - "@gitpod/supervisor-api-grpc": "main", + "@gitpod/supervisor-api-grpc": "jeanp413-your-workspace-is-currently-5313", "bufferutil": "^4.0.1", "reconnecting-websocket": "^4.4.0", "utf-8-validate": "^5.0.2", diff --git a/extensions/gitpod-shared/src/features.ts b/extensions/gitpod-shared/src/features.ts index 4effb2b0248009..19b0d1c1b2edf4 100644 --- a/extensions/gitpod-shared/src/features.ts +++ b/extensions/gitpod-shared/src/features.ts @@ -435,7 +435,12 @@ export async function registerWorkspaceSharing(context: GitpodExtensionContext): }); setWorkspaceShared(level === 'everyone'); if (level === 'everyone') { - await vscode.window.showInformationMessage(`Your workspace is currently shared. Anyone with the link can access this workspace.`); + const uri = context.info.getWorkspaceUrl(); + const copyToClipboard = 'Copy URL to Clipboard'; + const res = await vscode.window.showInformationMessage(`Your workspace is currently shared. Anyone with [the link](${uri}) can access this workspace.`, copyToClipboard); + if (res === copyToClipboard) { + await vscode.env.clipboard.writeText(uri); + } } else { await vscode.window.showInformationMessage(`Your workspace is currently not shared. Only you can access it.`); } diff --git a/extensions/yarn.lock b/extensions/yarn.lock index f35f70f726ee84..17b541bc90b0d5 100644 --- a/extensions/yarn.lock +++ b/extensions/yarn.lock @@ -31,10 +31,10 @@ "@improbable-eng/grpc-web" "0.14.0" google-protobuf "^3.17.0" -"@gitpod/supervisor-api-grpc@main": - version "0.1.5-main.1291" - resolved "https://registry.yarnpkg.com/@gitpod/supervisor-api-grpc/-/supervisor-api-grpc-0.1.5-main.1291.tgz#4b30571d6e5934fefceec8bc9c34506904d05e6c" - integrity sha512-+N6kFrpzB+Ljk2CO/2XZB7btgBdnx5LiiyjSnwJShn9XHju+eao9rzH/ZrChUbDVb/POFnwl1zfsBpISQChV3Q== +"@gitpod/supervisor-api-grpc@jeanp413-your-workspace-is-currently-5313": + version "0.1.5-jeanp413-your-workspace-is-currently-5313.0" + resolved "https://registry.yarnpkg.com/@gitpod/supervisor-api-grpc/-/supervisor-api-grpc-0.1.5-jeanp413-your-workspace-is-currently-5313.0.tgz#dae4e6c93d324f8df72d34320c6a9281c82a2c86" + integrity sha512-/4Y5bQ1braB4yxD5C5m9+2kdpqj5xwP0d9eUXqZ5i6S16uV1Qr0jqinKDOFRo0XT3/jdrvZyhU9THmOGNHzVGQ== dependencies: "@grpc/grpc-js" "^1.3.6" google-protobuf "^3.17.3"