BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
35e2315a
Commit
35e2315a
authored
Oct 12, 2016
by
Z.J. van de Weg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor style improvement
parent
4b40027b
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
16 deletions
+28
-16
merge_requests_controller.rb
app/controllers/projects/merge_requests_controller.rb
+6
-14
deployment.rb
app/models/deployment.rb
+4
-0
environment.rb
app/models/environment.rb
+7
-1
schema.rb
db/schema.rb
+11
-1
No files found.
app/controllers/projects/merge_requests_controller.rb
View file @
35e2315a
...
@@ -404,30 +404,22 @@ class Projects::MergeRequestsController < Projects::ApplicationController
...
@@ -404,30 +404,22 @@ class Projects::MergeRequestsController < Projects::ApplicationController
end
end
def
ci_environments_status
def
ci_environments_status
environments
=
environments
=
begin
begin
@merge_request
.
environments
.
map
do
|
environment
|
@merge_request
.
environments
.
map
do
|
environment
|
next
unless
can?
(
current_user
,
:read_environment
,
environment
)
next
unless
can?
(
current_user
,
:read_environment
,
environment
)
deployment
=
environment
.
first_deployment_for
(
@merge_request
.
diff_head_commit
)
deployment
=
environment
.
first_deployment_for
(
@merge_request
.
diff_head_commit
)
environment_data
=
{
{
name:
environment
.
name
,
id:
environment
.
id
,
id:
environment
.
id
,
name:
environment
.
name
,
url:
namespace_project_environment_path
(
@project
.
namespace
,
@project
,
environment
),
url:
namespace_project_environment_path
(
@project
.
namespace
,
@project
,
environment
),
external_url:
environment
.
external_url
,
external_url:
environment
.
external_url
,
deployed_at:
deployment
?
deployment
.
created_at
:
nil
external_url_formatted:
environment
.
formatted_external_url
,
deployed_at:
deployment
.
try
(
:created_at
),
deployed_at_formatted:
deployment
.
try
(
:formatted_deployment_time
)
}
}
if
environment_data
[
:external_url
]
environment_data
[
:external_url_formatted
]
=
environment_data
[
:external_url
].
gsub
(
/\A.*?:\/\//
,
''
)
end
if
environment_data
[
:deployed_at
]
environment_data
[
:deployed_at_formatted
]
=
environment_data
[
:deployed_at
].
to_time
.
in_time_zone
.
to_s
(
:medium
)
end
environment_data
end
.
compact
end
.
compact
end
end
...
...
app/models/deployment.rb
View file @
35e2315a
...
@@ -84,6 +84,10 @@ class Deployment < ActiveRecord::Base
...
@@ -84,6 +84,10 @@ class Deployment < ActiveRecord::Base
take
take
end
end
def
formatted_deployment_time
created_at
.
to_time
.
in_time_zone
.
to_s
(
:medium
)
end
private
private
def
ref_path
def
ref_path
...
...
app/models/environment.rb
View file @
35e2315a
...
@@ -53,11 +53,17 @@ class Environment < ActiveRecord::Base
...
@@ -53,11 +53,17 @@ class Environment < ActiveRecord::Base
return
nil
unless
ref
return
nil
unless
ref
deployment_id
=
ref
.
split
(
'/'
).
last
.
to_i
deployment_id
=
ref
.
split
(
'/'
).
last
deployments
.
find
(
deployment_id
)
deployments
.
find
(
deployment_id
)
end
end
def
ref_path
def
ref_path
"refs/environments/
#{
Shellwords
.
shellescape
(
name
)
}
"
"refs/environments/
#{
Shellwords
.
shellescape
(
name
)
}
"
end
end
def
formatted_external_url
return
nil
unless
external_url
external_url
.
gsub
(
/\A.*?:\/\//
,
''
)
end
end
end
db/schema.rb
View file @
35e2315a
...
@@ -446,6 +446,17 @@ ActiveRecord::Schema.define(version: 20161007133303) do
...
@@ -446,6 +446,17 @@ ActiveRecord::Schema.define(version: 20161007133303) do
add_index
"identities"
,
[
"user_id"
],
name:
"index_identities_on_user_id"
,
using: :btree
add_index
"identities"
,
[
"user_id"
],
name:
"index_identities_on_user_id"
,
using: :btree
create_table
"integrations"
,
force: :cascade
do
|
t
|
t
.
integer
"project_id"
t
.
string
"name"
t
.
string
"external_token"
t
.
datetime
"created_at"
,
null:
false
t
.
datetime
"updated_at"
,
null:
false
end
add_index
"integrations"
,
[
"external_token"
],
name:
"index_integrations_on_external_token"
,
unique:
true
,
using: :btree
add_index
"integrations"
,
[
"project_id"
],
name:
"index_integrations_on_project_id"
,
using: :btree
create_table
"issue_metrics"
,
force: :cascade
do
|
t
|
create_table
"issue_metrics"
,
force: :cascade
do
|
t
|
t
.
integer
"issue_id"
,
null:
false
t
.
integer
"issue_id"
,
null:
false
t
.
datetime
"first_mentioned_in_commit_at"
t
.
datetime
"first_mentioned_in_commit_at"
...
@@ -613,7 +624,6 @@ ActiveRecord::Schema.define(version: 20161007133303) do
...
@@ -613,7 +624,6 @@ ActiveRecord::Schema.define(version: 20161007133303) do
t
.
datetime
"updated_at"
,
null:
false
t
.
datetime
"updated_at"
,
null:
false
end
end
add_index
"merge_request_metrics"
,
[
"first_deployed_to_production_at"
],
name:
"index_merge_request_metrics_on_first_deployed_to_production_at"
,
using: :btree
add_index
"merge_request_metrics"
,
[
"merge_request_id"
],
name:
"index_merge_request_metrics"
,
using: :btree
add_index
"merge_request_metrics"
,
[
"merge_request_id"
],
name:
"index_merge_request_metrics"
,
using: :btree
create_table
"merge_requests"
,
force: :cascade
do
|
t
|
create_table
"merge_requests"
,
force: :cascade
do
|
t
|
...
...
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