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

New action to reload an individual view and all of its children #7362

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
Next Next commit
add reload action plugin
  • Loading branch information
scottbell committed Jan 9, 2024
commit b0d83efd8db12fdd2c145a9189da0f6196e11a64
1 change: 1 addition & 0 deletions src/MCT.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ export class MCT extends EventEmitter {
this.install(this.plugins.FlexibleLayout());
this.install(this.plugins.GoToOriginalAction());
this.install(this.plugins.OpenInNewTabAction());
this.install(this.plugins.ReloadAction());
this.install(this.plugins.WebPage());
this.install(this.plugins.Condition());
this.install(this.plugins.ConditionWidget());
Expand Down
2 changes: 2 additions & 0 deletions src/plugins/plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ import PerformanceIndicator from './performanceIndicator/plugin.js';
import CouchDBPlugin from './persistence/couch/plugin.js';
import PlanLayout from './plan/plugin.js';
import PlotPlugin from './plot/plugin.js';
import ReloadAction from './reloadAction/plugin.js';
import RemoteClock from './remoteClock/plugin.js';
import StaticRootPlugin from './staticRootPlugin/plugin.js';
import SummaryWidget from './summaryWidget/plugin.js';
Expand Down Expand Up @@ -141,6 +142,7 @@ plugins.Filters = Filters;
plugins.ObjectMigration = ObjectMigration;
plugins.GoToOriginalAction = GoToOriginalAction;
plugins.OpenInNewTabAction = OpenInNewTabAction;
plugins.ReloadAction = ReloadAction;
plugins.ClearData = ClearData;
plugins.WebPage = WebPagePlugin;
plugins.Espresso = Espresso;
Expand Down
37 changes: 37 additions & 0 deletions src/plugins/reloadAction/ReloadAction.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2023, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
* Open MCT is licensed under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
* Open MCT includes source code licensed under additional open source
* licenses. See the Open Source Licenses file (LICENSES.md) included with
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
export default class ReloadAction {
constructor(openmct) {
this.name = 'Reload';
this.key = 'reload';
this.description = 'Reload this object and its children';
this.group = 'action';
this.priority = 10;
this.cssClass = 'icon-refresh';

this.openmct = openmct;
}
invoke(objectPath, view) {
console.debug('🎨 Reloading');
this.openmct.objectViews.emit('reload');
}
}
28 changes: 28 additions & 0 deletions src/plugins/reloadAction/plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2023, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
* Open MCT is licensed under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
* Open MCT includes source code licensed under additional open source
* licenses. See the Open Source Licenses file (LICENSES.md) included with
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
import ReloadAction from './ReloadAction.js';

export default function plugin() {
return function install(openmct) {
openmct.actions.register(new ReloadAction(openmct));
};
}
6 changes: 6 additions & 0 deletions src/ui/components/ObjectView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ export default {
this.triggerUnsubscribeFromStaleness(this.domainObject);

this.openmct.objectViews.off('clearData', this.clearData);
this.openmct.objectViews.off('reload', this.reload);
if (this.contextActionEvent) {
this.openmct.objectViews.off(this.contextActionEvent, this.performContextAction);
}
Expand Down Expand Up @@ -218,6 +219,10 @@ export default {
this.clear();
this.updateView(true);
},
reload() {
this.clear();
this.updateView(true);
},
triggerStalenessSubscribe(object) {
if (this.openmct.telemetry.isTelemetryObject(object)) {
this.subscribeToStaleness(object);
Expand Down Expand Up @@ -316,6 +321,7 @@ export default {
this.domainObject.identifier
)}`;
this.openmct.objectViews.on('clearData', this.clearData);
this.openmct.objectViews.on('reload', this.reload);
this.openmct.objectViews.on(this.contextActionEvent, this.performContextAction);

this.$nextTick(() => {
Expand Down