forked from Reportr/dashboard
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Samy Pessé
committed
Oct 7, 2013
1 parent
c49b73b
commit 97f7a5c
Showing
14 changed files
with
471 additions
and
296 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
define([ | ||
"hr/hr", | ||
"api", | ||
"notifications", | ||
"models/user" | ||
], function(hr, api, notifications, User) { | ||
/* | ||
* EventInfo model represent informations given by the api using /api/<token>/event/<namespace>/<event> | ||
* about some events. | ||
* It used to get a list of all properties names and types of an events collection. | ||
*/ | ||
var EventInfo = hr.Model.extend({ | ||
defaults: { | ||
'event': null, | ||
'namespace': null, | ||
'properties': {}, | ||
'timestamp': 0, | ||
}, | ||
|
||
/* | ||
* Constructor | ||
*/ | ||
initialize: function() { | ||
EventInfo.__super__.initialize.apply(this, arguments); | ||
|
||
// Signal eventsi n relatime | ||
notifications.on("events:new", function(e) { | ||
if (e.report() == this.report()) { | ||
this.trigger("events:new", e); | ||
} | ||
}, this); | ||
return this; | ||
}, | ||
|
||
/* | ||
* Load info about events | ||
*/ | ||
load: function(eventNamespace, eventName) { | ||
var that = this; | ||
return api.request("get", User.current.get('token')+"/event/"+eventNamespace+"/"+eventName, {}).done(function(data) { | ||
that.set(data); | ||
}); | ||
}, | ||
|
||
/* | ||
* Return report id | ||
*/ | ||
report: function() { | ||
return this.get("namespace")+"/"+this.get("event"); | ||
}, | ||
|
||
/* | ||
* Return model for the event | ||
*/ | ||
model: function() { | ||
return User.current.models.getModel(this); | ||
} | ||
}); | ||
|
||
return EventInfo; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.