Compare commits

...

16 Commits

Author SHA1 Message Date
23a9bce055 debuggin 2021-06-23 18:53:08 -07:00
c9fda1af90 debuggin 2021-06-23 18:20:30 -07:00
8e5d09a4d4 debuggin 2021-06-23 17:50:21 -07:00
c44917bf13 debuggin 2021-06-23 17:42:48 -07:00
72a560323f debuggin 2021-06-23 17:22:22 -07:00
646e28ee6d debuggin 2021-06-23 16:46:49 -07:00
b5b8e5aa1a debuggin 2021-06-23 16:30:20 -07:00
80918fb397 debuggin 2021-06-23 16:13:41 -07:00
e2c81923cb debuggin 2021-06-23 16:05:47 -07:00
9d9ac00b99 debuggin 2021-06-23 15:53:46 -07:00
d0643ad54d debuggin 2021-06-23 15:47:47 -07:00
634ff87f45 debuggin 2021-06-23 15:42:51 -07:00
a3b5f882bb debuggin 2021-06-23 15:36:40 -07:00
f06ccd5564 debuggin 2021-06-23 15:11:54 -07:00
7319b2977f debuggin 2021-06-23 15:08:42 -07:00
75d65106d1 debuggin 2021-06-23 14:59:03 -07:00
5 changed files with 38 additions and 23 deletions

View File

@ -115,6 +115,7 @@ class MutableDomainObject {
return () => this._instanceEventEmitter.off(event, callback);
}
$destroy() {
console.log('mutable destroy');
while (this._observers.length > 0) {
const observer = this._observers.pop();
observer();

View File

@ -416,6 +416,7 @@ ObjectAPI.prototype._toMutable = function (object) {
}
});
mutableObject.$on('$_destroy', () => {
console.log('unobserve', object);
unobserve();
});
}

View File

@ -140,6 +140,7 @@ export default class CouchObjectProvider {
}
get(identifier, abortSignal) {
console.log('couch get', identifier, abortSignal);
this.batchIds.push(identifier.key);
if (this.bulkPromise === undefined) {
@ -166,14 +167,15 @@ export default class CouchObjectProvider {
if (batchIds.length === 1) {
let objectKey = batchIds[0];
console.log('one req', objectKey);
//If there's only one request, just do a regular get
return this.request(objectKey, "GET", undefined, abortSignal)
.then(this.returnAsMap(objectKey));
} else {
return this.bulkGet(batchIds, abortSignal);
console.log('bulk get', batchIds);
return this.bulkGet(batchIds);
}
});
}).catch(console.warn);
}
/**
@ -208,14 +210,14 @@ export default class CouchObjectProvider {
/**
* @private
*/
bulkGet(ids, signal) {
bulkGet(ids) {
ids = this.removeDuplicates(ids);
const query = {
'keys': ids
};
return this.request(ALL_DOCS, 'POST', query, signal).then((response) => {
return this.request(ALL_DOCS, 'POST', query).then((response) => {
if (response && response.rows !== undefined) {
return response.rows.reduce((map, row) => {
if (row.doc !== undefined) {
@ -227,7 +229,7 @@ export default class CouchObjectProvider {
} else {
return {};
}
});
}).catch(console.warn);
}
/**
@ -308,6 +310,7 @@ export default class CouchObjectProvider {
}
observe(identifier, callback) {
console.log('observe', identifier, 'observers', this.observers);
const keyString = this.openmct.objects.makeKeyString(identifier);
this.observers[keyString] = this.observers[keyString] || [];
this.observers[keyString].push(callback);
@ -317,6 +320,7 @@ export default class CouchObjectProvider {
}
return () => {
console.log('stop observing', this, this.observers, this.observers[keyString]);
this.observers[keyString] = this.observers[keyString].filter(observer => observer !== callback);
if (this.observers[keyString].length === 0) {
delete this.observers[keyString];
@ -382,11 +386,11 @@ export default class CouchObjectProvider {
"Content-Type": 'application/json'
},
body
});
}).catch(console.warn);
let reader;
if (response.body === undefined) {
if (!response || (response && response.body === undefined)) {
error = true;
} else {
reader = response.body.getReader();

View File

@ -293,6 +293,7 @@ export default {
},
closeTreeItemByPath(path) {
// if actively loading, abort
console.log('close tree item', path, 'is loading', this.isItemLoading(path));
if (this.isItemLoading(path)) {
this.abortItemLoad(path);
}
@ -328,6 +329,7 @@ export default {
delete this.treeItemLoading[path];
},
abortItemLoad(path) {
console.log('abort', path);
if (this.treeItemLoading[path]) {
this.treeItemLoading[path].abort();
this.endItemLoad(path);
@ -543,9 +545,11 @@ export default {
this.abortSearchController = new AbortController();
const abortSignal = this.abortSearchController.signal;
const promises = this.openmct.objects.search(this.searchValue, abortSignal)
// removed abortSignal until future updates support it
const promises = this.openmct.objects.search(this.searchValue)
.map(promise => promise
.then(results => this.aggregateSearchResults(results, abortSignal)));
// removed abortSignal until future updates support it
.then(results => this.aggregateSearchResults(results)));
Promise.all(promises).catch(reason => {
// search aborted
@ -561,7 +565,7 @@ export default {
let resultPromises = [];
for (const result of results) {
if (!abortSignal.aborted) {
if (!abortSignal || !abortSignal.aborted) {
resultPromises.push(this.openmct.objects.getOriginalPath(result.identifier).then((objectPath) => {
// removing the item itself, as the path we pass to buildTreeItem is a parent path
objectPath.shift();

View File

@ -5,6 +5,7 @@ define([
) {
return function install(openmct) {
console.log('brwose install');
let navigateCall = 0;
let browseObject;
let unobserve = undefined;
@ -28,6 +29,8 @@ define([
return;
}
console.log('browse: on params changed function')
if (changed.view && browseObject) {
let provider = openmct
.objectViews
@ -37,24 +40,25 @@ define([
}
function viewObject(object, viewProvider) {
if (mutable) {
openmct.objects.destroyMutable(mutable);
mutable = undefined;
}
console.log('browse: view object');
// if (mutable) {
// openmct.objects.destroyMutable(mutable);
// mutable = undefined;
// }
if (openmct.objects.supportsMutation(object.identifier)) {
mutable = openmct.objects._toMutable(object);
}
// if (openmct.objects.supportsMutation(object.identifier)) {
// mutable = openmct.objects._toMutable(object);
// }
currentObjectPath = openmct.router.path;
if (mutable !== undefined) {
openmct.layout.$refs.browseObject.show(mutable, viewProvider.key, true, currentObjectPath);
openmct.layout.$refs.browseBar.domainObject = mutable;
} else {
// if (mutable !== undefined) {
// openmct.layout.$refs.browseObject.show(mutable, viewProvider.key, true, currentObjectPath);
// openmct.layout.$refs.browseBar.domainObject = mutable;
// } else {
openmct.layout.$refs.browseObject.show(object, viewProvider.key, true, currentObjectPath);
openmct.layout.$refs.browseBar.domainObject = object;
}
// }
openmct.layout.$refs.browseBar.viewKey = viewProvider.key;
}
@ -150,6 +154,7 @@ define([
}
function clearMutationListeners() {
console.log('celarMutationListeners');
if (openmct.router.path !== undefined) {
openmct.router.path.forEach((pathObject) => {
if (pathObject.isMutable) {