Skip to content

Commit

Permalink
Fix services are not deselected on template removal in sample add form (
Browse files Browse the repository at this point in the history
#2675)

* Fix services are not deselected on sample template removal in sample add form

* Changelog

* Remove unnecessary re-declaration
  • Loading branch information
xispa authored Feb 13, 2025
1 parent 8a8be50 commit 4d7c1b4
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Changelog
2.6.0 (unreleased)
------------------

- #2675 Fix services are not deselected on template removal in sample add form
- #2673 Trigger recalculation of dependants if uncertainty changes
- #2674 Fix partitions not displayed correctly in batch samples listing
- #2672 Fix rejected sample analyses are re-added on profile removal
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -1471,13 +1471,38 @@ class window.AnalysisRequestAdd
on_analysis_template_removed: (event) =>
console.debug "°°° on_analysis_template_removed °°°"

me = this
el = event.currentTarget
$el = $(el)
arnum = $el.closest("[arnum]").attr "arnum"

# Get the template UID that has been deselected
template_uid = event.detail.value

record = @records_snapshot[arnum]
metadata = record.template_metadata[template_uid]
services = []

context = {}
context["template"] = metadata
context["services"] = services

# get the list of services assigned to the template
$.each record.template_to_services[template_uid], (index, uid) ->
services.push record.service_metadata[uid]

@applied_templates[arnum] = null

# trigger form:changed event
$(this).trigger "form:changed"
dialog = @template_dialog "template-remove-template", context
dialog.on "yes", ->
# deselect the services
$.each services, (index, service) ->
me.set_service arnum, service.uid, no
# trigger form:changed event
$(me).trigger "form:changed"
dialog.on "no", ->
# trigger form:changed event
$(me).trigger "form:changed"


###*
Expand Down

0 comments on commit 4d7c1b4

Please sign in to comment.