• B
    BobDay

    @mattfox said in ma-point-value: number formatting:

    point.value.toFixed(1)

    you can also use a built-in Angular filter -
    {{point.value | number(decimal places)}}

    ...even when doing things you can't do more than basics - like
    {{point.value*256 | number(1)}}

    edit. Jared Wiltshire - examples given here are incorrect, see post by @Puckfist below.

    posted in How-To read more
  • B
    BobDay

    Thanks, @Jared-Wiltshire. The problem seems to be as follows:

    If started from root (which I don't want to do, of course) with the --no-sandbox switch, everything works fine.

    if started from regular user, it appears there is an X server bug -

    Fatal server error:
    (EE) parse_vt_settings: Cannot open /dev/tty0 (Permission denied)
    

    Dealt with permissions, but then another similar permissions error...

    After fixing permissions on the tty files, it works now without having to run as root.

    Any experience with minimal Firefox kiosk use? Couldn't find much of value out there. Thanks again.

    edit: for anyone who comes across this, and keeping in mind that I have only vague knowledge of how xserver works, the environment needs access to a number of /dev/tty files. I had to change permissions (a+rw) in tty files in 3 successive attempts, until successful. In my case it was tty0, tty7, tty2. This is specific at least to xorg compiled with raspberian stretch lite as of 12/20/2018.

    posted in Mango Automation general Discussion read more
  • B
    BobDay

    @jared-wiltshire said in amCharts - maTankLevel center chart column in div:

    marginRight: -74

    Aha! Thank you Jared! I was barking up another tree... sorry for all the code - TMI

    posted in User help read more
  • B
    BobDay

    Thanks for all the help.

    posted in User help read more
  • B
    BobDay

    so WE did! same problem tho.

    lets take this back to chat...

    posted in User help read more
  • B
    BobDay

    ok, @MattFox... I feel like a post (as in dumb as one). Can you refresh me again as to how to now break out (and where to declare) the component's controller in its own file?

    userModule.js

    define(['angular', 'require','./push/pushLamp.js'],
      function (angular, require, pushLamp) {
        var userModule = angular.module('userModule', ['maUiApp']);
    
        userModule.filter('unsafe', ['$sce', function($sce) {
           return $sce.trustAsHtml;
        }]);
    
        try
        {
          userModule.component('pushLamp',pushLamp);
        }
        catch(e)
        {
          console.log('error: ', e);
        }
        return userModule.js;
    
    });
    

    pushLamp.js:

    define(['angular', 'require'], function (angular, require) {
    
      pushCtrl.$inject = ['$scope','$timeout'];
    
      function pushCtrl($scope,$timeout) {
    
        const $ctrl = this;
        $ctrl.$onChanges = function (changes) {
          if (changes.points && Array.isArray($ctrl.points)) {
    
            $ctrl.point = $ctrl.points.find(p => p.xid === 'DP_ind_' + $ctrl.target);
            $ctrl.switchPoint = $ctrl.points.find(p => p.xid === 'DP_sw_' + $ctrl.target);
    
            $ctrl.ptCSS = { // point css values for color and blink; ex, ng-class=""
              get color(){
                if ($ctrl.point.color < 10) {
                  return 0;
                }
                return Math.floor($ctrl.point.value / 10)},
              get blink(){return 'blink' + $ctrl.point.value % 10},
              get colStyle(){return 'color'+this.color}
            };
    
            $timeout(function() {
              console.log('color:', $ctrl.ptCSS.colStyle, 'blink:', $ctrl.ptCSS.blink );
            },1000);
          }
        };
    
        $ctrl.pushed = function() {
          console.log($ctrl.switchPoint.value);
            if ($ctrl.switchPoint) {
                $ctrl.switchPoint.toggleValue();
              console.log('switch ' + $ctrl.target + ' was switched.' );
           }
        };
      }
    
    return {
          templateUrl: '/modules/mangoUI/web/dev/push/push.html',
          bindings: {
            points: '<',
            target: '@'
          },
          controller: pushCtrl
        };
    
    });

    posted in User help read more