Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions app/controllers/app_groups_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ def show
@allow_set_status = policy(@new_app).toggle_status?
@allow_manage_access = policy(@app_group).manage_access?
@allow_see_infrastructure = policy(Infrastructure).show?
@allow_disable_app_tps = policy(@app_group).update?
@allow_see_helm_infrastructure = policy(HelmInfrastructure).show?
@allow_delete_barito_app = policy(@new_app).delete?
@allow_add_barito_app = policy(@new_app).create?
Expand Down Expand Up @@ -244,6 +245,10 @@ def update_redact_labels
end

def toggle_disable_app_tps
unless policy(@app_group).update?
return redirect_to app_group_path(@app_group)
end

@app_group.disable_app_tps = !@app_group.disable_app_tps
@app_group.save!

Expand Down
8 changes: 6 additions & 2 deletions app/views/app_groups/_applications.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ h4.mb-3 All Applications
table.table.table-hover.table-sm
thead
tr.d-flex
- if @show_log_and_cost_col || !@app_group.disable_app_tps
- if @show_log_and_cost_col && !@app_group.disable_app_tps
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we need to align the values in tbody as well if we change the alignment of label columns.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated ya @Abhinav1299

th.col-4 Name
- elsif @show_log_and_cost_col || !@app_group.disable_app_tps
th.col-5 Name
- else
th.col-6 Name
Expand All @@ -23,7 +25,9 @@ h4.mb-3 All Applications
tbody
- apps.each do |app|
tr.d-flex
- if @show_log_and_cost_col || !@app_group.disable_app_tps
- if @show_log_and_cost_col && !@app_group.disable_app_tps
td.col-4= app.name
- elsif @show_log_and_cost_col || !@app_group.disable_app_tps
td.col-5= app.name
- else
td.col-6= app.name
Expand Down
2 changes: 1 addition & 1 deletion app/views/app_groups/show.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@

dt.col-sm-2 Disable App TPS:
dd.col-sm-10
- if @allow_set_status
- if @allow_disable_app_tps
= check_box_tag "toggle_disable_app_tps_#{@app_group.id}", true, @app_group.disable_app_tps, data: { toggle: 'toggle', onstyle: 'success', on: 'Yes', off: 'No', id: @app_group.id, style: 'slow', size: 'small'}, onchange: "$('#form_toggle_disable_app_tps_#{@app_group.id}').submit();"
= form_tag toggle_disable_app_tps_app_group_path(@app_group), method: :patch, data: {confirm: "Are you sure ?"}, id: "form_toggle_disable_app_tps_#{@app_group.id}" do
= hidden_field_tag :toggle_disable_app_tps
Expand Down