CarnegieLearningWeb / UpGrade

Framework for adding A/B testing to education applications
https://www.upgradeplatform.org/
BSD 3-Clause "New" or "Revised" License
26 stars 13 forks source link

FF: Import Modal File Validation Happy Path #1720

Closed danoswaltCL closed 1 week ago

danoswaltCL commented 2 months ago

On successful selection and parsing of a JSON file, the UI will send a request to validate the file to the backend. On successful 200 ok of that validation, the file-uploader component will disappear and be replaced by a table that contains values in the following states:

COMPATIBLE: Greyed out carat, name of segment, COMPATIBLE status. WARNING or INCOMPLETE will have an enabled carat and an expandable row to see detailed information.

TBD: The implementation of https://github.com/CarnegieLearningWeb/UpGrade/issues/1713 will give us the data type of the response.

  1. If all of the files are incompatible, the primary "Import" button should be disabled.
  2. If at least one file is 'warning' or 'compatible', the Import button should be enable.
  3. On click of 'Import', we should see the import button disabled to prevent double-click, and we should see a load spinner.

Latest design (allow uploading only one file):

Image

Image

Image

Image

ppratikcr7 commented 1 month ago

@danoswaltCL @bcb37 For backend:

the /validation api will expect the below format:

[{
  fileName: string;
  fileContent: string;
}]

This api will return the below format:

[{
  fileName: string;
  compatibilityType: FF_COMPATIBILITY_TYPE;
}]
enum FF_COMPATIBILITY_TYPE {
  COMPATIBLE = 'compatible',
  WARNING = 'warning',
  INCOMPATIBLE = 'incompatible',
}

Based on the returned filenames and their compatibilityType, we can show the required message in the modal

ppratikcr7 commented 1 month ago

@danoswaltCL @bcb37 Is this fine? I can start with the api development.

danoswaltCL commented 1 month ago

yes please, can you put those details in the validation endpoint story as well and take needs refined off? It's all yours.

fileContent just means a valid feature flag JSON string, right?

https://github.com/orgs/CarnegieLearningWeb/projects/1/views/12?pane=issue&itemId=69574460

ppratikcr7 commented 1 month ago

Yes right. fileContent means a valid feature flag JSON string. Ohh sorry searched for validation and could find only this ticket. Will add it there. Thanks for the link to the ticket.

danoswaltCL commented 1 month ago

all good, we need those details for this story too anyway

bcb37 commented 1 month ago

@ppratikcr7 The API is good as it is, with no message needed from the backend