Skip to content
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
10 changes: 6 additions & 4 deletions web/server/vue-cli/e2e/pages/runs.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ module.exports = {
showDescriptionBtn: "button.description",
showHistoryBtn: "a.show-history",
showStatisticsBtn: "a.show-statistics",
showCheckCommandBtn: "button.show-analysis-info",
showAnalysisInfoBtn: "button.show-analysis-info",
openDetectionStatus: "a.detection-status-count",
descriptionMenu:
".menuable__content__active.run-description-menu .v-card__text",
Expand All @@ -61,10 +61,12 @@ module.exports = {
storedBefore: ".stored-before",
}
},
checkCommandDialog: {
analysisInfoDialog: {
selector: ".v-dialog__content--active .analysis-info",
elements: {
content: ".container",
command: ".analyze-command",
checkerStatuses: ".checker-statuses",
checkerStatusError: ".checker-status-unavailable",
closeBtn: ".v-card__title button"
}
},
Expand All @@ -89,7 +91,7 @@ module.exports = {
elements: {
date: ".date",
showStatisticsBtn: "a.show-statistics",
showCheckCommandBtn: "button.show-analysis-info",
showAnalysisInfoBtn: "button.show-analysis-info",
historyEvent: ".v-timeline-item.run-history",
baseline: ".compare-events .v-input--checkbox:nth-child(1)",
compareTo: ".compare-events .v-input--checkbox:nth-child(2)"
Expand Down
90 changes: 81 additions & 9 deletions web/server/vue-cli/e2e/specs/runs.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,19 +79,86 @@ module.exports = {
.waitForElementNotPresent("@descriptionMenu");
},

"show check command of a run" (browser) {
async "show check command of a run" (browser) {
const checkCommand = "cli.py analyze";
const runsPage = browser.page.runs();
const dialogSection = runsPage.section.checkCommandDialog;
const dialogSection = runsPage.section.analysisInfoDialog;

runsPage.click("@showCheckCommandBtn");
runsPage.click("@showAnalysisInfoBtn");

runsPage.expect.section(dialogSection)
.to.be.visible.before(5000);

dialogSection.assert.containsText("@content", checkCommand);
dialogSection.assert.containsText("@command", checkCommand);

// Close check command dialog.
dialogSection.expect.element("@checkerStatuses")
.to.be.present.before(5000);
dialogSection.expect.element("@checkerStatusError")
.to.not.be.present.before(5000);

dialogSection.pause(1000);
await (async () => {
const analyzerPanelBtnSelector = ".analysis-info " +
".analyzer-checkers-panel" +
".v-expansion-panel" +
":not(.v-expansion-panel--active) " +
"button";

dialogSection.expect.element(analyzerPanelBtnSelector)
.to.be.present.before(5000);

const analyzerPanelBtns = await runsPage.api.findElements(
analyzerPanelBtnSelector);
analyzerPanelBtns.value.forEach(async btnId =>
await runsPage.api.elementIdClick(btnId.getId()));

dialogSection.expect.element(analyzerPanelBtnSelector)
.to.not.be.present.before(5000);
})();
await (async () => {
const checkerGroupPanelBtnSelector = ".analysis-info " +
".analyzer-checker-group-panel" +
".v-expansion-panel" +
":not(.v-expansion-panel--active) " +
"button";

dialogSection.expect.element(checkerGroupPanelBtnSelector)
.to.be.present.before(5000);

const checkerGroupPanelBtns = await runsPage.api.findElements(
checkerGroupPanelBtnSelector);
checkerGroupPanelBtns.value.forEach(async btnId =>
await runsPage.api.elementIdClick(btnId.getId()));

dialogSection.expect.element(checkerGroupPanelBtnSelector)
.to.not.be.present.before(5000);
})();
dialogSection.pause(1000);

const assertCheckerStatus = (analyzer, group, checker, enabled) => {
const checkerSelector = ".analysis-info " +
".analyzer-checkers-panel[data-analyzer-name='" + analyzer + "'] " +
(group === "" ? "" :
".analyzer-checker-group-panel[data-group-name='" + group +"'] ") +
".analysis-info-checker[data-checker-name='" + checker + "'] " +
".checker-" + (enabled ? "enabled" : "disabled");

dialogSection.expect.element(checkerSelector).to.be.present.before(1000);
dialogSection.expect.element(checkerSelector).text.to.equal(checker);
};
const assertChecker = (analyzer, group, checker) =>
assertCheckerStatus(analyzer, group, checker, true);
const assertNotChecker = (analyzer, group, checker) =>
assertCheckerStatus(analyzer, group, checker, false);

assertChecker("clangsa", "core", "core.DivideZero");
assertChecker("clangsa", "cplusplus", "cplusplus.NewDelete");
assertNotChecker("clangsa", "osx", "osx.cocoa.Loops");

assertChecker("clang-tidy", "clang-diagnostic", "clang-diagnostic-switch");
assertNotChecker("clang-tidy", "llvm", "llvm-header-guard");

// Close analysis info dialog.
dialogSection.pause(100).click("@closeBtn");

runsPage.expect.section(dialogSection)
Expand Down Expand Up @@ -277,16 +344,21 @@ module.exports = {
const runsPage = browser.page.runs();
const expandedSection = runsPage.section.expanded;
const timelineSection = expandedSection.section.timeline;
const dialogSection = runsPage.section.checkCommandDialog;
const dialogSection = runsPage.section.analysisInfoDialog;

timelineSection.click("@showCheckCommandBtn");
timelineSection.click("@showAnalysisInfoBtn");

runsPage.expect.section(dialogSection)
.to.be.visible.before(5000);

dialogSection.assert.containsText("@content", checkCommand);
dialogSection.assert.containsText("@command", checkCommand);

dialogSection.expect.element("@checkerStatuses")
.to.be.present.before(5000);
dialogSection.expect.element("@checkerStatusError")
.to.not.be.present.before(5000);

// Close check command dialog.
// Close analysis info dialog.
dialogSection.click("@closeBtn");

runsPage.expect.section(dialogSection)
Expand Down
2 changes: 2 additions & 0 deletions web/server/vue-cli/src/components/AnalysisInfo/Checker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
<v-row
no-gutters
align="center"
class="analysis-info-checker"
:data-checker-name="name"
>
<v-col
cols="auto"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<template>
<v-expansion-panel>
<v-expansion-panel
class="analyzer-checker-group-panel"
:data-group-name="group"
>
<v-expansion-panel-header
class="pa-0 px-1"
>
Expand Down Expand Up @@ -76,7 +79,7 @@
<script>
import CountChips from "@/components/CountChips";
import CheckerRows from "./CheckerRows";
import { CountKeys } from "@/mixins/analysis-info-handling.mixin";
import { CountKeys } from "@/mixins/api/analysis-info-handling.mixin";

export default {
name: "CheckerGroup",
Expand Down
52 changes: 28 additions & 24 deletions web/server/vue-cli/src/components/AnalysisInfoDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<div
v-for="cmd in highlightedCmds"
:key="cmd"
class="analysis-info mb-2"
class="analyze-command mb-2"
v-html="cmd"
/>
</v-container>
Expand All @@ -37,14 +37,16 @@
v-if="analysisInfo.checkerInfoAvailability ===
CheckerInfoAvailability.Available"
>
<v-container class="pa-0 pt-1">
<v-container class="checker-statuses pa-0 pt-1">
<v-expansion-panels
multiple
hover
>
<v-expansion-panel
v-for="analyzer in analysisInfo.analyzers"
:key="analyzer"
class="analyzer-checkers-panel"
:data-analyzer-name="analyzer"
>
<v-expansion-panel-header
class="pa-0 px-1"
Expand Down Expand Up @@ -115,7 +117,7 @@
>
<v-alert
icon="mdi-alert"
class="mt-2"
class="checker-status-unavailable mt-2"
color="deep-orange"
outlined
>
Expand Down Expand Up @@ -148,8 +150,8 @@
<span class="version">{{
analysisInfo.codeCheckerVersion
}}</span>
client, and it was also <span class="font-italic">likely</span>
stored when the server ran this older version.
client, and it was also likely stored when the server ran this
older version.
</span>
<span
v-else-if="analysisInfo.checkerInfoAvailability ===
Expand All @@ -175,11 +177,11 @@ import {
} from "@/components/AnalysisInfo";
import CountChips from "@/components/CountChips";
import {
default as AnalysisInfoHandlingMixin,
default as AnalysisInfoHandlingAPIMixin,
CheckerInfoAvailability,
CountKeys,
GroupKeys
} from "@/mixins/analysis-info-handling.mixin";
} from "@/mixins/api/analysis-info-handling.mixin";

export default {
name: "AnalysisInfoDialog",
Expand All @@ -188,7 +190,7 @@ export default {
CheckerRows,
CountChips
},
mixins: [ AnalysisInfoHandlingMixin ],
mixins: [ AnalysisInfoHandlingAPIMixin ],
props: {
value: { type: Boolean, default: false },
runId: { type: Object, default: () => null },
Expand Down Expand Up @@ -283,26 +285,28 @@ export default {

<style lang="scss" scoped>
::v-deep .analysis-info {
border: 1px solid grey;
padding: 4px;
.analyze-command {
border: 1px solid grey;
padding: 4px;

.param {
background-color: rgba(0, 0, 0, 0.15);
font-weight: bold;
padding-left: 2px;
padding-right: 2px;
}
.param {
background-color: rgba(0, 0, 0, 0.15);
font-weight: bold;
padding-left: 2px;
padding-right: 2px;
}

.enabled-checkers {
background-color: rgba(0, 142, 0, 0.15);
}
.enabled-checkers {
background-color: rgba(0, 142, 0, 0.15);
}

.disabled-checkers {
background-color: rgba(142, 0, 0, 0.15);
}
.disabled-checkers {
background-color: rgba(142, 0, 0, 0.15);
}

.ctu, .statistics {
background-color: rgba(0, 0, 142, 0.15);
.ctu, .statistics {
background-color: rgba(0, 0, 142, 0.15);
}
}

.analyzer-name {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
RunFilter,
RunHistoryFilter
} from "@cc/report-server-types";
import VersionMixin from "./version.mixin";
import VersionMixin from "../version.mixin";

const GroupKeys = Object.freeze({
NoGroup: "__N",
Expand Down Expand Up @@ -129,6 +129,10 @@ function mergeReduceCheckerStatuses(accumulator, inCheckerDict) {
}

class AnalysisInfo {
GroupKeys() { return GroupKeys; }
CountKeys() { return CountKeys; }
CheckerInfoAvailability() { return CheckerInfoAvailability; }

constructor() {
this.cmds = [];
this.checkers = {};
Expand Down Expand Up @@ -217,7 +221,7 @@ class AnalysisInfo {
}
}

const AnalysisInfoHandlingMixin = {
const AnalysisInfoHandlingAPIMixin = {
methods: {
loadAnalysisInfo(runId, runHistoryId, reportId) {
const analysisInfoFilter = new AnalysisInfoFilter({
Expand Down Expand Up @@ -260,7 +264,7 @@ const AnalysisInfoHandlingMixin = {

export {
AnalysisInfo,
AnalysisInfoHandlingMixin as default,
AnalysisInfoHandlingAPIMixin as default,
CheckerInfoAvailability,
CountKeys,
GroupKeys,
Expand Down
5 changes: 5 additions & 0 deletions web/server/vue-cli/src/mixins/api/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import AnalysisInfoHandlingAPIMixin from "./analysis-info-handling.mixin";

export {
AnalysisInfoHandlingAPIMixin,
};
4 changes: 1 addition & 3 deletions web/server/vue-cli/src/mixins/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import AnalysisInfoHandlingMixin from "./analysis-info-handling.mixin";
import BugPathLengthColorMixin from "./bug-path-length-color.mixin";
import ConfidentialityMixin from "./confidentiality.mixin";
import DateMixin from "./date.mixin";
Expand All @@ -10,7 +9,6 @@ import ToCSV from "./to-csv.mixin";
import VersionMixin from "./version.mixin";

export {
AnalysisInfoHandlingMixin,
BugPathLengthColorMixin,
ConfidentialityMixin,
DateMixin,
Expand All @@ -19,5 +17,5 @@ export {
SeverityMixin,
StrToColorMixin,
ToCSV,
VersionMixin
VersionMixin,
};