services.js 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773
  1. /*jshint globalstrict:true */
  2. /*global angular:true */
  3. /*global Blob:false*/
  4. 'use strict';
  5. angular.module('kibana.services', [])
  6. .service('eventBus', function($rootScope) {
  7. // An array of registed types
  8. var _types = [];
  9. this.broadcast = function(from,to,type,data) {
  10. if(_.isUndefined(data)) {
  11. data = from;
  12. }
  13. var packet = {
  14. time: new Date(),
  15. type: type,
  16. from: from,
  17. to: to,
  18. data: data
  19. };
  20. if(_.contains(_types,'$kibana_debug')) {
  21. $rootScope.$broadcast('$kibana_debug',packet);
  22. }
  23. $rootScope.$broadcast(type,{
  24. from: from,
  25. to: to,
  26. data: data
  27. });
  28. };
  29. // This sets up an $on listener that checks to see if the event (packet) is
  30. // addressed to the scope in question and runs the registered function if it
  31. // is.
  32. this.register = function(scope,type,fn) {
  33. _types = _.union(_types,[type]);
  34. scope.$on(type,function(event,packet){
  35. var _id = scope.$id;
  36. var _to = packet.to;
  37. var _from = packet.from;
  38. var _type = packet.type;
  39. var _time = packet.time;
  40. var _group = (!(_.isUndefined(scope.panel))) ? scope.panel.group : ["NONE"];
  41. if(!(_.isArray(_to))) {
  42. _to = [_to];
  43. }
  44. if(!(_.isArray(_group))) {
  45. _group = [_group];
  46. }
  47. // Transmit event only if the sender is not the receiver AND one of the following:
  48. // 1) Receiver has group in _to 2) Receiver's $id is in _to
  49. // 3) Event is addressed to ALL 4) Receiver is in ALL group
  50. if((_.intersection(_to,_group).length > 0 ||
  51. _.indexOf(_to,_id) > -1 ||
  52. _.indexOf(_group,'ALL') > -1 ||
  53. _.indexOf(_to,'ALL') > -1) &&
  54. _from !== _id
  55. ) {
  56. fn(event,packet.data,{time:_time,to:_to,from:_from,type:_type});
  57. }
  58. });
  59. };
  60. })
  61. /*
  62. Service: fields
  63. Provides a global list of all seen fields for use in editor panels
  64. */
  65. .factory('fields', function($rootScope) {
  66. var fields = {
  67. list : []
  68. };
  69. $rootScope.$on('fields', function(event,f) {
  70. fields.list = _.union(f.data.all,fields.list);
  71. });
  72. return fields;
  73. })
  74. .service('kbnIndex',function($http) {
  75. // returns a promise containing an array of all indices matching the index
  76. // pattern that exist in a given range
  77. this.indices = function(from,to,pattern,interval) {
  78. var possible = [];
  79. _.each(expand_range(fake_utc(from),fake_utc(to),interval),function(d){
  80. possible.push(d.format(pattern));
  81. });
  82. return all_indices().then(function(p) {
  83. var indices = _.intersection(possible,p);
  84. indices.reverse();
  85. return indices;
  86. });
  87. };
  88. // returns a promise containing an array of all indices in an elasticsearch
  89. // cluster
  90. function all_indices() {
  91. var something = $http({
  92. url: config.elasticsearch + "/_aliases",
  93. method: "GET"
  94. }).error(function(data, status, headers, config) {
  95. // Handle error condition somehow?
  96. });
  97. return something.then(function(p) {
  98. var indices = [];
  99. _.each(p.data, function(v,k) {
  100. indices.push(k);
  101. // Also add the aliases. Could be expensive on systems with a lot of them
  102. _.each(v.aliases, function(v, k) {
  103. indices.push(k);
  104. });
  105. });
  106. return indices;
  107. });
  108. }
  109. // this is stupid, but there is otherwise no good way to ensure that when
  110. // I extract the date from an object that I get the UTC date. Stupid js.
  111. // I die a little inside every time I call this function.
  112. // Update: I just read this again. I died a little more inside.
  113. // Update2: More death.
  114. function fake_utc(date) {
  115. date = moment(date).clone().toDate();
  116. return moment(new Date(date.getTime() + date.getTimezoneOffset() * 60000));
  117. }
  118. // Create an array of date objects by a given interval
  119. function expand_range(start, end, interval) {
  120. if(_.contains(['hour','day','week','month','year'],interval)) {
  121. var range;
  122. start = moment(start).clone();
  123. range = [];
  124. while (start.isBefore(end)) {
  125. range.push(start.clone());
  126. switch (interval) {
  127. case 'hour':
  128. start.add('hours',1);
  129. break;
  130. case 'day':
  131. start.add('days',1);
  132. break;
  133. case 'week':
  134. start.add('weeks',1);
  135. break;
  136. case 'month':
  137. start.add('months',1);
  138. break;
  139. case 'year':
  140. start.add('years',1);
  141. break;
  142. }
  143. }
  144. range.push(moment(end).clone());
  145. return range;
  146. } else {
  147. return false;
  148. }
  149. }
  150. })
  151. .service('timer', function($timeout) {
  152. // This service really just tracks a list of $timeout promises to give us a
  153. // method for cancelling them all when we need to
  154. var timers = [];
  155. this.register = function(promise) {
  156. timers.push(promise);
  157. return promise;
  158. };
  159. this.cancel = function(promise) {
  160. timers = _.without(timers,promise);
  161. $timeout.cancel(promise);
  162. };
  163. this.cancel_all = function() {
  164. _.each(timers, function(t){
  165. $timeout.cancel(t);
  166. });
  167. timers = [];
  168. };
  169. })
  170. .service('query', function(dashboard) {
  171. // Create an object to hold our service state on the dashboard
  172. dashboard.current.services.query = dashboard.current.services.query || {};
  173. _.defaults(dashboard.current.services.query,{
  174. idQueue : [],
  175. list : {},
  176. ids : [],
  177. });
  178. // For convenience
  179. var _q = dashboard.current.services.query;
  180. this.colors = [
  181. "#7EB26D","#EAB839","#6ED0E0","#EF843C","#E24D42","#1F78C1","#BA43A9","#705DA0", //1
  182. "#508642","#CCA300","#447EBC","#C15C17","#890F02","#0A437C","#6D1F62","#584477", //2
  183. "#B7DBAB","#F4D598","#70DBED","#F9BA8F","#F29191","#82B5D8","#E5A8E2","#AEA2E0", //3
  184. "#629E51","#E5AC0E","#64B0C8","#E0752D","#BF1B00","#0A50A1","#962D82","#614D93", //4
  185. "#9AC48A","#F2C96D","#65C5DB","#F9934E","#EA6460","#5195CE","#D683CE","#806EB7", //5
  186. "#3F6833","#967302","#2F575E","#99440A","#58140C","#052B51","#511749","#3F2B5B", //6
  187. "#E0F9D7","#FCEACA","#CFFAFF","#F9E2D2","#FCE2DE","#BADFF4","#F9D9F9","#DEDAF7" //7
  188. ];
  189. // Save a reference to this
  190. var self = this;
  191. this.init = function() {
  192. _q = dashboard.current.services.query;
  193. self.list = dashboard.current.services.query.list;
  194. self.ids = dashboard.current.services.query.ids;
  195. if (self.ids.length === 0) {
  196. self.set({});
  197. }
  198. };
  199. // This is used both for adding queries and modifying them. If an id is passed, the query at that id is updated
  200. this.set = function(query,id) {
  201. if(!_.isUndefined(id)) {
  202. if(!_.isUndefined(self.list[id])) {
  203. _.extend(self.list[id],query);
  204. return id;
  205. } else {
  206. return false;
  207. }
  208. } else {
  209. var _id = nextId();
  210. var _query = {
  211. query: '*',
  212. alias: '',
  213. color: colorAt(_id),
  214. id: _id
  215. };
  216. _.defaults(query,_query);
  217. self.list[_id] = query;
  218. self.ids.push(_id);
  219. return _id;
  220. }
  221. };
  222. this.remove = function(id) {
  223. if(!_.isUndefined(self.list[id])) {
  224. delete self.list[id];
  225. // This must happen on the full path also since _.without returns a copy
  226. self.ids = dashboard.current.services.query.ids = _.without(self.ids,id);
  227. _q.idQueue.unshift(id);
  228. _q.idQueue.sort(function(v,k){
  229. return v-k;
  230. });
  231. return true;
  232. } else {
  233. return false;
  234. }
  235. };
  236. this.findQuery = function(queryString) {
  237. return _.findWhere(self.list,{query:queryString});
  238. };
  239. var nextId = function() {
  240. if(_q.idQueue.length > 0) {
  241. return _q.idQueue.shift();
  242. } else {
  243. return self.ids.length;
  244. }
  245. };
  246. var colorAt = function(id) {
  247. return self.colors[id % self.colors.length];
  248. };
  249. self.init();
  250. })
  251. .service('filterSrv', function(dashboard, ejsResource) {
  252. // Create an object to hold our service state on the dashboard
  253. dashboard.current.services.filter = dashboard.current.services.filter || {};
  254. _.defaults(dashboard.current.services.filter,{
  255. idQueue : [],
  256. list : {},
  257. ids : []
  258. });
  259. // For convenience
  260. var ejs = ejsResource(config.elasticsearch);
  261. var _f = dashboard.current.services.filter;
  262. // Save a reference to this
  263. var self = this;
  264. // Call this whenever we need to reload the important stuff
  265. this.init = function() {
  266. // Accessors
  267. self.list = dashboard.current.services.filter.list;
  268. self.ids = dashboard.current.services.filter.ids;
  269. _f = dashboard.current.services.filter;
  270. _.each(self.getByType('time',true),function(time) {
  271. self.list[time.id].from = new Date(time.from);
  272. self.list[time.id].to = new Date(time.to);
  273. });
  274. };
  275. // This is used both for adding filters and modifying them.
  276. // If an id is passed, the filter at that id is updated
  277. this.set = function(filter,id) {
  278. _.defaults(filter,{mandate:'must'});
  279. filter.active = true;
  280. if(!_.isUndefined(id)) {
  281. if(!_.isUndefined(self.list[id])) {
  282. _.extend(self.list[id],filter);
  283. return id;
  284. } else {
  285. return false;
  286. }
  287. } else {
  288. if(_.isUndefined(filter.type)) {
  289. return false;
  290. } else {
  291. var _id = nextId();
  292. var _filter = {
  293. alias: '',
  294. id: _id
  295. };
  296. _.defaults(filter,_filter);
  297. self.list[_id] = filter;
  298. self.ids.push(_id);
  299. return _id;
  300. }
  301. }
  302. };
  303. this.getBoolFilter = function(ids) {
  304. // A default match all filter, just in case there are no other filters
  305. var bool = ejs.BoolFilter().must(ejs.MatchAllFilter());
  306. var either_bool = ejs.BoolFilter().must(ejs.MatchAllFilter());
  307. _.each(ids,function(id) {
  308. if(self.list[id].active) {
  309. switch(self.list[id].mandate)
  310. {
  311. case 'mustNot':
  312. bool = bool.mustNot(self.getEjsObj(id));
  313. break;
  314. case 'either':
  315. either_bool = either_bool.should(self.getEjsObj(id));
  316. break;
  317. default:
  318. bool = bool.must(self.getEjsObj(id));
  319. }
  320. }
  321. });
  322. return bool.must(either_bool);
  323. };
  324. this.getEjsObj = function(id) {
  325. return self.toEjsObj(self.list[id]);
  326. };
  327. this.toEjsObj = function (filter) {
  328. if(!filter.active) {
  329. return false;
  330. }
  331. switch(filter.type)
  332. {
  333. case 'time':
  334. return ejs.RangeFilter(filter.field)
  335. .from(filter.from)
  336. .to(filter.to);
  337. case 'range':
  338. return ejs.RangeFilter(filter.field)
  339. .from(filter.from)
  340. .to(filter.to);
  341. case 'querystring':
  342. return ejs.QueryFilter(ejs.QueryStringQuery(filter.query));
  343. case 'terms':
  344. return ejs.TermsFilter(filter.field,filter.value);
  345. case 'exists':
  346. return ejs.ExistsFilter(filter.field);
  347. case 'missing':
  348. return ejs.MissingFilter(filter.field);
  349. default:
  350. return false;
  351. }
  352. };
  353. this.getByType = function(type,inactive) {
  354. return _.pick(self.list,self.idsByType(type,inactive));
  355. };
  356. this.removeByType = function(type) {
  357. var ids = self.idsByType(type);
  358. _.each(ids,function(id) {
  359. self.remove(id);
  360. });
  361. return ids;
  362. };
  363. this.idsByType = function(type,inactive) {
  364. var _require = inactive ? {type:type} : {type:type,active:true};
  365. return _.pluck(_.where(self.list,_require),'id');
  366. };
  367. // This special function looks for all time filters, and returns a time range according to the mode
  368. this.timeRange = function(mode) {
  369. var _t = _.where(self.list,{type:'time',active:true});
  370. if(_t.length === 0) {
  371. return false;
  372. }
  373. switch(mode) {
  374. case "min":
  375. return {
  376. from: new Date(_.max(_.pluck(_t,'from'))),
  377. to: new Date(_.min(_.pluck(_t,'to')))
  378. };
  379. case "max":
  380. return {
  381. from: new Date(_.min(_.pluck(_t,'from'))),
  382. to: new Date(_.max(_.pluck(_t,'to')))
  383. };
  384. default:
  385. return false;
  386. }
  387. };
  388. this.remove = function(id) {
  389. if(!_.isUndefined(self.list[id])) {
  390. delete self.list[id];
  391. // This must happen on the full path also since _.without returns a copy
  392. self.ids = dashboard.current.services.filter.ids = _.without(self.ids,id);
  393. _f.idQueue.unshift(id);
  394. _f.idQueue.sort(function(v,k){return v-k;});
  395. return true;
  396. } else {
  397. return false;
  398. }
  399. };
  400. var nextId = function() {
  401. if(_f.idQueue.length > 0) {
  402. return _f.idQueue.shift();
  403. } else {
  404. return self.ids.length;
  405. }
  406. };
  407. // Now init
  408. self.init();
  409. })
  410. .service('dashboard', function($routeParams, $http, $rootScope, $injector, ejsResource, timer, kbnIndex) {
  411. // A hash of defaults to use when loading a dashboard
  412. var _dash = {
  413. title: "",
  414. editable: true,
  415. rows: [],
  416. services: {},
  417. index: {
  418. interval: 'none',
  419. pattern: '_all',
  420. default: '_all'
  421. },
  422. };
  423. // An elasticJS client to use
  424. var ejs = ejsResource(config.elasticsearch);
  425. var gist_pattern = /(^\d{5,}$)|(^[a-z0-9]{10,}$)|(gist.github.com(\/*.*)\/[a-z0-9]{5,}\/*$)/;
  426. // Store a reference to this
  427. var self = this;
  428. var filterSrv,query;
  429. this.current = {};
  430. this.last = {};
  431. $rootScope.$on('$routeChangeSuccess',function(){
  432. // Clear the current dashboard to prevent reloading
  433. self.current = {};
  434. self.indices = [];
  435. route();
  436. });
  437. var route = function() {
  438. // Is there a dashboard type and id in the URL?
  439. if(!(_.isUndefined($routeParams.type)) && !(_.isUndefined($routeParams.id))) {
  440. var _type = $routeParams.type;
  441. var _id = $routeParams.id;
  442. switch(_type) {
  443. case ('elasticsearch'):
  444. self.elasticsearch_load('dashboard',_id);
  445. break;
  446. case ('temp'):
  447. self.elasticsearch_load('temp',_id);
  448. break;
  449. case ('file'):
  450. self.file_load(_id);
  451. break;
  452. default:
  453. self.file_load('default.json');
  454. }
  455. // No dashboard in the URL
  456. } else {
  457. // Check if browser supports localstorage, and if there's a dashboard
  458. if (window.Modernizr.localstorage &&
  459. !(_.isUndefined(window.localStorage['dashboard'])) &&
  460. window.localStorage['dashboard'] !== ''
  461. ) {
  462. var dashboard = JSON.parse(window.localStorage['dashboard']);
  463. _.defaults(dashboard,_dash);
  464. self.dash_load(dashboard);
  465. // No? Ok, grab default.json, its all we have now
  466. } else {
  467. self.file_load('default.json');
  468. }
  469. }
  470. };
  471. // Since the dashboard is responsible for index computation, we can compute and assign the indices
  472. // here before telling the panels to refresh
  473. this.refresh = function() {
  474. if(self.current.index.interval !== 'none') {
  475. if(filterSrv.idsByType('time').length > 0) {
  476. var _range = filterSrv.timeRange('min');
  477. kbnIndex.indices(_range.from,_range.to,
  478. self.current.index.pattern,self.current.index.interval
  479. ).then(function (p) {
  480. if(p.length > 0) {
  481. self.indices = p;
  482. } else {
  483. self.indices = [self.current.index.default];
  484. }
  485. $rootScope.$broadcast('refresh');
  486. });
  487. } else {
  488. // This is not optimal, we should be getting the entire index list here, or at least every
  489. // index that possibly matches the pattern
  490. self.indices = [self.current.index.default];
  491. $rootScope.$broadcast('refresh');
  492. }
  493. } else {
  494. self.indices = [self.current.index.default];
  495. $rootScope.$broadcast('refresh');
  496. }
  497. };
  498. this.dash_load = function(dashboard) {
  499. // Cancel all timers
  500. timer.cancel_all();
  501. // If not using time based indices, use the default index
  502. if(dashboard.index.interval === 'none') {
  503. self.indices = [dashboard.index.default];
  504. }
  505. self.current = _.clone(dashboard);
  506. // Ok, now that we've setup the current dashboard, we can inject our services
  507. query = $injector.get('query');
  508. filterSrv = $injector.get('filterSrv');
  509. // Make sure these re-init
  510. query.init();
  511. filterSrv.init();
  512. if(dashboard.index.interval !== 'none' && filterSrv.idsByType('time').length === 0) {
  513. self.refresh();
  514. }
  515. return true;
  516. };
  517. this.gist_id = function(string) {
  518. if(self.is_gist(string)) {
  519. return string.match(gist_pattern)[0].replace(/.*\//, '');
  520. }
  521. };
  522. this.is_gist = function(string) {
  523. if(!_.isUndefined(string) && string !== '' && !_.isNull(string.match(gist_pattern))) {
  524. return string.match(gist_pattern).length > 0 ? true : false;
  525. } else {
  526. return false;
  527. }
  528. };
  529. this.to_file = function() {
  530. var blob = new Blob([angular.toJson(self.current,true)], {type: "application/json;charset=utf-8"});
  531. // from filesaver.js
  532. window.saveAs(blob, self.current.title+"-"+new Date().getTime());
  533. return true;
  534. };
  535. this.set_default = function(dashboard) {
  536. if (window.Modernizr.localstorage) {
  537. window.localStorage['dashboard'] = angular.toJson(dashboard || self.current);
  538. return true;
  539. } else {
  540. return false;
  541. }
  542. };
  543. this.purge_default = function() {
  544. if (window.Modernizr.localstorage) {
  545. window.localStorage['dashboard'] = '';
  546. return true;
  547. } else {
  548. return false;
  549. }
  550. };
  551. // TOFIX: Pretty sure this breaks when you're on a saved dashboard already
  552. this.share_link = function(title,type,id) {
  553. return {
  554. location : window.location.href.replace(window.location.hash,""),
  555. type : type,
  556. id : id,
  557. link : window.location.href.replace(window.location.hash,"")+"#dashboard/"+type+"/"+id,
  558. title : title
  559. };
  560. };
  561. this.file_load = function(file) {
  562. return $http({
  563. url: "dashboards/"+file,
  564. method: "GET",
  565. }).then(function(result) {
  566. var _dashboard = result.data;
  567. _.defaults(_dashboard,_dash);
  568. self.dash_load(_dashboard);
  569. return true;
  570. },function(result) {
  571. return false;
  572. });
  573. };
  574. this.elasticsearch_load = function(type,id) {
  575. var request = ejs.Request().indices(config.kibana_index).types(type);
  576. var results = request.query(
  577. ejs.IdsQuery(id)
  578. ).doSearch();
  579. return results.then(function(results) {
  580. if(_.isUndefined(results)) {
  581. return false;
  582. } else {
  583. self.dash_load(angular.fromJson(results.hits.hits[0]['_source']['dashboard']));
  584. return true;
  585. }
  586. });
  587. };
  588. this.elasticsearch_save = function(type,title,ttl) {
  589. // Clone object so we can modify it without influencing the existing obejct
  590. var save = _.clone(self.current);
  591. var id;
  592. // Change title on object clone
  593. if (type === 'dashboard') {
  594. id = save.title = _.isUndefined(title) ? self.current.title : title;
  595. }
  596. // Create request with id as title. Rethink this.
  597. var request = ejs.Document(config.kibana_index,type,id).source({
  598. user: 'guest',
  599. group: 'guest',
  600. title: save.title,
  601. dashboard: angular.toJson(save)
  602. });
  603. request = type === 'temp' ? request.ttl(ttl) : request;
  604. // TOFIX: Implement error handling here
  605. return request.doIndex(
  606. // Success
  607. function(result) {
  608. return result;
  609. },
  610. // Failure
  611. function(result) {
  612. return false;
  613. }
  614. );
  615. };
  616. this.elasticsearch_delete = function(id) {
  617. return ejs.Document(config.kibana_index,'dashboard',id).doDelete(
  618. // Success
  619. function(result) {
  620. return result;
  621. },
  622. // Failure
  623. function(result) {
  624. return false;
  625. }
  626. );
  627. };
  628. this.elasticsearch_list = function(query,count) {
  629. var request = ejs.Request().indices(config.kibana_index).types('dashboard');
  630. return request.query(
  631. ejs.QueryStringQuery(query || '*')
  632. ).size(count).doSearch(
  633. // Success
  634. function(result) {
  635. return result;
  636. },
  637. // Failure
  638. function(result) {
  639. return false;
  640. }
  641. );
  642. };
  643. // TOFIX: Gist functionality
  644. this.save_gist = function(title,dashboard) {
  645. var save = _.clone(dashboard || self.current);
  646. save.title = title || self.current.title;
  647. return $http({
  648. url: "https://api.github.com/gists",
  649. method: "POST",
  650. data: {
  651. "description": save.title,
  652. "public": false,
  653. "files": {
  654. "kibana-dashboard.json": {
  655. "content": angular.toJson(save,true)
  656. }
  657. }
  658. }
  659. }).then(function(data, status, headers, config) {
  660. return data.data.html_url;
  661. }, function(data, status, headers, config) {
  662. return false;
  663. });
  664. };
  665. this.gist_list = function(id) {
  666. return $http.jsonp("https://api.github.com/gists/"+id+"?callback=JSON_CALLBACK"
  667. ).then(function(response) {
  668. var files = [];
  669. _.each(response.data.data.files,function(v,k) {
  670. try {
  671. var file = JSON.parse(v.content);
  672. files.push(file);
  673. } catch(e) {
  674. // Nothing?
  675. }
  676. });
  677. return files;
  678. }, function(data, status, headers, config) {
  679. return false;
  680. });
  681. };
  682. });