mirror of
https://github.com/nasa/openmct.git
synced 2025-06-17 14:48:13 +00:00
docs: Mission Status and more (#7521)
* chore: update tsconfig to target modern ES * docs: update UserProvider * docs: update UserAPI, make openmct private * docs: update StatusAPI * refactor: convert ViewRegistry to ES6 class * docs: finish type imports for openmct api * docs: minor doc improvements * docs: add UserIndicator readme * docs: add User API section to API docs * docs: document Mission Status * docs(JSDoc): primitive types should be lowercase, otherwise TitleCase
This commit is contained in:
@ -23,7 +23,7 @@
|
||||
let brandingOptions = {};
|
||||
|
||||
/**
|
||||
* @typedef {object} BrandingOptions
|
||||
* @typedef {Object} BrandingOptions
|
||||
* @property {string} smallLogoImage URL to the image to use as the applications logo.
|
||||
* This logo will appear on every screen and when clicked will launch the about dialog.
|
||||
* @property {string} aboutHtml Custom content for the about screen. When defined the
|
||||
|
@ -26,12 +26,12 @@ import { v4 as uuid } from 'uuid';
|
||||
|
||||
/**
|
||||
* @readonly
|
||||
* @enum {String} AnnotationType
|
||||
* @property {String} NOTEBOOK The notebook annotation type
|
||||
* @property {String} GEOSPATIAL The geospatial annotation type
|
||||
* @property {String} PIXEL_SPATIAL The pixel-spatial annotation type
|
||||
* @property {String} TEMPORAL The temporal annotation type
|
||||
* @property {String} PLOT_SPATIAL The plot-spatial annotation type
|
||||
* @enum {string} AnnotationType
|
||||
* @property {string} NOTEBOOK The notebook annotation type
|
||||
* @property {string} GEOSPATIAL The geospatial annotation type
|
||||
* @property {string} PIXEL_SPATIAL The pixel-spatial annotation type
|
||||
* @property {string} TEMPORAL The temporal annotation type
|
||||
* @property {string} PLOT_SPATIAL The plot-spatial annotation type
|
||||
*/
|
||||
const ANNOTATION_TYPES = Object.freeze({
|
||||
NOTEBOOK: 'NOTEBOOK',
|
||||
@ -47,9 +47,9 @@ const ANNOTATION_LAST_CREATED = 'annotationLastCreated';
|
||||
|
||||
/**
|
||||
* @typedef {Object} Tag
|
||||
* @property {String} key a unique identifier for the tag
|
||||
* @property {String} backgroundColor eg. "#cc0000"
|
||||
* @property {String} foregroundColor eg. "#ffffff"
|
||||
* @property {string} key a unique identifier for the tag
|
||||
* @property {string} backgroundColor eg. "#cc0000"
|
||||
* @property {string} foregroundColor eg. "#ffffff"
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -112,11 +112,11 @@ export default class AnnotationAPI extends EventEmitter {
|
||||
/**
|
||||
* Creates an annotation on a given domain object (e.g., a plot) and a set of targets (e.g., telemetry objects)
|
||||
* @typedef {Object} CreateAnnotationOptions
|
||||
* @property {String} name a name for the new annotation (e.g., "Plot annnotation")
|
||||
* @property {string} name a name for the new annotation (e.g., "Plot annnotation")
|
||||
* @property {DomainObject} domainObject the domain object this annotation was created with
|
||||
* @property {ANNOTATION_TYPES} annotationType the type of annotation to create (e.g., PLOT_SPATIAL)
|
||||
* @property {Tag[]} tags tags to add to the annotation, e.g., SCIENCE for science related annotations
|
||||
* @property {String} contentText Some text to add to the annotation, e.g. ("This annotation is about science")
|
||||
* @property {string} contentText Some text to add to the annotation, e.g. ("This annotation is about science")
|
||||
* @property {Array<Object>} targets The targets ID keystrings and their specific properties.
|
||||
* For plots, this will be a bounding box, e.g.: {keyString: "d8385009-789d-457b-acc7-d50ba2fd55ea", maxY: 100, minY: 0, maxX: 100, minX: 0}
|
||||
* For notebooks, this will be an entry ID, e.g.: {entryId: "entry-ecb158f5-d23c-45e1-a704-649b382622ba"}
|
||||
@ -208,7 +208,7 @@ export default class AnnotationAPI extends EventEmitter {
|
||||
|
||||
/**
|
||||
* @method defineTag
|
||||
* @param {String} key a unique identifier for the tag
|
||||
* @param {string} key a unique identifier for the tag
|
||||
* @param {Tag} tagsDefinition the definition of the tag to add
|
||||
*/
|
||||
defineTag(tagKey, tagsDefinition) {
|
||||
@ -217,7 +217,7 @@ export default class AnnotationAPI extends EventEmitter {
|
||||
|
||||
/**
|
||||
* @method setNamespaceToSaveAnnotations
|
||||
* @param {String} namespace the namespace to save new annotations to
|
||||
* @param {string} namespace the namespace to save new annotations to
|
||||
*/
|
||||
setNamespaceToSaveAnnotations(namespace) {
|
||||
this.namespaceToSaveAnnotations = namespace;
|
||||
@ -226,7 +226,7 @@ export default class AnnotationAPI extends EventEmitter {
|
||||
/**
|
||||
* @method isAnnotation
|
||||
* @param {DomainObject} domainObject the domainObject in question
|
||||
* @returns {Boolean} Returns true if the domain object is an annotation
|
||||
* @returns {boolean} Returns true if the domain object is an annotation
|
||||
*/
|
||||
isAnnotation(domainObject) {
|
||||
return domainObject && domainObject.type === ANNOTATION_TYPE;
|
||||
@ -442,7 +442,7 @@ export default class AnnotationAPI extends EventEmitter {
|
||||
|
||||
/**
|
||||
* @method searchForTags
|
||||
* @param {String} query A query to match against tags. E.g., "dr" will match the tags "drilling" and "driving"
|
||||
* @param {string} query A query to match against tags. E.g., "dr" will match the tags "drilling" and "driving"
|
||||
* @param {Object} [abortController] An optional abort method to stop the query
|
||||
* @returns {Promise} returns a model of matching tags with their target domain objects attached
|
||||
*/
|
||||
|
@ -33,7 +33,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {object} ListenerMap
|
||||
* @typedef {Object} ListenerMap
|
||||
* @property {Array.<any>} add
|
||||
* @property {Array.<any>} remove
|
||||
* @property {Array.<any>} load
|
||||
@ -271,7 +271,7 @@ export default class CompositionCollection {
|
||||
/**
|
||||
* Handle reorder from provider.
|
||||
* @private
|
||||
* @param {object} reorderMap
|
||||
* @param {Object} reorderMap
|
||||
*/
|
||||
#onProviderReorder(reorderMap) {
|
||||
this.#emit('reorder', reorderMap);
|
||||
|
@ -88,21 +88,21 @@ export default class FaultManagementAPI {
|
||||
}
|
||||
|
||||
/**
|
||||
* @typedef {object} TriggerValueInfo
|
||||
* @typedef {Object} TriggerValueInfo
|
||||
* @property {number} value
|
||||
* @property {string} rangeCondition
|
||||
* @property {string} monitoringResult
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {object} CurrentValueInfo
|
||||
* @typedef {Object} CurrentValueInfo
|
||||
* @property {number} value
|
||||
* @property {string} rangeCondition
|
||||
* @property {string} monitoringResult
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {object} Fault
|
||||
* @typedef {Object} Fault
|
||||
* @property {boolean} acknowledged
|
||||
* @property {CurrentValueInfo} currentValueInfo
|
||||
* @property {string} id
|
||||
@ -117,7 +117,7 @@ export default class FaultManagementAPI {
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {object} FaultAPIResponse
|
||||
* @typedef {Object} FaultAPIResponse
|
||||
* @property {string} type
|
||||
* @property {Fault} fault
|
||||
*/
|
||||
|
@ -48,7 +48,7 @@ export default class FormsAPI {
|
||||
* this formControlViewProvider is used inside form overlay to show/render a form row
|
||||
*
|
||||
* @public
|
||||
* @param {String} controlName a form structure, array of section
|
||||
* @param {string} controlName a form structure, array of section
|
||||
* @param {ControlViewProvider} controlViewProvider
|
||||
*/
|
||||
addNewFormControl(controlName, controlViewProvider) {
|
||||
@ -59,7 +59,7 @@ export default class FormsAPI {
|
||||
* Get a ControlViewProvider for a given/stored form controlName
|
||||
*
|
||||
* @public
|
||||
* @param {String} controlName a form structure, array of section
|
||||
* @param {string} controlName a form structure, array of section
|
||||
* @return {ControlViewProvider}
|
||||
*/
|
||||
getFormControl(controlName) {
|
||||
@ -69,7 +69,7 @@ export default class FormsAPI {
|
||||
/**
|
||||
* Section definition for formStructure
|
||||
* @typedef Section
|
||||
* @property {object} name Name of the section to display on Form
|
||||
* @property {Object} name Name of the section to display on Form
|
||||
* @property {string} cssClass class name for styling section
|
||||
* @property {array<Row>} rows collection of rows inside a section
|
||||
*/
|
||||
|
@ -25,7 +25,7 @@ import Menu, { MENU_PLACEMENT } from './menu.js';
|
||||
/**
|
||||
* Popup Menu options
|
||||
* @typedef {Object} MenuOptions
|
||||
* @property {String} menuClass Class for popup menu
|
||||
* @property {string} menuClass Class for popup menu
|
||||
* @property {MENU_PLACEMENT} placement Placement for menu relative to click
|
||||
* @property {Function} onDestroy callback function: invoked when menu is destroyed
|
||||
*/
|
||||
@ -33,10 +33,10 @@ import Menu, { MENU_PLACEMENT } from './menu.js';
|
||||
/**
|
||||
* Popup Menu Item/action
|
||||
* @typedef {Object} Action
|
||||
* @property {String} cssClass Class for menu item
|
||||
* @property {Boolean} isDisabled adds disable class if true
|
||||
* @property {String} name Menu item text
|
||||
* @property {String} description Menu item description
|
||||
* @property {string} cssClass Class for menu item
|
||||
* @property {boolean} isDisabled adds disable class if true
|
||||
* @property {string} name Menu item text
|
||||
* @property {string} description Menu item description
|
||||
* @property {Function} onItemClicked callback function: invoked when item is clicked
|
||||
*/
|
||||
|
||||
|
@ -34,7 +34,7 @@ import EventEmitter from 'eventemitter3';
|
||||
import moment from 'moment';
|
||||
|
||||
/**
|
||||
* @typedef {object} NotificationProperties
|
||||
* @typedef {Object} NotificationProperties
|
||||
* @property {function} dismiss Dismiss the notification
|
||||
* @property {NotificationModel} model The Notification model
|
||||
* @property {(progressPerc: number, progressText: string) => void} [progress] Update the progress of the notification
|
||||
@ -45,14 +45,14 @@ import moment from 'moment';
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {object} NotificationLink
|
||||
* @typedef {Object} NotificationLink
|
||||
* @property {function} onClick The function to be called when the link is clicked
|
||||
* @property {string} cssClass A CSS class name to style the link
|
||||
* @property {string} text The text to be displayed for the link
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {object} NotificationOptions
|
||||
* @typedef {Object} NotificationOptions
|
||||
* @property {number} [autoDismissTimeout] Milliseconds to wait before automatically dismissing the notification
|
||||
* @property {boolean} [minimized] Allows for a notification to be minimized into the indicator by default
|
||||
* @property {NotificationLink} [link] A link for the notification
|
||||
@ -66,7 +66,7 @@ import moment from 'moment';
|
||||
* and then minimized to a banner notification if needed, or vice-versa.
|
||||
*
|
||||
* @see DialogModel
|
||||
* @typedef {object} NotificationModel
|
||||
* @typedef {Object} NotificationModel
|
||||
* @property {string} message The message to be displayed by the notification
|
||||
* @property {number | 'unknown'} [progress] The progress of some ongoing task. Should be a number between 0 and 100, or
|
||||
* with the string literal 'unknown'.
|
||||
|
@ -391,7 +391,7 @@ class InMemorySearchProvider {
|
||||
* Dispatch a search query to the worker and return a queryId.
|
||||
*
|
||||
* @private
|
||||
* @returns {String} a unique query Id for the query.
|
||||
* @returns {string} a unique query Id for the query.
|
||||
*/
|
||||
#dispatchSearchToWorker({ queryId, searchType, query, maxResults }) {
|
||||
const message = {
|
||||
|
@ -34,7 +34,7 @@ import Transaction from './Transaction.js';
|
||||
/**
|
||||
* Uniquely identifies a domain object.
|
||||
*
|
||||
* @typedef {object} Identifier
|
||||
* @typedef {Object} Identifier
|
||||
* @property {string} namespace the namespace to/from which this domain
|
||||
* object should be loaded/stored.
|
||||
* @property {string} key a unique identifier for the domain object
|
||||
@ -51,7 +51,7 @@ import Transaction from './Transaction.js';
|
||||
* A few common properties are defined for domain objects. Beyond these,
|
||||
* individual types of domain objects may add more as they see fit.
|
||||
*
|
||||
* @typedef {object} DomainObject
|
||||
* @typedef {Object} DomainObject
|
||||
* @property {Identifier} identifier a key/namespace pair which
|
||||
* uniquely identifies this domain object
|
||||
* @property {string} type the type of domain object
|
||||
@ -572,8 +572,8 @@ export default class ObjectAPI {
|
||||
|
||||
/**
|
||||
* Return path of telemetry objects in the object composition
|
||||
* @param {object} identifier the identifier for the domain object to query for
|
||||
* @param {object} [telemetryIdentifier] the specific identifier for the telemetry
|
||||
* @param {Object} identifier the identifier for the domain object to query for
|
||||
* @param {Object} [telemetryIdentifier] the specific identifier for the telemetry
|
||||
* to look for in the composition, uses first object in composition otherwise
|
||||
* @returns {Array} path of telemetry object in object composition
|
||||
*/
|
||||
|
@ -107,7 +107,7 @@ class OverlayAPI {
|
||||
* displaying messages that require the user's
|
||||
* immediate attention.
|
||||
* @param {model} options defines options for the dialog
|
||||
* @returns {object} with an object with a dismiss function that can be called from the calling code
|
||||
* @returns {Object} with an object with a dismiss function that can be called from the calling code
|
||||
* to dismiss/destroy the dialog
|
||||
*
|
||||
* A description of the model options that may be passed to the
|
||||
@ -134,7 +134,7 @@ class OverlayAPI {
|
||||
* Displays a blocking (modal) progress dialog. This dialog can be used for
|
||||
* displaying messages that require the user's attention, and show progress
|
||||
* @param {model} options defines options for the dialog
|
||||
* @returns {object} with an object with a dismiss function that can be called from the calling code
|
||||
* @returns {Object} with an object with a dismiss function that can be called from the calling code
|
||||
* to dismiss/destroy the dialog and an updateProgress function that takes progressPercentage(Number 0-100)
|
||||
* and progressText (string)
|
||||
*
|
||||
|
@ -156,7 +156,7 @@ class BatchingWebSocket extends EventTarget {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Number} maxBatchSize the maximum length of a batch of messages. For example,
|
||||
* @param {number} maxBatchSize the maximum length of a batch of messages. For example,
|
||||
* the maximum number of telemetry values to batch before dropping them
|
||||
* Note that this is a fail-safe that is only invoked if performance drops to the
|
||||
* point where Open MCT cannot keep up with the amount of telemetry it is receiving.
|
||||
|
@ -38,19 +38,19 @@ import TelemetryValueFormatter from './TelemetryValueFormatter.js';
|
||||
* Describes and bounds requests for telemetry data.
|
||||
*
|
||||
* @typedef TelemetryRequestOptions
|
||||
* @property {String} [sort] the key of the property to sort by. This may
|
||||
* @property {string} [sort] the key of the property to sort by. This may
|
||||
* be prefixed with a "+" or a "-" sign to sort in ascending
|
||||
* or descending order respectively. If no prefix is present,
|
||||
* ascending order will be used.
|
||||
* @property {Number} [start] the lower bound for values of the sorting property
|
||||
* @property {Number} [end] the upper bound for values of the sorting property
|
||||
* @property {String} [strategy] symbolic identifier for strategies
|
||||
* @property {number} [start] the lower bound for values of the sorting property
|
||||
* @property {number} [end] the upper bound for values of the sorting property
|
||||
* @property {string} [strategy] symbolic identifier for strategies
|
||||
* (such as `latest` or `minmax`) which may be recognized by providers;
|
||||
* these will be tried in order until an appropriate provider
|
||||
* is found
|
||||
* @property {AbortController} [signal] an AbortController which can be used
|
||||
* to cancel a telemetry request
|
||||
* @property {String} [domain] the domain key of the request
|
||||
* @property {string} [domain] the domain key of the request
|
||||
* @property {TimeContext} [timeContext] the time context to use for this request
|
||||
* @memberof module:openmct.TelemetryAPI~
|
||||
*/
|
||||
@ -59,7 +59,7 @@ import TelemetryValueFormatter from './TelemetryValueFormatter.js';
|
||||
* Describes and bounds requests for telemetry data.
|
||||
*
|
||||
* @typedef TelemetrySubscriptionOptions
|
||||
* @property {String} [strategy] symbolic identifier directing providers on how
|
||||
* @property {string} [strategy] symbolic identifier directing providers on how
|
||||
* to handle telemetry subscriptions. The default behavior is 'latest' which will
|
||||
* always return a single telemetry value with each callback, and in the event
|
||||
* of throttling will always prioritize the latest data, meaning intermediate
|
||||
@ -936,7 +936,7 @@ export default class TelemetryAPI {
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {object} LimitsResponseObject
|
||||
* @typedef {Object} LimitsResponseObject
|
||||
* @memberof {module:openmct.TelemetryAPI~}
|
||||
* @property {LimitDefinition} limitLevel the level name and it's limit definition
|
||||
* @example {
|
||||
@ -966,7 +966,7 @@ export default class TelemetryAPI {
|
||||
* @typedef LimitDefinitionValue
|
||||
* @memberof {module:openmct.TelemetryAPI~}
|
||||
* @property {string} color color to represent this limit
|
||||
* @property {Number} value the limit value
|
||||
* @property {number} value the limit value
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -1050,9 +1050,9 @@ export default class TelemetryAPI {
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {object} StalenessResponseObject
|
||||
* @property {Boolean} isStale boolean representing the staleness state
|
||||
* @property {Number} timestamp Unix timestamp in milliseconds
|
||||
* @typedef {Object} StalenessResponseObject
|
||||
* @property {boolean} isStale boolean representing the staleness state
|
||||
* @property {number} timestamp Unix timestamp in milliseconds
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -55,7 +55,7 @@ export default function installWorker() {
|
||||
|
||||
/**
|
||||
* Establish a new WebSocket connection to the given URL
|
||||
* @param {String} url
|
||||
* @param {string} url
|
||||
*/
|
||||
connect(url) {
|
||||
this.#wsUrl = url;
|
||||
|
@ -62,7 +62,7 @@ class TimeAPI extends GlobalTimeContext {
|
||||
* another time system might be "sols" for a Martian mission. TimeSystems do
|
||||
* not address the issue of converting between time systems.
|
||||
*
|
||||
* @typedef {object} TimeSystem
|
||||
* @typedef {Object} TimeSystem
|
||||
* @property {string} key A unique identifier
|
||||
* @property {string} name A human-readable descriptor
|
||||
* @property {string} [cssClass] Specify a css class defining an icon for
|
||||
@ -95,7 +95,7 @@ class TimeAPI extends GlobalTimeContext {
|
||||
* Clocks provide a timing source that is used to
|
||||
* automatically update the time bounds of the data displayed in Open MCT.
|
||||
*
|
||||
* @typedef {object} Clock
|
||||
* @typedef {Object} Clock
|
||||
* @memberof openmct.timeAPI
|
||||
* @property {string} key A unique identifier
|
||||
* @property {string} name A human-readable name. The name will be used to
|
||||
|
@ -122,7 +122,7 @@ class TimeContext extends EventEmitter {
|
||||
* Clock offsets are used to calculate temporal bounds when the system is
|
||||
* ticking on a clock source.
|
||||
*
|
||||
* @typedef {object} ValidationResult
|
||||
* @typedef {Object} ValidationResult
|
||||
* @property {boolean} valid Result of the validation - true or false.
|
||||
* @property {string} message An error message if valid is false.
|
||||
*/
|
||||
@ -241,7 +241,7 @@ class TimeContext extends EventEmitter {
|
||||
* Clock offsets are used to calculate temporal bounds when the system is
|
||||
* ticking on a clock source.
|
||||
*
|
||||
* @typedef {object} ClockOffsets
|
||||
* @typedef {Object} ClockOffsets
|
||||
* @property {number} start A time span relative to the current value of the
|
||||
* ticking clock, from which start bounds will be calculated. This value must
|
||||
* be < 0. When a clock is active, bounds will be calculated automatically
|
||||
|
@ -24,12 +24,12 @@ import Tooltip from './ToolTip.js';
|
||||
|
||||
/**
|
||||
* @readonly
|
||||
* @enum {String} TooltipLocation
|
||||
* @property {String} ABOVE The string for locating tooltips above an element
|
||||
* @property {String} BELOW The string for locating tooltips below an element
|
||||
* @property {String} RIGHT The pixel-spatial annotation type
|
||||
* @property {String} LEFT The temporal annotation type
|
||||
* @property {String} CENTER The plot-spatial annotation type
|
||||
* @enum {string} TooltipLocation
|
||||
* @property {string} ABOVE The string for locating tooltips above an element
|
||||
* @property {string} BELOW The string for locating tooltips below an element
|
||||
* @property {string} RIGHT The pixel-spatial annotation type
|
||||
* @property {string} LEFT The temporal annotation type
|
||||
* @property {string} CENTER The plot-spatial annotation type
|
||||
*/
|
||||
const TOOLTIP_LOCATIONS = Object.freeze({
|
||||
ABOVE: 'above',
|
||||
|
@ -21,10 +21,23 @@
|
||||
*****************************************************************************/
|
||||
import EventEmitter from 'EventEmitter';
|
||||
|
||||
/**
|
||||
* The StatusAPI is used to get and set various statuses linked to the current logged in user.
|
||||
* This includes the ability to set the status of the current user as a response to a poll question,
|
||||
* set the poll question itself, and the ability to set the status of mission actions.
|
||||
*
|
||||
* @augments EventEmitter
|
||||
*/
|
||||
export default class StatusAPI extends EventEmitter {
|
||||
/** @type {UserAPI} */
|
||||
#userAPI;
|
||||
/** @type {OpenMCT} */
|
||||
#openmct;
|
||||
|
||||
/**
|
||||
* @param {UserAPI} userAPI
|
||||
* @param {OpenMCT} openmct
|
||||
*/
|
||||
constructor(userAPI, openmct) {
|
||||
super();
|
||||
this.#userAPI = userAPI;
|
||||
@ -64,7 +77,7 @@ export default class StatusAPI extends EventEmitter {
|
||||
|
||||
/**
|
||||
* Set a poll question for operators to respond to. When presented with a status poll question, all operators will reply with their current status.
|
||||
* @param {String} questionText - The text of the question
|
||||
* @param {string} questionText - The text of the question
|
||||
* @returns {Promise<Boolean>} true if operation was successful, otherwise false.
|
||||
*/
|
||||
async setPollQuestion(questionText) {
|
||||
@ -316,7 +329,7 @@ export default class StatusAPI extends EventEmitter {
|
||||
}
|
||||
|
||||
/**
|
||||
* Private internal function that cannot be made #private because it needs to be registered as a callback to the user provider
|
||||
* Listen to status events from the UserProvider
|
||||
* @private
|
||||
*/
|
||||
listenToStatusEvents(provider) {
|
||||
@ -328,6 +341,7 @@ export default class StatusAPI extends EventEmitter {
|
||||
}
|
||||
|
||||
/**
|
||||
* Emit a status change event
|
||||
* @private
|
||||
*/
|
||||
onProviderStatusChange(newStatus) {
|
||||
@ -335,6 +349,7 @@ export default class StatusAPI extends EventEmitter {
|
||||
}
|
||||
|
||||
/**
|
||||
* Emit a poll question change event
|
||||
* @private
|
||||
*/
|
||||
onProviderPollQuestionChange(pollQuestion) {
|
||||
@ -342,6 +357,7 @@ export default class StatusAPI extends EventEmitter {
|
||||
}
|
||||
|
||||
/**
|
||||
* Emit a mission action status change event
|
||||
* @private
|
||||
*/
|
||||
onMissionActionStatusChange({ action, status }) {
|
||||
@ -349,6 +365,14 @@ export default class StatusAPI extends EventEmitter {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @typedef {import('./UserAPI').default} UserAPI
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {import('../../../openmct').OpenMCT} OpenMCT
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {import('./UserProvider')} UserProvider
|
||||
*/
|
||||
@ -360,27 +384,29 @@ export default class StatusAPI extends EventEmitter {
|
||||
/**
|
||||
* The PollQuestion type
|
||||
* @typedef {Object} PollQuestion
|
||||
* @property {String} question - The question to be presented to users
|
||||
* @property {Number} timestamp - The time that the poll question was set.
|
||||
*/
|
||||
|
||||
/**
|
||||
* The MissionStatus type
|
||||
* @typedef {Object} MissionStatusOption
|
||||
* @extends {Status}
|
||||
* @property {String} color A color to be used when displaying the mission status
|
||||
* @property {string} question - The question to be presented to users
|
||||
* @property {number} timestamp - The time that the poll question was set.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} MissionAction
|
||||
* @property {String} key A unique identifier for this action
|
||||
* @property {String} label A human readable label for this action
|
||||
* @property {string} key A unique identifier for this action
|
||||
* @property {string} label A human readable label for this action
|
||||
*/
|
||||
|
||||
/**
|
||||
* The MissionStatusOption type, extends Status.
|
||||
* @typedef {Object} MissionStatusOption
|
||||
* @property {string} key - A unique identifier for this status.
|
||||
* @property {string} label - A human-readable label for this status.
|
||||
* @property {number} timestamp - The time that the status was set.
|
||||
* @property {string} color - A color to be used when displaying the mission status.
|
||||
*/
|
||||
|
||||
/**
|
||||
* The Status type
|
||||
* @typedef {Object} Status
|
||||
* @property {String} key - A unique identifier for this status
|
||||
* @property {String} label - A human readable label for this status
|
||||
* @property {Number} timestamp - The time that the status was set.
|
||||
* @property {string} key - A unique identifier for this status
|
||||
* @property {string} label - A human readable label for this status
|
||||
* @property {number} timestamp - The time that the status was set.
|
||||
*/
|
||||
|
@ -20,6 +20,9 @@
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
|
||||
/**
|
||||
* The example User class.
|
||||
*/
|
||||
export default class User {
|
||||
constructor(id, name) {
|
||||
this.id = id;
|
||||
|
@ -28,6 +28,8 @@ import StoragePersistance from './StoragePersistance.js';
|
||||
import User from './User.js';
|
||||
|
||||
class UserAPI extends EventEmitter {
|
||||
/** @type {OpenMCT} */
|
||||
#openmct;
|
||||
/**
|
||||
* @param {OpenMCT} openmct
|
||||
* @param {UserAPIConfiguration} config
|
||||
@ -35,7 +37,7 @@ class UserAPI extends EventEmitter {
|
||||
constructor(openmct, config) {
|
||||
super();
|
||||
|
||||
this._openmct = openmct;
|
||||
this.#openmct = openmct;
|
||||
this._provider = undefined;
|
||||
|
||||
this.User = User;
|
||||
@ -134,7 +136,7 @@ class UserAPI extends EventEmitter {
|
||||
/**
|
||||
* Will return if a role can provide a operator status response
|
||||
* @memberof module:openmct.UserApi#
|
||||
* @returns {Boolean}
|
||||
* @returns {boolean}
|
||||
*/
|
||||
canProvideStatusForRole() {
|
||||
if (!this.hasProvider()) {
|
||||
@ -166,7 +168,7 @@ class UserAPI extends EventEmitter {
|
||||
* 'hasRole' method
|
||||
*
|
||||
* @memberof module:openmct.UserAPI#
|
||||
* @returns {Function|Boolean} user provider 'isLoggedIn' method
|
||||
* @returns {Function|boolean} user provider 'isLoggedIn' method
|
||||
* @param {string} roleId id of role to check for
|
||||
* @throws Will throw an error if no user provider is set
|
||||
*/
|
||||
@ -201,20 +203,28 @@ class UserAPI extends EventEmitter {
|
||||
}
|
||||
|
||||
export default UserAPI;
|
||||
|
||||
/**
|
||||
* @typedef {String} Role
|
||||
* @typedef {string} Role
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} OpenMCT
|
||||
* @typedef {import('../../../openmct.js').OpenMCT} OpenMCT
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {{statusStyles: Object.<string, StatusStyleDefinition>}} UserAPIConfiguration
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} StatusStyleDefinition
|
||||
* @property {String} iconClass The icon class to apply to the status indicator when this status is active "icon-circle-slash",
|
||||
* @property {String} iconClassPoll The icon class to apply to the poll question indicator when this style is active eg. "icon-status-poll-question-mark"
|
||||
* @property {String} statusClass The class to apply to the indicator when this status is active eg. "s-status-error"
|
||||
* @property {String} statusBgColor The background color to apply in the status summary section of the poll question popup for this status eg."#9900cc"
|
||||
* @property {String} statusFgColor The foreground color to apply in the status summary section of the poll question popup for this status eg. "#fff"
|
||||
* @property {string} iconClass The icon class to apply to the status indicator when this status is active "icon-circle-slash",
|
||||
* @property {string} iconClassPoll The icon class to apply to the poll question indicator when this style is active eg. "icon-status-poll-question-mark"
|
||||
* @property {string} statusClass The class to apply to the indicator when this status is active eg. "s-status-error"
|
||||
* @property {string} statusBgColor The background color to apply in the status summary section of the poll question popup for this status eg."#9900cc"
|
||||
* @property {string} statusFgColor The foreground color to apply in the status summary section of the poll question popup for this status eg. "#fff"
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} UserProvider
|
||||
*/
|
||||
|
@ -19,18 +19,24 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
|
||||
/**
|
||||
* A user provider is responsible for providing information about the currently
|
||||
* logged in user. This includes information about the user's roles, and whether
|
||||
* the user is currently logged in.
|
||||
*/
|
||||
export default class UserProvider {
|
||||
/**
|
||||
* @returns {Promise<User>} A promise that resolves with the currently logged in user
|
||||
*/
|
||||
getCurrentUser() {}
|
||||
/**
|
||||
* @returns {Boolean} true if a user is currently logged in, otherwise false
|
||||
* @returns {boolean} true if a user is currently logged in, otherwise false
|
||||
*/
|
||||
isLoggedIn() {}
|
||||
/**
|
||||
* @param {String} role
|
||||
* @returns {Promise<Boolean>} true if the current user has the given role
|
||||
* @param {string} role
|
||||
* @returns {Promise<boolean>} true if the current user has the given role
|
||||
*/
|
||||
hasRole(role) {}
|
||||
}
|
||||
|
Reference in New Issue
Block a user