Skip to content

Allow user to upload entity CSV with missing properties#1551

Open
matthew-white wants to merge 1 commit into
masterfrom
upload-missing-properties
Open

Allow user to upload entity CSV with missing properties#1551
matthew-white wants to merge 1 commit into
masterfrom
upload-missing-properties

Conversation

@matthew-white
Copy link
Copy Markdown
Member

Closes getodk/central#1787.

What has been done to verify that this works as intended?

New tests. I also tried it out locally.

Why is this the best possible solution? Were any other approaches considered?

The existing EntityUpload modal is pretty complicated, so I tried not to change too much of the existing code. Instead, I added a new ref to store the warning about missing properties (headerWarnings) and a new component to show the warning (EntityUploadHeaderReview). As I continue working on getodk/central#1784, some of this approach may change.

Before submitting this PR, please make sure you have:

  • run npm run test and npm run lint and confirmed all checks still pass OR confirm CircleCI build passes
  • verified that any code or assets from external sources are properly credited in comments or that everything is internally sourced

Copy link
Copy Markdown
Member Author

@matthew-white matthew-white left a comment

Choose a reason for hiding this comment

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

Notes from interactive code review

<entity-upload-data-error v-if="dataError != null"
:message="dataError"/>
</entity-upload-file-select>
<entity-upload-header-review v-if="headerWarnings != null && headerErrors == null"
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Suggested change
<entity-upload-header-review v-if="headerWarnings != null && headerErrors == null"
<entity-upload-header-review v-if="headerWarnings != null"

return obj;
};
const { i18n: globalI18n, redAlert } = inject('container');
const parseEntities = async (file, headerResults, signal) => {
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Instead of passing header warnings here as part of headerInfo, let's move all the setting that this function does into selectFile() below. This function could then just return the results of parsing the data. We wouldn't need to distinguish between headerResults and headerInfo.

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.

Allow user to import Entity CSV with missing properties in header

2 participants