Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
= RailsAdminCharts
In your Gemfile
, add the following dependency:
gem 'rails_admin_charts'
Run:
$ bundle install
This will include the lazy_high_charts gem and add the assets to the pipeline. NB: remember to recompile assets if adding this to staging or production environments.
In your RailsAdmin initializer (app/config/initializers/rails_admin.rb
), enable the action by adding:
config.actions do
all # NB: comment out this line for RailsAdmin < 0.6.0
charts
end
For any model where you wish to display a chart (defaults to a cumulative total showing the last 100 days), add the following just under the class declaration:
include RailsAdminCharts
This adds the methods delta_records_since
and total_records_since
to your model, alongside graph_data
which utilises them.
The data displayed in the chart can be altered by overriding the class method graph_data
in your model, for example in the case of a User model using single table inheritance:
def self.graph_data since=30.days.ago
[
{
name: 'Admin Users',
pointInterval: point_interval = 1.day * 1000,
pointStart: start_point = since.to_i * 1000,
data: self.where(type: 'Admin').delta_records_since(since)
},
{
name: 'Standard Users',
pointInterval: point_interval,
pointStart: start_point,
data: self.where(type: nil).delta_records_since(since)
}
]
end
You can set custom categories by overriding the method xaxis
def self.xaxis
['cat a', 'cat b', 'cat c' 'cat d', 'cat e', 'cat f', 'cat g', 'cat h']
end
You can set label rotation by overriding the method label_rotation
It expects a string -45
or -90
def self.label_rotation
"-45"
end
This project uses MIT-LICENSE.
FAQs
Unknown package
We found that rails_admin_charts 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.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.