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
4d0a700d
Commit
4d0a700d
authored
Nov 02, 2017
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Expose applications as array via API
parent
94d5f568
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
12 deletions
+13
-12
app/models/clusters/applications/helm.rb
app/models/clusters/applications/helm.rb
+1
-1
app/models/clusters/cluster.rb
app/models/clusters/cluster.rb
+6
-0
app/models/clusters/concerns/application_status.rb
app/models/clusters/concerns/application_status.rb
+6
-5
app/presenters/clusters/cluster_presenter.rb
app/presenters/clusters/cluster_presenter.rb
+0
-6
No files found.
app/models/clusters/applications/helm.rb
View file @
4d0a700d
...
@@ -5,7 +5,7 @@ module Clusters
...
@@ -5,7 +5,7 @@ module Clusters
NAME
=
'helm'
.
freeze
NAME
=
'helm'
.
freeze
include
::
Clusters
::
Concerns
::
AppStatus
include
::
Clusters
::
Concerns
::
App
lication
Status
belongs_to
:cluster
,
class_name:
'Clusters::Cluster'
,
foreign_key: :cluster_id
belongs_to
:cluster
,
class_name:
'Clusters::Cluster'
,
foreign_key: :cluster_id
...
...
app/models/clusters/cluster.rb
View file @
4d0a700d
...
@@ -51,6 +51,12 @@ module Clusters
...
@@ -51,6 +51,12 @@ module Clusters
end
end
end
end
def
applications
[
application_helm
||
build_application_helm
]
end
def
provider
def
provider
return
provider_gcp
if
gcp?
return
provider_gcp
if
gcp?
end
end
...
...
app/models/clusters/concerns/app_status.rb
→
app/models/clusters/concerns/app
lication
_status.rb
View file @
4d0a700d
module
Clusters
module
Clusters
module
Concerns
module
Concerns
module
AppStatus
module
App
lication
Status
extend
ActiveSupport
::
Concern
extend
ActiveSupport
::
Concern
included
do
included
do
state_machine
:status
,
initial: :
scheduled
do
state_machine
:status
,
initial: :
installable
do
state
:errored
,
value:
-
1
state
:errored
,
value:
-
1
state
:scheduled
,
value:
0
state
:installable
,
value:
0
state
:installing
,
value:
1
state
:scheduled
,
value:
1
state
:installed
,
value:
2
state
:installing
,
value:
2
state
:installed
,
value:
3
event
:make_installing
do
event
:make_installing
do
transition
any
-
[
:installing
]
=>
:installing
transition
any
-
[
:installing
]
=>
:installing
...
...
app/presenters/clusters/cluster_presenter.rb
View file @
4d0a700d
...
@@ -5,11 +5,5 @@ module Clusters
...
@@ -5,11 +5,5 @@ module Clusters
def
gke_cluster_url
def
gke_cluster_url
"https://console.cloud.google.com/kubernetes/clusters/details/
#{
provider
.
zone
}
/
#{
name
}
"
if
gcp?
"https://console.cloud.google.com/kubernetes/clusters/details/
#{
provider
.
zone
}
/
#{
name
}
"
if
gcp?
end
end
def
applications
Clusters
::
Cluster
::
APPLICATIONS
.
map
do
|
key
,
value
|
value
.
find_by
(
cluster_id:
id
)
end
.
compact
end
end
end
end
end
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