Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GUI] Jump directly to documentation url without error modal #3974

Merged
merged 1 commit into from
Sep 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this mean that we can just outright delete that file? Seems like only Report.vue used it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, we cannot delete it. The Reports.vue also uses the 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>
Loading