From 91fc36e72674edde41aa899962faa6ce164e6373 Mon Sep 17 00:00:00 2001 From: Tobias Sjondin Date: Wed, 9 Jul 2014 11:58:01 +0200 Subject: [PATCH] Removed dep on API Change-Id: Ieb1f42f1f7ebb07c090f0e8f5bebc6bbf7564208 Signed-off-by: Tobias Sjondin --- application/media/js/jquery.filterable.js | 16 +++++++++++----- application/views/reports/js/common.js | 12 ++++++++---- op5build/monitor-ninja.spec | 1 - 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/application/media/js/jquery.filterable.js b/application/media/js/jquery.filterable.js index 9153ad10e..f1d6da330 100644 --- a/application/media/js/jquery.filterable.js +++ b/application/media/js/jquery.filterable.js @@ -8,19 +8,25 @@ "host": window.location.protocol + "//" + window.location.host, "datasource": function ( select ) { - var type = select.attr( 'data-type' ); - return settings.host + '/api/status/' + type + + var type = select.attr( 'data-type' ), + root = settings.host + _site_domain + _index_page; + + return root + '/listview/fetch_ajax?query=[' + type + 's] all&columns[]=key&limit=1000000'; + }, "collector": function ( select, data ) { + var names = []; - for ( var i = 0; i < data.length; i++ ) - names.push( data[ i ].name ); + for ( var i = 0; i < data.data.length; i++ ) { + names.push( data.data[ i ].key ); + } select.filterable( names ); + }, "ajax": { - data: { 'format': 'json', csrf_token: _csrf_token, 'auth_method': 'ninja' }, dataType: 'json', error: function( xhr ) { console.log( xhr.responseText ); diff --git a/application/views/reports/js/common.js b/application/views/reports/js/common.js index b6f58447f..6304eeeef 100644 --- a/application/views/reports/js/common.js +++ b/application/views/reports/js/common.js @@ -101,10 +101,12 @@ $(document).ready(function() { var filterable = jQuery.fn.filterable.find( $('select[name="objects[]"]') ), type = e.target.value.replace( /s$/, "" ); + var url = _site_domain + _index_page; + url += '/listview/fetch_ajax?query=[' + type + 's] all&columns[]=key&limit=1000000'; + if ( filterable ) { $.ajax({ - url: hostname + '/api/status/' + type, - data: { 'format': 'json', csrf_token: _csrf_token, 'auth_method': 'ninja' }, + url: url, dataType: 'json', error: function( xhr ) { console.log( xhr.responseText ); @@ -112,8 +114,10 @@ $(document).ready(function() { success: function( data ) { var names = []; - for ( var i = 0; i < data.length; i++ ) - names.push( data[ i ].name ); + + for ( var i = 0; i < data.data.length; i++ ) { + names.push( data.data[ i ].key ); + } filterable.data = new Set( names ); filterable.reset(); diff --git a/op5build/monitor-ninja.spec b/op5build/monitor-ninja.spec index 1535acd53..2f14b3c02 100644 --- a/op5build/monitor-ninja.spec +++ b/op5build/monitor-ninja.spec @@ -74,7 +74,6 @@ Group: op5/Monitor Requires: monitor-ninja = %version Requires: merlin monitor-merlin op5-nagios Requires: merlin-apps -Requires: monitor-http-api Requires: monitor-livestatus monitor-nagvis Requires: rubygem20-op5cucumber Requires: portal -- 2.11.4.GIT