.. index:: settings file, constants.js ================= Frontend settings ================= Besides the :doc:`backend settings `, several frontend configuration options are available to customize your Fleio installation. .. contents:: :local: .. _constants-js: .. _frontend-config: How to edit frontend configuration files ======================================== Frontend configuration files format is JSON. There is one configuration file for each file panel: * ``enduser.config.json`` * ``staff.config.json`` When editing a JSON configuration file, make sure you do not add a comma (``,``) after the last item in a JavaScript dictionary, otherwise it will lead to a syntax error. E.g.: .. code-block:: javascript { "urls": { "backendApiUrl": "//localhost:8000/api/", // comma, since other items follow "homeName": "enduser", "enduserUrl": "/" // last item, no comma }, // more items after this one, so comma is required // .. Edit frontend config files with ``fleio edit`` ---------------------------------------------- To edit these files, you can use the shortcut command ``fleio edit``: .. code-block:: bash fleio edit enduser.config.json # or fleio edit staff.config.json Alternatively, access config files with ``fleio bash`` ------------------------------------------------------ The three JSON files are stored in Docker volumes and can also be accessed with the utility command ``fleio bash`` (which launches a temporary Docker container, just to allow you to edit Docker volume contents). After you run ``fleio bash``, you can access the frontend configuration files in the following paths: * ``/var/webapps/fleio/frontend/enduser/assets/config/enduser.config.json`` * ``/var/webapps/fleio/frontend/staff/assets/config/staff.config.json`` How to see all available frontend settings ========================================== To see all available frontend settings (documented or undocumented), enter the ``frontend`` Docker container and print the content of the following files. .. important:: Do not edit the files mentioned below. These are base configuration files and Docker containers should be :ref:`treated as immutable`. Use the content of these files just for your reference and overwrite properties as described in :ref:`frontend-config`. .. code-block:: bash # launch bash in the frontend container docker exec -it fleio-frontend-1 bash # list all available end-user settings cat /var/webapps/fleio/frontend/enduser/assets/config-base/enduser.config.json # staff settings cat /var/webapps/fleio/frontend/staff/assets/config-base/staff.config.json # press CTRL + D to exit a Docker container .. _top-logo: How to change the top logo ========================== Depending on which panel's logo you want to customize, place the logo files in one of the following paths in the frontend Docker container: .. code-block:: bash /var/webapps/fleio/frontend/staff/assets/img/staff/ /var/webapps/fleio/frontend/enduser/assets/img/enduser/ .. note:: The logo image should be 140 x 70 pixels in size, otherwise the browser resizes the image to this dimension and the logo may get distorted. It's recommended that the logo image has a transparent background. To preserve you changes on upgrades or restarts, you need to :ref:`create a custom Docker image`. The next step is to change the ``logoDark`` and ``logoLight`` in the following files: * ``fleio edit staff.config.json`` * ``fleio edit enduser.config.json`` You will have to replace ``null`` with ``"REPLACE_ME_WITH_THE_CORRECT_FILENAME.png"`` .. _default-language: How to change default language ============================== In order to change the default language for Angular panels, you need to change the ``defaultLanguage`` variable from the :ref:`end-user or staff panels`. In order to replace some strings from english default language, check :ref:`related documentation page`. .. code-block:: javascript { // ... "settings": { // .. "defaultLanguage": "en", } } How to change default theme =========================== In order to change the default theme of a certain panel, be it end-user or staff, you will have to :ref:`edit the configuration file` and change the following line: .. code-block:: javascript { // ... "settings": { // .. "defaultTheme": "spring", } } .. _themes_in_my_profile: Configure which themes show up in my profile ============================================ You can configure the list of themes that shows up when users edit their profile, be it end-user or staff, by :ref:`editing the configuration file` and changing the following line: .. code-block:: javascript { // ... "settings": { // .. "availableThemes": [ "spring", "navy", "dusk", "dark" ], } } Change the page size ==================== Fleio uses infinite scroll to display objects list. By default, 20 objects are loaded at once and you can change this default value for end-user or staff by :ref:`editing the corresponding configuration file`. .. code-block:: javascript { // ... "settings": { // .. "paginateBy": 20 } } Customize page title ==================== In order to customize the page title of a certain panel, be it end-user or staff, you will have to :ref:`edit the configuration file` and add the following line: .. code-block:: javascript { // ... "settings": { // .. "baseTitle": "Fleio", // This is the prefix that is added the HTML of each page } } Customize idle timeout ====================== In order to configure the seconds after user is considered idle and the app stops refreshing content, be it end-user or staff, you will have to :ref:`edit the configuration file<frontend-config>` and change the following line: .. code-block:: javascript { // ... "settings": { // .. "appIdleTimeout": 30, } } Customize search bar minimum characters ======================================= In order to configure the minimum number of characters a user needs to fill in the search bar of the application for objects to be filtered, be it end-user or staff, you will have to :ref:`edit the configuration file<frontend-config>` and change the following line: .. code-block:: javascript { // ... "settings": { // .. "minSearchLength": 3, } } How to invalidate users' dashboard ================================== When users change their dashboard, the new layout is saved in their browser local storage. If you add customizations to it and want users to have the dashboard refreshed with the new changes and invalidate the layout saved in local storage, be it in end-user or staff panel, you can make use of a `dashboardVersion` setting which you can change by :ref:`editing the configuration file<frontend-config>`. When you set a new version (any string), saved layouts are invalidated. .. code-block:: javascript { // ... "settings": { // .. "dashboardVersion": "", } } How to change required credit card message ========================================== If you configure the app to require clients to have a credit card saved from :doc:`client configuration </staff/settings-configurations>` settings, a message is shown in end-user dashboard. In order to override it you have to edit the end-user :ref:`configuration file<frontend-config>` and change the following line: .. code-block:: javascript { // ... "settings": { // .. "requireCardValidationMsg": "<span class=\"fl-red-color\">Payment information is required to use our service.</span>", } } How to add a custom message when user needs to verify instance resize ===================================================================== When users resize instances they need to confirm the resize and a message is shown. To add an extra message besides the one already shown, be it end-user or staff, you will have to :ref:`edit the configuration file<frontend-config>` and change the following line by adding the string you want: .. code-block:: javascript { // ... "settings": { // .. "openstack": { "instances": { "verifyResizeExtraMessage": null, } }, } } How to add a custom message when user shuts down an instance ============================================================ When users stop instances a confirm action dialog is shown. To show a red message on this dialog, be it end-user or staff, you will have to :ref:`edit the configuration file<frontend-config>` and change the following line by adding the string you want: .. code-block:: javascript { // ... "settings": { // .. "openstack": { "instances": { "shutDownInstanceNote": null, } }, } } Instance form / How to change flavors selection display ======================================================= Flavors selection display on instance create form can be changed using the ``flavorsAsCards`` property from :ref:`the config file<frontend-config>`. When set to false, the instance create form will look like this: .. image:: /_static/images/enduser/cloud/instances/create-instance-dropdown.png When the setting is set to true, the flavors will be displayed as cards. Their description will appear in each card's body: .. image:: /_static/images/enduser/cloud/instances/create-instance-flavor-cards.png .. code-block:: javascript { // ... "settings": { // .. "instanceForm": { // .. "flavorsAsCards": false, // .. }, // .. } Instance form / Root password related settings ============================================== By default the **Root password** field is displayed and optional in the create instance form. You can make the field mandatory or hide it with these settings in :ref:`the config file<frontend-config>`: .. code-block:: javascript { // ... "settings": { // .. "instanceForm": { // ... "showRootPasswordField": true, "rootPasswordFieldMandatory": false, // note that the trailing comma must be present ONLY if there is another item after it. // Last item must be without a comma // ... } } } Instance form / Network related settings ======================================== By default, if only one network is available when creating an instance the networks selection is hidden and that network is preselected. You can override this behaviour by changing the ``hideNetworksIfOnlyOneAvailable`` property in one of the :ref:`frontend configuration files<frontend-config>`. Networks having a tag set to "public" are preselected on the instance create form by default. You can override this behaviour by changing the ``preselectPublicNetworks`` property in one of the :ref:`frontend configuration files<frontend-config>`, example: .. code-block:: javascript { // ... "settings": { // .. "instanceForm": { // ... "hideNetworksIfOnlyOneAvailable": true, "preselectPublicNetworks": true, // ... } } } Instance form / Show or hide cloud-init user data ================================================= The **Cloud-init user data** field allows the user to fill in a ``cloud-init`` script when creating a compute instance: .. image:: /_static/images/enduser/cloud/instances/cloud-init-user-data.png By default, this field is displayed, but you can change that by adding/changing the ``showUserData`` property in one of the :ref:`frontend configuration files<frontend-config>`. .. code-block:: javascript { // ... "settings": { // .. "instanceForm": { // ... "showUserData": true, // ... } } } .. _frontend-volume-settings: Instance form / Volume related settings ======================================= If you set ``hideVolumeSelectionForFlavorsWithDisk`` property from :ref:`the config file<frontend-config>` to ``true``, the volume create options on instance create dialog will be hidden when the flavor local disk space is greater than 0. If you want to set a default volume type you will need to add a dictionary for ``defaultVolumeType`` property, as shown in the following example: .. code-block:: javascript { // ... "settings": { // .. "instanceForm": { // .. "hideVolumeSelectionForFlavorsWithDisk": false, "defaultVolumeType":{ 'Region one': 'VOLUME_TYPE1', 'Region two': 'VOLUME_TYPE2' // note that last item in a JavaScript dictionary is not ended with a comma } // last item, no comma }, // .. } } .. _storage-related-options: Storage related options ======================= The following OpenStack principles are applied regarding the storage options: * local storage option does not show if the selected flavor has 0 disk space * local storage option will be displayed if the flavor has more than 0 disk space * if ``hideVolumeSelectionForFlavorsWithDisk`` is enabled, then only the local storage option will be available (the previous condition must be satisfied) .. _hide-volume-options: Hide volume options for flavors with disk size ============================================== Set property ``hideVolumeSelectionForFlavorsWithDisk``. See :ref:`frontend-volume-settings`. Global setting for card or table items display ============================================== By default, most of the list views in Fleio show items as cards, you can make all show as lists/tables by using the ``itemsDisplayAsList`` property in the :ref:`frontend configuration files<frontend-config>`. Note that the user will still be able to change the display mode for a page using the top-right of a page. The ``itemsDisplayAsList`` property only defines the **default** display mode. .. code-block:: javascript { // ... "settings": { // .. "itemsDisplayAsList": false, // only use a comma if there are other items after this one // .. } } Add/remove menu items or categories =================================== See :ref:`add-custom-menu-items`. .. _frontend-add-credit-url: How to set a custom add credit URL ================================== The **Add credit** button from the end-user's dashboard can be customized to any link. You can for instance set an external link, if you are using another system (like WHMCS) to handle invoicing and credit card payments. .. image:: /_static/images/enduser/billing/add-credit-button.png More on that on :ref:`settings.py ADD_CREDIT_URLS setting documentation <backend-add-credit-url>`. The Billing panel that shows client's credit and the **Add credit** button can be hidden completely through an :ref:`end-user feature toggle <enduser-feature-toggle>`. .. _logout-url: How to set custom logout URL ============================ By default your customers will be redirected to the login page when they log out. If you want to set a custom URL you need to set the ``logoutRedirect`` property :ref:`in the config file<frontend-config>`. .. code-block:: javascript { // ... "settings": { // .. "logoutRedirect": null, // null is the default value and it redirects to the standard Login page // .. } } How to change refresh intervals in the app ========================================== Refresh intervals are configured in milliseconds for various places in the app, you can edit them by changing :ref:`the config file<frontend-config>`: .. code-block:: javascript { // ... "settings": { // .. "refreshIntervals": { "defaultInterval": 10000, "defaultIntervalShort": 5000, "defaultIntervalTab": 3000, "clientDetailsInterval": 5000, "operationsListInterval": 1000, "operationDetailsInterval": 1000, "reportDetailsInterval": 1000, "operationsInProgressInterval": 5000, "routerDetailsInterval": 5000, "volumeDetailsBackupsInterval": 2000, "volumeDetailsSnapshotsInterval": 2000 }, // .. } } How to change toast notifications duration ========================================== Sometimes, notifications or errors appear in Fleio in the form of Angular material toasts. You can configure their duration with the ``messageDuration`` and ``messageWithLinkDuration`` (for toasts containing link buttons) properties in :ref:`the config files<frontend-config>` (values in milliseconds): .. code-block:: javascript { // ... "settings": { // .. "messageDuration": 2000, "messageWithLinkDuration": 4000, // .. } } Changing text editor on tickets plugin, etc. ============================================ The rich text editor found on tickets plugin, notification templates edit page, etc. can be customized by adding/editing the ``tinyMCEOptions`` dictionary in the :ref:`JSON config files<frontend-config>`. .. code-block:: javascript { // ... "settings": { // .. // Add the tinyMCEOptions section if it's missing from your file. You don't need to add all properties below, but // only the ones that you want to customize. "tinyMCEOptions": { "base_url": "/tinymce", "height" : "390", "relative_urls": true, "convert_urls": false, "browser_spellcheck": true, "inline": false, "plugins": "link code codesample lists autolink", "toolbar": [ "undo redo | styleselect | bold italic underline strikethrough | alignleft aligncenter alignright alignjustify | link code blockquote codesample | bullist numlist | removeformat" ], "codesample_languages": [ { "text": "Code", "value": "any" } ], "skin": "oxide", "theme": "silver", "menubar": "", "branding": false, "contextmenu": false, "promotion": false // last item in a JSON/JavaScript dictionary must be without a trailing comma }, // .. } } White label =========== If you want to remove the small Fleio link that appears at the bottom of the login screen and at the bottom of the left menu, you have to purchase the white-label option. Changing the :ref:`top logo is a simple setting <top-logo>` and does not require you to pay the white-label fee. Custom favicon ============== See :ref:`frontend customization with Docker below<docker-custom-frontend>`. Adding new custom themes ======================== To define new Angular themes see :doc:`/developer/angular-frontend-customization`. Adding custom headers in requests ================================= See :ref:`customizing-headers`. Add HTML head or body tags ========================== See :ref:`docker-custom-frontend`. Include custom JavaScript/CSS code ================================== See :ref:`docker-custom-frontend`. See :doc:`/developer/angular-frontend-customization`.