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
bc669442
Unverified
Commit
bc669442
authored
Feb 07, 2017
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix stoppable?
parent
1664354c
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
18 additions
and
18 deletions
+18
-18
environment_item.js.es6
...vascripts/environments/components/environment_item.js.es6
+4
-4
merge_requests_controller.rb
app/controllers/projects/merge_requests_controller.rb
+1
-1
deployment.rb
app/models/deployment.rb
+1
-1
environment_entity.rb
app/serializers/environment_entity.rb
+1
-1
_stop.html.haml
app/views/projects/environments/_stop.html.haml
+1
-1
environment_item_spec.js.es6
spec/javascripts/environments/environment_item_spec.js.es6
+1
-1
mock_data.js.es6
spec/javascripts/environments/mock_data.js.es6
+5
-5
deployment_spec.rb
spec/models/deployment_spec.rb
+2
-2
environment_spec.rb
spec/models/environment_spec.rb
+2
-2
No files found.
app/assets/javascripts/environments/components/environment_item.js.es6
View file @
bc669442
...
...
@@ -147,12 +147,12 @@ require('./environment_terminal_button');
},
/**
* Returns the value of the `stop
pable
?` key provided in the response.
* Returns the value of the `stop
_action
?` key provided in the response.
*
* @returns {Boolean}
*/
isStoppable
() {
return this.model['stop
pable
?'];
hasStopAction
() {
return this.model['stop
_action
?'];
},
/**
...
...
@@ -508,7 +508,7 @@ require('./environment_terminal_button');
</external-url-component>
</div>
<div v-if="
isStoppable
&& canCreateDeployment"
<div v-if="
hasStopAction
&& canCreateDeployment"
class="inline js-stop-component-container">
<stop-component
:stop-url="model.stop_path">
...
...
app/controllers/projects/merge_requests_controller.rb
View file @
bc669442
...
...
@@ -451,7 +451,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController
deployment
=
environment
.
first_deployment_for
(
@merge_request
.
diff_head_commit
)
stop_url
=
if
environment
.
stop
pable
?
&&
can?
(
current_user
,
:create_deployment
,
environment
)
if
environment
.
stop
_action
?
&&
can?
(
current_user
,
:create_deployment
,
environment
)
stop_namespace_project_environment_path
(
project
.
namespace
,
project
,
environment
)
end
...
...
app/models/deployment.rb
View file @
bc669442
...
...
@@ -91,7 +91,7 @@ class Deployment < ActiveRecord::Base
@stop_action
||=
manual_actions
.
find_by
(
name:
on_stop
)
end
def
stop
pable
?
def
stop
_action
?
stop_action
.
present?
end
...
...
app/serializers/environment_entity.rb
View file @
bc669442
...
...
@@ -7,7 +7,7 @@ class EnvironmentEntity < Grape::Entity
expose
:external_url
expose
:environment_type
expose
:last_deployment
,
using:
DeploymentEntity
expose
:stop
pable
?
expose
:stop
_action
?
expose
:environment_path
do
|
environment
|
namespace_project_environment_path
(
...
...
app/views/projects/environments/_stop.html.haml
View file @
bc669442
-
if
can?
(
current_user
,
:create_deployment
,
environment
)
&&
environment
.
stop
pable
?
-
if
can?
(
current_user
,
:create_deployment
,
environment
)
&&
environment
.
stop
_action
?
.inline
=
link_to
stop_namespace_project_environment_path
(
@project
.
namespace
,
@project
,
environment
),
method: :post
,
class:
'btn stop-env-link'
,
rel:
'nofollow'
,
data:
{
confirm:
'Are you sure you want to stop this environment?'
}
do
...
...
spec/javascripts/environments/environment_item_spec.js.es6
View file @
bc669442
...
...
@@ -119,7 +119,7 @@ describe('Environment item', () => {
},
],
},
'stop
pable
?': true,
'stop
_action
?': true,
environment_path: 'root/ci-folders/environments/31',
created_at: '2016-11-07T11:11:16.525Z',
updated_at: '2016-11-10T15:55:58.778Z',
...
...
spec/javascripts/environments/mock_data.js.es6
View file @
bc669442
...
...
@@ -50,7 +50,7 @@ const environmentsList = [
},
manual_actions: [],
},
'stop
pable
?': true,
'stop
_action
?': true,
environment_path: '/root/ci-folders/environments/31',
created_at: '2016-11-07T11:11:16.525Z',
updated_at: '2016-11-07T11:11:16.525Z',
...
...
@@ -105,7 +105,7 @@ const environmentsList = [
},
manual_actions: [],
},
'stop
pable
?': false,
'stop
_action
?': false,
environment_path: '/root/ci-folders/environments/31',
created_at: '2016-11-07T11:11:16.525Z',
updated_at: '2016-11-07T11:11:16.525Z',
...
...
@@ -116,7 +116,7 @@ const environmentsList = [
state: 'available',
environment_type: 'review',
last_deployment: null,
'stop
pable
?': true,
'stop
_action
?': true,
environment_path: '/root/ci-folders/environments/31',
created_at: '2016-11-07T11:11:16.525Z',
updated_at: '2016-11-07T11:11:16.525Z',
...
...
@@ -127,7 +127,7 @@ const environmentsList = [
state: 'available',
environment_type: 'review',
last_deployment: null,
'stop
pable
?': true,
'stop
_action
?': true,
environment_path: '/root/ci-folders/environments/31',
created_at: '2016-11-07T11:11:16.525Z',
updated_at: '2016-11-07T11:11:16.525Z',
...
...
@@ -143,7 +143,7 @@ const environment = {
external_url: 'http://production.',
environment_type: null,
last_deployment: {},
'stop
pable
?': false,
'stop
_action
?': false,
environment_path: '/root/review-app/environments/4',
stop_path: '/root/review-app/environments/4/stop',
created_at: '2016-12-16T11:51:04.690Z',
...
...
spec/models/deployment_spec.rb
View file @
bc669442
...
...
@@ -77,8 +77,8 @@ describe Deployment, models: true do
end
end
describe
'#stop
pable
?'
do
subject
{
deployment
.
stop
pable
?
}
describe
'#stop
_action
?'
do
subject
{
deployment
.
stop
_action
?
}
context
'when no other actions'
do
let
(
:deployment
)
{
build
(
:deployment
)
}
...
...
spec/models/environment_spec.rb
View file @
bc669442
...
...
@@ -112,8 +112,8 @@ describe Environment, models: true do
end
end
describe
'#stop
pable
?'
do
subject
{
environment
.
stop
pable
?
}
describe
'#stop
_action
?'
do
subject
{
environment
.
stop
_action
?
}
context
'when no other actions'
do
it
{
is_expected
.
to
be_falsey
}
...
...
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