This repository has been archived by the owner on Nov 28, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
NNS topology #108
Merged
Merged
NNS topology #108
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -73,7 +73,8 @@ jobs: | |
uses: cypress-io/[email protected] | ||
with: | ||
start: yarn serve-build, yarn start-console | ||
wait-on: "http://localhost:9001" | ||
wait-on: 'http://localhost:9001' | ||
wait-on-timeout: 120 | ||
browser: chrome | ||
headed: false | ||
|
||
|
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,17 @@ | ||
.description-item__title { | ||
justify-content: space-between; | ||
flex: 1; | ||
} | ||
|
||
.margin-top { | ||
margin-top: var(--pf-v5-global--spacer--md); | ||
} | ||
|
||
.DescriptionItemHeader { | ||
&--list-term { | ||
.pf-c-description-list__text { | ||
align-items: center; | ||
display: inline-flex; | ||
} | ||
} | ||
} |
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,117 @@ | ||
import React, { FC, ReactNode } from 'react'; | ||
import classnames from 'classnames'; | ||
|
||
import { | ||
Button, | ||
ButtonVariant, | ||
DescriptionListDescription, | ||
DescriptionListGroup, | ||
DescriptionListTermHelpText, | ||
Flex, | ||
FlexItem, | ||
} from '@patternfly/react-core'; | ||
import { PencilAltIcon } from '@patternfly/react-icons'; | ||
import { useNMStateTranslation } from '@utils/hooks/useNMStateTranslation'; | ||
|
||
import { DetailItemHeader } from './DetailItemHeader'; | ||
import EditButtonWithTooltip from './EditButtonWithTooltip'; | ||
|
||
import './DetailItem.scss'; | ||
|
||
type DetailItemProps = { | ||
popoverBodyContent?: ReactNode; | ||
breadcrumb?: string; | ||
className?: string; | ||
testId?: string; | ||
description: ReactNode | string; | ||
header?: ReactNode; | ||
editOnTitleJustify?: boolean; | ||
isDisabled?: boolean; | ||
isEdit?: boolean; | ||
isPopover?: boolean; | ||
headerBadge?: ReactNode; | ||
messageOnDisabled?: string; | ||
moreInfoURL?: string; | ||
onEditClick?: () => void; | ||
showEditOnTitle?: boolean; | ||
}; | ||
|
||
const DetailItem: FC<DetailItemProps> = ({ | ||
popoverBodyContent, | ||
breadcrumb, | ||
className, | ||
testId, | ||
description, | ||
header, | ||
editOnTitleJustify = false, | ||
isDisabled, | ||
isEdit, | ||
isPopover, | ||
headerBadge, | ||
messageOnDisabled, | ||
moreInfoURL, | ||
onEditClick, | ||
showEditOnTitle, | ||
}) => { | ||
const { t } = useNMStateTranslation(); | ||
const NotAvailable = <span className="text-muted">{t('Not available')}</span>; | ||
|
||
return ( | ||
<DescriptionListGroup className={classnames('pf-c-description-list__group', className)}> | ||
<DescriptionListTermHelpText className="pf-c-description-list__term"> | ||
<Flex | ||
justifyContent={{ | ||
default: editOnTitleJustify ? 'justifyContentSpaceBetween' : 'justifyContentFlexStart', | ||
}} | ||
> | ||
{(popoverBodyContent || breadcrumb || header || headerBadge || moreInfoURL) && ( | ||
<FlexItem> | ||
<DetailItemHeader | ||
bodyContent={popoverBodyContent} | ||
breadcrumb={breadcrumb} | ||
descriptionHeader={header} | ||
isPopover={isPopover} | ||
label={headerBadge} | ||
moreInfoURL={moreInfoURL} | ||
/> | ||
</FlexItem> | ||
)} | ||
{isEdit && showEditOnTitle && ( | ||
<FlexItem> | ||
<Button | ||
data-test-id={`${testId}-edit`} | ||
isDisabled={isDisabled} | ||
isInline | ||
onClick={onEditClick} | ||
variant={ButtonVariant.link} | ||
> | ||
{t('Edit')} | ||
<PencilAltIcon className="co-icon-space-l pf-v5-c-button-icon--plain" /> | ||
</Button> | ||
</FlexItem> | ||
)} | ||
</Flex> | ||
</DescriptionListTermHelpText> | ||
|
||
<DescriptionListDescription | ||
className="pf-c-description-list__description" | ||
data-test-id={testId} | ||
> | ||
{isEdit && !showEditOnTitle ? ( | ||
<EditButtonWithTooltip | ||
isEditable={!isDisabled} | ||
onEditClick={onEditClick} | ||
testId={testId} | ||
tooltipContent={messageOnDisabled} | ||
> | ||
{description ?? NotAvailable} | ||
</EditButtonWithTooltip> | ||
) : ( | ||
description | ||
)} | ||
</DescriptionListDescription> | ||
</DescriptionListGroup> | ||
); | ||
}; | ||
|
||
export default DetailItem; |
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,74 @@ | ||
import React, { FC, ReactNode } from 'react'; | ||
|
||
import { | ||
Breadcrumb, | ||
BreadcrumbItem, | ||
DescriptionListTerm, | ||
DescriptionListTermHelpTextButton, | ||
Popover, | ||
} from '@patternfly/react-core'; | ||
import { useNMStateTranslation } from '@utils/hooks/useNMStateTranslation'; | ||
|
||
import './DetailItem.scss'; | ||
|
||
type DetailItemHeaderProps = { | ||
bodyContent: ReactNode; | ||
breadcrumb?: string; | ||
descriptionHeader: ReactNode; | ||
isPopover: boolean; | ||
label?: ReactNode; | ||
maxWidth?: string; | ||
moreInfoURL?: string; | ||
}; | ||
|
||
export const DetailItemHeader: FC<DetailItemHeaderProps> = ({ | ||
bodyContent, | ||
breadcrumb, | ||
descriptionHeader, | ||
isPopover, | ||
label, | ||
maxWidth, | ||
moreInfoURL, | ||
}) => { | ||
const { t } = useNMStateTranslation(); | ||
|
||
if (isPopover && bodyContent) { | ||
return ( | ||
<Popover | ||
bodyContent={ | ||
<> | ||
{bodyContent} | ||
{moreInfoURL && ( | ||
<> | ||
{t('More info: ')} | ||
<a href={moreInfoURL}>{moreInfoURL}</a> | ||
</> | ||
)} | ||
{breadcrumb && ( | ||
<div className="margin-top"> | ||
<Breadcrumb> | ||
{breadcrumb.split('.').map((item) => ( | ||
<BreadcrumbItem key={item}>{item}</BreadcrumbItem> | ||
))} | ||
</Breadcrumb> | ||
</div> | ||
)} | ||
</> | ||
} | ||
hasAutoWidth | ||
headerContent={descriptionHeader} | ||
maxWidth={maxWidth || '30rem'} | ||
> | ||
<DescriptionListTermHelpTextButton className="pf-c-description-list__text"> | ||
{descriptionHeader} | ||
</DescriptionListTermHelpTextButton> | ||
</Popover> | ||
); | ||
} | ||
|
||
return ( | ||
<DescriptionListTerm className="DescriptionItemHeader--list-term"> | ||
{descriptionHeader} {label} | ||
</DescriptionListTerm> | ||
); | ||
}; |
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,30 @@ | ||
import React, { FC, PropsWithChildren, SyntheticEvent } from 'react'; | ||
|
||
import { Button, ButtonVariant, Flex } from '@patternfly/react-core'; | ||
import { PencilAltIcon } from '@patternfly/react-icons'; | ||
|
||
type EditButtonProps = PropsWithChildren<{ | ||
isEditable: boolean; | ||
onEditClick?: () => void; | ||
testId: string; | ||
}>; | ||
|
||
const EditButton: FC<EditButtonProps> = ({ children, onEditClick, isEditable, testId }) => ( | ||
<Button | ||
onClick={(e: SyntheticEvent<HTMLButtonElement>) => { | ||
e.stopPropagation(); | ||
onEditClick?.(); | ||
}} | ||
data-test-id={testId} | ||
isDisabled={!isEditable} | ||
isInline | ||
variant={ButtonVariant.link} | ||
> | ||
<Flex> | ||
{children} | ||
<PencilAltIcon className="co-icon-space-l" /> | ||
</Flex> | ||
</Button> | ||
); | ||
|
||
export default EditButton; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why making such a genric component? cant split for 2 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also copied from kubevirt