-
Notifications
You must be signed in to change notification settings - Fork 331
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
Added Admin Warnings For Deleting Conversions #1400
base: development
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks to @danielshid for working on this issue. Overall, it is fine. I have made some comments about details and style for you to consider. Given the cases are complex, this is not surprising. I did some testing and it works as desired (modulo the comments). I'll do a final check after the comments are addressed. Let me know if I can help in any way.
src/client/app/components/conversion/EditConversionModalComponent.tsx
Outdated
Show resolved
Hide resolved
src/client/app/components/conversion/EditConversionModalComponent.tsx
Outdated
Show resolved
Hide resolved
src/client/app/components/conversion/EditConversionModalComponent.tsx
Outdated
Show resolved
Hide resolved
if (count === 1) { | ||
msg += `Deleting this meter conversion will orphan ${unitDataById[state.destinationId].name}.\n`; | ||
} else { | ||
msg += 'Deleting this meter conversion will make the following meter(s) ungraphable:\n'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure the logic is what was desired. If there is only this conversion and there are meter(s) using the source unit then tell the admin about each meter and cancel the delete. If there are multiple conversions then tell the admin about each meter using the source unit and warn that the number of graphable units for the meter is reduced.
if (destCount === 1) { | ||
msg += `Deleting this unit conversion will orphan ${unitDataById[state.destinationId].name}.\n`; | ||
} | ||
if (state.bidirectional) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the description of the cases I gave you was confusing. What needs to be determined (including the check right above) is if there is only this conversion for the unit. To check this, the code needs to check if that unit is a source or if the conversion is bidirectional then it can be the destination (excluding the one being deleted). The idea is if it is the destination then it can could get to another unit if allowed which means it must be bidirectional. This check is looking at the bidirectional status of the one being deleted and not the other possibilities.
Description
I added warnings to inform admins of the impact their actions will have on meter units and possible graphing units when choosing to delete conversions.
Partially Addresses #905
Type of change
Checklist
Limitations
I was not able to cover cases for default graphic units and groups.