Group Details Private

administrators

 
  • 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