Permalink
Please sign in to comment.
Browse files
Merge branch 'master' into pagination
Conflicts: server/vendor/monarch/client/lib/monarch/model/relations/ordering.js server/vendor/monarch/client/lib/monarch/model/relations/relation.js
- Loading branch information...
Showing
with
1,633 additions
and 2,310 deletions.
- +1 −0 lib/monarch.js
- +0 −1 lib/monarch/http.js
- +24 −0 lib/monarch/http/command.js
- +0 −56 lib/monarch/http/command_batch.js
- +2 −2 lib/monarch/http/create_command.js
- +2 −2 lib/monarch/http/destroy_command.js
- +13 −49 lib/monarch/http/server.js
- +2 −2 lib/monarch/http/update_command.js
- +3 −1 lib/monarch/model/column.js
- +6 −2 lib/monarch/model/composite_tuple.js
- +28 −43 lib/monarch/model/record.js
- +0 −1 lib/monarch/model/relations.js
- +38 −38 lib/monarch/model/relations/difference.js
- +89 −74 lib/monarch/model/relations/inner_join.js
- +15 −73 lib/monarch/model/relations/ordering.js
- +0 −75 lib/monarch/model/relations/projection.js
- +188 −117 lib/monarch/model/relations/relation.js
- +19 −38 lib/monarch/model/relations/selection.js
- +23 −35 lib/monarch/model/relations/table.js
- +40 −36 lib/monarch/model/relations/table_projection.js
- +41 −29 lib/monarch/model/relations/union.js
- +1 −1 lib/monarch/model/remote_fieldset.js
- +1 −2 lib/monarch/model/repository.js
- +2 −0 lib/monarch/model/sort_specification.js
- +5 −1 lib/monarch/model/tuple.js
- +1 −1 lib/monarch/queue.js
- +205 −0 lib/monarch/skip_list.js
- +16 −0 lib/monarch/underscore_extensions.js
- +1 −1 lib/monarch/view/template.js
- +1 −1 spec/monarch/http/ajax_future_spec.js
- +50 −163 spec/monarch/http/server_spec.js
- +14 −86 spec/monarch/model/record_spec.js
- +65 −166 spec/monarch/model/relations/difference_spec.js
- +166 −258 spec/monarch/model/relations/inner_join_spec.js
- +47 −27 spec/monarch/model/relations/ordering_spec.js
- +0 −97 spec/monarch/model/relations/projection_spec.js
- +2 −26 spec/monarch/model/relations/relation_spec.js
- +107 −291 spec/monarch/model/relations/selection_spec.js
- +38 −45 spec/monarch/model/relations/table_projection_spec.js
- +143 −278 spec/monarch/model/relations/table_spec.js
- +79 −53 spec/monarch/model/relations/union_spec.js
- +1 −1 spec/monarch/model/remote_field_spec.js
- +4 −4 spec/monarch/model/repository_spec.js
- +35 −32 spec/monarch/model/tuple_spec.js
- +77 −0 spec/monarch/skip_list_spec.js
- +2 −2 spec/monarch/view/view_spec.js
- +1 −2 spec/spec_helpers/fake_server.js
- +0 −64 spec/spec_helpers/fake_server/fake_command_batch.js
- +20 −16 spec/spec_helpers/fake_server/fake_mutation.js
- +12 −17 spec/spec_helpers/fake_server/fake_server.js
- +1 −1 spec/spec_helpers/fake_server_spec.js
- +2 −0 vendor/underscore.js
@@ -1,6 +1,30 @@ | ||
(function(Monarch) { | ||
_.constructor("Monarch.Http.Command", { | ||
+ initialize: function(record, server) { | ||
+ this.record = record; | ||
+ this.server = server; | ||
+ this.future = new Monarch.Http.AjaxFuture(); | ||
+ }, | ||
+ | ||
+ perform: function() { | ||
+ this.server.post(Repository.originUrl + "/mutate", { operations: [this.wireRepresentation()] }) | ||
+ .onSuccess(this.hitch('handleSuccessfulResponse')) | ||
+ .onFailure(this.hitch('handleUnsuccessfulResponse')) | ||
+ return this.future; | ||
+ }, | ||
+ | ||
+ handleSuccessfulResponse: function(data) { | ||
+ this.future.updateRepositoryAndTriggerCallbacks(this.record, this.bind(function() { | ||
+ this.complete(data.primary[0]); | ||
+ Repository.mutate(data.secondary); | ||
+ })); | ||
+ }, | ||
+ | ||
+ handleUnsuccessfulResponse: function(data) { | ||
+ this.handleFailure(data.errors); | ||
+ this.future.triggerFailure(this.record); | ||
+ } | ||
}); | ||
})(Monarch); |
@@ -1,56 +0,0 @@ | ||
-(function(Monarch) { | ||
- | ||
-_.constructor("Monarch.Http.CommandBatch", { | ||
- initialize: function(server, commands) { | ||
- this.server = server; | ||
- this.commands = commands; | ||
- }, | ||
- | ||
- perform: function() { | ||
- this.future = new Monarch.Http.AjaxFuture(); | ||
- | ||
- if (this.commands.length > 0) { | ||
- this.server.post(Repository.originUrl + "/mutate", { operations: this.wireRepresentation() }) | ||
- .onSuccess(function(responseData) { | ||
- this.handleSuccessfulResponse(responseData); | ||
- }, this) | ||
- .onFailure(function(responseData) { | ||
- this.handleUnsuccessfulResponse(responseData); | ||
- }, this); | ||
- } else { | ||
- this.future.updateRepositoryAndTriggerCallbacks(null, _.identity); | ||
- } | ||
- | ||
- return this.future; | ||
- }, | ||
- | ||
- // private | ||
- | ||
- wireRepresentation: function() { | ||
- return _.map(this.commands, function(command) { | ||
- return command.wireRepresentation(); | ||
- }); | ||
- }, | ||
- | ||
- handleSuccessfulResponse: function(responseData) { | ||
- this.future.updateRepositoryAndTriggerCallbacks(this.commands[0].record, _.bind(function() { | ||
- _.each(this.commands, function(command, index) { | ||
- command.complete(responseData.primary[index]); | ||
- }); | ||
- Repository.mutate(responseData.secondary); | ||
- }, this)); | ||
- }, | ||
- | ||
- handleUnsuccessfulResponse: function(responseData) { | ||
- _.each(this.commands, function(command, index) { | ||
- if (index == responseData.index) { | ||
- command.handleFailure(responseData.errors); | ||
- this.future.triggerFailure(command.record); | ||
- } else { | ||
- command.handleFailure(null); | ||
- } | ||
- }, this); | ||
- } | ||
-}); | ||
- | ||
-})(Monarch); |

Oops, something went wrong.
0 comments on commit
b5f1fd5