-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Add Gitpod-related actions to JetBrains IDEs #12621
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
...nents/gitpod-protocol/java/src/main/java/io/gitpod/gitpodprotocol/api/entities/Error.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Copyright (c) 2022 Gitpod GmbH. All rights reserved. | ||
// Licensed under the GNU Affero General Public License (AGPL). | ||
// See License-AGPL.txt in the project root for license information. | ||
|
||
package io.gitpod.gitpodprotocol.api.entities; | ||
|
||
public enum Error { | ||
NOT_FOUND(404), | ||
SNAPSHOT_ERROR(630); | ||
|
||
private int errCode; | ||
|
||
Error(int errCode) { | ||
this.errCode = errCode; | ||
} | ||
|
||
public int getErrCode() { | ||
return errCode; | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
...l/java/src/main/java/io/gitpod/gitpodprotocol/api/entities/SetWorkspaceTimeoutResult.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Copyright (c) 2022 Gitpod GmbH. All rights reserved. | ||
// Licensed under the GNU Affero General Public License (AGPL). | ||
// See License-AGPL.txt in the project root for license information. | ||
|
||
package io.gitpod.gitpodprotocol.api.entities; | ||
|
||
public class SetWorkspaceTimeoutResult { | ||
private String[] resetTimeoutOnWorkspaces; | ||
|
||
public SetWorkspaceTimeoutResult(String[] resetTimeoutOnWorkspaces) { | ||
this.resetTimeoutOnWorkspaces = resetTimeoutOnWorkspaces; | ||
} | ||
|
||
public String[] getResetTimeoutOnWorkspaces() { | ||
return resetTimeoutOnWorkspaces; | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
...rotocol/java/src/main/java/io/gitpod/gitpodprotocol/api/entities/TakeSnapshotOptions.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// Copyright (c) 2022 Gitpod GmbH. All rights reserved. | ||
// Licensed under the GNU Affero General Public License (AGPL). | ||
// See License-AGPL.txt in the project root for license information. | ||
|
||
package io.gitpod.gitpodprotocol.api.entities; | ||
|
||
public class TakeSnapshotOptions { | ||
private String workspaceId; | ||
private String layoutData; | ||
private boolean dontWait; | ||
|
||
public TakeSnapshotOptions(final String workspaceId, final String layoutData, final Boolean dontWait) { | ||
this.workspaceId = workspaceId; | ||
this.layoutData = layoutData; | ||
this.dontWait = dontWait; | ||
} | ||
|
||
public TakeSnapshotOptions(final String workspaceId, final Boolean dontWait) { | ||
this.workspaceId = workspaceId; | ||
this.dontWait = dontWait; | ||
} | ||
|
||
public String getLayoutData() { | ||
return layoutData; | ||
} | ||
|
||
public void setLayoutData(String layoutData) { | ||
this.layoutData = layoutData; | ||
} | ||
|
||
public String getWorkspaceId() { | ||
return workspaceId; | ||
} | ||
|
||
public void setWorkspaceId(String workspaceId) { | ||
this.workspaceId = workspaceId; | ||
} | ||
|
||
public boolean isDontWait() { | ||
return dontWait; | ||
} | ||
|
||
public void setDontWait(boolean dontWait) { | ||
this.dontWait = dontWait; | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
...ol/java/src/main/java/io/gitpod/gitpodprotocol/api/entities/WorkspaceTimeoutDuration.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Copyright (c) 2022 Gitpod GmbH. All rights reserved. | ||
// Licensed under the GNU Affero General Public License (AGPL). | ||
// See License-AGPL.txt in the project root for license information. | ||
|
||
package io.gitpod.gitpodprotocol.api.entities; | ||
|
||
public enum WorkspaceTimeoutDuration { | ||
DURATION_SHORT("short"), | ||
DURATION_LONG("long"), | ||
DURATION_EXTENDED("extended"), | ||
DURATION_180M("180m"); // for backwards compatibility since the IDE uses this | ||
|
||
private String value; | ||
|
||
WorkspaceTimeoutDuration(String value) { | ||
this.value = value; | ||
} | ||
|
||
public String toString() { | ||
return value; | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
.../backend-plugin/src/main/kotlin/io/gitpod/jetbrains/remote/actions/AccessControlAction.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Copyright (c) 2022 Gitpod GmbH. All rights reserved. | ||
// Licensed under the GNU Affero General Public License (AGPL). | ||
// See License-AGPL.txt in the project root for license information. | ||
|
||
package io.gitpod.jetbrains.remote.actions | ||
|
||
import com.intellij.openapi.actionSystem.AnAction | ||
import com.intellij.openapi.actionSystem.AnActionEvent | ||
import com.intellij.openapi.components.service | ||
import io.gitpod.jetbrains.remote.GitpodManager | ||
import org.apache.http.client.utils.URIBuilder | ||
|
||
class AccessControlAction : AnAction() { | ||
private val manager = service<GitpodManager>() | ||
|
||
override fun actionPerformed(event: AnActionEvent) { | ||
manager.pendingInfo.thenAccept { workspaceInfo -> | ||
URIBuilder(workspaceInfo.gitpodHost).setPath("integrations").build().toString().let { url -> | ||
manager.openUrlFromAction(url) | ||
} | ||
} | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
.../backend-plugin/src/main/kotlin/io/gitpod/jetbrains/remote/actions/CommunityChatAction.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Copyright (c) 2022 Gitpod GmbH. All rights reserved. | ||
// Licensed under the GNU Affero General Public License (AGPL). | ||
// See License-AGPL.txt in the project root for license information. | ||
|
||
package io.gitpod.jetbrains.remote.actions | ||
|
||
import com.intellij.openapi.actionSystem.AnAction | ||
import com.intellij.openapi.actionSystem.AnActionEvent | ||
import com.intellij.openapi.components.service | ||
import io.gitpod.jetbrains.remote.GitpodManager | ||
|
||
class CommunityChatAction : AnAction() { | ||
private val manager = service<GitpodManager>() | ||
|
||
override fun actionPerformed(event: AnActionEvent) { | ||
manager.openUrlFromAction("https://www.gitpod.io/chat") | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
...brains/backend-plugin/src/main/kotlin/io/gitpod/jetbrains/remote/actions/ContextAction.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Copyright (c) 2022 Gitpod GmbH. All rights reserved. | ||
// Licensed under the GNU Affero General Public License (AGPL). | ||
// See License-AGPL.txt in the project root for license information. | ||
|
||
package io.gitpod.jetbrains.remote.actions | ||
|
||
import com.intellij.openapi.actionSystem.AnAction | ||
import com.intellij.openapi.actionSystem.AnActionEvent | ||
import com.intellij.openapi.components.service | ||
import io.gitpod.jetbrains.remote.GitpodManager | ||
|
||
class ContextAction : AnAction() { | ||
private val manager = service<GitpodManager>() | ||
|
||
override fun actionPerformed(event: AnActionEvent) { | ||
manager.pendingInfo.thenAccept { workspaceInfo -> | ||
manager.openUrlFromAction(workspaceInfo.workspaceContextUrl) | ||
} | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
...ains/backend-plugin/src/main/kotlin/io/gitpod/jetbrains/remote/actions/DashboardAction.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Copyright (c) 2022 Gitpod GmbH. All rights reserved. | ||
// Licensed under the GNU Affero General Public License (AGPL). | ||
// See License-AGPL.txt in the project root for license information. | ||
|
||
package io.gitpod.jetbrains.remote.actions | ||
|
||
import com.intellij.openapi.actionSystem.AnAction | ||
import com.intellij.openapi.actionSystem.AnActionEvent | ||
import com.intellij.openapi.components.service | ||
import io.gitpod.jetbrains.remote.GitpodManager | ||
|
||
class DashboardAction : AnAction() { | ||
private val manager = service<GitpodManager>() | ||
|
||
override fun actionPerformed(event: AnActionEvent) { | ||
manager.pendingInfo.thenAccept { workspaceInfo -> | ||
manager.openUrlFromAction(workspaceInfo.gitpodHost) | ||
} | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
.../backend-plugin/src/main/kotlin/io/gitpod/jetbrains/remote/actions/DocumentationAction.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Copyright (c) 2022 Gitpod GmbH. All rights reserved. | ||
// Licensed under the GNU Affero General Public License (AGPL). | ||
// See License-AGPL.txt in the project root for license information. | ||
|
||
package io.gitpod.jetbrains.remote.actions | ||
|
||
import com.intellij.openapi.actionSystem.AnAction | ||
import com.intellij.openapi.actionSystem.AnActionEvent | ||
import com.intellij.openapi.components.service | ||
import io.gitpod.jetbrains.remote.GitpodManager | ||
|
||
class DocumentationAction : AnAction() { | ||
private val manager = service<GitpodManager>() | ||
|
||
override fun actionPerformed(event: AnActionEvent) { | ||
manager.openUrlFromAction("https://www.gitpod.io/docs") | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
...plugin/src/main/kotlin/io/gitpod/jetbrains/remote/actions/ExtendWorkspaceTimeoutAction.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// Copyright (c) 2022 Gitpod GmbH. All rights reserved. | ||
// Licensed under the GNU Affero General Public License (AGPL). | ||
// See License-AGPL.txt in the project root for license information. | ||
|
||
package io.gitpod.jetbrains.remote.actions | ||
|
||
import com.intellij.openapi.actionSystem.AnAction | ||
import com.intellij.openapi.actionSystem.AnActionEvent | ||
import com.intellij.openapi.components.service | ||
import com.intellij.openapi.diagnostic.thisLogger | ||
import io.gitpod.gitpodprotocol.api.entities.WorkspaceTimeoutDuration | ||
import io.gitpod.jetbrains.remote.GitpodManager | ||
import com.intellij.notification.NotificationType | ||
|
||
class ExtendWorkspaceTimeoutAction : AnAction() { | ||
private val manager = service<GitpodManager>() | ||
|
||
override fun actionPerformed(event: AnActionEvent) { | ||
manager.pendingInfo.thenAccept { workspaceInfo -> | ||
manager.trackEvent("jb_execute_command_gitpod_workspace", mapOf( | ||
"action" to "extend-timeout" | ||
)) | ||
|
||
manager.client.server.setWorkspaceTimeout(workspaceInfo.workspaceId, WorkspaceTimeoutDuration.DURATION_180M.toString()).whenComplete { result, e -> | ||
var message: String | ||
var notificationType: NotificationType | ||
|
||
if (e != null) { | ||
message = "Cannot extend workspace timeout: ${e.message}" | ||
notificationType = NotificationType.ERROR | ||
thisLogger().error("gitpod: failed to extend workspace timeout", e) | ||
} else { | ||
if (result.resetTimeoutOnWorkspaces.isNotEmpty()) { | ||
message = "Workspace timeout has been extended to three hours. This reset the workspace timeout for other workspaces." | ||
notificationType = NotificationType.WARNING | ||
} else { | ||
message = "Workspace timeout has been extended to three hours." | ||
notificationType = NotificationType.INFORMATION | ||
} | ||
} | ||
|
||
val notification = manager.notificationGroup.createNotification(message, notificationType) | ||
notification.notify(null) | ||
} | ||
} | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
...kend-plugin/src/main/kotlin/io/gitpod/jetbrains/remote/actions/FollowUsOnTwitterAction.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Copyright (c) 2022 Gitpod GmbH. All rights reserved. | ||
// Licensed under the GNU Affero General Public License (AGPL). | ||
// See License-AGPL.txt in the project root for license information. | ||
|
||
package io.gitpod.jetbrains.remote.actions | ||
|
||
import com.intellij.openapi.actionSystem.AnAction | ||
import com.intellij.openapi.actionSystem.AnActionEvent | ||
import com.intellij.openapi.components.service | ||
import io.gitpod.jetbrains.remote.GitpodManager | ||
|
||
class FollowUsOnTwitterAction : AnAction() { | ||
private val manager = service<GitpodManager>() | ||
|
||
override fun actionPerformed(event: AnActionEvent) { | ||
manager.openUrlFromAction("https://twitter.com/gitpod") | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
...ns/backend-plugin/src/main/kotlin/io/gitpod/jetbrains/remote/actions/ReportIssueAction.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Copyright (c) 2022 Gitpod GmbH. All rights reserved. | ||
// Licensed under the GNU Affero General Public License (AGPL). | ||
// See License-AGPL.txt in the project root for license information. | ||
|
||
package io.gitpod.jetbrains.remote.actions | ||
|
||
import com.intellij.openapi.actionSystem.AnAction | ||
import com.intellij.openapi.actionSystem.AnActionEvent | ||
import com.intellij.openapi.components.service | ||
import io.gitpod.jetbrains.remote.GitpodManager | ||
|
||
class ReportIssueAction : AnAction() { | ||
private val manager = service<GitpodManager>() | ||
|
||
override fun actionPerformed(event: AnActionEvent) { | ||
manager.openUrlFromAction("https://github.com/gitpod-io/gitpod/issues/new/choose") | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
...rains/backend-plugin/src/main/kotlin/io/gitpod/jetbrains/remote/actions/SettingsAction.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Copyright (c) 2022 Gitpod GmbH. All rights reserved. | ||
// Licensed under the GNU Affero General Public License (AGPL). | ||
// See License-AGPL.txt in the project root for license information. | ||
|
||
package io.gitpod.jetbrains.remote.actions | ||
|
||
import com.intellij.openapi.actionSystem.AnAction | ||
import com.intellij.openapi.actionSystem.AnActionEvent | ||
import com.intellij.openapi.components.service | ||
import io.gitpod.jetbrains.remote.GitpodManager | ||
import org.apache.http.client.utils.URIBuilder | ||
|
||
class SettingsAction : AnAction() { | ||
private val manager = service<GitpodManager>() | ||
|
||
override fun actionPerformed(event: AnActionEvent) { | ||
manager.pendingInfo.thenAccept { workspaceInfo -> | ||
URIBuilder(workspaceInfo.gitpodHost).setPath("settings").build().toString().let { url -> | ||
manager.openUrlFromAction(url) | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.