Fix protocol dropdown options for the locked tasks and archived protocol template [SCI-8277] (#5264)

This commit is contained in:
ajugo 2023-04-06 16:29:19 +02:00 committed by GitHub
parent 890687052b
commit 4961243731
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 4 deletions

View file

@ -18,12 +18,11 @@
class="dropdown-menu dropdown-menu-right"
aria-labelledby="dropdownProtocolOptions"
>
<li>
<li v-if="protocol.attributes.urls.load_from_repo_url">
<a
ref="loadProtocol"
data-action="load-from-repository"
@click="loadProtocol"
:class="{ disabled: !protocol.attributes.urls.load_from_repo_url }"
>
<span class="fas fa-edit"></span>
<span>{{ i18n.t("my_modules.protocol.options_dropdown.load_from_repo") }}</span>

View file

@ -168,13 +168,15 @@ class ProtocolSerializer < ActiveModel::Serializer
end
def revert_protocol_url
return unless can_read_protocol_in_module?(object) && object.linked? && object.newer_than_parent?
return unless can_manage_protocol_in_module?(object) && object.linked? &&
object.parent.active? && object.newer_than_parent?
revert_modal_protocol_path(object, format: :json)
end
def update_protocol_url
return unless can_read_protocol_in_module?(object) && object.linked? && object.parent_newer?
return unless can_manage_protocol_in_module?(object) && object.linked? &&
object.parent.active? && object.parent_newer?
update_from_parent_modal_protocol_path(object, format: :json)
end