Skip to content

Commit

Permalink
Merge pull request #1896 from posit-dev/sagerb-add-publisher-log-link…
Browse files Browse the repository at this point in the history
…-to-deployment-in-progress

Add view-logs anchor to publishing progress indicator
  • Loading branch information
sagerb authored Jul 1, 2024
2 parents 2d59d8f + bf24ae0 commit 157b9e2
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 14 deletions.
16 changes: 8 additions & 8 deletions extensions/vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@
},
{
"command": "posit.publisher.logs.visit",
"title": "View Deployment in Connect",
"title": "View Deployment Logs in Connect",
"icon": "$(link-external)",
"category": "Posit Publisher"
},
Expand All @@ -230,25 +230,25 @@
},
{
"command": "posit.publisher.homeView.navigateToDeployment.Content",
"title": "View Content",
"title": "View Deployment in Connect",
"icon": "$(server-process)",
"category": "Posit Publisher"
},
{
"command": "posit.publisher.showOutputChannel",
"title": "Go to Debug Log",
"title": "Show Debug Log",
"icon": "$(output)",
"category": "Posit Publisher"
},
{
"command": "posit.publisher.showPublishingLog",
"title": "Go to Publishing Log",
"title": "Show Publishing Log",
"icon": "$(output)",
"category": "Posit Publisher"
},
{
"command": "posit.publisher.homeView.navigateToDeployment.ContentLog",
"title": "Show Content Logs",
"title": "View Content Log on Connect",
"icon": "$(output)",
"category": "Posit Publisher"
}
Expand Down Expand Up @@ -497,7 +497,7 @@
"panel": [
{
"id": "posit-publisher-logs",
"title": "Posit Publisher Logs",
"title": "Posit Publisher Log",
"icon": "$(output)"
}
]
Expand Down Expand Up @@ -562,8 +562,8 @@
"posit-publisher-logs": [
{
"id": "posit.publisher.logs",
"name": "Logs",
"contextualTitle": "Logs",
"name": "Log",
"contextualTitle": "Log",
"icon": "$(output)",
"when": "workbenchState == folder && posit.publish.state == 'initialized'"
}
Expand Down
10 changes: 8 additions & 2 deletions extensions/vscode/src/types/messages/webviewToHostMessages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export enum WebviewToHostMessageType {
SELECT_DEPLOYMENT = "selectDeployment",
NEW_DEPLOYMENT = "newDeployment",
NEW_CREDENTIAL = "newCredential",
VIEW_PUBLISHING_LOG = "viewPublishingLog",
}

export type AnyWebviewToHostMessage<
Expand Down Expand Up @@ -54,7 +55,8 @@ export type WebviewToHostMessage =
| ScanRPackageRequirementsMsg
| SelectDeploymentMsg
| NewDeploymentMsg
| NewCredentialMsg;
| NewCredentialMsg
| ViewPublishingLog;

export function isWebviewToHostMessage(msg: any): msg is WebviewToHostMessage {
return (
Expand All @@ -76,7 +78,8 @@ export function isWebviewToHostMessage(msg: any): msg is WebviewToHostMessage {
msg.kind === WebviewToHostMessageType.SCAN_R_PACKAGE_REQUIREMENTS ||
msg.kind === WebviewToHostMessageType.SELECT_DEPLOYMENT ||
msg.kind === WebviewToHostMessageType.NEW_DEPLOYMENT ||
msg.kind === WebviewToHostMessageType.NEW_CREDENTIAL
msg.kind === WebviewToHostMessageType.NEW_CREDENTIAL ||
msg.kind === WebviewToHostMessageType.VIEW_PUBLISHING_LOG
);
}

Expand Down Expand Up @@ -170,3 +173,6 @@ export type NewDeploymentMsg =

export type NewCredentialMsg =
AnyWebviewToHostMessage<WebviewToHostMessageType.NEW_CREDENTIAL>;

export type ViewPublishingLog =
AnyWebviewToHostMessage<WebviewToHostMessageType.VIEW_PUBLISHING_LOG>;
2 changes: 1 addition & 1 deletion extensions/vscode/src/views/deployProgress.ts
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ export function deployProject(localID: string, stream: EventStream) {
});
resolveCB("Success!");

let visitOption = "Visit";
let visitOption = "View";
const selection = await window.showInformationMessage(
"Deployment was successful",
visitOption,
Expand Down
6 changes: 6 additions & 0 deletions extensions/vscode/src/views/homeView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,8 @@ export class HomeViewProvider implements WebviewViewProvider, Disposable {
return this.showNewDeploymentMultiStep(Views.HomeView);
case WebviewToHostMessageType.NEW_CREDENTIAL:
return this.showNewCredential();
case WebviewToHostMessageType.VIEW_PUBLISHING_LOG:
return this.showPublishingLog();
default:
throw new Error(
`Error: _onConduitMessage unhandled msg: ${JSON.stringify(msg)}`,
Expand Down Expand Up @@ -796,6 +798,10 @@ export class HomeViewProvider implements WebviewViewProvider, Disposable {
);
}

private showPublishingLog() {
return commands.executeCommand(Commands.Logs.Focus);
}

private async showDeploymentQuickPick(): Promise<
DeploymentNames | undefined
> {
Expand Down
4 changes: 2 additions & 2 deletions extensions/vscode/src/views/logs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ export class LogsTreeDataProvider implements TreeDataProvider<LogsTreeItem> {
}
});

let showLogsOption = "Show Logs";
let showLogsOption = "View Log";
const selection = await window.showErrorMessage(
`Deployment failed: ${msg.data.message}`,
showLogsOption,
Expand Down Expand Up @@ -378,7 +378,7 @@ export class LogsTreeLogItem extends TreeItem {

if (msg.data.dashboardUrl !== undefined) {
this.command = {
title: "Visit",
title: "View",
command: Commands.Logs.Visit,
arguments: [msg.data.dashboardUrl],
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,14 @@
<div class="deployment-in-progress-container">
<div class="progress-container">
<vscode-progress-ring class="progress-ring" />
Deployment in Progress...
<div class="progress-desc">
<div>Deployment in Progress...</div>
<div class="progress-log-anchor">
<a href="" role="button" @click="onViewPublishingLog"
>View Log</a
>
</div>
</div>
</div>
<ActionToolbar
title="Logs"
Expand Down Expand Up @@ -215,6 +222,12 @@ const onEditConfiguration = (name: string) => {
});
};

const onViewPublishingLog = () => {
hostConduit.sendMsg({
kind: WebviewToHostMessageType.VIEW_PUBLISHING_LOG,
});
};

const isConfigInErrorList = (configName?: string): boolean => {
if (!configName) {
return false;
Expand Down Expand Up @@ -449,6 +462,16 @@ const newCredential = () => {
margin-right: 10px;
}

.progress-desc {
display: flex;
flex-direction: column;
align-items: flex-start;
}

.progress-log-anchor {
margin-top: 5px;
}

.deployment-details-container {
margin-bottom: 0.5rem;

Expand Down

0 comments on commit 157b9e2

Please sign in to comment.