Skip to content

Commit

Permalink
Added possibility to restart all failed hosts without checking any (#…
Browse files Browse the repository at this point in the history
…1408)

* Added possibility to restart all failed hosts without checking any

* Added modal window to confirm retrying deployment

* Changed naming in buttons

* Deleted class checked-hosts-btn

* Restored disabling buttons for not selected hosts
  • Loading branch information
vitalii-honchar authored Jan 22, 2024
1 parent 94c9105 commit 8163211
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 14 deletions.
8 changes: 8 additions & 0 deletions deploy-board/deploy_board/static/css/deploy-board.css
Original file line number Diff line number Diff line change
Expand Up @@ -342,3 +342,11 @@ body {
vertical-align: middle;
margin-top: 3px;
}

.mr-1 {
margin-right: 5px;
}

.ml-1 {
margin-left: 5px;
}
51 changes: 37 additions & 14 deletions deploy-board/deploy_board/templates/hosts/hosts.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,27 @@
<strong>Deploy:</strong><a href="/deploy/{{ deployId }}"> {{ deployId }}</a>
<div class="btn-toolbar pull-right">
<button id="pauseButton"
class="btn btn-default btn-sm" data-toggle="tooltip"
class="btn btn-default btn-sm checked-hosts-btn" data-toggle="tooltip"
title="Pause selected hosts">
<span class="glyphicon glyphicon-pause"></span> Pause
</button>
<button id="resumeButton"
class="btn btn-default btn-sm" data-toggle="tooltip"
class="btn btn-default btn-sm checked-hosts-btn" data-toggle="tooltip"
title="Resume selected hosts">
<span class="glyphicon glyphicon-play"></span> Resume
</button>
<button id="resetButton"
class="btn btn-default btn-sm" data-toggle="tooltip"
class="btn btn-default btn-sm checked-hosts-btn" data-toggle="tooltip"
title="reset selected hosts">
<span class="glyphicon glyphicon-repeat"></span> Reset
</button>
<button id="terminateButton"
class="btn btn-default btn-sm" data-toggle="tooltip"
class="btn btn-default btn-sm checked-hosts-btn" data-toggle="tooltip"
title="Soft terminate selected hosts">
<span class="glyphicon glyphicon-off"></span> Terminate
</button>
<button id="forceTerminateButton"
class="btn btn-default btn-sm" data-toggle="tooltip"
class="btn btn-default btn-sm checked-hosts-btn" data-toggle="tooltip"
title="Soft terminate selected hosts">
<span class="glyphicon glyphicon-remove"></span> Force Terminate
</button>
Expand Down Expand Up @@ -85,17 +85,17 @@

<div class="panel-footer clearfix">
{% if is_retryable and host_ids %}
<div class="pull-left">
<div class="pull-left mr-1">
<button id="reset_{{ deployId }}"
class="deployToolTip btn btn-primary" data-toggle="tooltip"
title="Retry the current deploy step on this host.">
Retry deploy on all hosts
title="Retry deploys on all failed hosts.">
Retry current deploy on all failed hosts
</button>
</div>
{% endif %}

{% if pinterest and host_ids %}
<div class="pull-left">
<div class="pull-left ml-1">
<button class="deployToolTip btn btn-default btn-block" data-target="#terminateHost"
data-toggle="modal" title="Terminate all failed hosts">
<span class="glyphicon glyphicon-remove"></span> Terminate failed hosts
Expand All @@ -108,7 +108,12 @@

$(function () {
$('.deployToolTip').tooltip();
$('#reset_{{ deployId }}').click(function () {

$("#reset_{{ deployId }}").on("click", function() {
$('#resetAllFailedDeploysModal').modal();
});

$('#resetAllFailedDeploys').click(function () {
$.ajax({
type: 'POST',
url: '/env/{{ env.envName }}/{{ env.stageName }}/reset_failed_hosts/{{ deployId }}/',
Expand All @@ -124,9 +129,9 @@

$('#hostTable input[type="checkbox"]').click(function(){
if ($("#hostTable input:checkbox:checked").length <= 0) {
$(".btn").prop("disabled", true);
$(".checked-hosts-btn").prop("disabled", true);
} else {
$(".btn").prop("disabled", false);
$(".checked-hosts-btn").prop("disabled", false);
}

if ($(this).is(":checked")) {
Expand All @@ -147,9 +152,9 @@
});

if ($("#hostTable input:checkbox:checked").length <= 0) {
$(".btn").prop("disabled", true);
$(".checked-hosts-btn").prop("disabled", true);
} else {
$(".btn").prop("disabled", false);
$(".checked-hosts-btn").prop("disabled", false);
}
});

Expand Down Expand Up @@ -321,3 +326,21 @@
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->

<div class="modal fade" id="resetAllFailedDeploysModal" tabindex="-1" role="dialog" aria-labelledby="newEntryModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
<h4 class="modal-title">Retry current deploy on all failed hosts confirmation</h4>
</div>
<div class="modal-body">
<p>Are you sure to retry the current deploy on all failed hosts?</p>
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-warning" id="resetAllFailedDeploys">Retry current deploy on all failed hosts</button>
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->

0 comments on commit 8163211

Please sign in to comment.