Show More
@@ -205,9 +205,6 b' class ContentsHandler(IPythonHandler):' | |||||
205 | self._copy(copy_from, path, name) |
|
205 | self._copy(copy_from, path, name) | |
206 | elif self.contents_manager.file_exists(name, path): |
|
206 | elif self.contents_manager.file_exists(name, path): | |
207 | self._save(model, path, name) |
|
207 | self._save(model, path, name) | |
208 | checkpoint = model.get('_checkpoint_after_save') |
|
|||
209 | if checkpoint: |
|
|||
210 | nbm.create_checkpoint(path, name) |
|
|||
211 | else: |
|
208 | else: | |
212 | self._upload(model, path, name) |
|
209 | self._upload(model, path, name) | |
213 | else: |
|
210 | else: |
@@ -2357,18 +2357,13 b' define([' | |||||
2357 | * @method list_checkpoints |
|
2357 | * @method list_checkpoints | |
2358 | */ |
|
2358 | */ | |
2359 | Notebook.prototype.list_checkpoints = function () { |
|
2359 | Notebook.prototype.list_checkpoints = function () { | |
2360 | var url = utils.url_join_encode( |
|
2360 | var that = this; | |
2361 | this.base_url, |
|
2361 | this.contents.list_checkpoints(this.notebook_path, this.notebook_name, { | |
2362 | 'api/contents', |
|
2362 | success_callback: $.proxy(this.list_checkpoints_success, this), | |
2363 | this.notebook_path, |
|
2363 | error_callback: function(xhr, status, error_msg) { | |
2364 | this.notebook_name, |
|
2364 | that.events.trigger('list_checkpoints_failed.Notebook'); | |
2365 |
|
|
2365 | } | |
2366 | ); |
|
2366 | }); | |
2367 | $.get(url).done( |
|
|||
2368 | $.proxy(this.list_checkpoints_success, this) |
|
|||
2369 | ).fail( |
|
|||
2370 | $.proxy(this.list_checkpoints_error, this) |
|
|||
2371 | ); |
|
|||
2372 | }; |
|
2367 | }; | |
2373 |
|
2368 | |||
2374 | /** |
|
2369 | /** | |
@@ -2391,35 +2386,18 b' define([' | |||||
2391 | }; |
|
2386 | }; | |
2392 |
|
2387 | |||
2393 | /** |
|
2388 | /** | |
2394 | * Failure callback for listing a checkpoint. |
|
|||
2395 | * |
|
|||
2396 | * @method list_checkpoint_error |
|
|||
2397 | * @param {jqXHR} xhr jQuery Ajax object |
|
|||
2398 | * @param {String} status Description of response status |
|
|||
2399 | * @param {String} error_msg HTTP error message |
|
|||
2400 | */ |
|
|||
2401 | Notebook.prototype.list_checkpoints_error = function (xhr, status, error_msg) { |
|
|||
2402 | this.events.trigger('list_checkpoints_failed.Notebook'); |
|
|||
2403 | }; |
|
|||
2404 |
|
||||
2405 | /** |
|
|||
2406 | * Create a checkpoint of this notebook on the server from the most recent save. |
|
2389 | * Create a checkpoint of this notebook on the server from the most recent save. | |
2407 | * |
|
2390 | * | |
2408 | * @method create_checkpoint |
|
2391 | * @method create_checkpoint | |
2409 | */ |
|
2392 | */ | |
2410 | Notebook.prototype.create_checkpoint = function () { |
|
2393 | Notebook.prototype.create_checkpoint = function () { | |
2411 | var url = utils.url_join_encode( |
|
2394 | var that = this; | |
2412 | this.base_url, |
|
2395 | this.contents.create_checkpoint(this.notebook_path, this.notebook_name, { | |
2413 | 'api/contents', |
|
2396 | success_callback: $.proxy(this.create_checkpoint_success, this), | |
2414 | this.notebook_path, |
|
2397 | error_callback: function (xhr, status, error_msg) { | |
2415 | this.notebook_name, |
|
2398 | that.events.trigger('checkpoint_failed.Notebook'); | |
2416 |
|
|
2399 | } | |
2417 | ); |
|
2400 | }); | |
2418 | $.post(url).done( |
|
|||
2419 | $.proxy(this.create_checkpoint_success, this) |
|
|||
2420 | ).fail( |
|
|||
2421 | $.proxy(this.create_checkpoint_error, this) |
|
|||
2422 | ); |
|
|||
2423 | }; |
|
2401 | }; | |
2424 |
|
2402 | |||
2425 | /** |
|
2403 | /** | |
@@ -2436,18 +2414,6 b' define([' | |||||
2436 | this.events.trigger('checkpoint_created.Notebook', data); |
|
2414 | this.events.trigger('checkpoint_created.Notebook', data); | |
2437 | }; |
|
2415 | }; | |
2438 |
|
2416 | |||
2439 | /** |
|
|||
2440 | * Failure callback for creating a checkpoint. |
|
|||
2441 | * |
|
|||
2442 | * @method create_checkpoint_error |
|
|||
2443 | * @param {jqXHR} xhr jQuery Ajax object |
|
|||
2444 | * @param {String} status Description of response status |
|
|||
2445 | * @param {String} error_msg HTTP error message |
|
|||
2446 | */ |
|
|||
2447 | Notebook.prototype.create_checkpoint_error = function (xhr, status, error_msg) { |
|
|||
2448 | this.events.trigger('checkpoint_failed.Notebook'); |
|
|||
2449 | }; |
|
|||
2450 |
|
||||
2451 | Notebook.prototype.restore_checkpoint_dialog = function (checkpoint) { |
|
2417 | Notebook.prototype.restore_checkpoint_dialog = function (checkpoint) { | |
2452 | var that = this; |
|
2418 | var that = this; | |
2453 | checkpoint = checkpoint || this.last_checkpoint; |
|
2419 | checkpoint = checkpoint || this.last_checkpoint; | |
@@ -2497,19 +2463,14 b' define([' | |||||
2497 | */ |
|
2463 | */ | |
2498 | Notebook.prototype.restore_checkpoint = function (checkpoint) { |
|
2464 | Notebook.prototype.restore_checkpoint = function (checkpoint) { | |
2499 | this.events.trigger('notebook_restoring.Notebook', checkpoint); |
|
2465 | this.events.trigger('notebook_restoring.Notebook', checkpoint); | |
2500 | var url = utils.url_join_encode( |
|
2466 | var that = this; | |
2501 | this.base_url, |
|
2467 | this.contents.restore_checkpoint(this.notebook_path, this.notebook_name, | |
2502 | 'api/contents', |
|
2468 | checkpoint, { | |
2503 | this.notebook_path, |
|
2469 | success_callback: $.proxy(this.create_checkpoint_success, this), | |
2504 | this.notebook_name, |
|
2470 | error_callback: function (xhr, status, error_msg) { | |
2505 | 'checkpoints', |
|
2471 | that.events.trigger('checkpoint_restore_failed.Notebook'); | |
2506 |
|
|
2472 | } | |
2507 | ); |
|
2473 | }); | |
2508 | $.post(url).done( |
|
|||
2509 | $.proxy(this.restore_checkpoint_success, this) |
|
|||
2510 | ).fail( |
|
|||
2511 | $.proxy(this.restore_checkpoint_error, this) |
|
|||
2512 | ); |
|
|||
2513 | }; |
|
2474 | }; | |
2514 |
|
2475 | |||
2515 | /** |
|
2476 | /** | |
@@ -2526,18 +2487,6 b' define([' | |||||
2526 | }; |
|
2487 | }; | |
2527 |
|
2488 | |||
2528 | /** |
|
2489 | /** | |
2529 | * Failure callback for restoring a notebook to a checkpoint. |
|
|||
2530 | * |
|
|||
2531 | * @method restore_checkpoint_error |
|
|||
2532 | * @param {jqXHR} xhr jQuery Ajax object |
|
|||
2533 | * @param {String} status Description of response status |
|
|||
2534 | * @param {String} error_msg HTTP error message |
|
|||
2535 | */ |
|
|||
2536 | Notebook.prototype.restore_checkpoint_error = function (xhr, status, error_msg) { |
|
|||
2537 | this.events.trigger('checkpoint_restore_failed.Notebook'); |
|
|||
2538 | }; |
|
|||
2539 |
|
||||
2540 | /** |
|
|||
2541 | * Delete a notebook checkpoint. |
|
2490 | * Delete a notebook checkpoint. | |
2542 | * |
|
2491 | * | |
2543 | * @method delete_checkpoint |
|
2492 | * @method delete_checkpoint | |
@@ -2545,18 +2494,13 b' define([' | |||||
2545 | */ |
|
2494 | */ | |
2546 | Notebook.prototype.delete_checkpoint = function (checkpoint) { |
|
2495 | Notebook.prototype.delete_checkpoint = function (checkpoint) { | |
2547 | this.events.trigger('notebook_restoring.Notebook', checkpoint); |
|
2496 | this.events.trigger('notebook_restoring.Notebook', checkpoint); | |
2548 | var url = utils.url_join_encode( |
|
2497 | var that = this; | |
2549 | this.base_url, |
|
2498 | this.contents.delete_checkpoint(this.notebook_path, this.notebook_name, | |
2550 | 'api/contents', |
|
2499 | checkpoint, { | |
2551 | this.notebook_path, |
|
2500 | success_callback: $.proxy(this.create_checkpoint_success, this), | |
2552 | this.notebook_name, |
|
2501 | error_callback: function (xhr, status, error_msg) { | |
2553 | 'checkpoints', |
|
2502 | that.events.trigger('checkpoint_delete_failed.Notebook', [xhr, status, error]); | |
2554 |
|
|
2503 | } | |
2555 | ); |
|
|||
2556 | $.ajax(url, { |
|
|||
2557 | type: 'DELETE', |
|
|||
2558 | success: $.proxy(this.delete_checkpoint_success, this), |
|
|||
2559 | error: $.proxy(this.delete_checkpoint_error, this) |
|
|||
2560 | }); |
|
2504 | }); | |
2561 | }; |
|
2505 | }; | |
2562 |
|
2506 | |||
@@ -2573,18 +2517,6 b' define([' | |||||
2573 | this.load_notebook(this.notebook_name, this.notebook_path); |
|
2517 | this.load_notebook(this.notebook_name, this.notebook_path); | |
2574 | }; |
|
2518 | }; | |
2575 |
|
2519 | |||
2576 | /** |
|
|||
2577 | * Failure callback for deleting a notebook checkpoint. |
|
|||
2578 | * |
|
|||
2579 | * @method delete_checkpoint_error |
|
|||
2580 | * @param {jqXHR} xhr jQuery Ajax object |
|
|||
2581 | * @param {String} status Description of response status |
|
|||
2582 | * @param {String} error HTTP error message |
|
|||
2583 | */ |
|
|||
2584 | Notebook.prototype.delete_checkpoint_error = function (xhr, status, error) { |
|
|||
2585 | this.events.trigger('checkpoint_delete_failed.Notebook', [xhr, status, error]); |
|
|||
2586 | }; |
|
|||
2587 |
|
||||
2588 |
|
2520 | |||
2589 | // For backwards compatability. |
|
2521 | // For backwards compatability. | |
2590 | IPython.Notebook = Notebook; |
|
2522 | IPython.Notebook = Notebook; |
@@ -169,38 +169,44 b' define([' | |||||
169 | * Checkpointing Functions |
|
169 | * Checkpointing Functions | |
170 | */ |
|
170 | */ | |
171 |
|
171 | |||
172 |
Contents.prototype. |
|
172 | Contents.prototype.create_checkpoint = function(path, name, options) { | |
173 | // This is not necessary - integrated into save |
|
173 | var url = this.api_url(path, name, 'checkpoints'); | |
|
174 | var settings = { | |||
|
175 | type : "POST", | |||
|
176 | success: options.success_callback || function(data, status, xhr) {}, | |||
|
177 | error: options.error_callback || function(xhr, status, error_msg) {} | |||
|
178 | }; | |||
|
179 | $.ajax(url, settings); | |||
174 | }; |
|
180 | }; | |
175 |
|
181 | |||
176 |
Contents.prototype. |
|
182 | Contents.prototype.list_checkpoints = function(path, name, options) { | |
177 | that = notebook; |
|
183 | var url = this.api_url(path, name, 'checkpoints'); | |
178 | this.events.trigger('notebook_restoring.Notebook', checkpoint); |
|
184 | var settings = { | |
179 | var url = this.api_url( |
|
185 | type : "GET", | |
180 | this.notebook_path, |
|
186 | success: options.success_callback || function(data, status, xhr) {}, | |
181 | this.notebook_name, |
|
187 | error: options.error_callback || function(xhr, status, error_msg) {} | |
182 | 'checkpoints', |
|
188 | }; | |
183 | checkpoint |
|
189 | $.ajax(url, settings); | |
184 | ); |
|
|||
185 | $.post(url).done( |
|
|||
186 | $.proxy(that.restore_checkpoint_success, that) |
|
|||
187 | ).fail( |
|
|||
188 | $.proxy(that.restore_checkpoint_error, that) |
|
|||
189 | ); |
|
|||
190 | }; |
|
190 | }; | |
191 |
|
191 | |||
192 |
Contents.prototype. |
|
192 | Contents.prototype.restore_checkpoint = function(path, name, checkpoint_id, options) { | |
193 | that = notebook; |
|
193 | var url = this.api_url(path, name, 'checkpoints', checkpoint_id); | |
194 | var url = this.api_url( |
|
194 | var settings = { | |
195 | that.notebook_path, |
|
195 | type : "POST", | |
196 | that.notebook_name, |
|
196 | success: options.success_callback || function(data, status, xhr) {}, | |
197 | 'checkpoints' |
|
197 | error: options.error_callback || function(xhr, status, error_msg) {} | |
198 |
|
|
198 | }; | |
199 | $.get(url).done( |
|
199 | $.ajax(url, settings); | |
200 | $.proxy(that.list_checkpoints_success, that) |
|
200 | }; | |
201 | ).fail( |
|
201 | ||
202 | $.proxy(that.list_checkpoints_error, that) |
|
202 | Contents.prototype.delete_checkpoint = function(path, name, checkpoint_id, options) { | |
203 | ); |
|
203 | var url = this.api_url(path, name, 'checkpoints', checkpoint_id); | |
|
204 | var settings = { | |||
|
205 | type : "DELETE", | |||
|
206 | success: options.success_callback || function(data, status, xhr) {}, | |||
|
207 | error: options.error_callback || function(xhr, status, error_msg) {} | |||
|
208 | }; | |||
|
209 | $.ajax(url, settings); | |||
204 | }; |
|
210 | }; | |
205 |
|
211 | |||
206 | /** |
|
212 | /** | |
@@ -225,7 +231,6 b' define([' | |||||
225 | */ |
|
231 | */ | |
226 | Contents.prototype.list_contents = function(path, load_callback, |
|
232 | Contents.prototype.list_contents = function(path, load_callback, | |
227 | error_callback) { |
|
233 | error_callback) { | |
228 | var that = this; |
|
|||
229 | var settings = { |
|
234 | var settings = { | |
230 | processData : false, |
|
235 | processData : false, | |
231 | cache : false, |
|
236 | cache : false, |
General Comments 0
You need to be logged in to leave comments.
Login now