The user interface configuration is tailored from multiple configuration files in multiple places, but the starting point is config/ui/config.jsThis file will merge the configuration files inside the config/ui/configs folder. Inside the configs folder exist _main.js, which can be consider as the base configuration for the final file.

Example _main.js
module.exports = {
    app: {
        title: 'Enterprise Search',
        description: 'Accenture - Enterprise Search',
        keywords: 'accenture, ui',
        defaultLanguage: 'en', // Use for label translations
        availableLangs: ['en', 'cs', 'es']
    },

    apiServer: {
        // url: 'http://localhost:3000', // To use the ui with a different PENDING
        index: 'default' // default index
    },

    homePage: {
        enabled: true // Enables or disables the search landing page
    },

    /**
     * Server related configuration, only refreshes restarting the server, and it's being copy from the actual server configuration
     * but if you want to reflect a change immediately in UI, you can specify the configuration manually
     */
    chat_forum: __config.chat_forum, // Configuration copied from the server configuration
    analytics: __config.analytics // Configuration copied from the server configuration
}

For each configuration file in the configs folder (except for _main.js), a property will be created using the name of each files as the name of the property and holding the configuration of the same file. For example, if we have a configuration named facets.js, this file's content will be merged to _main.js, where a new property called facets will be created to hold such content.

Selecting The Tabs Configuration

The merging of the configuration tab files inside the tabs folder is a little different, since each tab configuration can be extensive, and adding and removing tabs can be, at some moments common, they are handle separately.

Once all configurations are selected, the process will look for the tabs_control property (with the content of tabs_control.js), which holds a list of the configuration tabs to load, and see which ones are actually going to end up in the final file and add them to the _main.js

Sample tabs_control.js
module.exports = {
    // Name of the file tabs goes here
    tabs: [
        'movies',
        'sources',
        'filesystem',
        'financial',
        'kibana'
        // 'companies',
        // dashboard'
    ]
}

Final Step

With all the configurations loaded and merged, the config.js will return the tailored configuration file, which exist only in memory. Keep in mind this process will be executed every time the configuration is requested, by either through the API or from within the same server.

This configuration can can be access inside the server using the global variable __ui_config (applicable only in server side)




  • No labels