Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
  • 2 commits
  • 2 files changed
  • 0 commit comments
  • 1 contributor
Commits on Jan 08, 2013
Christopher Meiklejohn cmeiklejohn Clean up, and ensure we always load record into RA. 3b48187
Commits on Jan 09, 2013
Christopher Meiklejohn cmeiklejohn Merge pull request #40 from basho/csm-fix-record-array-access
Clean up, and ensure we always load record into RA.
fc24391
Showing with 20 additions and 10 deletions.
  1. +6 −10 assets/javascripts/app/events.js
  2. +14 −0 assets/javascripts/app/models.js
16 assets/javascripts/app/events.js
View
@@ -4,23 +4,19 @@ GiddyUp.EventProcessor = Ember.Object.extend({
this.source.addEventListener('test_result', function(e) {
var parsedResponse = JSON.parse(e.data);
- var testResult = parsedResponse.test_result;
-
- // Load the new test result into the store.
- //
- GiddyUp.store.load(GiddyUp.TestResult, testResult);
+ var rawTestResult = parsedResponse.test_result;
+ var testResult = GiddyUp.TestResult.loadRawTestResult(
+ rawTestResult);
// Notification handling.
//
if (window.webkitNotifications &&
window.webkitNotifications.checkPermission() === 0) {
-
- var result = GiddyUp.TestResult.find(testResult.id);
- var message = result.get('notification');
+ var message = testResult.get('notification');
window.webkitNotifications.createNotification(
- "icon.png", message.title, message.message
- ).show();
+ "icon.png", message.title, message.message).
+ show();
}
});
}
14 assets/javascripts/app/models.js
View
@@ -90,6 +90,20 @@ GiddyUp.TestResult = DS.Model.extend({
}.property()
});
+GiddyUp.TestResult.reopenClass({
+ /** Load record, immediately materialize, and force listening array
+ ** proxies to reference object. */
+ loadRawTestResult: function(rawTestResult) {
+ var newTestResult = GiddyUp.store.load(GiddyUp.TestResult,
+ rawTestResult);
+ var testResult = GiddyUp.TestResult.find(newTestResult.id);
+
+ testResult.get('test_instance.test_results').pushObject(testResult);
+
+ return testResult;
+ }
+});
+
GiddyUp.Log = DS.Model.extend({
body: DS.attr('string'),

No commit comments for this range

Something went wrong with that request. Please try again.