Skip to content

Commit

Permalink
disable desktop support for stable
Browse files Browse the repository at this point in the history
  • Loading branch information
akosyakov committed Aug 30, 2021
1 parent 10009f5 commit 330c9b3
Show file tree
Hide file tree
Showing 8 changed files with 60 additions and 54 deletions.
14 changes: 7 additions & 7 deletions extensions/gitpod-remote/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,17 +103,17 @@
{
"command": "gitpod.openInStable",
"title": "%openInStable%",
"enablement": "gitpod.inWorkspace == true && gitpod.UIKind == 'web'"
"enablement": "gitpod.inWorkspace == true && gitpod.UIKind == 'web' && gitpod.ideAlias == 'code-latest'"
},
{
"command": "gitpod.openInInsiders",
"title": "%openInInsiders%",
"enablement": "gitpod.inWorkspace == true && gitpod.UIKind == 'web'"
"enablement": "gitpod.inWorkspace == true && gitpod.UIKind == 'web' && gitpod.ideAlias == 'code-latest'"
},
{
"command": "gitpod.openInBrowser",
"title": "%openInBrowser%",
"enablement": "gitpod.inWorkspace == true && gitpod.UIKind == 'desktop'"
"enablement": "gitpod.inWorkspace == true && gitpod.UIKind == 'desktop' && gitpod.ideAlias == 'code-latest'"
}
],
"menus": {
Expand Down Expand Up @@ -196,17 +196,17 @@
{
"command": "gitpod.openInStable",
"group": "remote_00_gitpod_navigation@900",
"when": "gitpod.inWorkspace == true && gitpod.UIKind == 'web'"
"when": "gitpod.inWorkspace == true && gitpod.UIKind == 'web' && gitpod.ideAlias == 'code-latest'"
},
{
"command": "gitpod.openInInsiders",
"group": "remote_00_gitpod_navigation@1000",
"when": "gitpod.inWorkspace == true && gitpod.UIKind == 'web'"
"when": "gitpod.inWorkspace == true && gitpod.UIKind == 'web' && gitpod.ideAlias == 'code-latest'"
},
{
"command": "gitpod.openInBrowser",
"group": "remote_00_gitpod_navigation@1000",
"when": "gitpod.inWorkspace == true && gitpod.UIKind == 'desktop'"
"when": "gitpod.inWorkspace == true && gitpod.UIKind == 'desktop' && gitpod.ideAlias == 'code-latest'"
}
]
}
Expand All @@ -221,4 +221,4 @@
"gitpod-shared": "0.0.1",
"vscode-nls": "^5.0.0"
}
}
}
4 changes: 1 addition & 3 deletions extensions/gitpod-remote/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,12 @@ export function registerCLI(context: GitpodExtensionContext): void {
return;
}

// TODO(ak) fetch ide port from supervisor
const idePort = Number(process.env.GITPOD_THEIA_PORT);
async function updateIpcHookCli(): Promise<void> {
try {
await new Promise<void>((resolve, reject) => {
const req = http.request({
hostname: 'localhost',
port: idePort,
port: context.info.getIdePort(),
protocol: 'http:',
path: '/cli',
method: vscode.window.state.focused ? 'PUT' : 'DELETE'
Expand Down
2 changes: 1 addition & 1 deletion extensions/gitpod-shared/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
},
"dependencies": {
"@gitpod/gitpod-protocol": "main",
"@gitpod/supervisor-api-grpc": "jeanp413-your-workspace-is-currently-5313",
"@gitpod/supervisor-api-grpc": "ak-no-code-desktop-in-stable",
"bufferutil": "^4.0.1",
"reconnecting-websocket": "^4.4.0",
"utf-8-validate": "^5.0.2",
Expand Down
12 changes: 6 additions & 6 deletions extensions/gitpod-shared/scripts/inflate.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,17 +106,17 @@ const commands = [
{
'command': 'gitpod.openInStable',
'title': '%openInStable%',
'enablement': 'gitpod.inWorkspace == true && gitpod.UIKind == \'web\''
'enablement': 'gitpod.inWorkspace == true && gitpod.UIKind == \'web\' && gitpod.ideAlias == \'code-latest\''
},
{
'command': 'gitpod.openInInsiders',
'title': '%openInInsiders%',
'enablement': 'gitpod.inWorkspace == true && gitpod.UIKind == \'web\''
'enablement': 'gitpod.inWorkspace == true && gitpod.UIKind == \'web\' && gitpod.ideAlias == \'code-latest\''
},
{
'command': 'gitpod.openInBrowser',
'title': '%openInBrowser%',
'enablement': 'gitpod.inWorkspace == true && gitpod.UIKind == \'desktop\''
'enablement': 'gitpod.inWorkspace == true && gitpod.UIKind == \'desktop\' && gitpod.ideAlias == \'code-latest\''
}
];

Expand Down Expand Up @@ -199,17 +199,17 @@ const remoteMenus = [
{
'command': 'gitpod.openInStable',
'group': 'remote_00_gitpod_navigation@900',
'when': 'gitpod.inWorkspace == true && gitpod.UIKind == \'web\''
'when': 'gitpod.inWorkspace == true && gitpod.UIKind == \'web\' && gitpod.ideAlias == \'code-latest\''
},
{
'command': 'gitpod.openInInsiders',
'group': 'remote_00_gitpod_navigation@1000',
'when': 'gitpod.inWorkspace == true && gitpod.UIKind == \'web\''
'when': 'gitpod.inWorkspace == true && gitpod.UIKind == \'web\' && gitpod.ideAlias == \'code-latest\''
},
{
'command': 'gitpod.openInBrowser',
'group': 'remote_00_gitpod_navigation@1000',
'when': 'gitpod.inWorkspace == true && gitpod.UIKind == \'desktop\''
'when': 'gitpod.inWorkspace == true && gitpod.UIKind == \'desktop\' && gitpod.ideAlias == \'code-latest\''
}
];

Expand Down
8 changes: 8 additions & 0 deletions extensions/gitpod-shared/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ export async function createContext(context: vscode.ExtensionContext): Promise<G
return undefined;
}
vscode.commands.executeCommand('setContext', 'gitpod.inWorkspace', true);

vscode.commands.executeCommand('setContext', 'gitpod.ideAlias', gitpodContext.info.getIdeAlias());
if (vscode.env.uiKind === vscode.UIKind.Web) {
vscode.commands.executeCommand('setContext', 'gitpod.UIKind', 'web');
} else if (vscode.env.uiKind === vscode.UIKind.Desktop) {
vscode.commands.executeCommand('setContext', 'gitpod.UIKind', 'desktop');
}

registerUsageAnalytics(gitpodContext);
registerWorkspaceCommands(gitpodContext);
registerWorkspaceSharing(gitpodContext);
Expand Down
46 changes: 22 additions & 24 deletions extensions/gitpod-shared/src/features.ts
Original file line number Diff line number Diff line change
Expand Up @@ -321,31 +321,29 @@ export async function registerWorkspaceCommands(context: GitpodExtensionContext)
vscode.env.openExternal(vscode.Uri.parse('https://github.com/gitpod-io/gitpod/issues/new/choose'))
));

if (vscode.env.uiKind === vscode.UIKind.Web) {
vscode.commands.executeCommand('setContext', 'gitpod.UIKind', 'web');
function openDesktop(scheme: 'vscode' | 'vscode-insiders'): void {
const uri = vscode.workspace.workspaceFile || vscode.workspace.workspaceFolders?.[0]?.uri;
vscode.env.openExternal(vscode.Uri.from({
scheme,
authority: 'gitpod.gitpod-desktop',
path: uri?.path || context.info.getWorkspaceLocationFile() || context.info.getWorkspaceLocationFolder() || context.info.getCheckoutLocation(),
query: JSON.stringify({
instanceId: context.info.getInstanceId(),
workspaceId: context.info.getWorkspaceId(),
gitpodHost: context.info.getGitpodHost()
})
}));
if (context.info.getIdeAlias() === 'code-latest') {
if (vscode.env.uiKind === vscode.UIKind.Web) {
function openDesktop(scheme: 'vscode' | 'vscode-insiders'): void {
const uri = vscode.workspace.workspaceFile || vscode.workspace.workspaceFolders?.[0]?.uri;
vscode.env.openExternal(vscode.Uri.from({
scheme,
authority: 'gitpod.gitpod-desktop',
path: uri?.path || context.info.getWorkspaceLocationFile() || context.info.getWorkspaceLocationFolder() || context.info.getCheckoutLocation(),
query: JSON.stringify({
instanceId: context.info.getInstanceId(),
workspaceId: context.info.getWorkspaceId(),
gitpodHost: context.info.getGitpodHost()
})
}));
}
context.subscriptions.push(vscode.commands.registerCommand('gitpod.openInStable', () => openDesktop('vscode')));
context.subscriptions.push(vscode.commands.registerCommand('gitpod.openInInsiders', () => openDesktop('vscode-insiders')));
}
if (vscode.env.uiKind === vscode.UIKind.Desktop) {
context.subscriptions.push(vscode.commands.registerCommand('gitpod.openInBrowser', () =>
vscode.env.openExternal(vscode.Uri.parse(context.info.getWorkspaceUrl()))
));
}
context.subscriptions.push(vscode.commands.registerCommand('gitpod.openInStable', () => openDesktop('vscode')));
context.subscriptions.push(vscode.commands.registerCommand('gitpod.openInInsiders', () => openDesktop('vscode-insiders')));
}
// TODO(ak) fetch from supervisor info endpoint
const workspaceUrl = process.env.GITPOD_WORKSPACE_URL;
if (vscode.env.uiKind === vscode.UIKind.Desktop && workspaceUrl) {
vscode.commands.executeCommand('setContext', 'gitpod.UIKind', 'desktop');
context.subscriptions.push(vscode.commands.registerCommand('gitpod.openInBrowser', () =>
vscode.env.openExternal(vscode.Uri.parse(workspaceUrl))
));
}

const communityStatusBarItem = vscode.window.createStatusBarItem('gitpod.community', vscode.StatusBarAlignment.Right, -100);
Expand Down
20 changes: 11 additions & 9 deletions extensions/gitpod-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,17 +101,17 @@
{
"command": "gitpod.openInStable",
"title": "%openInStable%",
"enablement": "gitpod.inWorkspace == true && gitpod.UIKind == 'web'"
"enablement": "gitpod.inWorkspace == true && gitpod.UIKind == 'web' && gitpod.ideAlias == 'code-latest'"
},
{
"command": "gitpod.openInInsiders",
"title": "%openInInsiders%",
"enablement": "gitpod.inWorkspace == true && gitpod.UIKind == 'web'"
"enablement": "gitpod.inWorkspace == true && gitpod.UIKind == 'web' && gitpod.ideAlias == 'code-latest'"
},
{
"command": "gitpod.openInBrowser",
"title": "%openInBrowser%",
"enablement": "gitpod.inWorkspace == true && gitpod.UIKind == 'desktop'"
"enablement": "gitpod.inWorkspace == true && gitpod.UIKind == 'desktop' && gitpod.ideAlias == 'code-latest'"
},
{
"command": "gitpod.ports.openBrowser",
Expand Down Expand Up @@ -193,11 +193,13 @@
},
{
"command": "gitpod.openInStable",
"group": "gitpod@60"
"group": "gitpod@60",
"when": "gitpod.ideAlias == 'code-latest'"
},
{
"command": "gitpod.openInInsiders",
"group": "gitpod@70"
"group": "gitpod@70",
"when": "gitpod.ideAlias == 'code-latest'"
}
],
"accounts/context": [
Expand Down Expand Up @@ -394,17 +396,17 @@
{
"command": "gitpod.openInStable",
"group": "remote_00_gitpod_navigation@900",
"when": "gitpod.inWorkspace == true && gitpod.UIKind == 'web'"
"when": "gitpod.inWorkspace == true && gitpod.UIKind == 'web' && gitpod.ideAlias == 'code-latest'"
},
{
"command": "gitpod.openInInsiders",
"group": "remote_00_gitpod_navigation@1000",
"when": "gitpod.inWorkspace == true && gitpod.UIKind == 'web'"
"when": "gitpod.inWorkspace == true && gitpod.UIKind == 'web' && gitpod.ideAlias == 'code-latest'"
},
{
"command": "gitpod.openInBrowser",
"group": "remote_00_gitpod_navigation@1000",
"when": "gitpod.inWorkspace == true && gitpod.UIKind == 'desktop'"
"when": "gitpod.inWorkspace == true && gitpod.UIKind == 'desktop' && gitpod.ideAlias == 'code-latest'"
}
]
},
Expand Down Expand Up @@ -441,4 +443,4 @@
"vscode-jsonrpc": "^5.0.1",
"vscode-nls": "^5.0.0"
}
}
}
8 changes: 4 additions & 4 deletions extensions/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@
"@improbable-eng/grpc-web" "0.14.0"
google-protobuf "^3.17.0"

"@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==
"@gitpod/supervisor-api-grpc@ak-no-code-desktop-in-stable":
version "0.1.5-ak-no-code-desktop-in-stable.2"
resolved "https://registry.yarnpkg.com/@gitpod/supervisor-api-grpc/-/supervisor-api-grpc-0.1.5-ak-no-code-desktop-in-stable.2.tgz#b71f3792cee310e5eb00111a169be17253e0dacd"
integrity sha512-wHd/F4dI75MtNH8DjZlUZ+SUIJGyXjq6VvpQXqUGyWRPKQelgPrOx4nbCfNzsRIsAgsJvoAFU8rg7O4tr4vYtg==
dependencies:
"@grpc/grpc-js" "^1.3.6"
google-protobuf "^3.17.3"
Expand Down

0 comments on commit 330c9b3

Please sign in to comment.