-
Notifications
You must be signed in to change notification settings - Fork 70
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
fix(DataModel): Enables the deletion of a child node from a definition that is currently in use #12235
fix(DataModel): Enables the deletion of a child node from a definition that is currently in use #12235
Conversation
.../packages/schema-editor/src/components/SchemaTree/SchemaNode/ActionButtons/ActionButtons.tsx
Fixed
Show fixed
Hide fixed
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #12235 +/- ##
=======================================
Coverage 86.41% 86.41%
=======================================
Files 1188 1188
Lines 18045 18045
Branches 2290 2290
=======================================
Hits 15594 15594
+ Misses 2164 2163 -1
- Partials 287 288 +1 ☔ View full report in Codecov by Sentry. |
…ps://github.com/Altinn/altinn-studio into fix/12201_NotPossibleToDeleteFieldFromTypeInUse
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.
Looks good 😄
A few comments added.
Co-authored-by: WilliamThorenfeldt <133344438+WilliamThorenfeldt@users.noreply.github.com>
@@ -432,9 +438,10 @@ export class SchemaModel { | |||
} | |||
|
|||
public deleteNode(pointer: string): SchemaModel { | |||
if (pointer === ROOT_POINTER) throw new Error('It is not possible to delete the root node.'); | |||
if (this.isDefinitionInUse(pointer)) |
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.
Hva skjer nå hvis man kaller deleteNode på en type som er i bruk? Kunne det vært bedre å bytte ut denne med hasReferringNodes i stedet for å fjerne den helt?
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.
Hva skjer nå hvis man kaller deleteNode på en type som er i bruk? Kunne det vært bedre å bytte ut denne med hasReferringNodes i stedet for å fjerne den helt?
Godt forslag. Jeg gjør et forsøk på det på mandag. Usikker på om det potensielt kan stoppe oss for å kunne slette noden på typen også?
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.
Det skal ikke være mulig. hasReferringNodes
sjekker kun elementet som det pekes på, mens isDefinitionInUse
er rekursiv nettopp fordi den også sjekker oppover i treet. Egentlig tror jeg ikke vi trenger isDefinitionInUse
i det hele tatt.
Description
It should be possible to delete fields in a definition that is already in use. It is crucial to notify the user that the specific field they are attempting to remove is in use in one or more instances, and that deleting it will result in the disappearance of this field from all associated locations. We displays the following confirm message to the user: "Feltet du vil slette tilhører en aktiv type og vil påvirke alle tilknyttede områder. Er du sikker på slettingen?"
Related Issue(s)
Verification
Documentation