
Security News
Astral Launches pyx: A Python-Native Package Registry
Astral unveils pyx, a Python-native package registry in beta, designed to speed installs, enhance security, and integrate deeply with uv.
DashCreator is a client-side dashboard creator gem. It can be used with any database to create filters, charts and dashboards of your own with a graphical interface.
Add this line to your application's Gemfile:
gem 'dash_creator'
And then execute:
$ bundle
Or install it yourself as:
$ gem install dash_creator
Then run the generator:
$ rails g dash_creator:install
It will add to your project:
In the added initializer, by default Redis is used. If you don't use Redis, then go in the initializer and change:
$redis = Redis::Namespace.new("app_chart_cache", :redis => Redis.new)
config.redis_store_variable = $redis
To:
config.redis_store_variable = nil
Then you can migrate:
$ rails db:migrate
In config/initializers you will find a dash_creator.rb file after having run the generator. In this initializer you can define several options used by the gem:
For example, we have in Contact model:
belongs_to :owner, class_name: 'User', foreign_key: 'owned_by'
Then we should provide in the initializer:
config.attributes_aliases = {
owned_by: 'user_id'
}
config.columns_aliases = {
owner_id: 'owned_by'
}
One must also add the following functions:
If you use pgcrypto extension (PostgreSQL) in your DB to encrypt the ids, it will be used by default for DashCreator tables, except if you set it to false in initializer.
For the moment the following types are handled:
You can define your own layout for DashCreator in initializer. If your layout includes links, you may have to change them from 'blabla_path' to 'main_app.blabla_path'. Don't forget to also include the following lines in the head of your layout for DashCreator to work properly:
<%= stylesheet_link_tag 'dash_creator/application', media: 'all', 'data-turbolinks-track': 'reload' %>
<%= javascript_include_tag 'dash_creator/application', 'data-turbolinks-track': 'reload' %>
DashCreator is made of three components:
In each creator, you can get, save, modify and delete the objects you have created.
The usual flow would be to:
Now that you have built your own dashboards, you can access them in a controller. For example:
user = current_user
@dashboards = DashCreator::Dashboard.where(user_id: user.id)
A default engine route is provided to render your dashboards in a full page, using the engine layout. However you may want to customize the display of your dashboard.
If you want to have a full page for each of your dashboards, then you may want to do something like the following. In your routes.rb file:
get '/dashboard/:dashboard_id', to: 'user#dashboard'
And in your user controller:
def dashboard
user = current_user
@dashboard = DashCreator::Dashboard.where(user_id: user.id).find(params[:dashboard_id])
end
Running the generator added two files to your app/views/user folder, to help you display your dashboards:
It also added a new dash_creator/dashboard_object folder to your views, in which you can provide the partials for your self-defined dashboard items, and containing a template partial for rendering charts.
DashCreator natively only includes charts as dashboard objects. If you want to add more widgets to your dashboards, you can create your own, either by:
The DashCreator::DashboardObject model attributes are:
Don't plot charts using filters with a defined number of records. Result will be wrong and not limited to the wanted number.
Fix partial templates copying with generator
Customize everything on your chart:
The gem is available as open source under the terms of the MIT License.
FAQs
Unknown package
We found that dash_creator demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Astral unveils pyx, a Python-native package registry in beta, designed to speed installs, enhance security, and integrate deeply with uv.
Security News
The Latio podcast explores how static and runtime reachability help teams prioritize exploitable vulnerabilities and streamline AppSec workflows.
Security News
The latest Opengrep releases add Apex scanning, precision rule tuning, and performance gains for open source static code analysis.