Skip to content
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

Disable homeview's Easy Deploy View until ready #1961

Merged
merged 24 commits into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
3e6d080
recursive inspection, create deployment and configuration within dir …
sagerb Jul 9, 2024
bc4cd80
Update watcher patterns to be recursive
sagerb Jul 10, 2024
263d27f
Recursive API calls, integrate projectDir and switch to deploymentSel…
sagerb Jul 10, 2024
fb7b6ad
Deploy with projectDir parameter (and update deployment tooltip)
sagerb Jul 10, 2024
e9781c4
Fix codicons path issue (underscore was lost during search/replace)
sagerb Jul 10, 2024
73d105c
Merge remote-tracking branch 'origin/main' into sagerb-select-from-re…
sagerb Jul 10, 2024
e9fda93
Refactor use of deploymentSelector and use deploymentPath as unique "…
sagerb Jul 10, 2024
05a1424
start of select config for deployment updates
sagerb Jul 11, 2024
5a6f432
update selection w/ new unique deployment key (full path)
sagerb Jul 11, 2024
5876514
update message string missed in earlier refactoring.
sagerb Jul 11, 2024
201d5f1
remove commented out code.
sagerb Jul 11, 2024
edcd8b5
refactored changes to make dir mandatory for API calls. Updated watch…
sagerb Jul 11, 2024
aba4cbd
Temporarily update response from API for the value we need when we us…
sagerb Jul 12, 2024
04a80a7
show projectDir when selecting entrypoints
sagerb Jul 12, 2024
03d8132
move progress indicator to configurations view and update clone initi…
sagerb Jul 12, 2024
3e4cca4
show progress on initial tree load/refresh
sagerb Jul 12, 2024
9d986f5
Add progress indicator for api duration when refreshing/initial popul…
sagerb Jul 12, 2024
647faed
add progress indicators while APIs are outstanding
sagerb Jul 12, 2024
ea1b9a0
show scanning message until init apis are complete
sagerb Jul 12, 2024
eab56c1
disable noisy bus and event traces
sagerb Jul 12, 2024
e241319
Implement duration tracing for axios calls
sagerb Jul 12, 2024
535cfcb
implement showProgress utility, with duration tracing
sagerb Jul 12, 2024
8a2be03
use new showProgress utility rather than window.withProgress
sagerb Jul 12, 2024
8d78100
Merge pull request #1962 from posit-dev/sagerb-instrument-vscode-prog…
sagerb Jul 16, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ vendor

# VSCode Extension
extensions/vscode/out
test/sample-content

# webdriver.io service
test/vscode-ui/.wdio-vscode-service
extensions/vscode/dist
extensions/vscode/node_modules
extensions/vscode/webviews/homeView/node_modules
extensions/vscode/webviews/homeView/dist
4 changes: 2 additions & 2 deletions extensions/vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@
"category": "Posit Publisher"
},
{
"command": "posit.publisher.homeView.selectConfigForDeployment",
"command": "posit.publisher.homeView.showSelectConfigForDeployment",
"title": "Select Active Configuration For Deployment",
"category": "Posit Publisher"
},
Expand Down Expand Up @@ -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'"
},
{
Expand Down
10 changes: 5 additions & 5 deletions extensions/vscode/src/api/resources/Configurations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export class Configurations {
// 200 - success
// 404 - not found
// 500 - internal server error
get(configName: string, params?: { dir?: string }) {
get(configName: string, params: { dir: string }) {
const encodedName = encodeURIComponent(configName);
return this.client.get<Configuration | ConfigurationError>(
`/configurations/${encodedName}`,
Expand All @@ -31,7 +31,7 @@ export class Configurations {
// Returns:
// 200 - success
// 500 - internal server error
getAll(params?: { dir?: string; entrypoint?: string; recursive?: boolean }) {
getAll(params: { dir: string; entrypoint?: string; recursive?: boolean }) {
return this.client.get<Array<Configuration | ConfigurationError>>(
"/configurations",
{ params },
Expand All @@ -45,7 +45,7 @@ export class Configurations {
createOrUpdate(
configName: string,
cfg: ConfigurationDetails,
params?: { dir?: string },
params: { dir: string },
) {
const encodedName = encodeURIComponent(configName);
return this.client.put<Configuration>(
Expand All @@ -59,7 +59,7 @@ export class Configurations {
// 204 - success (no response)
// 404 - not found
// 500 - internal server error
delete(configName: string, params?: { dir?: string }) {
delete(configName: string, params: { dir: string }) {
const encodedName = encodeURIComponent(configName);
return this.client.delete(`configurations/${encodedName}`, { params });
}
Expand All @@ -70,8 +70,8 @@ export class Configurations {
// 400 - bad request
// 500 - internal server error
inspect(
params: { dir: string; entrypoint?: string; recursive?: boolean },
python?: string,
params?: { dir?: string; entrypoint?: string; recursive?: boolean },
) {
return this.client.post<ConfigurationInspectionResult[]>(
"/inspect",
Expand Down
12 changes: 6 additions & 6 deletions extensions/vscode/src/api/resources/ContentRecords.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export class ContentRecords {
// Returns:
// 200 - success
// 500 - internal server error
getAll(params?: { dir?: string; entrypoints?: string; recursive?: boolean }) {
getAll(params: { dir: string; entrypoints?: string; recursive?: boolean }) {
return this.client.get<Array<AllContentRecordTypes>>("/deployments", {
params,
});
Expand All @@ -28,7 +28,7 @@ export class ContentRecords {
// 200 - success
// 404 - not found
// 500 - internal server error
get(id: string, params?: { dir?: string }) {
get(id: string, params: { dir: string }) {
const encodedId = encodeURIComponent(id);
return this.client.get<AllContentRecordTypes>(`deployments/${encodedId}`, {
params,
Expand All @@ -42,10 +42,10 @@ export class ContentRecords {
// 500 - internal server error
// Errors returned through event stream
createNew(
params: { dir: string },
accountName?: string,
configName?: string,
saveName?: string,
params?: { dir?: string },
) {
const data = {
account: accountName,
Expand All @@ -61,10 +61,10 @@ export class ContentRecords {
// 500 - internal server error
// Errors returned through event stream
publish(
params: { dir: string },
targetName: string,
accountName: string,
configName: string = "default",
params?: { dir?: string },
) {
const data = {
account: accountName,
Expand All @@ -82,7 +82,7 @@ export class ContentRecords {
// 204 - no content
// 404 - not found
// 500 - internal server error
delete(saveName: string, params?: { dir?: string }) {
delete(saveName: string, params: { dir: string }) {
const encodedSaveName = encodeURIComponent(saveName);
return this.client.delete(`deployments/${encodedSaveName}`, { params });
}
Expand All @@ -91,7 +91,7 @@ export class ContentRecords {
// 204 - no content
// 404 - contentRecord or config file not found
// 500 - internal server error
patch(deploymentName: string, configName: string, params?: { dir?: string }) {
patch(deploymentName: string, configName: string, params: { dir: string }) {
const encodedName = encodeURIComponent(deploymentName);
return this.client.patch<ContentRecord>(
`deployments/${encodedName}`,
Expand Down
4 changes: 2 additions & 2 deletions extensions/vscode/src/api/resources/Files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export class Files {
// 404 - configuration does not exist
// 422 - configuration files list contains invalid patterns
// 500 - internal server error
getByConfiguration(configName: string, params?: { dir?: string }) {
getByConfiguration(configName: string, params: { dir: string }) {
const encodedName = encodeURIComponent(configName);
return this.client.get<ContentRecordFile>(
`/configurations/${encodedName}/files`,
Expand All @@ -37,7 +37,7 @@ export class Files {
configName: string,
path: string,
action: FileAction,
params?: { dir?: string },
params: { dir: string },
) {
const encodedName = encodeURIComponent(configName);
const body = {
Expand Down
8 changes: 4 additions & 4 deletions extensions/vscode/src/api/resources/Packages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class Packages {
// 409 - conflict (Python is not configured)
// 422 - package file is invalid
// 500 - internal server error
getPythonPackages(configName: string, params?: { dir?: string }) {
getPythonPackages(configName: string, params: { dir: string }) {
const encodedName = encodeURIComponent(configName);
return this.client.get<PythonPackagesResponse>(
`/configurations/${encodedName}/packages/python`,
Expand All @@ -33,7 +33,7 @@ export class Packages {
// 409 - conflict (R is not configured)
// 422 - package file is invalid
// 500 - internal server error
getRPackages(configName: string, params?: { dir?: string }) {
getRPackages(configName: string, params: { dir: string }) {
const encodedName = encodeURIComponent(configName);
return this.client.get<GetRPackagesResponse>(
`/configurations/${encodedName}/packages/r`,
Expand All @@ -46,9 +46,9 @@ export class Packages {
// 400 - bad request
// 500 - internal server error
createPythonRequirementsFile(
params: { dir: string },
python?: string,
saveName?: string,
params?: { dir?: string },
) {
return this.client.post<void>(
"packages/python/scan",
Expand All @@ -61,7 +61,7 @@ export class Packages {
// 200 - success
// 400 - bad request
// 500 - internal server error
createRRequirementsFile(saveName?: string, params?: { dir?: string }) {
createRRequirementsFile(params: { dir: string }, saveName?: string) {
return this.client.post<void>("packages/r/scan", { saveName }, { params });
}
}
29 changes: 15 additions & 14 deletions extensions/vscode/src/bus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,25 @@ export const bus = Omnibus.builder()
.build();

// Setup message logging
bus.on("activeContentRecordChanged", (msg) => {
console.debug(
`\nbus trace: activeContentRecordChanged: ${JSON.stringify(msg)}\n`,
);
});
bus.on("activeConfigChanged", (msg) => {
bus.on(
"activeContentRecordChanged",
(msg: ContentRecord | PreContentRecord | undefined) => {
console.debug(
`\nbus trace: activeContentRecordChanged: ${JSON.stringify(msg)}\n`,
);
},
);
bus.on("activeConfigChanged", (msg: Configuration | undefined) => {
console.debug(`\nbus trace: activeConfigChanged: ${JSON.stringify(msg)}\n`);
});
bus.on("requestActiveConfig", (msg) => {
console.debug(`\nbus trace: requestActiveConfig: ${JSON.stringify(msg)}`);
bus.on("requestActiveConfig", () => {
console.debug(`\nbus trace: requestActiveConfig`);
});
bus.on("requestActiveContentRecord", (msg) => {
console.debug(
`\nbus trace: requestActiveContentRecord: ${JSON.stringify(msg)}`,
);
bus.on("requestActiveContentRecord", () => {
console.debug(`\nbus trace: requestActiveContentRecord`);
});
bus.on("refreshCredentials", (msg) => {
console.debug(`\nbus trace: refreshCredentials: ${JSON.stringify(msg)}`);
bus.on("refreshCredentials", () => {
console.debug(`\nbus trace: refreshCredentials`);
});

export const useBus = () => {
Expand Down
16 changes: 8 additions & 8 deletions extensions/vscode/src/constants.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// Copyright (C) 2024 by Posit Software, PBC.

export const POSIT_FOLDER = ".posit";
export const PUBLISH_FOLDER = ".posit/publish";
export const PUBLISH_DEPLOYMENTS_FOLDER = ".posit/publish/deployments";
export const POSIT_FOLDER = "**/.posit";
export const PUBLISH_FOLDER = "**/.posit/publish";
export const PUBLISH_DEPLOYMENTS_FOLDER = "**/.posit/publish/deployments";

export const CONFIGURATIONS_PATTERN = ".posit/publish/*.toml";
export const DEPLOYMENTS_PATTERN = ".posit/publish/deployments/*.toml";
export const CONFIGURATIONS_PATTERN = "**/.posit/publish/*.toml";
export const DEPLOYMENTS_PATTERN = "**/.posit/publish/deployments/*.toml";

export const DEFAULT_PYTHON_PACKAGE_FILE = "requirements.txt";
export const DEFAULT_R_PACKAGE_FILE = "renv.lock";
Expand Down Expand Up @@ -85,8 +85,8 @@ const rPackagesCommands = {

const homeViewCommands = {
Refresh: "posit.publisher.homeView.refresh",
SelectConfigForDeployment:
"posit.publisher.homeView.selectConfigForDeployment",
ShowSelectConfigForDeployment:
"posit.publisher.homeView.showSelectConfigForDeployment",
CreateConfigForDeployment:
"posit.publisher.homeView.createConfigForDeployment",
SelectDeployment: "posit.publisher.homeView.selectDeployment",
Expand All @@ -110,7 +110,7 @@ const helpAndFeedbackCommands = {
} as const;

export const LocalState = {
LastSelectionState: "posit.publisher.homeView.lastSelectionState.v2",
LastSelectionState: "posit.publisher.homeView.lastDeploymentSelectedState",
};

export const Commands = {
Expand Down
11 changes: 7 additions & 4 deletions extensions/vscode/src/entrypointTracker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,13 @@ async function isDocumentEntrypoint(document: TextDocument): Promise<boolean> {
const api = await useApi();
const python = await getPythonInterpreterPath();

const response = await api.configurations.inspect(python, {
dir: dir,
entrypoint: uriUtils.basename(document.uri),
});
const response = await api.configurations.inspect(
{
dir: dir,
entrypoint: uriUtils.basename(document.uri),
},
python,
);

return hasKnownContentType(response.data);
} catch (error: unknown) {
Expand Down
13 changes: 11 additions & 2 deletions extensions/vscode/src/multiStepInputs/newConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@ export async function newConfig(title: string, viewId?: string) {
async (resolve, reject) => {
try {
const python = await getPythonInterpreterPath();
const inspectResponse = await api.configurations.inspect(python);
const inspectResponse = await api.configurations.inspect(
{ dir: ".", recursive: true },
python,
);
inspectionResults = inspectResponse.data;
inspectionResults.forEach((result, i) => {
const config = result.configuration;
Expand All @@ -48,6 +51,7 @@ export async function newConfig(title: string, viewId?: string) {
iconPath: new ThemeIcon("file"),
label: config.entrypoint,
description: `(${contentTypeStrings[config.type]})`,
detail: `${result.projectDir}/`,
index: i,
});
}
Expand Down Expand Up @@ -239,10 +243,15 @@ export async function newConfig(title: string, viewId?: string) {
return;
}
selectedInspectionResult.configuration.title = state.data.title;
const configName = await untitledConfigurationName();
const configName = await untitledConfigurationName(
selectedInspectionResult.projectDir,
);
const createResponse = await api.configurations.createOrUpdate(
configName,
selectedInspectionResult.configuration,
{
dir: selectedInspectionResult.projectDir,
},
);
newConfig = createResponse.data;
const fileUri = Uri.file(newConfig.configurationPath);
Expand Down
Loading