forked from opendatahub-io/odh-dashboard
-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/main' into rhoai-2.17
- Loading branch information
Showing
26 changed files
with
433 additions
and
170 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
import { OdhApplication, OdhApplicationCategory } from '~/types'; | ||
|
||
type MockOdhApplicationConfig = { | ||
name?: string; | ||
displayName?: string; | ||
provider?: string; | ||
description?: string; | ||
route?: string | null; | ||
routeNamespace?: string | null; | ||
routeSuffix?: string | null; | ||
serviceName?: string | null; | ||
endpoint?: string | null; | ||
link?: string | null; | ||
img?: string; | ||
docsLink?: string; | ||
hidden?: boolean | null; | ||
getStartedLink?: string; | ||
getStartedMarkDown?: string; | ||
category?: OdhApplicationCategory | string; | ||
support?: string; | ||
quickStart?: string | null; | ||
comingSoon?: boolean | null; | ||
beta?: boolean | null; | ||
betaTitle?: string | null; | ||
betaText?: string | null; | ||
shownOnEnabledPage?: boolean | null; | ||
isEnabled?: boolean | null; | ||
kfdefApplications?: string[]; | ||
csvName?: string; | ||
annotations?: { [key: string]: string }; | ||
enable?: { | ||
title: string; | ||
actionLabel: string; | ||
description?: string; | ||
linkPreface?: string; | ||
link?: string; | ||
variables?: { [key: string]: string }; | ||
variableDisplayText?: { [key: string]: string }; | ||
variableHelpText?: { [key: string]: string }; | ||
validationSecret: string; | ||
validationJob: string; | ||
validationConfigMap?: string; | ||
}; | ||
featureFlag?: string; | ||
internalRoute?: string; | ||
}; | ||
|
||
export const mockOdhApplication = ({ | ||
name = 'nvidia-nim', | ||
displayName = 'Test Application', | ||
provider = 'Test Provider', | ||
description = 'Test Description', | ||
route = null, | ||
routeNamespace = null, | ||
routeSuffix = null, | ||
serviceName = null, | ||
endpoint = null, | ||
link = null, | ||
img = 'test-image.png', | ||
docsLink = 'https://test-docs.com', | ||
hidden = null, | ||
getStartedLink = 'https://test-getting-started.com', | ||
getStartedMarkDown = '# Getting Started', | ||
category = 'category-1', | ||
support = 'test-support', | ||
quickStart = null, | ||
comingSoon = null, | ||
beta = null, | ||
betaTitle = null, | ||
betaText = null, | ||
shownOnEnabledPage = null, | ||
isEnabled = null, | ||
kfdefApplications = [], | ||
csvName = undefined, | ||
annotations = {}, | ||
enable = undefined, | ||
featureFlag = undefined, | ||
internalRoute = '/api/integrations/nim', | ||
}: MockOdhApplicationConfig = {}): OdhApplication => ({ | ||
metadata: { | ||
name, | ||
annotations, | ||
}, | ||
spec: { | ||
displayName, | ||
provider, | ||
description, | ||
route, | ||
routeNamespace, | ||
routeSuffix, | ||
serviceName, | ||
endpoint, | ||
link, | ||
img, | ||
docsLink, | ||
hidden, | ||
getStartedLink, | ||
getStartedMarkDown, | ||
category, | ||
support, | ||
quickStart, | ||
comingSoon, | ||
beta, | ||
betaTitle, | ||
betaText, | ||
shownOnEnabledPage, | ||
isEnabled, | ||
kfdefApplications, | ||
csvName, | ||
enable, | ||
featureFlag, | ||
internalRoute, | ||
}, | ||
}); |
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
37 changes: 37 additions & 0 deletions
37
frontend/src/concepts/nimServing/NIMAvailabilityContext.tsx
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,37 @@ | ||
import * as React from 'react'; | ||
import { useIsNIMAvailable } from '~/pages/modelServing/screens/projects/useIsNIMAvailable'; | ||
|
||
export type NIMAvailabilityContextType = { | ||
isNIMAvailable: boolean; | ||
loaded: boolean; | ||
}; | ||
|
||
type NIMAvailabilityContextProviderProps = { | ||
children: React.ReactNode; | ||
}; | ||
|
||
export const NIMAvailabilityContext = React.createContext<NIMAvailabilityContextType>({ | ||
isNIMAvailable: false, | ||
loaded: false, | ||
}); | ||
|
||
export const NimContextProvider: React.FC<NIMAvailabilityContextProviderProps> = ({ | ||
children, | ||
...props | ||
}) => { | ||
return <EnabledNimContextProvider {...props}>{children}</EnabledNimContextProvider>; | ||
|
||
return children; | ||
}; | ||
|
||
const EnabledNimContextProvider: React.FC<NIMAvailabilityContextProviderProps> = ({ children }) => { | ||
const [isNIMAvailable, loaded] = useIsNIMAvailable(); | ||
|
||
const contextValue = React.useMemo(() => ({ isNIMAvailable, loaded }), [isNIMAvailable, loaded]); | ||
|
||
return ( | ||
<NIMAvailabilityContext.Provider value={contextValue}> | ||
{children} | ||
</NIMAvailabilityContext.Provider> | ||
); | ||
}; |
Oops, something went wrong.