Merge pull request #1305 from github/aeisenberg/mrva-result-message

Update the warning message after running variant analysis
This commit is contained in:
Andrew Eisenberg
2022-04-26 11:46:03 -07:00
committed by GitHub
2 changed files with 25 additions and 14 deletions

View File

@@ -2,6 +2,7 @@ import { CancellationToken, Uri, window } from 'vscode';
import * as path from 'path';
import * as yaml from 'js-yaml';
import * as fs from 'fs-extra';
import * as os from 'os';
import * as tmp from 'tmp-promise';
import {
askForLanguage,
@@ -337,22 +338,26 @@ async function runRemoteQueriesApiRequest(
}
}
const eol = os.EOL;
const eol2 = os.EOL + os.EOL;
// exported for testng only
export function parseResponse(owner: string, repo: string, response: QueriesResponse) {
const popupMessage = `Successfully scheduled runs. [Click here to see the progress](https://github.com/${owner}/${repo}/actions/runs/${response.workflow_run_id}).`
+ (response.errors ? '\n\nSome repositories could not be scheduled. See extension log for details.' : '');
+ (response.errors ? `${eol2}Some repositories could not be scheduled. See extension log for details.` : '');
let logMessage = `Successfully scheduled runs. See https://github.com/${owner}/${repo}/actions/runs/${response.workflow_run_id}.`;
if (response.repositories_queried) {
logMessage += `\n\nRepositories queried:\n${response.repositories_queried.join(', ')}`;
logMessage += `${eol2}Repositories queried:${eol}${response.repositories_queried.join(', ')}`;
}
if (response.errors) {
logMessage += '\n\nSome repositories could not be scheduled.';
logMessage += `${eol2}Some repositories could not be scheduled.`;
if (response.errors.invalid_repositories?.length) {
logMessage += `\n\nInvalid repositories:\n${response.errors.invalid_repositories.join(', ')}`;
logMessage += `${eol2}Invalid repositories:${eol}${response.errors.invalid_repositories.join(', ')}`;
}
if (response.errors.repositories_without_database?.length) {
logMessage += `\n\nRepositories without databases:\n${response.errors.repositories_without_database.join(', ')}`;
logMessage += `${eol2}Repositories without databases:${eol}${response.errors.repositories_without_database.join(', ')}`;
logMessage += `${eol}These repositories have been added to the database storage service and we will attempt to create a database for them next time the store is updated.`;
}
}

View File

@@ -1,4 +1,5 @@
import { expect } from 'chai';
import * as os from 'os';
import { parseResponse } from '../../../remote-queries/run-remote-query';
describe('run-remote-query', () => {
@@ -14,7 +15,7 @@ describe('run-remote-query', () => {
['Successfully scheduled runs. See https://github.com/org/name/actions/runs/123.',
'',
'Repositories queried:',
'a/b, c/d'].join('\n')
'a/b, c/d'].join(os.EOL),
);
});
@@ -41,7 +42,7 @@ describe('run-remote-query', () => {
expect(result.popupMessage).to.equal(
['Successfully scheduled runs. [Click here to see the progress](https://github.com/org/name/actions/runs/123).',
'',
'Some repositories could not be scheduled. See extension log for details.'].join('\n')
'Some repositories could not be scheduled. See extension log for details.'].join(os.EOL)
);
expect(result.logMessage).to.equal(
['Successfully scheduled runs. See https://github.com/org/name/actions/runs/123.',
@@ -52,7 +53,7 @@ describe('run-remote-query', () => {
'Some repositories could not be scheduled.',
'',
'Invalid repositories:',
'e/f, g/h'].join('\n')
'e/f, g/h'].join(os.EOL)
);
});
@@ -68,16 +69,19 @@ describe('run-remote-query', () => {
expect(result.popupMessage).to.equal(
['Successfully scheduled runs. [Click here to see the progress](https://github.com/org/name/actions/runs/123).',
'',
'Some repositories could not be scheduled. See extension log for details.'].join('\n')
'Some repositories could not be scheduled. See extension log for details.'].join(os.EOL)
);
expect(result.logMessage).to.equal(
['Successfully scheduled runs. See https://github.com/org/name/actions/runs/123.',
'',
'Repositories queried:\na/b, c/d',
'Repositories queried:',
'a/b, c/d',
'',
'Some repositories could not be scheduled.',
'',
'Repositories without databases:\ne/f, g/h'].join('\n')
'Repositories without databases:',
'e/f, g/h',
'These repositories have been added to the database storage service and we will attempt to create a database for them next time the store is updated.'].join(os.EOL)
);
});
@@ -94,12 +98,13 @@ describe('run-remote-query', () => {
expect(result.popupMessage).to.equal(
['Successfully scheduled runs. [Click here to see the progress](https://github.com/org/name/actions/runs/123).',
'',
'Some repositories could not be scheduled. See extension log for details.'].join('\n')
'Some repositories could not be scheduled. See extension log for details.'].join(os.EOL)
);
expect(result.logMessage).to.equal(
['Successfully scheduled runs. See https://github.com/org/name/actions/runs/123.',
'',
'Repositories queried:\na/b, c/d',
'Repositories queried:',
'a/b, c/d',
'',
'Some repositories could not be scheduled.',
'',
@@ -107,7 +112,8 @@ describe('run-remote-query', () => {
'e/f, g/h',
'',
'Repositories without databases:',
'i/j, k/l'].join('\n')
'i/j, k/l',
'These repositories have been added to the database storage service and we will attempt to create a database for them next time the store is updated.'].join(os.EOL)
);
});
});