Make health check info hideable

If cluster verification in Sahara is totally disabled, then operators
probably do not want to have ugly UNKNOWN in the cluster status page.
They also probably do not want any references to health at all, if
there will never be any usable information there. So, let's add
something that can be read from local_settings to disable these when
the operator doesn't want them.

Change-Id: Ifc624d07767ed29646aa8a5b5739103fd4972b90
Co-Authored-By: Lucas H. Xu <xuh@bu.edu>
This commit is contained in:
Jeremy Freudberg 2017-05-31 20:08:28 +00:00
parent 1c7c9e9251
commit fce0b61b78
3 changed files with 33 additions and 12 deletions

View File

@ -33,6 +33,12 @@ SAHARA_AUTO_IP_ALLOCATION_ENABLED = getattr(
settings,
'SAHARA_AUTO_IP_ALLOCATION_ENABLED',
False)
SAHARA_VERIFICATION_DISABLED = getattr(
settings,
'SAHARA_VERIFICATION_DISABLED',
False)
VERSIONS = base.APIVersionManager(
SAHARA_SERVICE,
preferred_version=getattr(settings,

View File

@ -29,6 +29,8 @@ from sahara_dashboard.content.data_processing.utils \
import acl as acl_utils
from sahara_dashboard.content.data_processing.utils import helpers
SAHARA_VERIFICATION_DISABLED = saharaclient.SAHARA_VERIFICATION_DISABLED
class ClustersFilterAction(tables.FilterAction):
filter_type = "server"
@ -242,10 +244,10 @@ class ClustersTable(sahara_table.SaharaPaginateTabbedTable):
status = tables.Column(get_rich_status_info,
verbose_name=_("Status"),
filters=(rich_status_filter,))
health = tables.Column(get_health_status_info,
verbose_name=_("Health"),
filters=(get_health_filter,))
if not SAHARA_VERIFICATION_DISABLED:
health = tables.Column(get_health_status_info,
verbose_name=_("Health"),
filters=(get_health_filter,))
instances_count = tables.Column(get_instances_count,
verbose_name=_("Instances Count"))
@ -258,7 +260,9 @@ class ClustersTable(sahara_table.SaharaPaginateTabbedTable):
verbose_name = _("Clusters")
row_class = UpdateRow
cell_class = RichErrorCell
status_columns = ["status", "health"]
status_columns = ["status"]
if not SAHARA_VERIFICATION_DISABLED:
status_columns.append("health")
table_actions = (ClusterGuide,
CreateCluster,
ConfigureCluster,
@ -266,8 +270,14 @@ class ClustersTable(sahara_table.SaharaPaginateTabbedTable):
ClustersFilterAction)
table_actions_menu = (MakePublic, MakePrivate,
MakeProtected, MakeUnProtected)
row_actions = (ScaleCluster,
UpdateClusterShares,
DeleteCluster, MakePublic, MakePrivate,
MakeProtected, MakeUnProtected,
CheckClusterAction)
if SAHARA_VERIFICATION_DISABLED:
row_actions = (ScaleCluster,
UpdateClusterShares,
DeleteCluster, MakePublic, MakePrivate,
MakeProtected, MakeUnProtected)
else:
row_actions = (ScaleCluster,
UpdateClusterShares,
DeleteCluster, MakePublic, MakePrivate,
MakeProtected, MakeUnProtected,
CheckClusterAction)

View File

@ -251,6 +251,11 @@ class HealthChecksTab(tabs.Tab):
class ClusterDetailsTabs(tabs.TabGroup):
slug = "cluster_details"
tabs = (GeneralTab, ClusterConfigsDetails, NodeGroupsTab, InstancesTab,
EventLogTab, HealthChecksTab)
if saharaclient.SAHARA_VERIFICATION_DISABLED:
tabs = (GeneralTab, ClusterConfigsDetails, NodeGroupsTab, InstancesTab,
EventLogTab)
else:
tabs = (GeneralTab, ClusterConfigsDetails, NodeGroupsTab, InstancesTab,
EventLogTab, HealthChecksTab)
sticky = True