Class: Gitlab::PipelineScopeCounts

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/pipeline_scope_counts.rb

Constant Summary collapse

PIPELINES_COUNT_LIMIT =
1000

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(current_user, project, params) ⇒ PipelineScopeCounts

Returns a new instance of PipelineScopeCounts.



13
14
15
16
17
# File 'lib/gitlab/pipeline_scope_counts.rb', line 13

def initialize(current_user, project, params)
  @current_user = current_user
  @project = project
  @params = params
end

Instance Attribute Details

#projectObject (readonly)

Returns the value of attribute project.



5
6
7
# File 'lib/gitlab/pipeline_scope_counts.rb', line 5

def project
  @project
end

Class Method Details

.declarative_policy_classObject



9
10
11
# File 'lib/gitlab/pipeline_scope_counts.rb', line 9

def self.declarative_policy_class
  'Ci::ProjectPipelinesPolicy'
end

Instance Method Details

#allObject



19
20
21
# File 'lib/gitlab/pipeline_scope_counts.rb', line 19

def all
  finder.execute.limit(PIPELINES_COUNT_LIMIT).count
end

#finishedObject



27
28
29
# File 'lib/gitlab/pipeline_scope_counts.rb', line 27

def finished
  finder({ scope: "finished" }).execute.limit(PIPELINES_COUNT_LIMIT).count
end

#pendingObject



31
32
33
# File 'lib/gitlab/pipeline_scope_counts.rb', line 31

def pending
  finder({ scope: "pending" }).execute.limit(PIPELINES_COUNT_LIMIT).count
end

#runningObject



23
24
25
# File 'lib/gitlab/pipeline_scope_counts.rb', line 23

def running
  finder({ scope: "running" }).execute.limit(PIPELINES_COUNT_LIMIT).count
end