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

Showing closed reports #4244

Merged
merged 7 commits into from
May 29, 2024
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
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion web/api/js/codechecker-api-node/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "codechecker-api",
"version": "6.57.0",
"version": "6.58.0",
"description": "Generated node.js compatible API stubs for CodeChecker server.",
"main": "lib",
"homepage": "https://github.com/Ericsson/codechecker",
Expand Down
Binary file modified web/api/py/codechecker_api/dist/codechecker_api.tar.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion web/api/py/codechecker_api/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
with open('README.md', encoding='utf-8', errors="ignore") as f:
long_description = f.read()

api_version = '6.57.0'
api_version = '6.58.0'

setup(
name='codechecker_api',
Expand Down
Binary file not shown.
2 changes: 1 addition & 1 deletion web/api/py/codechecker_api_shared/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
with open('README.md', encoding='utf-8', errors="ignore") as f:
long_description = f.read()

api_version = '6.57.0'
api_version = '6.58.0'

setup(
name='codechecker_api_shared',
Expand Down
20 changes: 20 additions & 0 deletions web/api/report_server.thrift
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,15 @@ enum Order {
DESC
}

/**
* Report status can show the current status of the report
* that depends on the review and thedetection status.
*/
enum ReportStatus {
OUTSTANDING, // The report is outstanding according to the review- and the detection status.
CLOSED // The report is not a valid bug according to the review- and the detection status.
}

/**
* Review status is a feature which allows a user to assign one of these
* statuses to a particular Report.
Expand Down Expand Up @@ -381,6 +390,7 @@ struct ReportFilter {
// [(key1, value1), (key1, value2), (key2, value3)] returns reports which
// have "value1" OR "value2" for "key1" AND have "value3" for "key2".
22: optional list<Pair> annotations,
23: optional list<ReportStatus> reportStatus, // Specifying the status of the filtered reports.
}

struct RunReportCount {
Expand Down Expand Up @@ -826,6 +836,16 @@ service codeCheckerDBAccess {
5: i64 offset)
throws (1: codechecker_api_shared.RequestFailed requestError),

// getReportStatusCounts returns ReportStatus-count pairs
// to show the number of outstanding and closed reports.
// If the run id list is empty the metrics will be
// counted for all of the runs.
// PERMISSION: PRODUCT_VIEW
map<ReportStatus, i64> getReportStatusCounts(1: list<i64> runIds,
2: ReportFilter reportFilter,
3: CompareData cmpData)
throws (1: codechecker_api_shared.RequestFailed requestError),

// If the run id list is empty the metrics will be counted
// for all of the runs and in compare mode all of the runs
// will be used as a baseline excluding the runs in compare data.
Expand Down
2 changes: 1 addition & 1 deletion web/codechecker_web/shared/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# The newest supported minor version (value) for each supported major version
# (key) in this particular build.
SUPPORTED_VERSIONS = {
6: 57
6: 58
}

# Used by the client to automatically identify the latest major and minor
Expand Down
82 changes: 79 additions & 3 deletions web/server/codechecker_server/api/report_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
DetectionStatus, DiffType, \
Encoding, ExportData, \
Order, \
ReportData, ReportDetails, ReviewData, ReviewStatusRule, \
ReportData, ReportDetails, ReportStatus, ReviewData, ReviewStatusRule, \
ReviewStatusRuleFilter, ReviewStatusRuleSortMode, \
ReviewStatusRuleSortType, RunData, RunFilter, RunHistoryData, \
RunReportCount, RunSortType, RunTagCount, \
Expand Down Expand Up @@ -70,8 +70,8 @@
SourceComponent

from .thrift_enum_helper import detection_status_enum, \
detection_status_str, review_status_enum, review_status_str, \
report_extended_data_type_enum
detection_status_str, report_status_enum, \
review_status_enum, review_status_str, report_extended_data_type_enum


LOG = get_logger('server')
Expand Down Expand Up @@ -301,6 +301,28 @@ def process_report_filter(

AND.append(or_(*OR))

if report_filter.reportStatus:
dst = list(map(detection_status_str,
(DetectionStatus.NEW,
DetectionStatus.UNRESOLVED,
DetectionStatus.REOPENED)))
rst = list(map(review_status_str,
(API_ReviewStatus.UNREVIEWED,
API_ReviewStatus.CONFIRMED)))

OR = []
filter_query = and_(
Report.review_status.in_(rst),
Report.detection_status.in_(dst)
)
if ReportStatus.OUTSTANDING in report_filter.reportStatus:
OR.append(filter_query)

if ReportStatus.CLOSED in report_filter.reportStatus:
OR.append(not_(filter_query))

AND.append(or_(*OR))

if report_filter.detectionStatus:
dst = list(map(detection_status_str,
report_filter.detectionStatus))
Expand Down Expand Up @@ -3255,6 +3277,60 @@ def getCheckerMsgCounts(self, run_ids, report_filter, cmp_data, limit,
results = dict(checker_messages.all())
return results

@exc_to_thrift_reqfail
@timeit
def getReportStatusCounts(self, run_ids, report_filter, cmp_data):
"""
If the run id list is empty the metrics will be counted
for all of the runs and in compare mode all of the runs
will be used as a baseline excluding the runs in compare data.
"""
self.__require_view()
with DBSession(self._Session) as session:
filter_expression, join_tables = process_report_filter(
session, run_ids, report_filter, cmp_data)

extended_table = session.query(
Report.review_status,
Report.detection_status,
Report.bug_id
)

if report_filter.annotations is not None:
extended_table = extended_table.outerjoin(
ReportAnnotations,
ReportAnnotations.report_id == Report.id
)
extended_table = extended_table.group_by(Report.id)

extended_table = apply_report_filter(
extended_table, filter_expression, join_tables)

extended_table = extended_table.subquery()

is_outstanding_case = get_is_opened_case(extended_table)
case_label = "isOutstanding"

if report_filter.isUnique:
q = session.query(
is_outstanding_case.label(case_label),
func.count(extended_table.c.bug_id.distinct())) \
.group_by(is_outstanding_case)
else:
q = session.query(
is_outstanding_case.label(case_label),
func.count(extended_table.c.bug_id)) \
.group_by(is_outstanding_case)

results = {
report_status_enum(
"outstanding" if isOutstanding
else "closed"
): count for isOutstanding, count in q
}

return results

@exc_to_thrift_reqfail
@timeit
def getReviewStatusCounts(self, run_ids, report_filter, cmp_data):
Expand Down
22 changes: 21 additions & 1 deletion web/server/codechecker_server/api/thrift_enum_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@


from codechecker_api.codeCheckerDBAccess_v6.ttypes import DetectionStatus, \
ExtendedReportDataType, ReviewStatus
ExtendedReportDataType, ReportStatus, ReviewStatus
from codechecker_api.ProductManagement_v6.ttypes import Confidentiality


Expand Down Expand Up @@ -119,3 +119,23 @@ def report_extended_data_type_enum(status):
return ExtendedReportDataType.MACRO
elif status == 'fixit':
return ExtendedReportDataType.FIXIT


def report_status_str(status):
"""
Returns the given report status Thrift enum value.
"""
if status == ReportStatus.OUTSTANDING:
return 'outstanding'
elif status == ReportStatus.CLOSED:
return 'closed'


def report_status_enum(status):
"""
Converts the given report status to string.
"""
if status == 'outstanding':
return ReportStatus.OUTSTANDING
elif status == 'closed':
return ReportStatus.CLOSED
12 changes: 6 additions & 6 deletions web/server/vue-cli/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion web/server/vue-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
},
"dependencies": {
"@mdi/font": "^6.5.95",
"codechecker-api": "file:../../api/js/codechecker-api-node/dist/codechecker-api-6.57.0.tgz",
"codechecker-api": "file:../../api/js/codechecker-api-node/dist/codechecker-api-6.58.0.tgz",
"chart.js": "^2.9.4",
"chartjs-plugin-datalabels": "^0.7.0",
"codemirror": "^5.65.0",
Expand Down
36 changes: 36 additions & 0 deletions web/server/vue-cli/src/components/Icons/ReportStatusIcon.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<template>
<v-icon
v-if="status === ReportStatus.OUTSTANDING"
color="error"
title="Outstanding"
:size="size"
>
mdi-alert
</v-icon>

<v-icon
v-else-if="status === ReportStatus.CLOSED"
color="primary"
title="Closed"
:size="size"
>
mdi-close
</v-icon>
</template>

<script>
import { ReportStatus } from "@cc/report-server-types";

export default {
name: "ReportStatusIcon",
props: {
status: { type: Number, required: true },
size: { type: Number, default: null }
},
data() {
return {
ReportStatus
};
}
};
</script>
2 changes: 2 additions & 0 deletions web/server/vue-cli/src/components/Icons/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import AnalyzerStatisticsIcon from "./AnalyzerStatisticsIcon";
import ConfidentialityIcon from "./ConfidentialityIcon";
import DetectionStatusIcon from "./DetectionStatusIcon";
import ReportStatusIcon from "./ReportStatusIcon";
import ReportStepEnumIcon from "./ReportStepEnumIcon";
import ReviewStatusIcon from "./ReviewStatusIcon";
import SeverityIcon from "./SeverityIcon";
Expand All @@ -10,6 +11,7 @@ export {
AnalyzerStatisticsIcon,
ConfidentialityIcon,
DetectionStatusIcon,
ReportStatusIcon,
ReportStepEnumIcon,
ReviewStatusIcon,
SeverityIcon,
Expand Down
Loading
Loading