Skip to content
This repository has been archived by the owner on Sep 11, 2023. It is now read-only.

Commit

Permalink
feat: improve labels
Browse files Browse the repository at this point in the history
  • Loading branch information
bmvermeer committed Apr 28, 2020
1 parent f85070d commit 1c80dfb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 14 deletions.
24 changes: 11 additions & 13 deletions src/SnykAction.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,28 @@ export class SnykVulnInfo {
.map(diagnostic => {
const pkg = getPackageFromMessage(diagnostic.message);
const vulns = getPackageFromCache(pkg);

const count = vulns.count;
const res = [];

if (isAuthed()) {
res.push(
createShowOutputAction({
diagnostic,
actionTitle: 'Show vulnerability details',
actionTitle: `Fix vuln${count === 1 ? '' : 's'}`,
title: 'Show vulnerability details',
args: [vulns],
isPreferred: true,
})
);
} else {
res.push(
createAuthAction({
diagnostic,
actionTitle: `Fix vuln${count === 1 ? '' : 's'}`,
title: 'Connect to Snyk',
isPreferred: true,
})
);
}

res.push(
Expand All @@ -84,17 +93,6 @@ export class SnykVulnInfo {
// );
// }

if (!isAuthed()) {
res.push(
createAuthAction({
diagnostic,
actionTitle: 'Connect Snyk to fix vulnerabilities',
title: 'Connect to Snyk',
isPreferred: true,
})
);
}

return res;
})
.flat();
Expand Down
2 changes: 1 addition & 1 deletion src/decorator.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ function getDecorationMessage(packageInfo) {
}

const { count } = packageInfo.vulns;
let decorationMessage = `${count} vuln${count === 1 ? '' : 's'}`;
let decorationMessage = `${count} vuln${count === 1 ? '' : 's'} (click to fix)`;

return decorationMessage;
}
Expand Down

0 comments on commit 1c80dfb

Please sign in to comment.