From: Olivier Lamy Date: Thu, 28 Jun 2012 08:29:49 +0000 (+0000) Subject: refresh artifacts view after deletion X-Git-Tag: archiva-1.4-M3~586 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=4abbc9105048f42f2bf8e6351272c1c8c7496f3c;p=archiva.git refresh artifacts view after deletion git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1354857 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/search.js b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/search.js index 00159c2b9..8c0ccc4e2 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/search.js +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/search.js @@ -278,7 +278,7 @@ define("search",["jquery","i18n","jquery.tmpl","choosen","order!knockout","knock artifactDownloadInfosUrl+="/"+encodeURIComponent(self.artifactId)+"/"+encodeURIComponent(self.version); artifactDownloadInfosUrl+="?repositoryId="+encodeURIComponent(getSelectedBrowsingRepository()); $.get(artifactDownloadInfosUrl,function(data){ - var artifactDetailsDownloadViewModel = new ArtifactDetailsDownloadViewModel(mapArtifacts(data)); + var artifactDetailsDownloadViewModel = new ArtifactDetailsDownloadViewModel(mapArtifacts(data),self); mainContent.find("#artifact-details-download-content" ).attr("data-bind",'template:{name:"artifact-details-download-content_tmpl"}'); ko.applyBindings(artifactDetailsDownloadViewModel,mainContent.find("#artifact-details-download-content" ).get(0)); }); @@ -387,8 +387,9 @@ define("search",["jquery","i18n","jquery.tmpl","choosen","order!knockout","knock } - ArtifactDetailsDownloadViewModel=function(artifacts){ + ArtifactDetailsDownloadViewModel=function(artifacts, artifactVersionDetailViewModel){ this.artifacts=ko.observableArray(artifacts); + this.artifactVersionDetailViewModel=artifactVersionDetailViewModel; var self=this; deleteArtifact=function(artifact){ @@ -404,6 +405,14 @@ define("search",["jquery","i18n","jquery.tmpl","choosen","order!knockout","knock success:function(data){ self.artifacts.remove(artifact); displaySuccessMessage( $.i18n.prop('artifact.deleted')); + // reload datas from server + var artifactDownloadInfosUrl = "restServices/archivaServices/browseService/artifactDownloadInfos/"+encodeURIComponent(self.artifactVersionDetailViewModel.groupId); + artifactDownloadInfosUrl+="/"+encodeURIComponent(self.artifactVersionDetailViewModel.artifactId)+"/"+encodeURIComponent(self.artifactVersionDetailViewModel.version); + artifactDownloadInfosUrl+="?repositoryId="+encodeURIComponent(getSelectedBrowsingRepository()); + $.get(artifactDownloadInfosUrl,function(data){ + self.artifacts(mapArtifacts(data)); + }); + }, error:function(data){ displayRestError(data,"user-messages");