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

ExportProject actions/reducer/state #812

Merged
merged 8 commits into from
Nov 16, 2020
Merged

Conversation

imnasnainaec
Copy link
Collaborator

@imnasnainaec imnasnainaec commented Nov 13, 2020

  • Implement redux actions, reducer, and state for ExportProject
  • Remove unnecessary layer in MergeDup reducer
  • Organize reducers and states
  • Split the frontend export project function into two parts: export to zip, download zip
    • At present, the export function is a placeholder and the download function does all the work
    • The functionality still needs to be split in the backend, and the frontend functions updated to match

This change is Reviewable

@johnthagen
Copy link
Collaborator


src/rootReducer.tsx, line 22 at r1 (raw file):

  localize: localizeReducer,

  //login

Super minor, but the convention I've seen most is to place one space after // before a comment if we want to try to stay consistent across all of our code bases.

@johnthagen
Copy link
Collaborator


src/backend/index.tsx, line 332 at r1 (raw file):

export async function exportLift(projectId?: string) {
  let projectIdToExport = projectId ? projectId : LocalStorage.getProjectId();
  // ToDo: Once the create and download functions are split in the backend,

Super minor, but I've usually seen it written TODO for what it's worth.

@johnthagen
Copy link
Collaborator


src/backend/index.tsx, line 331 at r1 (raw file):

// Tell the backend to create a LIFT file for the project
export async function exportLift(projectId?: string) {
  let projectIdToExport = projectId ? projectId : LocalStorage.getProjectId();

LocalStorage.getProjectId() returns "" if there is no project. Would it be more type safe if it returned undef so that we could check for if it exists? Not sure what would happen if you try to query for a blank project (probably a silent error to user)?

@johnthagen
Copy link
Collaborator


src/components/ProjectSettings/ProjectExport/ExportProjectActions.tsx, line 18 at r1 (raw file):

}

export function asyncExportProject(projectId?: string) {

These all take projectId?. What should happen if undef gets passed in here?

Is there anyway to ensure undef isn't passed in at a higher level and handled once to make the signatures on these functions tighter?

@johnthagen
Copy link
Collaborator


src/components/ProjectSettings/ProjectExport/ExportProjectReducer.tsx, line 10 at r1 (raw file):

export const defaultState: ExportProjectState = {
  projectId: "",

Another instance of a "" project ID. It's not clear to me what this means. Should it instead be projectId?: undef so we can handle missing ID via the type system?

Copy link
Collaborator

@johnthagen johnthagen left a comment

Choose a reason for hiding this comment

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

Reviewed 19 of 19 files at r1.
Reviewable status: all files reviewed, 5 unresolved discussions (waiting on @imnasnainaec)

Copy link
Collaborator Author

@imnasnainaec imnasnainaec left a comment

Choose a reason for hiding this comment

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

Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @johnthagen)


src/rootReducer.tsx, line 22 at r1 (raw file):

Previously, johnthagen wrote…

Super minor, but the convention I've seen most is to place one space after // before a comment if we want to try to stay consistent across all of our code bases.

I matched the dominant format within the file. Could more global consistency be another pr?


src/backend/index.tsx, line 331 at r1 (raw file):

Previously, johnthagen wrote…

LocalStorage.getProjectId() returns "" if there is no project. Would it be more type safe if it returned undef so that we could check for if it exists? Not sure what would happen if you try to query for a blank project (probably a silent error to user)?

That would probably be be better. A later pr perhaps, since there's already so much in this one?


src/backend/index.tsx, line 332 at r1 (raw file):

Previously, johnthagen wrote…

Super minor, but I've usually seen it written TODO for what it's worth.

I've usually seen it that way too, but having Spanish-speaking collaborators in the past, I started using ToDo to minimize confusion ("todo" is Spanish for "everything").


src/components/ProjectSettings/ProjectExport/ExportProjectActions.tsx, line 18 at r1 (raw file):

Previously, johnthagen wrote…

These all take projectId?. What should happen if undef gets passed in here?

Is there anyway to ensure undef isn't passed in at a higher level and handled once to make the signatures on these functions tighter?

It's okay for that function to receive an undefined or "", because the function it calls checks the local storage for the current project if no project id is supplied (intentional decision).


src/components/ProjectSettings/ProjectExport/ExportProjectReducer.tsx, line 10 at r1 (raw file):

Previously, johnthagen wrote…

Another instance of a "" project ID. It's not clear to me what this means. Should it instead be projectId?: undef so we can handle missing ID via the type system?

That would perhaps be the best thing long term, to do along-side your first request (re. local storage).

@johnthagen
Copy link
Collaborator


src/rootReducer.tsx, line 22 at r1 (raw file):

Previously, imnasnainaec (D. Ror.) wrote…

I matched the dominant format within the file. Could more global consistency be another pr?

Sure thing.

@johnthagen
Copy link
Collaborator


src/backend/index.tsx, line 331 at r1 (raw file):

Previously, imnasnainaec (D. Ror.) wrote…

That would probably be be better. A later pr perhaps, since there's already so much in this one?

Sure thing.

@johnthagen
Copy link
Collaborator

I didn't find any issues with this PR, but would feel more comfortable if @jasonleenaylor reviewed and gave final approval due to the number of changes and me being relatively less familiar with the overall frontend design.

Copy link
Contributor

@jasonleenaylor jasonleenaylor left a comment

Choose a reason for hiding this comment

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

Reviewed 15 of 19 files at r1, 3 of 3 files at r2.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved

@jasonleenaylor jasonleenaylor dismissed johnthagen’s stale review November 16, 2020 16:58

Removing the block to merging, some consistency changes can come later.

@imnasnainaec imnasnainaec merged commit d1cd125 into master Nov 16, 2020
@imnasnainaec imnasnainaec deleted the projsettings-actions branch November 16, 2020 17:28
imnasnainaec added a commit that referenced this pull request Nov 18, 2020
Follow-up to #812
* Add dictionary (keyed by userId) to `LiftService` to hold completed exports for download
* Add associated methods `StoreExport`, `RetrieveExport`, and `DeleteExport`
* In `LiftController`, split off `DownloadLiftFile` from `ExportLiftFile`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants