2013-09-11 06:33:47 +00:00
|
|
|
|
'use strict';
|
2013-09-02 02:55:45 +00:00
|
|
|
|
define(
|
|
|
|
|
[
|
2013-09-11 06:33:47 +00:00
|
|
|
|
'app',
|
2013-09-02 02:55:45 +00:00
|
|
|
|
'backbone',
|
|
|
|
|
'Shared/Messenger',
|
|
|
|
|
'Mixins/backbone.signalr.mixin'
|
2013-09-11 06:33:47 +00:00
|
|
|
|
], function (App, Backbone, Messenger) {
|
2013-09-02 02:55:45 +00:00
|
|
|
|
|
|
|
|
|
var ProgressMessageCollection = Backbone.Collection.extend({
|
|
|
|
|
url : window.ApiRoot + '/progressmessage',
|
2013-09-11 06:33:47 +00:00
|
|
|
|
model: Backbone.Model,
|
|
|
|
|
|
|
|
|
|
initialize: function(){
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2013-09-02 02:55:45 +00:00
|
|
|
|
});
|
|
|
|
|
|
2013-09-11 06:33:47 +00:00
|
|
|
|
var collection = new ProgressMessageCollection();//.bindSignalR();
|
2013-09-02 02:55:45 +00:00
|
|
|
|
|
2013-09-11 06:33:47 +00:00
|
|
|
|
/* collection.signalRconnection.received(function (message) {
|
2013-09-02 02:55:45 +00:00
|
|
|
|
|
2013-09-11 06:33:47 +00:00
|
|
|
|
var type = getMessengerType(message.status);
|
|
|
|
|
var hideAfter = type === 'info' ? 60 :5;
|
2013-09-02 02:55:45 +00:00
|
|
|
|
|
2013-09-11 06:33:47 +00:00
|
|
|
|
Messenger.show({
|
|
|
|
|
id : message.commandId,
|
|
|
|
|
message : message.message,
|
|
|
|
|
type : type,
|
|
|
|
|
hideAfter: hideAfter
|
|
|
|
|
});
|
|
|
|
|
});*/
|
2013-09-02 02:55:45 +00:00
|
|
|
|
|
|
|
|
|
var getMessengerType = function (status) {
|
|
|
|
|
switch (status) {
|
|
|
|
|
case 'completed':
|
|
|
|
|
return 'success';
|
|
|
|
|
case 'failed':
|
|
|
|
|
return 'error';
|
|
|
|
|
default:
|
|
|
|
|
return 'info';
|
|
|
|
|
}
|
2013-09-02 03:46:43 +00:00
|
|
|
|
};
|
2013-09-02 02:55:45 +00:00
|
|
|
|
|
|
|
|
|
return collection;
|
|
|
|
|
});
|