diff --git a/js/apps/system/aardvark/frontend/js/collections/foxxCollection.js b/js/apps/system/aardvark/frontend/js/collections/foxxCollection.js index d63a1b9520..b98a968dd8 100644 --- a/js/apps/system/aardvark/frontend/js/collections/foxxCollection.js +++ b/js/apps/system/aardvark/frontend/js/collections/foxxCollection.js @@ -27,6 +27,7 @@ result = true; }, error: function(data) { + console.log(data); result = false; } }); @@ -53,6 +54,26 @@ return result; }, + gitInfo: function (key) { + var result; + $.ajax({ + cache: false, + type: "GET", + async: false, // sequential calls! + url: "/_admin/aardvark/foxxes/gitinfo/"+key, + contentType: "application/json", + processData: false, + success: function(data) { + result = data; + }, + error: function(data) { + result = data; + } + }); + + return result; + }, + purgeFoxx: function (key) { var msg, url = "/_admin/aardvark/foxxes/purge/"+key; $.ajax({ diff --git a/js/apps/system/aardvark/frontend/js/views/foxxInstalledView.js b/js/apps/system/aardvark/frontend/js/views/foxxInstalledView.js index 063855ae13..998b6c9b9a 100644 --- a/js/apps/system/aardvark/frontend/js/views/foxxInstalledView.js +++ b/js/apps/system/aardvark/frontend/js/views/foxxInstalledView.js @@ -40,6 +40,14 @@ ) ]; var buttonInfoConfig = [ + window.modalView.createDeleteButton( + "Remove", this.confirmRemovalSingle.bind(this) + ), + window.modalView.createSuccessButton( + "Install", this.installDialog.bind(this) + ) + ]; + var buttonInfoConfigUpdate = [ window.modalView.createDeleteButton( "Remove", this.confirmRemovalSingle.bind(this) ), @@ -51,6 +59,17 @@ ) ]; var buttonInfoMultipleVersionsConfig = [ + window.modalView.createDeleteButton( + "Remove All", this.confirmRemovalAll.bind(this) + ), + window.modalView.createDeleteButton( + "Remove", this.confirmRemovalSingle.bind(this) + ), + window.modalView.createSuccessButton( + "Install", this.installDialog.bind(this) + ) + ]; + var buttonInfoMultipleVersionsConfigUpdate = [ window.modalView.createDeleteButton( "Remove All", this.confirmRemovalAll.bind(this) ), @@ -78,12 +97,24 @@ "Application Settings", buttonInfoConfig ); + this.showInfoModUpdate = window.modalView.show.bind( + window.modalView, + "modalTable.ejs", + "Application Settings", + buttonInfoConfigUpdate + ); this.showInfoMultipleVersionsMod = window.modalView.show.bind( window.modalView, "modalTable.ejs", "Application Settings", buttonInfoMultipleVersionsConfig ); + this.showInfoMultipleVersionsModUpdate = window.modalView.show.bind( + window.modalView, + "modalTable.ejs", + "Application Settings", + buttonInfoMultipleVersionsConfigUpdate + ); this.showSystemInfoMod = window.modalView.show.bind( window.modalView, "modalTable.ejs", @@ -267,7 +298,15 @@ }, infoDialog: function(event) { - var versions, isSystem = false; + var name = this.model.get("name"), + mountinfo = this.model.collection.gitInfo(name), + versions, isSystem = false, isGit; + + if (mountinfo.git === true) { + this.model.set("isGit", mountinfo.git); + this.model.set("gitUrl", mountinfo.url); + } + if (this.model.get("isSystem")) { isSystem = true; } else { @@ -275,14 +314,21 @@ } versions = this.model.get("versions"); + isGit = this.model.get("isGit"); event.stopPropagation(); - if (isSystem === false && !versions) { + if (isSystem === false && !versions && !isGit) { this.showInfoMod(this.fillInfoValues()); } - else if (isSystem === false && versions) { + else if (isSystem === false && !versions && isGit) { + this.showInfoModUpdate(this.fillInfoValues()); + } + else if (isSystem === false && versions && !isGit) { this.showInfoMultipleVersionsMod(this.fillInfoValues()); } + else if (isSystem === false && versions && isGit) { + this.showInfoMultipleVersionsModUpdate(this.fillInfoValues()); + } else { this.showSystemInfoMod(this.fillInfoValues()); } @@ -301,8 +347,7 @@ }, update: function() { - var url = this.model.get("git"), - name = '', + var url = this.model.get("gitUrl"), version = 'master', result; @@ -311,7 +356,7 @@ return; } - result = this.collection.installFoxxFromGithub(url, name, version); + result = this.model.collection.installFoxxFromGithub(url, name, version); if (result === true) { window.modalView.hide(); window.App.applicationsView.reload();