mirror of
https://github.com/nasa/openmct.git
synced 2025-06-27 11:32:13 +00:00
Compare commits
15 Commits
eval-sourc
...
remove-lod
Author | SHA1 | Date | |
---|---|---|---|
d7ff80bf4f | |||
6170b51548 | |||
c1d0a6b4f3 | |||
eb5050b8ef | |||
b66a599c69 | |||
835bcbcb5a | |||
40c9546415 | |||
0622dbe78c | |||
2b96a8994c | |||
5efa7f69e4 | |||
33bb1c202e | |||
d73e9f6dae | |||
691742d8f0 | |||
ef4312e29a | |||
09cfe4f99a |
@ -12,7 +12,8 @@ module.exports = {
|
|||||||
"extends": [
|
"extends": [
|
||||||
"eslint:recommended",
|
"eslint:recommended",
|
||||||
"plugin:vue/recommended",
|
"plugin:vue/recommended",
|
||||||
"plugin:lodash/recommended"
|
"plugin:lodash/recommended",
|
||||||
|
"plugin:you-dont-need-lodash-underscore/compatible"
|
||||||
],
|
],
|
||||||
"parser": "vue-eslint-parser",
|
"parser": "vue-eslint-parser",
|
||||||
"parserOptions": {
|
"parserOptions": {
|
||||||
@ -24,6 +25,7 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"rules": {
|
"rules": {
|
||||||
|
"you-dont-need-lodash-underscore/omit": "off",
|
||||||
"lodash/prefer-lodash-method": "off",
|
"lodash/prefer-lodash-method": "off",
|
||||||
"lodash/prefer-lodash-typecheck": "off",
|
"lodash/prefer-lodash-typecheck": "off",
|
||||||
"lodash/prefer-constant": "off",
|
"lodash/prefer-constant": "off",
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
"eslint": "5.2.0",
|
"eslint": "5.2.0",
|
||||||
"eslint-plugin-lodash": "^6.0.0",
|
"eslint-plugin-lodash": "^6.0.0",
|
||||||
"eslint-plugin-vue": "^6.0.0",
|
"eslint-plugin-vue": "^6.0.0",
|
||||||
|
"eslint-plugin-you-dont-need-lodash-underscore": "^6.10.0",
|
||||||
"eventemitter3": "^1.2.0",
|
"eventemitter3": "^1.2.0",
|
||||||
"exports-loader": "^0.7.0",
|
"exports-loader": "^0.7.0",
|
||||||
"express": "^4.13.1",
|
"express": "^4.13.1",
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
* at runtime from the About dialog for additional information.
|
* at runtime from the About dialog for additional information.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
define(['lodash'], function (_) {
|
define([], function (_) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The ExportAsJSONAction is available from context menus and allows a user
|
* The ExportAsJSONAction is available from context menus and allows a user
|
||||||
@ -121,8 +121,8 @@ define(['lodash'], function (_) {
|
|||||||
*/
|
*/
|
||||||
ExportAsJSONAction.prototype.rewriteLink = function (child, parent) {
|
ExportAsJSONAction.prototype.rewriteLink = function (child, parent) {
|
||||||
this.externalIdentifiers.push(this.getId(child));
|
this.externalIdentifiers.push(this.getId(child));
|
||||||
var index = _.findIndex(parent.composition, function (id) {
|
var index = parent.composition.findIndex(function (id) {
|
||||||
return _.isEqual(child.identifier, id);
|
return JSON.stringify(child.identifier) === JSON.stringify(id);
|
||||||
});
|
});
|
||||||
var copyOfChild = this.copyObject(child);
|
var copyOfChild = this.copyObject(child);
|
||||||
copyOfChild.identifier.key = this.identifierService.generate();
|
copyOfChild.identifier.key = this.identifierService.generate();
|
||||||
|
@ -25,8 +25,7 @@
|
|||||||
* Module defining GenericSearchProvider. Created by shale on 07/16/2015.
|
* Module defining GenericSearchProvider. Created by shale on 07/16/2015.
|
||||||
*/
|
*/
|
||||||
define([
|
define([
|
||||||
'../../../../src/api/objects/object-utils',
|
'../../../../src/api/objects/object-utils'
|
||||||
'lodash'
|
|
||||||
], function (
|
], function (
|
||||||
objectUtils,
|
objectUtils,
|
||||||
_
|
_
|
||||||
@ -191,9 +190,7 @@ define([
|
|||||||
}
|
}
|
||||||
|
|
||||||
var domainObject = objectUtils.toNewFormat(model, id);
|
var domainObject = objectUtils.toNewFormat(model, id);
|
||||||
var composition = _.find(this.openmct.composition.registry, function (p) {
|
var composition = this.openmct.composition.registry.find(p => p.appliesTo(domainObject));
|
||||||
return p.appliesTo(domainObject);
|
|
||||||
});
|
|
||||||
|
|
||||||
if (!composition) {
|
if (!composition) {
|
||||||
return;
|
return;
|
||||||
|
@ -75,7 +75,7 @@ export default {
|
|||||||
this.items.push(item);
|
this.items.push(item);
|
||||||
},
|
},
|
||||||
removeItem(identifier) {
|
removeItem(identifier) {
|
||||||
let index = _.findIndex(this.items, (item) => this.openmct.objects.makeKeyString(identifier) === item.key);
|
let index = this.items.findIndex(item => this.openmct.objects.makeKeyString(identifier) === item.key);
|
||||||
|
|
||||||
this.items.splice(index, 1);
|
this.items.splice(index, 1);
|
||||||
},
|
},
|
||||||
|
@ -102,7 +102,7 @@ export default {
|
|||||||
this.compositions.push({composition, addCallback, removeCallback});
|
this.compositions.push({composition, addCallback, removeCallback});
|
||||||
},
|
},
|
||||||
removePrimary(identifier) {
|
removePrimary(identifier) {
|
||||||
let index = _.findIndex(this.primaryTelemetryObjects, (primary) => this.openmct.objects.makeKeyString(identifier) === primary.key),
|
let index = this.primaryTelemetryObjects.findIndex(primary => this.openmct.objects.makeKeyString(identifier) === primary.key),
|
||||||
primary = this.primaryTelemetryObjects[index];
|
primary = this.primaryTelemetryObjects[index];
|
||||||
|
|
||||||
this.$set(this.secondaryTelemetryObjects, primary.key, undefined);
|
this.$set(this.secondaryTelemetryObjects, primary.key, undefined);
|
||||||
@ -130,7 +130,7 @@ export default {
|
|||||||
removeSecondary(primary) {
|
removeSecondary(primary) {
|
||||||
return (identifier) => {
|
return (identifier) => {
|
||||||
let array = this.secondaryTelemetryObjects[primary.key],
|
let array = this.secondaryTelemetryObjects[primary.key],
|
||||||
index = _.findIndex(array, (secondary) => this.openmct.objects.makeKeyString(identifier) === secondary.key);
|
index = array.findIndex(secondary => this.openmct.objects.makeKeyString(identifier) === secondary.key);
|
||||||
|
|
||||||
array.splice(index, 1);
|
array.splice(index, 1);
|
||||||
|
|
||||||
|
@ -197,7 +197,7 @@ export default {
|
|||||||
this.$emit('telemetryUpdated', this.telemetryObjs);
|
this.$emit('telemetryUpdated', this.telemetryObjs);
|
||||||
},
|
},
|
||||||
removeTelemetryObject(identifier) {
|
removeTelemetryObject(identifier) {
|
||||||
let index = _.findIndex(this.telemetryObjs, (obj) => {
|
let index = this.telemetryObjs.findIndex(obj => {
|
||||||
let objId = this.openmct.objects.makeKeyString(obj.identifier);
|
let objId = this.openmct.objects.makeKeyString(obj.identifier);
|
||||||
let id = this.openmct.objects.makeKeyString(identifier);
|
let id = this.openmct.objects.makeKeyString(identifier);
|
||||||
return objId === id;
|
return objId === id;
|
||||||
|
@ -68,7 +68,6 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import uuid from 'uuid';
|
import uuid from 'uuid';
|
||||||
|
|
||||||
import SubobjectView from './SubobjectView.vue'
|
import SubobjectView from './SubobjectView.vue'
|
||||||
import TelemetryView from './TelemetryView.vue'
|
import TelemetryView from './TelemetryView.vue'
|
||||||
import BoxView from './BoxView.vue'
|
import BoxView from './BoxView.vue'
|
||||||
@ -375,7 +374,9 @@ export default {
|
|||||||
indices.push(selectedItem[0].context.index);
|
indices.push(selectedItem[0].context.index);
|
||||||
this.untrackItem(selectedItem[0].context.layoutItem);
|
this.untrackItem(selectedItem[0].context.layoutItem);
|
||||||
});
|
});
|
||||||
_.pullAt(this.layoutItems, indices);
|
while(indices.length) {
|
||||||
|
this.layoutItems.splice(indices.pop(), 1);
|
||||||
|
}
|
||||||
this.mutate("configuration.items", this.layoutItems);
|
this.mutate("configuration.items", this.layoutItems);
|
||||||
this.$el.click();
|
this.$el.click();
|
||||||
},
|
},
|
||||||
@ -512,7 +513,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
updateTelemetryFormat(item, format) {
|
updateTelemetryFormat(item, format) {
|
||||||
let index = _.findIndex(this.layoutItems, item);
|
let index = this.layoutItems.findIndex(item);
|
||||||
item.format = format;
|
item.format = format;
|
||||||
this.mutate(`configuration.items[${index}]`, item);
|
this.mutate(`configuration.items[${index}]`, item);
|
||||||
}
|
}
|
||||||
|
@ -55,6 +55,7 @@ export default {
|
|||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
hasActiveFilters() {
|
hasActiveFilters() {
|
||||||
|
console.log('hasActiveFilters');
|
||||||
// Should be true when the user has entered any filter values.
|
// Should be true when the user has entered any filter values.
|
||||||
return Object.values(this.persistedFilters).some(filters => {
|
return Object.values(this.persistedFilters).some(filters => {
|
||||||
return Object.values(filters).some(comparator => {
|
return Object.values(filters).some(comparator => {
|
||||||
@ -63,6 +64,7 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
hasMixedFilters() {
|
hasMixedFilters() {
|
||||||
|
console.log('hasMixedFilters')
|
||||||
// Should be true when filter values are mixed.
|
// Should be true when filter values are mixed.
|
||||||
let filtersToCompare = _.omit(this.persistedFilters[Object.keys(this.persistedFilters)[0]], [USE_GLOBAL]);
|
let filtersToCompare = _.omit(this.persistedFilters[Object.keys(this.persistedFilters)[0]], [USE_GLOBAL]);
|
||||||
return Object.values(this.persistedFilters).some(filters => {
|
return Object.values(this.persistedFilters).some(filters => {
|
||||||
@ -70,6 +72,7 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
label() {
|
label() {
|
||||||
|
console.log('label');
|
||||||
if (this.hasActiveFilters) {
|
if (this.hasActiveFilters) {
|
||||||
if (this.hasMixedFilters) {
|
if (this.hasMixedFilters) {
|
||||||
return FILTER_VIEW_TITLE_MIXED;
|
return FILTER_VIEW_TITLE_MIXED;
|
||||||
|
@ -111,7 +111,6 @@ import SearchResults from './search-results.vue';
|
|||||||
import Sidebar from './sidebar.vue';
|
import Sidebar from './sidebar.vue';
|
||||||
import { clearDefaultNotebook, getDefaultNotebook, setDefaultNotebook, setDefaultNotebookSection, setDefaultNotebookPage } from '../utils/notebook-storage';
|
import { clearDefaultNotebook, getDefaultNotebook, setDefaultNotebook, setDefaultNotebookSection, setDefaultNotebookPage } from '../utils/notebook-storage';
|
||||||
import { addNotebookEntry, createNewEmbed, getNotebookEntries } from '../utils/notebook-entries';
|
import { addNotebookEntry, createNewEmbed, getNotebookEntries } from '../utils/notebook-entries';
|
||||||
import { throttle } from 'lodash';
|
|
||||||
|
|
||||||
const DEFAULT_CLASS = 'is-notebook-default';
|
const DEFAULT_CLASS = 'is-notebook-default';
|
||||||
|
|
||||||
@ -175,7 +174,7 @@ export default {
|
|||||||
watch: {
|
watch: {
|
||||||
},
|
},
|
||||||
beforeMount() {
|
beforeMount() {
|
||||||
this.throttledSearchItem = throttle(this.searchItem, 500);
|
this.throttledSearchItem = this.throttle(this.searchItem, 500);
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.unlisten = this.openmct.objects.observe(this.internalDomainObject, '*', this.updateInternalDomainObject);
|
this.unlisten = this.openmct.objects.observe(this.internalDomainObject, '*', this.updateInternalDomainObject);
|
||||||
@ -195,6 +194,16 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
throttle(func, timeFrame) {
|
||||||
|
let lastTime = 0;
|
||||||
|
return function () {
|
||||||
|
let now = new Date();
|
||||||
|
if (now - lastTime >= timeFrame) {
|
||||||
|
func();
|
||||||
|
lastTime = now;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
},
|
||||||
addDefaultClass() {
|
addDefaultClass() {
|
||||||
const classList = this.internalDomainObject.classList || [];
|
const classList = this.internalDomainObject.classList || [];
|
||||||
if (classList.includes(DEFAULT_CLASS)) {
|
if (classList.includes(DEFAULT_CLASS)) {
|
||||||
|
@ -77,7 +77,7 @@ export default {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
names = _.flatten(names);
|
names.reduce((a, b) => a.concat(b), []);
|
||||||
this.filterNames = names.length === 0 ? names : Array.from(new Set(names));
|
this.filterNames = names.length === 0 ? names : Array.from(new Set(names));
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -99,7 +99,7 @@ export default {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return _.flatten(filterNames);
|
return filterNames.reduce((a, b) => a.concat(b), []);
|
||||||
},
|
},
|
||||||
getFilterLabels(filterObject, metadatum,) {
|
getFilterLabels(filterObject, metadatum,) {
|
||||||
let filterLabels = [];
|
let filterLabels = [];
|
||||||
|
@ -260,7 +260,6 @@ import search from '../../../ui/components/search.vue';
|
|||||||
import TableColumnHeader from './table-column-header.vue';
|
import TableColumnHeader from './table-column-header.vue';
|
||||||
import TelemetryFilterIndicator from './TelemetryFilterIndicator.vue';
|
import TelemetryFilterIndicator from './TelemetryFilterIndicator.vue';
|
||||||
import CSVExporter from '../../../exporters/CSVExporter.js';
|
import CSVExporter from '../../../exporters/CSVExporter.js';
|
||||||
import _ from 'lodash';
|
|
||||||
import ToggleSwitch from '../../../ui/components/ToggleSwitch.vue';
|
import ToggleSwitch from '../../../ui/components/ToggleSwitch.vue';
|
||||||
|
|
||||||
const VISIBLE_ROW_COUNT = 100;
|
const VISIBLE_ROW_COUNT = 100;
|
||||||
@ -378,13 +377,13 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.filterChanged = _.debounce(this.filterChanged, 500);
|
this.filterChanged = this.debounce(this.filterChanged, 500);
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.csvExporter = new CSVExporter();
|
this.csvExporter = new CSVExporter();
|
||||||
this.rowsAdded = _.throttle(this.rowsAdded, 200);
|
this.rowsAdded = this.throttle(this.rowsAdded, 200);
|
||||||
this.rowsRemoved = _.throttle(this.rowsRemoved, 200);
|
this.rowsRemoved = this.throttle(this.rowsRemoved, 200);
|
||||||
this.scroll = _.throttle(this.scroll, 100);
|
this.scroll = this.throttle(this.scroll, 100);
|
||||||
|
|
||||||
this.table.on('object-added', this.addObject);
|
this.table.on('object-added', this.addObject);
|
||||||
this.table.on('object-removed', this.removeObject);
|
this.table.on('object-removed', this.removeObject);
|
||||||
@ -432,6 +431,28 @@ export default {
|
|||||||
this.table.destroy();
|
this.table.destroy();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
debounce(func, wait, immediate) {
|
||||||
|
let timeout;
|
||||||
|
return function () {
|
||||||
|
let context = this, args = arguments;
|
||||||
|
clearTimeout(timeout);
|
||||||
|
timeout = setTimeout(function () {
|
||||||
|
timeout = null;
|
||||||
|
if (!immediate) { func.apply(context, args) }
|
||||||
|
}, wait);
|
||||||
|
if (immediate && !timeout) { func.apply(context, args) }
|
||||||
|
};
|
||||||
|
},
|
||||||
|
throttle(func, timeFrame) {
|
||||||
|
let lastTime = 0;
|
||||||
|
return function () {
|
||||||
|
let now = new Date();
|
||||||
|
if (now - lastTime >= timeFrame) {
|
||||||
|
func();
|
||||||
|
lastTime = now;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
},
|
||||||
updateVisibleRows() {
|
updateVisibleRows() {
|
||||||
if (!this.updatingView) {
|
if (!this.updatingView) {
|
||||||
this.updatingView = true;
|
this.updatingView = true;
|
||||||
|
Reference in New Issue
Block a user