Skip to content

Commit a1b8d54

Browse files
authored
Merge pull request #990 from akto-api-security/hotfix/fix_filters_on_api_changes
fixing null checks and adding filter operators for method header in a…
2 parents 31e317b + c4b08e7 commit a1b8d54

File tree

3 files changed

+18
-7
lines changed

3 files changed

+18
-7
lines changed

apps/dashboard/web/polaris_web/web/src/apps/dashboard/pages/observe/api_collections/component/ApiChangesTable.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ function ApiChangesTable(props) {
123123
selected={selected}
124124
onSelect={handleSelectedTab}
125125
mode={IndexFiltersMode.Default}
126-
headings={tableDataObj.headers}
126+
headings={tableDataObj.headings}
127127
useNewRow={true}
128128
condensedHeight={true}
129129
tableTabs={tableTabs}

apps/dashboard/web/polaris_web/web/src/apps/dashboard/pages/observe/api_collections/data/apiChanges.js

+11-1
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,14 @@ const endpointResourceName = {
121121
plural: 'API endpoints',
122122
};
123123

124+
const methodObj = [{
125+
text: 'Method',
126+
value: 'method',
127+
filterKey: 'method',
128+
showFilter: true,
129+
textValue: 'method',
130+
}]
131+
124132
const endpointSortOptions = [
125133
{ label: 'Method', value: 'method asc', directionLabel: 'A-Z', sortKey: 'method' },
126134
{ label: 'Method', value: 'method desc', directionLabel: 'Z-A', sortKey: 'method' },
@@ -180,13 +188,15 @@ const apiChangesData = {
180188
getData(key){
181189
if(key === 'param'){
182190
const obj = {
183-
headers: newParametersHeaders,
191+
headers: [...newParametersHeaders, ...methodObj],
192+
headings: newParametersHeaders,
184193
resourceName: parameterResourceName,
185194
sortOptions: parameterSortOptions,
186195
}
187196
return obj;
188197
}else{
189198
const obj = {
199+
headings: endpointHeadings,
190200
headers: endpointHeadings,
191201
resourceName: endpointResourceName,
192202
sortOptions: endpointSortOptions,

apps/dashboard/web/polaris_web/web/src/apps/dashboard/pages/testing/SingleTestRunPage/TrendChart.jsx

+6-5
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,11 @@ function TrendChart(props) {
6464
items.forEach((x) => {
6565
let ts = x["startTimestamp"] * 1000
6666
let countIssuesMap = x["countIssues"]
67-
68-
retH.push([ts, countIssuesMap["HIGH"]])
69-
retM.push([ts, countIssuesMap["MEDIUM"]])
70-
retL.push([ts, countIssuesMap["LOW"]])
67+
if(countIssuesMap && Object.keys(countIssuesMap).length > 0){
68+
retH.push([ts, countIssuesMap["HIGH"]])
69+
retM.push([ts, countIssuesMap["MEDIUM"]])
70+
retL.push([ts, countIssuesMap["LOW"]])
71+
}
7172
})
7273

7374
return [
@@ -144,7 +145,7 @@ function TrendChart(props) {
144145

145146
let count = 0
146147
testingRunResultSummaries.forEach((ele)=>{
147-
let obj = Object.keys(ele.countIssues) ? ele.countIssues : {HIGH: 0, MEDIUM: 0, LOW: 0}
148+
let obj = Object.keys(ele.countIssues).length > 0 ? ele.countIssues : {HIGH: 0, MEDIUM: 0, LOW: 0}
148149
count += (obj.HIGH + obj.MEDIUM + obj.LOW)
149150
})
150151

0 commit comments

Comments
 (0)