Fixes issue #2537 Removes unused isEditing parameter for the view method of ViewProviders. (#2542)

This commit is contained in:
Shefali Joshi 2019-11-18 10:27:05 -08:00 committed by Pegah Sarram
parent 93abb09419
commit a4c2e944b3
8 changed files with 14 additions and 15 deletions

View File

@ -38,7 +38,7 @@ define([
canEdit: function (domainObject) { canEdit: function (domainObject) {
return domainObject.type === 'LadTableSet'; return domainObject.type === 'LadTableSet';
}, },
view: function (domainObject, isEditing, objectPath) { view: function (domainObject, objectPath) {
let component; let component;
return { return {

View File

@ -38,7 +38,7 @@ define([
canEdit: function (domainObject) { canEdit: function (domainObject) {
return domainObject.type === 'LadTable'; return domainObject.type === 'LadTable';
}, },
view: function (domainObject, isEditing, objectPath) { view: function (domainObject, objectPath) {
let component; let component;
return { return {

View File

@ -46,7 +46,7 @@ define([
return selection.every(isTelemetryObject); return selection.every(isTelemetryObject);
}, },
view: function (domainObject, isEditing, objectPath) { view: function (domainObject, objectPath) {
let component; let component;
return { return {
show: function (element) { show: function (element) {

View File

@ -37,7 +37,7 @@ export default function DisplayLayoutPlugin(options) {
canEdit: function (domainObject) { canEdit: function (domainObject) {
return domainObject.type === 'layout'; return domainObject.type === 'layout';
}, },
view: function (domainObject, isEditing, objectPath) { view: function (domainObject, objectPath) {
let component; let component;
return { return {
show(container) { show(container) {

View File

@ -48,7 +48,7 @@ define([
canEdit(domainObject) { canEdit(domainObject) {
return domainObject.type === 'table'; return domainObject.type === 'table';
}, },
view(domainObject, isEditing, objectPath) { view(domainObject, objectPath) {
let table = new TelemetryTable(domainObject, openmct); let table = new TelemetryTable(domainObject, openmct);
let component; let component;
return { return {

View File

@ -77,7 +77,7 @@ export default {
if (!this.currentObject) { if (!this.currentObject) {
return; return;
} }
this.composition = this.openmct.composition.get(this.currentObject); this.composition = this.openmct.composition.get(this.currentObject);
if (this.composition) { if (this.composition) {
this.composition._synchronize(); this.composition._synchronize();
@ -98,13 +98,13 @@ export default {
if (this.openmct.editor.isEditing()) { if (this.openmct.editor.isEditing()) {
this.currentView = provider.edit(this.currentObject, true, objectPath); this.currentView = provider.edit(this.currentObject, true, objectPath);
} else { } else {
this.currentView = provider.view(this.currentObject, false, objectPath); this.currentView = provider.view(this.currentObject, objectPath);
} }
this.openmct.editor.on('isEditing', this.toggleEditView); this.openmct.editor.on('isEditing', this.toggleEditView);
this.releaseEditModeHandler = () => this.openmct.editor.off('isEditing', this.toggleEditView); this.releaseEditModeHandler = () => this.openmct.editor.off('isEditing', this.toggleEditView);
} else { } else {
this.currentView = provider.view(this.currentObject, this.openmct.editor.isEditing(), objectPath); this.currentView = provider.view(this.currentObject, objectPath);
if (this.currentView.onEditModeChange) { if (this.currentView.onEditModeChange) {
this.openmct.editor.on('isEditing', this.invokeEditModeHandler); this.openmct.editor.on('isEditing', this.invokeEditModeHandler);
@ -186,7 +186,7 @@ export default {
}, },
editIfEditable(event) { editIfEditable(event) {
let provider = this.getViewProvider(); let provider = this.getViewProvider();
if (provider && if (provider &&
provider.canEdit && provider.canEdit &&
provider.canEdit(this.currentObject) && provider.canEdit(this.currentObject) &&
!this.openmct.editor.isEditing()) { !this.openmct.editor.isEditing()) {
@ -204,7 +204,7 @@ export default {
if (domainObject) { if (domainObject) {
let clearKeyString = this.openmct.objects.makeKeyString(domainObject.identifier), let clearKeyString = this.openmct.objects.makeKeyString(domainObject.identifier),
currentObjectKeyString = this.openmct.objects.makeKeyString(this.currentObject.identifier); currentObjectKeyString = this.openmct.objects.makeKeyString(this.currentObject.identifier);
if (clearKeyString === currentObjectKeyString) { if (clearKeyString === currentObjectKeyString) {
if (this.currentView.onClearData) { if (this.currentView.onClearData) {
this.currentView.onClearData(); this.currentView.onClearData();

View File

@ -39,8 +39,8 @@
@setView="setView"> @setView="setView">
</view-switcher> </view-switcher>
<button v-if="notebookEnabled" <button v-if="notebookEnabled"
class="l-browse-bar__actions__edit c-button icon-notebook" class="l-browse-bar__actions__edit c-button icon-notebook"
title="New Notebook entry" title="New Notebook entry"
@click="snapshot"> @click="snapshot">
</button> </button>
</div> </div>
@ -123,13 +123,13 @@
}, },
setView(view) { setView(view) {
this.clear(); this.clear();
this.viewKey = view.key; this.viewKey = view.key;
this.viewContainer = document.createElement('div'); this.viewContainer = document.createElement('div');
this.viewContainer.classList.add('c-object-view','u-contents'); this.viewContainer.classList.add('c-object-view','u-contents');
this.$refs.objectView.append(this.viewContainer); this.$refs.objectView.append(this.viewContainer);
this.view = this.currentView.view(this.domainObject, false, this.objectPath); this.view = this.currentView.view(this.domainObject, this.objectPath);
this.view.show(this.viewContainer, false); this.view.show(this.viewContainer, false);
} }
}, },

View File

@ -225,7 +225,6 @@ define(['EventEmitter'], function (EventEmitter) {
* *
* When called by Open MCT, the following arguments will be passed to it: * When called by Open MCT, the following arguments will be passed to it:
* @param {object} domainObject - the domainObject that the view is provided for * @param {object} domainObject - the domainObject that the view is provided for
* @param {boolean} isEditing - A boolean value indicating wether openmct is in a global edit mode
* @param {array} objectPath - The current contextual object path of the view object * @param {array} objectPath - The current contextual object path of the view object
* eg current domainObject is located under MyItems which is under Root * eg current domainObject is located under MyItems which is under Root
* *