startPolling: function(){
   if(!this.get('isWorking')){
     return false;
   }
   App.updater.run(this, 'loadUpdatedStatus', 'isWorking', App.componentsUpdateInterval); //update will not run it immediately
   App.updater.run(this, 'loadAlerts', 'isWorking'); //update will not run it immediately
   return true;
 }.observes('isWorking'),
Ejemplo n.º 2
0
 it(tests.t4.m, function() {
   App.updater.run(tests.t4.obj, 'method3', 'isWorking');
   this.clock.tick(10000);
   tests.t4.obj.set('isWorking', false);
   this.clock.tick(5000);
   expect(tests.t4.obj.method3.called).to.be.false;
 });
Ejemplo n.º 3
0
 updateAll: function () {
   if (this.get('isWorking')) {
     App.updater.run(this, 'updateServices', 'isWorking');
     App.updater.run(this, 'updateHost', 'isWorking');
     App.updater.run(this, 'updateServiceMetricConditionally', 'isWorking', App.componentsUpdateInterval);
     App.updater.run(this, 'updateComponentsState', 'isWorking', App.componentsUpdateInterval);
     App.updater.run(this, 'graphsUpdate', 'isWorking');
     if (App.supports.hostOverrides) {
       App.updater.run(this, 'updateComponentConfig', 'isWorking');
     }
   }
 }.observes('isWorking'),
 setTimeout(function(){
   App.updater.immediateRun('loadUpdatedStatus');
 }, delay);
Ejemplo n.º 5
0
 it(tests.t5.m, function () {
   App.updater.run(tests.t5.obj, 'method4', 'isWorking', 15000, 'pattern');
   this.clock.tick(15000);
   expect(tests.t5.obj.method4.called).to.be.false;
 });
Ejemplo n.º 6
0
 it(tests.t3.m, function() {
   App.updater.run(tests.t3.obj, 'method2', 'isWorking');
   App.updater.immediateRun('method2');
   expect(tests.t3.obj.method2.called).to.be.ok;
 });
Ejemplo n.º 7
0
 it(tests.t2.m, function() {
   var methodCall = App.updater.run(tests.t2.obj, 'method', 'isWorking');
   expect(methodCall).to.be.false;
 });
Ejemplo n.º 8
0
 it(tests.t1.m, function() {
   App.updater.run(tests.t1.obj, 'method', 'isWorking');
   this.clock.tick(15000);
   expect(tests.t1.obj.method.called).to.be.ok;
 });
Ejemplo n.º 9
0
  updateHost: function (callback, error) {
    var testUrl = App.get('isHadoop2Stack') ? '/data/hosts/HDP2/hosts.json' : '/data/hosts/hosts.json',
      self = this,
      hostDetailsFilter = '';
    var realUrl = '/hosts?<parameters>fields=Hosts/host_name,Hosts/maintenance_state,Hosts/public_host_name,Hosts/cpu_count,Hosts/ph_cpu_count,Hosts/total_mem,' +
      'Hosts/host_status,Hosts/last_heartbeat_time,Hosts/os_arch,Hosts/os_type,Hosts/ip,host_components/HostRoles/state,host_components/HostRoles/maintenance_state,' +
      'host_components/HostRoles/stale_configs,host_components/HostRoles/service_name,metrics/disk,metrics/load/load_one,metrics/cpu/cpu_system,metrics/cpu/cpu_user,' +
      'metrics/memory/mem_total,metrics/memory/mem_free,alerts/summary&minimal_response=true';

    if (App.router.get('currentState.name') == 'index' && App.router.get('currentState.parentState.name') == 'hosts') {
      App.updater.updateInterval('updateHost', App.get('contentUpdateInterval'));
    }
    else {
      if(App.router.get('currentState.name') == 'summary' && App.router.get('currentState.parentState.name') == 'hostDetails') {
        hostDetailsFilter = App.router.get('location.lastSetURL').match(/\/hosts\/(.*)\/summary/)[1];
        App.updater.updateInterval('updateHost', App.get('componentsUpdateInterval'));
      }
      else {
        callback();
        // On pages except for hosts/hostDetails, making sure hostsMapper loaded only once on page load, no need to update, but at least once
        if (this.get('queryParams.Hosts') && this.get('queryParams.Hosts').length > 0) {
          return;
        }
      }
    }
    var mainHostController = App.router.get('mainHostController'),
      sortProperties = mainHostController.getSortProperties();
    if (hostDetailsFilter) {
      //if host details page opened then request info only of one displayed host
      this.get('queryParams').set('Hosts', [
        {
          key: 'Hosts/host_name',
          value: [hostDetailsFilter],
          type: 'MULTIPLE'
        }
      ]);
    } else {
      this.get('queryParams').set('Hosts', mainHostController.getQueryParameters(true));
    }
    var clientCallback = function (skipCall, queryParams) {
      if (skipCall) {
        //no hosts match filter by component
        App.hostsMapper.map({
          items: [],
          itemTotal: '0'
        });
        callback();
      }
      else {
        var params = self.computeParameters(queryParams),
          paginationProps = self.computeParameters(queryParams.filter(function (param) {
            return (this.get('paginationKeys').contains(param.key));
          }, self)),
          sortProps = self.computeParameters(sortProperties);

        if ((params.length + paginationProps.length + sortProps.length) > 0) {
          realUrl = App.get('apiPrefix') + '/clusters/' + App.get('clusterName') +
            realUrl.replace('<parameters>', '') +
            (paginationProps.length > 0 ? '&' + paginationProps.substring(0, paginationProps.length - 1) : '') +
            (sortProps.length > 0 ? '&' + sortProps.substring(0, sortProps.length - 1) : '');
          App.HttpClient.get(realUrl, App.hostsMapper, {
            complete: callback,
            doGetAsPost: true,
            params: params.substring(0, params.length - 1),
            error: error
          });
        }
        else {
          var hostsUrl = self.getComplexUrl(testUrl, realUrl, queryParams);
          App.HttpClient.get(hostsUrl, App.hostsMapper, {
            complete: callback,
            doGetAsPost: false,
            error: error
          });
        }
      }
    };

    if (!this.preLoadHosts(clientCallback)) {
      clientCallback(false, self.get('queryParams.Hosts'));
    }
  },
Ejemplo n.º 10
0
 didInsertElement: function () {
   this.set('controller.isRangerUpdateWorking', true);
   App.updater.run(this.get('controller'), 'updateRangerPluginsStatus', 'isRangerUpdateWorking', App.bgOperationsUpdateInterval);
   App.updater.immediateRun('updateRangerPluginsStatus');
 },