
There are no longer two separate projects living inside the horizon repository. There is a single project now with a single setup.py, single README, etc. The openstack-dashboard/dashboard django project is now named "openstack_dashboard" and lives as an example project in the topmost horizon directory. The "horizon/horizon" directory has been bumped up a level and now is directly on the path when the root horizon directory is on your python path. Javascript media which the horizon module directly relies upon now ships in the horizon/static dir rather than openstack-dashboard/dashboard/static. All the corresponding setup, installation, build, and env scripts have been updated accordingly. Implements blueprint unified-packaging. Change-Id: Ieed8e3c777432cd046c3e0298869a9428756ab62
57 lines
1.8 KiB
Python
57 lines
1.8 KiB
Python
from django.utils.translation import ugettext as _
|
|
from django.template.defaultfilters import timesince
|
|
|
|
from horizon import tables
|
|
from horizon.templatetags.sizeformat import mbformat
|
|
|
|
|
|
class CSVSummary(tables.LinkAction):
|
|
name = "csv_summary"
|
|
verbose_name = _("Download CSV Summary")
|
|
|
|
def get_link_url(self, usage=None):
|
|
return self.table.kwargs['usage'].csv_link()
|
|
|
|
|
|
class BaseUsageTable(tables.DataTable):
|
|
vcpus = tables.Column('vcpus', verbose_name=_("VCPUs"))
|
|
disk = tables.Column('local_gb', verbose_name=_("Disk"))
|
|
memory = tables.Column('memory_mb',
|
|
verbose_name=_("RAM"),
|
|
filters=(mbformat,))
|
|
hours = tables.Column('vcpu_hours', verbose_name=_("VCPU Hours"))
|
|
|
|
|
|
class GlobalUsageTable(BaseUsageTable):
|
|
tenant = tables.Column('tenant_id', verbose_name=_("Project ID"))
|
|
disk_hours = tables.Column('disk_gb_hours',
|
|
verbose_name=_("Disk GB Hours"))
|
|
|
|
def get_object_id(self, datum):
|
|
return datum.tenant_id
|
|
|
|
class Meta:
|
|
name = "global_usage"
|
|
verbose_name = _("Usage Summary")
|
|
columns = ("tenant", "vcpus", "disk", "memory",
|
|
"hours", "disk_hours")
|
|
table_actions = (CSVSummary,)
|
|
multi_select = False
|
|
|
|
|
|
class TenantUsageTable(BaseUsageTable):
|
|
instance = tables.Column('name')
|
|
uptime = tables.Column('uptime_at',
|
|
verbose_name=_("Uptime"),
|
|
filters=(timesince,))
|
|
|
|
def get_object_id(self, datum):
|
|
return datum['name']
|
|
|
|
class Meta:
|
|
name = "tenant_usage"
|
|
verbose_name = _("Usage Summary")
|
|
columns = ("instance", "vcpus", "disk", "memory", "uptime")
|
|
table_actions = (CSVSummary,)
|
|
multi_select = False
|