mirror of
https://github.com/nasa/openmct.git
synced 2025-02-21 17:57:04 +00:00
[#3389] Set the persisted timestamp to date.now rather than the domain object's modified timestamp (#3390)
This commit is contained in:
parent
08b2940eb6
commit
7879752f47
@ -200,17 +200,19 @@ define([
|
|||||||
} else if (hasAlreadyBeenPersisted(domainObject)) {
|
} else if (hasAlreadyBeenPersisted(domainObject)) {
|
||||||
result = Promise.resolve(true);
|
result = Promise.resolve(true);
|
||||||
} else {
|
} else {
|
||||||
|
const persistedTime = Date.now();
|
||||||
if (domainObject.persisted === undefined) {
|
if (domainObject.persisted === undefined) {
|
||||||
domainObject.persisted = domainObject.modified;
|
|
||||||
result = new Promise((resolve) => {
|
result = new Promise((resolve) => {
|
||||||
savedResolve = resolve;
|
savedResolve = resolve;
|
||||||
});
|
});
|
||||||
|
domainObject.persisted = persistedTime;
|
||||||
provider.create(domainObject).then((response) => {
|
provider.create(domainObject).then((response) => {
|
||||||
this.mutate(domainObject, 'persisted', domainObject.modified);
|
this.mutate(domainObject, 'persisted', persistedTime);
|
||||||
savedResolve(response);
|
savedResolve(response);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
this.mutate(domainObject, 'persisted', domainObject.modified);
|
domainObject.persisted = persistedTime;
|
||||||
|
this.mutate(domainObject, 'persisted', persistedTime);
|
||||||
result = provider.update(domainObject);
|
result = provider.update(domainObject);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,14 +33,15 @@ describe('the plugin', () => {
|
|||||||
let provider;
|
let provider;
|
||||||
let testSpace = 'testSpace';
|
let testSpace = 'testSpace';
|
||||||
let testPath = '/test/db';
|
let testPath = '/test/db';
|
||||||
let mockDomainObject = {
|
let mockDomainObject;
|
||||||
identifier: {
|
|
||||||
namespace: '',
|
|
||||||
key: 'some-value'
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
beforeEach((done) => {
|
beforeEach((done) => {
|
||||||
|
mockDomainObject = {
|
||||||
|
identifier: {
|
||||||
|
namespace: '',
|
||||||
|
key: 'some-value'
|
||||||
|
}
|
||||||
|
};
|
||||||
openmct = createOpenMct(false);
|
openmct = createOpenMct(false);
|
||||||
openmct.install(new CouchPlugin(testSpace, testPath));
|
openmct.install(new CouchPlugin(testSpace, testPath));
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user