{"size": 1451, "ext": "js", "max_stars_repo_path": "scripts/quotascheck.js", "max_stars_repo_name": "vlobzakov/tomcat-cluster", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "scripts/quotascheck.js", "max_issues_repo_name": "vlobzakov/tomcat-cluster", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "scripts/quotascheck.js", "max_forks_repo_name": "vlobzakov/tomcat-cluster", "max_forks_repo_forks_event_min_datetime": "2021-04-16T07:37:22.000Z", "max_forks_repo_forks_event_max_datetime": "2021-04-28T13:32:14.000Z"}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": 5, "avg_line_length": 40.3055555556, "max_line_length": 317, "alphanum_fraction": 0.6037215713}
var MAX_CLOUDLET = "environment.maxcloudletsperrec",
    SAME_NODES = "environment.maxsamenodescount",
    MAX_NODES = "environment.maxnodescount",
    SSL = "environment.jelasticssl.enabled";

var max = 10, cloudlets = 6, min = 2, resp, name, value, ssl, markup = "", q = jelastic.billing.account.GetQuotas(MAX_NODES + ";" + SAME_NODES + ";" + MAX_CLOUDLET + ";" + SSL).array || [];

for (var i = 0, n = q.length; i < n; i++) {
  name = q[i].quota.name;
  value = q[i].value;

  if (name == SSL) { 
    ssl = !!value;
    continue;
  }
  
  if (name == MAX_CLOUDLET && value < cloudlets) {
    markup = "Quota limits: " + name + " = " + value + ".  Please upgrade your account.";
    continue;
  }
  if (max >= value) {
    if (name == MAX_NODES) max = value ? value - 1 : 1;
      else if (name == SAME_NODES) max = value;
  }

}
resp = {result: 0, settings: {fields: [{type: "spinner", name: "nodes", caption: "Nodes Count", min: 2, max: max, "default": Math.min(min, max)},{"caption":"Stack","type":"list","name":"stack","default":"tomcat","required":true,"values":[{"value":"tomcat","caption":"Tomcat"},{"value":"tomee","caption":"TomEE"}]}]}};
resp.ssl = ssl;

if (markup) {
resp.settings.fields.push(
  {"type": "displayfield", "cls": "warning", "height": 30, "hideLabel": true, "markup": markup},
  {"type": "compositefield","height": 0,"hideLabel": true,"width": 0,"items": [{"height": 0,"type": "string","required": true}]});
}
return resp;
