Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion cloudkittydashboard/dashboards/admin/hashmap/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# under the License.


from cloudkittyclient import exc as ck_exc
from django.urls import reverse
from django.urls import reverse_lazy
from django.utils.translation import gettext_lazy as _
Expand Down Expand Up @@ -41,7 +42,7 @@ def get_data(self):
try:
service = manager.info.get_metric(metric_name=s['name'])
unit = service['unit']
except exceptions.NotFound:
except (exceptions.NotFound, ck_exc.HTTPNotFound):
unit = "-"

list_services.append({
Expand Down
5 changes: 4 additions & 1 deletion cloudkittydashboard/dashboards/admin/summary/tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,12 @@ class Meta(object):


class TenantSummaryTable(tables.DataTable):
res_type = tables.Column('res_type', verbose_name=_("Res Type"))
res_type = tables.Column('type', verbose_name=_("Resource Type"))
rate = tables.Column('rate', verbose_name=_("Rate"))

class Meta(object):
name = "tenant_summary"
verbose_name = _("Project Summary")

def get_object_id(self, datum):
return datum.get('type')
57 changes: 31 additions & 26 deletions cloudkittydashboard/dashboards/admin/summary/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,49 +33,54 @@ class IndexView(tables.DataTableView):
table_class = sum_tables.SummaryTable

def get_data(self):
summary = api.cloudkittyclient(self.request).report.get_summary(
groupby=['tenant_id'], all_tenants=True)['summary']
summary = api.cloudkittyclient(
self.request, version='2').summary.get_summary(
groupby=['project_id'],
response_format='object')

tenants, _ = api_keystone.tenant_list(self.request)
tenants, unused = api_keystone.tenant_list(self.request)
tenants = {tenant.id: tenant.name for tenant in tenants}
summary.append({
'tenant_id': 'ALL',
'rate': sum([float(item['rate']) for item in summary]),
data = summary.get('results')

total = sum([r.get('rate') for r in data])
data.append({
'project_id': 'ALL',
'rate': total,
})
summary = api.identify(summary, key='tenant_id')
for tenant in summary:
data = api.identify(data, key='project_id')
for tenant in data:
tenant['tenant_id'] = tenant.get('project_id')
tenant['name'] = tenants.get(tenant.id, '-')
summary[-1]['name'] = 'Cloud Total'
for tenant in summary:
tenant['rate'] = utils.formatRate(tenant['rate'],
rate_prefix, rate_postfix)
return summary
data[-1]['name'] = _('Cloud Total')
return data


class TenantDetailsView(tables.DataTableView):
template_name = 'admin/rating_summary/details.html'
table_class = sum_tables.TenantSummaryTable
page_title = _("Script details: {{ table.project_id }}")

def _get_cloud_total_summary(self):
return api.cloudkittyclient(self.request).report.get_summary(
groupby=['res_type'], all_tenants=True)['summary']

def get_data(self):
tenant_id = self.kwargs['project_id']

if tenant_id == 'ALL':
summary = self._get_cloud_total_summary()
summary = api.cloudkittyclient(
self.request, version='2').summary.get_summary(
groupby=['type'], response_format='object')
else:
summary = api.cloudkittyclient(self.request).report.get_summary(
groupby=['res_type'], tenant_id=tenant_id)['summary']
summary = api.cloudkittyclient(
self.request, version='2').summary.get_summary(
filters={'project_id': tenant_id},
groupby=['type'], response_format='object')

summary.append({
'tenant_id': tenant_id,
'res_type': 'TOTAL',
'rate': sum([float(item['rate']) for item in summary]),
})
summary = api.identify(summary, key='res_type', name=True)
for item in summary:
data = summary.get('results')
total = sum([r.get('rate') for r in data])
data.append({'type': 'TOTAL', 'rate': total})

for item in data:
item['rate'] = utils.formatRate(item['rate'],
rate_prefix, rate_postfix)
return summary

return data
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
upgrade:
- |
Upgrades the CloudKitty API from v1 to v2 in the admin/rating panel.

26 changes: 24 additions & 2 deletions releasenotes/source/locale/en_GB/LC_MESSAGES/releasenotes.po
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,16 @@
# Andi Chandler <andi@gowling.com>, 2022. #zanata
# Andi Chandler <andi@gowling.com>, 2023. #zanata
# Andi Chandler <andi@gowling.com>, 2024. #zanata
# Andi Chandler <andi@gowling.com>, 2026. #zanata
msgid ""
msgstr ""
"Project-Id-Version: Cloudkitty Dashboard Release Notes\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-08-07 10:32+0000\n"
"POT-Creation-Date: 2025-11-26 12:19+0000\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"PO-Revision-Date: 2024-04-18 12:35+0000\n"
"PO-Revision-Date: 2026-01-07 11:22+0000\n"
"Last-Translator: Andi Chandler <andi@gowling.com>\n"
"Language-Team: English (United Kingdom)\n"
"Language: en_GB\n"
Expand All @@ -29,6 +30,9 @@ msgstr "11.0.1"
msgid "12.0.0"
msgstr "12.0.0"

msgid "12.0.0-4"
msgstr "12.0.0-4"

msgid "13.0.0"
msgstr "13.0.0"

Expand All @@ -38,6 +42,9 @@ msgstr "14.0.1"
msgid "15.0.0"
msgstr "15.0.0"

msgid "19.0.0"
msgstr "19.0.0"

msgid "2023.1 Series Release Notes"
msgstr "2023.1 Series Release Notes"

Expand All @@ -47,6 +54,18 @@ msgstr "2023.2 Series Release Notes"
msgid "2024.1 Series Release Notes"
msgstr "2024.1 Series Release Notes"

msgid "2024.2 Series Release Notes"
msgstr "2024.2 Series Release Notes"

msgid "2025.1 Series Release Notes"
msgstr "2025.1 Series Release Notes"

msgid "2025.2 Series Release Notes"
msgstr "2025.2 Series Release Notes"

msgid "21.0.0"
msgstr "21.0.0"

msgid "8.1.0"
msgstr "8.1.0"

Expand Down Expand Up @@ -136,6 +155,9 @@ msgstr "Rocky Series Release Notes"
msgid "Stein Series Release Notes"
msgstr "Stein Series Release Notes"

msgid "Support for Python 3.8 and 3.9 has been dropped."
msgstr "Support for Python 3.8 and 3.9 has been dropped."

msgid ""
"The \"Cost Per Service Per Hour\" graph no longer stacks series on the Y "
"axis."
Expand Down
Loading