Skip to content

Commit 6765bdd

Browse files
committed
Add a new button to import settings on the welcome screen without requiring to set an API key.
1 parent 29137fb commit 6765bdd

File tree

14 files changed

+42
-14
lines changed

14 files changed

+42
-14
lines changed

src/core/config/importExport.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,16 @@ export const importSettings = async ({ providerSettingsManager, contextProxy }:
4949
}
5050

5151
await providerSettingsManager.import(newProviderProfiles)
52-
5352
await contextProxy.setValues(globalSettings)
53+
54+
// Roo uses providerSettingsManager to manage api configs, but Cline uses ContextProxy, and to due to some legacy
55+
// code from it, we need to set the the provider setttings here as well.
56+
// For the future we should remove the provider from the proxy and keep providerSettingsManager as source of truth for apiConfig.
57+
const firstApiConfig = Object.values(providerProfiles.apiConfigs)[0]
58+
if (firstApiConfig) {
59+
contextProxy.setProviderSettings(firstApiConfig)
60+
}
61+
5462
contextProxy.setValue("currentApiConfigName", providerProfiles.currentApiConfigName)
5563
contextProxy.setValue("listApiConfigMeta", await providerSettingsManager.listConfig())
5664

webview-ui/src/components/welcome/WelcomeView.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { useCallback, useState } from "react"
2-
import { VSCodeButton } from "@vscode/webview-ui-toolkit/react"
2+
import { VSCodeButton, VSCodeLink } from "@vscode/webview-ui-toolkit/react"
33
import { useExtensionState } from "@src/context/ExtensionStateContext"
44
import { validateApiConfiguration } from "@src/utils/validate"
55
import { vscode } from "@src/utils/vscode"
@@ -113,6 +113,14 @@ const WelcomeView = () => {
113113
</TabContent>
114114
<div className="sticky bottom-0 bg-vscode-sideBar-background p-5">
115115
<div className="flex flex-col gap-1">
116+
<div className="flex justify-end">
117+
<VSCodeLink
118+
href="#"
119+
onClick={() => vscode.postMessage({ type: "importSettings" })}
120+
className="text-sm">
121+
{t("welcome:importSettings")}
122+
</VSCodeLink>
123+
</div>
116124
<VSCodeButton onClick={handleSubmit} appearance="primary">
117125
{t("welcome:start")}
118126
</VSCodeButton>

webview-ui/src/i18n/locales/ca/welcome.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,6 @@
2323
"allow": "Permetre",
2424
"deny": "Denegar"
2525
},
26-
"or": "o"
26+
"or": "o",
27+
"importSettings": "Importar configuració"
2728
}

webview-ui/src/i18n/locales/de/welcome.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,6 @@
2323
"allow": "Erlauben",
2424
"deny": "Ablehnen"
2525
},
26-
"or": "oder"
26+
"or": "oder",
27+
"importSettings": "Einstellungen importieren"
2728
}

webview-ui/src/i18n/locales/en/welcome.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,6 @@
2323
"allow": "Allow",
2424
"deny": "Deny"
2525
},
26-
"or": "or"
26+
"or": "or",
27+
"importSettings": "Import Settings"
2728
}

webview-ui/src/i18n/locales/es/welcome.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,6 @@
2323
"allow": "Permitir",
2424
"deny": "Denegar"
2525
},
26-
"or": "o"
26+
"or": "o",
27+
"importSettings": "Importar configuración"
2728
}

webview-ui/src/i18n/locales/fr/welcome.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,6 @@
2323
"allow": "Autoriser",
2424
"deny": "Refuser"
2525
},
26-
"or": "ou"
26+
"or": "ou",
27+
"importSettings": "Importer les paramètres"
2728
}

webview-ui/src/i18n/locales/hi/welcome.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,6 @@
2323
"allow": "अनुमति दें",
2424
"deny": "अस्वीकार करें"
2525
},
26-
"or": "या"
26+
"or": "या",
27+
"importSettings": "सेटिंग्स आयात करें"
2728
}

webview-ui/src/i18n/locales/it/welcome.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,6 @@
2323
"allow": "Consenti",
2424
"deny": "Nega"
2525
},
26-
"or": "o"
26+
"or": "o",
27+
"importSettings": "Importa impostazioni"
2728
}

webview-ui/src/i18n/locales/pl/welcome.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,6 @@
2323
"allow": "Zezwól",
2424
"deny": "Odmów"
2525
},
26-
"or": "lub"
26+
"or": "lub",
27+
"importSettings": "Importuj ustawienia"
2728
}

0 commit comments

Comments
 (0)