YaST/Web/VendorCustomization

From openSUSE

< YaST | Web

Contents

Vendor customization

As it is targeted to custom appliances, WebYast can be customized for your own needs during appliance creaton.

Misc. Options

These options can be set in the optional /etc/YaST2/vendor.yml file.

# Custom url that will be displayed on crashes.
bug_url: http://www.mycompany.com/report_bug
# Important packages of your appliance, those versions are displayed
# in the status information
packages:
  - mydb-server
  - mydb-console
# Important services of your appliances, those may be
# remarked or hightlighted
services:
  - mydb-daemon
  - syslog
# Your appliance eula
eula:
  This is an evil eula that will
  make you think twice before
  clicking it

Custom Services

To provide important service of your appliance, edit /etc/webyast/custom_services.yml file. Service(s) added here will be available in client under Custom Services module.

# service name:
#       description: Enhanced description of the service
#       start: path to application that should start the service
#       stop: path to application that should stop the service
#       status: path to application that should query the service status
#
#
# The file needs to be located under /etc/webyast/. The file should be root only
# writable, because start, stop and status scripts defined here are called by root.
#
# ------------------------------------------------------------------------------
#
# The list of services that could be operated by webYaST services module.
# It is required to provide commands to start, stop and read the service status.
# Providing service description is optional.

collectd:
  description: Statistics Collection Daemon for filling RRD Files
  start: "/usr/sbin/rccollectd start"
  stop: "/usr/sbin/rccollectd stop"
  status: "/usr/sbin/rccollectd status"

/etc/webyast/custom_services.yml must be located on target machine, that is being configured.

Client customization

On webclient part, it is possible to provide unique name and icon for Custom Services module, by editing shortcuts.yml that comes with yast2-webclient-custom-services package.

Layout and Theming

This part describes ways how the layout of WebYaST like text, stylesheet, images, icons,... can be changed or added.

Overriding existing images,icons and stylesheets

Images, icons, stylesheets are stored in the public directory of the YaST-Webclient. The public directory contains and additional subdirectory vendor which is used for overwriting,exchaninging images, stylesheets,.... for special vendors. Each file in the public directory can be exchanged by putting a file with the same path into the vendor.

For example changing the WebYaST logo which is stored in:

---public
     |
     +---images
            |
            +---webyast-logo.png

the corresponding file has be created in:

---public
     |
     +---images
     |      |
     |      +---webyast-logo.png
     |
     +---vendor
            |
            +---images
                   |
                   +---webyast-logo.png

Please take care that all links in the views have to be defined by the AssetTagHelper like image_tag, stylesheet_link_tag, javascript_include_tag, ...

e.g.

   <%= link_to(image_tag("/images/webyast-logo.png", :alt =>"webyast" ),"/")  %>

instead of

   <a href="/"><img src="/images/webyast-logo.png" alt="webyast" /></a>


Add new images, icons, stylesheets,.... for Plugins

Icons, images,... are normally stored in the public directory of the webserver. In order to avoid flooding this directory each plugin can define his own public directory in:

  vendor/plugins/<plugin-name>/public

The webserver has a look into this directory if the requested file is not in the official public directory. So only new files will be regarded in the vendor/plugins/<plugin-name>/public directory.

In order to exchange existing files use the mechanism described above.

Changing Text strings

WebYaST uses gettext in order to provide translations for each text in the UI. These translations are located in the po directory split in so called textdomains. While running a WebYaST module different textdomains will be loaded. e.g. the status module loads (logfile output):

Loading standard textdomain: yast_webclient
Loading standard textdomain: yast_webclient_status

The concerning translations ( so called po-files) are located in

  • po/<language>/yast_webclient.po
  • vendor/plugins/status/po/<language>/yast_webclient_status.po

These po-files have to be translated into so called mo-files by the call rake makemo. The generated files are located in:

  • locale/<language>/LC_MESSAGES/yast_webclient.po
  • vendor/plugins/language/locale/<language>/LC_MESSAGES/yast_webclient_status.mo

This mechanism can also be used for changing text completely. Please regard when changing the text you have to provide translations by your own :-).

This is an example how to change the textdomain yast_webclient:

  • Copy po/<language>/yast_webclient.po to public/vendor/text/po/<language>/yast_webclient.po
  • Change the text in public/vendor/text/po/<language>/yast_webclient.po
  • Call rake makemo in public/vendor/text. The text will be translated into mo-files.

After restarting the webserver following entries are generated in the logfile:

Loading textdomain yast_webclient from public/vendor/text/locale
Loading standard textdomain yast_webclient_status

Link to Application-Specific Web UI

This section describes how to link out to a vendor's own Web UI by defining an own plugin which contains a link to the vendors's Web UI:

.../vendor/plugins/novell
                     |
                     |--- init.rb            
                     |--- shortcuts.yml
                     +--- public
                             |
                             +--- icons
                                    |
                                    +--- novell.png

init.rb

The file contains almost "nothing" but is needed to show that it is a plugin:

# Include hook code here

shortcuts.yml

This file describes the layout like label, group, icon,....

main:
  icon: '/icons/novell.png'
  url: http://www.novell.com
  groups: [ Novell ]
  tags: [ novell ]
  title: Novell Homepage
  description: Novell Homepage
  resources: [ novell ]

novell.png

Icon which will be shown.

Result

The result with the concerning link will be shown in the control panel:

Image:Vendor.png

OK, the Novell icon should be little bit smaller. :-)