diff --git a/plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/OpenWebviewAction.kt b/plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/OpenWebviewAction.kt index 7f6eacfc6a..8778b3a2f3 100644 --- a/plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/OpenWebviewAction.kt +++ b/plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/OpenWebviewAction.kt @@ -142,13 +142,12 @@ class WebviewBrowser(val project: Project) { val profileName = lastLoginIdcInfo.profileName val startUrl = lastLoginIdcInfo.startUrl - val directoryId = extractDirectoryIdFromStartUrl(startUrl) val region = lastLoginIdcInfo.region jcefBrowser.cefBrowser.executeJavaScript( "window.ideClient.updateLastLoginIdcInfo({" + "profileName: \"$profileName\"," + - "directoryId: \"$directoryId\"," + + "startUrl: \"$startUrl\"," + "region: \"$region\"})", jcefBrowser.cefBrowser.url, 0 @@ -258,11 +257,6 @@ class WebviewBrowser(val project: Project) { else -> "" } - private fun extractDirectoryIdFromStartUrl(startUrl: String): String { - val pattern = "https://(.*?).awsapps.com/start.*".toRegex() - return pattern.matchEntire(startUrl)?.groupValues?.get(1).orEmpty() - } - fun component(): JComponent? = jcefBrowser.component private suspend fun pollFor(func: () -> T): T? { diff --git a/plugins/core/webview/src/model.ts b/plugins/core/webview/src/model.ts index 274ee83344..a26343e432 100644 --- a/plugins/core/webview/src/model.ts +++ b/plugins/core/webview/src/model.ts @@ -13,7 +13,7 @@ export interface Region { export interface IdcInfo { profileName: string, - directoryId: string, + startUrl: string, region: string, } diff --git a/plugins/core/webview/src/q-ui/components/ssoLoginForm.vue b/plugins/core/webview/src/q-ui/components/ssoLoginForm.vue index b10ecf9ef3..3750b3414d 100644 --- a/plugins/core/webview/src/q-ui/components/ssoLoginForm.vue +++ b/plugins/core/webview/src/q-ui/components/ssoLoginForm.vue @@ -30,18 +30,16 @@
Start URL
URL for your organization, provided by an admin or help desk
-
https://
-
.awsapps.com/start

@@ -93,14 +91,14 @@ export default defineComponent({ }) } }, - directoryId: { + startUrl: { get() { - return this.$store.state.lastLoginIdcInfo.directoryId; + return this.$store.state.lastLoginIdcInfo.startUrl; }, set(value: string) { window.ideClient.updateLastLoginIdcInfo({ ...this.$store.state.lastLoginIdcInfo, - directoryId: value + startUrl: value }) } }, @@ -117,24 +115,23 @@ export default defineComponent({ }, isInputValid: { get() { - return this.directoryId != "" && this.selectedRegion != "" + return this.startUrl != "" && this.selectedRegion != "" }, set() {} } }, methods: { handleUrlInput() { - this.isInputValid = this.directoryId != "" && this.selectedRegion != ""; + this.isInputValid = this.startUrl != "" && this.selectedRegion != ""; }, handleBackButtonClick() { this.$emit('backToMenu') }, async handleContinueClick() { if (!this.isInputValid) return - const startUrl = "https://" + this.directoryId + ".awsapps.com/start" window.ideApi.postMessage({ command: 'loginIdC', - url: startUrl, + url: this.startUrl, region: this.selectedRegion, profileName: this.ssoProfile }) @@ -162,14 +159,10 @@ export default defineComponent({ border-radius: 4px; } -.sso-profile, .region-select { +.url-input, .sso-profile, .region-select { width: 100%; } -.url-input { - width: 29%; -} - .sso-profile, .url-input { padding-left: 10px; box-sizing: border-box; @@ -180,10 +173,6 @@ export default defineComponent({ margin-right: 3px; } -.url-part { - display: inline-block; -} - .region-select { padding-left: 6px; } diff --git a/plugins/core/webview/src/q-ui/index.ts b/plugins/core/webview/src/q-ui/index.ts index 912ae485b8..8031dad553 100644 --- a/plugins/core/webview/src/q-ui/index.ts +++ b/plugins/core/webview/src/q-ui/index.ts @@ -17,7 +17,7 @@ const store = createStore({ authorizationCode: undefined, lastLoginIdcInfo: { profileName: '', - directoryId: '', + startUrl: '', region: '', } }, @@ -35,7 +35,7 @@ const store = createStore({ setLastLoginIdcInfo(state: State, idcInfo: IdcInfo) { console.log('state idc info is updated') state.lastLoginIdcInfo.profileName = idcInfo.profileName - state.lastLoginIdcInfo.directoryId = idcInfo.directoryId + state.lastLoginIdcInfo.startUrl = idcInfo.startUrl state.lastLoginIdcInfo.region = idcInfo.region }, reset(state: State) { @@ -44,7 +44,7 @@ const store = createStore({ state.authorizationCode = undefined state.lastLoginIdcInfo = { profileName: '', - directoryId: '', + startUrl: '', region: '' } } diff --git a/plugins/core/webview/src/q-ui/toolkit.ts b/plugins/core/webview/src/q-ui/toolkit.ts index 29bffd9f70..caad383dc3 100644 --- a/plugins/core/webview/src/q-ui/toolkit.ts +++ b/plugins/core/webview/src/q-ui/toolkit.ts @@ -18,7 +18,7 @@ const store = createStore({ authorizationCode: undefined, lastLoginIdcInfo: { profileName: '', - directoryId: '', + startUrl: '', region: '', } }, @@ -36,7 +36,7 @@ const store = createStore({ setLastLoginIdcInfo(state: State, idcInfo: IdcInfo) { console.log('state idc info is updated') state.lastLoginIdcInfo.profileName = idcInfo.profileName - state.lastLoginIdcInfo.directoryId = idcInfo.directoryId + state.lastLoginIdcInfo.startUrl = idcInfo.startUrl state.lastLoginIdcInfo.region = idcInfo.region }, reset(state: State) { @@ -45,7 +45,7 @@ const store = createStore({ state.authorizationCode = undefined state.lastLoginIdcInfo = { profileName: '', - directoryId: '', + startUrl: '', region: '' } } diff --git a/plugins/core/webview/src/q-ui/vue.shims.d.ts b/plugins/core/webview/src/vue.shims.d.ts similarity index 100% rename from plugins/core/webview/src/q-ui/vue.shims.d.ts rename to plugins/core/webview/src/vue.shims.d.ts