diff --git a/app/controllers/storage_locations_controller.rb b/app/controllers/storage_locations_controller.rb
index bea2d3b60..a6af1aecc 100644
--- a/app/controllers/storage_locations_controller.rb
+++ b/app/controllers/storage_locations_controller.rb
@@ -4,10 +4,17 @@ class StorageLocationsController < ApplicationController
before_action :load_storage_location, only: %i(update destroy)
before_action :check_read_permissions, only: :index
before_action :check_manage_permissions, except: :index
+ before_action :set_breadcrumbs_items, only: :index
def index
- storage_locations = Lists::StorageLocationsService.new(current_team, storage_location_params).call
- render json: storage_locations, each_serializer: Lists::StorageLocationSerializer
+ respond_to do |format|
+ format.html
+ format.json do
+ storage_locations = Lists::StorageLocationsService.new(current_team, params).call
+ render json: storage_locations, each_serializer: Lists::StorageLocationSerializer,
+ user: current_user, meta: pagination_dict(storage_locations)
+ end
+ end
end
def update
@@ -43,6 +50,12 @@ class StorageLocationsController < ApplicationController
end
end
+ def actions_toolbar
+ render json: {
+ actions: [] # TODO: Add actions
+ }
+ end
+
private
def storage_location_params
@@ -62,4 +75,37 @@ class StorageLocationsController < ApplicationController
def check_manage_permissions
render_403 unless true
end
+
+ def set_breadcrumbs_items
+ @breadcrumbs_items = []
+
+ @breadcrumbs_items.push({
+ label: t('breadcrumbs.inventories')
+ })
+
+ @breadcrumbs_items.push({
+ label: t('breadcrumbs.locations'),
+ url: storage_locations_path
+ })
+
+ storage_locations = []
+ if params[:parent_id]
+ location = StorageLocation.where(team: current_team).find_by(id: params[:parent_id])
+ if location
+ storage_locations.unshift(breadcrumbs_item(location))
+ while location.parent
+ location = location.parent
+ storage_locations.unshift(breadcrumbs_item(location))
+ end
+ end
+ end
+ @breadcrumbs_items += storage_locations
+ end
+
+ def breadcrumbs_item(location)
+ {
+ label: location.name,
+ url: storage_locations_path(parent_id: location.id)
+ }
+ end
end
diff --git a/app/helpers/left_menu_bar_helper.rb b/app/helpers/left_menu_bar_helper.rb
index f8a77be75..b6a2d22d2 100644
--- a/app/helpers/left_menu_bar_helper.rb
+++ b/app/helpers/left_menu_bar_helper.rb
@@ -19,8 +19,16 @@ module LeftMenuBarHelper
url: repositories_path,
name: t('left_menu_bar.repositories'),
icon: 'sn-icon-inventory',
- active: repositories_are_selected?,
- submenu: []
+ active: repositories_are_selected? || storage_locations_are_selected?,
+ submenu: [{
+ url: repositories_path,
+ name: t('left_menu_bar.items'),
+ active: repositories_are_selected?
+ }, {
+ url: storage_locations_path,
+ name: t('left_menu_bar.locations'),
+ active: storage_locations_are_selected?
+ }]
}, {
url: "#",
name: t('left_menu_bar.templates'),
@@ -63,6 +71,10 @@ module LeftMenuBarHelper
controller_name == 'repositories'
end
+ def storage_locations_are_selected?
+ controller_name == 'storage_locations'
+ end
+
def protocols_are_selected?
controller_name == 'protocols'
end
diff --git a/app/javascript/packs/vue/storage_locations_table.js b/app/javascript/packs/vue/storage_locations_table.js
new file mode 100644
index 000000000..e83db7824
--- /dev/null
+++ b/app/javascript/packs/vue/storage_locations_table.js
@@ -0,0 +1,10 @@
+import { createApp } from 'vue/dist/vue.esm-bundler.js';
+import PerfectScrollbar from 'vue3-perfect-scrollbar';
+import StorageLocations from '../../vue/storage_locations/table.vue';
+import { mountWithTurbolinks } from './helpers/turbolinks.js';
+
+const app = createApp();
+app.component('StorageLocations', StorageLocations);
+app.config.globalProperties.i18n = window.I18n;
+app.use(PerfectScrollbar);
+mountWithTurbolinks(app, '#storageLocationsTable');
diff --git a/app/javascript/vue/storage_locations/table.vue b/app/javascript/vue/storage_locations/table.vue
new file mode 100644
index 000000000..53991400e
--- /dev/null
+++ b/app/javascript/vue/storage_locations/table.vue
@@ -0,0 +1,143 @@
+
+