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
70c65e82
Commit
70c65e82
authored
May 26, 2018
by
Dennis Tang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix case where token may expire
parent
2532dc74
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
3 deletions
+7
-3
app/controllers/projects/clusters_controller.rb
app/controllers/projects/clusters_controller.rb
+6
-2
app/views/projects/clusters/new.html.haml
app/views/projects/clusters/new.html.haml
+1
-1
No files found.
app/controllers/projects/clusters_controller.rb
View file @
70c65e82
...
...
@@ -171,8 +171,7 @@ class Projects::ClustersController < Projects::ApplicationController
end
def
new_cluster
if
GoogleApi
::
CloudPlatform
::
Client
.
new
(
token_in_session
,
nil
)
.
validate_token
(
expires_at_in_session
)
if
valid_gcp_token
@new_cluster
=
::
Clusters
::
Cluster
.
new
.
tap
do
|
cluster
|
cluster
.
build_provider_gcp
end
...
...
@@ -185,6 +184,11 @@ class Projects::ClustersController < Projects::ApplicationController
end
end
def
valid_gcp_token
@valid_gcp_token
=
GoogleApi
::
CloudPlatform
::
Client
.
new
(
token_in_session
,
nil
)
.
validate_token
(
expires_at_in_session
)
end
def
token_in_session
@token_in_session
||=
session
[
GoogleApi
::
CloudPlatform
::
Client
.
session_key_for_token
]
...
...
app/views/projects/clusters/new.html.haml
View file @
70c65e82
...
...
@@ -20,7 +20,7 @@
.tab-content.gitlab-tab-content
.tab-pane
{
id:
'create-new-cluster-pane'
,
class:
active_when
(
active_tab
==
'new'
),
role:
'tabpanel'
}
=
render
'projects/clusters/gcp/header'
-
if
@
token_in_sessio
n
-
if
@
valid_gcp_toke
n
=
render
'projects/clusters/gcp/form'
-
elsif
@authorize_url
=
link_to
@authorize_url
do
...
...
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