Skip to content

Commit

Permalink
Add hint widgets to problems view
Browse files Browse the repository at this point in the history
Ref #291
  • Loading branch information
algorys committed Apr 3, 2018
1 parent 382e2b9 commit e7e6c31
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 12 deletions.
21 changes: 12 additions & 9 deletions alignak_app/qobjects/alignak/problems.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

from alignak_app.backend.datamanager import data_manager
from alignak_app.backend.backend import app_backend
from alignak_app.items.host import Host
from alignak_app.utils.config import settings

from alignak_app.qobjects.common.actions import ActionsQWidget
Expand Down Expand Up @@ -257,14 +258,6 @@ def update_problems_data(self, item_type=''):
_("Problems (%d)") % len(problems_data['problems'])
)

self.problems_title.setText(
_('There are %d problems to manage (hosts: %d, services: %d)') % (
len(problems_data['problems']),
problems_data['hosts_nb'],
problems_data['services_nb']
)
)

if self.filter_hosts_btn.is_checked() and not self.filter_services_btn.is_checked():
item_type = 'host'
if self.filter_services_btn.is_checked() and not self.filter_hosts_btn.is_checked():
Expand All @@ -284,7 +277,17 @@ def update_problems_data(self, item_type=''):
]

proxy_filter = self.problems_table.update_view(problems_data)
self.line_search.textChanged.connect(proxy_filter.setFilterRegExp)
if problems_data['problems']:
self.problems_title.setText(
_('There are %d problems to manage (hosts: %d, services: %d)') % (
len(problems_data['problems']),
problems_data['hosts_nb'],
problems_data['services_nb']
)
)
self.line_search.textChanged.connect(proxy_filter.setFilterRegExp)
else:
self.problems_title.setText(_('If problems are found, they will be displayed here.'))

self.problems_table.selectionModel().selectionChanged.connect(self.update_action_buttons)
self.update_action_buttons()
Expand Down
15 changes: 12 additions & 3 deletions alignak_app/qobjects/alignak/problems_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,18 @@ def update_view(self, problems_data):
problems_model.setRowCount(len(problems_data['problems']))
problems_model.setColumnCount(len(self.headers_list))

for row, item in enumerate(problems_data['problems']):
problems_model.setItem(row, 0, self.get_tableitem(item))
problems_model.setItem(row, 1, self.get_output_tableitem(item))
if problems_data['problems']:
for row, item in enumerate(problems_data['problems']):
problems_model.setItem(row, 0, self.get_tableitem(item))
problems_model.setItem(row, 1, self.get_output_tableitem(item))

else:
tableitem = QStandardItem('No problem to report.')

icon = QIcon(settings.get_image('checked'))
tableitem.setIcon(icon)
tableitem.setTextAlignment(Qt.AlignCenter)
problems_model.setItem(0, 0, tableitem)

proxy_filter = QSortFilterProxyModel()
proxy_filter.setFilterCaseSensitivity(Qt.CaseInsensitive)
Expand Down
1 change: 1 addition & 0 deletions alignak_app/qobjects/events/spy_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
from PyQt5.Qt import pyqtSignal, QSize, Qt, QListWidget

from alignak_app.backend.datamanager import data_manager

from alignak_app.qobjects.events.item import EventItem

logger = getLogger(__name__)
Expand Down

0 comments on commit e7e6c31

Please sign in to comment.