Skip to content

Commit

Permalink
Merge pull request #1227 from akto-api-security/hotfix/fix_loading_fo…
Browse files Browse the repository at this point in the history
…r_collections

adding hostname field in projections
  • Loading branch information
notshivansh authored Jun 27, 2024
2 parents 36ed4a2 + 7c874fa commit 07a6a1c
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ public String fetchAllCollections() {
public String fetchAllCollectionsBasic(){
this.apiCollections = ApiCollectionsDao.instance.findAll(
new BasicDBObject(),
Projections.include(ApiCollection.ID, ApiCollection.NAME)
Projections.include(ApiCollection.ID, ApiCollection.NAME, ApiCollection.HOST_NAME)
);
return Action.SUCCESS.toUpperCase();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,27 +37,15 @@ export default function Header() {
const searchItemsArr = func.getSearchItemsArr(allRoutes, allCollections)

const setCurrentTestingRuns = TestingStore(state => state.setCurrentTestingRuns)

const fetchTestingStatus = () => {
setInterval(()=> {
testingApi.fetchTestingRunStatus().then((resp) => {
setCurrentTestingRuns(resp.currentRunningTestsStatus)
setCurrentTestsObj({
totalTestsInitiated: resp?.testRunsScheduled || 0,
totalTestsCompleted: resp?.totalTestsCompleted || 0,
totalTestsQueued: resp?.testRunsQueued || 0,
testRunsArr: resp?.currentRunningTestsStatus || []
})
})
},2000)
}
const [intervalId, setIntervalId] = useState(null);

const toggleIsUserMenuOpen = useCallback(
() => setIsUserMenuOpen((isUserMenuOpen) => !isUserMenuOpen),
[],
);

const handleLogOut = async () => {
const handleLogOut = async () => {
clearInterval(intervalId)
api.logout().then(res => {
resetAll();
storeAccessToken(null)
Expand Down Expand Up @@ -250,8 +238,28 @@ export default function Header() {
);

useEffect(() => {
fetchTestingStatus()
},[])
const fetchTestingStatus = () => {
const id = setInterval(() => {
testingApi.fetchTestingRunStatus().then((resp) => {
setCurrentTestingRuns(resp.currentRunningTestsStatus);
setCurrentTestsObj({
totalTestsInitiated: resp?.testRunsScheduled || 0,
totalTestsCompleted: resp?.totalTestsCompleted || 0,
totalTestsQueued: resp?.testRunsQueued || 0,
testRunsArr: resp?.currentRunningTestsStatus || []
});
});
}, 2000);
setIntervalId(id);
};

fetchTestingStatus();

return () => {
clearInterval(intervalId);
};
}, []);


return (
topBarMarkup
Expand Down

0 comments on commit 07a6a1c

Please sign in to comment.