Skip to content

Conversation

@kevinkim-ogp
Copy link
Contributor

Problem

There is no warning/prompt when user is deleting a connection.
Other delete actions on Apps/Pipes/Tiles have a warning/prompt when user is attempting to delete.

Closes PLU-361: warning-when-deleting-connections

Solution

Add warning/prompt modal when user is attempting to delete a connection.

Improvements:

  • Refactor Tiles to use MenuAlertDialog instead of inline AlertDialog
  • Add toast on Tile delete success

Before & After Screenshots

BEFORE:

  • No warning/modal, connection is deleted immediately.
Screen.Recording.2024-11-11.at.1.45.57.PM.mov
  • No notification on Tile delete success

AFTER:

  • Delete Connection
Screen.Recording.2024-11-11.at.1.47.42.PM.mov
  • Delete Tile
Screen.Recording.2024-11-11.at.2.44.37.PM.mov

Tests

  • Modal appears when user attempts to delete a connection.
  • Connection is deleted successfully upon confirmation on modal.
  • Able to delete Tiles
  • Able to duplicate Pipes
  • Able to delete Pipes

New scripts:

  • packages/frontend/src/components/MenuAlertDialog/index.tsx : generic MenuAlertDialog for reuse across delete actions (updated from plumber/packages/frontend/src/components/FlowRow/MenuAlertDialog.tsx)

@kevinkim-ogp kevinkim-ogp requested a review from a team as a code owner November 11, 2024 06:48
@linear
Copy link

linear bot commented Nov 11, 2024

Comment on lines 43 to 44
header: `Duplicate ${dialogHeader}`,
body: `You'll need to replace the data in every step and test each step in your duplicated ${dialogHeader?.toLowerCase()} before publishing it.`,
Copy link
Contributor

Choose a reason for hiding this comment

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

actually the description will be quite unique to duplicate pipe only right? maybe it should not need the dialog header variable here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

initially thought maybe parameterise in case there's a duplicate tile function in future, but agree we can change to var when we need next time

import { Button } from '@opengovsg/design-system-react'

export type AlertDialogType = 'delete' | 'duplicate'
export type AlertHeaderType = 'App' | 'Connection' | 'Pipe' | 'Tile'
Copy link
Contributor

Choose a reason for hiding this comment

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

just checking is app being used anywhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

you're right, this is not being used by App


function AppConnectionRow(props: AppConnectionRowProps): React.ReactElement {
const toast = useToast()
const [dialogType, setDialogType] = useState<AlertDialogType>('delete') // delete by default
Copy link
Contributor

Choose a reason for hiding this comment

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

i think you won't need this since there's only one delete action possible in this file right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good point, unlikely to have other actions any time soon, will remove

Copy link
Contributor

@m0nggh m0nggh left a comment

Choose a reason for hiding this comment

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

nice refactor, just have some nits but tested that functionality still works!

@datadog-opengovsg
Copy link

Datadog Report

Branch report: chore/connections-warning-on-delete
Commit report: 38e6d3f
Test service: plumber

✅ 0 Failed, 687 Passed, 0 Skipped, 1m 56.37s Total Time
🔻 Test Sessions change in coverage: 1 decreased (-0.04%)

🔻 Code Coverage Decreases vs Default Branch (1)

Copy link
Contributor

@m0nggh m0nggh left a comment

Choose a reason for hiding this comment

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

ok nice lgtm

@kevinkim-ogp kevinkim-ogp merged commit 25eeaae into develop-v2 Nov 19, 2024
3 checks passed
@kevinkim-ogp kevinkim-ogp deleted the chore/connections-warning-on-delete branch November 19, 2024 06:00
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