PageRenderTime 26ms CodeModel.GetById 20ms RepoModel.GetById 1ms app.codeStats 0ms

/plugins/hq/_site/js/collection/node/NodeStatsListModel.js

https://gitlab.com/zouxc/elasticsearch-cn-out-of-box
JavaScript | 53 lines | 28 code | 1 blank | 24 comment | 7 complexity | 0e399caf9337e11764622efa0af2cab5 MD5 | raw file
  1. /*
  2. Copyright 2013 Roy Russo
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. Latest Builds: https://github.com/royrusso/elasticsearch-HQ
  13. http://localhost:9200/_cluster/nodes/XXX/stats
  14. */
  15. /*****
  16. * settings, os, process, jvm, thread_pool, network, transport, http and plugin, all
  17. * @type {*}
  18. */
  19. var NodeStatsListModel = Backbone.Model.extend({//Backbone.Collection.extend({
  20. defaults:{
  21. selectedNodes:undefined
  22. },
  23. initialize:function () {
  24. console.log("Inside NodeStatsListModel");
  25. },
  26. url:function () {
  27. var sNodes = this.get('selectedNodes');
  28. if (sNodes == undefined || sNodes.length == 0) {
  29. return '/_cluster/nodes/stats?all=1';
  30. }
  31. else {
  32. var nodes = '';
  33. for (var i = 0; i < sNodes.length; i++) {
  34. nodes = nodes + sNodes[i];
  35. if (sNodes.length - 1 > i) {
  36. nodes = nodes + ',';
  37. }
  38. }
  39. return '/_cluster/nodes/' + nodes + '/stats?all=1';
  40. }
  41. //return '/_nodes/stats?clear=true&os=false'; // test for incomplete dataset returns from server.
  42. },
  43. fetch:function (options) {
  44. ajaxloading.show();
  45. this.constructor.__super__.fetch.apply(this, arguments);
  46. }
  47. });