Skip to content

Commit

Permalink
v0.9.0
Browse files Browse the repository at this point in the history
* add - "variables" support
* fix - no need to refresh the page to switch the apps
* zip updated with v0.9.0
  • Loading branch information
countnazgul committed Jan 3, 2016
1 parent f2243da commit b7ecc15
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 9 deletions.
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ This mashup provide both export the app to json and import the json file.
* measures
* snapshots
* bookmarks
* ***variables ( in the next release )***
* variables
* app properties - like name, thumbnail, description etc.
* load script
* fields
Expand Down Expand Up @@ -57,6 +57,13 @@ After the restore process is finished the app will be saved to preserve the chan
* press the "Restore" button and wait for the process to finish. After the process is done the result table will be populated with more detail about the objects that were processed.
* That's it! If you have the app already open just refresh the browser tabs where this app is open.

#### Change log
v0.9.0 (03/01/2016)
* add - "variables" support
* update - qsocks to v2.1.5
* update - serializeapp to v1.0.3
* fix - no need to refresh the page to switch the apps

Please report and issues in the [Github issue tracker](https://github.com/countnazgul/QS-backup-and-restore-app/issues)

![Screenshot](https://raw.githubusercontent.com/countnazgul/QS-backup-and-restore-app/master/images/backup_and_restore.png)
1 change: 1 addition & 0 deletions backup-and-restore.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<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"/>
</head>

<body>
Expand Down
75 changes: 68 additions & 7 deletions backup-and-restore.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ require(['jquery', 'qsocks', 'serializeApp', 'dataTables'], function($, qsocks,
case "measures":
case "snapshots":
case "bookmarks":
case "variables":
for (var i = 0; i < backupContent[name].length; i++) {
backupInfos.push({
info: backupContent[name][i].qInfo,
Expand Down Expand Up @@ -100,7 +101,6 @@ require(['jquery', 'qsocks', 'serializeApp', 'dataTables'], function($, qsocks,
if (present == true) {
status.forUpdate.push(d)
} else {

if (appInfos.qInfos[i].qType != 'folder' && appInfos.qInfos[i].qType != 'internet' && appInfos.qInfos[i].qType != 'ODBC' && appInfos.qInfos[i].qType != 'OLEDB') {
status.forDelete.push(appInfos.qInfos[i])
}
Expand Down Expand Up @@ -134,23 +134,23 @@ require(['jquery', 'qsocks', 'serializeApp', 'dataTables'], function($, qsocks,

function deleteObjects() {
return Promise.all(status.forDelete.map(function(d) {
//console.log('deleted123')
//console.log(d.qType)
if (d.qType === 'measure') {
return main.app.destroyMeasure(d.qId).then(function() {
return importData.push([d.qType, '', d.qId, 'delete']);
});
} else if (d.qType === 'dimension') {
return main.app.destroyDimension(d.qId).then(function() {
return importData.push([d.qType, '', d.qId, 'delete']);
});;
});
} else if (d.qType === 'snapshot' || d.qType === 'bookmark') {
return main.app.destoryBookmark(d.qId).then(function() {
return importData.push([d.qType, '', d.qId, 'delete']);
});;
});
} else if (d.qType === 'variable') {
return main.app.destroyVariableById(d.qId).then(function() {
return importData.push([d.qType, '', d.qId, 'delete']);
});;
});
} else {
return main.app.destroyObject(d.qId).then(function() {
return importData.push([d.qType, '', d.qId, 'delete']);
Expand All @@ -169,6 +169,10 @@ require(['jquery', 'qsocks', 'serializeApp', 'dataTables'], function($, qsocks,
return main.app.createDimension(d.data).then(function(msg) {
return importData.push(['dimension', d.data.qMetaDef.title, d.info.qId, 'create']);
})
} else if (d.info.qType === 'variable') {
return main.app.createVariableEx(d.data).then(function(msg) {
return importData.push(['variable', d.data.qName, d.info.qId, 'create']);
})
} else if (d.info.qType === 'snapshot' || d.info.qType === 'bookmark') {
return main.app.createBookmark(d.data).then(function(msg) {
var snapTitle;
Expand Down Expand Up @@ -203,6 +207,24 @@ require(['jquery', 'qsocks', 'serializeApp', 'dataTables'], function($, qsocks,
return importData.push(['dimension', d.data.qMetaDef.title, d.info.qId, 'modify']);
});
})
} 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']);
});
})
} else if (d.info.qType === 'snapshot' || d.info.qType === 'bookmark') {
return main.app.getBookmark(d.info.qId).then(function(obj) {
return obj.setProperties(d.data).then(function(msg) {
Expand Down Expand Up @@ -266,6 +288,31 @@ require(['jquery', 'qsocks', 'serializeApp', 'dataTables'], function($, qsocks,
})
}

function getVariables(app) {

return app.createSessionObject({
qVariableListDef: {
qType: 'variable',
qShowReserved: false,
qShowConfig: false,
qData: {
info: '/qDimInfos'
},
qMeta: {}
},
qInfo: { qId: "VariableList", qType: "VariableList" }
}).then(function (list) {
return list.getLayout().then(function (layout) {
return Promise.all(layout.qVariableList.qItems.map(function (d) {
return app.getVariableById(d.qInfo.qId).then(function (variable) {
return variable.getProperties().then(function(properties) { return properties; });
});
}));
});
});

};

$("#open").on("click", function() {
$('#openDoc').css('visibility', 'hidden');
$('#loadingImg').css('display', 'inline-block');
Expand All @@ -289,6 +336,7 @@ require(['jquery', 'qsocks', 'serializeApp', 'dataTables'], function($, qsocks,
.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 @@ -297,6 +345,18 @@ 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,
qType: variables[i].qInfo.qType
})
}

})

$('#json').prop('disabled', false);
$('#loadingImg').css('display', 'none');
$('#openDoc').css('visibility', 'visible');
Expand Down Expand Up @@ -350,12 +410,13 @@ require(['jquery', 'qsocks', 'serializeApp', 'dataTables'], function($, qsocks,
insertObjects(),
updateObjects(),
setScript(),
setAppProperties(),
main.app.doSave()
setAppProperties()
])
.then(function(results) {
main.app.doSave().then(function(results) {
GenerateTable()
});
});

})

Expand Down
2 changes: 1 addition & 1 deletion backup-and-restore.qext
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"type": "mashup",
"name": "Backup and Restore",
"version": "0.8.2",
"version": "0.9.0",
"description": "Bachup and restore QS app",
"preview": "images/preview.png",
"homepage": "https://github.com/countnazgul/QS-backup-and-restore-app",
Expand Down
Binary file modified backup-and-restore.zip
Binary file not shown.

0 comments on commit b7ecc15

Please sign in to comment.