diff --git a/apps/dashboard/web/polaris_web/web/src/apps/dashboard/pages/observe/api_collections/ApiChanges.jsx b/apps/dashboard/web/polaris_web/web/src/apps/dashboard/pages/observe/api_collections/ApiChanges.jsx index ede23555d0..12ad723e67 100644 --- a/apps/dashboard/web/polaris_web/web/src/apps/dashboard/pages/observe/api_collections/ApiChanges.jsx +++ b/apps/dashboard/web/polaris_web/web/src/apps/dashboard/pages/observe/api_collections/ApiChanges.jsx @@ -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, @@ -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(() => { @@ -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} /> ) diff --git a/apps/dashboard/web/polaris_web/web/src/apps/dashboard/pages/observe/api_collections/component/ApiChangesTable.jsx b/apps/dashboard/web/polaris_web/web/src/apps/dashboard/pages/observe/api_collections/component/ApiChangesTable.jsx index 9c99fd8617..6674fd903f 100644 --- a/apps/dashboard/web/polaris_web/web/src/apps/dashboard/pages/observe/api_collections/component/ApiChangesTable.jsx +++ b/apps/dashboard/web/polaris_web/web/src/apps/dashboard/pages/observe/api_collections/component/ApiChangesTable.jsx @@ -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) @@ -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); @@ -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 (