Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
b26913a3
Commit
b26913a3
authored
Mar 30, 2018
by
Matija Čupić
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extract cluster installed query to scope
parent
f6fa8429
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
1 deletion
+15
-1
app/models/clusters/cluster.rb
app/models/clusters/cluster.rb
+2
-0
lib/gitlab/usage_data.rb
lib/gitlab/usage_data.rb
+1
-1
spec/models/clusters/cluster_spec.rb
spec/models/clusters/cluster_spec.rb
+12
-0
No files found.
app/models/clusters/cluster.rb
View file @
b26913a3
...
@@ -53,6 +53,8 @@ module Clusters
...
@@ -53,6 +53,8 @@ module Clusters
scope
:disabled
,
->
{
where
(
enabled:
false
)
}
scope
:disabled
,
->
{
where
(
enabled:
false
)
}
scope
:user_provided
,
->
{
where
(
provider_type:
::
Clusters
::
Cluster
.
provider_types
[
:user
])
}
scope
:user_provided
,
->
{
where
(
provider_type:
::
Clusters
::
Cluster
.
provider_types
[
:user
])
}
scope
:gcp_provided
,
->
{
where
(
provider_type:
::
Clusters
::
Cluster
.
provider_types
[
:gcp
])
}
scope
:gcp_provided
,
->
{
where
(
provider_type:
::
Clusters
::
Cluster
.
provider_types
[
:gcp
])
}
scope
:gcp_installed
,
->
{
gcp_provided
.
includes
(
:provider_gcp
).
where
(
cluster_providers_gcp:
{
status:
::
Clusters
::
Providers
::
Gcp
.
state_machines
[
:status
].
states
[
:created
].
value
})
}
scope
:default_environment
,
->
{
where
(
environment_scope:
DEFAULT_ENVIRONMENT
)
}
scope
:default_environment
,
->
{
where
(
environment_scope:
DEFAULT_ENVIRONMENT
)
}
def
status_name
def
status_name
...
...
lib/gitlab/usage_data.rb
View file @
b26913a3
...
@@ -51,7 +51,7 @@ module Gitlab
...
@@ -51,7 +51,7 @@ module Gitlab
clusters:
::
Clusters
::
Cluster
.
count
,
clusters:
::
Clusters
::
Cluster
.
count
,
clusters_enabled:
::
Clusters
::
Cluster
.
enabled
.
count
,
clusters_enabled:
::
Clusters
::
Cluster
.
enabled
.
count
,
clusters_disabled:
::
Clusters
::
Cluster
.
disabled
.
count
,
clusters_disabled:
::
Clusters
::
Cluster
.
disabled
.
count
,
clusters_platforms_gke:
::
Clusters
::
Cluster
.
gcp_
provided
.
includes
(
:provider_gcp
).
where
(
cluster_providers_gcp:
{
status:
::
Clusters
::
Providers
::
Gcp
.
state_machines
[
:status
].
states
[
:created
].
value
})
.
enabled
.
count
,
clusters_platforms_gke:
::
Clusters
::
Cluster
.
gcp_
installed
.
enabled
.
count
,
clusters_platforms_user:
::
Clusters
::
Cluster
.
user_provided
.
enabled
.
count
,
clusters_platforms_user:
::
Clusters
::
Cluster
.
user_provided
.
enabled
.
count
,
clusters_applications_helm:
::
Clusters
::
Applications
::
Helm
.
installed
.
count
,
clusters_applications_helm:
::
Clusters
::
Applications
::
Helm
.
installed
.
count
,
clusters_applications_ingress:
::
Clusters
::
Applications
::
Ingress
.
installed
.
count
,
clusters_applications_ingress:
::
Clusters
::
Applications
::
Ingress
.
installed
.
count
,
...
...
spec/models/clusters/cluster_spec.rb
View file @
b26913a3
...
@@ -63,6 +63,18 @@ describe Clusters::Cluster do
...
@@ -63,6 +63,18 @@ describe Clusters::Cluster do
it
{
is_expected
.
to
contain_exactly
(
cluster
)
}
it
{
is_expected
.
to
contain_exactly
(
cluster
)
}
end
end
describe
'.gcp_installed'
do
subject
{
described_class
.
gcp_installed
}
let!
(
:cluster
)
{
create
(
:cluster
,
:provided_by_gcp
)
}
before
do
create
(
:cluster
,
:providing_by_gcp
)
end
it
{
is_expected
.
to
contain_exactly
(
cluster
)
}
end
describe
'validation'
do
describe
'validation'
do
subject
{
cluster
.
valid?
}
subject
{
cluster
.
valid?
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment