Unverified Commit 8cc4e6b3 authored by Tao Feng's avatar Tao Feng Committed by GitHub

Change dashboard ES doc based on latest requirement (#238)

parent cf8478c0
...@@ -8,13 +8,13 @@ class DashboardESDocument(ElasticsearchDocument): ...@@ -8,13 +8,13 @@ class DashboardESDocument(ElasticsearchDocument):
Schema for the ES dashboard ES document Schema for the ES dashboard ES document
""" """
def __init__(self, def __init__(self,
dashboard_group, # type: str group_name, # type: str
dashboard_name, # type: str name, # type: str
description, # type: Union[str, None] description, # type: Union[str, None]
total_usage, # type: int total_usage, # type: int
product='', # type: Optional[str] product='', # type: Optional[str]
cluster='', # type: Optional[str] cluster='', # type: Optional[str]
dashboard_group_description=None, # type: Optional[str] group_description=None, # type: Optional[str]
query_names=None, # type: Union[List[str], None] query_names=None, # type: Union[List[str], None]
group_url=None, # type: Optional[str] group_url=None, # type: Optional[str]
url=None, # type: Optional[str] url=None, # type: Optional[str]
...@@ -23,8 +23,8 @@ class DashboardESDocument(ElasticsearchDocument): ...@@ -23,8 +23,8 @@ class DashboardESDocument(ElasticsearchDocument):
tags=None # type: list tags=None # type: list
): ):
# type: (...) -> None # type: (...) -> None
self.dashboard_group = dashboard_group self.group_name = group_name
self.dashboard_name = dashboard_name self.name = name
self.description = description self.description = description
self.cluster = cluster self.cluster = cluster
self.product = product self.product = product
...@@ -33,6 +33,6 @@ class DashboardESDocument(ElasticsearchDocument): ...@@ -33,6 +33,6 @@ class DashboardESDocument(ElasticsearchDocument):
self.uri = uri self.uri = uri
self.last_successful_run_timestamp = last_successful_run_timestamp self.last_successful_run_timestamp = last_successful_run_timestamp
self.total_usage = total_usage self.total_usage = total_usage
self.dashboard_group_description = dashboard_group_description self.group_description = group_description
self.query_names = query_names self.query_names = query_names
self.tags = tags self.tags = tags
...@@ -2,7 +2,7 @@ import os ...@@ -2,7 +2,7 @@ import os
from setuptools import setup, find_packages from setuptools import setup, find_packages
__version__ = '2.5.1' __version__ = '2.5.2'
requirements_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'requirements.txt') requirements_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'requirements.txt')
with open(requirements_path) as requirements_file: with open(requirements_path) as requirements_file:
......
...@@ -11,12 +11,12 @@ class TestDashboardElasticsearchDocument(unittest.TestCase): ...@@ -11,12 +11,12 @@ class TestDashboardElasticsearchDocument(unittest.TestCase):
""" """
Test string generated from to_json method Test string generated from to_json method
""" """
test_obj = DashboardESDocument(dashboard_group='test_dashboard_group', test_obj = DashboardESDocument(group_name='test_dashboard_group',
dashboard_name='test_dashboard_name', name='test_dashboard_name',
description='test_description', description='test_description',
product='mode', product='mode',
cluster='gold', cluster='gold',
dashboard_group_description='work space group', group_description='work space group',
query_names=['query1'], query_names=['query1'],
group_url='mode_group_url', group_url='mode_group_url',
url='mode_report_url', url='mode_report_url',
...@@ -25,8 +25,8 @@ class TestDashboardElasticsearchDocument(unittest.TestCase): ...@@ -25,8 +25,8 @@ class TestDashboardElasticsearchDocument(unittest.TestCase):
total_usage=10, total_usage=10,
tags=['test']) tags=['test'])
expected_document_dict = {"dashboard_group": "test_dashboard_group", expected_document_dict = {"group_name": "test_dashboard_group",
"dashboard_name": "test_dashboard_name", "name": "test_dashboard_name",
"description": "test_description", "description": "test_description",
"product": "mode", "product": "mode",
"cluster": "gold", "cluster": "gold",
...@@ -35,7 +35,7 @@ class TestDashboardElasticsearchDocument(unittest.TestCase): ...@@ -35,7 +35,7 @@ class TestDashboardElasticsearchDocument(unittest.TestCase):
"uri": "mode_dashboard://gold.cluster/dashboard_group/dashboard", "uri": "mode_dashboard://gold.cluster/dashboard_group/dashboard",
"query_names": ['query1'], "query_names": ['query1'],
"last_successful_run_timestamp": 10, "last_successful_run_timestamp": 10,
"dashboard_group_description": "work space group", "group_description": "work space group",
"total_usage": 10, "total_usage": 10,
"tags": ["test"] "tags": ["test"]
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment