Skip to content

Commit

Permalink
Merge branch 'main' into mm-config-name-in-api
Browse files Browse the repository at this point in the history
  • Loading branch information
mmarchetti committed Apr 3, 2024
2 parents d64c6f5 + 09a6045 commit ab16a17
Show file tree
Hide file tree
Showing 42 changed files with 3,361 additions and 107 deletions.
3 changes: 1 addition & 2 deletions cmd/publisher/commands/ui.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ type UICmd struct {
OpenBrowserAt string `help:"Network address to use when launching the browser." placeholder:"HOST[:PORT]" hidden:""`
Theme string `help:"UI theme, 'light' or 'dark'." hidden:""`
Listen string `help:"Network address to listen on." placeholder:"HOST[:PORT]" default:"localhost:0"`
AccessLog bool `help:"Log all HTTP requests."`
TLSKeyFile string `help:"Path to TLS private key file for the UI server."`
TLSCertFile string `help:"Path to TLS certificate chain file for the UI server."`
}
Expand Down Expand Up @@ -45,7 +44,7 @@ func (cmd *UICmd) Run(args *cli_types.CommonArgs, ctx *cli_types.CLIContext) err
cmd.OpenBrowserAt,
cmd.Theme,
cmd.Listen,
cmd.AccessLog,
true,
cmd.TLSKeyFile,
cmd.TLSCertFile,
absPath,
Expand Down
1 change: 0 additions & 1 deletion extensions/vscode/.prettierrc

This file was deleted.

23 changes: 18 additions & 5 deletions extensions/vscode/.vscodeignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,24 @@
.vscode/**
.vscode-test/**
src/**
.gitignore
.yarnrc
**/tsconfig.json
**/.eslintrc.json
**/*.map
**/*.ts
**/_.map
\*\*/_.ts
CONTRIBUTING.md
vsc-extension-quickstart.md

# Ignore all webview files except the build directories

webviews/homeView/src/**
webviews/homeView/index.html
webviews/homeView/package.json
webviews/homeView/package-lock.json
webviews/homeView/README.md
webviews/homeView/node_modules/**

# Ignore configuration files

**/.gitignore
**/.eslintrc.json
**/tsconfig\*.json
**/vite.config.json
5 changes: 5 additions & 0 deletions extensions/vscode/justfile
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ clean:
rm -rf dist
rm -rf node_modules
rm -rf out
just ./webviews/homeView/clean


# Install dependencies
deps:
Expand All @@ -65,9 +67,12 @@ deps:
if [ {{ _ci }} = "true" ]; then
npm ci --no-audit --no-fund | sed 's/^/debug: /'
npm --prefix ./webviews/homeView ci --no-audit --no-fund | sed 's/^/debug: /'
else
npm install --no-audit --no-fund | sed 's/^/debug: /'
npm --prefix ./webviews/homeView install --no-audit --no-fund | sed 's/^/debug: /'
fi
just ./webviews/homeView/deps


configure os="$(just ../../os)" arch="$(just ../../arch)":
Expand Down
74 changes: 63 additions & 11 deletions extensions/vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,12 @@
"icon": "$(add)",
"category": "Posit Publisher"
},
{
"command": "posit.publisher.deployments.createNew",
"title": "Create New Deployment File",
"icon": "$(add)",
"category": "Posit Publisher"
},
{
"command": "posit.publisher.deployments.deploy",
"title": "Deploy",
Expand Down Expand Up @@ -140,6 +146,12 @@
"icon": "$(eye)",
"category": "Posit Publisher"
},
{
"command": "posit.publisher.homeView.refresh",
"title": "Refresh Home View",
"icon": "$(refresh)",
"category": "Posit Publisher"
},
{
"command": "posit.publisher.helpAndFeedback.gettingStarted",
"title": "Open Getting Started Documentation",
Expand All @@ -155,6 +167,18 @@
"title": "View Deployment in Connect",
"icon": "$(link-external)",
"category": "Posit Publisher"
},
{
"command": "posit.publisher.homeView.showBasicMode",
"title": "Show Basic Mode",
"icon": "$(target)",
"category": "Posit Publisher"
},
{
"command": "posit.publisher.homeView.showAdvancedMode",
"title": "Show Advanced Mode",
"icon": "$(list-tree)",
"category": "Posit Publisher"
}
],
"configuration": {
Expand Down Expand Up @@ -217,6 +241,21 @@
"command": "posit.publisher.credentials.refresh",
"when": "view == posit.publisher.credentials",
"group": "navigation"
},
{
"command": "posit.publisher.homeView.showBasicMode",
"when": "view == posit.publisher.homeView",
"group": "navigation@1"
},
{
"command": "posit.publisher.homeView.showAdvancedMode",
"when": "view == posit.publisher.homeView",
"group": "navigation@2"
},
{
"command": "posit.publisher.homeView.refresh",
"when": "view == posit.publisher.homeView && posit.publisher.homeView.expanded",
"group": "navigation@3"
}
],
"view/item/context": [
Expand Down Expand Up @@ -313,13 +352,21 @@
"command": "posit.publisher.files.addExclusion",
"when": "false"
},
{
"command": "posit.publisher.deployments.createNew",
"when": "false"
},
{
"command": "posit.publisher.requirements.refresh",
"when": "!posit.publish.missing && posit.publish.state == 'initialized'"
},
{
"command": "posit.publisher.requirements.scan",
"when": "!posit.publish.missing && posit.publish.state == 'initialized'"
},
{
"command": "posit.publisher.homeView.refresh",
"when": "!posit.publish.missing && posit.publish.state == 'initialized'"
}
]
},
Expand Down Expand Up @@ -347,45 +394,48 @@
"contextualTitle": "Publisher",
"when": "workbenchState == empty || workbenchState == workspace || posit.publish.missing || posit.publish.state == 'uninitialized'"
},
{
"id": "posit.publisher.homeView",
"type": "webview",
"name": "Home",
"contextualTitle": "Publisher",
"icon": "$(symbol-file)",
"when": "workbenchState == folder && !posit.publish.missing && posit.publish.state == 'initialized'"
},
{
"id": "posit.publisher.files",
"name": "Deployment Files",
"contextualTitle": "Publisher",
"icon": "$(symbol-file)",
"visibility": "collapsed",
"when": "workbenchState == folder && !posit.publish.missing && posit.publish.state == 'initialized'"
"when": "workbenchState == folder && !posit.publish.missing && posit.publish.state == 'initialized' && posit.publisher.homeView.deploymentActiveMode == 'basic-mode'"
},
{
"id": "posit.publisher.requirements",
"name": "Requirements",
"contextualTitle": "Publisher",
"icon": "$(package)",
"visibility": "collapsed",
"when": "workbenchState == folder && !posit.publish.missing && posit.publish.state == 'initialized'"
"when": "workbenchState == folder && !posit.publish.missing && posit.publish.state == 'initialized' && posit.publisher.homeView.deploymentActiveMode == 'basic-mode'"
},
{
"id": "posit.publisher.configurations",
"name": "Configurations",
"contextualTitle": "Publisher",
"icon": "$(gear)",
"visibility": "collapsed",
"when": "workbenchState == folder && !posit.publish.missing && posit.publish.state == 'initialized'"
"when": "workbenchState == folder && !posit.publish.missing && posit.publish.state == 'initialized' && posit.publisher.homeView.deploymentActiveMode == 'advanced-mode'"
},
{
"id": "posit.publisher.credentials",
"name": "Credentials",
"contextualTitle": "Publisher",
"icon": "$(key)",
"visibility": "collapsed",
"when": "workbenchState == folder && !posit.publish.missing && posit.publish.state == 'initialized'"
"when": "workbenchState == folder && !posit.publish.missing && posit.publish.state == 'initialized' && posit.publisher.homeView.deploymentActiveMode == 'advanced-mode'"
},
{
"id": "posit.publisher.deployments",
"name": "Deployments",
"contextualTitle": "Publisher",
"icon": "$(cloud-upload)",
"visibility": "collapsed",
"when": "workbenchState == folder && !posit.publish.missing && posit.publish.state == 'initialized'"
"when": "workbenchState == folder && !posit.publish.missing && posit.publish.state == 'initialized' && posit.publisher.homeView.deploymentActiveMode == 'advanced-mode'"
},
{
"id": "posit.publisher.helpAndFeedback",
Expand Down Expand Up @@ -451,10 +501,12 @@
},
"scripts": {
"vscode:prepublish": "npm run compile",
"compile": "tsc -p ./",
"compile": "npm run compile-extension && npm run compile-deploy-selector",
"compile-extension": "tsc -p ./",
"watch": "tsc -watch -p ./",
"pretest": "npm run compile",
"lint": "eslint src --ext ts",
"compile-deploy-selector": "npm run --prefix webviews/homeView compile",
"test": "node ./out/test/runTest.js"
},
"devDependencies": {
Expand Down
10 changes: 5 additions & 5 deletions extensions/vscode/src/api/types/deployments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,12 @@ type DeploymentRecord = {
serverUrl: string;
saveName: string;
createdAt: string;
configurationName: string;
deploymentError: AgentError | null;
} & DeploymentLocation;

export type PreDeployment = {
state: DeploymentState.NEW;
error: AgentError | null;
configurationName: string | undefined;
configurationPath: string | undefined;
} & DeploymentRecord;
Expand All @@ -45,7 +46,6 @@ export type Deployment = {
files: string[];
deployedAt: string;
state: DeploymentState.DEPLOYED;
deploymentError: AgentError | null;
configurationName: string;
configurationPath: string;
} & DeploymentRecord &
Expand All @@ -59,10 +59,10 @@ export function isSuccessful(
if (d === undefined) {
return undefined;
}
if (isDeployment(d)) {
return Boolean(!d.deploymentError);
if (isDeploymentError(d)) {
return false;
}
return Boolean(!d.error);
return Boolean(!d.deploymentError);
}

export function isUnsuccessful(
Expand Down
10 changes: 9 additions & 1 deletion extensions/vscode/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import { CredentialsTreeDataProvider } from "./views/credentials";
import { HelpAndFeedbackTreeDataProvider } from "./views/helpAndFeedback";
import { LogsTreeDataProvider } from "./views/logs";
import { EventStream } from "./events";
import { HomeViewProvider } from "./views/homeView";
import { commands } from "vscode";

const STATE_CONTEXT = "posit.publish.state";
const MISSING_CONTEXT = "posit.publish.missing";
Expand Down Expand Up @@ -77,7 +79,12 @@ export async function activate(context: vscode.ExtensionContext) {
});
context.subscriptions.push(watcher);

setMissingContext(await isMissingPublishDirs(folder));
// set our initial mode
commands.executeCommand(
"setContext",
"posit.publisher.homeView.deploymentActiveMode",
"basic-mode",
);
} else {
setMissingContext(true);
}
Expand All @@ -97,6 +104,7 @@ export async function activate(context: vscode.ExtensionContext) {
new CredentialsTreeDataProvider(apiReady).register(context);
new HelpAndFeedbackTreeDataProvider().register(context);
new LogsTreeDataProvider(stream).register(context);
new HomeViewProvider(context.extensionUri, stream).register(context);

await service.start();

Expand Down
Loading

0 comments on commit ab16a17

Please sign in to comment.