diff --git a/app/helpers/my_modules_helper.rb b/app/helpers/my_modules_helper.rb
index b2014275c..c457f7385 100644
--- a/app/helpers/my_modules_helper.rb
+++ b/app/helpers/my_modules_helper.rb
@@ -112,4 +112,65 @@ module MyModulesHelper
''
end
end
+
+ def extract_my_module_metadata(my_module)
+ [
+ team_data(my_module.team),
+ project_data(my_module.project),
+ experiment_data(my_module.experiment),
+ my_module_data(my_module)
+ ].each do |item|
+ item[:value] = "(A) #{item[:value]}" if item[:archived]
+ end
+ end
+
+ private
+
+ def team_data(team)
+ {
+ label: I18n.t('repositories.item_card.assigned.labels.team'),
+ value: team.name,
+ url: projects_path(team: team.id),
+ archived: false
+ }
+ end
+
+ def project_data(project)
+ {
+ label: I18n.t('repositories.item_card.assigned.labels.project'),
+ value: project.name,
+ url: project_path(project, view_mode: view_mode(project.archived?)),
+ archived: project.archived?
+ }
+ end
+
+ def experiment_data(experiment)
+ {
+ label: I18n.t('repositories.item_card.assigned.labels.experiment'),
+ value: experiment.name,
+ url: experiment_url(experiment),
+ archived: experiment.archived_branch?
+ }
+ end
+
+ def my_module_data(my_module)
+ {
+ label: I18n.t('repositories.item_card.assigned.labels.my_module'),
+ value: my_module.name,
+ url: protocols_my_module_path(my_module, view_mode: view_mode(my_module.archived_branch?)),
+ archived: my_module.archived_branch?
+ }
+ end
+
+ def view_mode(archived)
+ archived ? 'archived' : 'active'
+ end
+
+ def experiment_url(experiment)
+ if experiment.archived_branch?
+ module_archive_experiment_path(experiment)
+ else
+ my_modules_experiment_path(experiment)
+ end
+ end
end
diff --git a/app/javascript/vue/components/RepositoryItemSidebar.vue b/app/javascript/vue/components/RepositoryItemSidebar.vue
index d6c404ad0..3999245c3 100644
--- a/app/javascript/vue/components/RepositoryItemSidebar.vue
+++ b/app/javascript/vue/components/RepositoryItemSidebar.vue
@@ -60,14 +60,40 @@
-
-
-
Assigned (3)
-
- {{ this.assigned }}
+
+
+
+ {{ i18n.t('repositories.item_card.section.assigned', { count: assignedModules.total_assigned_count }) }}
+
+
+
+
+ {{ i18n.t('repositories.item_card.assigned.private', { count: assignedModules.private_count }) }}
+
+
+
+
+
+
+
+ {{ i18n.t('repositories.item_card.assigned.empty') }}
+
-
-
@@ -114,9 +140,9 @@
repositoryName: null,
defaultColumns: null,
customColumns: null,
+ assignedModules: null,
isShowing: false,
sequenceExpanded: false,
- assigned: 'Assigned to 3 private tasks that will not be displayed'
}
},
created() {
@@ -172,6 +198,7 @@
this.repositoryName = result.repository_name;
this.defaultColumns = result.default_columns;
this.customColumns = result.custom_columns;
+ this.assignedModules = result.assigned_modules;
}
});
},
diff --git a/app/views/repository_rows/show.json.jbuilder b/app/views/repository_rows/show.json.jbuilder
index 8c5d7acdf..04208c43c 100644
--- a/app/views/repository_rows/show.json.jbuilder
+++ b/app/views/repository_rows/show.json.jbuilder
@@ -14,3 +14,13 @@ json.custom_columns do
json.merge! serialize_repository_cell_value(repository_cell, @repository.team, @repository)
end
end
+
+json.assigned_modules do
+ json.total_assigned_count @assigned_modules.length
+ json.private_count @private_modules.length
+ json.viewable_modules do
+ json.array! @viewable_modules do |my_module|
+ json.merge! extract_my_module_metadata(my_module)
+ end
+ end
+end
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 33658c23c..4ef6c3a81 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -2109,6 +2109,18 @@ en:
item_card:
title:
information: "Information"
+ section:
+ assigned: "Assigned (%{count})"
+ assigned:
+ empty: "This item is not assigned to any task."
+ private:
+ one: "Assigned to %{count} private task"
+ other: "Assigned to %{count} private tasks"
+ labels:
+ team: "Team:"
+ project: "Project:"
+ experiment: "Experiment:"
+ my_module: "Task:"
default_columns:
repository_name: "Inventory"
id: "Item ID"