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

Feature #710: View deleted Entities and restore Entities #1119

Merged

Conversation

sadiqkhoja
Copy link
Contributor

@sadiqkhoja sadiqkhoja commented Dec 31, 2024

Closes getodk/central#710

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

Added tests and verified manually.

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

Followed the existing code pattern.

How does this change affect users? Describe intentional changes to behavior and behavior that could have accidentally been affected by code changes. In other words, what are the regression risks?

None.

Does this change require updates to user documentation? If so, please file an issue here and include the link below.

Added in getodk/docs#1896

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

@sadiqkhoja sadiqkhoja force-pushed the features/710-delete-restore-entities branch from 747d373 to 4f18ade Compare December 31, 2024 22:39
@sadiqkhoja
Copy link
Contributor Author

Verify that duplicate UUID error is handled correctly in bulk Entities upload

@sadiqkhoja sadiqkhoja force-pushed the features/710-delete-restore-entities branch from 4f18ade to bbbcc71 Compare January 6, 2025 20:14
if (this.confirmDelete) {
this.uuidToDelete = entity.__id;
this.del.show({ label: entity.label });
this.deleteModal.show({ entity });
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Passing whole entity object to make it consistent with restore and Submissions deleted/restore

@sadiqkhoja sadiqkhoja force-pushed the features/710-delete-restore-entities branch from bbbcc71 to 2d3dd3b Compare January 8, 2025 19:29
@sadiqkhoja sadiqkhoja mentioned this pull request Jan 24, 2025
2 tasks
Copy link
Member

@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.

Looks great!

const props = defineProps({
state: Boolean,
checkbox: Boolean,
label: {
Copy link
Member

Choose a reason for hiding this comment

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

I think the label prop isn't used, since the label is grabbed off the entity prop.

"If the Entity is deleted again, it will be another 30 days before it is removed."
],
"field": {
"noConfirm": "Undelete immediately without confirmation until I leave the page"
Copy link
Member

Choose a reason for hiding this comment

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

I think this is the same as the message in SubmissionRestore. It'd be good to avoid retranslating it:

// @transifexKey component.SubmissionRestore.field.noConfirm

const { dataset } = useRequestData();
const odataEntities = useEntities();
const { dataset, deletedEntityCount } = useRequestData();
const { odataEntities } = useEntities();
Copy link
Member

Choose a reason for hiding this comment

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

If DatasetEntities is calling useEntities(), then I think EntityList shouldn't, because useEntities() will always create resources. It will create a new resource even if there is another local resource with the same name. Instead, odataEntities should be obtained from useRequestData().

If useEntities() is removed from this file, some tests may fail. If there are any tests that mount EntityList instead of DatasetEntities, those tests will need to pass useEntities to testRequestData().

<entity-download-button :odata-filter="odataFilter"/>
<entity-download-button :odata-filter="deleted ? null : odataFilter"
:aria-disabled="deleted"
v-tooltip.aria-describedby="deleted ? $t('downloadDisabled') : null"/>
Copy link
Member

Choose a reason for hiding this comment

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

How about adding a test that the download button is disabled?

@sadiqkhoja sadiqkhoja merged commit 6b5df8c into getodk:master Jan 30, 2025
1 check passed
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.

Add remaining functionality for entity deletion
2 participants