Add Last backup date column (#798)
This commit is contained in:
parent
55a965e5bd
commit
e17e69dff3
@ -118,7 +118,7 @@
|
|||||||
<number>10</number>
|
<number>10</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="columnCount">
|
<property name="columnCount">
|
||||||
<number>14</number>
|
<number>15</number>
|
||||||
</property>
|
</property>
|
||||||
<attribute name="horizontalHeaderCascadingSectionResizes">
|
<attribute name="horizontalHeaderCascadingSectionResizes">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
@ -237,6 +237,11 @@
|
|||||||
<string>Backups</string>
|
<string>Backups</string>
|
||||||
</property>
|
</property>
|
||||||
</column>
|
</column>
|
||||||
|
<column>
|
||||||
|
<property name="text">
|
||||||
|
<string>Last backup</string>
|
||||||
|
</property>
|
||||||
|
</column>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
@ -279,6 +284,7 @@
|
|||||||
<addaction name="action_internal"/>
|
<addaction name="action_internal"/>
|
||||||
<addaction name="action_ip"/>
|
<addaction name="action_ip"/>
|
||||||
<addaction name="action_backups"/>
|
<addaction name="action_backups"/>
|
||||||
|
<addaction name="action_last_backup"/>
|
||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
<addaction name="action_toolbar"/>
|
<addaction name="action_toolbar"/>
|
||||||
<addaction name="action_menubar"/>
|
<addaction name="action_menubar"/>
|
||||||
@ -862,6 +868,17 @@
|
|||||||
<string>Include in backups</string>
|
<string>Include in backups</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
|
<action name="action_last_backup">
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Last backup</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="resources.qrc"/>
|
<include location="resources.qrc"/>
|
||||||
|
@ -689,6 +689,27 @@ class VmIncludeInBackupsItem(QTableWidgetItem):
|
|||||||
else:
|
else:
|
||||||
return self.vm.include_in_backups < other.vm.include_in_backups
|
return self.vm.include_in_backups < other.vm.include_in_backups
|
||||||
|
|
||||||
|
class VmLastBackupItem(QTableWidgetItem):
|
||||||
|
def __init__(self, vm):
|
||||||
|
super(VmLastBackupItem, self).__init__()
|
||||||
|
self.setFlags(Qt.ItemIsSelectable|Qt.ItemIsEnabled)
|
||||||
|
|
||||||
|
self.vm = vm
|
||||||
|
if self.vm.backup_timestamp:
|
||||||
|
self.setText(str(self.vm.backup_timestamp.date()))
|
||||||
|
else:
|
||||||
|
self.setText("")
|
||||||
|
|
||||||
|
def __lt__(self, other):
|
||||||
|
if self.vm.backup_timestamp == other.vm.backup_timestamp:
|
||||||
|
return self.vm.qid < other.vm.qid
|
||||||
|
elif not self.vm.backup_timestamp:
|
||||||
|
return False
|
||||||
|
elif not other.vm.backup_timestamp:
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
return self.vm.backup_timestamp < other.vm.backup_timestamp
|
||||||
|
|
||||||
class VmRowInTable(object):
|
class VmRowInTable(object):
|
||||||
cpu_graph_hue = 210
|
cpu_graph_hue = 210
|
||||||
mem_graph_hue = 120
|
mem_graph_hue = 120
|
||||||
@ -751,6 +772,10 @@ class VmRowInTable(object):
|
|||||||
table.setItem(row_no, VmManagerWindow.columns_indices[
|
table.setItem(row_no, VmManagerWindow.columns_indices[
|
||||||
'Backups'], self.include_in_backups_widget)
|
'Backups'], self.include_in_backups_widget)
|
||||||
|
|
||||||
|
self.last_backup_widget = VmLastBackupItem(vm)
|
||||||
|
table.setItem(row_no, VmManagerWindow.columns_indices[
|
||||||
|
'Last backup'], self.last_backup_widget)
|
||||||
|
|
||||||
def update(self, blk_visible = None, cpu_load = None, update_size_on_disk = False, rec_visible = None):
|
def update(self, blk_visible = None, cpu_load = None, update_size_on_disk = False, rec_visible = None):
|
||||||
self.info_widget.update_vm_state(self.vm, blk_visible, rec_visible)
|
self.info_widget.update_vm_state(self.vm, blk_visible, rec_visible)
|
||||||
if cpu_load is not None:
|
if cpu_load is not None:
|
||||||
@ -809,6 +834,7 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow):
|
|||||||
"Internal": 11,
|
"Internal": 11,
|
||||||
"IP": 12,
|
"IP": 12,
|
||||||
"Backups": 13,
|
"Backups": 13,
|
||||||
|
"Last backup": 14,
|
||||||
}
|
}
|
||||||
|
|
||||||
def __init__(self, parent=None):
|
def __init__(self, parent=None):
|
||||||
@ -867,6 +893,8 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow):
|
|||||||
.action_ip
|
.action_ip
|
||||||
self.columns_actions[ self.columns_indices["Backups"] ] = self\
|
self.columns_actions[ self.columns_indices["Backups"] ] = self\
|
||||||
.action_backups
|
.action_backups
|
||||||
|
self.columns_actions[ self.columns_indices["Last backup"] ] = self\
|
||||||
|
.action_last_backup
|
||||||
|
|
||||||
self.visible_columns_count = len(self.columns_indices)
|
self.visible_columns_count = len(self.columns_indices)
|
||||||
self.table.setColumnHidden( self.columns_indices["NetVM"], True)
|
self.table.setColumnHidden( self.columns_indices["NetVM"], True)
|
||||||
@ -883,6 +911,8 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow):
|
|||||||
self.action_ip.setChecked(False)
|
self.action_ip.setChecked(False)
|
||||||
self.table.setColumnHidden( self.columns_indices["Backups"], True)
|
self.table.setColumnHidden( self.columns_indices["Backups"], True)
|
||||||
self.action_backups.setChecked(False)
|
self.action_backups.setChecked(False)
|
||||||
|
self.table.setColumnHidden( self.columns_indices["Last backup"], True)
|
||||||
|
self.action_last_backup.setChecked(False)
|
||||||
|
|
||||||
self.table.setColumnWidth(self.columns_indices["State"], 80)
|
self.table.setColumnWidth(self.columns_indices["State"], 80)
|
||||||
self.table.setColumnWidth(self.columns_indices["Name"], 150)
|
self.table.setColumnWidth(self.columns_indices["Name"], 150)
|
||||||
@ -892,6 +922,7 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow):
|
|||||||
self.table.setColumnWidth(self.columns_indices["Internal"], 60)
|
self.table.setColumnWidth(self.columns_indices["Internal"], 60)
|
||||||
self.table.setColumnWidth(self.columns_indices["IP"], 100)
|
self.table.setColumnWidth(self.columns_indices["IP"], 100)
|
||||||
self.table.setColumnWidth(self.columns_indices["Backups"], 60)
|
self.table.setColumnWidth(self.columns_indices["Backups"], 60)
|
||||||
|
self.table.setColumnWidth(self.columns_indices["Last backup"], 90)
|
||||||
|
|
||||||
self.table.horizontalHeader().setResizeMode(QHeaderView.Fixed)
|
self.table.horizontalHeader().setResizeMode(QHeaderView.Fixed)
|
||||||
|
|
||||||
@ -1884,6 +1915,9 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow):
|
|||||||
def on_action_backups_toggled(self, checked):
|
def on_action_backups_toggled(self, checked):
|
||||||
self.showhide_column( self.columns_indices['Backups'], checked)
|
self.showhide_column( self.columns_indices['Backups'], checked)
|
||||||
|
|
||||||
|
def on_action_last_backup_toggled(self, checked):
|
||||||
|
self.showhide_column( self.columns_indices['Last backup'], checked)
|
||||||
|
|
||||||
def on_action_template_toggled(self, checked):
|
def on_action_template_toggled(self, checked):
|
||||||
self.showhide_column( self.columns_indices['Template'], checked)
|
self.showhide_column( self.columns_indices['Template'], checked)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user