Coder Social home page Coder Social logo

talpor / django-dashing Goto Github PK

View Code? Open in Web Editor NEW
727.0 727.0 107.0 1.09 MB

django-dashing is a customisable, modular dashboard application framework for Django to visualize interesting data about your project. Inspired in the dashboard framework Dashing

License: BSD 3-Clause "New" or "Revised" License

Python 1.46% CSS 1.17% JavaScript 96.71% HTML 0.66%
dashboard django

django-dashing's People

Contributors

agent-jacob avatar asampat3090 avatar atmaniak avatar benwebber avatar erfaan avatar felipearreaza avatar geelweb avatar gobelinus avatar hockeybuggy avatar itsn0ll avatar jangeador avatar jarekwg avatar josemariaruiz avatar mcomisso avatar mtdb avatar mverteuil avatar nickburlett avatar noirbee avatar nschlemm avatar rafaellehmkuhl avatar rvernica avatar timgates42 avatar torstenfeld avatar verosk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

django-dashing's Issues

Can't get rv-on-click to work in a custom widget

Hi,

I'm having A LOT of difficulties when trying to add "rv-on-click" to my custom widget.

basically I took the list widget and created my own custom widget with the ability to change the color of the value field. This is how my customlist.js looks:

Dashing.widgets.CustomList = function (dashboard) {
    var self = this;
    self.__init__ = Dashing.utils.widgetInit(dashboard, 'customlist');
    self.row = 2;
    self.col = 1;
    self.scope = {};
    self.getWidget = function () {
        return this.__widget__;
    };
    self.getData = function () {};
    self.interval = 10000;
};

rivets.binders['value-color'] = function(el, value) {
        if (value == "Down") {
                $(el).css('color', 'orange');
        }
        else if (value == "OK") {
                $(el).css('color', 'green');
        }
        else if (value == "Error" || value == "FAILED") {
                $(el).css('color', 'red');
        }
};

Now i'm trying to add the following code to the same file ("testbind" is the ID of the customlist div):

var controller = {
        popup: function(el) {
                alert('test');
        }
};

rivets.bind($('#testbind'), {
        controller: controller
});

I've tried like a million different variations, went over every example I could find online, but this doesnt seem to work, i keep getting this "this.call is not a function" error.

What am i missing?

Thanks.

example / demo

can you provide an example, how to use the py-widgets and json?

Embedding links into Dashboard?

This isn't really an issue, but rather a question. I would like to add links inside a widget, but seems I can't do that. I'm guessing the Widgets are readonly...

I see I can add links on the html page for the dashboard, but is there a way I can do this with a widget?

Like the list widget, put in a clickable link?

(I tried adding href to a key,value in data, but no joy.

Fields with rf-if are not updated

Fields marked with rf-if are only updated once, when the data becomes available, and then they are not updated again.

For example, in knob.html, updated-at is as follows:

<p class="updated-at" rv-if="updatedAt">{ updatedAt }</p>

If updatedAt is not set when the widget is loading, setting it later will refresh the widget and show this time. However, if updatedAt is changed again (which happens all the time on a dashboard), the widget still shows the original value.

I've been able to fix this by removing rv-if from all html files. Rivets will then refresh as expected, and appears to handle undefined and any other "false" value appropriately:

<p class="updated-at">{ updatedAt }</p>

issues with xFormat and yFormat

xFormat and yFormat seem to have no effect on a graph widget.

in my widgets.py I have:
class MyGraph(GraphWidget):
title = 'My Graph'
def get_data(self):
return [{'x': x, 'y': x} for x in range(5)]

then in dashing-config.js:

employers.addWidget('MyGraph', 'Graph', {
color: 'black',
scope: {
xFormat(n) {
return '(' + n + ')';
},
yFormat(n) {
return '(' + n + ')';
},
},
getData: function () {
var self = this;
Dashing.utils.get('myGraph', function(data) {
$.extend(self.scope, data, {
title: 'Test Graph!',
properties: {
renderer: 'bar',
padding: {
top: 0.1,
right: 0.1
}
},
});
});
},
interval: 2000
});

graph chart not displayed correctly when not on first dashboard set

I'm using the rickshaw chart within the graph widget. When I use it on the first dashboard in a multi-dashboardset scenario, everything is fine. But when the widget is part in one of the other dashboard sets, the chart is cut off:

2015-02-25_07-49-24

I'd create a pull request, but I have to admit, that I do not find the problem. :(

Question Developing New Widget Locally

I am a little confused on how to set up my directory when I am trying to develop and test a widget locally. Based on the documentation I have my directory like this in my project:

project/
-----static/
----------dashing-config.js
----------widgets/
---------------custom_widget.js
---------------custom_widget.css
---------------custom_widget/
-------------------- custom_widget.html

When I do this and add my custom widget to my INSTALLED_WIDGETS option in my settings.py, I receive a "custom_widget does not exist" error in my web console.

load staticfiles missing in documentation for dashboard.html

I stumble across this as I tried to add a custom script for a new widget:

When adding

{% block 'scripts' %}
    <script type="text/javascript" src="{% static 'my/custom/script.js' %}"></script>
{% endblock %}

to dashing/dashboard.html and calling the web page, I get the following error as {% load staticfiles %} is missing:

TemplateSyntaxError at /dashboard/
Invalid block tag: 'static', expected 'endblock'

If it's ok for you, I'd submit a pull request for this.

Widget Template Registry

It's not easy to use third-party or proprietary widgets from multiple sources right now. I suggest using a registry using settings.py as this feels like configuration.

dashboard.html can then consult this registry and use that for the list of html templates to include, perhaps in the form of a templatetag or something.

If application support saving selection

I would like to point that, Just used this application and found one issue that when I re-organize widgets, there is no visible option to save new organization of widgets. and when I reload page, all widgets are organized to default value.

If I am doing something wrong?
If this feature is missing?
If Missing:
If there is any hook available to implement it?
If it's planned in future?

Suggestion : Use websockets

Hi!
Sending repeatedly AJAX request is not a best practice.
That's why They introduced Websockets.
It's not easy to migrate everything now but think about it.

Integration with Django admin

This is not really an issue but a doubt that I had.I have a need to display the statistics of my model within the django admin site.My simple model is as follows:

class Lecture(models.Model):
    Speaker = model.CharField(max_length=100)
    Topic = models.CharField(max_length=100)
    Choices = ((1,"Upcoming"),(2,"In Progress",),(3,"Completed"))
    Status = models.SmallIntegerField(choices=Choices, default=1, max_length=1)

So for example,If i wanted a count of all lectures in completed state,what would I need to do to see a widget within django admin which self updates itself ??

Permission do not work on Widgets

Currently permission can only be set for dashboard but not widgets. Ideally speaking those permission should also be set for widgets urls.

Repository Custom Widgets

Hi,

I am having trouble adding a custom widget to my dashboard because my webserver does not have access to the internet. I have downloaded the django dashing weather widget, placed the files in the static/widgets/weather folder, added the 'weather' widget to the 'INSTALLED_WIDGETS' config. Then I added the widget to my dashing-config.js file.

When I load the page in my browser I get an internal server error and error in the log file (shown below). How can I configure django-dashing to either not try to connect to an external webpage or use a local repository instead?

[2016-Nov-28 21:50:28] ERROR [django.request:124] Internal Server Error: /dashboard/
Traceback (most recent call last):
  File "d:\localapp\anaconda3\lib\urllib\request.py", line 1254, in do_open
    h.request(req.get_method(), req.selector, req.data, headers)
  File "d:\localapp\anaconda3\lib\http\client.py", line 1106, in request
    self._send_request(method, url, body, headers)
  File "d:\localapp\anaconda3\lib\http\client.py", line 1151, in _send_request
    self.endheaders(body)
  File "d:\localapp\anaconda3\lib\http\client.py", line 1102, in endheaders
    self._send_output(message_body)
  File "d:\localapp\anaconda3\lib\http\client.py", line 934, in _send_output
    self.send(msg)
  File "d:\localapp\anaconda3\lib\http\client.py", line 877, in send
    self.connect()
  File "d:\localapp\anaconda3\lib\http\client.py", line 1252, in connect
    super().connect()
  File "d:\localapp\anaconda3\lib\http\client.py", line 849, in connect
    (self.host,self.port), self.timeout, self.source_address)
  File "d:\localapp\anaconda3\lib\socket.py", line 693, in create_connection
    for res in getaddrinfo(host, port, 0, SOCK_STREAM):
  File "d:\localapp\anaconda3\lib\socket.py", line 732, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno 11001] getaddrinfo failed

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "d:\localapp\anaconda3\lib\site-packages\django\core\handlers\exception.py", line 39, in inner
    response = get_response(request)
  File "d:\localapp\anaconda3\lib\site-packages\django\core\handlers\base.py", line 249, in _legacy_get_response
    response = self._get_response(request)
  File "d:\localapp\anaconda3\lib\site-packages\django\core\handlers\base.py", line 217, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "d:\localapp\anaconda3\lib\site-packages\django\core\handlers\base.py", line 215, in _get_response
    response = response.render()
  File "d:\localapp\anaconda3\lib\site-packages\django\template\response.py", line 109, in render
    self.content = self.rendered_content
  File "d:\localapp\anaconda3\lib\site-packages\django\template\response.py", line 86, in rendered_content
    content = template.render(context, self._request)
  File "d:\localapp\anaconda3\lib\site-packages\django\template\backends\django.py", line 66, in render
    return self.template.render(context)
  File "d:\localapp\anaconda3\lib\site-packages\django\template\base.py", line 208, in render
    return self._render(context)
  File "d:\localapp\anaconda3\lib\site-packages\django\template\base.py", line 199, in _render
    return self.nodelist.render(context)
  File "d:\localapp\anaconda3\lib\site-packages\django\template\base.py", line 994, in render
    bit = node.render_annotated(context)
  File "d:\localapp\anaconda3\lib\site-packages\django\template\base.py", line 961, in render_annotated
    return self.render(context)
  File "d:\localapp\anaconda3\lib\site-packages\django\template\loader_tags.py", line 174, in render
    return compiled_parent._render(context)
  File "d:\localapp\anaconda3\lib\site-packages\django\template\base.py", line 199, in _render
    return self.nodelist.render(context)
  File "d:\localapp\anaconda3\lib\site-packages\django\template\base.py", line 994, in render
    bit = node.render_annotated(context)
  File "d:\localapp\anaconda3\lib\site-packages\django\template\base.py", line 961, in render_annotated
    return self.render(context)
  File "d:\localapp\anaconda3\lib\site-packages\django\template\library.py", line 203, in render
    output = self.func(*resolved_args, **resolved_kwargs)
  File "d:\localapp\anaconda3\lib\site-packages\dashing\templatetags\dashing_tags.py", line 66, in widget_styles
    return load('<link rel="stylesheet" href="{}">\n', 'css')
  File "d:\localapp\anaconda3\lib\site-packages\dashing\templatetags\dashing_tags.py", line 57, in load
    path = remote_path(name)
  File "d:\localapp\anaconda3\lib\site-packages\dashing\templatetags\dashing_tags.py", line 31, in remote_path
    resource = json.load(reader(urllib2.urlopen(dashing_settings.REPOSITORY)))
  File "d:\localapp\anaconda3\lib\urllib\request.py", line 163, in urlopen
    return opener.open(url, data, timeout)
  File "d:\localapp\anaconda3\lib\urllib\request.py", line 466, in open
    response = self._open(req, data)
  File "d:\localapp\anaconda3\lib\urllib\request.py", line 484, in _open
    '_open', req)
  File "d:\localapp\anaconda3\lib\urllib\request.py", line 444, in _call_chain
    result = func(*args)
  File "d:\localapp\anaconda3\lib\urllib\request.py", line 1297, in https_open
    context=self._context, check_hostname=self._check_hostname)
  File "d:\localapp\anaconda3\lib\urllib\request.py", line 1256, in do_open
    raise URLError(err)
urllib.error.URLError: <urlopen error [Errno 11001] getaddrinfo failed>

DashboardSet - Dashboard disappears after half a second

Hi,

I am having trouble setting up a DashboardSet. I am not sure how what to use as the name when adding dashboards to the DashboardSet. When I load the page in my browser, the widgets from the site dashboard will display for half a second and then disappear. If I hit the Ctrl key and click on a dashboard it does not display the dashboard. I am not very familiar with javascript, so apologies if I have made an obvious error.

var site = new Dashboard('{"name":"site"}');
var test = new Dashboard('{"name":"test"}');

var myDashboardSet = new DashboardSet();

site.addWidget('convergence_widget', 'Graph', {
    getData: function () {
        $.extend(this.scope, {
            title: 'Test Graph',
            value: Math.floor(Math.random() * 50) + 40,
            more_info: '',
            data: [
                    { x: 0, y: Math.floor(Math.random() * 50) + 40 },
                    { x: 1, y: Math.floor(Math.random() * 50) + 40 },
                    { x: 2, y: Math.floor(Math.random() * 50) + 40 },
                    { x: 3, y: Math.floor(Math.random() * 50) + 40 },
                    { x: 4, y: Math.floor(Math.random() * 50) + 40 }
                ]
            });
    }
});

test.addWidget('clock_widget', 'Clock');

myDashboardSet.addDashboard('site');
myDashboardSet.addDashboard('test');

myDashboardSet.addAction('Link 1', function() {
    window.location.href = 'http://sitelink1/';
});
myDashboardSet.addAction('Link 2', function() {
    window.location.href = 'http://sitelink2/';
});

Integrating with mongodb

Hi

I wonder how to configure dashing in a 'mongoengine.django.mongo_auth' environment.
Does it work with this kind of environment ?

Thanks for your help.

Different coloured lists

Is it possible to create different coloured widgets without having to create a new custom widget each time?
Another way of wording this might be, is it possible to edit the style/class of a widget when you're adding it to a dashboard. Similar to the color option, but that only impacts the background, not the div holding the data displayed on top of it.

Compatibility with Django 3

I tried to use django-dashing but realized it's not updated to work with Django 3. I did try to update django-dashing to Django 3, but noted there are more than a handful of modifications to be had:

It appears Django 3 introduces some breaking changes to django-dashing, such as removal of django.utils.six (used in dashing/settings.py), rename of settings.MIDDLEWARE_CLASSES to settings.MIDDLEWARE (used in test/test_app/test_app/settings.py). It appears some of the middlewares used in the test app do not appear to exist with the same name anymore.

Additionally it appears Python 2.7 support was dropped from Django from 1.1 1.11 onwards.

Is there interest in supporting Django 3? Is django-dashing still supporting Python 2? Thanks in advance.

Conditional background color

I'm stuck on something which is maybe trivial... have checked the documentation, source code, and the various examples but no luck.

How can I show a different background color with the Number widget?

Would like to show Green if a number = zero, and Red if number > 0.

Thanks for the cool dashboard by the way :-)

403 Forbidden

Hi,

Following the documentation, I have added the IsAuthenticated permission to the configuration. How do I set the redirect to login setting so that an unauthenticated user is redirected to my site's login page?

# settings for django-dashing dashboard
DASHING = {
    'INSTALLED_WIDGETS': ('number', 'list', 'graph', 'clock', 'knob', ),
    'PERMISSION_CLASSES':  (
        'dashing.permissions.IsAuthenticated',
    )
}

Error Adding a map widget

Here is the JS for the map widget
dashboard.addWidget('map_widget', 'Map', { getData: function () { var self = this; $.extend(self.scope, { map: { zoom: 8, doubleClickZoom: true, defaultUI: true, center: { lat: 10, lng: 10, }, markers: [ { lat: 10, lng: 10, }, { lat: 11, lng: 11, } ] } }); }, interval: 6000000 });

It throws an error:
Type not recognized: preloadjs-0.6.1.combined.js:2195:10

How to get data to widget?

WARINING: I'm fairly new to Django, but I have created a couple other projects. I'm a complete newb when it comes to js.

I can not, for the life of me, get my data to a widget. I've created a widgets.py file. Performed the operations to get the data. I can do print statements and see the correct values. It took me a while to wrap my head around what django-dashing is doing. I think I have it figured out, but I still can't get my custom data to show up on a widget. In fact, the two widgets I've created are blank.

I decided to do some testing and I can't get any data to show on the widgets I've created.

~ view.py


from django.shortcuts import render
from django.template import loader

from django.http import HttpResponse

from models import AccountDim


class CanvasData(Dashboard):
    template_name = 'canvas_dashboard.html'

~ dashing-config.js


myDashboard.addWidget('customWidget', 'Number', {
    getData: function () {
        var self = this;
        Dashing.utils.get('custom_widget', function(data) {
            $.extend(self.scope, data);
        });
    },
    interval: 0
});

myDashboard.addWidget('accountWidget', 'Number', {
    getData: function () {
        var self = this;
        Dashing.utils.get('account_widget', function(data) {
            $.extend(self.scope, data);
        });
    },
    interval: 0
});

In urls.py, I can uncomment #url(r'', include(router.urls)), but my dashboard won't show up, only the default will show.

~ urls.py

from dashing.utils import router

from widgets import NewClientsWidget, AccountWidget
from views import CanvasData
from. import views

router.register(NewClientsWidget, 'custom_widget')
router.register(AccountWidget, 'account_widget')


urlpatterns = [
    url(r'', CanvasData.as_view()),
    #url(r'', views.canvas_dashboard)
    #url(r'', include(router.urls)),
]

~ widgets.py

from dashing.widgets import NumberWidget
from random import randint

from models import AccountDim

users = randint(50, 100)
#AccountDim.objects.count()


class NewClientsWidget(NumberWidget):
    title = 'New Users'

    def get_value(self):
        return '{}'.format(users)

    def get_detail(self):
        global users
        return '{} actives'.format(users/3)

    def get_more_info(self):
        global users
        return '{} fakes'.format(users/10)


class AccountWidget(NumberWidget):
    title = 'Accounts'

    def get_value(self):
        return '{}'.format(users)

    def get_detail(self):
        global users
        return '{} actives'.format(users/3)

    def get_more_info(self):
        global users
        return '{} fakes'.format(users/10)

~ my HMTL template

{% load staticfiles %}

{% block stylesheets %}
{#<link rel="stylesheet" href="{% static 'my/custom/style.css' %}">#}
{% endblock %}

{% block scripts %}
{#<script type="text/javascript" src="{% static '../static' %}"></script>#}
{% endblock %}

{% block config_file %}
<script type="text/javascript" src="{% static 'js/dashing-config.js' %}"></script>
{% endblock %}

I did some test, so there is some commented out code. Any help would be appreciated.

It looks like the routers are just an API which pushes JSON like syntax.

After all this, my guess is it has something to do with the routers. They're not being called? But, if I try to use the routers, I only get the default dashboard. Perhaps the documentation should have a workflow document, so users can understand how data is transferred throughout. Maybe that's naivety.

Install & Usage

Thanks for making this awesome project, but I'm having an issue installing and usage....

I've followed the documentation, and I can pull up the built in "demo" dashboard in my project, however
the docs don't really explain how to setup an HTML file/view for my own custom dashboard.

I could modify the default dashboard, but that's not what should be done.

I went ahead and created an HTML file, and served it through a view like this:

from django.http import HttpResponse, StreamingHttpResponse
from django.shortcuts import render, render_to_response, redirect, RequestContext

view.py:
def test_dashboard(request):

context={ }
return render(request,'dashing/dashing.html',context)      

html file:
{% extends 'dashing/base.html' %}
{% load staticfiles %}

{% block 'stylesheets' %}

<script type="text/javascript" src="{% static 'js/dashing-config.js' %}"></script>

{% endblock %}

When I render this, I still get the default dashboard data, even if my dashing-config.js file is empty.

So, my questions are two fold:

1.) How do I setup my own dashboard (not use the built in dashboard) (I've read the example trelio card app, and still can't figure it out)

2.) Once I am rendering my HTML document, how to I point the JS/HTML to retreive data from the widget classes setup?

Map URL arguments to parameters in widgets

It would be nice if I could write a general widget, for example a github repository commit list (I have written this in my fork but it's pretty messy), to use URL parameters to pass configuration options like the repo to watch and the most recent commits.

I can see a case to be made for REST style URLs here (i.e. /widgets/githubcommits/talpor/django-dashing/) or parameterized requests (i.e. /widgets/githubcommits/?user=talpor&repo=django-dashing)

This project is fantastic and has good velocity and I'd be happy to discuss design and implementation of this feature if you like. Have you considered this yourself?

feature requests

been using django-dashing for a week now and it's been great.

Here are some of feature requests

  • ability to change the color of widget without modifying the library itself
  • Rickshaw.Graph.Axis.Time
  • ability to use multiple series in rickshawgraph

Pushing data into a widget on demand?

The original shopify version of Dashing allowed the use of CURL to push data from any source into a widget. This was helpful for things like MOTD, where anyone could display info. I see in the docs some reference to an API, but I do not see any examples of how to actually use it. Does this feature exist in django-dashing?

looping through dashboard set

As I now have some more widgets on my dashboard as can be displayed on one page (it's used on a separate computer for monitoring), I modified django-dashing to automatically roll through the different dashboards in the set depending on an URL parameter.

If you'd like to see this feature in the official django-dashing repo, I'd create that feature and a pull request (might take some days ;) ).

Please let me know if this is of interest. Thanks.

Problem: other widgets extend this.data, not this.scope

The demo, and widgets not hosted here, do this:

$.extend(self.data, bla);

instead of this:

$.extend(self.scope, bla);

With 0.3.0, I can only get the latter to work. Will I have to fork for instance the weather-widget, or is this accidentally something that breaks compatibility (ergo a bug) and something that should be flagged to widget-maintainters?

Knob not updated on new data

Graph and List both update on $.extend( this.scope, scope ), however Knob (specifically, scope.value and scope.data.fgColor) does not. (I want a knob that changes its foreground colour based on the value, in the standard "green/yellow/red" scheme.)

For example, the following will update the numerical value displayed (i.e. the one hidden by scope.data.displayInput), but not the arc itself:

dashboard.addWidget( "MyWidget", "Knob", {
    getData: function() {
        var scope = GetWidgetScope();
        $.extend( this.scope, scope );
    }
});

I've been able to work around this by adding these trigger calls to the end of getData, but I'd rather this was handled by the library itself:

$( ".dashing-knob" ).trigger( "change" );           // updates the value
$( ".dashing-knob" ).trigger( "configure", data );  // updates the colour/etc

How to display percent sign in Knob Widget

In the screenshot used in README, how did you get % to appear after 68. If I put a % in value (e.g., value: '68%'), it seems be be stripped by JavaScript. (I also tried &#37;)

README-Screenshot

Error in the Getting Started section of the Readme

In the following code:

var myDashboard = new Dashboard();
myDashboard.addWidget('customWidget', 'Number', {
    getData: function () {
        var self = this;
        Dashing.utils.get('custom_widget', function(data) {
            $.extend(self.data, data);
        });
    },
    interval: 3000
});

It should actually be $.extend(self.scope, data);

Unable to avoid loading default widgets

I have followed the steps in order to create my own widget. But no matter what I do, default widgets are being loaded instead. If I check my Django debug server output, my own dashing-config.js is being loaded because I'm doing a GET request there that is happening according to the log, but I assume that later the default dashing-config.js is being loaded.

I'm working with Python 3.5.2 with Django 2.0.

My widgets.py:

from dashing.widgets import NumberWidget
class InterferenceCountWidget(NumberWidget):
	title = 'Detected interferences'
	value = 0
	
	def get_title(self):
		return self.title
		
	def get_value(self):
		return self.value

My dashing-config.js (situated in /myapp/myapp/static/dashing/dashing-config.js):


var dashboard = new Dashboard();

dashboard.addWidget('interference_count_widget', 'Number', {
    getData: function () {
        var self = this;
        $.get('/interference_count/', function(data) {
           self.data = data;
           dashboard.publish('interference_count_widget/render');
        });
	    dashboard.publish('interference_count_widget/render');
    }
});

My urls.py:

from django.contrib import admin
from django.urls import path
from dashing.utils import router
from .widgets import InterferenceCountWidget


router.register(InterferenceCountWidget, 'interference_count_widget')

urlpatterns = [
    path('admin/', admin.site.urls),
	path('', include(router.urls)),
	path('interference_count/', InterferenceCountWidget.as_view(), name='interference_count_widget')

Default settings.py but for including dashing in INSTALLED_APPS.

What am I missing here? It seems non trivial to avoid loading default demo widgets...

options.require dependency issue

The widget dependency loader is broken for cases where two one widget requires dependency ['a'] and another requires ['a', 'b'].

The issue is that the loadResource function deletes the name from the resources list after loading the first widget, causing the second widget to stop processing its list the moment it finds an unknown dependency ('b').

Support for external data sources?

How do you configure a widget to pull data from an external data source? In the readme, there's a brief mention of using an "API" but the docs don't elaborate on this, and the demo just uses auto-generated toy data. Does this project support pulling or pushing data into the app or is that out of scope?

Create a release for JavaScript fix

Hey there,

There is a bugfix(f5d556b) in the JavaScript dashing.js for setting widget color that you have in master that isn't released. Please create a new release and upload to PyPI. :)

Best,
Matthew

Trying to send data using curl to widget

Trying to send data to a widget using curl but cannot find the format. Django dashing does not use dashboard.erb to define a data-id or a dashboard.html, so I'm just wondering how to push the data.

Something is wrong with Django 1.9

I've upgraded my systems to Django 1.9 and since then Django Dashing is broken.

In particular the <script> tags appear like verbatim in the page, > instead of > for instance.

graph.js: Uncaught TypeError: Cannot read property 'beforeRender' of undefined

Hi @individuo7,

with your master branch I get Uncaught TypeError: Cannot read property 'beforeRender' of undefined in dashing/static/widgets/graph/graph.js line 27:
beforeRender = this.model.beforeRender || data.beforeRender

With the demo dashing-config.js I do not have that problem. Please find the widget code of my dashing-config below. Would be nice, if you could point me to the right direction.

is.addWidget('analytics_sessions_widget', 'Graph', {
    data: {
        data: [],
        title: 'FC Sessions',
        value: 'loading',
        moreInfo: 'Last week: loading'
    },
    interval: 300000, // 30 min
    col: 1,

    getData: function () {
        var self = this;
        $.get('/api/v1/ga/sessions/test', function(data) {
            var analyticsData = [];
            for(var i=0; i<4; i++) {
                var sessions_string = data[i]['sessions'];
                var sessions_int = parseInt(sessions_string);
                analyticsData.push({
                    x: i,
                    y: sessions_int
                });
                if(i==2) {
                    self.data.moreInfo = 'Last week: ' + sessions_string;
                }
                if(i==3) {
                    self.data.value = sessions_int;
                }
            }
            self.data.data = analyticsData;
            self.data.updatedAt = lastUpdate();
            is.publish('analytics_sessions_widget/render');
        });
        is.publish('analytics_sessions_widget/render');
    }
});

Conditional color formating for number widget

Hello,

Could you tell me how to get value from detail-field of widget with the rivet.js?
To proceed something like that:

rivets.binders['status-color'] = function(el, value) {
    if (value == detail) {
        $(el).css('background-color', 'green');
    }
    else if (value < detail) {
        $(el).css('background-color', 'orange');
    }
    else {
        $(el).css('background-color', 'red');
    }
};

Thank you beforehand.
Andrei B.

afterRender is not fired after timer

myDashboard.addWidget('AvailabilityAverageWidget', 'Graph', {
color: 'steelblue',
getData: function () {
var self = this;
Dashing.utils.get('availability/', function(data) {
data.afterRender = function() {
alert('graph shown');
};
$.extend(self.data, data);
});
},
interval: 60000
});

I have only one alert.

How to use rickshawgraph extension?

https://gist.github.com/jwalton/6614023

It has *.coffee *.html *.scss .

django-dashing states fully create your own with css, html, and javascript.

Can I adapt the rickshawgraph widget somehow?

** edit **

I didn't know dashing is the root project that inspired django-dashing.. (ok. it's stated on the front page of django-dashing)

There's apparently a python clone..
https://github.com/evolvedlight/pydashie

And it uses flask and uses the same *.coffee *.html *.scss
So I assume you could litterally copy and paste the new widgets from dashing

Would it be possible to do similar with django-dashing ?

block identifiers in template are in single quotes

I stumble across this as I tried to add a custom script for a new widget:

in dashing/base.html the block identifiers are surrounded by single quotes which gives me errors in my IDE (PyCharm). If it's okay with you, I'd change that and send a pull request.

{% block 'scripts' %}

to

{% block scripts %}

Creating Granular Permissions

Read through the documentation but I was wondering if it is possible to make multiple dashboards that can each only be accessed by a specific user?

Any help would be really appreciated

Own modules

Hey,

I'm trying to setup this really cool tool. Unfortunatelly I am not able to create my own widgets. I was trying it with the documentation (created own PyPI package with my custom widgets with no success). Is there somebody who has some experience with creating own widgets? Can you share all steps needed?

Also there is a question when I have own widget with python class, how can I pass parameters from js to the python? I want to have one widget to be used with different data passed to python. Is it possible? I didn't find any reasonable example.

Thanks a lot! :-)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.