Skip to content

Commit

Permalink
Update backup-and-restore.js
Browse files Browse the repository at this point in the history
if ticket is present in the url - pass it to qSocks
  • Loading branch information
countnazgul committed Mar 9, 2016
1 parent 458e7f8 commit 30b4d0d
Showing 1 changed file with 27 additions and 4 deletions.
31 changes: 27 additions & 4 deletions backup-and-restore.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,23 @@ var main = {};

require(['jquery', 'qsocks', 'serializeApp', 'dataTables'], function($, qsocks, serializeApp, DataTable) {

var getUrlParameter = function getUrlParameter(sParam) {
var sPageURL = decodeURIComponent(window.location.search.substring(1)),
sURLVariables = sPageURL.split('&'),
sParameterName,
i;

for (i = 0; i < sURLVariables.length; i++) {
sParameterName = sURLVariables[i].split('=');

if (sParameterName[0] === sParam) {
return sParameterName[1] === undefined ? true : sParameterName[1];
}
}
};

var ticket = getUrlParameter('qlikTicket');

$('#open').prop('disabled', true);
$('#go').prop('disabled', true);
$('#serialize').prop('disabled', true);
Expand Down Expand Up @@ -275,10 +292,16 @@ require(['jquery', 'qsocks', 'serializeApp', 'dataTables'], function($, qsocks,
if(selectedApp) {
appConfig.appname = selectedApp;
}
return qsocks.Connect(appConfig).then(function(global) {
return main.global = global;
})
}

if(ticket) {
appConfig.ticket = ticket;
console.log(ticket)
}

return qsocks.Connect(appConfig).then(function(global) {
return main.global = global;
})
}

function getVariables(app) {

Expand Down

0 comments on commit 30b4d0d

Please sign in to comment.