Skip to content

Commit

Permalink
Merge branch 'master' into feat/concurrent-linting
Browse files Browse the repository at this point in the history
  • Loading branch information
unlikelyzero committed Aug 30, 2023
2 parents a0026e5 + b87459d commit ceef077
Show file tree
Hide file tree
Showing 18 changed files with 119 additions and 60 deletions.
40 changes: 29 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

Open MCT (Open Mission Control Technologies) is a next-generation mission control framework for visualization of data on desktop and mobile devices. It is developed at NASA's Ames Research Center, and is being used by NASA for data analysis of spacecraft missions, as well as planning and operation of experimental rover systems. As a generalizable and open source framework, Open MCT could be used as the basis for building applications for planning, operation, and analysis of any systems producing telemetry data.

Please visit our [Official Site](https://nasa.github.io/openmct/) and [Getting Started Guide](https://nasa.github.io/openmct/getting-started/)
> [!NOTE]
> Please visit our [Official Site](https://nasa.github.io/openmct/) and [Getting Started Guide](https://nasa.github.io/openmct/getting-started/)

Once you've created something amazing with Open MCT, showcase your work in our GitHub Discussions [Show and Tell](https://github.com/nasa/openmct/discussions/categories/show-and-tell) section. We love seeing unique and wonderful implementations of Open MCT!

Expand All @@ -14,20 +16,32 @@ Once you've created something amazing with Open MCT, showcase your work in our G
Building and running Open MCT in your local dev environment is very easy. Be sure you have [Git](https://git-scm.com/downloads) and [Node.js](https://nodejs.org/) installed, then follow the directions below. Need additional information? Check out the [Getting Started](https://nasa.github.io/openmct/getting-started/) page on our website.
(These instructions assume you are installing as a non-root user; developers have [reported issues](https://github.com/nasa/openmct/issues/1151) running these steps with root privileges.)

1. Clone the source code
1. Clone the source code:

```
git clone https://github.com/nasa/openmct.git
```

2. (Optional) Install the correct node version using [nvm](https://github.com/nvm-sh/nvm):

`git clone https://github.com/nasa/openmct.git`
```
nvm install
```

2. (Optionally) Install the correct node version using [nvm](https://github.com/nvm-sh/nvm) (`nvm install`)
3. Install development dependencies. Note: Check the package.json engine for our tested and supported node versions.
3. Install development dependencies (Note: Check the `package.json` engine for our tested and supported node versions):

`npm install`
```
npm install
```

4. Run a local development server
4. Run a local development server:

`npm start`
```
npm start
```

Open MCT is now running, and can be accessed by pointing a web browser at [http://localhost:8080/](http://localhost:8080/)
> [!IMPORTANT]
> Open MCT is now running, and can be accessed by pointing a web browser at [http://localhost:8080/](http://localhost:8080/)
Open MCT is built using [`npm`](http://npmjs.com/) and [`webpack`](https://webpack.js.org/).

Expand All @@ -41,8 +55,12 @@ The clearest examples for developing Open MCT plugins are in the
[tutorials](https://github.com/nasa/openmct-tutorial) provided in
our documentation.

We want Open MCT to be as easy to use, install, run, and develop for as
possible, and your feedback will help us get there! Feedback can be provided via [GitHub issues](https://github.com/nasa/openmct/issues/new/choose), [Starting a GitHub Discussion](https://github.com/nasa/openmct/discussions), or by emailing us at [arc-dl-openmct@mail.nasa.gov](mailto:arc-dl-openmct@mail.nasa.gov).
> [!NOTE]
> We want Open MCT to be as easy to use, install, run, and develop for as
> possible, and your feedback will help us get there!
> Feedback can be provided via [GitHub issues](https://github.com/nasa/openmct/issues/new/choose),
> [Starting a GitHub Discussion](https://github.com/nasa/openmct/discussions),
> or by emailing us at [arc-dl-openmct@mail.nasa.gov](mailto:arc-dl-openmct@mail.nasa.gov).
## Developing Applications With Open MCT

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ test.describe('Operator Status', () => {
});
await page.goto('./', { waitUntil: 'domcontentloaded' });
await expect(page.getByText('Select Role')).toBeVisible();
// Description should be empty https://github.com/nasa/openmct/issues/6978
await expect(page.locator('.c-message__action-text')).toBeHidden();
// set role
await page.getByRole('button', { name: 'Select' }).click();
// dismiss role confirmation popup
Expand Down
2 changes: 1 addition & 1 deletion src/api/notifications/NotificationAPI.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ export default class NotificationAPI extends EventEmitter {
/**
* Create a new progress notification. These notifications will contain a progress bar.
* @param {string} message
* @param {number | 'unknown'} progressPerc A value between 0 and 100, or the string 'unknown'.
* @param {number | null} progressPerc A value between 0 and 100, or null.
* @param {string} [progressText] Text description of progress (eg. "10 of 20 objects copied").
*/
progress(message, progressPerc, progressText) {
Expand Down
2 changes: 1 addition & 1 deletion src/api/overlays/OverlayAPI.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ class OverlayAPI {
* @see NotificationService
*
* @typedef options
* @property {number} progressPerc the initial progress value (0-100) or {string} 'unknown' for anonymous progress
* @property {number | null} progressPerc the initial progress value (0-100) or null for anonymous progress
* @property {string} progressText the initial text to be shown under the progress bar
* @property {buttons[]} buttons a list of buttons with title and callback properties that will
* be added to the dialog.
Expand Down
19 changes: 18 additions & 1 deletion src/api/telemetry/TelemetryAPI.js
Original file line number Diff line number Diff line change
Expand Up @@ -784,6 +784,7 @@ export default class TelemetryAPI {
*/
getLimits(domainObject) {
const provider = this.#findLimitEvaluator(domainObject);

if (!provider || !provider.getLimits) {
return {
limits: function () {
Expand All @@ -792,7 +793,23 @@ export default class TelemetryAPI {
};
}

return provider.getLimits(domainObject);
const abortController = new AbortController();
const options = { signal: abortController.signal };
this.requestAbortControllers.add(abortController);

try {
return provider.getLimits(domainObject, options);
} catch (error) {
if (error.name !== 'AbortError') {
this.openmct.notifications.error(
'Error requesting telemetry data, see console for details'
);
}

throw new Error(error);
} finally {
this.requestAbortControllers.delete(abortController);
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/plugins/formActions/CreateAction.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export default class CreateAction extends PropertiesAction {

// Show saving progress dialog
let dialog = this.openmct.overlays.progressDialog({
progressPerc: 'unknown',
progressPerc: null,
message:
'Do not navigate away from this page or close this browser tab while this message is displayed.',
iconClass: 'info',
Expand Down
1 change: 1 addition & 0 deletions src/plugins/imagery/components/ImageryView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -864,6 +864,7 @@ export default {
if (this.domainObject.configuration) {
const persistedLayers = this.domainObject.configuration.layers;
if (!persistedLayers) {
this.layers.forEach((layer) => (layer.visible = false));
return;
}
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/notebook/components/Notebook.vue
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
<progress-bar
v-if="savingTransaction"
class="c-telemetry-table__progress-bar"
:model="{ progressPerc: undefined }"
:model="{ progressPerc: null }"
/>
<div v-if="selectedPage && selectedPage.isLocked" class="c-notebook__page-locked">
<div class="icon-lock"></div>
Expand Down
8 changes: 8 additions & 0 deletions src/plugins/persistence/couch/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,14 @@ sh ./src/plugins/persistence/couch/replace-localstorage-with-couchdb-indexhtml.s

Open MCT will now use your local CouchDB container as its persistence store. Access the CouchDB instance manager by visiting <http://localhost:5984/_utils>.

### Removing CouchDB Container completely

To completely remove the CouchDB container and volumes:

```sh
docker stop couch-couchdb-1;docker rm couch-couchdb-1;docker volume rm couch_couchdb
```

## macOS

While we highly recommend using the CouchDB docker-compose installation, it is still possible to install CouchDB through other means.
Expand Down
77 changes: 45 additions & 32 deletions src/plugins/persistence/couch/setup-couchdb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ if [ "${COUCH_ADMIN_PASSWORD}" ]; then
CURL_USERPASS_ARG+=":${COUCH_ADMIN_PASSWORD}"
fi

# Functions
resource_exists() {
response=$(curl -u "${CURL_USERPASS_ARG}" -s -o /dev/null -I -w "%{http_code}" $1);
if [ "200" == "${response}" ]; then
Expand All @@ -29,16 +28,16 @@ resource_exists() {
}

db_exists() {
resource_exists $COUCH_BASE_LOCAL/$OPENMCT_DATABASE_NAME
resource_exists "$COUCH_BASE_LOCAL"/"$OPENMCT_DATABASE_NAME"
}

create_db() {
response=$(curl -su "${CURL_USERPASS_ARG}" -XPUT $COUCH_BASE_LOCAL/$OPENMCT_DATABASE_NAME);
echo $response
response=$(curl -su "${CURL_USERPASS_ARG}" -XPUT "$COUCH_BASE_LOCAL"/"$OPENMCT_DATABASE_NAME");
echo "$response"
}

admin_user_exists() {
response=$(curl -su "${CURL_USERPASS_ARG}" -o /dev/null -I -w "%{http_code}" $COUCH_BASE_LOCAL/_node/$COUCH_NODE_NAME/_config/admins/$COUCH_ADMIN_USER);
response=$(curl -su "${CURL_USERPASS_ARG}" -o /dev/null -I -w "%{http_code}" "$COUCH_BASE_LOCAL"/_node/"$COUCH_NODE_NAME"/_config/admins/"$COUCH_ADMIN_USER");
if [ "200" == "${response}" ]; then
echo "TRUE"
else
Expand All @@ -48,26 +47,26 @@ admin_user_exists() {

create_admin_user() {
echo Creating admin user
curl -X PUT $COUCH_BASE_LOCAL/_node/$COUCH_NODE_NAME/_config/admins/$COUCH_ADMIN_USER -d \'"$COUCH_ADMIN_PASSWORD"\'
curl -X PUT "$COUCH_BASE_LOCAL"/_node/"$COUCH_NODE_NAME"/_config/admins/"$COUCH_ADMIN_USER" -d \'"$COUCH_ADMIN_PASSWORD"\'
}

is_cors_enabled() {
resource_exists $COUCH_BASE_LOCAL/_node/$COUCH_NODE_NAME/_config/httpd/enable_cors
resource_exists "$COUCH_BASE_LOCAL"/_node/"$COUCH_NODE_NAME"/_config/httpd/enable_cors
}

enable_cors() {
curl -su "${CURL_USERPASS_ARG}" -o /dev/null -X PUT $COUCH_BASE_LOCAL/_node/$COUCH_NODE_NAME/_config/httpd/enable_cors -d '"true"'
curl -su "${CURL_USERPASS_ARG}" -o /dev/null -X PUT $COUCH_BASE_LOCAL/_node/$COUCH_NODE_NAME/_config/cors/origins -d '"*"'
curl -su "${CURL_USERPASS_ARG}" -o /dev/null -X PUT $COUCH_BASE_LOCAL/_node/$COUCH_NODE_NAME/_config/cors/credentials -d '"true"'
curl -su "${CURL_USERPASS_ARG}" -o /dev/null -X PUT $COUCH_BASE_LOCAL/_node/$COUCH_NODE_NAME/_config/cors/methods -d '"GET, PUT, POST, HEAD, DELETE"'
curl -su "${CURL_USERPASS_ARG}" -o /dev/null -X PUT $COUCH_BASE_LOCAL/_node/$COUCH_NODE_NAME/_config/cors/headers -d '"accept, authorization, content-type, origin, referer, x-csrf-token"'
curl -su "${CURL_USERPASS_ARG}" -o /dev/null -X PUT "$COUCH_BASE_LOCAL"/_node/"$COUCH_NODE_NAME"/_config/httpd/enable_cors -d '"true"'
curl -su "${CURL_USERPASS_ARG}" -o /dev/null -X PUT "$COUCH_BASE_LOCAL"/_node/"$COUCH_NODE_NAME"/_config/cors/origins -d '"*"'
curl -su "${CURL_USERPASS_ARG}" -o /dev/null -X PUT "$COUCH_BASE_LOCAL"/_node/"$COUCH_NODE_NAME"/_config/cors/credentials -d '"true"'
curl -su "${CURL_USERPASS_ARG}" -o /dev/null -X PUT "$COUCH_BASE_LOCAL"/_node/"$COUCH_NODE_NAME"/_config/cors/methods -d '"GET, PUT, POST, HEAD, DELETE"'
curl -su "${CURL_USERPASS_ARG}" -o /dev/null -X PUT "$COUCH_BASE_LOCAL"/_node/"$COUCH_NODE_NAME"/_config/cors/headers -d '"accept, authorization, content-type, origin, referer, x-csrf-token"'
}

update_db_permissions() {
local db_name=$1
echo "Updating ${db_name} database permissions"
response=$(curl -su "${CURL_USERPASS_ARG}" --location \
--request PUT $COUCH_BASE_LOCAL/$db_name/_security \
--request PUT "$COUCH_BASE_LOCAL"/"$db_name"/_security \
--header 'Content-Type: application/json' \
--data-raw '{ "admins": {"roles": []},"members": {"roles": []}}')
if [ "{\"ok\":true}" == "${response}" ]; then
Expand All @@ -77,17 +76,24 @@ update_db_permissions() {
fi
}

create_system_tables() {
local system_tables=("_users" "_replicator")
for table in "${system_tables[@]}"; do
echo "Creating $table database"
response=$(curl -su "${CURL_USERPASS_ARG}" -X PUT $COUCH_BASE_LOCAL/$table)
if [ "{\"ok\":true}" == "${response}" ]; then
echo "Successfully created $table database"
else
echo "Unable to create $table database"
fi
done
create_users_table() {
echo "Creating _users database"
response=$(curl -su "${CURL_USERPASS_ARG}" -XPUT "$COUCH_BASE_LOCAL"/_users)
if [ "{\"ok\":true}" == "${response}" ]; then
echo "Successfully created _users database"
else
echo "Unable to create _users database"
fi
}

create_replicator_table() {
echo "Creating _replicator database"
response=$(curl -su "${CURL_USERPASS_ARG}" -XPUT "$COUCH_BASE_LOCAL"/_replicator)
if [ "{\"ok\":true}" == "${response}" ]; then
echo "Successfully created _replicator database"
else
echo "Unable to create _replicator database"
fi
}

# Main script execution
Expand All @@ -100,17 +106,24 @@ else
echo "Admin user exists"
fi

# Check if system tables exist; if not, create them.
system_tables_exist=$(resource_exists $COUCH_BASE_LOCAL/_users)
if [ "TRUE" == "${system_tables_exist}" ]; then
echo "System tables exist, skipping creation"
# Check if the _users table exists; if not, create it.
users_table_exists=$(resource_exists "$COUCH_BASE_LOCAL"/_users)
if [ "FALSE" == "${users_table_exists}" ]; then
create_users_table
else
echo "_users database already exists, skipping creation"
fi

# Check if the _replicator database exists; if not, create it.
replicator_table_exists=$(resource_exists "$COUCH_BASE_LOCAL/_replicator")
if [ "FALSE" == "${replicator_table_exists}" ]; then
create_replicator_table
else
echo "Fresh install, creating system tables"
create_system_tables
echo "_replicator database already exists, skipping creation"
fi

# Check if the database exists; if not, create it.
if [ "FALSE" == $(db_exists) ]; then
if [ "FALSE" == "$(db_exists)" ]; then
response=$(create_db)
if [ "{\"ok\":true}" == "${response}" ]; then
echo "Database successfully created"
Expand All @@ -126,7 +139,7 @@ update_db_permissions "_replicator"
update_db_permissions "${OPENMCT_DATABASE_NAME}"

# Check if CORS is enabled; if not, enable it.
if [ "FALSE" == $(is_cors_enabled) ]; then
if [ "FALSE" == "$(is_cors_enabled)" ]; then
echo "Enabling CORS"
enable_cors
else
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/plot/Plot.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<progress-bar
v-show="!!loading"
class="c-telemetry-table__progress-bar"
:model="{ progressPerc: undefined }"
:model="{ progressPerc: null }"
/>
<mct-plot
:class="[plotLegendExpandedStateClass, plotLegendPositionClass]"
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/staticRootPlugin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ Any object tree in Open MCT can be exported as JSON after installing the

## Installation
``` js
openmct.install(openmct.plugins.StaticRootPlugin('mission', 'data/static-objects.json'));
openmct.install(openmct.plugins.StaticRootPlugin({ namespace: 'mission', exportUrl: 'data/static-objects.json' }));
```

## Parameters
The StaticRootPlugin takes two parameters:
1. __namespace__: This should be a name that uniquely identifies this collection of objects.
2. __path__: The file that the static tree should be exposed from. This will need to be a path that is reachable by a web
2. __exportUrl__: The file that the static tree should be exposed from. This will need to be a path that is reachable by a web
browser, ie not a path on the local file system.
2 changes: 1 addition & 1 deletion src/plugins/telemetryTable/components/table.vue
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@
<progress-bar
v-if="loading"
class="c-telemetry-table__progress-bar"
:model="{ progressPerc: undefined }"
:model="{ progressPerc: null }"
/>

<!-- Headers table -->
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/userIndicator/components/UserIndicator.vue
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export default {
selectionOptions,
iconClass: 'alert',
title: 'Select Role',
message: 'Please select your role for operator status.',
message: '',
currentSelection: this.role,
onChange: (event) => {
this.inputRoleSelection = event.target.value;
Expand Down
4 changes: 2 additions & 2 deletions src/ui/components/ProgressBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<div class="c-progress-bar">
<div
class="c-progress-bar__bar"
:class="{ '--indeterminate': model.progressPerc === undefined }"
:class="{ '--indeterminate': model.progressPerc === null }"
:style="styleBarWidth"
></div>
<div v-if="model.progressText !== undefined" class="c-progress-bar__text">
Expand All @@ -43,7 +43,7 @@ export default {
},
computed: {
styleBarWidth() {
return this.model.progressPerc !== undefined ? `width: ${this.model.progressPerc}%;` : '';
return this.model.progressPerc !== null ? `width: ${this.model.progressPerc}%;` : '';
}
}
};
Expand Down
2 changes: 1 addition & 1 deletion src/ui/layout/BrowseBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ export default {
},
saveAndFinishEditing() {
let dialog = this.openmct.overlays.progressDialog({
progressPerc: 'unknown',
progressPerc: null,
message:
'Do not navigate away from this page or close this browser tab while this message is displayed.',
iconClass: 'info',
Expand Down
2 changes: 1 addition & 1 deletion src/ui/layout/search/SearchResultsDropDown.vue
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
</div>
<div v-if="searchLoading" class="c-gsearch__result-pane-msg">
<div class="hint">Searching...</div>
<progress-bar :model="{ progressPerc: undefined }" />
<progress-bar :model="{ progressPerc: null }" />
</div>
<div
v-if="
Expand Down

0 comments on commit ceef077

Please sign in to comment.