-
Notifications
You must be signed in to change notification settings - Fork 167
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add connection type to model serving create modal (#3356)
* Add connection type to model serving create modal * Jest tests * Fixes * Show types with missing required fields, but set them required * Add connection type to model serving create modal
- Loading branch information
Showing
10 changed files
with
719 additions
and
74 deletions.
There are no files selected for viewing
73 changes: 73 additions & 0 deletions
73
frontend/src/concepts/connectionTypes/ConnectionDetailsHelperText.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,73 @@ | ||
import React from 'react'; | ||
import { | ||
Button, | ||
DescriptionList, | ||
DescriptionListDescription, | ||
DescriptionListGroup, | ||
DescriptionListTerm, | ||
HelperText, | ||
HelperTextItem, | ||
LabelGroup, | ||
Popover, | ||
} from '@patternfly/react-core'; | ||
import { getDescriptionFromK8sResource, getDisplayNameFromK8sResource } from '~/concepts/k8s/utils'; | ||
import TruncatedText from '~/components/TruncatedText'; | ||
import { Connection, ConnectionTypeConfigMapObj } from './types'; | ||
import CategoryLabel from './CategoryLabel'; | ||
|
||
type Props = { | ||
connection: Connection; | ||
connectionType?: ConnectionTypeConfigMapObj; | ||
}; | ||
|
||
export const ConnectionDetailsHelperText: React.FC<Props> = ({ connection, connectionType }) => { | ||
const displayName = getDisplayNameFromK8sResource(connection); | ||
const description = getDescriptionFromK8sResource(connection); | ||
|
||
return ( | ||
<HelperText> | ||
{description && ( | ||
<HelperTextItem> | ||
<TruncatedText maxLines={2} content={description} /> | ||
</HelperTextItem> | ||
)} | ||
<HelperTextItem> | ||
<Popover | ||
headerContent="Connection details" | ||
bodyContent={ | ||
<DescriptionList> | ||
<DescriptionListGroup> | ||
<DescriptionListTerm>Connection name</DescriptionListTerm> | ||
<DescriptionListDescription>{displayName}</DescriptionListDescription> | ||
</DescriptionListGroup> | ||
{description ? ( | ||
<DescriptionListGroup> | ||
<DescriptionListTerm>Connection description</DescriptionListTerm> | ||
<DescriptionListDescription>{description}</DescriptionListDescription> | ||
</DescriptionListGroup> | ||
) : undefined} | ||
<DescriptionListGroup> | ||
<DescriptionListTerm>Type</DescriptionListTerm> | ||
<DescriptionListDescription> | ||
{connectionType?.data?.category?.length ? ( | ||
<LabelGroup> | ||
{connectionType.data.category.map((category) => ( | ||
<CategoryLabel key={category} category={category} /> | ||
))} | ||
</LabelGroup> | ||
) : ( | ||
'-' | ||
)} | ||
</DescriptionListDescription> | ||
</DescriptionListGroup> | ||
</DescriptionList> | ||
} | ||
> | ||
<Button variant="link" isInline> | ||
View connection details | ||
</Button> | ||
</Popover> | ||
</HelperTextItem> | ||
</HelperText> | ||
); | ||
}; |
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.