Compare commits

..

7 Commits

Author SHA1 Message Date
Shefali Joshi
9e33a804e5 Merge branch 'master' into fix-plan-grouping 2020-11-16 06:14:57 -08:00
Charles Hacskaylo
30ca4b707d Fix Imagery-related issue for VERVE #301 (#3520)
- Add 'display: flex' where needed to get main image to display in
preview overlay;
2020-11-13 16:09:01 -08:00
Deep Tailor
8e3e4c9035 Merge branch 'master' into fix-plan-grouping 2020-11-13 16:02:06 -08:00
Jamie V
27704c9a48 [Testing] Test UTC Time System at plugin level (#3517) 2020-11-13 14:25:58 -08:00
Joshi
c8cfedaa8a Address review comments 2020-11-13 07:47:34 -08:00
Joshi
cb07620488 Ensure that overlap checking only looks at activities within it's own group. This is done by assuming that any rows less than a group's starting row belong to another group.
Observe for changes to a plan and update the plan view accordingly.
2020-11-12 10:12:56 -08:00
Shefali Joshi
b0203f2272 Preparing master for the next sprint v1.4.1-SNAPSHOT (#3508) 2020-11-09 13:10:50 -08:00
6 changed files with 124 additions and 102 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "openmct",
"version": "1.4.0",
"version": "1.4.1-SNAPSHOT",
"description": "The Open MCT core platform",
"dependencies": {},
"devDependencies": {

View File

@@ -61,13 +61,21 @@ export default {
this.openmct.time.on("timeSystem", this.setScaleAndPlotActivities);
this.openmct.time.on("bounds", this.updateViewBounds);
this.resizeTimer = setInterval(this.resize, RESIZE_POLL_INTERVAL);
this.unlisten = this.openmct.objects.observe(this.domainObject, '*', this.observeForChanges);
},
destroyed() {
clearInterval(this.resizeTimer);
this.openmct.time.off("timeSystem", this.setScaleAndPlotActivities);
this.openmct.time.off("bounds", this.updateViewBounds);
if (this.unlisten) {
this.unlisten();
}
},
methods: {
observeForChanges(mutatedObject) {
this.validateJSON(mutatedObject.selectFile.body);
this.setScaleAndPlotActivities();
},
resize() {
if (this.$refs.axisHolder.clientWidth !== this.width) {
this.setDimensions();
@@ -200,7 +208,7 @@ export default {
return 0;
},
// Get the row where the next activity will land.
getRowForActivity(rectX, width, defaultActivityRow = 0) {
getRowForActivity(rectX, width, minimumActivityRow = 0) {
let currentRow;
let sortedActivityRows = Object.keys(this.activitiesByRow).sort(this.sortFn);
@@ -216,17 +224,18 @@ export default {
for (let i = 0; i < sortedActivityRows.length; i++) {
let row = sortedActivityRows[i];
if (getOverlap(this.activitiesByRow[row])) {
if (row >= minimumActivityRow && getOverlap(this.activitiesByRow[row])) {
currentRow = row;
break;
}
}
if (currentRow === undefined && sortedActivityRows.length) {
currentRow = parseInt(sortedActivityRows[sortedActivityRows.length - 1], 10) + ROW_HEIGHT + ROW_PADDING;
let row = Math.max(parseInt(sortedActivityRows[sortedActivityRows.length - 1], 10), minimumActivityRow);
currentRow = row + ROW_HEIGHT + ROW_PADDING;
}
return (currentRow || defaultActivityRow);
return (currentRow || minimumActivityRow);
},
calculatePlanLayout() {
this.activitiesByRow = {};
@@ -236,8 +245,9 @@ export default {
let groups = Object.keys(this.json);
groups.forEach((key, index) => {
let activities = this.json[key];
//set the currentRow to the beginning of the next logical row
currentRow = currentRow + ROW_HEIGHT * index;
//set the new group's first row. It should be greater than the largest row of the last group
let sortedActivityRows = Object.keys(this.activitiesByRow).sort(this.sortFn);
const groupRowStart = sortedActivityRows.length ? parseInt(sortedActivityRows[sortedActivityRows.length - 1], 10) + 1 : 0;
let newGroup = true;
activities.forEach((activity) => {
if (this.isActivityInBounds(activity)) {
@@ -256,9 +266,9 @@ export default {
const textWidth = textStart + this.getTextWidth(textLines[0]) + TEXT_LEFT_PADDING;
if (activityNameFitsRect) {
currentRow = this.getRowForActivity(rectX, rectWidth);
currentRow = this.getRowForActivity(rectX, rectWidth, groupRowStart);
} else {
currentRow = this.getRowForActivity(rectX, textWidth);
currentRow = this.getRowForActivity(rectX, textWidth, groupRowStart);
}
let textY = parseInt(currentRow, 10) + (activityNameFitsRect ? INNER_TEXT_PADDING : OUTER_TEXT_PADDING);

View File

@@ -1,44 +0,0 @@
/*****************************************************************************
* Open MCT Web, Copyright (c) 2014-2015, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
* Open MCT Web 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 Web 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.
*****************************************************************************/
define(["./LocalClock"], function (LocalClock) {
describe("The LocalClock class", function () {
let clock;
let mockTimeout;
const timeoutHandle = {};
beforeEach(function () {
mockTimeout = jasmine.createSpy("timeout");
mockTimeout.and.returnValue(timeoutHandle);
clock = new LocalClock(0);
clock.start();
});
it("calls listeners on tick with current time", function () {
const mockListener = jasmine.createSpy("listener");
clock.on('tick', mockListener);
clock.tick();
expect(mockListener).toHaveBeenCalledWith(jasmine.any(Number));
});
});
});

View File

@@ -1,48 +0,0 @@
/*****************************************************************************
* Open MCT Web, Copyright (c) 2014-2015, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
* Open MCT Web 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 Web 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.
*****************************************************************************/
define(['./UTCTimeSystem'], function (UTCTimeSystem) {
describe("The UTCTimeSystem class", function () {
let timeSystem;
let mockTimeout;
beforeEach(function () {
mockTimeout = jasmine.createSpy("timeout");
timeSystem = new UTCTimeSystem(mockTimeout);
});
it("Uses the UTC time format", function () {
expect(timeSystem.timeFormat).toBe('utc');
});
it("is UTC based", function () {
expect(timeSystem.isUTCBased).toBe(true);
});
it("defines expected metadata", function () {
expect(timeSystem.key).toBeDefined();
expect(timeSystem.name).toBeDefined();
expect(timeSystem.cssClass).toBeDefined();
expect(timeSystem.durationFormat).toBeDefined();
});
});
});

View File

@@ -0,0 +1,103 @@
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2020, 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 LocalClock from './LocalClock.js';
import UTCTimeSystem from './UTCTimeSystem';
import {
createOpenMct,
resetApplicationState
} from 'utils/testing';
describe("The UTC Time System", () => {
const UTC_SYSTEM_AND_FORMAT_KEY = 'utc';
let openmct;
let utcTimeSystem;
let mockTimeout;
beforeEach(() => {
openmct = createOpenMct();
openmct.install(openmct.plugins.UTCTimeSystem());
});
afterEach(() => {
return resetApplicationState(openmct);
});
describe("plugin", function () {
beforeEach(function () {
mockTimeout = jasmine.createSpy("timeout");
utcTimeSystem = new UTCTimeSystem(mockTimeout);
});
it("is installed", () => {
let timeSystems = openmct.time.getAllTimeSystems();
let utc = timeSystems.find(ts => ts.key === UTC_SYSTEM_AND_FORMAT_KEY);
expect(utc).not.toEqual(-1);
});
it("can be set to be the main time system", () => {
openmct.time.timeSystem(UTC_SYSTEM_AND_FORMAT_KEY, {
start: 0,
end: 4
});
expect(openmct.time.timeSystem().key).toBe(UTC_SYSTEM_AND_FORMAT_KEY);
});
it("uses the utc time format", () => {
expect(utcTimeSystem.timeFormat).toBe(UTC_SYSTEM_AND_FORMAT_KEY);
});
it("is UTC based", () => {
expect(utcTimeSystem.isUTCBased).toBe(true);
});
it("defines expected metadata", () => {
expect(utcTimeSystem.key).toBe(UTC_SYSTEM_AND_FORMAT_KEY);
expect(utcTimeSystem.name).toBeDefined();
expect(utcTimeSystem.cssClass).toBeDefined();
expect(utcTimeSystem.durationFormat).toBeDefined();
});
});
describe("LocalClock class", function () {
let clock;
const timeoutHandle = {};
beforeEach(function () {
mockTimeout = jasmine.createSpy("timeout");
mockTimeout.and.returnValue(timeoutHandle);
clock = new LocalClock(0);
clock.start();
});
it("calls listeners on tick with current time", function () {
const mockListener = jasmine.createSpy("listener");
clock.on('tick', mockListener);
clock.tick();
expect(mockListener).toHaveBeenCalledWith(jasmine.any(Number));
});
});
});

View File

@@ -13,8 +13,9 @@
}
&__object-view {
display: flex;
flex: 1 1 auto;
height: 0; // Chrome 73
height: 100%; // Chrome 73
overflow: auto;
> div:not([class]) {