+
Skip to content

Allow opting out of message that a job completed #153

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

Merged
merged 1 commit into from
Jul 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions src/constants/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,6 @@ export const SCHEDULE_INTERVIEW_URL =
'https://tidycal.com/localci/30-minute-meeting';
export const SUPPRESS_UNCOMMITTED_FILE_WARNING =
'local-ci.suppress-warning.uncommitted';
export const SUPPRESS_JOB_COMPLETE_MESSAGE =
'local-ci.suppress-message.job-complete';
export const TELEMETRY_KEY = '90189d4e-b560-4a92-aa2c-5a9df190b66a'; // Microsoft.AppInsights Instrumentation Key.
24 changes: 16 additions & 8 deletions src/utils/listenToJob.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,18 @@ import * as fs from 'fs';
import * as vscode from 'vscode';
import Job from '../classes/Job';
import JobProvider from '../classes/JobProvider';
import { GET_PICARD_CONTAINER_FUNCTION } from '../constants';
import {
GET_PICARD_CONTAINER_FUNCTION,
SUPPRESS_JOB_COMPLETE_MESSAGE,
} from '../constants';
import getConfigFilePath from './getConfigFilePath';
import getConfigFromPath from './getConfigFromPath';
import getDynamicConfigPath from './getDynamicConfigPath';
import getSpawnOptions from './getSpawnOptions';
import showLogFile from './showLogFile';

function handleExit(
context: vscode.ExtensionContext,
job: Job | undefined,
logFilePath: string,
didSucceed: boolean
Expand All @@ -19,22 +23,26 @@ function handleExit(
? vscode.workspace.workspaceFolders[0].uri
: null;

if (!folderUri) {
if (!folderUri || context.globalState.get(SUPPRESS_JOB_COMPLETE_MESSAGE)) {
return;
}

const showJobOutput = 'Show job log';
const dontShowAgain = `Don't show again`;
vscode.window
.showInformationMessage(
`The job ${job?.getJobName()} ${didSucceed ? 'succeeded' : 'failed'}`,
{
title: showJobOutput,
}
showJobOutput,
dontShowAgain
)
.then((clicked) => {
if (clicked?.title === showJobOutput) {
if (clicked === showJobOutput) {
showLogFile(logFilePath);
}

if (clicked === dontShowAgain) {
context.globalState.update(SUPPRESS_JOB_COMPLETE_MESSAGE, true);
}
});
}

Expand Down Expand Up @@ -90,7 +98,7 @@ export default function listenToJob(
job?.setExpanded();
jobProvider.refresh(job);

handleExit(job, logFilePath, true);
handleExit(context, job, logFilePath, true);
commitProcess.kill();

if (doesJobCreateDynamicConfig) {
Expand All @@ -114,7 +122,7 @@ export default function listenToJob(
job?.setExpanded();
jobProvider.refresh(job);

handleExit(job, logFilePath, false);
handleExit(context, job, logFilePath, false);
commitProcess.kill();
}

Expand Down
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载