Custom modules in deshboard designer menu
-
Is there a way for me to code into my module/controller or something at load time that will register my Controllers with the dashboard designer. Currently I have to add this
{ name: "dk-graphics", translation: "dkDeviceGraphics.description", filter: { moduleName: "dkGraphicsModule" }, strictFilter: !0 },
to the 'componentSections' of the dashboardDesignerModule. And then put it in the overrides folder. I would rather not have to copy/modify/load this everytime you guys put out an update. That would actually be impractical if not impossible if I start deploying these at customer sites.
OR a second option:
Can I write an extension to dashboard designer module which will do it? Then I could use module dependencies and push an update.
-
I thought of a third option. A minor change to the dashboardDesigner module code that would read some external file and add those into the component sections. Then developers could just add/modify that(those) files. But really, once I add my section code into the file/folder, the system would just always read and add that when loading the DD module. It would only need to be changed if there was a major structural change to the componentSections part of the module.
Just a thought.
And for clarification, I'm not using the userModule. My intention is to avoid using that all together as I'm working on deeper module development.
-
@sstuhlmann said in Custom modules in deshboard designer menu:
And for clarification, I'm not using the userModule. My intention is to avoid using that all together as I'm working on deeper module development.
How are you loading the AngularJS module then? Using a Mango module which has a AngularJSModuleDefinition?
-
@sstuhlmann said in Custom modules in deshboard designer menu:
And for clarification, I'm not using the userModule. My intention is to avoid using that all together as I'm working on deeper module development.
If you're going to do that, you might as well write something custom and load it somewhere else and talk via the API. The usermodule exists to extend the dashboard, not overwrite it. Alternatively, write new directives and load those in pages instead of other mango pages via the usermodule. It's honestly not that hard.
Your menu changes will be saved in the mango sql database.@sstuhlmann said in Custom modules in deshboard designer menu:
I would rather not have to copy/modify/load this everytime you guys put out an update.
That I do agree with and have raised it myself with custom UI code, as I'm the sole dev. It does slow down my ability to roll out updates with our custom code, but that's how it is now since mango's UI has been reformatted into ES6. All I can do is test, shoot, and hope.
-
@sstuhlmann I agree that Mango modules should be able to add sections. I'll put out a new Dashboard Designer soon in which you can configure a service in order to add sections.
const myModule = angular.module('myModule', ['maUiApp']); // no way to specify an option module require in AngularJS, UI bootstrap will pick this up and add it to the module requires if module is present // If you know Dashboard Designer module will always be present then you can add it the the standard requires above (after maUiApp) myModule.optionalRequires = ['maDashboardDesigner']; myModule.config(['$injector', function($injector) { // check with the injector that the service provider is present if ($injector.has('maDesignerTagInfoProvider')) { $injector.get('maDesignerTagInfoProvider').addComponentSection({ name: 'my-components', translation: 'my.components', filter: { moduleName: 'myModule' }, strictFilter: true }, 'mango-modules'); // mango-modules is the name of the section that this one will be added before } }]);
-
-
Yes, I am writing completely independent modules with definition java files. I'm currently just running development and testing locally. Once I build my new module (which lists module-parent as its parent), I just drop the zip onto my MangoES. I'm currently working on two modules. One is a better and more standardized deviceConfig/templating module. And the second is a graphical gauges one which wraps ma-gauge and uses the DP tags to dynamically load different layouts. Like so:
The injector will be great. Should work out for me nicely.
At some point I will look at publishing my modules to the store. But they aren't quite ready for prime time.