-
Notifications
You must be signed in to change notification settings - Fork 0
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
Use of project dir and new deployment selector for subdirectory support w/ select configuration support #1946
Changes from 4 commits
e9fda93
05a1424
5a6f432
5876514
201d5f1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -185,7 +185,7 @@ | |
"category": "Posit Publisher" | ||
}, | ||
{ | ||
"command": "posit.publisher.homeView.selectConfigForDeployment", | ||
"command": "posit.publisher.homeView.showSelectConfigForDeployment", | ||
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. Change made to remove confusion (mostly my own). |
||
"title": "Select Active Configuration For Deployment", | ||
"category": "Posit Publisher" | ||
}, | ||
|
@@ -460,7 +460,7 @@ | |
], | ||
"webview/context": [ | ||
{ | ||
"command": "posit.publisher.homeView.selectConfigForDeployment", | ||
"command": "posit.publisher.homeView.showSelectConfigForDeployment", | ||
"when": "webviewId == 'posit.publisher.homeView' && webviewSection == 'even-easier-deploy-more-menu-matching-configs'" | ||
}, | ||
{ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -81,7 +81,9 @@ export async function selectConfig( | |
|
||
const getConfigurations = new Promise<void>(async (resolve, reject) => { | ||
try { | ||
const response = await api.configurations.getAll(); | ||
const response = await api.configurations.getAll({ | ||
dir: activeDeployment.projectDir, | ||
}); | ||
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. Only can select configurations from the same location as the deployment file. |
||
let rawConfigs = response.data; | ||
// Filter down configs to same content type as active deployment, | ||
// but also allowing configs if active Deployment is a preDeployment | ||
|
@@ -135,7 +137,9 @@ export async function selectConfig( | |
async (resolve, reject) => { | ||
try { | ||
const python = await getPythonInterpreterPath(); | ||
const inspectResponse = await api.configurations.inspect(python); | ||
const inspectResponse = await api.configurations.inspect(python, { | ||
dir: activeDeployment.projectDir, | ||
}); | ||
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. This is selecting a config for an existing deployment, so we have to limit choices to the configs which are present in that particular project dir where the entrypoint was found. |
||
inspectionResults = filterInspectionResultsToType( | ||
inspectResponse.data, | ||
activeDeployment.type, | ||
|
@@ -428,7 +432,7 @@ export async function selectConfig( | |
) { | ||
return ( | ||
config.configurationName === | ||
state.data.existingConfigurationName.label | ||
state.data.existingConfigurationName.detail | ||
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. configuration name is in |
||
); | ||
} | ||
return false; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,7 +20,6 @@ export enum HostToWebviewMessageType { | |
PUBLISH_FINISH_SUCCESS = "publishFinishSuccess", | ||
PUBLISH_FINISH_FAILURE = "publishFinishFailure", | ||
UPDATE_CONTENTRECORD_SELECTION = "updateContentRecordSelection", | ||
UPDATE_CONFIG_SELECTION = "updateConfigSelection", | ||
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. We no longer update the config selection. The config is ALWAYS determined by what configuration name is present within the contentRecord, which is read from the file. If we want to change it, we patch the deployment, thus updating the file and causing a refresh, where the new configuration name is picked up. |
||
SAVE_SELECTION = "saveSelection", | ||
REFRESH_FILES_LISTS = "refreshFilesLists", | ||
UPDATE_PYTHON_PACKAGES = "updatePythonPackages", | ||
|
@@ -45,7 +44,6 @@ export type HostToWebviewMessage = | |
| PublishFinishSuccessMsg | ||
| PublishFinishFailureMsg | ||
| UpdateContentRecordSelectionMsg | ||
| UpdateConfigSelectionMsg | ||
| SaveSelectionMsg | ||
| RefreshFilesListsMsg | ||
| UpdatePythonPackages | ||
|
@@ -60,7 +58,6 @@ export function isHostToWebviewMessage(msg: any): msg is HostToWebviewMessage { | |
msg.kind === HostToWebviewMessageType.PUBLISH_FINISH_SUCCESS || | ||
msg.kind === HostToWebviewMessageType.PUBLISH_FINISH_FAILURE || | ||
msg.kind === HostToWebviewMessageType.UPDATE_CONTENTRECORD_SELECTION || | ||
msg.kind === HostToWebviewMessageType.UPDATE_CONFIG_SELECTION || | ||
msg.kind === HostToWebviewMessageType.SAVE_SELECTION || | ||
msg.kind === HostToWebviewMessageType.REFRESH_FILES_LISTS || | ||
msg.kind === HostToWebviewMessageType.UPDATE_PYTHON_PACKAGES || | ||
|
@@ -80,7 +77,6 @@ export type RefreshConfigDataMsg = AnyHostToWebviewMessage< | |
{ | ||
configurations: Configuration[]; | ||
configurationsInError: ConfigurationError[]; | ||
deploymentSelected: DeploymentSelector | null; | ||
} | ||
>; | ||
export type RefreshCredentialDataMsg = AnyHostToWebviewMessage< | ||
|
@@ -108,13 +104,6 @@ export type UpdateContentRecordSelectionMsg = AnyHostToWebviewMessage< | |
saveSelection?: boolean; | ||
} | ||
>; | ||
export type UpdateConfigSelectionMsg = AnyHostToWebviewMessage< | ||
HostToWebviewMessageType.UPDATE_CONFIG_SELECTION, | ||
{ | ||
config: Configuration; | ||
saveSelection?: boolean; | ||
} | ||
>; | ||
export type SaveSelectionMsg = | ||
AnyHostToWebviewMessage<HostToWebviewMessageType.SAVE_SELECTION>; | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,9 +8,7 @@ import { | |
} from "../api"; | ||
|
||
export type DeploymentSelector = { | ||
deploymentName: string; | ||
projectDir: string; | ||
configurationName?: string; | ||
deploymentPath: string; | ||
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. The deploymentPath value is guaranteed to be unique across the user's installation. This is set by the agent while reading the file system. Once we match up to the applicable contentRecord, we then use information within it to find the configuration and projectDir, thus switching back to a relative access which works for all users, even if sharing files. |
||
}; | ||
|
||
export type HomeViewState = DeploymentSelector | null; | ||
|
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.
Changes have been replicated into different PR, should clean up after some merges. #1948