linting fixes

This commit is contained in:
Jamie Vigliotta
2020-08-14 10:44:02 -07:00
813 changed files with 7410 additions and 4438 deletions

View File

@ -58,7 +58,7 @@ export default {
isEditing: this.openmct.editor.isEditing(),
telemetryFormat: undefined,
nonMixedFormat: false
}
};
},
mounted() {
this.openmct.editor.on('isEditing', this.toggleEdit);
@ -99,6 +99,6 @@ export default {
this.telemetryFormat = this.nonMixedFormat ? format : '';
}
}
}
};
</script>

View File

@ -37,7 +37,7 @@
</template>
<script>
import LayoutFrame from './LayoutFrame.vue'
import LayoutFrame from './LayoutFrame.vue';
import conditionalStylesMixin from '../mixins/objectStyles-mixin';
export default {
@ -118,5 +118,5 @@ export default {
this.removeSelectable();
}
}
}
};
</script>

View File

@ -74,14 +74,14 @@
<script>
import uuid from 'uuid';
import SubobjectView from './SubobjectView.vue'
import TelemetryView from './TelemetryView.vue'
import BoxView from './BoxView.vue'
import TextView from './TextView.vue'
import LineView from './LineView.vue'
import ImageView from './ImageView.vue'
import EditMarquee from './EditMarquee.vue'
import _ from 'lodash'
import SubobjectView from './SubobjectView.vue';
import TelemetryView from './TelemetryView.vue';
import BoxView from './BoxView.vue';
import TextView from './TextView.vue';
import LineView from './LineView.vue';
import ImageView from './ImageView.vue';
import EditMarquee from './EditMarquee.vue';
import _ from 'lodash';
const TELEMETRY_IDENTIFIER_FUNCTIONS = {
'table': (domainObject) => {
@ -102,10 +102,11 @@ const TELEMETRY_IDENTIFIER_FUNCTIONS = {
identifiers.push(object.identifier);
}
});
return Promise.resolve(identifiers);
});
}
}
};
const ITEM_TYPE_VIEW_MAP = {
'subobject-view': SubobjectView,
@ -151,6 +152,7 @@ export default {
},
data() {
let domainObject = JSON.parse(JSON.stringify(this.domainObject));
return {
internalDomainObject: domainObject,
initSelectIndex: undefined,
@ -171,8 +173,9 @@ export default {
},
showMarquee() {
let selectionPath = this.selection[0];
let singleSelectedLine = this.selection.length === 1 &&
selectionPath[0].context.layoutItem && selectionPath[0].context.layoutItem.type === 'line-view';
let singleSelectedLine = this.selection.length === 1
&& selectionPath[0].context.layoutItem && selectionPath[0].context.layoutItem.type === 'line-view';
return this.isEditing && selectionPath && selectionPath.length > 1 && !singleSelectedLine;
}
},
@ -210,7 +213,9 @@ export default {
if ($event) {
$event.stopImmediatePropagation();
}
this.dragInProgress = false;
return;
}
},
@ -364,20 +369,21 @@ export default {
if (this.internalDomainObject.locked) {
return;
}
// Get the ID of the dragged object
let draggedKeyString = $event.dataTransfer.types
.filter(type => type.startsWith(DRAG_OBJECT_TRANSFER_PREFIX))
.map(type => type.substring(DRAG_OBJECT_TRANSFER_PREFIX.length))[0];
// If the layout already contains the given object, then shortcut the default dragover behavior and
// potentially allow drop. Display layouts allow drag drop of duplicate telemetry objects.
// If the layout already contains the given object, then shortcut the default dragover behavior and
// potentially allow drop. Display layouts allow drag drop of duplicate telemetry objects.
if (this.containsObject(draggedKeyString)) {
$event.preventDefault();
}
},
isTelemetry(domainObject) {
if (this.openmct.telemetry.isTelemetryObject(domainObject) &&
!this.options.showAsView.includes(domainObject.type)) {
if (this.openmct.telemetry.isTelemetryObject(domainObject)
&& !this.options.showAsView.includes(domainObject.type)) {
return true;
} else {
return false;
@ -423,9 +429,9 @@ export default {
return;
}
let keyString = this.openmct.objects.makeKeyString(item.identifier),
telemetryViewCount = this.telemetryViewMap[keyString],
objectViewCount = this.objectViewMap[keyString];
let keyString = this.openmct.objects.makeKeyString(item.identifier);
let telemetryViewCount = this.telemetryViewMap[keyString];
let objectViewCount = this.objectViewMap[keyString];
if (item.type === 'telemetry-view') {
telemetryViewCount = --this.telemetryViewMap[keyString];
@ -458,8 +464,8 @@ export default {
this.layoutItems.forEach(this.trackItem);
},
isItemAlreadyTracked(child) {
let found = false,
keyString = this.openmct.objects.makeKeyString(child.identifier);
let found = false;
let keyString = this.openmct.objects.makeKeyString(child.identifier);
this.layoutItems.forEach(item => {
if (item.identifier) {
@ -467,6 +473,7 @@ export default {
if (itemKeyString === keyString) {
found = true;
return;
}
}
@ -545,9 +552,9 @@ export default {
let newIndex = -1;
indices.forEach((itemIndex, index) => {
let isAdjacentItemSelected = position === 'up' ?
itemIndex + 1 === previousItemIndex :
itemIndex - 1 === previousItemIndex;
let isAdjacentItemSelected = position === 'up'
? itemIndex + 1 === previousItemIndex
: itemIndex - 1 === previousItemIndex;
if (index > 0 && isAdjacentItemSelected) {
if (position === 'up') {
@ -596,13 +603,13 @@ export default {
},
createNewDomainObject(domainObject, composition, viewType, nameExtension, model) {
let identifier = {
key: uuid(),
namespace: this.internalDomainObject.identifier.namespace
},
type = this.openmct.types.get(viewType),
parentKeyString = this.openmct.objects.makeKeyString(this.internalDomainObject.identifier),
objectName = nameExtension ? `${domainObject.name}-${nameExtension}` : domainObject.name,
object = {};
key: uuid(),
namespace: this.internalDomainObject.identifier.namespace
};
let type = this.openmct.types.get(viewType);
let parentKeyString = this.openmct.objects.makeKeyString(this.internalDomainObject.identifier);
let objectName = nameExtension ? `${domainObject.name}-${nameExtension}` : domainObject.name;
let object = {};
if (model) {
object = _.cloneDeep(model);
@ -612,6 +619,13 @@ export default {
object.composition.push(...composition);
}
if (object.modified || object.persisted) {
object.modified = undefined;
object.persisted = undefined;
delete object.modified;
delete object.persisted;
}
object.name = objectName;
object.identifier = identifier;
object.location = parentKeyString;
@ -632,11 +646,11 @@ export default {
shiftKey: true,
cancelable: true,
view: window
})
});
selectItemsArray.forEach((id) => {
let refId = `layout-item-${id}`,
component = this.$refs[refId] && this.$refs[refId][0];
let refId = `layout-item-${id}`;
let component = this.$refs[refId] && this.$refs[refId][0];
if (component) {
component.immediatelySelect = event;
@ -645,15 +659,15 @@ export default {
});
},
duplicateItem(selectedItems) {
let objectStyles = this.internalDomainObject.configuration.objectStyles || {},
selectItemsArray = [],
newDomainObjectsArray = [];
let objectStyles = this.internalDomainObject.configuration.objectStyles || {};
let selectItemsArray = [];
let newDomainObjectsArray = [];
selectedItems.forEach(selectedItem => {
let layoutItem = selectedItem[0].context.layoutItem,
domainObject = selectedItem[0].context.item,
layoutItemStyle = objectStyles[layoutItem.id],
copy = _.cloneDeep(layoutItem);
let layoutItem = selectedItem[0].context.layoutItem;
let domainObject = selectedItem[0].context.item;
let layoutItemStyle = objectStyles[layoutItem.id];
let copy = _.cloneDeep(layoutItem);
copy.id = uuid();
selectItemsArray.push(copy.id);
@ -672,7 +686,7 @@ export default {
}
offsetKeys.forEach(key => {
copy[key] += DUPLICATE_OFFSET
copy[key] += DUPLICATE_OFFSET;
});
if (layoutItemStyle) {
@ -696,16 +710,16 @@ export default {
},
mergeMultipleTelemetryViews(selection, viewType) {
let identifiers = selection.map(selectedItem => {
return selectedItem[0].context.layoutItem.identifier;
}),
firstDomainObject = selection[0][0].context.item,
firstLayoutItem = selection[0][0].context.layoutItem,
position = [firstLayoutItem.x, firstLayoutItem.y],
mockDomainObject = {
name: 'Merged Telemetry Views',
identifier: firstDomainObject.identifier
},
newDomainObject = this.createNewDomainObject(mockDomainObject, identifiers, viewType);
return selectedItem[0].context.layoutItem.identifier;
});
let firstDomainObject = selection[0][0].context.item;
let firstLayoutItem = selection[0][0].context.layoutItem;
let position = [firstLayoutItem.x, firstLayoutItem.y];
let mockDomainObject = {
name: 'Merged Telemetry Views',
identifier: firstDomainObject.identifier
};
let newDomainObject = this.createNewDomainObject(mockDomainObject, identifiers, viewType);
this.composition.add(newDomainObject);
this.addItem('subobject-view', newDomainObject, position);
@ -713,18 +727,18 @@ export default {
this.initSelectIndex = this.layoutItems.length - 1;
},
mergeMultipleOverlayPlots(selection, viewType) {
let overlayPlots = selection.map(selectedItem => selectedItem[0].context.item),
overlayPlotIdentifiers = overlayPlots.map(overlayPlot => overlayPlot.identifier),
firstOverlayPlot = overlayPlots[0],
firstLayoutItem = selection[0][0].context.layoutItem,
position = [firstLayoutItem.x, firstLayoutItem.y],
mockDomainObject = {
name: 'Merged Overlay Plots',
identifier: firstOverlayPlot.identifier
},
newDomainObject = this.createNewDomainObject(mockDomainObject, overlayPlotIdentifiers, viewType),
newDomainObjectKeyString = this.openmct.objects.makeKeyString(newDomainObject.identifier),
internalDomainObjectKeyString = this.openmct.objects.makeKeyString(this.internalDomainObject.identifier);
let overlayPlots = selection.map(selectedItem => selectedItem[0].context.item);
let overlayPlotIdentifiers = overlayPlots.map(overlayPlot => overlayPlot.identifier);
let firstOverlayPlot = overlayPlots[0];
let firstLayoutItem = selection[0][0].context.layoutItem;
let position = [firstLayoutItem.x, firstLayoutItem.y];
let mockDomainObject = {
name: 'Merged Overlay Plots',
identifier: firstOverlayPlot.identifier
};
let newDomainObject = this.createNewDomainObject(mockDomainObject, overlayPlotIdentifiers, viewType);
let newDomainObjectKeyString = this.openmct.objects.makeKeyString(newDomainObject.identifier);
let internalDomainObjectKeyString = this.openmct.objects.makeKeyString(this.internalDomainObject.identifier);
this.composition.add(newDomainObject);
this.addItem('subobject-view', newDomainObject, position);
@ -748,10 +762,10 @@ export default {
}
},
switchViewType(context, viewType, selection) {
let domainObject = context.item,
layoutItem = context.layoutItem,
position = [layoutItem.x, layoutItem.y],
layoutType = 'subobject-view';
let domainObject = context.item;
let layoutItem = context.layoutItem;
let position = [layoutItem.x, layoutItem.y];
let layoutType = 'subobject-view';
if (layoutItem.type === 'telemetry-view') {
let newDomainObject = this.createNewDomainObject(domainObject, [domainObject.identifier], viewType);
@ -762,8 +776,8 @@ export default {
this.getTelemetryIdentifiers(domainObject).then((identifiers) => {
if (viewType === 'telemetry-view') {
identifiers.forEach((identifier, index) => {
let positionX = position[0] + (index * DUPLICATE_OFFSET),
positionY = position[1] + (index * DUPLICATE_OFFSET);
let positionX = position[0] + (index * DUPLICATE_OFFSET);
let positionY = position[1] + (index * DUPLICATE_OFFSET);
this.convertToTelemetryView(identifier, [positionX, positionY]);
});
@ -780,5 +794,5 @@ export default {
this.initSelectIndex = this.layoutItems.length - 1; //restore selection
}
}
}
};
</script>

View File

@ -46,7 +46,7 @@
</template>
<script>
import LayoutDrag from './../LayoutDrag'
import LayoutDrag from './../LayoutDrag';
export default {
inject: ['openmct'],
@ -65,7 +65,7 @@ export default {
data() {
return {
dragPosition: undefined
}
};
},
computed: {
marqueePosition() {
@ -109,7 +109,7 @@ export default {
y: y,
width: width,
height: height
}
};
},
marqueeStyle() {
return {
@ -159,8 +159,8 @@ export default {
let marqueeEndWidth = this.dragPosition.dimensions[0];
let marqueeEndHeight = this.dragPosition.dimensions[1];
let scaleWidth = marqueeEndWidth / marqueeStartWidth;
let scaleHeight = marqueeEndHeight / marqueeStartHeight;
let scaleWidth = marqueeEndWidth / marqueeStartWidth;
let scaleHeight = marqueeEndHeight / marqueeStartHeight;
let marqueeStart = {
x: marqueeStartX,
@ -187,5 +187,5 @@ export default {
event.preventDefault();
}
}
}
};
</script>

View File

@ -37,7 +37,7 @@
</template>
<script>
import LayoutFrame from './LayoutFrame.vue'
import LayoutFrame from './LayoutFrame.vue';
import conditionalStylesMixin from "../mixins/objectStyles-mixin";
export default {
@ -85,8 +85,10 @@ export default {
if (this.itemStyle.imageUrl !== undefined) {
backgroundImage = 'url(' + this.itemStyle.imageUrl + ')';
}
border = this.itemStyle.border;
}
return {
backgroundImage,
border
@ -122,5 +124,5 @@ export default {
this.removeSelectable();
}
}
}
};
</script>

View File

@ -39,8 +39,8 @@
</template>
<script>
import LayoutDrag from './../LayoutDrag'
import _ from 'lodash'
import LayoutDrag from './../LayoutDrag';
import _ from 'lodash';
export default {
inject: ['openmct'],
@ -63,6 +63,7 @@ export default {
computed: {
size() {
let {width, height} = this.item;
return {
width: (this.gridSize[0] * width),
height: (this.gridSize[1] * height)
@ -70,6 +71,7 @@ export default {
},
style() {
let {x, y, width, height} = this.item;
return {
left: (this.gridSize[0] * x) + 'px',
top: (this.gridSize[1] * y) + 'px',
@ -127,5 +129,5 @@ export default {
});
}
}
}
};
</script>

View File

@ -129,6 +129,7 @@ export default {
computed: {
showFrameEdit() {
let layoutItem = this.selection.length > 0 && this.selection[0][0].context.layoutItem;
return !this.multiSelect && layoutItem && layoutItem.id === this.item.id;
},
position() {
@ -136,13 +137,20 @@ export default {
if (this.dragging && this.dragPosition) {
({x, y, x2, y2} = this.dragPosition);
}
return {x, y, x2, y2};
return {
x,
y,
x2,
y2
};
},
stroke() {
if (this.itemStyle) {
if (this.itemStyle.border) {
return this.itemStyle.border.replace('1px solid ', '');
}
return '';
} else {
return this.item.stroke;
@ -154,6 +162,7 @@ export default {
let height = Math.max(this.gridSize[1] * Math.abs(y - y2), 1);
let left = this.gridSize[0] * Math.min(x, x2);
let top = this.gridSize[1] * Math.min(y, y2);
return {
left: `${left}px`,
top: `${top}px`,
@ -172,41 +181,67 @@ export default {
if (x2 === x) {
return 5; // Vertical line
}
if (y2 === y) {
return 6; // Horizontal line
}
if (x2 > x) {
if (y2 < y) {
return 1;
}
return 4;
}
if (y2 < y) {
return 2;
}
return 3;
},
linePosition() {
let pos = {};
switch(this.vectorQuadrant) {
switch (this.vectorQuadrant) {
case 1:
case 3:
// slopes up
pos = {x1: '0%', y1: '100%', x2: '100%', y2: '0%'};
pos = {
x1: '0%',
y1: '100%',
x2: '100%',
y2: '0%'
};
break;
case 5:
// vertical
pos = {x1: '0%', y1: '0%', x2: '0%', y2: '100%'};
pos = {
x1: '0%',
y1: '0%',
x2: '0%',
y2: '100%'
};
break;
case 6:
// horizontal
pos = {x1: '0%', y1: '0%', x2: '100%', y2: '0%'};
pos = {
x1: '0%',
y1: '0%',
x2: '100%',
y2: '0%'
};
break;
default:
// slopes down
pos = {x1: '0%', y1: '0%', x2: '100%', y2: '100%'};
pos = {
x1: '0%',
y1: '0%',
x2: '100%',
y2: '100%'
};
break;
}
return pos;
}
},
@ -238,6 +273,7 @@ export default {
if (this.removeSelectable) {
this.removeSelectable();
}
this.openmct.selection.off('change', this.setSelection);
},
methods: {
@ -247,7 +283,12 @@ export default {
document.body.addEventListener('mouseup', this.endDrag);
this.startPosition = [event.pageX, event.pageY];
let {x, y, x2, y2} = this.item;
this.dragPosition = {x, y, x2, y2};
this.dragPosition = {
x,
y,
x2,
y2
};
if (x === x2 || y === y2) {
if (y > y2 || x < x2) {
if (this.dragging === 'start') {
@ -257,6 +298,7 @@ export default {
}
}
}
event.preventDefault();
},
continueDrag(event) {
@ -282,8 +324,14 @@ export default {
if (!this.dragging) {
this.$emit('endMove');
} else {
this.$emit('endLineResize', this.item, {x, y, x2, y2});
this.$emit('endLineResize', this.item, {
x,
y,
x2,
y2
});
}
this.dragPosition = undefined;
this.dragging = undefined;
event.preventDefault();
@ -292,7 +340,12 @@ export default {
let gridDeltaX = Math.round(pxDeltaX / this.gridSize[0]);
let gridDeltaY = Math.round(pxDeltaY / this.gridSize[1]);
let {x, y, x2, y2} = this.item;
let dragPosition = {x, y, x2, y2};
let dragPosition = {
x,
y,
x2,
y2
};
if (this.dragging === 'start') {
dragPosition.x -= gridDeltaX;
@ -307,6 +360,7 @@ export default {
dragPosition.x2 -= gridDeltaX;
dragPosition.y2 -= gridDeltaY;
}
return dragPosition;
},
setSelection(selection) {
@ -318,5 +372,5 @@ export default {
});
}
}
}
};
</script>

View File

@ -40,13 +40,13 @@
</template>
<script>
import ObjectFrame from '../../../ui/components/ObjectFrame.vue'
import LayoutFrame from './LayoutFrame.vue'
import ObjectFrame from '../../../ui/components/ObjectFrame.vue';
import LayoutFrame from './LayoutFrame.vue';
const MINIMUM_FRAME_SIZE = [320, 180],
DEFAULT_DIMENSIONS = [10, 10],
DEFAULT_POSITION = [1, 1],
DEFAULT_HIDDEN_FRAME_TYPES = ['hyperlink', 'summary-widget', 'conditionWidget'];
const MINIMUM_FRAME_SIZE = [320, 180];
const DEFAULT_DIMENSIONS = [10, 10];
const DEFAULT_POSITION = [1, 1];
const DEFAULT_HIDDEN_FRAME_TYPES = ['hyperlink', 'summary-widget', 'conditionWidget'];
function getDefaultDimensions(gridSize) {
return MINIMUM_FRAME_SIZE.map((min, index) => {
@ -106,7 +106,7 @@ export default {
return {
domainObject: undefined,
currentObjectPath: []
}
};
},
watch: {
index(newIndex) {
@ -137,7 +137,7 @@ export default {
setObject(domainObject) {
this.domainObject = domainObject;
this.currentObjectPath = [this.domainObject].concat(this.objectPath.slice());
this.$nextTick(function () {
this.$nextTick(() => {
let childContext = this.$refs.objectFrame.getSelectionContext();
childContext.item = domainObject;
childContext.layoutItem = this.item;
@ -149,5 +149,5 @@ export default {
});
}
}
}
};
</script>

View File

@ -71,13 +71,13 @@
</template>
<script>
import LayoutFrame from './LayoutFrame.vue'
import printj from 'printj'
import LayoutFrame from './LayoutFrame.vue';
import printj from 'printj';
import conditionalStylesMixin from "../mixins/objectStyles-mixin";
const DEFAULT_TELEMETRY_DIMENSIONS = [10, 5],
DEFAULT_POSITION = [1, 1],
CONTEXT_MENU_ACTIONS = ['viewHistoricalData'];
const DEFAULT_TELEMETRY_DIMENSIONS = [10, 5];
const DEFAULT_POSITION = [1, 1];
const CONTEXT_MENU_ACTIONS = ['viewHistoricalData'];
export default {
makeDefinition(openmct, gridSize, domainObject, position) {
@ -130,7 +130,7 @@ export default {
formats: undefined,
domainObject: undefined,
currentObjectPath: undefined
}
};
},
computed: {
showLabel() {
@ -181,6 +181,7 @@ export default {
}
let alarm = this.limitEvaluator && this.limitEvaluator.evaluate(this.datum, this.valueMetadata);
return alarm && alarm.cssClass;
}
},
@ -283,6 +284,6 @@ export default {
this.openmct.contextMenu._showContextMenuForObjectPath(this.currentObjectPath, event.x, event.y, CONTEXT_MENU_ACTIONS);
}
}
}
};
</script>

View File

@ -39,7 +39,7 @@
</template>
<script>
import LayoutFrame from './LayoutFrame.vue'
import LayoutFrame from './LayoutFrame.vue';
import conditionalStylesMixin from "../mixins/objectStyles-mixin";
export default {
@ -118,5 +118,5 @@ export default {
this.removeSelectable();
}
}
}
};
</script>