Skip to content

Commit

Permalink
Merge pull request #1735 from akto-api-security/hotfix/fix_memory_hea…
Browse files Browse the repository at this point in the history
…p_issue

reverting comment of api
  • Loading branch information
Ark2307 authored Nov 18, 2024
2 parents 3cb6cd1 + 26eae6d commit 9e33253
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ function ApiChanges() {
const [loading, setLoading] = useState(false);
const [apiDetail, setApiDetail] = useState({})
const [tableHeaders,setTableHeaders] = useState([])
const [newParams, setNewParams] = useState([])
const [summaryCountObj,setSummaryCountObj] = useState({
"newEndpointsCount": 0,
"sensitiveEndpointsCount": 0,
Expand Down Expand Up @@ -99,17 +98,6 @@ function ApiChanges() {
const endpointsTrendObj = transform.findNewParametersCountTrend(mergedArrObj, startTimestamp, endTimestamp)
setEndpointsTrend(endpointsTrendObj.trend)
setLoading(false)

// await api.fetchRecentParams(startTimestamp, endTimestamp).then((res) => {
// const ret = res.data.endpoints.map((x,index) => transform.prepareEndpointForTable(x,index));
// setNewParams(ret)
// setSummaryCountObj((prev) => {
// return{
// ...prev,
// newParamsCount: ret.length
// }
// })
// })
}

useEffect(() => {
Expand Down Expand Up @@ -145,10 +133,8 @@ function ApiChanges() {
tableLoading={loading}
startTimeStamp={startTimestamp}
endTimeStamp={endTimestamp}
newEndpointsCount={summaryCountObj.new_endpoints}
key="table"
tab={(location.state)?(location.state.tab):0 }
newParams={newParams}
/>
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import api from '../../api';

function ApiChangesTable(props) {

const { handleRowClick, tableLoading, startTimeStamp, endTimeStamp, newParams} = props ;
const { handleRowClick, tableLoading, startTimeStamp, endTimeStamp} = props ;
const [selectedTab, setSelectedTab] = useState("new_endpoints") ;
const [selected, setSelected] = useState(0) ;
const apiCollectionMap = PersistStore(state => state.collectionsMap)
Expand All @@ -20,10 +20,10 @@ function ApiChangesTable(props) {

const definedTableTabs = ['New endpoints', 'New params']

const initialCount = [newEndpointsCount , newParams.length]
const initialCount = [newEndpointsCount , 0]

const { tabsInfo } = useTable()
const tableCountObj = func.getTabsCount(definedTableTabs, newParams, initialCount)
const tableCountObj = func.getTabsCount(definedTableTabs, [], initialCount)
const tableTabs = func.getTableTabsContent(definedTableTabs, tableCountObj, setSelectedTab, selectedTab, tabsInfo)

const tableDataObj = apiChangesData.getData(selectedTab);
Expand Down Expand Up @@ -83,16 +83,21 @@ function ApiChangesTable(props) {
})
return { value: ret, total: total };
}else{
let data = []
await api.fetchRecentParams(startTimeStamp, endTimeStamp).then((res) => {
const ret = res.data.endpoints.map((x,index) => transform.prepareEndpointForTable(x,index));
data = ret;
})
const dataObj = {
"headers": tableDataObj.headers,
"data": newParams,
"data": data,
"sortOptions": tableDataObj.sortOptions,
}
return tableFunc.fetchDataSync(sortKey, sortOrder, skip, limit, filters, filterOperators, queryValue, () => {}, dataObj)
}
}

const key = selectedTab + startTimeStamp + endTimeStamp + newParams.length
const key = selectedTab + startTimeStamp + endTimeStamp
const filterOptions = func.getCollectionFilters(tableDataObj?.filters || [])

return (
Expand Down

0 comments on commit 9e33253

Please sign in to comment.