Skip to content

Commit

Permalink
Fixed update issues when showing update progress
Browse files Browse the repository at this point in the history
  • Loading branch information
davidfowl committed Jul 31, 2011
1 parent f86ae1e commit cfa17b8
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 13 deletions.
2 changes: 2 additions & 0 deletions Kudu.Core/Deployment/DeployResult.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using System;
using System.Diagnostics;

namespace Kudu.Core.Deployment {
[DebuggerDisplay("{Id} {Status}")]
public class DeployResult {
public string Id { get; set; }
public DeployStatus Status { get; set; }
Expand Down
6 changes: 4 additions & 2 deletions Kudu.Web/Hubs/SourceControl/SourceControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ public SourceControl(IRepository repository,
_repositoryManager = repositoryManager;
_deploymentManager = deploymentManager;

connection.Received += OnDeploymentStatusChanged;
connection.Start();
if (!connection.IsActive) {
connection.Received += OnDeploymentStatusChanged;
connection.Start();
}
}

public ChangeSetDetailViewModel Show(string id) {
Expand Down
6 changes: 5 additions & 1 deletion Kudu.Web/Hubs/SourceControl/SourceControl.css
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
#scm .icon-notext {
background-repeat: no-repeat;
background-position: 0 50%;
padding-left: 10px;
padding-left: 12px;
line-height: 20px;
}

Expand Down Expand Up @@ -151,6 +151,10 @@
background-image: url('../../../images/folder_table.png');
}

#scm .icon-tick {
background-image: url('../../../images/tick.png');
}

#scm .icon-message {
list-style-image: url('../../../images/tick.png');
}
Expand Down
25 changes: 19 additions & 6 deletions Kudu.Web/Hubs/SourceControl/SourceControl.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ $(function () {

var infiniteScrollCheck = false;
var changesXhr = null;
var loadingRepository = false;
var pageSize = 15;

function getDiffClass(type) {
Expand Down Expand Up @@ -83,6 +84,13 @@ $(function () {
// Add the cross cutting data
this.branches = scm.branches[this.Id];
this.deploymentInfo = scm.deployments[this.Id];
this.showDeploy = !this.Active &&
this.deploymentInfo &&
this.deploymentInfo.Status == 'Success';

this.showLoading = this.deploymentInfo &&
this.deploymentInfo.Status !== 'Success' &&
this.deploymentInfo.Status !== 'Failed';
});

$('#changes').append($('#changeset').render(changes));
Expand Down Expand Up @@ -203,6 +211,8 @@ $(function () {
}

function loadRepository(onComplete) {
loadingRepository = true;

$('#show').hide();
$('#working').hide();
$('#deploy-log').hide();
Expand All @@ -222,6 +232,8 @@ $(function () {
getChangeSets(0, function () {
window.loader.hide(token);

loadingRepository = false;

if (onComplete) {
onComplete();
}
Expand All @@ -235,6 +247,7 @@ $(function () {
.fail(function (e) {
onError(e);
window.loader.hide(token);
loadingRepository = false;
});
}

Expand Down Expand Up @@ -412,13 +425,13 @@ $(function () {
initialize();

scm.updateDeployStatus = function (result) {
if (!document.getElementById(result.Id)) {
loadRepository(function () {
if (loadingRepository === false) {
if (!document.getElementById(result.Id)) {
loadRepository();
}
else {
updateStatus(result);
});
}
else if (changesXhr == null) {
updateStatus(result);
}
}
};

Expand Down
7 changes: 3 additions & 4 deletions Kudu.Web/Views/Application/Scm.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
<div id="status">
</div>
</div>

<table id="log">
<thead>
<tr>
Expand Down Expand Up @@ -113,11 +112,11 @@
{{if deploymentInfo }}
<a href="#/view-log/${Id}" class="view-log">view log</a>
{{/if}}
<a href="#" class="update deploy${!Active && deploymentInfo && deploymentInfo.Status == 'Success' ? "" : " hide"}" data-id="${Id}">deploy</a>
<a href="#" class="update deploy${showDeploy ? "" : " hide"}" data-id="${Id}">deploy</a>
</td>
<td>
<span class="loading hide icon-notext icon-loading">&nbsp;</span>
<img class="status${Active ? "" : " hide"}" src="@Url.Content("~/images/tick.png")" />
<span class="loading icon-notext icon-loading${showLoading ? "" : " hide"}">&nbsp;</span>
<span class="status icon-notext icon-tick${Active ? "" : " hide"}">&nbsp;</span>
</td>
</tr>
</script>
Expand Down

0 comments on commit cfa17b8

Please sign in to comment.