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}
/>
</DndProvider>
{showSaveButton && (
{isEditingActionMode && (
<SaveConfigButton
showSaveButton={Boolean(showSaveButton)}
onSaveConfigurationHandler={onSaveConfigurationHandler}
onCancelConfigurationHandler={onCancelConfigurationHandler}
/>

View File

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

View File

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