Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(dashboard): delete step editor functionality #6860

Merged
merged 4 commits into from
Nov 5, 2024

Conversation

ChmaraX
Copy link
Contributor

@ChmaraX ChmaraX commented Nov 5, 2024

What changed? Why was the change needed?

  • adds ability to delete a step + confirmation modal
delete_step_1.mp4

Copy link

linear bot commented Nov 5, 2024


const onDeleteStep = () => {
deleteStep(stepSlug);
navigate(buildRoute(ROUTES.EDIT_WORKFLOW, { environmentSlug: currentEnvironment?.slug ?? '', workflowSlug }));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Focus back to workflow after opened step is deleted, otherwise the sidebar with deleted step will remain opened with undefined data.

stepName: string;
};

export const DeleteStepModal = ({ open, onOpenChange, onConfirm, stepName }: DeleteStepModalProps) => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll create a generic confirmation-modal in separate PR, since we use this same modal also for promotion and probably it will be used in other places.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines 32 to 39
const checkStepsDeleted = useCallback(() => {
const currentStepsLength = watchedData.steps?.length ?? 0;
const wasDeleted = previousStepsLength.current !== null && currentStepsLength < previousStepsLength.current;

previousStepsLength.current = currentStepsLength;

return wasDeleted;
}, [watchedData]);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Logic to determine if step was deleted in order to not use debounced save.

If we used debounced save for deletion, user could potentially refresh in the 500ms time window and the step wouldn't be deleted, although I'm not sure if its worth the additional logic.

Copy link

netlify bot commented Nov 5, 2024

Deploy Preview for novu-stg-vite-dashboard-poc ready!

Name Link
🔨 Latest commit 6e45327
🔍 Latest deploy log https://app.netlify.com/sites/novu-stg-vite-dashboard-poc/deploys/672a0e22a84e260008be6408
😎 Deploy Preview https://deploy-preview-6860--novu-stg-vite-dashboard-poc.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@ChmaraX ChmaraX merged commit 4a5e6b7 into next Nov 5, 2024
37 checks passed
@ChmaraX ChmaraX deleted the nv-4512-configure-step-delete-functionality branch November 5, 2024 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants