28 lines
846 B
JavaScript
28 lines
846 B
JavaScript
import BaseService from '../service';
|
|
import $ from 'jquery';
|
|
|
|
export default BaseService.extend({
|
|
modelName: 'ExportTask',
|
|
startup: function() {
|
|
const me = this;
|
|
$.on('WEBSOCKET', function(e, data) {
|
|
console.log('Export task: On websocket message trigger.', e, data);
|
|
if (!data) {
|
|
console.log('Event data is null, ignore.', e);
|
|
return;
|
|
}
|
|
|
|
me.set('countUndownloaded', data.countUndownloaded);
|
|
|
|
if (data.type == 'EXPORT_TASK_COMPLETED') {
|
|
if (data.success) {
|
|
me.get('message').alert('Export task completed.');
|
|
}
|
|
else {
|
|
me.get('message').error('Export task error caused: ' + data.message);
|
|
}
|
|
}
|
|
});
|
|
}
|
|
});
|