Add deploy-in-action spinner

This commit is contained in:
Nick O'Leary 2014-02-20 17:31:40 +00:00
parent d97e23947d
commit ed9ce1bb3c
3 changed files with 21 additions and 3 deletions

View File

@ -68,7 +68,7 @@
</ul>
</div>
<div class="btn-group pull-right">
<a id="btn-deploy" class="btn action-deploy disabled" href="#"><i class="icon-upload"></i> Deploy</a>
<a id="btn-deploy" class="btn action-deploy disabled" href="#"><i id="btn-icn-deploy" class="icon-upload"></i> Deploy</a>
</div>
</div>
</div>

View File

@ -75,12 +75,17 @@ var RED = function() {
}
}
var nns = RED.nodes.createCompleteNodeSet();
$("#btn-icn-deploy").removeClass('icon-upload');
$("#btn-icn-deploy").addClass('spinner');
RED.view.dirty(false);
d3.xhr("flows").header("Content-type", "application/json")
.post(JSON.stringify(nns),function(err,resp) {
$("#btn-icn-deploy").removeClass('spinner');
$("#btn-icn-deploy").addClass('icon-upload');
if (resp && resp.status == 204) {
RED.notify("Successfully deployed","success");
RED.view.dirty(false);
RED.nodes.eachNode(function(node) {
if (node.changed) {
node.dirty = true;
@ -91,6 +96,7 @@ var RED = function() {
RED.history.markAllDirty();
RED.view.redraw();
} else {
RED.view.dirty(true);
if (resp) {
RED.notify("<strong>Error</strong>: "+resp,"error");
} else {

View File

@ -815,3 +815,15 @@ div.tab-config-list-users {
padding: 1px 5px;
}
i.spinner {
display: inline-block;
width: 14px;
height: 14px;
line-height: 14px;
vertical-align: text-top;
margin-top: 0px;
background: url(spin.gif) no-repeat 50% 50%;
}