* making a revert on failed save more clear * only notify conflicts for non sync items in object api, spruce up notebook with better transaction tracking and observing and unobserving during transactions, structuredClone backup in monkeypatch * WIP * WIP debuggin * fresh start * dont observe in transaction objects, small changes to notebook vue to indicate saving/prevent spamming, added forceRemote flag to objects.get * updating readability of code as well as fix issue of stuck transaction for same value entry edits * once entry is created, click out to blur * quick revert ; * click outside of entry to blur and commit * switched to enter... as suggested :) * removing unused variable * initializing transaction to null as we are using that now for no transaction * fix: ensure EventSource is closed so it recovers - Make sure to close the CouchDB EventSource as well, so that it can recover in the case where two tabs or windows are on Open MCT and one refreshes. The check on line 81 was preventing recovery since the EventSource was not closed properly. * enhance, enhance, enhance readability Co-authored-by: Jesse Mazzella <jesse.d.mazzella@nasa.gov>
56 lines
2.2 KiB
JavaScript
56 lines
2.2 KiB
JavaScript
/*****************************************************************************
|
|
* Open MCT, Copyright (c) 2014-2022, United States Government
|
|
* as represented by the Administrator of the National Aeronautics and Space
|
|
* Administration. All rights reserved.
|
|
*
|
|
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
|
* "License"); you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
* http://www.apache.org/licenses/LICENSE-2.0.
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
* License for the specific language governing permissions and limitations
|
|
* under the License.
|
|
*
|
|
* Open MCT includes source code licensed under additional open source
|
|
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
|
* this source code distribution or the Licensing information page available
|
|
* at runtime from the About dialog for additional information.
|
|
*****************************************************************************/
|
|
|
|
import Migrations from './Migrations.js';
|
|
|
|
export default function () {
|
|
return function (openmct) {
|
|
let migrations = Migrations(openmct);
|
|
|
|
function needsMigration(domainObject) {
|
|
return migrations.some(m => m.check(domainObject));
|
|
}
|
|
|
|
function migrateObject(domainObject) {
|
|
return migrations.filter(m => m.check(domainObject))[0]
|
|
.migrate(domainObject);
|
|
}
|
|
|
|
let wrappedFunction = openmct.objects.get;
|
|
openmct.objects.get = function migrate() {
|
|
return wrappedFunction.apply(openmct.objects, [...arguments])
|
|
.then(function (object) {
|
|
if (needsMigration(object)) {
|
|
migrateObject(object)
|
|
.then(newObject => {
|
|
openmct.objects.mutate(newObject, 'persisted', Date.now());
|
|
|
|
return newObject;
|
|
});
|
|
}
|
|
|
|
return object;
|
|
});
|
|
};
|
|
};
|
|
}
|