+
Skip to content
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
68 changes: 59 additions & 9 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ const reporter = new TelemetryReporter(
TELEMETRY_KEY
);

const doNotConfirmRunJob = 'local-ci.job.do-not-confirm';

export function activate(context: vscode.ExtensionContext): void {
if (!context.globalState.get(TRIAL_STARTED_TIMESTAMP)) {
context.globalState.update(TRIAL_STARTED_TIMESTAMP, new Date().getTime());
Expand Down Expand Up @@ -203,12 +205,31 @@ export function activate(context: vscode.ExtensionContext): void {

reporter.sendTelemetryEvent('runJob');

if (job instanceof Job) {
job.setIsRunning();
await jobProvider.hardRefresh(job);
if (context.globalState.get(doNotConfirmRunJob)) {
runJob(context, jobName, jobProvider, job);
}

runJob(context, jobName, jobProvider, job);
const confirmText = 'Yes';
const doNotAskAgainText = `Don't ask again`;
vscode.window
.showInformationMessage(
`Do you want to run the job ${jobName}?`,
{ modal: true },
{ title: confirmText },
{ title: doNotAskAgainText }
)
.then((selection) => {
if (
selection?.title === confirmText ||
selection?.title === doNotAskAgainText
) {
runJob(context, jobName, jobProvider, job);
}

if (selection?.title === doNotAskAgainText) {
context.globalState.update(doNotConfirmRunJob, true);
}
});
}
),
vscode.commands.registerCommand(EXIT_JOB_COMMAND, (job: Job) => {
Expand All @@ -218,13 +239,42 @@ export function activate(context: vscode.ExtensionContext): void {
disposeTerminalsForJob(jobName);
}),
vscode.commands.registerCommand('local-ci.job.rerun', async (job: Job) => {
job.setIsRunning();
await jobProvider.hardRefresh(job);
const jobName = job.getJobName();
disposeTerminalsForJob(jobName);
const confirmText = 'Yes';
const doNotAskAgainText = `Don't ask again`;

async function rerunJob() {
job.setIsRunning();
await jobProvider.hardRefresh(job);
disposeTerminalsForJob(jobName);

reporter.sendTelemetryEvent('rerunJob');
runJob(context, jobName, jobProvider, job);
}

if (context.globalState.get(doNotConfirmRunJob)) {
rerunJob();
}

vscode.window
.showInformationMessage(
`Do you want to rerun the job ${jobName}?`,
{ modal: true },
{ title: confirmText },
{ title: doNotAskAgainText }
)
.then(async (selection) => {
if (
selection?.title === confirmText ||
selection?.title === doNotAskAgainText
) {
rerunJob();
}

reporter.sendTelemetryEvent('rerunJob');
runJob(context, jobName, jobProvider, job);
if (selection?.title === doNotAskAgainText) {
context.globalState.update(doNotConfirmRunJob, true);
}
});
}),
vscode.commands.registerCommand(
'local-ci.debug.repo',
Expand Down
5 changes: 5 additions & 0 deletions src/utils/runJob.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ export default async function runJob(
jobProvider: JobProvider,
job: JobClass | undefined
): Promise<void> {
if (job && job instanceof JobClass) {
job.setIsRunning();
await jobProvider.hardRefresh(job);
}

const configFilePath = await getConfigFilePath(context);
const repoPath = path.dirname(path.dirname(configFilePath));
const terminal = vscode.window.createTerminal({
Expand Down
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载