Bug 1570077

Summary: [RFE] Add UI plugin API function to allow tab/place resource cleanup
Product: [oVirt] ovirt-engine Reporter: Vojtech Szocs <vszocs>
Component: Frontend.WebAdminAssignee: Vojtech Szocs <vszocs>
Status: CLOSED CURRENTRELEASE QA Contact: Pavel Novotny <pnovotny>
Severity: low Docs Contact:
Priority: low    
Version: futureCC: apinnick, bugs, gshereme, lsvaty, tjelinek
Target Milestone: ovirt-4.3.0Keywords: FutureFeature
Target Release: 4.3.0Flags: rule-engine: ovirt-4.3?
rule-engine: planning_ack?
rule-engine: devel_ack+
lsvaty: testing_ack+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: ovirt-engine-4.3.0_alpha Doc Type: Enhancement
Doc Text:
The current release of the User Interface Plugin API provides an "unload" handler that can be attached to a primary/secondary menu item or a details tab to perform clean-up when the user navigates away from these interface elements.
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-03-26 07:17:48 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: UX RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Test UI plugin none

Description Vojtech Szocs 2018-04-20 15:16:07 UTC
UI plugins should be able to register tab/place unload handler in order to cleanup associated resources when the user navigates away from the given tab/place.

For example:

---

api.register({
  UiInit () {
    api.addPrimaryMenuPlace('Test', 'test-tab', 'plugin/test-plugin/tab.html');
  }
});

api.setPlaceUnloadHandler('test-tab', function () {
  // plugin specific cleanup code
});

api.ready();

---

To verify above example:

1, navigate to given plugin-contributed place, e.g. 'Test'
2, navigate to any other place, e.g. 'Events'
3, unload handler code should execute

Comment 1 Vojtech Szocs 2018-05-16 15:34:36 UTC
Verification with test UI plugin didn't pass for all API functions, moving to POST and going to fix the problem.

Comment 2 Vojtech Szocs 2018-05-16 16:37:00 UTC
Created attachment 1437475 [details]
Test UI plugin

Comment 3 Vojtech Szocs 2018-05-16 16:46:21 UTC
Attached test UI plugin to ease BZ verification.

Please check plugin code in test-resources/start.html and adapt if necessary.

To verify, for all application places contributed by the test UI plugin:

1, nav menu -> Test Primary Place (#test1)
2, nav menu -> Test Container -> Test Secondary Place (#test2)
3, nav menu -> Compute -> Virtual Machines (#vms) -> [click on VM name] -> Test Detail Tab (#test3)

check that going away from that place to somewhere else (e.g. Events) will emit following console logs:

  Calling unload handler for place test1
  Calling unload handler for place test2
  Calling unload handler for place test3

Comment 4 Pavel Novotny 2019-03-25 16:07:19 UTC
Verified in
ovirt-engine-4.3.2.1-0.1.el7.noarch
ovirt-engine-webadmin-portal-4.3.2.1-0.1.el7.noarch

Verified with provided test plugin in attachment 1437475 [details]

Followed steps in comment 3, the browser console showed:

Calling unload handler for place test1
Calling unload handler for place test2
Calling unload handler for place test3

Comment 5 Sandro Bonazzola 2019-03-26 07:17:48 UTC
This bugzilla is included in oVirt 4.3.0 release, published on February 4th 2019.

Since the problem described in this bug report should be
resolved in oVirt 4.3.0 release, it has been closed with a resolution of CURRENT RELEASE.

If the solution does not work for you, please open a new bug report.