Squashed commit of the following:

commit 3f199a9f06
Merge: 27fe4ed 736cba7
Author: Victor Woeltjen <victor.woeltjen@nasa.gov>
Date:   Mon Jun 27 09:04:40 2016 -0700

    Merge remote-tracking branch 'origin/master' into clear-transactions-1046

    Conflicts:
    	platform/commonUI/edit/src/actions/SaveAsAction.js

commit 27fe4edb30
Author: Victor Woeltjen <victor.woeltjen@nasa.gov>
Date:   Wed Jun 22 15:04:06 2016 -0700

    [Edit] Mark restartTransaction as private API

commit 21d1938a0f
Author: Victor Woeltjen <victor.woeltjen@nasa.gov>
Date:   Wed Jun 22 15:03:17 2016 -0700

    [Edit] Clarify JSDoc

commit 06a83f9fa9
Author: Victor Woeltjen <victor.woeltjen@nasa.gov>
Date:   Wed Jun 22 15:01:35 2016 -0700

    [Edit] Update failing spec

commit 1f525160e0
Author: Victor Woeltjen <victor.woeltjen@nasa.gov>
Date:   Wed Jun 22 14:52:43 2016 -0700

    [Edit] Refer to correct variable

    ...when clearing transactions after a restartTransaction

commit b60e94bce4
Author: Victor Woeltjen <victor.woeltjen@nasa.gov>
Date:   Wed Jun 22 14:38:54 2016 -0700

    [Edit] Clear transactions on Save As

    ...such that only persistence calls associated with the
    saved clones are actually issued. Fixes #1046.
This commit is contained in:
Victor Woeltjen
2016-06-27 09:12:57 -07:00
parent 736cba76bb
commit d1c01d3c86
4 changed files with 65 additions and 3 deletions

View File

@ -140,9 +140,38 @@ define(
});
};
/**
* Clear and restart the active transaction.
*
* This neither cancels nor commits the active transaction;
* instead, it returns a function that can be used to cancel that
* transaction.
*
* @returns {Function} a function to cancel the prior transaction
* @private
*/
TransactionService.prototype.restartTransaction = function () {
var oldOnCancels = this.onCancels;
this.onCommits = [];
this.onCancels = [];
return function () {
while (oldOnCancels.length > 0) {
var onCancel = oldOnCancels.pop();
try {
onCancel();
} catch (error) {
this.$log.error("Error cancelling transaction.");
}
}
};
};
TransactionService.prototype.size = function () {
return this.onCommits.length;
};
return TransactionService;
});
}
);