summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/controllers/admin/conversational_development_index_controller.rb5
-rw-r--r--app/controllers/instance_statistics/application_controller.rb12
-rw-r--r--app/controllers/instance_statistics/cohorts_controller.rb (renamed from app/controllers/admin/cohorts_controller.rb)2
-rw-r--r--app/controllers/instance_statistics/conversational_development_index_controller.rb5
-rw-r--r--app/views/admin/application_settings/_usage.html.haml2
-rw-r--r--app/views/instance_statistics/cohorts/_cohorts_table.html.haml (renamed from app/views/admin/cohorts/_cohorts_table.html.haml)0
-rw-r--r--app/views/instance_statistics/cohorts/_usage_ping.html.haml (renamed from app/views/admin/cohorts/_usage_ping.html.haml)0
-rw-r--r--app/views/instance_statistics/cohorts/index.html.haml (renamed from app/views/admin/cohorts/index.html.haml)0
-rw-r--r--app/views/instance_statistics/conversational_development_index/_callout.html.haml (renamed from app/views/admin/conversational_development_index/_callout.html.haml)0
-rw-r--r--app/views/instance_statistics/conversational_development_index/_card.html.haml (renamed from app/views/admin/conversational_development_index/_card.html.haml)0
-rw-r--r--app/views/instance_statistics/conversational_development_index/_disabled.html.haml (renamed from app/views/admin/conversational_development_index/_disabled.html.haml)0
-rw-r--r--app/views/instance_statistics/conversational_development_index/_no_data.html.haml (renamed from app/views/admin/conversational_development_index/_no_data.html.haml)0
-rw-r--r--app/views/instance_statistics/conversational_development_index/index.html.haml (renamed from app/views/admin/conversational_development_index/show.html.haml)0
-rw-r--r--app/views/layouts/instance_statistics.html.haml6
-rw-r--r--app/views/layouts/nav/sidebar/_admin.html.haml4
-rw-r--r--app/views/layouts/nav/sidebar/_instance_statistics.html.haml33
-rw-r--r--config/routes.rb1
-rw-r--r--config/routes/admin.rb4
-rw-r--r--config/routes/instance_statistics.rb6
-rw-r--r--spec/features/instance_statistics/cohorts_spec.rb (renamed from spec/features/admin/admin_cohorts_spec.rb)4
-rw-r--r--spec/features/instance_statistics/conversational_development_index_spec.rb (renamed from spec/features/admin/admin_conversational_development_index_spec.rb)8
21 files changed, 73 insertions, 19 deletions
diff --git a/app/controllers/admin/conversational_development_index_controller.rb b/app/controllers/admin/conversational_development_index_controller.rb
deleted file mode 100644
index 921169d3e2b..00000000000
--- a/app/controllers/admin/conversational_development_index_controller.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-class Admin::ConversationalDevelopmentIndexController < Admin::ApplicationController
- def show
- @metric = ConversationalDevelopmentIndex::Metric.order(:created_at).last&.present
- end
-end
diff --git a/app/controllers/instance_statistics/application_controller.rb b/app/controllers/instance_statistics/application_controller.rb
new file mode 100644
index 00000000000..fbdce7d0f0d
--- /dev/null
+++ b/app/controllers/instance_statistics/application_controller.rb
@@ -0,0 +1,12 @@
+class InstanceStatistics::ApplicationController < ApplicationController
+ before_action :authenticate_user!
+ layout 'instance_statistics'
+
+ def index
+ redirect_to instance_statistics_conversations_development_index_index_path
+ end
+
+ def authenticate_user!
+ render_404 unless current_user.admin?
+ end
+end
diff --git a/app/controllers/admin/cohorts_controller.rb b/app/controllers/instance_statistics/cohorts_controller.rb
index 10d9d1b5345..77d09c198c8 100644
--- a/app/controllers/admin/cohorts_controller.rb
+++ b/app/controllers/instance_statistics/cohorts_controller.rb
@@ -1,4 +1,4 @@
-class Admin::CohortsController < Admin::ApplicationController
+class InstanceStatistics::CohortsController < InstanceStatistics::ApplicationController
def index
if Gitlab::CurrentSettings.usage_ping_enabled
cohorts_results = Rails.cache.fetch('cohorts', expires_in: 1.day) do
diff --git a/app/controllers/instance_statistics/conversational_development_index_controller.rb b/app/controllers/instance_statistics/conversational_development_index_controller.rb
new file mode 100644
index 00000000000..023ce917e13
--- /dev/null
+++ b/app/controllers/instance_statistics/conversational_development_index_controller.rb
@@ -0,0 +1,5 @@
+class InstanceStatistics::ConversationalDevelopmentIndexController < InstanceStatistics::ApplicationController
+ def index
+ @metric = ConversationalDevelopmentIndex::Metric.order(:created_at).last&.present
+ end
+end
diff --git a/app/views/admin/application_settings/_usage.html.haml b/app/views/admin/application_settings/_usage.html.haml
index 49a3ee33a85..40b5c51ac88 100644
--- a/app/views/admin/application_settings/_usage.html.haml
+++ b/app/views/admin/application_settings/_usage.html.haml
@@ -23,7 +23,7 @@
periodically collect usage information.
= link_to 'Learn more', help_page_path("user/admin_area/settings/usage_statistics", anchor: "usage-ping")
about what information is shared with GitLab Inc. Visit
- = link_to 'Cohorts', admin_cohorts_path(anchor: 'usage-ping')
+ = link_to 'Cohorts', instance_statistics_cohorts_path(anchor: 'usage-ping')
to see the JSON payload sent.
- else
The usage ping is disabled, and cannot be configured through this
diff --git a/app/views/admin/cohorts/_cohorts_table.html.haml b/app/views/instance_statistics/cohorts/_cohorts_table.html.haml
index 701a4e62b39..701a4e62b39 100644
--- a/app/views/admin/cohorts/_cohorts_table.html.haml
+++ b/app/views/instance_statistics/cohorts/_cohorts_table.html.haml
diff --git a/app/views/admin/cohorts/_usage_ping.html.haml b/app/views/instance_statistics/cohorts/_usage_ping.html.haml
index 3dda386fcf7..3dda386fcf7 100644
--- a/app/views/admin/cohorts/_usage_ping.html.haml
+++ b/app/views/instance_statistics/cohorts/_usage_ping.html.haml
diff --git a/app/views/admin/cohorts/index.html.haml b/app/views/instance_statistics/cohorts/index.html.haml
index 5e9a8c083af..5e9a8c083af 100644
--- a/app/views/admin/cohorts/index.html.haml
+++ b/app/views/instance_statistics/cohorts/index.html.haml
diff --git a/app/views/admin/conversational_development_index/_callout.html.haml b/app/views/instance_statistics/conversational_development_index/_callout.html.haml
index 33a4dab1e00..33a4dab1e00 100644
--- a/app/views/admin/conversational_development_index/_callout.html.haml
+++ b/app/views/instance_statistics/conversational_development_index/_callout.html.haml
diff --git a/app/views/admin/conversational_development_index/_card.html.haml b/app/views/instance_statistics/conversational_development_index/_card.html.haml
index 57eda06630b..57eda06630b 100644
--- a/app/views/admin/conversational_development_index/_card.html.haml
+++ b/app/views/instance_statistics/conversational_development_index/_card.html.haml
diff --git a/app/views/admin/conversational_development_index/_disabled.html.haml b/app/views/instance_statistics/conversational_development_index/_disabled.html.haml
index 0a741b50960..0a741b50960 100644
--- a/app/views/admin/conversational_development_index/_disabled.html.haml
+++ b/app/views/instance_statistics/conversational_development_index/_disabled.html.haml
diff --git a/app/views/admin/conversational_development_index/_no_data.html.haml b/app/views/instance_statistics/conversational_development_index/_no_data.html.haml
index d69c46194b4..d69c46194b4 100644
--- a/app/views/admin/conversational_development_index/_no_data.html.haml
+++ b/app/views/instance_statistics/conversational_development_index/_no_data.html.haml
diff --git a/app/views/admin/conversational_development_index/show.html.haml b/app/views/instance_statistics/conversational_development_index/index.html.haml
index e3d1aa31dc2..e3d1aa31dc2 100644
--- a/app/views/admin/conversational_development_index/show.html.haml
+++ b/app/views/instance_statistics/conversational_development_index/index.html.haml
diff --git a/app/views/layouts/instance_statistics.html.haml b/app/views/layouts/instance_statistics.html.haml
new file mode 100644
index 00000000000..af39318b2ab
--- /dev/null
+++ b/app/views/layouts/instance_statistics.html.haml
@@ -0,0 +1,6 @@
+- page_title "Instance Statistics"
+- header_title "Instance Statistics", instance_statistics_root_path
+- nav "instance_statistics"
+- @left_sidebar = true
+
+= render template: "layouts/application"
diff --git a/app/views/layouts/nav/sidebar/_admin.html.haml b/app/views/layouts/nav/sidebar/_admin.html.haml
index 0047efa363d..302de31a6d4 100644
--- a/app/views/layouts/nav/sidebar/_admin.html.haml
+++ b/app/views/layouts/nav/sidebar/_admin.html.haml
@@ -48,11 +48,11 @@
%span
= _('Gitaly Servers')
= nav_link path: 'cohorts#index' do
- = link_to admin_cohorts_path, title: _('Cohorts') do
+ = link_to instance_statistics_cohorts_path, title: _('Cohorts') do
%span
= _('Cohorts')
= nav_link(controller: :conversational_development_index) do
- = link_to admin_conversational_development_index_path, title: _('ConvDev Index') do
+ = link_to instance_statistics_conversational_development_index_index_path, title: _('ConvDev Index') do
%span
= _('ConvDev Index')
diff --git a/app/views/layouts/nav/sidebar/_instance_statistics.html.haml b/app/views/layouts/nav/sidebar/_instance_statistics.html.haml
new file mode 100644
index 00000000000..cb64c97f7b4
--- /dev/null
+++ b/app/views/layouts/nav/sidebar/_instance_statistics.html.haml
@@ -0,0 +1,33 @@
+.nav-sidebar{ class: ("sidebar-collapsed-desktop" if collapsed_sidebar?) }
+ .nav-sidebar-inner-scroll
+ .context-header
+ = link_to instance_statistics_root_path, title: 'Instance Statistics' do
+ .avatar-container.s40.settings-avatar
+ = sprite_icon('chart', size: 24)
+ .sidebar-context-title Instance Statistics
+ %ul.sidebar-top-level-items
+ = nav_link(controller: :conversational_development_index) do
+ = link_to instance_statistics_conversational_development_index_index_path do
+ .nav-icon-container
+ = sprite_icon('comment')
+ %span.nav-item-name
+ = _('ConvDev Index')
+ %ul.sidebar-sub-level-items.is-fly-out-only
+ = nav_link(controller: :conversational_development_index, html_options: { class: "fly-out-top-item" } ) do
+ = link_to instance_statistics_conversational_development_index_index_path do
+ %strong.fly-out-top-item-name
+ = _('ConvDev Index')
+
+ = nav_link(controller: :cohorts) do
+ = link_to instance_statistics_cohorts_path do
+ .nav-icon-container
+ = sprite_icon('users')
+ %span.nav-item-name
+ = _('Cohorts')
+ %ul.sidebar-sub-level-items.is-fly-out-only
+ = nav_link(controller: :cohorts, html_options: { class: "fly-out-top-item" } ) do
+ = link_to instance_statistics_cohorts_path do
+ %strong.fly-out-top-item-name
+ = _('Cohorts')
+
+ = render 'shared/sidebar_toggle_button'
diff --git a/config/routes.rb b/config/routes.rb
index e0a9139b1b4..17b969f669d 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -110,6 +110,7 @@ Rails.application.routes.draw do
draw :group
draw :user
draw :project
+ draw :instance_statistics
root to: "root#index"
diff --git a/config/routes/admin.rb b/config/routes/admin.rb
index ff27ceb50dc..0ed57d78066 100644
--- a/config/routes/admin.rb
+++ b/config/routes/admin.rb
@@ -76,8 +76,6 @@ namespace :admin do
resource :system_info, controller: 'system_info', only: [:show]
resources :requests_profiles, only: [:index, :show], param: :name, constraints: { name: /.+\.html/ }
- get 'conversational_development_index' => 'conversational_development_index#show'
-
resources :projects, only: [:index]
scope(path: 'projects/*namespace_id',
@@ -123,8 +121,6 @@ namespace :admin do
end
end
- resources :cohorts, only: :index
-
resources :jobs, only: :index do
collection do
post :cancel_all
diff --git a/config/routes/instance_statistics.rb b/config/routes/instance_statistics.rb
new file mode 100644
index 00000000000..365797cb688
--- /dev/null
+++ b/config/routes/instance_statistics.rb
@@ -0,0 +1,6 @@
+namespace :instance_statistics do
+ root to: redirect("instance_statistics/conversational_development_index")
+
+ resources :cohorts, only: :index
+ resources :conversational_development_index, only: :index
+end
diff --git a/spec/features/admin/admin_cohorts_spec.rb b/spec/features/instance_statistics/cohorts_spec.rb
index 9dce9494b97..81fc5eff980 100644
--- a/spec/features/admin/admin_cohorts_spec.rb
+++ b/spec/features/instance_statistics/cohorts_spec.rb
@@ -1,6 +1,6 @@
require 'rails_helper'
-describe 'Admin cohorts page' do
+describe 'Cohorts page' do
before do
sign_in(create(:admin))
end
@@ -8,7 +8,7 @@ describe 'Admin cohorts page' do
it 'See users count per month' do
2.times { create(:user) }
- visit admin_cohorts_path
+ visit instance_statistics_cohorts_path
expect(page).to have_content("#{Time.now.strftime('%b %Y')} 3 0")
end
diff --git a/spec/features/admin/admin_conversational_development_index_spec.rb b/spec/features/instance_statistics/conversational_development_index_spec.rb
index 2d2c7df5364..d441a7a5af9 100644
--- a/spec/features/admin/admin_conversational_development_index_spec.rb
+++ b/spec/features/instance_statistics/conversational_development_index_spec.rb
@@ -1,6 +1,6 @@
require 'spec_helper'
-describe 'Admin Conversational Development Index' do
+describe 'Conversational Development Index' do
before do
sign_in(create(:admin))
end
@@ -9,7 +9,7 @@ describe 'Admin Conversational Development Index' do
it 'shows empty state' do
stub_application_setting(usage_ping_enabled: false)
- visit admin_conversational_development_index_path
+ visit instance_statistics_conversational_development_index_index_path
expect(page).to have_content('Usage ping is not enabled')
end
@@ -19,7 +19,7 @@ describe 'Admin Conversational Development Index' do
it 'shows empty state' do
stub_application_setting(usage_ping_enabled: true)
- visit admin_conversational_development_index_path
+ visit instance_statistics_conversational_development_index_index_path
expect(page).to have_content('Data is still calculating')
end
@@ -30,7 +30,7 @@ describe 'Admin Conversational Development Index' do
stub_application_setting(usage_ping_enabled: true)
create(:conversational_development_index_metric)
- visit admin_conversational_development_index_path
+ visit instance_statistics_conversational_development_index_index_path
expect(page).to have_content(
'Issues created per active user 1.2 You 9.3 Lead 13.3%'