Skip to content

Commit

Permalink
Jump directly to documetaion url without error modal
Browse files Browse the repository at this point in the history
  • Loading branch information
cservakt committed Aug 9, 2023
1 parent 38f9315 commit 66acd7a
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 8 deletions.
25 changes: 22 additions & 3 deletions web/server/vue-cli/src/components/Report/Report.vue
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,8 @@ export default {
selectedChecker: null,
analysisInfoDialog: false,
reportId: null,
enableBlameView
enableBlameView,
docUrl: null
};
},
Expand Down Expand Up @@ -487,7 +488,6 @@ export default {
analyzerName: this.report.analyzerName,
checkerId: this.report.checkerId
});
this.checkerDocumentationDialog = true;
});
},
Expand Down Expand Up @@ -654,6 +654,24 @@ export default {
}));
});
const errorChecker = new Checker({
analyzerName: this.report.analyzerName,
checkerId: this.report.checkerId
});
await new Promise(resolve => {
ccService.getClient().getCheckerLabels(
[ errorChecker ],
handleThriftError(labels => {
const docUrlLabels = labels[0].filter(
param => param.startsWith("doc_url")
);
this.docUrl = docUrlLabels.length ?
docUrlLabels[0].split("doc_url:")[1] : "";
resolve(this.docUrl);
})
);
});
const isSameFile = path => path.fileId.equals(this.sourceFile.fileId);
// Add extra path events (macro expansions, notes).
Expand Down Expand Up @@ -757,7 +775,8 @@ export default {
index: event.$index,
bus: this.bus,
prevStep: event.$prevStep,
nextStep: event.$nextStep
nextStep: event.$nextStep,
docUrl: this.docUrl
};
this.addLineWidget(event, props);
});
Expand Down
18 changes: 13 additions & 5 deletions web/server/vue-cli/src/components/Report/ReportStepMessage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<div>
{{ value }}

<p v-if="type === 'error'" class="mb-0 mt-2">
<p v-if="type === 'error' && docUrl != ''" class="mb-0 mt-2">
For more information see the
<a
class="show-documentation-btn"
Expand All @@ -40,6 +40,12 @@
checker documentation
</a>.
</p>
<p
v-else-if="type === 'error'"
class="no-documentation-msg-text mb-0 mt-2"
>
No documentation for checker.
</p>
</div>

<v-btn
Expand Down Expand Up @@ -73,7 +79,8 @@ export default {
index: { type: [ Number, String ], default: null },
bus: { type: Object, default: null },
prevStep: { type: Object, default: null },
nextStep: { type: Object, default: null }
nextStep: { type: Object, default: null },
docUrl: { type: String, default: "" }
},
computed: {
color() {
Expand Down Expand Up @@ -118,9 +125,7 @@ export default {
},
showDocumentation() {
if (!this.bus) return;
this.bus.$emit("showDocumentation");
window.open(this.docUrl, "_blank");
}
}
};
Expand All @@ -147,5 +152,8 @@ export default {
display: inline-block;
}
}
.no-documentation-msg-text {
color: grey
}
}
</style>

0 comments on commit 66acd7a

Please sign in to comment.