-
Notifications
You must be signed in to change notification settings - Fork 213
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1008 from akto-api-security/develop
Develop
- Loading branch information
Showing
28 changed files
with
628 additions
and
383 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 6 additions & 6 deletions
12
apps/api-runtime/src/test/java/com/akto/dependency/TestDependencyAnalyser.java
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
apps/dashboard/web/polaris_web/web/src/apps/dashboard/components/tables/TableContext.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { createContext, useReducer, useContext } from "react"; | ||
import tableReducer, {initialState} from "./tableReducer"; | ||
|
||
const TableContext = createContext(initialState); | ||
|
||
export const TableContextProvider = ({ children }) => { | ||
const [state, dispatch] = useReducer(tableReducer, initialState); | ||
|
||
const applyFilter = (filter) => { | ||
dispatch({ | ||
type: "APPLY_FILTER", | ||
payload: { | ||
tabsInfo: filter | ||
} | ||
}); | ||
}; | ||
|
||
const value = { | ||
tabsInfo: state.tabsInfo, | ||
applyFilter, | ||
}; | ||
return <TableContext.Provider value={value}>{children}</TableContext.Provider>; | ||
}; | ||
|
||
const useTable = () => { | ||
const context = useContext(TableContext); | ||
|
||
if (context === undefined) { | ||
throw new Error("useTable must be used within TableContext"); | ||
} | ||
|
||
return context; | ||
}; | ||
|
||
export default useTable; |
21 changes: 21 additions & 0 deletions
21
apps/dashboard/web/polaris_web/web/src/apps/dashboard/components/tables/tableReducer.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import PersistStore from "../../../main/PersistStore"; | ||
const tableInitialState = PersistStore.getState().tableInitialState[window.location.href] || {} | ||
|
||
export const initialState = { | ||
tabsInfo : tableInitialState | ||
} | ||
|
||
const tableReducer = (state, action) =>{ | ||
const { type, payload } = action; | ||
switch (type) { | ||
case "APPLY_FILTER": | ||
return { | ||
...state, | ||
tabsInfo: payload.tabsInfo, | ||
}; | ||
default: | ||
return{...state} | ||
} | ||
} | ||
|
||
export default tableReducer |
Oops, something went wrong.