提交 0e1f39d8 编写于 作者: K Kamil Trzcinski

Allow to close environments

上级 c319cc5a
......@@ -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
......
......@@ -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)
......
......@@ -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
......
......@@ -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 },
]
......
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册