-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[TB] allow to config launcher from Dashboard #20051
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
Show all changes
5 commits
Select commit
Hold shift + click to select a range
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 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
This file contains 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
This file contains 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 |
---|---|---|
|
@@ -13,6 +13,8 @@ import { useUpdateCurrentUserMutation } from "../data/current-user/update-mutati | |
import { converter } from "../service/public-api"; | ||
import { isOrganizationOwned } from "@gitpod/public-api-common/lib/user-utils"; | ||
import Alert from "../components/Alert"; | ||
import { useFeatureFlag } from "../data/featureflag-query"; | ||
import { IDESettingsVersion } from "@gitpod/gitpod-protocol/lib/ide-protocol"; | ||
|
||
export type IDEChangedTrackLocation = "workspace_list" | "workspace_start" | "preferences"; | ||
interface SelectIDEProps { | ||
|
@@ -25,18 +27,21 @@ export default function SelectIDE(props: SelectIDEProps) { | |
|
||
const [defaultIde, setDefaultIde] = useState<string>(user?.editorSettings?.name || "code"); | ||
const [useLatestVersion, setUseLatestVersion] = useState<boolean>(user?.editorSettings?.version === "latest"); | ||
const [preferToolbox, setPreferToolbox] = useState<boolean>(user?.editorSettings?.preferToolbox || false); | ||
const [ideWarning, setIdeWarning] = useState<ReactNode | undefined>(undefined); | ||
const enableExperimentalJBTB = useFeatureFlag("enable_experimental_jbtb"); | ||
|
||
const isOrgOwnedUser = user && isOrganizationOwned(user); | ||
|
||
const actualUpdateUserIDEInfo = useCallback( | ||
async (selectedIde: string, useLatestVersion: boolean) => { | ||
async (selectedIde: string, useLatestVersion: boolean, preferToolbox: boolean) => { | ||
// update stored autostart options to match useLatestVersion value set here | ||
const workspaceAutostartOptions = user?.workspaceAutostartOptions?.map((o) => { | ||
const option = converter.fromWorkspaceAutostartOption(o); | ||
|
||
if (option.ideSettings) { | ||
option.ideSettings.useLatestVersion = useLatestVersion; | ||
option.ideSettings.preferToolbox = preferToolbox; | ||
} | ||
|
||
return option; | ||
|
@@ -46,9 +51,10 @@ export default function SelectIDE(props: SelectIDEProps) { | |
additionalData: { | ||
workspaceAutostartOptions, | ||
ideSettings: { | ||
settingVersion: "2.0", | ||
settingVersion: IDESettingsVersion, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nice! |
||
defaultIde: selectedIde, | ||
useLatestVersion: useLatestVersion, | ||
preferToolbox: preferToolbox, | ||
}, | ||
}, | ||
}); | ||
|
@@ -59,18 +65,26 @@ export default function SelectIDE(props: SelectIDEProps) { | |
|
||
const actuallySetDefaultIde = useCallback( | ||
async (value: string) => { | ||
await actualUpdateUserIDEInfo(value, useLatestVersion); | ||
await actualUpdateUserIDEInfo(value, useLatestVersion, preferToolbox); | ||
setDefaultIde(value); | ||
}, | ||
[actualUpdateUserIDEInfo, useLatestVersion], | ||
[actualUpdateUserIDEInfo, useLatestVersion, preferToolbox], | ||
); | ||
|
||
const actuallySetUseLatestVersion = useCallback( | ||
async (value: boolean) => { | ||
await actualUpdateUserIDEInfo(defaultIde, value); | ||
await actualUpdateUserIDEInfo(defaultIde, value, preferToolbox); | ||
setUseLatestVersion(value); | ||
}, | ||
[actualUpdateUserIDEInfo, defaultIde], | ||
[actualUpdateUserIDEInfo, defaultIde, preferToolbox], | ||
); | ||
|
||
const actuallySetPreferToolbox = useCallback( | ||
async (value: boolean) => { | ||
await actualUpdateUserIDEInfo(defaultIde, useLatestVersion, value); | ||
setPreferToolbox(value); | ||
}, | ||
[actualUpdateUserIDEInfo, defaultIde, useLatestVersion], | ||
); | ||
|
||
const shouldShowJetbrainsNotice = isJetbrains(defaultIde); | ||
|
@@ -142,6 +156,24 @@ export default function SelectIDE(props: SelectIDEProps) { | |
checked={useLatestVersion} | ||
onChange={(checked) => actuallySetUseLatestVersion(checked)} | ||
/> | ||
|
||
{enableExperimentalJBTB && ( | ||
<CheckboxInputField | ||
label={ | ||
<span className="flex items-center gap-2"> | ||
Launch in JetBrains Toolbox{" "} | ||
<PillLabel type="warn"> | ||
<a href="https://www.gitpod.io/docs/references/gitpod-releases"> | ||
<span className="text-xs">BETA</span> | ||
</a> | ||
</PillLabel> | ||
</span> | ||
} | ||
hint={<span>Launch JetBrains IDEs in the JetBrains Toolbox.</span>} | ||
checked={preferToolbox} | ||
onChange={(checked) => actuallySetPreferToolbox(checked)} | ||
/> | ||
)} | ||
</> | ||
); | ||
} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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 |
---|---|---|
|
@@ -129,6 +129,18 @@ | |
"If you don't see an open dialog in your browser, make sure you have the \u003ca target='_blank' class='gp-link' href='https://www.gitpod.io/docs/ides-and-editors/jetbrains-gateway#getting-started-jetbrains-gateway'\u003eJetBrains Gateway with Gitpod Plugin\u003c/a\u003e installed on your machine, and then click \u003cb\u003e${OPEN_LINK_LABEL}\u003c/b\u003e below." | ||
] | ||
}, | ||
"jetbrains-toolbox": { | ||
"defaultDesktopIDE": "intellij", | ||
"desktopIDEs": [ | ||
"intellij", | ||
"goland", | ||
"pycharm", | ||
"phpstorm" | ||
], | ||
"installationSteps": [ | ||
"If you don't see an open dialog in your browser, make sure you have the \u003ca target='_blank' class='gp-link' href='https://www.gitpod.io/docs/ides-and-editors/jetbrains-gateway#getting-started-jetbrains-gateway'\u003eJetBrains Toolbox with Gitpod Plugin\u003c/a\u003e installed on your machine, and then click \u003cb\u003e${OPEN_LINK_LABEL}\u003c/b\u003e below." | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Draft changes, will update in the future |
||
] | ||
}, | ||
"vscode": { | ||
"defaultDesktopIDE": "code-desktop", | ||
"desktopIDEs": [ | ||
|
This file contains 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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: we can only default on
undefined