<commit_before>(function () {
  "use strict";

  angular
    .module('mnPoolDefault', [
      'mnPools'
    ])
    .factory('mnPoolDefault', mnPoolDefaultFactory);

  function mnPoolDefaultFactory($http, $q, mnPools, $window, $location, $httpParamSerializerJQLike, mnHelper) {
    var latest = {};
    var mnPoolDefault = {
      latestValue: latestValue,
      get: get,
      clearCache: clearCache,
      getFresh: getFresh,
      getUrlsRunningService: getUrlsRunningService,
      export: {
        compat: undefined
      }
    };
    var version25 = encodeCompatVersion(2, 5);
    var version30 = encodeCompatVersion(3, 0);
    var version40 = encodeCompatVersion(4, 0);
    var version45 = encodeCompatVersion(4, 5);
    var version46 = encodeCompatVersion(4, 6);
    var version50 = encodeCompatVersion(5, 0);
    var cache;
    var request;

    return mnPoolDefault;

    function latestValue() {
      return latest;
    }
    // counterpart of ns_heart:effective_cluster_compat_version/0
    function encodeCompatVersion(major, minor) {
      if (major < 2) {
        return 1;
      }
      return major * 0x10000 + minor;
    }
    function get(params, mnHttpParams) {
      if (!(params && params.etag) && cache) {
        return $q.when(cache);
      }
      if (request && !cache) {
        return request;
      }
      params = params || {waitChange: 0};
      request = $q.all([
        $http({
          mnHttp: mnHttpParams,
          method: 'GET',
          url: '/pools/default',
          params: params,
          timeout: 30000
        }),
        mnPools.get(mnHttpParams)
      ]).then(function (resp) {
        var poolDefault = resp[0].data;
        var pools = resp[1]
        poolDefault.rebalancing = poolDefault.rebalanceStatus !== 'none';
        //TODO replace serverGroupsUri in isGroupsAvailable using mixed cluster version
        poolDefault.isGroupsAvailable = !!(pools.isEnterprise && poolDefault.serverGroupsUri);
        poolDefault.isEnterprise = pools.isEnterprise;
        poolDefault.thisNode = _.detect(poolDefault.nodes, function (n) {
          return n.thisNode;
        });
        poolDefault.compat = {
          atLeast25: poolDefault.thisNode.clusterCompatibility >= version25,
          atLeast30: poolDefault.thisNode.clusterCompatibility >= version30,
          atLeast40: poolDefault.thisNode.clusterCompatibility >= version40,
          atLeast45: poolDefault.thisNode.clusterCompatibility >= version45,
          atLeast46: poolDefault.thisNode.clusterCompatibility >= version46,
          atLeast50: poolDefault.thisNode.clusterCompatibility >= version50
        };
        poolDefault.isKvNode =  _.indexOf(poolDefault.thisNode.services, "kv") > -1;
        poolDefault.capiBase = $window.location.protocol === "https:" ? poolDefault.thisNode.couchApiBaseHTTPS : poolDefault.thisNode.couchApiBase;

        _.extend(mnPoolDefault.export, poolDefault);
        latest.value = poolDefault; //deprecated and superseded by mnPoolDefault.export
        cache = poolDefault;<commit_msg>make UI aware of Vulcan compat mode<commit_after>(function () {
  "use strict";

  angular
    .module('mnPoolDefault', [
      'mnPools'
    ])
    .factory('mnPoolDefault', mnPoolDefaultFactory);

  function mnPoolDefaultFactory($http, $q, mnPools, $window, $location, $httpParamSerializerJQLike, mnHelper) {
    var latest = {};
    var mnPoolDefault = {
      latestValue: latestValue,
      get: get,
      clearCache: clearCache,
      getFresh: getFresh,
      getUrlsRunningService: getUrlsRunningService,
      export: {
        compat: undefined
      }
    };
    var version25 = encodeCompatVersion(2, 5);
    var version30 = encodeCompatVersion(3, 0);
    var version40 = encodeCompatVersion(4, 0);
    var version45 = encodeCompatVersion(4, 5);
    var version46 = encodeCompatVersion(4, 6);
    var version50 = encodeCompatVersion(5, 0);
    var version51 = encodeCompatVersion(5, 1);
    var cache;
    var request;

    return mnPoolDefault;

    function latestValue() {
      return latest;
    }
    // counterpart of ns_heart:effective_cluster_compat_version/0
    function encodeCompatVersion(major, minor) {
      if (major < 2) {
        return 1;
      }
      return major * 0x10000 + minor;
    }
    function get(params, mnHttpParams) {
      if (!(params && params.etag) && cache) {
        return $q.when(cache);
      }
      if (request && !cache) {
        return request;
      }
      params = params || {waitChange: 0};
      request = $q.all([
        $http({
          mnHttp: mnHttpParams,
          method: 'GET',
          url: '/pools/default',
          params: params,
          timeout: 30000
        }),
        mnPools.get(mnHttpParams)
      ]).then(function (resp) {
        var poolDefault = resp[0].data;
        var pools = resp[1]
        poolDefault.rebalancing = poolDefault.rebalanceStatus !== 'none';
        //TODO replace serverGroupsUri in isGroupsAvailable using mixed cluster version
        poolDefault.isGroupsAvailable = !!(pools.isEnterprise && poolDefault.serverGroupsUri);
        poolDefault.isEnterprise = pools.isEnterprise;
        poolDefault.thisNode = _.detect(poolDefault.nodes, function (n) {
          return n.thisNode;
        });
        poolDefault.compat = {
          atLeast25: poolDefault.thisNode.clusterCompatibility >= version25,
          atLeast30: poolDefault.thisNode.clusterCompatibility >= version30,
          atLeast40: poolDefault.thisNode.clusterCompatibility >= version40,
          atLeast45: poolDefault.thisNode.clusterCompatibility >= version45,
          atLeast46: poolDefault.thisNode.clusterCompatibility >= version46,
          atLeast50: poolDefault.thisNode.clusterCompatibility >= version50,
          atLeast51: poolDefault.thisNode.clusterCompatibility >= version51
        };
        poolDefault.isKvNode =  _.indexOf(poolDefault.thisNode.services, "kv") > -1;
        poolDefault.capiBase = $window.location.protocol === "https:" ? poolDefault.thisNode.couchApiBaseHTTPS : poolDefault.thisNode.couchApiBase;

        _.extend(mnPoolDefault.export, poolDefault);
        latest.value = poolDefault; //deprecated and superseded by mnPoolDefault.export
        cache = poolDefault;
{'fraction_non_alphanumeric': 0.10557513617430311, 'fraction_numerical': 0.02242870874719641, 'mean_word_length': 2.7608433734939757, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 18, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2395289', 'n_tokens_mistral': 1885, 'n_tokens_neox': 1780, 'n_words': 380}