Compare commits

..

1 Commits

Author SHA1 Message Date
Andrew Henry
a8ebf3d00c Some experimentation resulting in slightly lower CPU usage, but broken scrolling 2019-03-29 12:57:32 -07:00
7 changed files with 36 additions and 67 deletions

View File

@@ -65,8 +65,7 @@ define([
"depends": [
"$document",
"$compile",
"$rootScope",
"$timeout"
"$rootScope"
]
}
],

View File

@@ -44,9 +44,8 @@ define(
* @memberof platform/commonUI/dialog
* @constructor
*/
function OverlayService($document, $compile, $rootScope, $timeout) {
function OverlayService($document, $compile, $rootScope) {
this.$compile = $compile;
this.$timeout = $timeout;
// Don't include $document and $rootScope directly;
// avoids https://docs.angularjs.org/error/ng/cpws
@@ -94,14 +93,12 @@ define(
scope.key = key;
scope.typeClass = typeClass || 't-dialog';
this.$timeout(() => {
// Create the overlay element and add it to the document's body
element = this.$compile(TEMPLATE)(scope);
// Append so that most recent dialog is last in DOM. This means the most recent dialog will be on top when
// multiple overlays with the same z-index are active.
this.findBody().append(element);
});
// Create the overlay element and add it to the document's body
element = this.$compile(TEMPLATE)(scope);
// Append so that most recent dialog is last in DOM. This means the most recent dialog will be on top when
// multiple overlays with the same z-index are active.
this.findBody().append(element);
return {
dismiss: dismiss

View File

@@ -35,20 +35,16 @@ define(
mockTemplate,
mockElement,
mockScope,
mockTimeout,
overlayService;
beforeEach(function () {
mockDocument = jasmine.createSpyObj("$document", ["find"]);
mockCompile = jasmine.createSpy("$compile");
mockRootScope = jasmine.createSpyObj("$rootScope", ["$new"]);
mockBody = jasmine.createSpyObj("body", ["append"]);
mockBody = jasmine.createSpyObj("body", ["prepend"]);
mockTemplate = jasmine.createSpy("template");
mockElement = jasmine.createSpyObj("element", ["remove"]);
mockScope = jasmine.createSpyObj("scope", ["$destroy"]);
mockTimeout = function (callback) {
callback();
}
mockDocument.find.and.returnValue(mockBody);
mockCompile.and.returnValue(mockTemplate);
@@ -58,8 +54,7 @@ define(
overlayService = new OverlayService(
mockDocument,
mockCompile,
mockRootScope,
mockTimeout
mockRootScope
);
});
@@ -72,7 +67,7 @@ define(
it("adds the templated element to the body", function () {
overlayService.createOverlay("test", {});
expect(mockBody.append).toHaveBeenCalledWith(mockElement);
expect(mockBody.prepend).toHaveBeenCalledWith(mockElement);
});
it("places the provided model/key in its template's scope", function () {

View File

@@ -356,7 +356,7 @@ define([
legacyRegistry.enable('adapter');
this.router.route(/^\/$/, () => {
this.router.setPath('/browse/');
this.router.setPath('/browse/mine');
});
/**

View File

@@ -280,11 +280,7 @@ define([
if (!provider) {
return Promise.reject('No provider found');
}
return provider.request.apply(provider, arguments).catch((rejected) => {
this.openmct.notifications.error('Error requesting telemetry data, see console for details');
console.error(rejected);
return Promise.reject(rejected);
});
return provider.request.apply(provider, arguments);
};
/**

View File

@@ -173,7 +173,6 @@
&__body-w {
// Wraps __body table provides scrolling
flex: 1 1 100%;
height: 0; // Fixes Chrome 73 overflow bug
overflow-x: auto;
overflow-y: scroll;
}
@@ -433,9 +432,9 @@ export default {
shouldSnapToBottom() {
return this.scrollable.scrollTop >= (this.scrollable.scrollHeight - this.scrollable.offsetHeight - AUTO_SCROLL_TRIGGER_HEIGHT);
},
scrollToBottom() {
scrollToBottom: _.throttle(function() {
this.scrollable.scrollTop = this.scrollable.scrollHeight;
},
}, 100),
synchronizeScrollX() {
this.headersHolderEl.scrollLeft = this.scrollable.scrollLeft;
},

View File

@@ -9,27 +9,11 @@ define([
let browseObject;
let unobserve = undefined;
openmct.router.route(/^\/browse\/?$/, navigateToFirstChildOfRoot);
openmct.router.route(/^\/browse\/(.*)$/, (path, results, params) => {
let navigatePath = results[1];
navigateToPath(navigatePath, params.view);
});
openmct.router.on('change:params', function (newParams, oldParams, changed) {
if (changed.view && browseObject) {
let provider = openmct
.objectViews
.getByProviderKey(changed.view);
viewObject(browseObject, provider);
}
});
function viewObject(object, viewProvider) {
openmct.layout.$refs.browseObject.show(object, viewProvider.key, true);
openmct.layout.$refs.browseBar.domainObject = object;
openmct.layout.$refs.browseBar.viewKey = viewProvider.key;
}
};
function navigateToPath(path, currentViewKey) {
navigateCall++;
@@ -40,12 +24,13 @@ define([
unobserve = undefined;
}
//Split path into object identifiers
if (!Array.isArray(path)) {
path = path.split('/');
}
return pathToObjects(path).then((objects)=>{
return Promise.all(path.map((keyString)=>{
return openmct.objects.get(keyString);
})).then((objects)=>{
if (currentNavigation !== navigateCall) {
return; // Prevent race.
}
@@ -94,25 +79,23 @@ define([
});
}
function pathToObjects(path) {
return Promise.all(path.map((keyString)=>{
return openmct.objects.get(keyString);
}));
}
openmct.router.route(/^\/browse\/(.*)$/, (path, results, params) => {
let navigatePath = results[1];
if (!navigatePath) {
navigatePath = 'mine';
}
navigateToPath(navigatePath, params.view);
});
openmct.router.on('change:params', function (newParams, oldParams, changed) {
if (changed.view && browseObject) {
let provider = openmct
.objectViews
.getByProviderKey(changed.view);
viewObject(browseObject, provider);
}
});
function navigateToFirstChildOfRoot() {
openmct.objects.get('ROOT').then(rootObject => {
openmct.composition.get(rootObject).load()
.then(children => {
let lastChild = children[children.length - 1];
if (!lastChild) {
console.error('Unable to navigate to anything. No root objects found.');
} else {
let lastChildId = openmct.objects.makeKeyString(lastChild.identifier);
openmct.router.setPath(`#/browse/${lastChildId}`);
}
});
});
}
}
});