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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
6472025e
Commit
6472025e
authored
May 02, 2018
by
Matija Čupić
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove Projects::Clusters::GcpController#list_projects
parent
1e8dbd52
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
0 additions
and
45 deletions
+0
-45
app/controllers/projects/clusters/gcp_controller.rb
app/controllers/projects/clusters/gcp_controller.rb
+0
-16
config/routes/project.rb
config/routes/project.rb
+0
-1
spec/controllers/projects/clusters/gcp_controller_spec.rb
spec/controllers/projects/clusters/gcp_controller_spec.rb
+0
-28
No files found.
app/controllers/projects/clusters/gcp_controller.rb
View file @
6472025e
...
...
@@ -2,7 +2,6 @@ class Projects::Clusters::GcpController < Projects::ApplicationController
before_action
:authorize_read_cluster!
before_action
:authorize_create_cluster!
,
only:
[
:new
,
:create
]
before_action
:authorize_google_api
,
except:
[
:login
,
:list_projects
]
before_action
:get_gcp_projects
,
only:
[
:new
]
def
login
begin
...
...
@@ -34,12 +33,6 @@ class Projects::Clusters::GcpController < Projects::ApplicationController
end
end
def
list_projects
respond_to
do
|
format
|
format
.
json
{
render
status: :ok
,
json:
{
projects:
gcp_projects
}
}
end
end
private
def
create_params
...
...
@@ -65,15 +58,6 @@ class Projects::Clusters::GcpController < Projects::ApplicationController
end
end
def
get_gcp_projects
redis_token_key
=
ListGcpProjectsWorker
.
store_session_token
(
token_in_session
)
ListGcpProjectsWorker
.
perform_async
(
redis_token_key
)
end
def
gcp_projects
ListGcpProjectsWorker
.
read_projects
(
token_in_session
)
end
def
token_in_session
@token_in_session
||=
session
[
GoogleApi
::
CloudPlatform
::
Client
.
session_key_for_token
]
...
...
config/routes/project.rb
View file @
6472025e
...
...
@@ -206,7 +206,6 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
get
'/gcp/new'
,
to:
'clusters/gcp#new'
get
'/gcp/login'
,
to:
'clusters/gcp#login'
get
'/gcp/list_projects'
,
to:
'clusters/gcp#list_projects'
post
'/gcp'
,
to:
'clusters/gcp#create'
end
end
...
...
spec/controllers/projects/clusters/gcp_controller_spec.rb
View file @
6472025e
...
...
@@ -77,8 +77,6 @@ describe Projects::Clusters::GcpController do
end
it
'has new object'
do
expect
(
controller
).
to
receive
(
:get_gcp_projects
)
go
expect
(
assigns
(
:cluster
)).
to
be_an_instance_of
(
Clusters
::
Cluster
)
...
...
@@ -137,8 +135,6 @@ describe Projects::Clusters::GcpController do
context
'when access token is valid'
do
before
do
stub_google_api_validate_token
allow_any_instance_of
(
described_class
).
to
receive
(
:get_gcp_projects
)
allow_any_instance_of
(
described_class
).
to
receive
(
:gcp_projects
).
and_return
([
double
])
end
it
'creates a new cluster'
do
...
...
@@ -183,28 +179,4 @@ describe Projects::Clusters::GcpController do
post
:create
,
params
.
merge
(
namespace_id:
project
.
namespace
,
project_id:
project
)
end
end
describe
'GET list_projects'
do
describe
'functionality'
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:gcp_projects
)
{
[
project_id:
'test-project-1234'
]
}
before
do
project
.
add_master
(
user
)
sign_in
(
user
)
allow_any_instance_of
(
described_class
).
to
receive
(
:gcp_projects
).
and_return
(
gcp_projects
)
end
it
'renders the response as json'
do
go
expect
(
response
.
body
).
to
eq
({
projects:
gcp_projects
}.
to_json
)
end
end
def
go
get
:list_projects
,
namespace_id:
project
.
namespace
,
project_id:
project
,
format: :json
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