chore: upgrade eventemitter to v5.0.2 (#7709)

* chore: upgrade eventemitter to v5.0.2
* fix: pass context to eventHelpers
* fix: no need to destroy router as it is destroyed during openmct teardown
* fix: register `CreateAction` and retrieve it from the registry
* test: fix tests
* refactor: import action key consts
* fix: update usage. don't use getters
Co-authored-by: David Tsay <3614296+davetsay@users.noreply.github.com>

---------

Co-authored-by: David Tsay <3614296+davetsay@users.noreply.github.com>
This commit is contained in:
Jesse Mazzella
2024-05-14 14:51:33 -07:00
committed by GitHub
parent 810d580b18
commit 017380bb6a
56 changed files with 646 additions and 491 deletions

View File

@ -1,13 +1,15 @@
import clipboard from '@/utils/clipboard';
export default class CopyToClipboardAction {
const COPY_TO_CLIPBOARD_ACTION_KEY = 'copyToClipboard';
class CopyToClipboardAction {
constructor(openmct) {
this.openmct = openmct;
this.cssClass = 'icon-duplicate';
this.description = 'Copy value to clipboard';
this.group = 'action';
this.key = 'copyToClipboard';
this.key = COPY_TO_CLIPBOARD_ACTION_KEY;
this.name = 'Copy to Clipboard';
this.priority = 1;
}
@ -36,3 +38,7 @@ export default class CopyToClipboardAction {
return row.formattedValueForCopy && typeof row.formattedValueForCopy === 'function';
}
}
export { COPY_TO_CLIPBOARD_ACTION_KEY };
export default CopyToClipboardAction;

View File

@ -72,11 +72,14 @@
</template>
<script>
import { COPY_TO_CLIPBOARD_ACTION_KEY } from '@/plugins/displayLayout/actions/CopyToClipboardAction.js';
import { COPY_TO_NOTEBOOK_ACTION_KEY } from '@/plugins/notebook/actions/CopyToNotebookAction.js';
import {
getDefaultNotebook,
getNotebookSectionAndPage
} from '@/plugins/notebook/utils/notebook-storage.js';
import stalenessMixin from '@/ui/mixins/staleness-mixin';
import { VIEW_HISTORICAL_DATA_ACTION_KEY } from '@/ui/preview/ViewHistoricalDataAction.js';
import tooltipHelpers from '../../../api/tooltips/tooltipMixins.js';
import conditionalStylesMixin from '../mixins/objectStyles-mixin.js';
@ -84,7 +87,11 @@ import LayoutFrame from './LayoutFrame.vue';
const DEFAULT_TELEMETRY_DIMENSIONS = [10, 5];
const DEFAULT_POSITION = [1, 1];
const CONTEXT_MENU_ACTIONS = ['copyToClipboard', 'copyToNotebook', 'viewHistoricalData'];
const CONTEXT_MENU_ACTIONS = [
COPY_TO_CLIPBOARD_ACTION_KEY,
COPY_TO_NOTEBOOK_ACTION_KEY,
VIEW_HISTORICAL_DATA_ACTION_KEY
];
export default {
makeDefinition(openmct, gridSize, domainObject, position) {
@ -381,7 +388,7 @@ export default {
return CONTEXT_MENU_ACTIONS.map((actionKey) => {
const action = this.openmct.actions.getAction(actionKey);
if (action.key === 'copyToNotebook') {
if (action.key === COPY_TO_NOTEBOOK_ACTION_KEY) {
action.name = defaultNotebookName;
}