summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2016-10-06 14:16:03 +0200
committerKamil Trzcinski <ayufan@ayufan.eu>2016-10-06 14:16:03 +0200
commit0e1f39d8cee3a6d23fccb195f8257178df840805 (patch)
tree6e84589c4c567e69680718b911b075c53d188687
parentc319cc5ab5064459aaf803ee719a08e9663726ea (diff)
downloadgitlab-ce-0e1f39d8cee3a6d23fccb195f8257178df840805.tar.gz
Allow to close environments
-rw-r--r--app/views/projects/deployments/_actions.haml5
-rw-r--r--app/views/projects/environments/index.html.haml4
-rw-r--r--app/views/projects/environments/show.html.haml1
-rw-r--r--db/fixtures/development/14_pipelines.rb1
-rw-r--r--db/schema.rb5
5 files changed, 8 insertions, 8 deletions
diff --git a/app/views/projects/deployments/_actions.haml b/app/views/projects/deployments/_actions.haml
index 2d9c229ed5b..7b7e37353e3 100644
--- a/app/views/projects/deployments/_actions.haml
+++ b/app/views/projects/deployments/_actions.haml
@@ -16,9 +16,8 @@
- if local_assigns.fetch(:allow_close, false) && deployment.closeable?
.inline
- %a.close-env-link.btn
- = link_to [:play, @project.namespace.becomes(Namespace), @project, deployment.close_action], method: :post, rel: 'nofollow', data: { confirm: 'Are you sure you want to close this environment?' } do
- = icon('stop', class: 'close-env-icon')
+ = link_to [:play, @project.namespace.becomes(Namespace), @project, deployment.close_action], method: :post, class: 'btn close-env-link', rel: 'nofollow', data: { confirm: 'Are you sure you want to close this environment?' } do
+ = icon('stop', class: 'close-env-icon')
- if local_assigns.fetch(:allow_rollback, false)
= link_to [:retry, @project.namespace.becomes(Namespace), @project, deployment.deployable], method: :post, class: 'btn' do
diff --git a/app/views/projects/environments/index.html.haml b/app/views/projects/environments/index.html.haml
index 702cccd6ab3..11e2ff506b4 100644
--- a/app/views/projects/environments/index.html.haml
+++ b/app/views/projects/environments/index.html.haml
@@ -7,12 +7,12 @@
%ul.nav-links
%li{class: ('active' if @scope.nil?)}
= link_to project_environments_path(@project) do
- Availabe
+ Available
%span.badge.js-avaibale-environments-count
= number_with_delimiter(@all_environments.opened.count)
%li{class: ('active' if @scope == 'closed')}
- = link_to project_environments_path(@project, scope: :stopped) do
+ = link_to project_environments_path(@project, scope: :closed) do
Stopped
%span.badge.js-stopped-environments-count
= number_with_delimiter(@all_environments.closed.count)
diff --git a/app/views/projects/environments/show.html.haml b/app/views/projects/environments/show.html.haml
index 5f4a0ef082c..4981b95a19b 100644
--- a/app/views/projects/environments/show.html.haml
+++ b/app/views/projects/environments/show.html.haml
@@ -14,7 +14,6 @@
= link_to 'Edit', edit_namespace_project_environment_path(@project.namespace, @project, @environment), class: 'btn'
- if @environment.opened? && last_deployment.try(:close_action)
= link_to 'Close', [:play, @project.namespace.becomes(Namespace), @project, last_deployment.close_action], data: { confirm: 'Are you sure you want to close this environment?' }, class: 'btn btn-danger', method: :post
- = link_to 'Destroy', namespace_project_environment_path(@project.namespace, @project, @environment), data: { confirm: 'Are you sure you want to delete this environment?' }, class: 'btn btn-danger', method: :delete
- if @deployments.blank?
.blank-state.blank-state-no-icon
diff --git a/db/fixtures/development/14_pipelines.rb b/db/fixtures/development/14_pipelines.rb
index 803cbca584d..d3fabe111a1 100644
--- a/db/fixtures/development/14_pipelines.rb
+++ b/db/fixtures/development/14_pipelines.rb
@@ -17,6 +17,7 @@ class Gitlab::Seeder::Pipelines
{ name: 'env:beta', stage: 'deploy', environment: 'beta', status: :running },
{ name: 'env:gamma', stage: 'deploy', environment: 'gamma', status: :canceled },
{ name: 'staging', stage: 'deploy', environment: 'staging', status_event: :success },
+ { name: 'close staging', stage: 'deploy', environment: 'staging', when: 'manual', status: :skipped, options: { environment: { close: true } } },
{ name: 'production', stage: 'deploy', environment: 'production', when: 'manual', status: :skipped },
{ name: 'slack', stage: 'notify', when: 'manual', status: :created },
]
diff --git a/db/schema.rb b/db/schema.rb
index ad62c249b3f..b9dc5b5f895 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema.define(version: 20160926145521) do
+ActiveRecord::Schema.define(version: 20161006104309) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@@ -392,11 +392,12 @@ ActiveRecord::Schema.define(version: 20160926145521) do
create_table "environments", force: :cascade do |t|
t.integer "project_id"
- t.string "name", null: false
+ t.string "name", null: false
t.datetime "created_at"
t.datetime "updated_at"
t.string "external_url"
t.string "environment_type"
+ t.string "state", default: "opened", null: false
end
add_index "environments", ["project_id", "name"], name: "index_environments_on_project_id_and_name", using: :btree