Skip to content

Commit

Permalink
v0.9.1
Browse files Browse the repository at this point in the history
* better workflow
* small design changes
* zip updated
  • Loading branch information
countnazgul committed Jan 4, 2016
1 parent b7ecc15 commit 094bdce
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 78 deletions.
95 changes: 49 additions & 46 deletions backup-and-restore.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,61 +2,64 @@
<html lang="en">

<head>
<meta charset="utf-8">
<title>Backup and Restore Apps</title>
<meta name="author" content="[email protected]">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- <link rel="stylesheet" href="../../resources/autogenerated/qlikui.css"> -->
<!-- <link rel="stylesheet" href="../../resources/assets/client/client.css" media="all"> -->
<link rel="stylesheet" href="css/backup-and-restore.css">
<link rel="stylesheet" href="css/jquery.dataTables.min.css">
<script src="../../resources/assets/external/requirejs/require.js"></script>
<link rel="shortcut icon" type="image/png" href="/favicon.png"/>
<meta charset="utf-8">
<title>Backup and Restore Apps</title>
<meta name="author" content="[email protected]">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link id="favicon" rel="shortcut icon" type="image/png" href="./images/preview.png" />
<!-- <link rel="stylesheet" href="../../resources/autogenerated/qlikui.css"> -->
<!-- <link rel="stylesheet" href="../../resources/assets/client/client.css" media="all"> -->
<link rel="stylesheet" href="css/backup-and-restore.css">
<link rel="stylesheet" href="css/jquery.dataTables.min.css">
<script src="../../resources/assets/external/requirejs/require.js"></script>
</head>

<body>
<div class="main">
Qlik sense app
<select id="docList"></select>
<button id="open">Open</button> &nbsp
<img id="loadingImg" src="images/loading.gif" style="width: 21px; height: 21px; vertical-align: middle; display: inline-block">
<span id="openDoc">No active document</span>
</div>
<div class="main">
Qlik sense app
<select id="docList"></select>
<button id="open">Open</button> &nbsp
<img id="loadingImg" src="images/loading.gif" style="width: 21px; height: 21px; vertical-align: middle; display: inline-block">
<span id="openDoc">No active document</span>
<span id="version" style="float: right; color: gainsboro"></span>
</div>

<div class="main" class="media">
Backup file:
<input id="json" type="file">
<button id="go">Restore</button>
<button id="serialize">Backup</button>
</br>
</br>
<div id="prestatus"></div>
</div>
<div class="main" class="media">
Backup file:
<input id="json" type="file">
<button id="go">Restore</button>
<button id="serialize">Backup</button>
</br>
</br>
<div id="prestatus"></div>
</div>

<div>
<table id="resultTable" class="display compact">
<thead>
<tr>
<th>Object Type</th>
<th>Object Name</th>
<th>Object Id</th>
<th>Operation</th>
</tr>
</thead>
</table>
<div>
<table id="resultTable" class="display compact">
<thead>
<tr>
<th>Object Type</th>
<th>Object Name</th>
<th>Object Id</th>
<th>Operation</th>
</tr>
</thead>
</table>

</div>
</div>

<div>
<div class="main" id="status"></div>
<div class="main" id="download"></div>
<div id="dvTable"> </div>
<div style="margin-top:10px; font-size: 11px">
<span> Thanks to <a href="https://twitter.com/mindspank">Alexander Karlsson</a> for <a href="https://github.com/mindspank/qsocks">qsocks</a> and <a href="https://github.com/mindspank/serializeapp">serializeapp</a> </span>
</div>
<div>
<div class="main" id="status"></div>
<div class="main" id="download"></div>
<div id="dvTable"> </div>
<div style="margin-top:10px; font-size: 11px">
<span>Follow the project at </span><a id="branchlink" href="#">Qlik Branch</a>
<br>
<span> Thanks to <a href="https://twitter.com/mindspank">Alexander Karlsson</a> for <a href="https://github.com/mindspank/qsocks">qsocks</a> and <a href="https://github.com/mindspank/serializeapp">serializeapp</a> </span>
</div>
</div>

<script src="backup-and-restore.js"></script>
<script src="backup-and-restore.js"></script>
</body>

</html>
57 changes: 26 additions & 31 deletions backup-and-restore.js
Original file line number Diff line number Diff line change
Expand Up @@ -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']);
Expand Down Expand Up @@ -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({
Expand All @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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($("<option></option>")
.attr("value", docList[i].qDocId)
.text(docList[i].qDocName));
}

$('#loadingImg').css('display', 'none');
$('#open').prop('disabled', false);
})
Expand Down
3 changes: 2 additions & 1 deletion backup-and-restore.qext
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
{
"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",
"author": "[email protected]",
"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"
}
Expand Down
Binary file modified backup-and-restore.zip
Binary file not shown.

0 comments on commit 094bdce

Please sign in to comment.