• phildunlap

    You can subscribe to the points in the loop, but you only need one websocket to service all the points you would subscribe to.

    posted in Dashboard Designer & Custom AngularJS Pages read more
  • phildunlap

    For values from the past you should continue to use the point-values endpoint. Iirc, the majority of your queries were only for the current, latest value, which the websocket can keep up to date for you.

    posted in Dashboard Designer & Custom AngularJS Pages read more
  • phildunlap

    My mistake, forgot to put the subscription in the onopen function like,

    var myWs = new WebSocket("ws://" + window.location.host + "/rest/v1/websocket/point-value");
    // use wss:// for https://
    
    myWs.onmessage = function( message ) {
          console.log( JSON.parse(message.data) );
      }
    
    myWs.subscribePoint = function(xid) {
      myWs.send('{"xid":"' + xid + '","eventTypes":["ATTRIBUTE_CHANGE","INITIALIZE","REGISTERED","TERMINATE","UPDATE"]}');
    }
    
    myWs.unsubscribePoint = function(xid) {
      myWs.send('{"xid":"' + xid + '","eventTypes":[]}');
    }
    
    myWs.onopen = function() { myWs.subscribePoint("DP_1234") }; //change to a data point's xid from your system that updates somewhat often
    

    posted in Dashboard Designer & Custom AngularJS Pages read more
  • phildunlap

    Was this on a browser tab that was logged in to Mango?

    Yeah, the first part of the comment was to show the structure of the message passed into the onmessage function. The console.log is actual code at least...

    posted in Dashboard Designer & Custom AngularJS Pages read more
  • phildunlap

    Hi Ian,

    You could do this by modifying the Mango/web/modules/mangoUI/web/mangoUi.js file. The string Mango v3 only appears in the relevant place (you'll need to address the use of titleSuffix elsewhere in the file, probably).

    The <title> element is in Mango/web/modules/mangoUI/web/ui/index.html

    Modifying those will not persist through an upgrade. While you could put them into Mango/overrides/web/modules/mangoUI/web[/ui] I would not advise it, since that could break other things in the UI upon update.

    posted in User help read more
  • phildunlap

    ...Everything in the onmessage function is still commented out... And, you only need to create one websocket so long as it is working, then subscribe to all the points you need via the functions I provided on the websocket. So, you probably don't want to be calling this function as you used to.

    Y'know, you really should just enter this into your browser's developer console and play with it until you have some idea.

    var myWs = new WebSocket("ws://" + window.location.host + "/rest/v1/websocket/point-value");
    // use wss:// for https://
    
    myWs.onmessage = function( message ) {
          console.log( JSON.parse(message.data) );
      }
    
    myWs.subscribePoint = function(xid) {
      myWs.send('{"xid":"' + xid + '","eventTypes":["ATTRIBUTE_CHANGE","INITIALIZE","REGISTERED","TERMINATE","UPDATE"]}');
    }
    
    myWs.unsubscribePoint = function(xid) {
      myWs.send('{"xid":"' + xid + '","eventTypes":[]}');
    }
    
    myWs.subscribePoint( "DP_1234" ); //change to a data point's xid from your system that updates somewhat often
    

    posted in Dashboard Designer & Custom AngularJS Pages read more
  • phildunlap

    Hi joeselbiyoyo,

    i am not able to reflect any settable datapoint into my customized web pages

    I do not know what the word 'reflect' means in that context.

    You can see how the watchlist table is coded here: https://github.com/infiniteautomation/ma-dashboards/blob/main/UI/web-src/ui/directives/watchList/watchListTable.html

    I do not believe there is a <ma-watch-list-table> directive.

    posted in Mango Automation general Discussion read more
  • phildunlap

    I would think it would work fine in the same place. Should just need to be in some JavaScript that gets executed, which that excerpt must. You may also need to do something like check the myWs.readyState periodically to see if it closed or not connected for some reason (then you'd need to create a new websocket), but I wouldn't worry about that at first.

    posted in Dashboard Designer & Custom AngularJS Pages read more
  • phildunlap

    Hi Ava2018, welcome to the forum!

    On the NoSQL database, I would recommend someone attempt to achieve that via either counting the points' value from a script in Mango and outputting a list of points with over or under counts into alphanumeric points, something like

    var overcounts = [];
    var undercounts = [];
    for(var contextPoint in CONTEXT_POINTS) {
        var count = this[contextPoint].past(DAY].count;
        if( count > 2880 )
            overcounts.push( this[contextPoint].getDataPointWrapper().getExtendedName() );
        else if( count < 2880 )
            undercounts.push( this[contextPoint].getDataPointWrapper().getExtendedName() );
    }
    //these two points would be alphanumeric points on the scripting data source:
    overcountPoint.set(JSON.stringify(overcounts));
    undercountPoint.set(JSON.stringify(undercounts));
    

    or that they achieve it by querying a /rest/v2/point-values/ endpoint for a count rollup,

    I should also say that we mitigated the issue of multiple context points updating at the same millisecond being a great source of inefficiency by tracking if there are multiple updates at the latest millisecond and only accepting one of them. It doesn't mitigate the issue if the values are backdated, though. The updates only trigger the execution, but their having arrived is not necessary for the values to be available in the cache, but it is a race condition and one of the possible reasons to introduce an execution delay on a meta point.

    You could also have the meta points executing on a cron, which would eliminate the issue.

    posted in Mango Automation general Discussion read more
  • phildunlap

    What question are you running into? Aren't you already updating the page in a callback from an API query? You would just update the same scope / view via the websocket onmessage function instead, where the messages should have a form similar to what I posted as a comment in that function.

    posted in Dashboard Designer & Custom AngularJS Pages read more
  • phildunlap

    To the question of the text in the tag select box, it looks like that's done with transclusion like,

        <md-input-container>
            <ma-data-point-tag-select ng-model="maDeviceSelect" key='device' restrictions="{Site:maSiteTagSelect}" >
                <ma-label>Plant or Equipment for the selected Project</ma-label>
            </ma-data-point-tag-select>
        </md-input-container>
    

    And to the initial display issue if you do hardcode the series axis sides, you should be about to do something like,

    <ma-serial-chart ng-if="points.length > 0" .... ></ma-serial-chart>
    

    to prevent it from showing up when empty with an enormous legend.

    posted in Dashboard Designer & Custom AngularJS Pages read more
  • phildunlap

    How did I not think of that??

    Because it's...... hard code

    :-)

    posted in Dashboard Designer & Custom AngularJS Pages read more
  • phildunlap

    Hi Desmond,

    Craig has led you astray. The JavaScript engine is bundled into the Java distribution, and if you are using Java 8 (which is currently the version we recommend) you are on the Nashorn JavaScript engine. If you are using Java 7, you are probably also using an old version of Mango, but you should be able to use Java 8 on that old version. RhinoJS was the JavaScript engine in 7.. Stack overflow would have me believe JDK8 may only have a subset of ES6 available to it: https://stackoverflow.com/questions/46898540/unable-to-execute-es6-on-java-8-with-nashornscriptengine including no arrow functions.

    You can probably run Mango on Java 9 as things are right now,but there may be lingering compatibility issues as we haven't focused on moving to Java 9, 10, 11 (so many to choose from...). But I believe we've at least fixed the bugs that prevent you from using 9 or 10 (there may be some issues on the github for the ma-core-public project concerning known incompatibilities, like I believe there is some issue starting on SSL in Java 10, etc.)

    To the question of ES6, Nashorn DOES support ES6 (or at least some), but not by default. One need either instantiate the JavaScript engine with the ES6 flag (we've discussed making arguments possible to send to the script engine factory, since there are other cool options too!), or set it more globally with an ext-enabled script, then stopping, then starting (not restarting) Mango like,

    #!/bin/bash
    case "$1" in
        init)
            # Start with Nashorn toggled to support some ES6 features
            JAVAOPTS="$JAVAOPTS -Dnashorn.args=--language=es6"
            ;;
    esac
    

    posted in Scripting general Discussion read more
  • phildunlap

    Hi Ian,

    Currently the answer seems to be no. While browsers will almost assuredly be redirected to HTTPS, it is possible for REST requests to still be sent over HTTP (I tested using token auth). You have started a discussion on the topic though!

    Indeed doing the redirect at the proxy / firewall will be more complete for the moment.

    posted in User help read more
  • phildunlap

    Please check for a related event on the events page.

    Doesn't seem like the actual polling for data would be different for the different data types, The only part that is very concerned with the data type of the point is the variableToValue and valueToVariable functions but both of those should be able to handle a Gauge and Numeric. I shared with you the variableToValue function before: https://forum.infiniteautomation.com/topic/3887/snmp-host-testing

    Please could You tellme how to make a script.

    Create a meta data source. Create a meta data point. Add the point you wish to divide by 10 into context,

    return p.value / 10; //where p is the variable name of the context point
    

    posted in How-To read more
  • phildunlap

    Hi Ian,

    Huh. I was readily able to reproduce. How strange. I have made this issue for it: https://github.com/infiniteautomation/ma-dashboards/issues/169

    Thanks for bringing it to our attention!

    posted in User help read more
  • phildunlap

    Hmm. And no events about why it's not working?

    Yes you can definitely make a meta point and transform the value that way.

    posted in How-To read more
  • phildunlap

    Hi glamprecht,

    While I do ambiguously omit the http://host.extension:port/ I do so because I abhor loose hyperlinks. If I have a path that begins with /ui/ it's probably a path in Mango. Same if it ends with .shtm . You can edit the JSON Store through the JSON Store menu item under the administration menu in the UI or by going directly to the URL.

    posted in Dashboard Designer & Custom AngularJS Pages read more
  • phildunlap

    Hi glamprecht,

    You can use a parameter of type data source. Then you can use that data source object in crafting the RQL for the query on the 1 watchlist it would take to achieve what I think you're asking.

    Go to the Watchlist Builder, make a new point query watchlist
    0_1544643861891_step1.png

    Add a data source parameter
    0_1544643899633_step2.png

    Refer to the value of that parameter, which in this case is a data source object, in the RQL query. I am using the Data Source XID for I need to use the interpolated value {{DS.xid}} to get that xid from the data source model.
    0_1544643923734_step3.png

    Profit!
    0_1544643934663_step4.png

    posted in Dashboard Designer & Custom AngularJS Pages read more
  • phildunlap

    Certainly!

    You can preload the ma-serial-chart with series-n-axis desginations, like

    series-1-axis="left" series-2-axis="left" series-3-axis="right" series-4-axis="right"

    but that may have an initial display issue. It also may only be supported up to 99

    Someone else may contribute a cleaner way of doing it.

    posted in Dashboard Designer & Custom AngularJS Pages read more