Compare commits
	
		
			15 Commits
		
	
	
		
			eventemitt
			...
			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": [
 | 
			
		||||
        "eslint:recommended",
 | 
			
		||||
        "plugin:vue/recommended",
 | 
			
		||||
        "plugin:lodash/recommended"
 | 
			
		||||
        "plugin:lodash/recommended",
 | 
			
		||||
        "plugin:you-dont-need-lodash-underscore/compatible"
 | 
			
		||||
    ],
 | 
			
		||||
    "parser": "vue-eslint-parser",
 | 
			
		||||
    "parserOptions": {
 | 
			
		||||
@@ -24,6 +25,7 @@ module.exports = {
 | 
			
		||||
        }
 | 
			
		||||
    },
 | 
			
		||||
    "rules": {
 | 
			
		||||
        "you-dont-need-lodash-underscore/omit": "off",
 | 
			
		||||
        "lodash/prefer-lodash-method": "off",
 | 
			
		||||
        "lodash/prefer-lodash-typecheck": "off",
 | 
			
		||||
        "lodash/prefer-constant": "off",
 | 
			
		||||
 
 | 
			
		||||
@@ -25,6 +25,7 @@
 | 
			
		||||
    "eslint": "5.2.0",
 | 
			
		||||
    "eslint-plugin-lodash": "^6.0.0",
 | 
			
		||||
    "eslint-plugin-vue": "^6.0.0",
 | 
			
		||||
    "eslint-plugin-you-dont-need-lodash-underscore": "^6.10.0",
 | 
			
		||||
    "eventemitter3": "^1.2.0",
 | 
			
		||||
    "exports-loader": "^0.7.0",
 | 
			
		||||
    "express": "^4.13.1",
 | 
			
		||||
 
 | 
			
		||||
@@ -20,7 +20,7 @@
 | 
			
		||||
 * 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
 | 
			
		||||
@@ -121,8 +121,8 @@ define(['lodash'], function (_) {
 | 
			
		||||
     */
 | 
			
		||||
    ExportAsJSONAction.prototype.rewriteLink = function (child, parent) {
 | 
			
		||||
        this.externalIdentifiers.push(this.getId(child));
 | 
			
		||||
        var index = _.findIndex(parent.composition, function (id) {
 | 
			
		||||
            return _.isEqual(child.identifier, id);
 | 
			
		||||
        var index = parent.composition.findIndex(function (id) {
 | 
			
		||||
            return JSON.stringify(child.identifier) === JSON.stringify(id);
 | 
			
		||||
        });
 | 
			
		||||
        var copyOfChild = this.copyObject(child);
 | 
			
		||||
        copyOfChild.identifier.key = this.identifierService.generate();
 | 
			
		||||
 
 | 
			
		||||
@@ -25,8 +25,7 @@
 | 
			
		||||
 * Module defining GenericSearchProvider. Created by shale on 07/16/2015.
 | 
			
		||||
 */
 | 
			
		||||
define([
 | 
			
		||||
    '../../../../src/api/objects/object-utils',
 | 
			
		||||
    'lodash'
 | 
			
		||||
    '../../../../src/api/objects/object-utils'
 | 
			
		||||
], function (
 | 
			
		||||
    objectUtils,
 | 
			
		||||
    _
 | 
			
		||||
@@ -191,9 +190,7 @@ define([
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        var domainObject = objectUtils.toNewFormat(model, id);
 | 
			
		||||
        var composition = _.find(this.openmct.composition.registry, function (p) {
 | 
			
		||||
            return p.appliesTo(domainObject);
 | 
			
		||||
        });
 | 
			
		||||
        var composition = this.openmct.composition.registry.find(p => p.appliesTo(domainObject));
 | 
			
		||||
 | 
			
		||||
        if (!composition) {
 | 
			
		||||
            return;
 | 
			
		||||
 
 | 
			
		||||
@@ -75,7 +75,7 @@ export default {
 | 
			
		||||
            this.items.push(item);
 | 
			
		||||
        },
 | 
			
		||||
        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);
 | 
			
		||||
        },
 | 
			
		||||
 
 | 
			
		||||
@@ -102,7 +102,7 @@ export default {
 | 
			
		||||
            this.compositions.push({composition, addCallback, removeCallback});
 | 
			
		||||
        },
 | 
			
		||||
        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];
 | 
			
		||||
 | 
			
		||||
            this.$set(this.secondaryTelemetryObjects, primary.key, undefined);
 | 
			
		||||
@@ -130,7 +130,7 @@ export default {
 | 
			
		||||
        removeSecondary(primary) {
 | 
			
		||||
            return (identifier) => {
 | 
			
		||||
                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);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -197,7 +197,7 @@ export default {
 | 
			
		||||
            this.$emit('telemetryUpdated', this.telemetryObjs);
 | 
			
		||||
        },
 | 
			
		||||
        removeTelemetryObject(identifier) {
 | 
			
		||||
            let index = _.findIndex(this.telemetryObjs, (obj) => {
 | 
			
		||||
            let index = this.telemetryObjs.findIndex(obj => {
 | 
			
		||||
                let objId = this.openmct.objects.makeKeyString(obj.identifier);
 | 
			
		||||
                let id = this.openmct.objects.makeKeyString(identifier);
 | 
			
		||||
                return objId === id;
 | 
			
		||||
 
 | 
			
		||||
@@ -68,7 +68,6 @@
 | 
			
		||||
 | 
			
		||||
<script>
 | 
			
		||||
import uuid from 'uuid';
 | 
			
		||||
 | 
			
		||||
import SubobjectView from './SubobjectView.vue'
 | 
			
		||||
import TelemetryView from './TelemetryView.vue'
 | 
			
		||||
import BoxView from './BoxView.vue'
 | 
			
		||||
@@ -375,7 +374,9 @@ export default {
 | 
			
		||||
                indices.push(selectedItem[0].context.index);
 | 
			
		||||
                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.$el.click();
 | 
			
		||||
        },
 | 
			
		||||
@@ -512,7 +513,7 @@ export default {
 | 
			
		||||
            }
 | 
			
		||||
        },
 | 
			
		||||
        updateTelemetryFormat(item, format) {
 | 
			
		||||
            let index = _.findIndex(this.layoutItems, item);
 | 
			
		||||
            let index = this.layoutItems.findIndex(item);
 | 
			
		||||
            item.format = format;
 | 
			
		||||
            this.mutate(`configuration.items[${index}]`, item);
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
@@ -55,6 +55,7 @@ export default {
 | 
			
		||||
    },
 | 
			
		||||
    computed: {
 | 
			
		||||
        hasActiveFilters() {
 | 
			
		||||
            console.log('hasActiveFilters');
 | 
			
		||||
            // Should be true when the user has entered any filter values.
 | 
			
		||||
            return Object.values(this.persistedFilters).some(filters => {
 | 
			
		||||
                return Object.values(filters).some(comparator => {
 | 
			
		||||
@@ -63,6 +64,7 @@ export default {
 | 
			
		||||
            });
 | 
			
		||||
        },
 | 
			
		||||
        hasMixedFilters() {
 | 
			
		||||
            console.log('hasMixedFilters')
 | 
			
		||||
            // Should be true when filter values are mixed.
 | 
			
		||||
            let filtersToCompare = _.omit(this.persistedFilters[Object.keys(this.persistedFilters)[0]], [USE_GLOBAL]);
 | 
			
		||||
            return Object.values(this.persistedFilters).some(filters => {
 | 
			
		||||
@@ -70,6 +72,7 @@ export default {
 | 
			
		||||
            });
 | 
			
		||||
        },
 | 
			
		||||
        label() {
 | 
			
		||||
            console.log('label');
 | 
			
		||||
            if (this.hasActiveFilters) {
 | 
			
		||||
                if (this.hasMixedFilters) {
 | 
			
		||||
                    return FILTER_VIEW_TITLE_MIXED;
 | 
			
		||||
 
 | 
			
		||||
@@ -111,7 +111,6 @@ import SearchResults from './search-results.vue';
 | 
			
		||||
import Sidebar from './sidebar.vue';
 | 
			
		||||
import { clearDefaultNotebook, getDefaultNotebook, setDefaultNotebook, setDefaultNotebookSection, setDefaultNotebookPage } from '../utils/notebook-storage';
 | 
			
		||||
import { addNotebookEntry, createNewEmbed, getNotebookEntries } from '../utils/notebook-entries';
 | 
			
		||||
import { throttle } from 'lodash';
 | 
			
		||||
 | 
			
		||||
const DEFAULT_CLASS = 'is-notebook-default';
 | 
			
		||||
 | 
			
		||||
@@ -175,7 +174,7 @@ export default {
 | 
			
		||||
    watch: {
 | 
			
		||||
    },
 | 
			
		||||
    beforeMount() {
 | 
			
		||||
        this.throttledSearchItem = throttle(this.searchItem, 500);
 | 
			
		||||
        this.throttledSearchItem = this.throttle(this.searchItem, 500);
 | 
			
		||||
    },
 | 
			
		||||
    mounted() {
 | 
			
		||||
        this.unlisten = this.openmct.objects.observe(this.internalDomainObject, '*', this.updateInternalDomainObject);
 | 
			
		||||
@@ -195,6 +194,16 @@ export default {
 | 
			
		||||
        })
 | 
			
		||||
    },
 | 
			
		||||
    methods: {
 | 
			
		||||
        throttle(func, timeFrame) {
 | 
			
		||||
            let lastTime = 0;
 | 
			
		||||
            return function () {
 | 
			
		||||
                let now = new Date();
 | 
			
		||||
                if (now - lastTime >= timeFrame) {
 | 
			
		||||
                    func();
 | 
			
		||||
                    lastTime = now;
 | 
			
		||||
                }
 | 
			
		||||
            };
 | 
			
		||||
        },
 | 
			
		||||
        addDefaultClass() {
 | 
			
		||||
            const classList = this.internalDomainObject.classList || [];
 | 
			
		||||
            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));
 | 
			
		||||
            });
 | 
			
		||||
        },
 | 
			
		||||
@@ -99,7 +99,7 @@ export default {
 | 
			
		||||
                }
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
            return _.flatten(filterNames);
 | 
			
		||||
            return filterNames.reduce((a, b) => a.concat(b), []);
 | 
			
		||||
        },
 | 
			
		||||
        getFilterLabels(filterObject, metadatum,) {
 | 
			
		||||
            let filterLabels = [];
 | 
			
		||||
 
 | 
			
		||||
@@ -260,7 +260,6 @@ import search from '../../../ui/components/search.vue';
 | 
			
		||||
import TableColumnHeader from './table-column-header.vue';
 | 
			
		||||
import TelemetryFilterIndicator from './TelemetryFilterIndicator.vue';
 | 
			
		||||
import CSVExporter from '../../../exporters/CSVExporter.js';
 | 
			
		||||
import _ from 'lodash';
 | 
			
		||||
import ToggleSwitch from '../../../ui/components/ToggleSwitch.vue';
 | 
			
		||||
 | 
			
		||||
const VISIBLE_ROW_COUNT = 100;
 | 
			
		||||
@@ -378,13 +377,13 @@ export default {
 | 
			
		||||
        }
 | 
			
		||||
    },
 | 
			
		||||
    created() {
 | 
			
		||||
        this.filterChanged = _.debounce(this.filterChanged, 500);
 | 
			
		||||
        this.filterChanged = this.debounce(this.filterChanged, 500);
 | 
			
		||||
    },
 | 
			
		||||
    mounted() {
 | 
			
		||||
        this.csvExporter = new CSVExporter();
 | 
			
		||||
        this.rowsAdded = _.throttle(this.rowsAdded, 200);
 | 
			
		||||
        this.rowsRemoved = _.throttle(this.rowsRemoved, 200);
 | 
			
		||||
        this.scroll = _.throttle(this.scroll, 100);
 | 
			
		||||
        this.rowsAdded = this.throttle(this.rowsAdded, 200);
 | 
			
		||||
        this.rowsRemoved = this.throttle(this.rowsRemoved, 200);
 | 
			
		||||
        this.scroll = this.throttle(this.scroll, 100);
 | 
			
		||||
 | 
			
		||||
        this.table.on('object-added', this.addObject);
 | 
			
		||||
        this.table.on('object-removed', this.removeObject);
 | 
			
		||||
@@ -432,6 +431,28 @@ export default {
 | 
			
		||||
        this.table.destroy();
 | 
			
		||||
    },
 | 
			
		||||
    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() {
 | 
			
		||||
            if (!this.updatingView) {
 | 
			
		||||
                this.updatingView = true;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user