Skip to content

Commit

Permalink
[NCL-8452] Consolidate action buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
jomrazek committed Apr 23, 2024
1 parent f5ad600 commit 2ceb437
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
import { Button } from '@patternfly/react-core';
import { Button, ButtonProps } from '@patternfly/react-core';

import { ButtonTitles } from 'common/constants';

import { IArtifactEditQualityModalProps } from 'components/ArtifactEditQualityModal/ArtifactEditQualityModal';
import { ProtectedComponent } from 'components/ProtectedContent/ProtectedComponent';
import { TooltipWrapper } from 'components/TooltipWrapper/TooltipWrapper';

type IArtifactEditQualityModalButtonProps = {
toggleModal: () => void;
variant: IArtifactEditQualityModalProps['variant'];
variant?: ButtonProps['variant'];
} & ({ isBuildVariant?: false } | { isBuildVariant: true; buildArtifactsCount: number | undefined });

export const ArtifactEditQualityModalButton = ({
toggleModal,
variant,
variant = 'secondary',
isBuildVariant,
...props
}: IArtifactEditQualityModalButtonProps) => {
Expand All @@ -24,8 +23,8 @@ export const ArtifactEditQualityModalButton = ({
return (
<ProtectedComponent>
<TooltipWrapper tooltip={disabledButtonReason}>
<Button variant={variant === 'list' ? 'secondary' : 'tertiary'} onClick={toggleModal} isSmall isAriaDisabled={isDisabled}>
{ButtonTitles.edit} Quality
<Button variant={variant} onClick={toggleModal} isSmall isAriaDisabled={isDisabled}>
{ButtonTitles.update} quality
</Button>
</TooltipWrapper>
</ProtectedComponent>
Expand Down
2 changes: 1 addition & 1 deletion src/components/ArtifactPages/ArtifactPages.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export const ArtifactPages = () => {
<PageLayout
title={serviceContainerArtifact.data?.identifier}
breadcrumbs={[{ entity: breadcrumbData.artifact.id, title: serviceContainerArtifact.data?.identifier }]}
actions={<ArtifactEditQualityModalButton toggleModal={toggleEditQualityModal} variant="detail" />}
actions={<ArtifactEditQualityModalButton toggleModal={toggleEditQualityModal} />}
tabs={pageTabs}
>
<Outlet context={{ serviceContainerArtifact }} />
Expand Down
2 changes: 1 addition & 1 deletion src/components/BrewPushModal/BrewPushModalButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const BrewPushModalButton = ({ toggleModal, build }: IBrewPushModalButton
return (
<ProtectedComponent>
<TooltipWrapper tooltip={disabledButtonReason}>
<Button variant="tertiary" onClick={toggleModal} isAriaDisabled={!!disabledButtonReason} isBlock isSmall>
<Button variant="primary" onClick={toggleModal} isAriaDisabled={!!disabledButtonReason} isBlock isSmall>
Push to Brew
</Button>
</TooltipWrapper>
Expand Down
1 change: 0 additions & 1 deletion src/components/BuildArtifactsPage/BuildArtifactsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ export const BuildArtifactsPage = ({ componentId = 'a1' }: IBuildArtifactsPagePr
<ToolbarItem>
<ArtifactEditQualityModalButton
toggleModal={toggleEditQualitiesModal}
variant="detail"
isBuildVariant
buildArtifactsCount={serviceContainerArtifacts.data?.content?.length}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ interface IBuildConfigRestoreModalButtonProps {

export const BuildConfigRestoreModalButton = ({ toggleModal }: IBuildConfigRestoreModalButtonProps) => (
<ProtectedComponent>
<Button variant="tertiary" onClick={toggleModal} isSmall>
<Button variant="primary" onClick={toggleModal} isSmall>
Restore
</Button>
</ProtectedComponent>
Expand Down
2 changes: 1 addition & 1 deletion src/components/CancelBuildModal/CancelBuildModalButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const CancelBuildModalButton = ({ toggleModal, build, variant }: ICancelB
return (
<ProtectedComponent>
<TooltipWrapper tooltip={disabledButtonReason}>
<Button variant="tertiary" onClick={toggleModal} isAriaDisabled={!!disabledButtonReason} isBlock isSmall>
<Button variant="primary" onClick={toggleModal} isAriaDisabled={!!disabledButtonReason} isBlock isSmall>
Abort
</Button>
</TooltipWrapper>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,9 @@ export const GroupConfigDetailPage = ({
<BuildStartButton groupConfig={serviceContainerGroupConfig.data!} />
</ProtectedComponent>,
<ProtectedComponent key="edit-group-config-button">
<ActionButton link="edit">Edit Group Config</ActionButton>
<ActionButton variant="tertiary" link="edit">
Edit Group Config
</ActionButton>
</ProtectedComponent>,
]}
sidebar={{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export const ProductMilestoneMarkModalButton = ({
variant === 'list' && !isDisabled && 'black-color',
variant === 'list' && isDisabled && 'disabled-color',
variant === 'list' && 'dropdown-item-font-size',
'dropdown-item-font-size',
'text-align-left'
)}
isBlock
Expand Down

0 comments on commit 2ceb437

Please sign in to comment.