dtpublic / malhar-angular-dashboard Goto Github PK
View Code? Open in Web Editor NEWGeneric Dashboard/Widgets functionality with AngularJS (directive)
Home Page: http://datatorrent.github.io/malhar-angular-dashboard/#/
License: Apache License 2.0
Generic Dashboard/Widgets functionality with AngularJS (directive)
Home Page: http://datatorrent.github.io/malhar-angular-dashboard/#/
License: Apache License 2.0
When my widget is resized the columns of my grid only resize after receive a click at grid header. How to implement a event to make my grid receive that "resize".
My grid options
$scope.gridOptions = {
data: 'items',
enableRowSelection: true,
enableColumnResize: true,
columnDefs: [
{ field: 'name', displayName: 'Calls' , width: '*', cellClass: 'grid-align'},
{ field: 'value', displayName: 'Numbers', width: '*', cellClass: 'grid-align'}
]
};
Hello,
I wanted to know how I can associate my Widget X, to a template Y that will be displayed in the dialog 'Widget Options', I tried, but it still does not work.
I always instead "No edit template specified for this widget ({{}} widget.name)." '
Thank you to explain to me in details, I am still a beginner or give me an example.
Thank you in advance.
Hello, I just started looking into this project, it seems well done.
I'm looking for an option to set a custom class on the widget div
<div class="dashboard-widget-area">
<div ng-repeat="widget in widgets" ng-style="widget.style" class="widget-container" widget>
<div class="widget panel panel-default __here I want to add my own classes__">
The reason being I want to have different themes (colors) for certain widgets.
Do you think it'll be possible?
This may be a feature request, but if one has a chart it is often desirable to resize both in x and y direction. Say one has a single "banner" chart at the top which is 100% width and 300px high. Then follows two smaller 50% width chart widgets below the banner chart. How would that work with the existing implementation? Can it be done? All 3 widgets would use the same widget template but with different options.
Following original discussion in #37 ngmin is now officially deprecated in favor of ng-annoate; even NPM is giving warnings!
npm WARN deprecated [email protected]: use ng-annotate instead
Presumably you would also embrace grunt tool also?
Widgets to support full screen mode.
Want something similar to full screen edit mode "Zen Mode" in github. Although obviously Zen mode takes away distractions, whereas we imagine people wanting to quickly zoom into widget chart, maxing out available space in browser window...in fact gmail fullscreen for composing introduced over last year may be the best user experience to kep in mind!
We may be able to leverage jquery fullscreen, here is one tutorial: http://tutorialzine.com/2012/02/enhance-your-website-fullscreen-api/
Full screen icon would naturally be offered next to existing gear icon for editing.
Hi,
You have done some great work!
Can you give us some guidance on how to plug data into the dashboard from a server-side point of view.
Thanks.
Hi all,
After several weeks of using this in a real-life project, I have noticed that there are several shortcomings with the current way in which widgets are instantiated, saved, etc. Here are a few things I am thinking about specifically:
Problem: Currently, when a widget is instantiated using a Widget Definition Object, it picks a hard-coded set of keys to copy. This is pretty rigid and does not allow client code to supply arbitrary data to WDOs that get inherited by instances of those widgets.
Solution: Perform a more generic extend/copy process when instantiating widgets. This will allow for arbitrary data to be passed to the widget instance from WDOs.
Problem: There is no way to specify which properties are persistent (should be saved) and which are transient (should not be saved). It is true that this could potentially be handled by a custom storage
service, but this is a lot of work for a pretty common customization. This goes for built-in WDO properties. For example, some users have requested that dataModelOptions
gets persisted while others have requested that it does not (same for attrs
).
Solution: Allow a mechanism for specifying which properties are persistent and which are transient. It should be possible to do this on a per-widget basis as well as dashboard-wide. Perhaps something like this on WDOs:
var myWidgetDefinitions = [
{
title: 'default title',
name: 'name-of-widget',
directive: 'my-cool-widget',
dataModelType: MyDataModel,
dataModelOptions: {
iAmPersistent: 'value',
iAmTransient: 'other value'
},
attrs: {
'some-attr': 'someValue'
},
// Specify which are transient and which are persistent:
// Mirrors structure of widget: a "true" value means persist
persist: {
title: true,
// Specify persistence of deep locations
dataModelOptions: {
iAmPersistent: true
},
// if a location that is an object, all values
// in that object will inherit that choice.
// So in this case, no attrs will be saved:
attrs: false
}
}
]
Setting dashboard-wide persist
options could look like this on dashboard options:
scope.options = {
// ... other dashboard options ...
persistWidgetAttributes: {
title: true,
dataModelOptions: {
iAmPersistent: true
},
attrs: false
}
}
(Ok, this one isn't really widget-related, but I'm on a roll here...)
Problem: A user cannot set the default dashboard options for all instances of dashboard in their apps. Meaning that if you use the same settings for storage
and explicitSave
, you have to keep putting those options in your dashboard option objects.
Solution (maybe): AFAIK, there is no provider that can be used in .config()
blocks for directives. So I am thinking we can add a simple provider/service to the module that holds default options, and can be configured using a config block. The directive will then use this service to provide default options.
I would LOVE to hear feedback from anyone using this module in a non-trivial way.
@awashbrook, @sjoerdmulder, @ceterumnet, @eduardonunesp, @NickPadilla, @hfiedler
One of our most important goals for our project is to encourage creation of dashboards by non-developers. We will have a palette of WDO's from which user can instantiate new types of widgets from and configure using widget options/settings dialog. Must be possible to save individual widget configuration and layout on the dash and to persist to backend data store!
Widget configuration includes directive attributes and data source options (#5).
We want to set reasonable defaults for directive attributes in the WDO, eg. here for nvd3-stacked-area-chart
isArea: true,
height: 400,
showXAxis: true,
showYAxis: true,
xAxisTickFormat: 'xAxisTickFormat()',
interactive: true,
useInteractiveGuideline: true,
tooltips: true,
showLegend: true,
showControls: true,
color: "colorFunction()",
forcey: '[0,2]'
We want to be able to enable a generic editing of the attributes set on each widget, just like editing properties in an IDE. Unlike many property dialogs though, we do not intend to support adding new properties, the general idea is we declare reasonable defaults for those attributes is safe to change on the fly.
Ideally we would provide basic validation which respects the type of each attribute (at least distinguishing boolean, strings, longs and doubles), which is why we have not specified everything as strings in the json definition above.
This should be something that can be enabled at the dashboard level along with other Dashboard Options.
This requirement was first discussed as (4) in #2. Working on a pull request. This may fit within the scope of your other enhancement for generic settings dialog (#11).
Hey Nick,
Seems we have similar interests in angular and node charting and dashboard technologies. We first glanced at your project soon after you unveiled back in January, and thought it must be too young! Well having checked out the competition back again with renewed interest and have forked your demo project: https://github.com/awashbrook/angular-dashboard-app
Have spend the entire week digesting the code from both projects and very much appreciate your team starting to commit some documentation, which is helping me figure out the delicate separation of concerns between widgets and data models.
Have a few questions:
Looking at operational rather than business dashboards. Are you interested in integrating with with graphite?
Strategically we are set on d3. So far using Rickshaw, but keeping an open mind for nvd3 after seeing your work. Intrigued to find project the directive project so active:https://github.com/cmaurer/angularjs-nvd3-directives. Any strong feelings for either solution?
Are you planning to support basic websockets at the framework level, with meteor optional for those wiling to take the plunge?
Reconfiguring widgets is key for us. So far the topics options dialog is disabled in the demo for the meteor dashboard etc. Hoping to create my own to allow custom selector for browsing graphite metrics soon. However, the design today support modifying only the widget dataModelOptions. We also believe the ability to edit rendering attributes is very import charts (nvd3 has a tons of options!!). What do you think?
Thanks very much for your time and for contributing such a fantastic piece of work.Let me know if you would be interested in more external collaboration on this project in the future?
This will allow for more granular deprecation of stored widget state.
Right now, it is assumed that items passed to storage.setItem
should be passed through JSON.stringify
and items returned by storage.getItem
will be a string that should be passed through JSON.parse
. This should not be an assumption by the dashboard, but rather a parameter in dashboardOptions.
Just grabbed fresh copy of Malhar angular project suite from scratch:
Dashboard: b2377f9
Widgets: 89dd1b74c9b230f7923aa141f4a0ef4024b3db89
With latest Dashboard changes, all Widget and WebApp demos fail with 1000s of ng:cpws Copying Window or Scope errors in the console: https://docs.angularjs.org/error/ng/cpws!
The Dashboard demo run great with localStore persistence :)
Let me know if I can help!
Hello for all. When I attempt command grunt demo
these error message are appeared
Running "connect:livereload" (connect) task
Warning: Object function createServer() {
function app(req, res, next){ app.handle(req, res, next); }
merge(app, proto);
merge(app, EventEmitter.prototype);
app.route = '/';
app.stack = [];
return app;
} has no method 'static' Use --force to continue.
Aborted due to warnings.
How can I fix it?
There are several things to improve regarding the widget settings dialog:
optionsTemplateUrl
for custom widget options in the dialog. Possible names for replacement: dialogTemplateUrl
, settingsTemplateUrl
dialogTemplate
/settingsTemplate
As per https://github.com/nickholub/angular-ui-dashboard/blob/master/src/directives/dashboard.js, we seem to be invited to setup our own custom options for a each particular type of Widget Model, rather than using the default ability which is to optionsTemplateUrl, which is for entire dashboard only. However editModalOptions is never set in demo this or sister project.
So below is setting default options when no others were set...
scope.openWidgetDialog = function (widget) {
var options = widget.editModalOptions;
// use default options when none are supplied by widget
if (!options) {
options = {
templateUrl: 'template/widget-template.html',
resolve: {
widget: function () {
return widget;
},
optionsTemplateUrl: function () {
return scope.options.optionsTemplateUrl;
}
},
controller: 'WidgetDialogCtrl'
};
}
var modalInstance = $modal.open(options);
Working on graphite integration and need ability to modify data source for each widget, so have taken the liberty of setting editModalOptions in the constructor for my angular service similar to https://github.com/nickholub/angular-dashboard-app/blob/master/app/scripts/services/datamodel.js.
Once I began setting options for my individual widgets, noticed that all dataModelOptions were attempting to update simultaneously after edit attempt due to bug in Widget Model https://github.com/nickholub/angular-ui-dashboard/blob/master/src/models/widgetModel.js.
Root cause appears to be shallow rather than deep clone of Widget Model, leading to WM Class dataModelOptions being referenced from ALL WM instances!
angular.module('ui.dashboard')
.factory('WidgetModel', function () {
// constructor for widget model instances
function WidgetModel(Class, overrides) {
overrides = overrides || {};
angular.extend(this, {
title: 'Widget',
name: Class.name,
attrs: Class.attrs,
dataAttrName: Class.dataAttrName,
dataTypes: Class.dataTypes,
dataModelType: Class.dataModelType,
dataModelOptions: Class.dataModelOptions,
style: Class.style
}, overrides);
this.style = this.style || { width: '33%' };
this.setWidth(this.style.width);
Have addressed the issue locally and got my graphite dashboard working. Will raise a pull request accordingly.
Many thanks.
Hello,
I stumbled across your project a few weeks ago. It has been very useful in my current project of developing a dashboard with dynamic widgets. I recently just grabbed the latest with the local storage enhancements and it works great. Thanks for providing a great dashboard solution for Angular. I have one question:
1)What is the proper way to save multiple widget configurations inside the dashboard? For instance: I would like to have a set of generic layouts that can be selected from a UI input. A step further would be able to build these layouts. Any advice would be greatly appreciated, because I feel as though I am working against the framework with my implementation.
Hello,
I was wondering why, if for any particular reason, the dashboard widgets do not use the jQuery UI Resizable plugin? The requirements for this project already include the jQuery UI project for the sortable - could we not include the Resizable as well? This would give us both height and width resizing out of the box. I have integrated it into my project, with a small effort. We can add a resizable configuration attribute so that users can easily configure it.
If your interested in using this kind of functionality I can spend a bit of time creating a feature branch and adding in the functionality. Shouldn't take long at all, but wanted to check in before proceeding in case there is a reason for not including it.
Thanks!
Dashboards are continuously saved today: no "save" button, only "clear" and "revert to defaults".
This is a key UX decision and one with ramifications (how do we provide rollback capability, and does one need to provide full version control...which is why, say, google docs users can thrive without an "undo" button!
This issue is merely to flag this design assumption and potential ramifications of this as our modus operandi!
Few minor issues to flag:
Instantiate Data Model from String Name with $injector
Enable Local Storage
Can someone lead my on how to populate widget data from service endpoint?
Thanks..
Hello!
Thanks again for this really cool project! We are looking to dynamically load files/modules when a gadget is loaded. This way we don't load everything every time the page loads, only the gadgets that are 'default' and/or saved to local storage. I am wondering at what point should I look to hook in to?
In a perfect world I'd like to add a new widget def field that is something to effect of 'require' and then provide the module we should load. Or provide a callback option that allows us to do the load before adding the widget to the DOM - passing in the 'require' field to the callback. This way we don't create another dependency for your project.
Any ideas or thoughts would be greatly appreciated!
Hi,
I have a project that needs to change some parameters inside the dataModelType, when user changes the params in the widgets. How is the best way to not load dataModelType in widget init and controls that inside my widget. I tested the following code without success.
.directive('wtVolumetry', function ($interval, VolumetryDataModel) {
return {
restrict: 'A',
replace: true,
templateUrl: 'template/widgets/topN/topN.html',
scope: {
data: '=',
},
controller: function ($scope) {
var ds; // data source
var setDataSource = function() {
if (!$scope.$parent.widget.dataModelType) {
ds = new VolumetryDataModel();
$scope.$parent.widget.dataModel = ds;
ds.setup($scope.$parent.widget, $scope);
ds.init();
$scope.$parent.widget.dataModelType = VolumetryDataModel
$scope.$on('$destroy', ds.destroy.bind(ds));
}
}
$scope.gridOptions = {
data: 'items',
enableRowSelection: true,
enableColumnResize: true,
columnDefs: [
{ field: 'name', displayName: 'Calls' },
{ field: 'value', displayName: 'Qty'}
]
};
$scope.hourInit = "0:00";
$scope.hourEnd = "23:00";
setDataSource();
},
link: function postLink(scope) {
scope.$watch('data', function (data) {
if (data) {
scope.items = _.sortBy(data, function (item) {
return (-item.value);
});
}
});
}
};
})
Replace Underscore.js with Lodash
Currently it is called by proxy when the handleStateLoad
method calls resetWidgetsToDefault
, which in turn calls save. While calling resetWidgetsToDefault
should trigger a save, this should not occur on initial load.
Save Title to Local Storage
Hi,
Love this dashboard but I need to use it in a slightly different way to what is shown in the examples.
My widget definitions are saved in a database which I access through a service. I do not get hold of the definitions until after the dashboard has loaded. The definitions for the dashboard seem to be initialized when the link function is called on the directive.
Is there any way to supply the definitions to the dashboard after the directive has loaded?
Thanks,
Conor
I'd like to implement a progress bar in the widget I'm developing based on the Malhar framework.
Does one already exist?
Hello,
I start to use the dashboard and it's really great and powerful ! I'm new with Angular and feel a little bit lost in the best way to achieve what sounds simple to me : i have a custom widget, i will create a dataModel to feed the widget but i would like to be able to instantiate the widget with some parameters that will be pushed to the dataModel
For example my sensor widget will request data from my DB. The 1st instance will display data for sensor1, the 2nd for sensor2, etc.
Is there any way to achieve that without breaking your project ? ;-)
This is necessary to address #13. It also cleans up the code a lot.
This will improve testability and readability
Basically if a WDO looks like this:
// ...
{
name: 'someName',
dataModelType: MyDataType,
dataModelOptions: {
serializable: 'im a string',
unserializable: function notSerializable() {}
}
},
// ...
the unserializable
property is no longer present after future loads from storage. We should decide if this is intended behavior or if unserializable attributes of dataModelOptions
should be put into WDOs from storage
.
Provide option to lock default layouts (prevent from deleting and renaming).
Hey guys,
First of all, thanks you guys, you are doing a great job. I am currently developing a dashboard based on your solution which is really really awesome and am experiencing a little issue.
I have a widget used tu monitor the activities of a software user.
As you can see on the picture, the user can choose for each monitored activity the monitored period so as the representation style(Table or graph).
The selects and the buttons modify directly the widget attributes, for instance "widget.attrs.myArchivingsPeriod" or "widget.attrs.myArchivingsRepresentationTypeIsTable".
An example of modifying code, this is the case of the select:
When declaring my widget:
{
name: 'My production monitoring',
title: 'Mon suivi production',
directive: 'wt-my-production-monitoring',
attrs: {
myArchivingsPeriod: '1day',
myRestoresPeriod: '1day',
myArchivingsRepresentationTypeIsTable:'true',
myRestoresRepresentationTypeIsTable:'true'
},
style: {
width: '50%'
}
}
In my directive:
$scope.periods = ['1day', '7days', '30days', '90days', '1year'];
In my widget view(actually written in JADE):
select.col-xs-6.col-sm-6.col-md-6.col-lg-6(name="archivingsPeriod" ng-model="widget.attrs.myArchivingsPeriod" ng-change="updateMyArchivings()" ng-options="period for period in periods")
After doing some testing, I have reached the conclusion that these attributes changes are only persisted to localStorage if I change the size, position or title of the widget.
I guess that widget attributes persistence to localStorage works perfectly using widgets options, but would it be hard to fix this issue?
Thanks in advance and keep the good work up!
Cheers,
Harald
Hi when I try to install dashboard with bower I get this error
bower install angular-ui-dashboard
bower angular-ui-dashboard#* cached git://github.com/nickholub/angular-ui-dashboard.git#0.1.0
bower angular-ui-dashboard#* validate 0.1.0 against git://github.com/nickholub/angular-ui-dashboard.git#*
bower jquery-ui#~1.10.3 not-cached git://github.com/components/jqueryui.git#~1.10.3
bower jquery-ui#~1.10.3 resolve git://github.com/components/jqueryui.git#~1.10.3
bower angular#~1.2.6 cached git://github.com/angular/bower-angular.git#1.2.16
bower angular#~1.2.6 validate 1.2.16 against git://github.com/angular/bower-angular.git#~1.2.6
bower underscore#~1.5.2 cached git://github.com/jashkenas/underscore.git#1.5.2
bower underscore#~1.5.2 validate 1.5.2 against git://github.com/jashkenas/underscore.git#~1.5.2
bower angular-bootstrap#0.9.0 cached git://github.com/angular-ui/bootstrap-bower.git#0.9.0
bower angular-bootstrap#0.9.0 validate 0.9.0 against git://github.com/angular-ui/bootstrap-bower.git#0.9.0
bower angular-ui-sortable#~0.10.0 cached git://github.com/angular-ui/ui-sortable.git#0.10.1
bower angular-ui-sortable#~0.10.0 validate 0.10.1 against git://github.com/angular-ui/ui-sortable.git#~0.10.0
bower jquery-ui#~1.10.3 download https://github.com/components/jqueryui/archive/1.10.4.tar.gz
bower angular#>=1 cached git://github.com/angular/bower-angular.git#1.2.16
bower angular#>=1 validate 1.2.16 against git://github.com/angular/bower-angular.git#>=1
bower jquery-ui#>= 1.9 not-cached git://github.com/components/jqueryui.git#>= 1.9
bower jquery-ui#>= 1.9 resolve git://github.com/components/jqueryui.git#>= 1.9
bower jquery-ui#>= 1.9 download https://github.com/components/jqueryui/archive/1.10.4.tar.gz
bower angular#~1.0.x cached git://github.com/angular/bower-angular.git#1.0.8
bower angular#~1.0.x validate 1.0.8 against git://github.com/angular/bower-angular.git#~1.0.x
bower jquery-ui#~1.10.3 extract archive.tar.gz
bower jquery-ui#>= 1.9 extract archive.tar.gz
events.js:72
throw er; // Unhandled 'error' event
^
Error: ENOSPC, write
when I tried to install or update other bower components there is no problem.
I did some actions and jquery-ui cause the problem.
Good Afternoon,
I was reviewing the current documentation and I notice that the layouts have the restriction of set a define default widgets for al the layouts.
https://github.com/DataTorrent/malhar-angular-dashboard#widget-definition-objects
Dashboard Layouts
One common requirement for user-customizable dashboards is the ability to have multiple layouts consisting of the same set of widget definitions.
Currently, I need to have exactly the opposite and I want to specific set of default widgets for each layout.
I know that the layouts properties are defined in
.controller('LayoutsDemoExplicitSaveCtrl', function($scope, widgetDefinitions, defaultWidgets, LayoutStorage, $interval) {
$scope.layoutOptions = {
storageId: 'demo-layouts-explicit-save',
storage: localStorage,
storageHash: 'fs4df4d51',
widgetDefinitions: widgetDefinitions,
defaultWidgets: defaultWidgets,
explicitSave: true,
defaultLayouts: [
{ title: 'Layout 1', active: true , defaultWidgets: defaultWidgets1 },
{ title: 'Layout 2', active: false, defaultWidgets: defaultWidgets2 },
{ title: 'Layout 3', active: false, defaultWidgets: defaultWidgets3 }
]
};
It is possible to pass the widgetDefinitions for each layout as well as the defaultwidgets?
It is possible to achieve this kind of functionality in any customized way?
Thank you for the hard work.
Regards,
Gabriel Acosta
Hello,
I have a question regarding the newest version of dashboard directive. What I want to make is that I have additional settings properties defined for a specific widget. What I did till now is:
Now the problem is that when modal button OK is pressed, these custom fields are not stored into browser's local storage (that's is expected if I take a look at the code in the DasboardState save method). So, my questions are:
Thank you in advance! Regards.
For a more consistent layout I propose angular-gridster as a replacement for angular-ui-sortable
Currently you have to specify default widgets like this:
var defaultWidgets = [
{ name: 'My First Widget' },
{ name: 'My Second Widget' }
];
And you should be able to do something like this:
var defaultWidgets = [
'My First Widget',
'My Second Widget'
];
You should also be able to mix the two:
And you should be able to do something like this:
var defaultWidgets = [
'My First Widget',
{ name: 'My Second Widget' }
];
This is major limitation, fortunately easily addressed...pull request #35 raised.
DataModel Example
I love the concept here. I think you should be using http://www.chartjs.org/ instead. Here's a NG wrapper: https://github.com/lgsilver/angles
If there's interest, I may start working on it for my needs.
Hello,
I would like to know where I could add the variable 'optionsTemplateUrl'.
thank you
UI Sortable dependency is old enough compared to project that it's using Angular 1.0 not anything in the 1.2x train. This can be resolved of course via bower, but the dependency should be updated.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.