forked from keephq/keep
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into Feat/runbook
- Loading branch information
Showing
29 changed files
with
2,777 additions
and
1,594 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
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
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
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,53 @@ | ||
"use client"; | ||
import React, { createContext, useContext, useState } from "react"; | ||
|
||
type TopologySearchContextType = { | ||
selectedObjectId: string | null; | ||
setSelectedObjectId: (id: string | null) => void; | ||
selectedApplicationIds: string[]; | ||
setSelectedApplicationIds: (ids: string[]) => void; | ||
}; | ||
|
||
const defaultContext: TopologySearchContextType = { | ||
selectedObjectId: "", | ||
setSelectedObjectId: () => {}, | ||
selectedApplicationIds: [], | ||
setSelectedApplicationIds: () => {}, | ||
}; | ||
|
||
export const TopologySearchContext = | ||
createContext<TopologySearchContextType>(defaultContext); | ||
|
||
export function useTopologySearchContext() { | ||
const context = useContext(TopologySearchContext); | ||
if (context === undefined) { | ||
throw new Error( | ||
"useTopologySearchContext must be used within a TopologySearchContextProvider" | ||
); | ||
} | ||
return context; | ||
} | ||
|
||
export const TopologySearchProvider: React.FC<{ | ||
children: React.ReactNode; | ||
}> = ({ children }) => { | ||
const [selectedServiceId, setSelectedServiceId] = useState<string | null>( | ||
null | ||
); | ||
const [selectedApplicationIds, setSelectedApplicationIds] = useState< | ||
string[] | ||
>([]); | ||
|
||
return ( | ||
<TopologySearchContext.Provider | ||
value={{ | ||
selectedObjectId: selectedServiceId, | ||
setSelectedObjectId: setSelectedServiceId, | ||
selectedApplicationIds, | ||
setSelectedApplicationIds, | ||
}} | ||
> | ||
{children} | ||
</TopologySearchContext.Provider> | ||
); | ||
}; |
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
Oops, something went wrong.