On Fri, Apr 15, 2016 at 11:23 AM, Vojtech Szocs <vszocs(a)redhat.com> wrote:
Hi Martin,
(adding Greg and Alex in case they have any thoughts)
if you build your UI plugin in a way that requires CSS styles,
JS libraries etc. at runtime (dynamic linking), you can utilize
oVirt branding servlet [a] to serve branding-related resources.
[a] org.ovirt.engine.core.branding.BrandingServlet
By default, oVirt Engine ships with single branding package:
$ ls /etc/ovirt-engine/branding/
00-ovirt.brand
That `00-ovirt.brand` directory symlinks to:
/usr/share/ovirt-engine/branding/ovirt.brand
containing all branding-related resources.
To fetch them, use the following URL:
http://example.com/ovirt-engine/webadmin/theme/<path_to_file>
where <path_to_file> is relative to `ovirt.brand` directory.
In your UI plugin, you can use the newly introduced API to
construct this URL more easily [b]:
var url = api.engineBaseUrl() + 'webadmin/theme/' + pathToFile
[b]
https://gerrit.ovirt.org/#/c/55694/
WebAdmin UI itself loads following CSS styles (in this order):
- web_admin.css
- common.css
- gwt_common.css
- patternfly/css/styles.min.css
- patternfly-ovirt.css
- ovirt-patternfly-compat.css
- ovirt.css
For starters, you can load PatternFly-specific CSS only.
As for JS libraries, these are typically provided through
PatternFly RPM, to which `patternfly` directory symlinks.
For starters, you can use stuff under `patternfly/js` and
`patternfly/components` (these are PF's own dependencies).
oVirt ships its own version of jQuery (v1.11) + Bootstrap
(v3.3.6) -- please don't use them!! If you're wondering
why we use custom jQuery and Bootstrap, see here:
https://gerrit.ovirt.org/#/c/41228/
https://gerrit.ovirt.org/#/c/55546/
(@Greg, any plans for upgrading to PF-provided jQuery?)
No plans to switch to the libraries that PatternFly provides -- and I'm not
all that sure we should. We got burned by it, so we moved away from it
intentionally in [
https://gerrit.ovirt.org/#/c/41228/]. Probably best to
chat about that in another thread.
Greg
Regards,
Vojtech
----- Original Message -----
> From: "Martin Sivak" <msivak(a)redhat.com>
> To: "engine-devel(a)ovirt.org" <devel(a)ovirt.org>
> Cc: "Moran Goldboim" <mgoldboi(a)redhat.com>, "Vojtech
Szocs" <
vszocs(a)redhat.com>, "Oved Ourfali" <oourfali(a)redhat.com>
> Sent: Wednesday, April 13, 2016 5:30:49 PM
> Subject: UI plugins - access to engine styles and libraries
>
> Hi everybody,
>
> there is one piece I always missed when developing my optimizer plugin
> and that is the access to the engine css styles.
>
> I feel it might be pretty easy and good for both bandwidth and
> branding to expose them using some "well known" url from the engine.
> All plugins would be then able to (re-)use the same styling
> information and basic javascript libraries (jQuery, angular, whatever
> you decide the core engine will use).
>
> So far, each UI plugin has to link to its own version of libraries and
> define (and maintain) custom color theme.
>
> Do you think this would be doable for 4.0?
>
> Best regards
>
> --
> Martin Sivak
> SLA / oVirt
>
--
Greg Sheremeta, MBA
Red Hat, Inc.
Sr. Software Engineer
gshereme(a)redhat.com
919-741-4016