grid icon indicating copy to clipboard operation
grid copied to clipboard

IMAGEDAM-1665: Generic React modal dialog and send to Photosales functionality

Open Conalb97 opened this issue 10 months ago • 2 comments

What does this change?

Note, this PR builds on changes introduced in IMAGEDAM-1502 and so will replace that PR.

This PR introduces two new functionalities:

  • The ability for a user to add a 'send to photosales' syndication usage to an image, via the 'Send to Photosales button'
  • A generic React modal component, used in this case as a confirmation dialog

As an archivist user of BBC Images, I want to be able to send certain images from BBC Images to BBC Photo Sales, through the Grid UI. This PR introduces this functionality, allowing a user to select a number of images and trigger the outbound photo sales process by clicking on the new 'Send to Photo Sales' button.

Upon doing this the confirmation dialog will pop up, asking the user to confirm their choice. The dialog will have different text and button options depending on if the images selected already exist in photosales or not. Once the user has confirmed their intention to send the image, a syndication usage (with a 'pending' usage status) is added to each of the selected image, which is the trigger for an AWS step function that carries out the majority of the outbound logic.

The Photosales functionality is BBC specific, hence it is disabled by default via the showSendToPhotoSales feature flag.

image

How should a reviewer test this change?

As a user with elevated permissions and with the showSendToPhotoSales flag set to true:

No selected images already exist in Photosales

  • Select a number of image thumbnails from the main grid view, ensure none of these images have already been sent to Photosales
  • Click the 'Send to Photo Sales Button' from the menu that appears
  • A confirmation dialog will pop up
  • Click 'Yes, send'

The selected images contain a mixture of images that have and have not been sent to Photosales

  • Select a number of image thumbnails from the main grid view, ensure that some of these images have already been sent to Photosales and some have not been sent
  • Click the 'Send to Photo Sales Button' from the menu that appears
  • A confirmation dialog will pop up
  • Click 'Yes, send'

All the selected images have already been sent to Photosales

  • Select a number of image thumbnails from the main grid view, ensure that all of these images ahve already been sent to Photosales
  • Click the 'Send to Photo Sales Button' from the menu that appears
  • A confirmation dialog, with one button will pop up
  • Click 'Okay'

How can success be measured?

No selected images already exist in Photosales

  • Confirm that a Pending Publication usage is visible in the usages section of the metadata panel, for the selected images
  • Confirm that the confirmation dialog has the following appearance: Screenshot 2024-05-02 at 10 43 41

The selected images contain a mixture of images that have and have not been sent to Photosales

  • Confirm that a Pending Publication usage is visible in the usages section of the metadata panel, for those selected images that had not already been sent to Photosales
  • Confirm that the confirmation dialog has the following appearance: Screenshot 2024-05-02 at 10 43 24

All the selected images have already been sent to Photosales

  • Confirm that the confirmation dialog has the following appearance: Screenshot 2024-05-02 at 10 42 52

Who should look at this?

@guardian/digital-cms

Tested? Documented?

  • [x] locally by committer
  • [ ] locally by Guardian reviewer
  • [ ] on the Guardian's TEST environment
  • [ ] relevant documentation added or amended (if needed)

Conalb97 avatar May 02 '24 09:05 Conalb97

Hi, just trying to test this in our test environment, think we've got the right configuration (the showSendToPhotoSales is set to true and I can see it in the browser), but when trying to press the button with two newly uploaded photos selected, nothing seems to happen, I can see the following error in my browser console which refers to this line in result.js image The logic seems right to me though... have you seen this too?

Georges-GNM avatar May 13 '24 14:05 Georges-GNM

Hi, just trying to test this in our test environment, think we've got the right configuration (the showSendToPhotoSales is set to true and I can see it in the browser), but when trying to press the button with two newly uploaded photos selected, nothing seems to happen, I can see the following error in my browser console which refers to this line in result.js image The logic seems right to me though... have you seen this too?

Thanks for pointing this out!

The brackets around validImages in sendToPhotosales was incorrect - by selecting [0] we've already resolved the array.

Removing these brackets addresses this issue. This fix has been pushed in the latest commit.

Conalb97 avatar May 14 '24 09:05 Conalb97

Seen on auth, usage, image-loader, metadata-editor, cropper, collections, kahuna (created by @Conalb97 and merged by @paperboyo 8 minutes and 39 seconds ago) Please check your changes!

prout-bot avatar Jun 05 '24 13:06 prout-bot

Seen on thrall (created by @Conalb97 and merged by @paperboyo 8 minutes and 44 seconds ago) Please check your changes!

prout-bot avatar Jun 05 '24 13:06 prout-bot

Seen on media-api (created by @Conalb97 and merged by @paperboyo 8 minutes and 48 seconds ago) Please check your changes!

prout-bot avatar Jun 05 '24 13:06 prout-bot

Seen on leases (created by @Conalb97 and merged by @paperboyo 8 minutes and 59 seconds ago) Please check your changes!

prout-bot avatar Jun 05 '24 13:06 prout-bot