remote-save: let the server notify the client if it worked or not

This commit is contained in:
jean-emmanuel 2019-01-05 17:08:51 +01:00
parent 5374a91325
commit 8c59676e2b
3 changed files with 35 additions and 22 deletions

View file

@ -46,9 +46,9 @@ module.exports = {
},
sessionAllowRemoteSave: function(data){
sessionSaved: function(data){
session.allowRemoteSave = data
editor.unsavedSession = false
},
@ -180,6 +180,20 @@ module.exports = {
})
},
notify: function(data) {
var message = data.message || ''
if (data.locale) message = locales(data.locale) + message
notifications.add({
icon: data.icon,
class: data.class,
message: message
})
}
}

View file

@ -97,23 +97,7 @@ var SessionManager = class SessionManager {
save() {
if (this.allowRemoteSave) {
ipc.send('sessionSave', JSON.stringify(this.session, null, ' '))
notifications.add({
icon: 'save',
message: locales('session_savesuccess')
})
editor.unsavedSession = false
} else {
ipc.send('log', 'Could not save session file')
notifications.add({
class: 'error',
message: locales('session_saveerror')
})
}
ipc.send('sessionSave', JSON.stringify(this.session, null, ' '))
}