Skip to content

Commit

Permalink
Fix wrong item when proxy is filtering
Browse files Browse the repository at this point in the history
Ref #272
  • Loading branch information
algorys committed Mar 14, 2018
1 parent c8bb034 commit 9dc0767
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions alignak_app/qobjects/alignak/problems.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,13 @@ def update_action_buttons(self):
"""

# Get QStandardItem
standard_item = self.problems_model.item(
self.problem_table.selectionModel().currentIndex().row(),
self.problem_table.selectionModel().currentIndex().column()
# Get item by UserRole
item = self.problem_table.model().data(
self.problem_table.selectionModel().currentIndex(),
Qt.UserRole
)

if standard_item:
item = standard_item.data(Qt.UserRole)

if item:
# If the elements had been ack or downtimed, they would not be present
self.actions_widget.acknowledge_btn.setEnabled(True)
self.actions_widget.downtime_btn.setEnabled(True)
Expand Down Expand Up @@ -201,14 +199,13 @@ def add_spied_host(self):
"""

# Get QStandardItem
standard_item = self.problems_model.item(
self.problem_table.selectionModel().currentIndex().row(),
self.problem_table.selectionModel().currentIndex().column()
# Get item by UserRole
item = self.problem_table.model().data(
self.problem_table.selectionModel().currentIndex(),
Qt.UserRole
)

if standard_item:
item = standard_item.data(Qt.UserRole)
if item:
if 'service' in item.item_type:
item_id = item.data['host']
else:
Expand Down

0 comments on commit 9dc0767

Please sign in to comment.