correctly display spinner when loading network proxies

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1308322 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2012-04-02 12:38:33 +00:00
parent a3507802bc
commit 77771ec721
1 changed files with 48 additions and 49 deletions

View File

@ -204,60 +204,59 @@ define("archiva.network-proxies",["jquery","i18n","jquery.tmpl","bootstrap","jqu
clearUserMessages(); clearUserMessages();
var mainContent = $("#main-content"); var mainContent = $("#main-content");
mainContent.html(mediumSpinnerImg()); mainContent.html(mediumSpinnerImg());
mainContent.html($("#networkProxiesMain").tmpl());
mainContent.find("#network-proxies-view-tabs a:first").tab('show');
var networkProxiesViewModel = new NetworkProxiesViewModel();
mainContent.find("#network-proxies-view-tabs").on('show', function (e) {
if ($(e.target).attr("href")=="#network-proxies-edit") {
var viewModel = new NetworkProxyViewModel(new NetworkProxy(),false,networkProxiesViewModel);
ko.applyBindings(viewModel,$("#main-content #network-proxies-edit").get(0));
activateNetworkProxyFormValidation();
clearUserMessages();
}
if ($(e.target).attr("href")=="#network-proxies-view") {
$("#main-content #network-proxies-view-tabs-li-edit a").html($.i18n.prop("add"));
clearUserMessages();
}
});
loadNetworkProxies( function(data) { loadNetworkProxies( function(data) {
networkProxiesViewModel.networkProxies(mapNetworkProxies(data)); var networkProxiesViewModel = new NetworkProxiesViewModel();
networkProxiesViewModel.gridViewModel = new ko.simpleGrid.viewModel({ mainContent.html($("#networkProxiesMain").tmpl());
data: networkProxiesViewModel.networkProxies, mainContent.find("#network-proxies-view-tabs a:first").tab('show');
columns: [
{ mainContent.find("#network-proxies-view-tabs").on('show', function (e) {
headerText: $.i18n.prop('identifier'), if ($(e.target).attr("href")=="#network-proxies-edit") {
rowText: "id" var viewModel = new NetworkProxyViewModel(new NetworkProxy(),false,networkProxiesViewModel);
}, ko.applyBindings(viewModel,$("#main-content #network-proxies-edit").get(0));
{ activateNetworkProxyFormValidation();
headerText: $.i18n.prop('protocol'), clearUserMessages();
rowText: "protocol" }
}, if ($(e.target).attr("href")=="#network-proxies-view") {
{ $("#main-content #network-proxies-view-tabs-li-edit a").html($.i18n.prop("add"));
headerText: $.i18n.prop('host'), clearUserMessages();
rowText: "host" }
},
{ });
headerText: $.i18n.prop('port'), networkProxiesViewModel.networkProxies(mapNetworkProxies(data));
rowText: "port" networkProxiesViewModel.gridViewModel = new ko.simpleGrid.viewModel({
}, data: networkProxiesViewModel.networkProxies,
{ columns: [
headerText: $.i18n.prop('username'), {
rowText: "username" headerText: $.i18n.prop('identifier'),
} rowText: "id"
], },
pageSize: 5, {
gridUpdateCallBack: function(networkProxy){ headerText: $.i18n.prop('protocol'),
$("#main-content #networkProxiesTable [title]").tooltip(); rowText: "protocol"
},
{
headerText: $.i18n.prop('host'),
rowText: "host"
},
{
headerText: $.i18n.prop('port'),
rowText: "port"
},
{
headerText: $.i18n.prop('username'),
rowText: "username"
} }
}); ],
ko.applyBindings(networkProxiesViewModel,$("#main-content #network-proxies-view").get(0)); pageSize: 5,
} gridUpdateCallBack: function(networkProxy){
$("#main-content #networkProxiesTable [title]").tooltip();
}
});
ko.applyBindings(networkProxiesViewModel,$("#main-content #network-proxies-view").get(0));
}
) )
} }