chore: add prettier (2/3): apply formatting, re-enable lint ci step (#6682)

* style: apply prettier formatting

* fix: re-enable lint ci check
This commit is contained in:
Jesse Mazzella
2023-05-18 14:54:46 -07:00
committed by GitHub
parent 172e0b23fd
commit caa7bc6fae
976 changed files with 115922 additions and 114693 deletions

View File

@ -1,4 +1,3 @@
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2023, United States Government
* as represented by the Administrator of the National Aeronautics and Space
@ -24,65 +23,66 @@
import EventEmitter from 'EventEmitter';
export default class Editor extends EventEmitter {
constructor(openmct) {
super();
this.editing = false;
this.openmct = openmct;
constructor(openmct) {
super();
this.editing = false;
this.openmct = openmct;
}
/**
* Initiate an editing session. This will start a transaction during
* which any persist operations will be deferred until either save()
* or finish() are called.
*/
edit() {
if (this.editing === true) {
throw 'Already editing';
}
/**
* Initiate an editing session. This will start a transaction during
* which any persist operations will be deferred until either save()
* or finish() are called.
*/
edit() {
if (this.editing === true) {
throw "Already editing";
}
this.editing = true;
this.emit('isEditing', true);
this.openmct.objects.startTransaction();
}
this.editing = true;
this.emit('isEditing', true);
this.openmct.objects.startTransaction();
}
/**
* @returns {boolean} true if the application is in edit mode, false otherwise.
*/
isEditing() {
return this.editing;
}
/**
* @returns {boolean} true if the application is in edit mode, false otherwise.
*/
isEditing() {
return this.editing;
}
/**
* Save any unsaved changes from this editing session. This will
* end the current transaction.
*/
async save() {
const transaction = this.openmct.objects.getActiveTransaction();
await transaction.commit();
this.editing = false;
this.emit('isEditing', false);
this.openmct.objects.endTransaction();
}
/**
* Save any unsaved changes from this editing session. This will
* end the current transaction.
*/
async save() {
const transaction = this.openmct.objects.getActiveTransaction();
await transaction.commit();
this.editing = false;
this.emit('isEditing', false);
this.openmct.objects.endTransaction();
}
/**
* End the currently active transaction and discard unsaved changes.
*/
cancel() {
this.editing = false;
this.emit('isEditing', false);
/**
* End the currently active transaction and discard unsaved changes.
*/
cancel() {
this.editing = false;
this.emit('isEditing', false);
return new Promise((resolve, reject) => {
const transaction = this.openmct.objects.getActiveTransaction();
if (!transaction) {
return resolve();
}
return new Promise((resolve, reject) => {
const transaction = this.openmct.objects.getActiveTransaction();
if (!transaction) {
return resolve();
}
transaction.cancel()
.then(resolve)
.catch(reject)
.finally(() => {
this.openmct.objects.endTransaction();
});
transaction
.cancel()
.then(resolve)
.catch(reject)
.finally(() => {
this.openmct.objects.endTransaction();
});
}
});
}
}