-
Notifications
You must be signed in to change notification settings - Fork 153
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
399 additions
and
99 deletions.
There are no files selected for viewing
72 changes: 72 additions & 0 deletions
72
frontend/src/concepts/connectionTypes/ConnectionTypeDetailsHelperText.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,72 @@ | ||
import React from 'react'; | ||
import { | ||
Button, | ||
DescriptionList, | ||
DescriptionListDescription, | ||
DescriptionListGroup, | ||
DescriptionListTerm, | ||
HelperText, | ||
HelperTextItem, | ||
LabelGroup, | ||
Popover, | ||
} from '@patternfly/react-core'; | ||
import { getDescriptionFromK8sResource } from '~/concepts/k8s/utils'; | ||
import { ConnectionTypeConfigMapObj } from './types'; | ||
import UnspecifiedValue from './fields/UnspecifiedValue'; | ||
import CategoryLabel from './CategoryLabel'; | ||
|
||
type Props = { | ||
connectionType?: ConnectionTypeConfigMapObj; | ||
}; | ||
|
||
export const ConnectionTypeDetailsHelperText: React.FC<Props> = ({ connectionType }) => { | ||
const displayName = | ||
connectionType && connectionType.metadata.annotations?.['openshift.io/display-name']; | ||
const description = connectionType && getDescriptionFromK8sResource(connectionType); | ||
|
||
return ( | ||
<HelperText> | ||
<HelperTextItem> | ||
<Popover | ||
headerContent="Connection type details" | ||
bodyContent={ | ||
<DescriptionList> | ||
<DescriptionListGroup> | ||
<DescriptionListTerm>Connection type name</DescriptionListTerm> | ||
<DescriptionListDescription> | ||
{displayName || <UnspecifiedValue />} | ||
</DescriptionListDescription> | ||
</DescriptionListGroup> | ||
{description ? ( | ||
<DescriptionListGroup> | ||
<DescriptionListTerm>Connection type description</DescriptionListTerm> | ||
<DescriptionListDescription> | ||
{description || <UnspecifiedValue />} | ||
</DescriptionListDescription> | ||
</DescriptionListGroup> | ||
) : undefined} | ||
<DescriptionListGroup> | ||
<DescriptionListTerm>Category</DescriptionListTerm> | ||
<DescriptionListDescription> | ||
{connectionType?.data?.category?.length ? ( | ||
<LabelGroup> | ||
{connectionType.data.category.map((category) => ( | ||
<CategoryLabel key={category} category={category} /> | ||
))} | ||
</LabelGroup> | ||
) : ( | ||
<UnspecifiedValue /> | ||
)} | ||
</DescriptionListDescription> | ||
</DescriptionListGroup> | ||
</DescriptionList> | ||
} | ||
> | ||
<Button variant="link" isInline> | ||
View connection type details | ||
</Button> | ||
</Popover> | ||
</HelperTextItem> | ||
</HelperText> | ||
); | ||
}; |
205 changes: 111 additions & 94 deletions
205
frontend/src/concepts/connectionTypes/ConnectionTypePreview.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
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
Oops, something went wrong.