+
Skip to content

Add a button to complain to me #188

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 3 commits into from
Sep 21, 2022
Merged
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
45 changes: 38 additions & 7 deletions src/job/JobListener.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ export default class JobListener {
logFilePath,
`Log for CircleCI® job ${jobName} \n${new Date()} \n\n`
);
const complainToMeLink =
'mailto:ryan@getlocalci.com?subject=There was an error using Local CI&body=Hi Ryan, Could you help with this error I saw with Local CI: <!-- please fill in error here -->';

const process = this.childProcessGateway.cp.spawn(
'/bin/sh',
Expand Down Expand Up @@ -124,10 +126,20 @@ export default class JobListener {

dockerRelatedErrors.forEach((errorMessage) => {
if (output?.includes(errorMessage)) {
this.editorGateway.editor.window.showErrorMessage(
`Restarting Docker Desktop should fix that error '${errorMessage}', though that's not fun`,
{ detail: 'Possible solution' }
);
const complainToMeText = 'Complain to me';
this.editorGateway.editor.window
.showErrorMessage(
`Restarting Docker Desktop should fix that error '${errorMessage}', though that's not fun`,
{ detail: 'Possible solution' },
complainToMeText
)
.then((clicked) => {
if (clicked === complainToMeText) {
this.editorGateway.editor.env.openExternal(
this.editorGateway.editor.Uri.parse(complainToMeLink)
);
}
});
}
});

Expand All @@ -152,18 +164,26 @@ export default class JobListener {
errors.forEach((error) => {
if (output?.includes(error.message)) {
const getBashCommandsText = 'Get Bash commands';
const complainToMeText = 'Complain to me';
this.editorGateway.editor.window
.showErrorMessage(
'You might be able to fix this failed job with Bash commands',
{ detail: 'Possible solution' },
getBashCommandsText
getBashCommandsText,
complainToMeText
)
.then((clicked) => {
if (clicked === getBashCommandsText) {
this.editorGateway.editor.env.openExternal(
this.editorGateway.editor.Uri.parse(error.solutionUrl)
);
}

if (clicked === complainToMeText) {
this.editorGateway.editor.env.openExternal(
this.editorGateway.editor.Uri.parse(complainToMeLink)
);
}
});
}
});
Expand All @@ -188,12 +208,17 @@ export default class JobListener {
}

const showJobOutput = 'Show job log';
const complainToMeText = 'Complain to me';
const complainToMeLink =
'mailto:ryan@getlocalci.com?subject=A job failed with Local Ci, and I do not know why&body=Hi Ryan, Could you help with this error I saw with a Local CI job: <!-- please fill in error here -->';
const dontShowAgain = `Don't show again`;

this.editorGateway.editor.window
.showInformationMessage(
`The job ${job?.getJobName()} ${didSucceed ? 'succeeded' : 'failed'}`,
showJobOutput,
dontShowAgain
...(didSucceed
? [showJobOutput, dontShowAgain]
: [showJobOutput, complainToMeText, dontShowAgain])
)
.then((clicked) => {
if (clicked === showJobOutput) {
Expand All @@ -203,6 +228,12 @@ export default class JobListener {
if (clicked === dontShowAgain) {
context.globalState.update(SUPPRESS_JOB_COMPLETE_MESSAGE, true);
}

if (clicked === complainToMeText) {
this.editorGateway.editor.env.openExternal(
this.editorGateway.editor.Uri.parse(complainToMeLink)
);
}
});
}
}
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载