algairim commented on a change in pull request #241:
URL: https://github.com/apache/brooklyn-ui/pull/241#discussion_r666385550
##########
File path: ui-modules/blueprint-composer/app/components/quick-fix/quick-fix.js
##########
@@ -55,6 +55,31 @@ export function computeQuickFixes(blueprintService,
allIssues) {
computeQuickFixesForIssue(issue, issue.entity, blueprintService,
v.quickFixes)
});
});
+
+ allIssues.warnings.byMessage = {};
+ Object.values(allIssues.warnings.byEntity).forEach(list => {
+ list.forEach(issue => {
+ let key = issue.group+":"+issue.ref+":"+issue.message;
+ let v = allIssues.warnings.byMessage[key];
+ if (!v) {
+ v = allIssues.warnings.byMessage[key] = {
+ group: issue.group,
+ ref: issue.ref,
+ message: issue.message,
+ issues: [],
+ quickFixes: {},
+ };
+ }
+
+ let issueO = {
+ issue,
+ //quickFixes: {},
+ }
+ v.issues.push(issueO);
+
+ computeQuickFixesForIssue(issue, issue.entity, blueprintService,
v.quickFixes)
+ });
+ });
Review comment:
Duplicate code, can be moved into a function like:
```
export function computeQuickFixes(blueprintService, allIssues) {
if (!allIssues) allIssues = blueprintService.getAllIssues();
if (!allIssues) allIssues = {};
if (!allIssues.errors) allIssues.errors = {};
computeQuickFixesForIssues(allIssues.errors, blueprintService);
computeQuickFixesForIssues(allIssues.warnings, blueprintService);
return allIssues;
}
function computeQuickFixesForIssues(issuesCollection, blueprintService) {
issuesCollection.byMessage = {};
Object.values(issuesCollection.byEntity).forEach(list => {
// etc.
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]