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
2b82ab1c
Commit
2b82ab1c
authored
Sep 16, 2019
by
João Cunha
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove string concat duplicated logic from services
parent
f2f98d7f
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
8 additions
and
4 deletions
+8
-4
app/models/clusters/cluster.rb
app/models/clusters/cluster.rb
+1
-1
app/services/clusters/applications/base_service.rb
app/services/clusters/applications/base_service.rb
+4
-0
app/services/clusters/applications/create_service.rb
app/services/clusters/applications/create_service.rb
+1
-1
app/services/clusters/applications/destroy_service.rb
app/services/clusters/applications/destroy_service.rb
+1
-1
app/services/clusters/applications/update_service.rb
app/services/clusters/applications/update_service.rb
+1
-1
No files found.
app/models/clusters/cluster.rb
View file @
2b82ab1c
...
...
@@ -37,7 +37,7 @@ module Clusters
has_one
:platform_kubernetes
,
class_name:
'Clusters::Platforms::Kubernetes'
,
inverse_of: :cluster
,
autosave:
true
def
self
.
has_one_cluster_application
(
name
)
def
self
.
has_one_cluster_application
(
name
)
# rubocop:disable Naming/PredicateName
application
=
APPLICATIONS
[
name
.
to_s
]
has_one
application
.
association_name
,
class_name:
application
.
to_s
# rubocop:disable Rails/ReflectionClassName
end
...
...
app/services/clusters/applications/base_service.rb
View file @
2b82ab1c
...
...
@@ -77,6 +77,10 @@ module Clusters
params
[
:application
]
end
def
application_class
Clusters
::
Cluster
::
APPLICATIONS
[
application_name
]
end
def
create_oauth_application
(
application
,
request
)
oauth_application_params
=
{
name:
params
[
:application
],
...
...
app/services/clusters/applications/create_service.rb
View file @
2b82ab1c
...
...
@@ -10,7 +10,7 @@ module Clusters
end
def
builder
cluster
.
public_send
(
:"application_
#{
application_name
}
"
)
||
# rubocop:disable GitlabSecurity/PublicSend
cluster
.
public_send
(
application_class
.
association_name
)
||
# rubocop:disable GitlabSecurity/PublicSend
cluster
.
public_send
(
:"build_application_
#{
application_name
}
"
)
# rubocop:disable GitlabSecurity/PublicSend
end
end
...
...
app/services/clusters/applications/destroy_service.rb
View file @
2b82ab1c
...
...
@@ -16,7 +16,7 @@ module Clusters
private
def
builder
cluster
.
public_send
(
:"application_
#{
application_name
}
"
)
# rubocop:disable GitlabSecurity/PublicSend
cluster
.
public_send
(
application_class
.
association_name
)
# rubocop:disable GitlabSecurity/PublicSend
end
end
end
...
...
app/services/clusters/applications/update_service.rb
View file @
2b82ab1c
...
...
@@ -10,7 +10,7 @@ module Clusters
end
def
builder
cluster
.
public_send
(
:"application_
#{
application_name
}
"
)
# rubocop:disable GitlabSecurity/PublicSend
cluster
.
public_send
(
application_class
.
association_name
)
# rubocop:disable GitlabSecurity/PublicSend
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