Fix: FE: pipelines: should be able to exit edit mode without making a change (#4335)

* fix: show cancel button on entering edit mode before any changes have been made

* chore: align pipeline page save/cancel buttons to the right
This commit is contained in:
Raj Kamal Singh 2024-01-10 11:26:25 +05:30 committed by GitHub
parent 722a38491e
commit d65d75ef69
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 9 deletions

View File

@ -506,8 +506,9 @@ function PipelineListsView({
pagination={false} pagination={false}
/> />
</DndProvider> </DndProvider>
{showSaveButton && ( {isEditingActionMode && (
<SaveConfigButton <SaveConfigButton
showSaveButton={Boolean(showSaveButton)}
onSaveConfigurationHandler={onSaveConfigurationHandler} onSaveConfigurationHandler={onSaveConfigurationHandler}
onCancelConfigurationHandler={onCancelConfigurationHandler} onCancelConfigurationHandler={onCancelConfigurationHandler}
/> />

View File

@ -4,6 +4,7 @@ import { useTranslation } from 'react-i18next';
import { SaveConfigWrapper } from './styles'; import { SaveConfigWrapper } from './styles';
function SaveConfigButton({ function SaveConfigButton({
showSaveButton,
onSaveConfigurationHandler, onSaveConfigurationHandler,
onCancelConfigurationHandler, onCancelConfigurationHandler,
}: SaveConfigButtonTypes): JSX.Element { }: SaveConfigButtonTypes): JSX.Element {
@ -11,6 +12,7 @@ function SaveConfigButton({
return ( return (
<SaveConfigWrapper> <SaveConfigWrapper>
{showSaveButton && (
<Button <Button
key="submit" key="submit"
type="primary" type="primary"
@ -19,6 +21,7 @@ function SaveConfigButton({
> >
{t('save_configuration')} {t('save_configuration')}
</Button> </Button>
)}
<Button key="cancel" onClick={onCancelConfigurationHandler}> <Button key="cancel" onClick={onCancelConfigurationHandler}>
{t('cancel')} {t('cancel')}
</Button> </Button>
@ -26,6 +29,7 @@ function SaveConfigButton({
); );
} }
export interface SaveConfigButtonTypes { export interface SaveConfigButtonTypes {
showSaveButton: boolean;
onSaveConfigurationHandler: VoidFunction; onSaveConfigurationHandler: VoidFunction;
onCancelConfigurationHandler: VoidFunction; onCancelConfigurationHandler: VoidFunction;
} }

View File

@ -108,6 +108,7 @@ export const ModeAndConfigWrapper = styled.div`
export const SaveConfigWrapper = styled.div` export const SaveConfigWrapper = styled.div`
display: flex; display: flex;
justify-content: flex-end;
gap: 0.938rem; gap: 0.938rem;
margin-top: 1.25rem; margin-top: 1.25rem;
`; `;