Skip to content

Commit

Permalink
Fix services are not deselected on sample template removal in sample …
Browse files Browse the repository at this point in the history
…add form
  • Loading branch information
xispa committed Feb 13, 2025
1 parent 8a8be50 commit c9a7fec
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 5 deletions.

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,39 @@ 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"
me = this
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 c9a7fec

Please sign in to comment.