Commit 0e1f39d8 authored by Kamil Trzcinski's avatar Kamil Trzcinski

Allow to close environments

parent c319cc5a
...@@ -16,9 +16,8 @@ ...@@ -16,9 +16,8 @@
- if local_assigns.fetch(:allow_close, false) && deployment.closeable? - if local_assigns.fetch(:allow_close, false) && deployment.closeable?
.inline .inline
%a.close-env-link.btn = 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
= 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')
= icon('stop', class: 'close-env-icon')
- if local_assigns.fetch(:allow_rollback, false) - if local_assigns.fetch(:allow_rollback, false)
= link_to [:retry, @project.namespace.becomes(Namespace), @project, deployment.deployable], method: :post, class: 'btn' do = link_to [:retry, @project.namespace.becomes(Namespace), @project, deployment.deployable], method: :post, class: 'btn' do
......
...@@ -7,12 +7,12 @@ ...@@ -7,12 +7,12 @@
%ul.nav-links %ul.nav-links
%li{class: ('active' if @scope.nil?)} %li{class: ('active' if @scope.nil?)}
= link_to project_environments_path(@project) do = link_to project_environments_path(@project) do
Availabe Available
%span.badge.js-avaibale-environments-count %span.badge.js-avaibale-environments-count
= number_with_delimiter(@all_environments.opened.count) = number_with_delimiter(@all_environments.opened.count)
%li{class: ('active' if @scope == 'closed')} %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 Stopped
%span.badge.js-stopped-environments-count %span.badge.js-stopped-environments-count
= number_with_delimiter(@all_environments.closed.count) = number_with_delimiter(@all_environments.closed.count)
......
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
= link_to 'Edit', edit_namespace_project_environment_path(@project.namespace, @project, @environment), class: 'btn' = link_to 'Edit', edit_namespace_project_environment_path(@project.namespace, @project, @environment), class: 'btn'
- if @environment.opened? && last_deployment.try(:close_action) - 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 '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? - if @deployments.blank?
.blank-state.blank-state-no-icon .blank-state.blank-state-no-icon
......
...@@ -17,6 +17,7 @@ class Gitlab::Seeder::Pipelines ...@@ -17,6 +17,7 @@ class Gitlab::Seeder::Pipelines
{ name: 'env:beta', stage: 'deploy', environment: 'beta', status: :running }, { name: 'env:beta', stage: 'deploy', environment: 'beta', status: :running },
{ name: 'env:gamma', stage: 'deploy', environment: 'gamma', status: :canceled }, { name: 'env:gamma', stage: 'deploy', environment: 'gamma', status: :canceled },
{ name: 'staging', stage: 'deploy', environment: 'staging', status_event: :success }, { 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: 'production', stage: 'deploy', environment: 'production', when: 'manual', status: :skipped },
{ name: 'slack', stage: 'notify', when: 'manual', status: :created }, { name: 'slack', stage: 'notify', when: 'manual', status: :created },
] ]
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # 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 # These are extensions that must be enabled in order to support this database
enable_extension "plpgsql" enable_extension "plpgsql"
...@@ -392,11 +392,12 @@ ActiveRecord::Schema.define(version: 20160926145521) do ...@@ -392,11 +392,12 @@ ActiveRecord::Schema.define(version: 20160926145521) do
create_table "environments", force: :cascade do |t| create_table "environments", force: :cascade do |t|
t.integer "project_id" t.integer "project_id"
t.string "name", null: false t.string "name", null: false
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
t.string "external_url" t.string "external_url"
t.string "environment_type" t.string "environment_type"
t.string "state", default: "opened", null: false
end end
add_index "environments", ["project_id", "name"], name: "index_environments_on_project_id_and_name", using: :btree add_index "environments", ["project_id", "name"], name: "index_environments_on_project_id_and_name", using: :btree
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment