X-Git-Url: http://git.onelab.eu/?p=plstackapi.git;a=blobdiff_plain;f=planetstack%2Fcore%2Fxoslib%2Fstatic%2Fjs%2FxosTenant.js;h=4225caccbc54bf9e311c96361ba755d8d26d8348;hp=79e093e16ed50e09a17a55588b539db0ac373c3c;hb=8ce133b9805597522ff5957d6a879f9b078787eb;hpb=c2aea9f6a5d307c293f05d7d61e2e7c30fc32c8c diff --git a/planetstack/core/xoslib/static/js/xosTenant.js b/planetstack/core/xoslib/static/js/xosTenant.js index 79e093e..4225cac 100644 --- a/planetstack/core/xoslib/static/js/xosTenant.js +++ b/planetstack/core/xoslib/static/js/xosTenant.js @@ -297,25 +297,8 @@ XOSTenantApp.editUsers = function(model) { $("#tenant-edit-users-dialog").dialog("open"); }; -XOSTenantApp.downloadSSHOld = function(model) { - sshCommands = ""; - for (index in model.attributes.sliceInfo.sshCommands) { - sshCommand = model.attributes.sliceInfo.sshCommands[index]; - sshCommands = sshCommands + sshCommand + "\n"; - } - - if (sshCommands.length == 0) { - alert("this slice has no instantiated slivers yet"); - return; - } - - var myWindow = window.open("", "ssh_command_list",""); // "width=640, height=480"); - myWindow.document.write("SSH Commands
" + sshCommands + "
"); - myWindow.document.close(); -}; - XOSTenantApp.downloadSSH = function(model) { - sshCommands = ""; + var sshCommands = ""; for (index in model.attributes.sliceInfo.sshCommands) { sshCommand = model.attributes.sliceInfo.sshCommands[index]; sshCommands = sshCommands + sshCommand + "\n"; @@ -334,7 +317,15 @@ XOSTenantApp.downloadSSH = function(model) { modal: true, width: 640, buttons : { - "Ok" : function() { + "Download": function() { + var dlLink = document.createElement('a'); + dlLink.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(sshCommands)); + dlLink.setAttribute('download', 'sshcommands.txt'); + dlLink.click(); + + //window.open('data:text/text,' + encodeURIComponent(sshCommands)); + }, + "Close" : function() { $(this).dialog("close"); }, }