class VolumeSnapshotsTable(volumes_tables.VolumesTableBase): name = tables.Column("name", verbose_name=_("Name"), link="horizon:admin:volumes:snapshots:detail") volume_name = snapshots_tables.SnapshotVolumeNameColumn( "name", verbose_name=_("Volume Name"), link="horizon:admin:volumes:volumes:detail") host = tables.Column("host_name", verbose_name=_("Host")) tenant = tables.Column("tenant_name", verbose_name=_("Project")) class Meta: name = "volume_snapshots" verbose_name = _("Volume Snapshots") table_actions = ( snapshots_tables.VolumeSnapshotsFilterAction, snapshots_tables.DeleteVolumeSnapshot, ) row_actions = ( snapshots_tables.DeleteVolumeSnapshot, UpdateVolumeSnapshotStatus, ) row_class = UpdateRow status_columns = ("status", ) columns = ( 'tenant', 'host', 'name', 'description', 'size', 'status', 'volume_name', )
class VolumeSnapshotsTable(volumes_tables.VolumesTableBase): name = tables.Column("name", verbose_name=_("Name"), link="horizon:admin:volumes:snapshots:detail") volume_name = snapshots_tables.SnapshotVolumeNameColumn( "name", verbose_name=_("Volume Name"), link="horizon:admin:volumes:volumes:detail") host = tables.Column("host_name", verbose_name=_("Host")) tenant = tables.Column("tenant_name", verbose_name=_("Project")) class Meta: name = "volume_snapshots" verbose_name = _("Volume Snapshots") table_actions = (snapshots_tables.DeleteVolumeSnapshot, ) row_actions = ( snapshots_tables.DeleteVolumeSnapshot, UpdateVolumeSnapshotStatus, ) row_class = UpdateRow status_columns = ("status", ) columns = ( 'tenant', 'host', 'name', 'description', 'size', 'status', 'volume_name', ) def get_rows(self): """Return the row data for this table broken out by columns.""" rows = [] policy = policy_is(self.request.user.username, 'sysadmin', 'admin') for datum in self.filtered_data: row = self._meta.row_class(self, datum) if self.get_object_id(datum) == self.current_item_id: self.selected = True row.classes.append('current_selected') if not policy: del row.cells['actions'] del row.cells['multi_select'] rows.append(row) return rows def get_columns(self): if not (policy_is(self.request.user.username, 'sysadmin', 'admin')): self.columns['multi_select'].attrs = {'class': 'hide'} self.columns['actions'].attrs = {'class': 'hide'} return self.columns.values()