Skip to content
Permalink
Browse files

Fix dashboard kibana url

  • Loading branch information...
pwnbus committed Jul 8, 2019
1 parent c03be1f commit c14c6797606d1a9fef832d2e68079d7b423c7e69
Showing with 12 additions and 6 deletions.
  1. +5 −1 rest/index.py
  2. +7 −5 tests/rest/test_rest_index.py
@@ -526,9 +526,13 @@ def kibanaDashboards():
results = search_query.execute(es_client, indices=['.kibana'])

for dashboard in results['hits']:
dashboard_id = dashboard['_id']
if dashboard_id.startswith('dashboard:'):
dashboard_id = dashboard_id.replace('dashboard:', '')

resultsList.append({
'name': dashboard['_source']['dashboard']['title'],
'id': dashboard['_id']
'id': dashboard_id
})

except ElasticsearchInvalidIndex as e:
@@ -10,6 +10,7 @@
import json
import time

from operator import itemgetter
from dateutil.parser import parse

from .rest_test_suite import RestTestSuite
@@ -39,6 +40,7 @@ def save_dashboard(self, dash_file, dash_name):
dashboardjson = json.load(f)
f.close()
dashid = dash_name.replace(' ', '-')
dashid = 'dashboard:{0}'.format(dashid)
dashboardjson['dashboard']['title'] = dash_name
dashboardjson['type'] = 'dashboard'
return self.es_client.save_object(body=dashboardjson, index='.kibana', doc_id=dashid)
@@ -69,11 +71,11 @@ def test_route_endpoints(self):
assert type(json_resp) == list
assert len(json_resp) == 2

assert json_resp[1]['id'] == "Example-SSH-Dashboard"
assert json_resp[1]['name'] == 'Example SSH Dashboard'

assert json_resp[0]['id'] == "Example-FTP-Dashboard"
assert json_resp[0]['name'] == 'Example FTP Dashboard'
sorted_dashboards = sorted(json_resp, key=itemgetter('name'))
assert sorted_dashboards[0]['id'] == "Example-FTP-Dashboard"
assert sorted_dashboards[0]['name'] == 'Example FTP Dashboard'
assert sorted_dashboards[1]['id'] == "Example-SSH-Dashboard"
assert sorted_dashboards[1]['name'] == 'Example SSH Dashboard'


class TestKibanaDashboardsRouteWithoutDashboards(RestTestSuite):

0 comments on commit c14c679

Please sign in to comment.
You can’t perform that action at this time.