New eslint rules auto fix (#3058)
* no-implicit-coercion and no-unneeded-ternary * End every line with a semicolon * Spacing and formatting * Enabled semi-spacing * Applies npm run lint:fix to code after master merge * Fix merge issues * Switched operator-linebreak to 'before' Co-authored-by: Joshi <simplyrender@gmail.com>
This commit is contained in:
@@ -33,7 +33,7 @@ define([
|
||||
) {
|
||||
|
||||
return {
|
||||
name:"platform/persistence/queue",
|
||||
name: "platform/persistence/queue",
|
||||
definition: {
|
||||
"extensions": {
|
||||
"components": [
|
||||
|
||||
@@ -34,7 +34,10 @@ define(
|
||||
key: "cancel"
|
||||
}
|
||||
],
|
||||
OK_OPTIONS = [{ name: "OK", key: "ok" }];
|
||||
OK_OPTIONS = [{
|
||||
name: "OK",
|
||||
key: "ok"
|
||||
}];
|
||||
|
||||
/**
|
||||
* Populates a `dialogModel` to pass to `dialogService.getUserChoise`
|
||||
@@ -49,8 +52,8 @@ define(
|
||||
// Place this failure into an appropriate group
|
||||
function categorizeFailure(failure) {
|
||||
// Check if the error is due to object revision
|
||||
var isRevisionError = ((failure || {}).error || {}).key ===
|
||||
PersistenceFailureConstants.REVISION_ERROR_KEY;
|
||||
var isRevisionError = ((failure || {}).error || {}).key
|
||||
=== PersistenceFailureConstants.REVISION_ERROR_KEY;
|
||||
// Push the failure into the appropriate group
|
||||
(isRevisionError ? revisionErrors : otherErrors).push(failure);
|
||||
}
|
||||
@@ -65,8 +68,8 @@ define(
|
||||
revised: revisionErrors,
|
||||
unrecoverable: otherErrors
|
||||
},
|
||||
options: revisionErrors.length > 0 ?
|
||||
OVERWRITE_CANCEL_OPTIONS : OK_OPTIONS
|
||||
options: revisionErrors.length > 0
|
||||
? OVERWRITE_CANCEL_OPTIONS : OK_OPTIONS
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -52,6 +52,7 @@ define(
|
||||
function discard(failure) {
|
||||
var persistence =
|
||||
failure.domainObject.getCapability('persistence');
|
||||
|
||||
return persistence.refresh();
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,6 @@ define(
|
||||
PersistenceFailureHandler
|
||||
) {
|
||||
|
||||
|
||||
/**
|
||||
* The PersistenceQueue is used by the QueuingPersistenceCapability
|
||||
* to aggregate calls for object persistence. These are then issued
|
||||
|
||||
@@ -87,6 +87,7 @@ define(
|
||||
requeue: requeue,
|
||||
error: error
|
||||
});
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -97,9 +98,9 @@ define(
|
||||
|
||||
// Handle any failures from the full operation
|
||||
function handleFailure(value) {
|
||||
return failures.length > 0 ?
|
||||
failureHandler.handle(failures) :
|
||||
value;
|
||||
return failures.length > 0
|
||||
? failureHandler.handle(failures)
|
||||
: value;
|
||||
}
|
||||
|
||||
// Try to persist everything, then handle any failures
|
||||
|
||||
@@ -66,8 +66,8 @@ define(
|
||||
|
||||
// Check if the queue's size has stopped increasing)
|
||||
function quiescent() {
|
||||
return Object.keys(self.persistences).length ===
|
||||
self.lastObservedSize;
|
||||
return Object.keys(self.persistences).length
|
||||
=== self.lastObservedSize;
|
||||
}
|
||||
|
||||
// Persist all queued objects
|
||||
@@ -82,6 +82,7 @@ define(
|
||||
function clearFlushPromise(value) {
|
||||
self.flushPromise = undefined;
|
||||
flushingDefer.resolve(value);
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
@@ -109,6 +110,7 @@ define(
|
||||
} else {
|
||||
self.scheduleFlush();
|
||||
}
|
||||
|
||||
// Update lastObservedSize to detect quiescence
|
||||
self.lastObservedSize = Object.keys(self.persistences).length;
|
||||
}
|
||||
@@ -120,14 +122,13 @@ define(
|
||||
} else {
|
||||
// Otherwise, schedule a flush on a timeout (to give
|
||||
// a window for other updates to get aggregated)
|
||||
self.pendingTimeout = self.pendingTimeout ||
|
||||
$timeout(maybeFlush, self.delay, false);
|
||||
self.pendingTimeout = self.pendingTimeout
|
||||
|| $timeout(maybeFlush, self.delay, false);
|
||||
}
|
||||
|
||||
return self.activeDefer.promise;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Queue persistence of a domain object.
|
||||
* @param {DomainObject} domainObject the domain object
|
||||
@@ -139,6 +140,7 @@ define(
|
||||
var id = domainObject.getId();
|
||||
this.persistences[id] = persistence;
|
||||
this.objects[id] = domainObject;
|
||||
|
||||
return this.scheduleFlush();
|
||||
};
|
||||
|
||||
|
||||
@@ -60,9 +60,9 @@ define(
|
||||
capabilities.persistence = function (domainObject) {
|
||||
// Get/instantiate the original
|
||||
var original =
|
||||
(typeof originalPersistence === 'function') ?
|
||||
originalPersistence(domainObject) :
|
||||
originalPersistence;
|
||||
(typeof originalPersistence === 'function')
|
||||
? originalPersistence(domainObject)
|
||||
: originalPersistence;
|
||||
|
||||
// Provide a decorated version
|
||||
return new QueuingPersistenceCapability(
|
||||
@@ -72,6 +72,7 @@ define(
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
return capabilities;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
define(
|
||||
["../src/PersistenceFailureConstants"],
|
||||
function (PersistenceFailureConstants) {
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
define(
|
||||
["../src/PersistenceFailureController"],
|
||||
function (PersistenceFailureController) {
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
define(
|
||||
["../src/PersistenceFailureDialog", "../src/PersistenceFailureConstants"],
|
||||
function (PersistenceFailureDialog, Constants) {
|
||||
@@ -31,11 +30,26 @@ define(
|
||||
|
||||
beforeEach(function () {
|
||||
testFailures = [
|
||||
{ error: { key: Constants.REVISION_ERROR_KEY }, someKey: "abc" },
|
||||
{ error: { key: "..." }, someKey: "def" },
|
||||
{ error: { key: Constants.REVISION_ERROR_KEY }, someKey: "ghi" },
|
||||
{ error: { key: Constants.REVISION_ERROR_KEY }, someKey: "jkl" },
|
||||
{ error: { key: "..." }, someKey: "mno" }
|
||||
{
|
||||
error: { key: Constants.REVISION_ERROR_KEY },
|
||||
someKey: "abc"
|
||||
},
|
||||
{
|
||||
error: { key: "..." },
|
||||
someKey: "def"
|
||||
},
|
||||
{
|
||||
error: { key: Constants.REVISION_ERROR_KEY },
|
||||
someKey: "ghi"
|
||||
},
|
||||
{
|
||||
error: { key: Constants.REVISION_ERROR_KEY },
|
||||
someKey: "jkl"
|
||||
},
|
||||
{
|
||||
error: { key: "..." },
|
||||
someKey: "mno"
|
||||
}
|
||||
];
|
||||
dialog = new PersistenceFailureDialog(testFailures);
|
||||
});
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
define(
|
||||
["../src/PersistenceFailureHandler", "../src/PersistenceFailureConstants"],
|
||||
function (PersistenceFailureHandler, Constants) {
|
||||
@@ -48,10 +47,14 @@ define(
|
||||
mockFailure.domainObject.getCapability.and.callFake(function (c) {
|
||||
return (c === 'persistence') && mockPersistence;
|
||||
});
|
||||
mockFailure.domainObject.getModel.and.returnValue({ id: id, modified: index });
|
||||
mockFailure.domainObject.getModel.and.returnValue({
|
||||
id: id,
|
||||
modified: index
|
||||
});
|
||||
mockFailure.persistence = mockPersistence;
|
||||
mockFailure.id = id;
|
||||
mockFailure.error = { key: Constants.REVISION_ERROR_KEY };
|
||||
|
||||
return mockFailure;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
define(
|
||||
["../src/PersistenceQueueHandler"],
|
||||
function (PersistenceQueueHandler) {
|
||||
@@ -50,6 +49,7 @@ define(
|
||||
['persist', 'refresh']
|
||||
);
|
||||
mockPersistence.persist.and.returnValue(asPromise(true));
|
||||
|
||||
return mockPersistence;
|
||||
}
|
||||
|
||||
@@ -59,6 +59,7 @@ define(
|
||||
['getId']
|
||||
);
|
||||
mockDomainObject.getId.and.returnValue(id);
|
||||
|
||||
return mockDomainObject;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
define(
|
||||
["../src/PersistenceQueueImpl"],
|
||||
function (PersistenceQueueImpl) {
|
||||
@@ -41,6 +40,7 @@ define(
|
||||
['getId']
|
||||
);
|
||||
mockDomainObject.getId.and.returnValue(id);
|
||||
|
||||
return mockDomainObject;
|
||||
}
|
||||
|
||||
@@ -49,6 +49,7 @@ define(
|
||||
'persistence-' + id,
|
||||
['persist']
|
||||
);
|
||||
|
||||
return mockPersistence;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
define(
|
||||
["../src/PersistenceQueue"],
|
||||
function (PersistenceQueue) {
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
define(
|
||||
["../src/QueuingPersistenceCapabilityDecorator"],
|
||||
function (QueuingPersistenceCapabilityDecorator) {
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
define(
|
||||
["../src/QueuingPersistenceCapability"],
|
||||
function (QueuingPersistenceCapability) {
|
||||
|
||||
Reference in New Issue
Block a user