Skip to content

Commit

Permalink
Merge pull request #3974 from cservakt/docUrl
Browse files Browse the repository at this point in the history
[GUI] Jump directly to documentation url without error modal
  • Loading branch information
Szelethus authored Sep 13, 2023
2 parents c3dbb1b + a57050e commit 96a40a6
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 27 deletions.
20 changes: 10 additions & 10 deletions web/server/vue-cli/e2e/specs/reportDetail.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,18 @@ module.exports = {

"show documentation" (browser) {
const reportDetailPage = browser.page.reportDetail();
const dialog = reportDetailPage.section.documentationDialog;
reportDetailPage.expect.element('@showDocumentationBtn')
.to.be.present.before(5000, false);

reportDetailPage.click("@showDocumentationBtn");
reportDetailPage.click('@showDocumentationBtn');

reportDetailPage.expect.section(dialog)
.to.be.visible.before(5000);

dialog.expect.element("@content").text.to.not.equal(null);

dialog.pause(100).click("@closeBtn");

reportDetailPage.expect.section(dialog).to.not.be.present.before(5000);
browser.windowHandles(windowObj => {
if (windowObj.value.length > 1) {
browser.switchWindow(windowObj.value[1]);
browser.closeWindow();
browser.switchWindow(windowObj.value[0]);
}
});
},

"show blame information" (browser) {
Expand Down
35 changes: 23 additions & 12 deletions web/server/vue-cli/src/components/Report/Report.vue
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
<template>
<v-container fluid class="pa-0">
<checker-documentation-dialog
:value.sync="checkerDocumentationDialog"
:checker="selectedChecker"
/>

<analysis-info-dialog
:value.sync="analysisInfoDialog"
:report-id="reportId"
Expand Down Expand Up @@ -313,8 +308,7 @@ import ReportTreeKind from "@/components/Report/ReportTree/ReportTreeKind";
import { SetCleanupPlanBtn } from "@/components/Report/CleanupPlan";
import AnalysisInfoBtn from "./AnalysisInfoBtn";
import CheckerDocumentationDialog from
"@/components/CheckerDocumentationDialog";
import { ReportComments } from "./Comment";
import GitBlameMixin from "./Git/GitBlame";
import ToggleBlameViewBtn from "./Git/ToggleBlameViewBtn";
Expand All @@ -330,7 +324,6 @@ export default {
components: {
AnalysisInfoBtn,
AnalysisInfoDialog,
CheckerDocumentationDialog,
CopyBtn,
ReportComments,
ReportInfoButton,
Expand Down Expand Up @@ -367,11 +360,11 @@ export default {
loading: true,
bus: new Vue(),
annotation: null,
checkerDocumentationDialog: false,
selectedChecker: null,
analysisInfoDialog: false,
reportId: null,
enableBlameView
enableBlameView,
docUrl: null
};
},
Expand Down Expand Up @@ -487,7 +480,6 @@ export default {
analyzerName: this.report.analyzerName,
checkerId: this.report.checkerId
});
this.checkerDocumentationDialog = true;
});
},
Expand Down Expand Up @@ -654,6 +646,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] : null;
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 +767,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: null }
},
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 96a40a6

Please sign in to comment.