Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CLA Approved] feat: AMD -> ES6 #7029

Merged
merged 23 commits into from
Dec 27, 2023
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
292 changes: 149 additions & 143 deletions src/MCT.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,25 @@
import EventEmitter from 'EventEmitter';
import { createApp, markRaw } from 'vue/dist/vue.esm-bundler';

import api from './api/api';
import ActionsAPI from './api/actions/ActionsAPI';
import AnnotationAPI from './api/annotation/AnnotationAPI';
import BrandingAPI from './api/Branding';
import CompositionAPI from './api/composition/CompositionAPI';
import EditorAPI from './api/Editor';
import FaultManagementAPI from './api/faultmanagement/FaultManagementAPI';
import FormsAPI from './api/forms/FormsAPI';
import IndicatorAPI from './api/indicators/IndicatorAPI';
import MenuAPI from './api/menu/MenuAPI';
import NotificationAPI from './api/notifications/NotificationAPI';
import ObjectAPI from './api/objects/ObjectAPI';
import OverlayAPI from './api/overlays/OverlayAPI';
import PriorityAPI from './api/priority/PriorityAPI';
import StatusAPI from './api/status/StatusAPI';
import TelemetryAPI from './api/telemetry/TelemetryAPI';
import TimeAPI from './api/time/TimeAPI';
import ToolTipAPI from './api/tooltips/ToolTipAPI';
import TypeRegistry from './api/types/TypeRegistry';
import UserAPI from './api/user/UserAPI';
import DuplicateActionPlugin from './plugins/duplicate/plugin';
import ExportAsJSONAction from './plugins/exportAsJSONAction/plugin';
import ImageryPlugin from './plugins/imagery/plugin';
Expand Down Expand Up @@ -61,162 +76,153 @@ import Browse from './ui/router/Browse';
* @memberof module:openmct
*/
export class MCT extends EventEmitter {
plugins = plugins;

/**
* Tracks current selection state of the application.
* @private
*/
selection = new Selection(this);

/**
* MCT's time conductor, which may be used to synchronize view contents
* for telemetry- or time-based views.
* @type {module:openmct.TimeConductor}
* @memberof module:openmct.MCT#
* @name conductor
*/
time = new api.TimeAPI(this);
constructor() {
super();
EventEmitter.call(this);

/**
* An interface for interacting with the composition of domain objects.
* The composition of a domain object is the list of other domain
* objects it "contains" (for instance, that should be displayed
* beneath it in the tree.)
*
* `composition` may be called as a function, in which case it acts
* as [`composition.get`]{@link module:openmct.CompositionAPI#get}.
*
* @type {module:openmct.CompositionAPI}
* @memberof module:openmct.MCT#
* @name composition
*/
composition = new api.CompositionAPI(this);
this.buildInfo = {
version: __OPENMCT_VERSION__,
buildDate: __OPENMCT_BUILD_DATE__,
revision: __OPENMCT_REVISION__,
branch: __OPENMCT_BUILD_BRANCH__
};

/**
* Registry for views of domain objects which should appear in the
* main viewing area.
*
* @type {module:openmct.ViewRegistry}
* @memberof module:openmct.MCT#
* @name objectViews
*/
objectViews = new ViewRegistry();
this.destroy = this.destroy.bind(this);
this.defaultClock = 'local';

/**
* Registry for views which should appear in the Inspector area.
* These views will be chosen based on the selection state.
*
* @type {module:openmct.InspectorViewRegistry}
* @memberof module:openmct.MCT#
* @name inspectorViews
*/
inspectorViews = new InspectorViewRegistry();
this.plugins = plugins;

/**
* Registry for views which should appear in Edit Properties
* dialogs, and similar user interface elements used for
* modifying domain objects external to its regular views.
*
* @type {module:openmct.ViewRegistry}
* @memberof module:openmct.MCT#
* @name propertyEditors
*/
propertyEditors = new ViewRegistry();
/**
* Tracks current selection state of the application.
* @private
*/
this.selection = new Selection(this);

/**
* Registry for views which should appear in the toolbar area while
* editing. These views will be chosen based on the selection state.
*
* @type {module:openmct.ToolbarRegistry}
* @memberof module:openmct.MCT#
* @name toolbars
*/
toolbars = new ToolbarRegistry();
/**
* MCT's time conductor, which may be used to synchronize view contents
* for telemetry- or time-based views.
* @type {module:openmct.TimeConductor}
* @memberof module:openmct.MCT#
* @name conductor
*/
this.time = new TimeAPI(this);

/**
* Registry for domain object types which may exist within this
* instance of Open MCT.
*
* @type {module:openmct.TypeRegistry}
* @memberof module:openmct.MCT#
* @name types
*/
types = new api.TypeRegistry();
/**
* An interface for interacting with the composition of domain objects.
* The composition of a domain object is the list of other domain
* objects it "contains" (for instance, that should be displayed
* beneath it in the tree.)
*
* `composition` may be called as a function, in which case it acts
* as [`composition.get`]{@link module:openmct.CompositionAPI#get}.
*
* @type {module:openmct.CompositionAPI}
* @memberof module:openmct.MCT#
* @name composition
*/
this.composition = new CompositionAPI(this);

/**
* An interface for interacting with domain objects and the domain
* object hierarchy.
*
* @type {module:openmct.ObjectAPI}
* @memberof module:openmct.MCT#
* @name objects
*/
objects = new api.ObjectAPI(this.types, this);
/**
* Registry for views of domain objects which should appear in the
* main viewing area.
*
* @type {module:openmct.ViewRegistry}
* @memberof module:openmct.MCT#
* @name objectViews
*/
this.objectViews = new ViewRegistry();

/**
* An interface for retrieving and interpreting telemetry data associated
* with a domain object.
*
* @type {module:openmct.TelemetryAPI}
* @memberof module:openmct.MCT#
* @name telemetry
*/
telemetry = new api.TelemetryAPI(this);
/**
* Registry for views which should appear in the Inspector area.
* These views will be chosen based on the selection state.
*
* @type {module:openmct.InspectorViewRegistry}
* @memberof module:openmct.MCT#
* @name inspectorViews
*/
this.inspectorViews = new InspectorViewRegistry();

/**
* An interface for creating new indicators and changing them dynamically.
*
* @type {module:openmct.IndicatorAPI}
* @memberof module:openmct.MCT#
* @name indicators
*/
indicators = new api.IndicatorAPI(this);
/**
* Registry for views which should appear in Edit Properties
* dialogs, and similar user interface elements used for
* modifying domain objects external to its regular views.
*
* @type {module:openmct.ViewRegistry}
* @memberof module:openmct.MCT#
* @name propertyEditors
*/
this.propertyEditors = new ViewRegistry();

/**
* MCT's user awareness management, to enable user and
* role specific functionality.
* @type {module:openmct.UserAPI}
* @memberof module:openmct.MCT#
* @name user
*/
user = new api.UserAPI(this);
/**
* Registry for views which should appear in the toolbar area while
* editing. These views will be chosen based on the selection state.
*
* @type {module:openmct.ToolbarRegistry}
* @memberof module:openmct.MCT#
* @name toolbars
*/
this.toolbars = new ToolbarRegistry();

notifications = new api.NotificationAPI();
editor = new api.EditorAPI(this);
overlays = new OverlayAPI();
tooltips = new ToolTipAPI();
menus = new api.MenuAPI(this);
actions = new api.ActionsAPI(this);
status = new api.StatusAPI(this);
priority = api.PriorityAPI;
router = new ApplicationRouter(this);
faults = new api.FaultManagementAPI(this);
forms = new api.FormsAPI(this);
branding = BrandingAPI;
/**
* Registry for domain object types which may exist within this
* instance of Open MCT.
*
* @type {module:openmct.TypeRegistry}
* @memberof module:openmct.MCT#
* @name types
*/
this.types = new TypeRegistry();

/**
* MCT's annotation API that enables
* human-created comments and categorization linked to data products
* @type {module:openmct.AnnotationAPI}
* @memberof module:openmct.MCT#
* @name annotation
*/
annotation = new api.AnnotationAPI(this);
/**
* An interface for interacting with domain objects and the domain
* object hierarchy.
*
* @type {module:openmct.ObjectAPI}
* @memberof module:openmct.MCT#
* @name objects
*/
this.objects = new ObjectAPI(this.types, this);

constructor() {
super();
EventEmitter.call(this);
/**
* An interface for retrieving and interpreting telemetry data associated
* with a domain object.
*
* @type {module:openmct.TelemetryAPI}
* @memberof module:openmct.MCT#
* @name telemetry
*/
this.telemetry = new TelemetryAPI(this);

this.buildInfo = {
version: __OPENMCT_VERSION__,
buildDate: __OPENMCT_BUILD_DATE__,
revision: __OPENMCT_REVISION__,
branch: __OPENMCT_BUILD_BRANCH__
};
/**
* An interface for creating new indicators and changing them dynamically.
*
* @type {module:openmct.IndicatorAPI}
* @memberof module:openmct.MCT#
* @name indicators
*/
this.indicators = new IndicatorAPI(this);

this.destroy = this.destroy.bind(this);
this.defaultClock = 'local';
/**
* MCT's user awareness management, to enable user and
* role specific functionality.
* @type {module:openmct.UserAPI}
* @memberof module:openmct.MCT#
* @name user
*/
this.user = new UserAPI(this);

this.notifications = new NotificationAPI();
this.editor = new EditorAPI(this);
this.overlays = new OverlayAPI();
this.tooltips = new ToolTipAPI();
this.menus = new MenuAPI(this);
this.actions = new ActionsAPI(this);
this.status = new StatusAPI(this);
this.priority = PriorityAPI;
this.router = new ApplicationRouter(this);
this.faults = new FaultManagementAPI(this);
this.forms = new FormsAPI(this);
this.branding = BrandingAPI;

/**
* MCT's annotation API that enables
Expand All @@ -225,7 +231,7 @@ export class MCT extends EventEmitter {
* @memberof module:openmct.MCT#
* @name annotation
*/
this.annotation = new api.AnnotationAPI(this);
this.annotation = new AnnotationAPI(this);

// Plugins that are installed by default
this.install(this.plugins.Plot());
Expand Down
32 changes: 16 additions & 16 deletions src/api/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,20 @@ import TypeRegistry from './types/TypeRegistry';
import UserAPI from './user/UserAPI';

export default {
ActionsAPI: ActionsAPI,
CompositionAPI: CompositionAPI,
EditorAPI: EditorAPI,
FaultManagementAPI: FaultManagementAPI,
FormsAPI: FormsAPI,
IndicatorAPI: IndicatorAPI,
MenuAPI: MenuAPI,
NotificationAPI: NotificationAPI,
ObjectAPI: ObjectAPI,
PriorityAPI: PriorityAPI,
StatusAPI: StatusAPI,
TelemetryAPI: TelemetryAPI,
TimeAPI: TimeAPI,
TypeRegistry: TypeRegistry,
UserAPI: UserAPI,
AnnotationAPI: AnnotationAPI
ActionsAPI,
CompositionAPI,
EditorAPI,
FaultManagementAPI,
FormsAPI,
IndicatorAPI,
MenuAPI,
NotificationAPI,
ObjectAPI,
PriorityAPI,
StatusAPI,
TelemetryAPI,
TimeAPI,
TypeRegistry,
UserAPI,
AnnotationAPI
};
6 changes: 3 additions & 3 deletions src/plugins/plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ import LocalStorage from './localStorage/plugin';
import LocalTimeSystem from './localTimeSystem/plugin';
import MyItems from './myItems/plugin';
import NewFolderAction from './newFolderAction/plugin';
import * as Notebook from './notebook/plugin';
import { NotebookPlugin, RestrictedNotebookPlugin } from './notebook/plugin';
import NotificationIndicator from './notificationIndicator/plugin';
import ObjectMigration from './objectMigration/plugin';
import OpenInNewTabAction from './openInNewTabAction/plugin';
Expand Down Expand Up @@ -128,8 +128,8 @@ plugins.TelemetryTable = TelemetryTablePlugin;
plugins.SummaryWidget = SummaryWidget;
plugins.TelemetryMean = TelemetryMean;
plugins.URLIndicator = URLIndicatorPlugin;
plugins.Notebook = Notebook.NotebookPlugin;
plugins.RestrictedNotebook = Notebook.RestrictedNotebookPlugin;
plugins.Notebook = NotebookPlugin;
plugins.RestrictedNotebook = RestrictedNotebookPlugin;
plugins.DisplayLayout = DisplayLayoutPlugin;
plugins.FaultManagement = FaultManagementPlugin;
plugins.FormActions = FormActions;
Expand Down
Loading