2018-09-25 23:45:43 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-08-24 11:17:15 -04:00
|
|
|
class Projects::CycleAnalyticsController < Projects::ApplicationController
|
2016-09-20 09:20:48 -04:00
|
|
|
include ActionView::Helpers::DateHelper
|
2016-09-21 00:27:14 -04:00
|
|
|
include ActionView::Helpers::TextHelper
|
2016-11-07 04:08:18 -05:00
|
|
|
include CycleAnalyticsParams
|
2020-06-22 11:09:27 -04:00
|
|
|
include Analytics::UniqueVisitsHelper
|
2020-07-17 14:09:20 -04:00
|
|
|
include GracefulTimeoutHandling
|
2016-09-17 02:38:23 -04:00
|
|
|
|
2016-08-26 06:54:30 -04:00
|
|
|
before_action :authorize_read_cycle_analytics!
|
|
|
|
|
2020-06-22 11:09:27 -04:00
|
|
|
track_unique_visits :show, target_id: 'p_analytics_valuestream'
|
|
|
|
|
2020-10-08 14:08:32 -04:00
|
|
|
feature_category :planning_analytics
|
|
|
|
|
2016-08-24 11:17:15 -04:00
|
|
|
def show
|
2021-06-14 08:10:13 -04:00
|
|
|
@cycle_analytics = Analytics::CycleAnalytics::ProjectLevel.new(project: @project, options: options(cycle_analytics_project_params))
|
2016-11-22 08:29:25 -05:00
|
|
|
|
2016-09-08 05:33:38 -04:00
|
|
|
respond_to do |format|
|
2019-08-14 12:12:12 -04:00
|
|
|
format.html do
|
|
|
|
Gitlab::UsageDataCounters::CycleAnalyticsCounter.count(:views)
|
|
|
|
|
|
|
|
render :show
|
|
|
|
end
|
|
|
|
format.json do
|
|
|
|
render json: cycle_analytics_json
|
|
|
|
end
|
2016-09-08 05:33:38 -04:00
|
|
|
end
|
2016-08-26 06:48:52 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
2016-11-22 05:46:02 -05:00
|
|
|
def cycle_analytics_json
|
|
|
|
{
|
|
|
|
summary: @cycle_analytics.summary,
|
2016-11-22 08:29:25 -05:00
|
|
|
stats: @cycle_analytics.stats,
|
|
|
|
permissions: @cycle_analytics.permissions(user: current_user)
|
2016-09-20 09:20:48 -04:00
|
|
|
}
|
2016-11-21 09:39:43 -05:00
|
|
|
end
|
2016-08-24 11:17:15 -04:00
|
|
|
end
|