Changing the standard charts in the angular JS
-
What if I want to link to a page I have made, but I do not want the page to be on the menu?
Also, what if I make a page that has a specific graph, labels, and layout. I have a site with 5 buildiungs. I want to make 1 page that has the graphs, textboxes, etc. I want to make it so if I press a button that says Gas, it keeps the graph and layout, it just uses the gas device_xid's for reverence.
Do you have an example of that?
-
What version of the dashboards module are you using? Have you copied the adminTemplate or any other template? Or are you using the custom pages in the v3.2 version of the module?
Yes you can definitely do what you specified, I'd suggest setting the data point's "device name" to whatever the name of the building is. Use a set of buttons that do something like
ng-click="buildingName='Building 1'"
Then use this to get the points for that building<ma-point-query query="{deviceName:buildingName}" points="points"></ma-point-query>
-
I'm still using the adminTemplate. I am trying to understand better the new msAdmin and how to recreate our website with it.
-
Using the adminTemplate you will want to add a Page to the MENU_ITEMS array in app.js but you will want to set its menuHidden property to true.
For example this is the errors Page definition:
{ name: 'dashboard.apiErrors', url: '/api-errors', templateUrl: 'views/dashboard/errors.html', menuTr: 'dashboards.v3.dox.apiErrors', menuIcon: 'warning', menuHidden: true }
So you would want to do this for the custom page you have created. You will still need a url, template, state name, and menuTr or menuText (as it is used in the breadcrumbs header on the page when viewed.
and then you can link to them via the state name and ui-sref property on a link:
eg:<a ui-sref="dashboard.apiErrors" class="md-mangoDefault-theme"><md-icon class="md-mangoDefault-theme material-icons">warning</md-icon></a>
or simply the href set by the url property:
<a href="/dashboards/api-errors" class="md-mangoDefault-theme"><md-icon class="md-mangoDefault-theme material-icons">warning</md-icon></a>
-
I am getting this error:
angular.js:118 Error: Could not resolve 'dashboard.cooling' from state 'dashboard.section1.page1'
at Object.y.transitionTo (angular-ui-router.js:7)
at Object.y.go (angular-ui-router.js:7)
at angular-ui-router.js:7
at angular.js:158
at e (angular.js:45)
at angular.js:48 -
When are you getting the error? Please post up the URL you are trying to navigate to and/or the HTML code for your link.
Please also post the contents of your app.js file.We cannot even begin to start guessing why you are getting that error without knowing more details.
Can you please try and explain the context of your errors more completely when you are asking questions. It will make it a lot faster and easier for us to help you out. -
Sorry Jared. You are right. I am getting an error opening a custom page from a button click on one of my pages.
Here is my app.js file.
0_1472833196236_apps.jsHere is my HTML code for the page where I am using a button to go to a custom page.
0_1472833228093_page1.htmlI added the custom pages into the views/dashboards/ file
For quick reference, here is a snippet of the app.js file// define our pages, these are added to the $stateProvider in the config block below
myAdminApp.constant('PAGES', [
{
state: 'dashboard',
url: '/dashboard',
templateUrl: 'views/dashboard/main.html',
resolve: {
auth: ['$rootScope', 'User', function($rootScope, User) {
// retrieves the current user when we navigate to a dashboard page
// if an error occurs the $stateChangeError listener redirects to the login page
$rootScope.user = User.current();
return $rootScope.user.$promise;
}],
dashboardTranslations: ['Translate', function(Translate) {
// load any translation namespaces you want to use in your app up-front
// so they can be used by the 'tr' filter
return Translate.loadNamespaces(['dashboards']);
}]
}
},
{
state: 'login',
url: '/login',
templateUrl: 'views/login.html',
resolve: {
loginTranslations: ['Translate', function(Translate) {
return Translate.loadNamespaces('login');
}]
}
},
{
state: 'dashboard.home',
url: '/home',
templateUrl: 'views/dashboard/home.html',
menuTr: 'dashboards.v3.dox.home',
//menuIcon: 'fa fa-home', // font awesome css classes for icon
menuType: 'link'
},
{
state: 'dashboard.apiErrors',
url: '/api-errors',
templateUrl: 'views/dashboard/errors.html',
menuTr: 'dashboards.v3.dox.apiErrors'
},
{
state: 'dashboard.power',
url: '/power',
templateUrl: 'views/dashboard/power.html',
// menuTr: 'dashboards.v3.dox.power'
menuhidden: true
},
{
state: 'dashboard.heating',
url: '/gas',
templateUrl: 'views/dashboard/heating.html',
// menuTr: 'dashboards.v3.dox.gas'
menuhidden: true
},
{
state: 'dashboard.cooling',
url: '/power',
templateUrl: 'views/dashboard/cooling.html',
// menuTr: 'dashboards.v3.dox.cooling'
menuhidden: true
},
{
state: 'dashboard.water',
url: '/water',
templateUrl: 'views/dashboard/water.html',
// menuTr: 'dashboards.v3.dox.water'
menuhidden: true
}, -
OK I think that your problem is that you have the same url in both state
dashboard.power
anddashboard.cooling
.
Also your menu items won't be hidden as the property name ismenuHidden
notmenuhidden
(should have a capital H). -
OK. I have fixed those items. It is still giving me that error.
-
@atkins.chrisw
Have you cleared your browser cache? -
Yes. Whats weird is that the Home button works. It will send me back home.
-
I reloaded all of my files in my server and it is now working.
Thanks again Jared. Sorry I keep being a pain