Show Table of Contents
C.4. 用户界面插件的实现示例
下面介绍了创建一个用户界面插件的方法。这里所创建的插件所实现的功能是,当用户登录到 Red Hat Virtualization Manager 管理门户后,这个插件会运行一个
Hello World! 程序。
过程 C.2. 实现一个 Hello World! 插件
- 在 Manager 上添加以下的
/usr/share/ovirt-engine/ui-plugins/helloWorld.json文件来创建一个插件描述符:{ "name": "HelloWorld", "url": "/ovirt-engine/webadmin/plugin/HelloWorld/start.html", "resourcePath": "hello-files" } - 在 Manager 上添加以下的
/usr/share/ovirt-engine/ui-plugins/hello-files/start.html文件来创建插件主页:<!DOCTYPE html><html><head> <script> var api = parent.pluginApi('HelloWorld'); api.register({ UiInit: function() { window.alert('Hello world'); } }); api.ready(); </script> </head><body></body></html>
如果您成功地部署了这个
Hello World! 插件,在您登录到管理门户的时候会看到以下显示:

图 C.1. 成功部署的 Hello World! 插件

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.