Commit 602a1c34 authored by Luke Bennett's avatar Luke Bennett Committed by Bob Van Landuyt

Create instance_statistics namespace and move convdev index and cohorts to it

parent ed81ee9b
# 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
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
......
class Admin::ConversationalDevelopmentIndexController < Admin::ApplicationController
def show
# frozen_string_literal: true
class InstanceStatistics::ConversationalDevelopmentIndexController < InstanceStatistics::ApplicationController
def index
@metric = ConversationalDevelopmentIndex::Metric.order(:created_at).last&.present
end
end
......@@ -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
......
- page_title "Instance Statistics"
- header_title "Instance Statistics", instance_statistics_root_path
- nav "instance_statistics"
- @left_sidebar = true
= render template: "layouts/application"
......@@ -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')
......
.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'
......@@ -110,6 +110,7 @@ Rails.application.routes.draw do
draw :group
draw :user
draw :project
draw :instance_statistics
root to: "root#index"
......
......@@ -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
......
# frozen_string_literal: true
namespace :instance_statistics do
root to: redirect("instance_statistics/conversational_development_index")
resources :cohorts, only: :index
resources :conversational_development_index, only: :index
end
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
......
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%'
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment