Pricing Calculator Widget
Pricing Calculator widget is an interactive tool that estimates the environment cost based on the configured topology. It is based on the standard HTML, js, and CSS technologies supported by all modern browsers, which ensures easy installation on any page. Also, the initialization is performed in the background and does not affect the page loading speed.
Widget addition to your site can be accomplished in a few simple steps:
1. All the required scripts and styles for the pricing calculator widget are stored in the dedicated j-calculator directory. You can get this folder from the appropriate repository. For example, with the following command:
|
|
2. Add the j-calculator folder downloaded in the previous step to your site’s ROOT folder and insert the following lines between the and tags of the required page:
|
|
Don’t forget to correctly substitute your {siteUrl} placeholder.
3. Now, insert the following block at the position the widget should be displayed at:
|
|
IMPORTANT: The data-key parameter allows displaying pricing for your specific platform only. If skipped, a platform selector list will be displayed.
The default ready-to-work pricing calculator widget looks as follows:
If needed, you can adjust the widget by tuning predefined ranges and values, changing localization, or customize the whole widget by adjusting its source code.
Customize Widget Parameters
The widget is provided with multiple out-of-box arguments that allow you to customize resource ranges and the default values (i.e. the state of parameters right after the widget is loaded) up to your needs.
Parameter | Description | Example Value |
---|---|---|
data-languages | A comma-separated string of the programming languages displayed within the widget. | java, php, node, python, go, ruby |
data-key | Define this parameter to show prices for the particular hosting provider only. Otherwise, a platform selector list will be displayed. | app.{hoster_domain} |
data-storage | The default amount of disk space for the environment per hour in GB (in the 0-99999 range). 10 if not specified. | {number} |
data-ip | The default number of external IP addresses for the environment (in the 0-10 range). 1 if not specified. | {number} |
data-traffic | The default amount of external traffic for the environment per hour in GB (in the 0-99999 range). 10 if not specified. | {number} |
data-balancer-nodes | The number of the load balancer nodes enabled by default (in the 0-99 range). 0 if not specified. | {number} |
data-balancer-min | The minimum cloudlets consumption per load balancer. 0 if not specified. | {number} |
data-balancer-max | The maximum cloudlets consumption per load balancer. 128 if not specified. | {number} |
data-balancer-reserved | The default number of fixed (reserved) cloudlets per load balancer. 0 if not specified. | {number} |
data-balancer-scaling | The default number of flexible (dynamic) cloudlets per load balancer. 0 if not specified. | {number} |
data-appserver-nodes | The number of application servers enabled by default (in the 0-99 range). 1 if not specified. | {number} |
data-appserver-min | The minimum cloudlets consumption per application server. 0 if not specified. | {number} |
data-appserver-max | The maximum cloudlets consumption per application server. 128 if not specified. | {number} |
data-appserver-reserved | The default number of fixed (reserved) cloudlets per application server. 1 if not specified. | {number} |
data-appserver-scaling | The default number of flexible (dynamic) cloudlets per application server. 64 if not specified. | {number} |
data-database-nodes | The number of the database nodes enabled by default (in the 0-99 range). 0 if not specified. | {number} |
data-database-min | The minimum cloudlets consumption per database. 0 if not specified. | {number} |
data-database-max | The maximum cloudlets consumption per database. 128 if not specified. | {number} |
data-database-reserved | The default number of fixed (reserved) cloudlets per database. 0 if not specified. | {number} |
data-database-scaling | The default number of flexible (dynamic) cloudlets per database. 0 if not specified. | {number} |
data-period | The default period (hourly/monthly) for the price estimation. Hourly if not specified. | hourly/monthly |
data-currencies | A comma-separated list of the currencies that can be selected in the widget. All currencies are displayed if the parameter is not specified. | USD,EUR,INR |
data-start-currency | A code of the currency that should be displayed by default. USD if not specified. | USD / INR / EUR / etc. |
data-price-separator | A decimal separator for the prices used in the widget. “.” if not specified. | , |
These properties can be provided in the following way:
|
|
Customize Widget Localization
PaaS implementation of the pricing widget is provided with a complete set of the localization parameters to easily adjust any required text up to your particular need. Also, it is possible to change the widget language altogether by replacing all of the settings below:
Parameter | Default Value (English Localization) |
---|---|
data-appserver-tx | App Server |
data-balancer-tx | Balancer |
data-db-tx | Database |
data-disk-tooltip-tx | Amount of disk space consumed per hour. While checking per month price, the calculator considers that you use the stated number of GB every hour during the whole period. The platform will count only consumed resources on hourly basis, so the total price can be lower. |
data-disk-tx | Disk Space<span class=“small”>GB / hour</span> |
data-hourly-tx | Per Hour |
data-ip-tx | Public IP |
data-monthly-tx | Per Month |
data-price-max-descr-tx | if all resources are fully used up to Scaling Limit |
data-price-max-tx | Maximum Price |
data-price-min-tx | Starting Price |
data-reserved-cloudlets-tx | Reserved Cloudlets |
data-reserved-tooltip-tx | Reserve the cloudlets to pay a fixed price. The more you reserve, the bigger the discount is! |
data-reserved-tx | Reserved |
data-scaling-limit-tx | Scaling Limit |
data-scaling-tooltip-tx | Define the maximum amount of resources for automatic vertical scaling based on load changes |
data-total-tx | Total Cloudlets |
data-traffic-tooltip-tx | Amount of external traffic consumed per hour. While checking per month price, the calculator considers that you use the stated number of GB every hour during the whole period. The platform will count only consumed resources on hourly basis, so the total price can be lower. |
data-traffic-tx | External TrafficGB / hour |
|
|
Customize Widget Layout
If needed, the widget can be fully customized to match your particular needs and brand look. The project is built based on the Gulp with SCSS preprocessor, which provides access to the following features:
- CSS auto-prefixing
- built-in preview server with BrowserSync
- compile sass with libsass
- lint and minify scripts
- image optimization
In order to perform customization to the project, you’ll need a Node.js server of 6 or higher version.
1. Install the Gulp utility with the following command:
|
|
2. Next, clone the widget repository.
|
|
3. Move inside the project folder and install dependencies.
|
|
4. Start a server with gulp to preview changes.
|
|
5. You can change CSS in the assets/scss/*.scss file. For example, the default variables:
|
|
6. Once you are satisfied with the results, build the production environments.
|
|
In a moment, you will have the following files in the j-calculator folder:
- index.html - example with widget initialization selector
- j-calculator.min.js - minified JavaScript
- j-calculator.min.css - minified CSS
Use these files instead of the default ones during the widget addition to your website page.
7. Additionally, for the best performance, some images are saved in the SVG format, optimized with the svgomg service and included in CSS/SCSS with the BASE64 technology via base64encode.org. Non-converted images can be located in the assets/img/ folder.
Now, you have all the required information to customize (if needed) and integrate the Pricing Calculator widget to your website.