Class: Resolvers::ProjectPipelineStatisticsResolver

Inherits:
BaseResolver
  • Object
show all
Includes:
Gitlab::Graphql::Authorize::AuthorizeResource
Defined in:
app/graphql/resolvers/project_pipeline_statistics_resolver.rb

Constant Summary

Constants included from Gitlab::Graphql::Authorize::AuthorizeResource

Gitlab::Graphql::Authorize::AuthorizeResource::ConfigurationError, Gitlab::Graphql::Authorize::AuthorizeResource::RESOURCE_ACCESS_ERROR

Instance Method Summary collapse

Methods included from Gitlab::Graphql::Authorize::AuthorizeResource

#authorize!, #authorized_find!, #authorized_resource?, #find_object, #raise_resource_not_available_error!

Methods inherited from BaseResolver

as_single, authorization, authorized?, before_connection_authorization, before_connection_authorization_block, calculate_ext_conn_complexity, calls_gitaly!, complexity, complexity_multiplier, #current_user, field_options, last, #object, #offset_pagination, requires_argument!, resolver_complexity, #select_result, single, #single?, single_definition_blocks, singular_type, when_single

Methods included from Gitlab::Utils::Override

#extended, extensions, #included, #method_added, #override, #prepended, #queue_verification, verify!

Instance Method Details

#resolveObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'app/graphql/resolvers/project_pipeline_statistics_resolver.rb', line 11

def resolve
  weekly_stats = Gitlab::Ci::Charts::WeekChart.new(object)
  monthly_stats = Gitlab::Ci::Charts::MonthChart.new(object)
  yearly_stats = Gitlab::Ci::Charts::YearChart.new(object)
  pipeline_times = Gitlab::Ci::Charts::PipelineTime.new(object)

  {
    week_pipelines_labels: weekly_stats.labels,
    week_pipelines_totals: weekly_stats.total,
    week_pipelines_successful: weekly_stats.success,
    month_pipelines_labels: monthly_stats.labels,
    month_pipelines_totals: monthly_stats.total,
    month_pipelines_successful: monthly_stats.success,
    year_pipelines_labels: yearly_stats.labels,
    year_pipelines_totals: yearly_stats.total,
    year_pipelines_successful: yearly_stats.success,
    pipeline_times_labels: pipeline_times.labels,
    pipeline_times_values: pipeline_times.pipeline_times
  }
end