Skip to content

Commit

Permalink
Merge pull request #2151 from posit-dev/dotnomad/credentials-into-web…
Browse files Browse the repository at this point in the history
…view

Move Credentials to webview
  • Loading branch information
dotNomad authored Aug 22, 2024
2 parents 1a82a23 + 4650335 commit e197325
Show file tree
Hide file tree
Showing 10 changed files with 172 additions and 191 deletions.
41 changes: 10 additions & 31 deletions extensions/vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,19 @@
"category": "Posit Publisher"
},
{
"command": "posit.publisher.credentials.add",
"command": "posit.publisher.homeView.addCredential",
"title": "New Credential",
"icon": "$(add)",
"category": "Posit Publisher"
},
{
"command": "posit.publisher.credentials.delete",
"title": "Delete",
"command": "posit.publisher.homeView.deleteCredential",
"title": "Delete Credential",
"icon": "$(trash)",
"category": "Posit Publisher"
},
{
"command": "posit.publisher.credentials.refresh",
"command": "posit.publisher.homeView.refreshCredentials",
"title": "Refresh Credentials",
"icon": "$(refresh)",
"category": "Posit Publisher"
Expand Down Expand Up @@ -222,39 +222,23 @@
"when": "view == posit.publisher.pythonPackages",
"group": "navigation@3"
},
{
"command": "posit.publisher.credentials.add",
"when": "view == posit.publisher.credentials",
"group": "navigation@1"
},
{
"command": "posit.publisher.credentials.refresh",
"when": "view == posit.publisher.credentials",
"group": "navigation@2"
},
{
"command": "posit.publisher.homeView.refresh",
"when": "view == posit.publisher.homeView",
"group": "navigation@1"
}
],
"view/item/context": [
{
"command": "posit.publisher.credentials.delete",
"when": "view == posit.publisher.credentials && viewItem == posit.publisher.credentials.tree.item.keychain"
}
],
"commandPalette": [
{
"command": "posit.publisher.init-project",
"when": "workbenchState == folder && posit.publish.state == 'initialized'"
},
{
"command": "posit.publisher.credentials.delete",
"command": "posit.publisher.homeView.deleteCredential",
"when": "false"
},
{
"command": "posit.publisher.credentials.refresh",
"command": "posit.publisher.homeView.refreshCredentials",
"when": "posit.publish.state == 'initialized'"
},
{
Expand Down Expand Up @@ -348,6 +332,10 @@
"command": "posit.publisher.showPublishingLog",
"when": "webviewId == 'posit.publisher.homeView' && webviewSection == 'homeview-active-contentRecord-more-menu'",
"group": "show@2"
},
{
"command": "posit.publisher.homeView.deleteCredential",
"when": "webviewId == 'posit.publisher.homeView' && webviewSection == 'credentials-tree-item'"
}
]
},
Expand Down Expand Up @@ -395,15 +383,6 @@
"visibility": "visible",
"initialSize": 1,
"when": "workbenchState == folder && posit.publish.state == 'initialized'"
},
{
"id": "posit.publisher.credentials",
"name": "Credentials",
"contextualTitle": "Publisher",
"icon": "$(key)",
"visibility": "collapsed",
"initialSize": 0,
"when": "workbenchState == folder && posit.publish.state == 'initialized'"
}
],
"posit-publisher-logs": [
Expand Down
11 changes: 3 additions & 8 deletions extensions/vscode/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,6 @@ const logsCommands = {
ToggleVisibility: "posit.publisher.logs.toggleVisibility",
} as const;

const credentialsCommands = {
Add: "posit.publisher.credentials.add",
Delete: "posit.publisher.credentials.delete",
Refresh: "posit.publisher.credentials.refresh",
} as const;

const credentialsContexts = {
Keychain: "posit.publisher.credentials.tree.item.keychain",
EnvironmentVars: "posit.publisher.credentials.tree.item.environmentVars",
Expand Down Expand Up @@ -76,6 +70,9 @@ const homeViewCommands = {
ShowContentLogs: "posit.publisher.homeView.navigateToDeployment.ContentLog",
OpenFeedback: "posit.publisher.homeView.openFeedback",
OpenGettingStarted: "posit.publisher.homeView.gettingStarted",
AddCredential: "posit.publisher.homeView.addCredential",
DeleteCredential: "posit.publisher.homeView.deleteCredential",
RefreshCredentials: "posit.publisher.homeView.refreshCredentials",
// Added automatically by VSCode with view registration
Focus: "posit.publisher.homeView.focus",
} as const;
Expand All @@ -90,7 +87,6 @@ export const LocalState = {

export const Commands = {
...baseCommands,
Credentials: credentialsCommands,
Logs: logsCommands,
Files: filesCommands,
PythonPackages: pythonPackagesCommands,
Expand All @@ -107,7 +103,6 @@ export const Contexts = {
export const enum Views {
Project = "posit.publisher.project",
HomeView = "posit.publisher.homeView",
Credentials = "posit.publisher.credentials",
ContentRecords = "posit.publisher.contentRecords",
Logs = "posit.publisher.logs",
}
Expand Down
4 changes: 0 additions & 4 deletions extensions/vscode/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { ExtensionContext, Uri, commands } from "vscode";
import * as ports from "src/ports";
import { Service } from "src/services";
import { ProjectTreeDataProvider } from "src/views/project";
import { CredentialsTreeDataProvider } from "src/views/credentials";
import { LogsTreeDataProvider } from "src/views/logs";
import { EventStream } from "src/events";
import { HomeViewProvider } from "src/views/homeView";
Expand Down Expand Up @@ -57,16 +56,13 @@ export async function activate(context: ExtensionContext) {
// First the construction of the data providers
const projectTreeDataProvider = new ProjectTreeDataProvider(context);

const credentialsTreeDataProvider = new CredentialsTreeDataProvider(context);

const logsTreeDataProvider = new LogsTreeDataProvider(context, stream);

const homeViewProvider = new HomeViewProvider(context, stream);
context.subscriptions.push(homeViewProvider);

// Then the registration of the data providers with the VSCode framework
projectTreeDataProvider.register();
credentialsTreeDataProvider.register();
logsTreeDataProvider.register();
homeViewProvider.register(watchers);

Expand Down
12 changes: 12 additions & 0 deletions extensions/vscode/src/types/messages/webviewToHostMessages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,15 @@ export enum WebviewToHostMessageType {
INCLUDE_FILE = "includeFile",
EXCLUDE_FILE = "excludeFile",
REQUEST_FILES_LISTS = "requestFilesLists",
REQUEST_CREDENTIALS = "requestCredentials",
VSCODE_OPEN_RELATIVE = "VSCodeOpenRelativeMsg",
REFRESH_PYTHON_PACKAGES = "RefreshPythonPackagesMsg",
SCAN_PYTHON_PACKAGE_REQUIREMENTS = "ScanPythonPackageRequirementsMsg",
REFRESH_R_PACKAGES = "RefreshRPackagesMsg",
SCAN_R_PACKAGE_REQUIREMENTS = "ScanRPackageRequirementsMsg",
SELECT_DEPLOYMENT = "selectDeployment",
NEW_DEPLOYMENT = "newDeployment",
NEW_CREDENTIAL_FOR_DEPLOYMENT = "newCredentialForDeployment",
NEW_CREDENTIAL = "newCredential",
VIEW_PUBLISHING_LOG = "viewPublishingLog",
}
Expand All @@ -46,13 +48,15 @@ export type WebviewToHostMessage =
| IncludeFileMsg
| ExcludeFileMsg
| RequestFilesListsMsg
| RequestCredentialsMsg
| RefreshPythonPackagesMsg
| VSCodeOpenRelativeMsg
| ScanPythonPackageRequirementsMsg
| RefreshRPackagesMsg
| ScanRPackageRequirementsMsg
| SelectDeploymentMsg
| NewDeploymentMsg
| NewCredentialForDeploymentMsg
| NewCredentialMsg
| ViewPublishingLog;

Expand All @@ -68,13 +72,15 @@ export function isWebviewToHostMessage(msg: any): msg is WebviewToHostMessage {
msg.kind === WebviewToHostMessageType.INCLUDE_FILE ||
msg.kind === WebviewToHostMessageType.EXCLUDE_FILE ||
msg.kind === WebviewToHostMessageType.REQUEST_FILES_LISTS ||
msg.kind === WebviewToHostMessageType.REQUEST_CREDENTIALS ||
msg.kind === WebviewToHostMessageType.REFRESH_PYTHON_PACKAGES ||
msg.kind === WebviewToHostMessageType.VSCODE_OPEN_RELATIVE ||
msg.kind === WebviewToHostMessageType.SCAN_PYTHON_PACKAGE_REQUIREMENTS ||
msg.kind === WebviewToHostMessageType.REFRESH_R_PACKAGES ||
msg.kind === WebviewToHostMessageType.SCAN_R_PACKAGE_REQUIREMENTS ||
msg.kind === WebviewToHostMessageType.SELECT_DEPLOYMENT ||
msg.kind === WebviewToHostMessageType.NEW_DEPLOYMENT ||
msg.kind === WebviewToHostMessageType.NEW_CREDENTIAL_FOR_DEPLOYMENT ||
msg.kind === WebviewToHostMessageType.NEW_CREDENTIAL ||
msg.kind === WebviewToHostMessageType.VIEW_PUBLISHING_LOG
);
Expand Down Expand Up @@ -141,6 +147,9 @@ export type ExcludeFileMsg = AnyWebviewToHostMessage<
export type RequestFilesListsMsg =
AnyWebviewToHostMessage<WebviewToHostMessageType.REQUEST_FILES_LISTS>;

export type RequestCredentialsMsg =
AnyWebviewToHostMessage<WebviewToHostMessageType.REQUEST_CREDENTIALS>;

export type RefreshPythonPackagesMsg =
AnyWebviewToHostMessage<WebviewToHostMessageType.REFRESH_PYTHON_PACKAGES>;

Expand All @@ -166,6 +175,9 @@ export type SelectDeploymentMsg =
export type NewDeploymentMsg =
AnyWebviewToHostMessage<WebviewToHostMessageType.NEW_DEPLOYMENT>;

export type NewCredentialForDeploymentMsg =
AnyWebviewToHostMessage<WebviewToHostMessageType.NEW_CREDENTIAL_FOR_DEPLOYMENT>;

export type NewCredentialMsg =
AnyWebviewToHostMessage<WebviewToHostMessageType.NEW_CREDENTIAL>;

Expand Down
145 changes: 0 additions & 145 deletions extensions/vscode/src/views/credentials.ts

This file was deleted.

Loading

0 comments on commit e197325

Please sign in to comment.