summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorLuke Bennett <lukeeeebennettplus@gmail.com>2018-07-18 01:37:58 +0100
committerBob Van Landuyt <bob@vanlanduyt.co>2018-07-27 15:54:26 +0200
commit602a1c34e33d75940c7acbf4a31a65e187dbbfde (patch)
tree580e136cf3a00cd15ade56447928ece7ad127f2c /app
parented81ee9ba2b5a0b68996ccb238bfa4c69a6df062 (diff)
downloadgitlab-ce-602a1c34e33d75940c7acbf4a31a65e187dbbfde.tar.gz
Create instance_statistics namespace and move convdev index and cohorts to it
Diffstat (limited to 'app')
-rw-r--r--app/controllers/admin/conversational_development_index_controller.rb5
-rw-r--r--app/controllers/instance_statistics/application_controller.rb14
-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.rb7
-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
16 files changed, 64 insertions, 9 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..2077b71bf2d
--- /dev/null
+++ b/app/controllers/instance_statistics/application_controller.rb
@@ -0,0 +1,14 @@
+# frozen_string_literal: true
+
+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..d6d2191849f
--- /dev/null
+++ b/app/controllers/instance_statistics/conversational_development_index_controller.rb
@@ -0,0 +1,7 @@
+# frozen_string_literal: true
+
+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'