Add activity for import protocol from protocols.io [SCI-12112]

This commit is contained in:
Anton 2025-08-08 13:51:44 +02:00
parent 8ceb099acf
commit 01fe789ad8
4 changed files with 20 additions and 4 deletions

View file

@ -65,7 +65,8 @@ class ExternalProtocolsController < ApplicationController
partial: 'protocol_importers/import_form',
locals: { protocol: @protocol,
steps_json: service_call.serialized_steps,
steps_assets: service_call.steps_assets }
steps_assets: service_call.steps_assets,
source: new_params[:protocol_source] }
),
title: t('protocol_importers.new.modal_title', protocol_name: @protocol.name),
footer: render_to_string(
@ -88,6 +89,17 @@ class ExternalProtocolsController < ApplicationController
)
if service_call.succeed?
if params[:source] == 'protocolsio/v3'
protocol = service_call.protocol
Activities::CreateActivityService
.call(activity_type: :import_protocol_in_repository_from_protocols_io,
owner: current_user,
subject: protocol,
team: protocol.team,
message_items: {
protocol: protocol.id
})
end
message = t('protocols.index.protocolsio.import.success_flash', name: service_call.protocol.name)
render json: { protocol: service_call.protocol, message: message }
else

View file

@ -35,7 +35,7 @@
<%= f.label :published_on_label,
t('protocols.import_export.import_modal.published_on_label'),
:"data-e2e" => "e2e-TX-protocolTemplates-previewProtocolsIo-publishedOnLabel" %>
<%= f.text_field :published_on_label,
<%= f.text_field :published_on_label,
value: I18n.l(protocol.published_on, format: :full),
class: 'form-control',
disabled: true,
@ -50,6 +50,7 @@
<%= f.hidden_field(:protocol_type, value: protocol.protocol_type) %>
<%= f.hidden_field(:visibility) %>
<%= f.hidden_field(:default_public_user_role_id) %>
<%= hidden_field_tag(:source, source) %>
<% end %>

View file

@ -622,7 +622,8 @@ class Extends
repository_access_revoked_user_group: 405,
automation_task_status_changed: 406,
automation_experiment_status_changed: 407,
automation_project_status_changed: 408
automation_project_status_changed: 408,
import_protocol_in_repository_from_protocols_io: 409
}
ACTIVITY_GROUPS = {
@ -640,7 +641,7 @@ class Extends
protocol_repository: [80, 103, 89, 87, 79, 90, 91, 88, 85, 86, 84, 81, 82,
83, 101, 112, 123, 125, 117, 119, 129, 131, 187, 186,
190, 191, *204..215, 220, 223, 227, 228, 229, *230..235,
*237..240, *253..256, *279..283, 300, 304, 307, 330, *353..355, 360, *387..389],
*237..240, *253..256, *279..283, 300, 304, 307, 330, *353..355, 360, *387..389, 409],
team: [92, 94, 93, 97, 104, 244, 245, *379..383],
label_templates: [*216..219],
storage_locations: [*309..315, 361],

View file

@ -424,6 +424,7 @@ en:
automation_task_status_changed_html: "%{user} triggered automatic status change from <strong>%{my_module_status_old}</strong> to <strong>%{my_module_status_new}</strong> for task %{my_module}."
automation_experiment_status_changed_html: "%{user} triggered automatic status change from <strong>%{experiment_status_old}</strong> to <strong>%{experiment_status_new}</strong> for experiment %{experiment}."
automation_project_status_changed_html: "%{user} triggered automatic status change from <strong>%{project_status_old}</strong> to <strong>%{project_status_new}</strong> for project %{project}."
import_protocol_in_repository_from_protocols_io_html: "%{user} imported protocol %{protocol} to Protocol repository from protocols.io."
activity_name:
create_project: "Project created"
edit_project: "Project edited"
@ -803,6 +804,7 @@ en:
automation_task_status_changed: "Task status changed automatically"
automation_experiment_status_changed: "Experiment status changed automatically"
automation_project_status_changed: "Project status changed automatically"
import_protocol_in_repository_from_protocols_io: "Protocol imported from protocols.io"
activity_group:
projects: "Projects"
task_results: "Task results"