Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
6472025e
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
6472025e
编写于
5月 02, 2018
作者:
M
Matija Čupić
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove Projects::Clusters::GcpController#list_projects
上级
1e8dbd52
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
0 addition
and
45 deletion
+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
未找到文件。
app/controllers/projects/clusters/gcp_controller.rb
浏览文件 @
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
浏览文件 @
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
浏览文件 @
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
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录