1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

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> </ul>
</div> </div>
<div class="btn-group pull-right"> <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> </div>
</div> </div>

View File

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

View File

@ -815,3 +815,15 @@ div.tab-config-list-users {
padding: 1px 5px; 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%;
}