From c4f46e4b4cdb77c2d5e2dc02094d051c993c4ab0 Mon Sep 17 00:00:00 2001 From: Bill Sager Date: Thu, 19 Sep 2024 14:10:20 -0700 Subject: [PATCH 1/8] Update QuickPickItem and EvenEasierDeploy to show entrypoint more prominently. --- extensions/vscode/src/views/homeView.ts | 12 +++- .../src/components/EvenEasierDeploy.vue | 67 +++++++++++++------ .../homeView/src/components/QuickPickItem.vue | 4 +- .../vscode/webviews/homeView/vite.config.ts | 1 + 4 files changed, 57 insertions(+), 27 deletions(-) diff --git a/extensions/vscode/src/views/homeView.ts b/extensions/vscode/src/views/homeView.ts index fb04a75f4..56bcc2782 100644 --- a/extensions/vscode/src/views/homeView.ts +++ b/extensions/vscode/src/views/homeView.ts @@ -1068,15 +1068,21 @@ export class HomeViewProvider implements WebviewViewProvider, Disposable { } let details = []; - if (!isRelativePathRoot(contentRecord.projectDir)) { - details.push(`${contentRecord.projectDir}${path.sep}`); - } if (credential?.name) { details.push(credential.name); } else { details.push(`Missing Credential for ${contentRecord.serverUrl}`); problem = true; } + if ( + !isRelativePathRoot(contentRecord.projectDir) && + config && + !isConfigurationError(config) + ) { + details.push( + `${contentRecord.projectDir}${path.sep}${config.configuration.entrypoint}`, + ); + } const detail = details.join(" • "); let lastMatch = diff --git a/extensions/vscode/webviews/homeView/src/components/EvenEasierDeploy.vue b/extensions/vscode/webviews/homeView/src/components/EvenEasierDeploy.vue index 0e96aab05..50cfb2df5 100644 --- a/extensions/vscode/webviews/homeView/src/components/EvenEasierDeploy.vue +++ b/extensions/vscode/webviews/homeView/src/components/EvenEasierDeploy.vue @@ -18,7 +18,7 @@
-
-
- {{ home.selectedConfiguration.configuration.entrypoint }} - (selected as entrypoint) -
-
-

No Config Entry in Deployment record - {{ home.selectedContentRecord?.saveName }}. @@ -84,7 +66,7 @@

diff --git a/extensions/vscode/webviews/homeView/vite.config.ts b/extensions/vscode/webviews/homeView/vite.config.ts index ef318c263..814f7e13e 100644 --- a/extensions/vscode/webviews/homeView/vite.config.ts +++ b/extensions/vscode/webviews/homeView/vite.config.ts @@ -16,6 +16,7 @@ export default defineConfig({ resolve: { alias: { src: fileURLToPath(new URL("./src", import.meta.url)), + path: "path-browserify", }, }, build: { From 7edf3ba53b54624721ed08372408d0e6f745b558 Mon Sep 17 00:00:00 2001 From: Bill Sager Date: Fri, 20 Sep 2024 08:48:39 -0700 Subject: [PATCH 2/8] PR feedback changes --- extensions/vscode/src/views/homeView.ts | 16 +++---- .../webviews/homeView/package-lock.json | 11 ++++- .../vscode/webviews/homeView/package.json | 2 + .../src/components/EvenEasierDeploy.vue | 45 +++---------------- 4 files changed, 27 insertions(+), 47 deletions(-) diff --git a/extensions/vscode/src/views/homeView.ts b/extensions/vscode/src/views/homeView.ts index 56bcc2782..3416ee2f9 100644 --- a/extensions/vscode/src/views/homeView.ts +++ b/extensions/vscode/src/views/homeView.ts @@ -1074,14 +1074,14 @@ export class HomeViewProvider implements WebviewViewProvider, Disposable { details.push(`Missing Credential for ${contentRecord.serverUrl}`); problem = true; } - if ( - !isRelativePathRoot(contentRecord.projectDir) && - config && - !isConfigurationError(config) - ) { - details.push( - `${contentRecord.projectDir}${path.sep}${config.configuration.entrypoint}`, - ); + if (!isRelativePathRoot(contentRecord.projectDir)) { + if (config && !isConfigurationError(config)) { + details.push( + `${contentRecord.projectDir}${path.sep}${config.configuration.entrypoint}`, + ); + } else { + details.push(`${contentRecord.projectDir}${path.sep}`); + } } const detail = details.join(" • "); diff --git a/extensions/vscode/webviews/homeView/package-lock.json b/extensions/vscode/webviews/homeView/package-lock.json index 6203a2e47..7e41dc17b 100644 --- a/extensions/vscode/webviews/homeView/package-lock.json +++ b/extensions/vscode/webviews/homeView/package-lock.json @@ -11,12 +11,14 @@ "axios": "^1.7.4", "eventsource": "^2.0.2", "get-port": "5.1.1", + "path-browserify": "^1.0.1", "pinia": "^2.1.7", "vue": "^3.4.21" }, "devDependencies": { "@tsconfig/node20": "^20.1.4", "@types/node": "^20.14.2", + "@types/path-browserify": "^1.0.3", "@types/vscode-webview": "^1.57.5", "@vitejs/plugin-vue": "^5.0.4", "@vscode/webview-ui-toolkit": "^1.4.0", @@ -775,6 +777,13 @@ "undici-types": "~6.19.2" } }, + "node_modules/@types/path-browserify": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@types/path-browserify/-/path-browserify-1.0.3.tgz", + "integrity": "sha512-ZmHivEbNCBtAfcrFeBCiTjdIc2dey0l7oCGNGpSuRTy8jP6UVND7oUowlvDujBy8r2Hoa8bfFUOCiPWfmtkfxw==", + "dev": true, + "license": "MIT" + }, "node_modules/@types/vscode-webview": { "version": "1.57.5", "resolved": "https://registry.npmjs.org/@types/vscode-webview/-/vscode-webview-1.57.5.tgz", @@ -1889,7 +1898,7 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-1.0.1.tgz", "integrity": "sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g==", - "dev": true + "license": "MIT" }, "node_modules/path-key": { "version": "3.1.1", diff --git a/extensions/vscode/webviews/homeView/package.json b/extensions/vscode/webviews/homeView/package.json index 0bb38e797..27f02fa5b 100644 --- a/extensions/vscode/webviews/homeView/package.json +++ b/extensions/vscode/webviews/homeView/package.json @@ -11,11 +11,13 @@ "axios": "^1.7.4", "eventsource": "^2.0.2", "get-port": "5.1.1", + "path-browserify": "^1.0.1", "pinia": "^2.1.7", "vue": "^3.4.21" }, "devDependencies": { "@tsconfig/node20": "^20.1.4", + "@types/path-browserify": "^1.0.3", "@types/node": "^20.14.2", "@types/vscode-webview": "^1.57.5", "@vitejs/plugin-vue": "^5.0.4", diff --git a/extensions/vscode/webviews/homeView/src/components/EvenEasierDeploy.vue b/extensions/vscode/webviews/homeView/src/components/EvenEasierDeploy.vue index 50cfb2df5..4ba7f55ce 100644 --- a/extensions/vscode/webviews/homeView/src/components/EvenEasierDeploy.vue +++ b/extensions/vscode/webviews/homeView/src/components/EvenEasierDeploy.vue @@ -332,19 +332,15 @@ const entrypointSubTitle = computed(() => { ) { const contentRecord = home.selectedContentRecord; const config = home.selectedConfiguration; - if ( - contentRecord && - config.configuration.entrypoint && - !isConfigurationError(config) - ) { - return path.join( - contentRecord.projectDir, - config.configuration.entrypoint, - ); - // return `${contentRecord.projectDir}/${config.configuration.entrypoint}`; + if (contentRecord) { + if (isConfigInError.value) { + return `${contentRecord.projectDir}${path.sep}`; + } else { + return `${contentRecord.projectDir}${path.sep}${config.configuration.entrypoint}`; + } } } - return "Entrypoint not determined"; + return "ProjectDir and Entrypoint not determined"; }); const isCredentialMissing = computed((): boolean => { @@ -535,31 +531,4 @@ const newCredential = () => { margin-top: 5px; margin-bottom: 0px; } - -.deployment-details-container { - margin-bottom: 0.5rem; - - .deployment-details-row { - display: flex; - align-items: center; - - .deployment-details-label { - font-size: 0.9em; - line-height: normal; - opacity: 1; - overflow: hidden; - text-overflow: ellipsis; - white-space: pre; - } - - .deployment-details-info { - font-size: 0.8em; - line-height: normal; - opacity: 0.7; - overflow: hidden; - text-overflow: ellipsis; - white-space: pre; - } - } -} From 7505f9994fdf19dc796a2032a32f2b326ad6bdaf Mon Sep 17 00:00:00 2001 From: Kevin Gartland Date: Fri, 20 Sep 2024 13:07:46 -0400 Subject: [PATCH 3/8] update ui tests --- .../webviews/homeView/src/components/EvenEasierDeploy.vue | 1 + test/vscode-ui/test/specs/nested-fastapi-deployment.spec.ts | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/extensions/vscode/webviews/homeView/src/components/EvenEasierDeploy.vue b/extensions/vscode/webviews/homeView/src/components/EvenEasierDeploy.vue index 4ba7f55ce..c60d215b1 100644 --- a/extensions/vscode/webviews/homeView/src/components/EvenEasierDeploy.vue +++ b/extensions/vscode/webviews/homeView/src/components/EvenEasierDeploy.vue @@ -20,6 +20,7 @@ :label="deploymentTitle" :details="deploymentSubTitles" :title="toolTipText" + :data-automation="`entrypoint-label`" />
{ // switch out of iframe await browser.switchToFrame(null); const myConfig = browser.$( - `aria/my fastapi app, fastapi-simple${sep} • my connect server, Existing`, + `aria/my connect server • fastapi-simple${sep}simple.py`, ); await expect(myConfig).toExist(); myConfig.click(); @@ -94,7 +94,8 @@ describe("Nested Fast API Deployment", () => { it("can confirm Deployment Details", async () => { const deploymentName = await $('[data-automation="entrypoint-label"]'); - await expect(deploymentName).toHaveText("simple.py"); + const deploymentDetails = `my fastapi app\nmy connect server\nfastapi-simple${sep}simple.py`; + await expect(deploymentName).toHaveText(deploymentDetails); }); it("can confirm Deployment Status", async () => { From 06e160ed45304368f2d7e69764dcbdaa7dc02230 Mon Sep 17 00:00:00 2001 From: Bill Sager Date: Fri, 20 Sep 2024 12:24:25 -0700 Subject: [PATCH 4/8] remove use of path-browserify and instead pass down path separator from node environment of extension. --- .../src/types/messages/hostToWebviewMessages.ts | 14 ++++++++++++-- extensions/vscode/src/views/homeView.ts | 9 +++++++++ .../vscode/webviews/homeView/package-lock.json | 10 +--------- extensions/vscode/webviews/homeView/package.json | 2 -- .../webviews/homeView/src/HostConduitService.ts | 7 +++++++ .../homeView/src/components/EvenEasierDeploy.vue | 4 ++-- .../vscode/webviews/homeView/src/stores/home.ts | 2 ++ 7 files changed, 33 insertions(+), 15 deletions(-) diff --git a/extensions/vscode/src/types/messages/hostToWebviewMessages.ts b/extensions/vscode/src/types/messages/hostToWebviewMessages.ts index 6ee3ef487..57ded072f 100644 --- a/extensions/vscode/src/types/messages/hostToWebviewMessages.ts +++ b/extensions/vscode/src/types/messages/hostToWebviewMessages.ts @@ -27,6 +27,7 @@ export enum HostToWebviewMessageType { UPDATE_R_PACKAGES = "updateRPackages", SHOW_DISABLE_OVERLAY = "showDisableOverlay", HIDE_DISABLE_OVERLAY = "hideDisableOverlay", + SET_PATH_SEPARATOR = "setPathSeparator", } export type AnyHostToWebviewMessage< @@ -53,7 +54,8 @@ export type HostToWebviewMessage = | UpdatePythonPackages | UpdateRPackages | ShowDisableOverlayMsg - | HideDisableOverlayMsg; + | HideDisableOverlayMsg + | SetPathSeparatorMsg; export function isHostToWebviewMessage(msg: any): msg is HostToWebviewMessage { return ( @@ -70,7 +72,8 @@ export function isHostToWebviewMessage(msg: any): msg is HostToWebviewMessage { msg.kind === HostToWebviewMessageType.UPDATE_PYTHON_PACKAGES || msg.kind === HostToWebviewMessageType.UPDATE_R_PACKAGES || msg.kind === HostToWebviewMessageType.SHOW_DISABLE_OVERLAY || - msg.kind === HostToWebviewMessageType.HIDE_DISABLE_OVERLAY + msg.kind === HostToWebviewMessageType.HIDE_DISABLE_OVERLAY || + msg.kind === HostToWebviewMessageType.SET_PATH_SEPARATOR ); } @@ -152,3 +155,10 @@ export type ShowDisableOverlayMsg = export type HideDisableOverlayMsg = AnyHostToWebviewMessage; + +export type SetPathSeparatorMsg = AnyHostToWebviewMessage< + HostToWebviewMessageType.SET_PATH_SEPARATOR, + { + separator: string; + } +>; diff --git a/extensions/vscode/src/views/homeView.ts b/extensions/vscode/src/views/homeView.ts index 3416ee2f9..3fd559113 100644 --- a/extensions/vscode/src/views/homeView.ts +++ b/extensions/vscode/src/views/homeView.ts @@ -271,6 +271,15 @@ export class HomeViewProvider implements WebviewViewProvider, Disposable { } private async onInitializingMsg() { + // inform webview of the platform specific path separator + // (path package is a node library, wrapper for browser doesn't seem to work in webview correctly) + this.webviewConduit.sendMsg({ + kind: HostToWebviewMessageType.SET_PATH_SEPARATOR, + content: { + separator: path.sep, + }, + }); + // send back the data needed. Optimize request for initialization... await this.refreshAll(false, true); this.setInitializationContext(HomeViewInitialized.initialized); diff --git a/extensions/vscode/webviews/homeView/package-lock.json b/extensions/vscode/webviews/homeView/package-lock.json index 7e41dc17b..b08f973d5 100644 --- a/extensions/vscode/webviews/homeView/package-lock.json +++ b/extensions/vscode/webviews/homeView/package-lock.json @@ -11,14 +11,12 @@ "axios": "^1.7.4", "eventsource": "^2.0.2", "get-port": "5.1.1", - "path-browserify": "^1.0.1", "pinia": "^2.1.7", "vue": "^3.4.21" }, "devDependencies": { "@tsconfig/node20": "^20.1.4", "@types/node": "^20.14.2", - "@types/path-browserify": "^1.0.3", "@types/vscode-webview": "^1.57.5", "@vitejs/plugin-vue": "^5.0.4", "@vscode/webview-ui-toolkit": "^1.4.0", @@ -777,13 +775,6 @@ "undici-types": "~6.19.2" } }, - "node_modules/@types/path-browserify": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/@types/path-browserify/-/path-browserify-1.0.3.tgz", - "integrity": "sha512-ZmHivEbNCBtAfcrFeBCiTjdIc2dey0l7oCGNGpSuRTy8jP6UVND7oUowlvDujBy8r2Hoa8bfFUOCiPWfmtkfxw==", - "dev": true, - "license": "MIT" - }, "node_modules/@types/vscode-webview": { "version": "1.57.5", "resolved": "https://registry.npmjs.org/@types/vscode-webview/-/vscode-webview-1.57.5.tgz", @@ -1898,6 +1889,7 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-1.0.1.tgz", "integrity": "sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g==", + "dev": true, "license": "MIT" }, "node_modules/path-key": { diff --git a/extensions/vscode/webviews/homeView/package.json b/extensions/vscode/webviews/homeView/package.json index 27f02fa5b..0bb38e797 100644 --- a/extensions/vscode/webviews/homeView/package.json +++ b/extensions/vscode/webviews/homeView/package.json @@ -11,13 +11,11 @@ "axios": "^1.7.4", "eventsource": "^2.0.2", "get-port": "5.1.1", - "path-browserify": "^1.0.1", "pinia": "^2.1.7", "vue": "^3.4.21" }, "devDependencies": { "@tsconfig/node20": "^20.1.4", - "@types/path-browserify": "^1.0.3", "@types/node": "^20.14.2", "@types/vscode-webview": "^1.57.5", "@vitejs/plugin-vue": "^5.0.4", diff --git a/extensions/vscode/webviews/homeView/src/HostConduitService.ts b/extensions/vscode/webviews/homeView/src/HostConduitService.ts index 524e65447..6bf5acdc6 100644 --- a/extensions/vscode/webviews/homeView/src/HostConduitService.ts +++ b/extensions/vscode/webviews/homeView/src/HostConduitService.ts @@ -13,6 +13,7 @@ import { UpdatePythonPackages, UpdateRPackages, RefreshFilesMsg, + SetPathSeparatorMsg, } from "../../../src/types/messages/hostToWebviewMessages"; import { WebviewToHostMessage, @@ -83,11 +84,17 @@ const onMessageFromHost = (msg: HostToWebviewMessage): void => { return onShowDisableOverlayMsg(); case HostToWebviewMessageType.HIDE_DISABLE_OVERLAY: return onHideDisableOverlayMsg(); + case HostToWebviewMessageType.SET_PATH_SEPARATOR: + return onSetPathSeparatorMsg(msg); default: console.warn(`unexpected command: ${JSON.stringify(msg)}`); } }; +const onSetPathSeparatorMsg = (msg: SetPathSeparatorMsg) => { + useHomeStore().platformFileSeparator = msg.content.separator; +}; + const onInitializingRequestCompleteMsg = () => { useHomeStore().initializingRequestComplete = true; }; diff --git a/extensions/vscode/webviews/homeView/src/components/EvenEasierDeploy.vue b/extensions/vscode/webviews/homeView/src/components/EvenEasierDeploy.vue index 4ba7f55ce..b633fefec 100644 --- a/extensions/vscode/webviews/homeView/src/components/EvenEasierDeploy.vue +++ b/extensions/vscode/webviews/homeView/src/components/EvenEasierDeploy.vue @@ -334,9 +334,9 @@ const entrypointSubTitle = computed(() => { const config = home.selectedConfiguration; if (contentRecord) { if (isConfigInError.value) { - return `${contentRecord.projectDir}${path.sep}`; + return `${contentRecord.projectDir}${home.platformFileSeparator}`; } else { - return `${contentRecord.projectDir}${path.sep}${config.configuration.entrypoint}`; + return `${contentRecord.projectDir}${home.platformFileSeparator}${config.configuration.entrypoint}`; } } } diff --git a/extensions/vscode/webviews/homeView/src/stores/home.ts b/extensions/vscode/webviews/homeView/src/stores/home.ts index 547c62492..06e08604b 100644 --- a/extensions/vscode/webviews/homeView/src/stores/home.ts +++ b/extensions/vscode/webviews/homeView/src/stores/home.ts @@ -17,6 +17,7 @@ import { DeploymentSelector } from "../../../../src/types/shared"; import { splitFilesOnInclusion } from "src/utils/files"; export const useHomeStore = defineStore("home", () => { + const platformFileSeparator = ref("/"); const publishInProgress = ref(false); const contentRecords = ref<(ContentRecord | PreContentRecord)[]>([]); @@ -187,6 +188,7 @@ export const useHomeStore = defineStore("home", () => { }; return { + platformFileSeparator, showDisabledOverlay, publishInProgress, contentRecords, From cb21af99df925e4a257098bba7fb6a0fd5a9a06a Mon Sep 17 00:00:00 2001 From: Bill Sager Date: Fri, 20 Sep 2024 17:33:49 -0700 Subject: [PATCH 5/8] suppress display of "./" --- .../homeView/src/components/EvenEasierDeploy.vue | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/extensions/vscode/webviews/homeView/src/components/EvenEasierDeploy.vue b/extensions/vscode/webviews/homeView/src/components/EvenEasierDeploy.vue index 549bf5c00..e54160dcf 100644 --- a/extensions/vscode/webviews/homeView/src/components/EvenEasierDeploy.vue +++ b/extensions/vscode/webviews/homeView/src/components/EvenEasierDeploy.vue @@ -334,11 +334,14 @@ const entrypointSubTitle = computed(() => { const contentRecord = home.selectedContentRecord; const config = home.selectedConfiguration; if (contentRecord) { - if (isConfigInError.value) { - return `${contentRecord.projectDir}${home.platformFileSeparator}`; - } else { - return `${contentRecord.projectDir}${home.platformFileSeparator}${config.configuration.entrypoint}`; + let subTitle = ""; + if (contentRecord.projectDir !== ".") { + subTitle = `${contentRecord.projectDir}${home.platformFileSeparator}`; } + if (!isConfigInError.value) { + subTitle += config.configuration.entrypoint; + } + return subTitle; } } return "ProjectDir and Entrypoint not determined"; From 9cd86833393e6ecb65c1a01b314294a35619b097 Mon Sep 17 00:00:00 2001 From: Jordan Jensen Date: Mon, 23 Sep 2024 15:52:59 -0700 Subject: [PATCH 6/8] Remove path-browserify from vite config --- extensions/vscode/webviews/homeView/vite.config.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/extensions/vscode/webviews/homeView/vite.config.ts b/extensions/vscode/webviews/homeView/vite.config.ts index 814f7e13e..ef318c263 100644 --- a/extensions/vscode/webviews/homeView/vite.config.ts +++ b/extensions/vscode/webviews/homeView/vite.config.ts @@ -16,7 +16,6 @@ export default defineConfig({ resolve: { alias: { src: fileURLToPath(new URL("./src", import.meta.url)), - path: "path-browserify", }, }, build: { From 9ef1dddaf62dfc95bbef83bb53d42fa7222e3cc2 Mon Sep 17 00:00:00 2001 From: Jordan Jensen Date: Mon, 23 Sep 2024 16:09:08 -0700 Subject: [PATCH 7/8] Remove unused imports in EvenEasierDeploy --- .../webviews/homeView/src/components/EvenEasierDeploy.vue | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/extensions/vscode/webviews/homeView/src/components/EvenEasierDeploy.vue b/extensions/vscode/webviews/homeView/src/components/EvenEasierDeploy.vue index e54160dcf..07bccd794 100644 --- a/extensions/vscode/webviews/homeView/src/components/EvenEasierDeploy.vue +++ b/extensions/vscode/webviews/homeView/src/components/EvenEasierDeploy.vue @@ -162,9 +162,7 @@