Browse Source

Fix backup/restore functions.

pull/3202/head
TheGoddessInari 6 years ago
parent
commit
55fe946f58
No known key found for this signature in database
GPG Key ID: 1209B1B7632D69A
  1. 20
      app/ux/FileBackup.js
  2. 5
      app/view/main/MainController.js

20
app/ux/FileBackup.js

@ -1,14 +1,16 @@
Ext.define('Rambox.ux.FileBackup', {
singleton: true,
initComponent: () => {
this.remote = require('electron').remote;
this.path = this.remote.require('path');
this.fs = this.remote.require('fs');
this.userPath = this.remote.app.getPath('userData');
this.defaultFileName = 'rambox-backup.json';
this.myDefaultPath = this.userPath + this.path.sep + this.defaultFileName;
constructor() {
const me = this;
me.callParent(arguments);
me.remote = require('electron').remote;
me.path = me.remote.require('path');
me.fs = me.remote.require('fs');
me.userPath = me.remote.app.getPath('userData');
me.defaultFileName = 'rambox-backup.json';
me.myDefaultPath = me.userPath + me.path.sep + me.defaultFileName;
},
backupConfiguration: function (callback) {
backupConfiguration(callback) {
var me = this;
let services = [];
Ext.getStore('Services').each(function(service) {
@ -31,7 +33,7 @@ Ext.define('Rambox.ux.FileBackup', {
});
if (Ext.isFunction(callback)) callback.bind(me)();
},
restoreConfiguration: function () {
restoreConfiguration() {
var me = this;
me.remote.dialog.showOpenDialog({
defaultPath: me.myDefaultPath,

5
app/view/main/MainController.js

@ -215,14 +215,15 @@ Ext.define('Rambox.view.main.MainController', {
}));
});
Promise.all(promises)
.then(function(value) {
.then(function(resolve) {
if ( Ext.isFunction(callback) ) callback();
return resolve;
})
.catch(function(err) {
console.error('Error removing services: ' + err);
Ext.Msg.alert('Error!','Error removing services: ' + err);
})
.then(function() { // Replace when Promise.finally when available.
.finally(function() {
store.resumeEvent('childmove');
store.resumeEvent('remove');
document.title = 'Rambox-OS';

Loading…
Cancel
Save