-
Notifications
You must be signed in to change notification settings - Fork 178
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 #2025 from DaoDaoNoCode/upstream-issue-1947
Implement KServe table on project details page
- Loading branch information
Showing
7 changed files
with
171 additions
and
17 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
29 changes: 29 additions & 0 deletions
29
...end/src/pages/modelServing/screens/projects/KServeSection/KServeInferenceServiceTable.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,29 @@ | ||
import * as React from 'react'; | ||
import { Table } from '~/components/table'; | ||
import { getKServeInferenceServiceColumns } from '~/pages/modelServing/screens/global/data'; | ||
import KServeInferenceServiceTableRow from '~/pages/modelServing/screens/projects/KServeSection/KServeInferenceServiceTableRow'; | ||
import { ProjectDetailsContext } from '~/pages/projects/ProjectDetailsContext'; | ||
|
||
const KServeInferenceServiceTable: React.FC = () => { | ||
const { | ||
inferenceServices: { data: models }, | ||
} = React.useContext(ProjectDetailsContext); | ||
|
||
return ( | ||
<Table | ||
data={models} | ||
columns={getKServeInferenceServiceColumns()} | ||
disableRowRenderSupport | ||
defaultSortColumn={1} | ||
rowRenderer={(modelServer, rowIndex) => ( | ||
<KServeInferenceServiceTableRow | ||
key={modelServer.metadata.uid} | ||
obj={modelServer} | ||
rowIndex={rowIndex} | ||
/> | ||
)} | ||
/> | ||
); | ||
}; | ||
|
||
export default KServeInferenceServiceTable; |
104 changes: 104 additions & 0 deletions
104
.../src/pages/modelServing/screens/projects/KServeSection/KServeInferenceServiceTableRow.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,104 @@ | ||
import * as React from 'react'; | ||
import { ExpandableRowContent, Tbody, Td, Tr } from '@patternfly/react-table'; | ||
import { | ||
DescriptionList, | ||
DescriptionListDescription, | ||
DescriptionListGroup, | ||
DescriptionListTerm, | ||
Stack, | ||
StackItem, | ||
} from '@patternfly/react-core'; | ||
import { InferenceServiceKind } from '~/k8sTypes'; | ||
import InferenceServiceTableRow from '~/pages/modelServing/screens/global/InferenceServiceTableRow'; | ||
import { ProjectDetailsContext } from '~/pages/projects/ProjectDetailsContext'; | ||
import ServingRuntimeDetails from '~/pages/modelServing/screens/projects/ModelMeshSection/ServingRuntimeDetails'; | ||
import ServingRuntimeTokensTable from '~/pages/modelServing/screens/projects/ModelMeshSection/ServingRuntimeTokensTable'; | ||
import { isServingRuntimeTokenEnabled } from '~/pages/modelServing/screens/projects/utils'; | ||
|
||
type KServeInferenceServiceTableRowProps = { | ||
obj: InferenceServiceKind; | ||
rowIndex: number; | ||
}; | ||
|
||
const KServeInferenceServiceTableRow: React.FC<KServeInferenceServiceTableRowProps> = ({ | ||
obj, | ||
rowIndex, | ||
}) => { | ||
const [isExpanded, setExpanded] = React.useState(false); | ||
const { | ||
servingRuntimes: { data: servingRuntimes }, | ||
} = React.useContext(ProjectDetailsContext); | ||
|
||
const frameworkName = obj.spec.predictor.model.modelFormat.name; | ||
const frameworkVersion = obj.spec.predictor.model.modelFormat.version; | ||
|
||
const servingRuntime = servingRuntimes.find( | ||
(sr) => sr.metadata.name === obj.spec.predictor.model.runtime, | ||
); | ||
|
||
return ( | ||
<Tbody isExpanded={isExpanded}> | ||
<Tr> | ||
<Td | ||
expand={{ | ||
rowIndex: rowIndex, | ||
expandId: 'kserve-model-row-item', | ||
isExpanded, | ||
onToggle: () => setExpanded(!isExpanded), | ||
}} | ||
/> | ||
<InferenceServiceTableRow | ||
obj={obj} | ||
isGlobal={false} | ||
showServingRuntime | ||
servingRuntime={servingRuntimes.find( | ||
(sr) => sr.metadata.name === obj.spec.predictor.model.runtime, | ||
)} | ||
onDeleteInferenceService={() => undefined} | ||
onEditInferenceService={() => undefined} | ||
/> | ||
</Tr> | ||
<Tr isExpanded={isExpanded}> | ||
<Td /> | ||
<Td dataLabel="Information" colSpan={5}> | ||
<ExpandableRowContent> | ||
<Stack hasGutter> | ||
<StackItem> | ||
<DescriptionList isHorizontal horizontalTermWidthModifier={{ default: '250px' }}> | ||
<DescriptionListGroup> | ||
<DescriptionListTerm>Framework</DescriptionListTerm> | ||
<DescriptionListDescription> | ||
{frameworkVersion ? `${frameworkName}-${frameworkVersion}` : frameworkName} | ||
</DescriptionListDescription> | ||
</DescriptionListGroup> | ||
</DescriptionList> | ||
</StackItem> | ||
{servingRuntime && ( | ||
<StackItem> | ||
<ServingRuntimeDetails obj={servingRuntime} /> | ||
</StackItem> | ||
)} | ||
{servingRuntime && ( | ||
<StackItem> | ||
<DescriptionList> | ||
<DescriptionListGroup> | ||
<DescriptionListTerm>Tokens</DescriptionListTerm> | ||
<DescriptionListDescription> | ||
<ServingRuntimeTokensTable | ||
obj={servingRuntime} | ||
isTokenEnabled={isServingRuntimeTokenEnabled(servingRuntime)} | ||
/> | ||
</DescriptionListDescription> | ||
</DescriptionListGroup> | ||
</DescriptionList> | ||
</StackItem> | ||
)} | ||
</Stack> | ||
</ExpandableRowContent> | ||
</Td> | ||
</Tr> | ||
</Tbody> | ||
); | ||
}; | ||
|
||
export default KServeInferenceServiceTableRow; |
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