diff --git a/backup-and-restore.html b/backup-and-restore.html index fa609e5..bc4f41a 100644 --- a/backup-and-restore.html +++ b/backup-and-restore.html @@ -2,61 +2,64 @@ - - Backup and Restore Apps - - - - - - - - + + Backup and Restore Apps + + + + + + + + -
- Qlik sense app - -   - - No active document -
+
+ Qlik sense app + +   + + No active document + +
-
- Backup file: - - - -
-
-
-
+
+ Backup file: + + + +
+
+
+
-
- - - - - - - - - -
Object TypeObject NameObject IdOperation
+
+ + + + + + + + + +
Object TypeObject NameObject IdOperation
-
+
-
-
-
-
-
- Thanks to Alexander Karlsson for qsocks and serializeapp -
+
+
+
+
+
+ Follow the project at Qlik Branch +
+ Thanks to Alexander Karlsson for qsocks and serializeapp
+
- + diff --git a/backup-and-restore.js b/backup-and-restore.js index 84d7e87..23ae4da 100644 --- a/backup-and-restore.js +++ b/backup-and-restore.js @@ -208,18 +208,6 @@ require(['jquery', 'qsocks', 'serializeApp', 'dataTables'], function($, qsocks, }); }) } else if (d.info.qType === 'variable') { - // qDef = JSON.stringify(d.data.qDefinition); - // qName = JSON.stringify(d.data.qName); - // var patches = [{ - // "qOp": "replace", - // "qPath": "/qDefinition", - // "qValue": qDef - // },{ - // "qOp": "replace", - // "qPath": "/qName", - // "qValue": qName - // }]; - return main.app.getVariableById(d.info.qId).then(function(obj) { return obj.setProperties(d.data).then(function(msg) { return importData.push(['variable', d.data.qName, d.info.qId, 'modify']); @@ -314,29 +302,32 @@ require(['jquery', 'qsocks', 'serializeApp', 'dataTables'], function($, qsocks, }; $("#open").on("click", function() { + var table = $('#resultTable').DataTable(); + table + .clear() + .draw(); + $('#openDoc').css('visibility', 'hidden'); $('#loadingImg').css('display', 'inline-block'); var selectedApp = $('#docList').find(":selected").val(); selectedAppText = $('#docList').find(":selected").text(); - //if( main.app ) { - main.global.connection.ws.close(); - //} + try { + main.global.connection.ws.close(); + } catch(ex) { - qSocksConnect().then(function() { - main.global.openDoc(selectedApp) - .then(function(app) { - main.app = app; + } + qSocksConnect().then(function() { + main.global.openDoc(selectedApp).then(function(app) { + main.app = app; }) .then(function() { return main.app.getAllInfos() }) .then(function(info) { - appInfos = info; - //console.log(JSON.stringify(appInfos)) main.app.getConnections().then(function(connections) { for (var i = 0; i < connections.length; i++) { appInfos.qInfos.push({ @@ -346,8 +337,6 @@ require(['jquery', 'qsocks', 'serializeApp', 'dataTables'], function($, qsocks, } getVariables(main.app).then(function(variables) { - // console.log(variables) - for (var i = 0; i < variables.length; i++) { appInfos.qInfos.push({ qId: variables[i].qInfo.qId, @@ -367,6 +356,11 @@ require(['jquery', 'qsocks', 'serializeApp', 'dataTables'], function($, qsocks, }) }); + $.get('./backup-and-restore.qext', function(data) { + $('#version').text('version: '+ data.version) + $("#branchlink").attr("href", data.qlikbranch) + }) + $('#resultTable').DataTable({ "scrollY": "400px", "scrollCollapse": true, @@ -414,26 +408,27 @@ require(['jquery', 'qsocks', 'serializeApp', 'dataTables'], function($, qsocks, ]) .then(function(results) { main.app.doSave().then(function(results) { - GenerateTable() - }); + GenerateTable(); + $('#json').replaceWith( $("#json").clone() ); + $('#go').prop('disabled', true); + $('#serialize').prop('disabled', true); + $('#prestatus').html(''); + $('#json').prop('disabled', true); + $('#openDoc').text('No active document'); + main.global.connection.ws.close(); + }); }); - }) - // qsocks.Connect(appConfig).then(function(global) { - // return main.global = global; - // }) qSocksConnect().then(function() { return main.global.getDocList() }).then(function(docList) { - for (var i = 0; i < docList.length; i++) { $('#docList') .append($("") .attr("value", docList[i].qDocId) .text(docList[i].qDocName)); } - $('#loadingImg').css('display', 'none'); $('#open').prop('disabled', false); }) diff --git a/backup-and-restore.qext b/backup-and-restore.qext index 6387f82..317f722 100644 --- a/backup-and-restore.qext +++ b/backup-and-restore.qext @@ -1,7 +1,7 @@ { "type": "mashup", "name": "Backup and Restore", - "version": "0.9.0", + "version": "0.9.1", "description": "Bachup and restore QS app", "preview": "images/preview.png", "homepage": "https://github.com/countnazgul/QS-backup-and-restore-app", @@ -9,6 +9,7 @@ "keywords": "qlik-sense, mashup", "license": "", "repository": "https://github.com/countnazgul/QS-backup-and-restore-app.git", + "qlikbranch": "http://branch-test.qlik.com/#/project/56728f52d1e497241ae698c7", "dependencies": { "qlik-sense": ">=2.1.1" } diff --git a/backup-and-restore.zip b/backup-and-restore.zip index 4bce863..80bf900 100644 Binary files a/backup-and-restore.zip and b/backup-and-restore.zip differ