mirror of
https://github.com/nasa/openmct.git
synced 2025-06-25 02:29:24 +00:00
Compare commits
35 Commits
master
...
feature/is
Author | SHA1 | Date | |
---|---|---|---|
dfbd85bbd9 | |||
73057df6c9 | |||
a3e0dbf827 | |||
b1b5528f17 | |||
4ff226469f | |||
b208991661 | |||
a5a3bf6b9b | |||
49a85c553d | |||
68a5d5a3af | |||
ecfded69ee | |||
354a14c89e | |||
f212bbad77 | |||
ba3169ff66 | |||
6d048338f1 | |||
ca9ba1978c | |||
2c07314b01 | |||
2f8243c39f | |||
2f60bb727f | |||
99da1b84a0 | |||
fb066d13f7 | |||
eaecfe8443 | |||
01e981b625 | |||
ac9be7df3a | |||
f75a159a1d | |||
5a2c04a48d | |||
28430d008f | |||
f05b690c1d | |||
38a6954581 | |||
e65baab202 | |||
0599ecf624 | |||
28e10ea52d | |||
fb80ae2262 | |||
a033e4a552 | |||
56fa2ce824 | |||
3e204b4ef5 |
@ -202,8 +202,13 @@ class IndependentTimeContext extends TimeContext {
|
||||
}
|
||||
|
||||
getUpstreamContext() {
|
||||
let timeContext = this.globalTimeContext;
|
||||
const objectKey = this.openmct.objects.makeKeyString(this.objectPath[this.objectPath.length - 1].identifier);
|
||||
const doesObjectHaveTimeContext = this.globalTimeContext.independentContexts.get(objectKey);
|
||||
if (doesObjectHaveTimeContext) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
let timeContext = this.globalTimeContext;
|
||||
this.objectPath.some((item, index) => {
|
||||
const key = this.openmct.objects.makeKeyString(item.identifier);
|
||||
//last index is the view object itself
|
||||
|
@ -31,8 +31,8 @@ export default class OpenInNewTab {
|
||||
|
||||
this._openmct = openmct;
|
||||
}
|
||||
invoke(objectPath) {
|
||||
let url = objectPathToUrl(this._openmct, objectPath);
|
||||
invoke(objectPath, urlParams = undefined) {
|
||||
let url = objectPathToUrl(this._openmct, objectPath, urlParams);
|
||||
window.open(url);
|
||||
}
|
||||
}
|
||||
|
@ -383,10 +383,8 @@ export default {
|
||||
},
|
||||
setTimeContext() {
|
||||
this.stopFollowingTimeContext();
|
||||
|
||||
this.timeContext = this.openmct.time.getContextForView(this.path);
|
||||
this.followTimeContext();
|
||||
|
||||
},
|
||||
followTimeContext() {
|
||||
this.updateDisplayBounds(this.timeContext.bounds());
|
||||
|
@ -24,9 +24,27 @@
|
||||
* Module defining url handling.
|
||||
*/
|
||||
|
||||
export function paramsToArray(openmct) {
|
||||
// parse urlParams from an object to an array.
|
||||
function getUrlParams(openmct, customUrlParams = {}) {
|
||||
let urlParams = openmct.router.getParams();
|
||||
Object.entries(customUrlParams).forEach((urlParam) => {
|
||||
const [key, value] = urlParam;
|
||||
urlParams[key] = value;
|
||||
});
|
||||
|
||||
if (urlParams['tc.mode'] === 'fixed') {
|
||||
delete urlParams['tc.startDelta'];
|
||||
delete urlParams['tc.endDelta'];
|
||||
} else if (urlParams['tc.mode'] === 'local') {
|
||||
delete urlParams['tc.startBound'];
|
||||
delete urlParams['tc.endBound'];
|
||||
}
|
||||
|
||||
return urlParams;
|
||||
}
|
||||
|
||||
export function paramsToArray(openmct, customUrlParams = {}) {
|
||||
// parse urlParams from an object to an array.
|
||||
let urlParams = getUrlParams(openmct, customUrlParams);
|
||||
let newTabParams = [];
|
||||
for (let key in urlParams) {
|
||||
if ({}.hasOwnProperty.call(urlParams, key)) {
|
||||
@ -42,9 +60,9 @@ export function identifierToString(openmct, objectPath) {
|
||||
return '#/browse/' + openmct.objects.getRelativePath(objectPath);
|
||||
}
|
||||
|
||||
export default function objectPathToUrl(openmct, objectPath) {
|
||||
export default function objectPathToUrl(openmct, objectPath, customUrlParams = {}) {
|
||||
let url = identifierToString(openmct, objectPath);
|
||||
let urlParams = paramsToArray(openmct);
|
||||
let urlParams = paramsToArray(openmct, customUrlParams);
|
||||
if (urlParams.length) {
|
||||
url += '?' + urlParams.join('&');
|
||||
}
|
||||
|
@ -66,5 +66,14 @@ describe('the url tool', function () {
|
||||
const constructedURL = objectPathToUrl(openmct, mockObjectPath);
|
||||
expect(constructedURL).toContain('#/browse/mock-parent-folder/mock-folder');
|
||||
});
|
||||
it('can take params to set a custom url', () => {
|
||||
const customParams = {
|
||||
'tc.startBound': 1669911059,
|
||||
'tc.endBound': 1669911082,
|
||||
'tc.mode': 'fixed'
|
||||
};
|
||||
const constructedURL = objectPathToUrl(openmct, mockObjectPath, customParams);
|
||||
expect(constructedURL).toContain('tc.startBound=1669911059&tc.endBound=1669911082&tc.mode=fixed');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -22,8 +22,10 @@
|
||||
|
||||
import ObjectView from './ObjectView.vue';
|
||||
import StackedPlot from '../../plugins/plot/stackedPlot/StackedPlot.vue';
|
||||
import Plot from '../../plugins/plot/Plot.vue';
|
||||
|
||||
export default {
|
||||
ObjectView,
|
||||
StackedPlot
|
||||
StackedPlot,
|
||||
Plot
|
||||
};
|
||||
|
Reference in New Issue
Block a user