130 Commits

Author SHA1 Message Date
tintmy
e31269f5e9 Change mbformat to mb_float_format
In the some page use mbformat to filter RAM,(Usage Summary,
instances details,database,image detail, test file), We need
change to mb_float_format.

Change-Id: Ib2d98d17949ba1b453977cb666b2e10cdf07d90b
Closes-bug:#1319230
2015-01-20 08:32:56 +08:00
Akihiro Motoki
3b24bca074 Split large methods into submethods to reduce max-complexity
By this refactoring max-complexity of PEP8 is reduced from 33 to 19.

Closes-Bug: #1399523
Change-Id: I7e9e5cefd3e72e322d8b327f495ce7fc863c3678
2014-12-05 13:30:41 +09:00
eric
f5b77f9a14 Quotas for users with admin role do not work
The quotas code does not isloate counts to resources within the
current tenant/project.  So if a user with the admin role makes
calls for quota items, the admin role will have counts of a global
list of resources.  This changes that for the tenant quota call
to fallback to the request.user.project_id if no project was
otherwise specified for the tenant quota api call.

Change-Id: Ib0e6ce7774c4c03686a044f233dbb9aa36dbe1b9
Closes-bug: #1391242
2014-11-30 07:03:20 -07:00
Sam Betts
e98f2429fa Remove duplicated headings from horizon tables
Many panels in horizon only contain a single table, in these cases the
tables often have the same name as the panel, leading to duplicated
headings, e.g. Instances (panel heading) then Instances (table
heading). This patch adds an attribute the table to hide or show the
title, since the majority of panels have this duplication this flag
is set to hide the heading by default allowing a developer to re-enable
it for specific cases.

Tabbed panels also often lead to duplicated titles between the panel
heading and the tabs themselves, that is not fixed, however how this
patch reduces the duplication in the case of Volumes (panel name),
Volumes (tab name) and Volumes (table name), by hiding the table
heading.

Change-Id: I65efa53cc881417288e5c5b29bfa7d539e97c7dd
Closes-Bug: 1379044
2014-11-13 15:31:08 +00:00
Bradley Jones
746af6eeb0 Create Subnet button should respect quotas
The create subnet button (visible for each network in the networks list and on
the detail page when looking at an individual network) should be disabled if
the quota for subnets is at capacity.

Tests have been added to check that when the quota is exceeded the buttons are
disabled.

Change-Id: I7bba89c2d89a39220900480f0091bdc6215505fe
Closes-bug: 1369779
2014-10-29 11:35:11 +00:00
Cindy Lu
13f56fc1bc Clarify meaning of "Disk GB Hours" column
Admin > Overview Usage table has a column called "Disk GB Hours".
The meaning of this column is unclear.

Co-Authored-By: Thiago Paiva <thiagop@lsd.ufcg.edu.br>

Change-Id: I17e4a3ce60c66804e98a18c33261881ea10964b8
Closes-Bug: #1267362
2014-10-28 19:03:56 -07:00
Sam Betts
193d40a414 Pass correct project ID to get tenant_usages
The current implementation of tenant_quota_usages did not allow for
queries regarding projects that were not the currently active project,
this meant that when an admin went to edit or create a project it tried
to verify the usages against the wrong project. This patch adds the
code for passing a project id to the tenant_quota_usages function so
that the usages can be fetched for a specific project, as well as
removes the need for usage validation on creation of a new project.

Change-Id: I3ec84d14c8be7e3aae066119e963c4093f8aa345
Closes-Bug: 1380701
2014-10-17 15:33:28 +01:00
Jenkins
27c56ba541 Merge "Fix inconsistent behaviour exceeding quota limit" 2014-10-10 12:12:57 +00:00
Bradley Jones
42d73e85a6 Fix inconsistent behaviour exceeding quota limit
Added quota checks for security groups, networks and routers. If quotas are
exceeded then buttons to create are disabled and feedback is given to the
user.

Appropriate tests are also in place

Change-Id: Ie49db5397d87a0c9a583b64e5de34460144b5956
Closes-bug: 1278449
2014-10-06 13:10:14 +01:00
Matthias Runge
b5b09140b1 Change column uptime
Renamed misleading column uptime

Change-Id: Id72c10a7166943fcfef68c338a1412897ad9cc4b
Closes-Bug: #1156563
2014-10-01 14:00:31 +02:00
Justin Pomeroy
b388aaacb3 Persist usage start and end dates in the session
This patch adds the usage start and end dates to the user's session
so they are saved while navigating between pages.

Closes-Bug: #1373651
Change-Id: I3046b5533eb96f85fb2f90e63b3ff84360ad14c4
2014-09-25 15:16:28 -05:00
Jenkins
5cc1d2e7b7 Merge "Remove NotImplementedErrors from "virtual" methods" 2014-09-15 10:17:56 +00:00
Radomir Dopieralski
0f2bf801af Remove NotImplementedErrors from "virtual" methods
Raising a NotImplementedError in a method of a base class
makes it impossible to use super() with it and do multiple
inheritance properly. Those methods should instead simply
return some default "empty" value, so that the methods in
the subclasses can still call them, if that's where they
fall in the MRO.

Change-Id: I581391e87dc58f0f76adea3dbf90cef173d3daef
Closes-bug: 1278825
2014-09-02 11:31:05 +02:00
liyingjun
6e14382c65 Map quota keys to translatable strings
Change-Id: I1446efad26b140bad04f6c2bddc4f8f980735d72
Related-bug: 1274234
2014-08-08 09:45:54 +08:00
Akihiro Motoki
936fc59aa8 Disable Floating IP features if Neutron router is disabled
If the config option 'enable_router' is set to False,
Floating IP features are disabled when Neutron is enabled.
It does not affect when Neutron is disabled.

It also adds unit tests for api.network.servers_update_addresses
which is affected by this change.

Completes blueprint hide-router-panel-by-config
Closes-Bug: #1292022
Change-Id: Ib63c6a0e7bb5661d4a60d10a1722fdad978b50bb
2014-08-30 05:12:27 +09:00
Cindy Lu
a6cd12f24d Add missing Disk unit to Overview Usage
Added unit to the Summary table and the csv report

Change-Id: I91a0bdd13384098cd2e306413bfc103c99bbc418
Closes-Bug: #1346389
2014-08-04 15:59:58 -07:00
Radomir Dopieralski
0eca7449cc Fix Flake8 style warnings in openstack_dashboard/
Warnings H904, H307 and H405 are new or considerably changed, and will
be fixed in a separate patch.

Closes-bug: #1349820
Partial-bug: #1347472

Change-Id: I4fd28990dacf16f03a4eaa6074ef59c37f1a2c14
2014-07-30 14:13:24 +02:00
Jenkins
9690232e99 Merge "Update Twitter Bootstrap to version 3" 2014-07-28 22:17:55 +00:00
Jiri Tomasek
92146772b6 Update Twitter Bootstrap to version 3
Updated to bootstrap 3.2.0
back to v3.1.1
fix base-line-height variable
Revamped grid system
Replaced help-inline with help-block
Change .control-group to .form-group
Add column widths to horizontal form labels and .controls, remove .controls class
Datepicker form fix
Add btn-default to btn elements with no other color
Topbar switcher fix
Rename button sizes
Replace alert-error with alert-danger
Removed alert-block
Alerts fixing
Updated LinkAction and Action table actions to define icon, replaced btn-default icon with glyphicon
Replaced icons with glyphicons, removed btn-icon styling from horizon.scss
change Button Icons text in customizing docs
Fixed table header
Fix page_header h2 margin
Nav accordion fix
Tables fix
Modal fixes
added form-control class to input and selects
Forms fixes
Workflow modal fix
Fix quota bar
updated customizing docs
removed unused styling from horizon.scss
make datepicker form inline
fix table filter styling
added btn-danger to terminate instances button
fixed loading spinner
form fields and validations
Created bootstrap_form_field filter and template to render bootstrap forms properly
Style up the datepicker
Fixed failing test cases

Implements: blueprint bootstrap-update

Change-Id: Ic826849be1af7fc6bf06f97dd7a60fc54b862148
2014-07-28 16:13:21 +02:00
Akihiro Motoki
cc25bd6026 Remove per-feature extension check method in api/neutron
Change-Id: Ie1309d5a51e86a37c640e169d66c73724fc1c9ff
Closes-Bug: #1348075
2014-07-25 01:45:55 +09:00
Justin Pomeroy
407c17b38a Tolerate service catalog and endpoint connection errors
This is a fix for the issues encountered when a service is not
configured or a service endpoint is not reachable. This fix
will add tolerance for these errors so that an error message is
displayed but the dashboard page will still load, not an error page.
This makes it easier for the user to recover by allowing them to
go to a different page, select a different region, or logout. This
makes sense in many cases such as when a region only contains an
image service endpoint, or when a single endpoint is not reachable
for whatever reason.

It also adds permissions to the panels that require compute or
image services so that the dashboard will not display them if
the service is not configured.

To test these changes you will need to set up your keystone service
catalog so that not all services are available in all regions, or
some of the service endpoints are not reachable.

Change-Id: Ie04699d1fb1d4db13a7f4dcf1bdfd23bf21aab80
Closes-Bug: 1323811
Closes-Bug: 1207636
2014-07-21 08:38:53 -05:00
Jenkins
b04f020fc1 Merge "'Create Volume Snapshot' form should show the quota for snapshot" 2014-07-18 04:24:50 +00:00
Christian Berendt
d2f4b9ceca Raise NotImplementedError instead of NotImplemented
Change-Id: Ia6bae64fb5618208b35a652194159c365f6c46a9
2014-07-04 13:13:43 +02:00
Akihiro Motoki
ea0000f6a0 Handle error from neutron extension check in Overview page
Previously some Neutron API calls in get_neutron_limits are outside
try/except and if an error occurs a traceback will be displayed.

Change-Id: I191aecbf3135ddac3b20dbc7e0f22b63aa3837f9
Closes-Bug: #1252878
2014-06-07 18:26:52 +09:00
liyingjun
44a6df30fc 'Create Volume Snapshot' form should show the quota for snapshot
When creating a new volume snapshot the window shows the quota of number
of volumes and what should be shown is the quota of snapshots.
Basically, the code was pasted from "Create Volume" and nothing has been
changed to respect the equivalent quotas.

Change-Id: Ifbfa84a008d7b61e4b53f885793c5a1750dade3c
Closes-bug: 1282172
2014-05-10 11:23:29 +08:00
He Yongli
e790ac070e Remove extraneous vim configuration comments
Remove vim setting:
comment - # vim: tabstop=4 shiftwidth=4 softtabstop=4

at the top of source code files, except for files in
openstack/common.

Change-Id: I9a5c6b17c6ef7ecec601f4503dfc7b31fc72e90a
Close-bug: #1229324
2014-05-06 15:30:10 +08:00
Thiago Paiva Brito
497f69aef3 Correct default usage filtering on overview page
On the overview page, the usage data showed by default was not filtered by
the dates shown on the date selectors. This can lead the user to wrong
conclusions about resource usage.

This patch corrects the default filtering dates to match the dates showed
by default on overview (first day in the month to current date).

Change-Id: I37a240d784ca0826821c125f06922d2c1d1e8659
Closes-Bug: #1294668
2014-04-14 11:44:22 -03:00
Rob Raymond
9ad412827b Refactor CSV generation code to utils
Moving general CSV generation code from usage into utils so that it can be
used by other dashboards.

The file is named csvbase to avoid name collisions with csv module.

Change-Id: I3f4a573b53cb2d85fa36e84320707d74917498ad
Closes-bug: #1280475
2014-03-03 10:05:23 -07:00
He Yongli
990f151cdc Use six.StringIO/BytesIO instead of StringIO.StringIO
to keep Python 3.x compatibility, use six.StringIO/BytesIO to
replace StringIO.StringIO

StringIO works for unicode
BytesIO works for bytes

Change-Id: I1d4db56dd082916879b851f2d9ac71d17c0db94f
Closes-Bug: #1280100
2014-02-26 09:33:33 +08:00
Jenkins
86bdac1f22 Merge "Same styling for "Limit Summary" and "Usage Summary"" 2014-01-12 04:05:13 +00:00
Radomir Dopieralski
66419fef50 Replace asserts in __init__ files with __all__
Defines __all__ in place of assert statements in the __init__.py files.

Change-Id: I0e871789d012e3ec579a8563a61d7ae32e20ed96
Closes-bug: #1251546
2014-01-10 10:28:02 +01:00
Radomir Dopieralski
028332da4a Remove #noqa from most common imports and add them to import_exceptions
We have a lot of import with #noqa that is there to ignore h302,
because it's traditional to import and use a name directly, instead
of a whole module. This hides other errors and gives people the
impression that it's actually fine to import non-modules, you just
have to slap #noqa on those lines.

I went through the code and identified about a dozen names that are
most commonly imported this way. I remove the #noqa tag from them,
and added them to the list in import_exceptions.

I also removed a few unused imports that were revealed in the process.

Change-Id: I27afb8e2b1d4759ec974ded9464d8f010312ee78
2014-01-07 12:26:35 +01:00
Babitha Donepudi
0d089c49c5 Same styling for "Limit Summary" and "Usage Summary"
"Usage Summary" as heading instead of "Select a month.."

Submit button styling is changed.

Change-Id: Ie19e8fd16a4db11a67267513cef82ad9e0c41c29
Closes-Bug: #1100830
2013-12-27 15:26:29 +05:30
Ana Krivokapic
f2de787d8a Add missing __contains__() and get() methods to QuotaUsage
The QuotaUsage class was missing __contains__() and get() methods which was
causing unexpected behaviour, e.g:

    >>> usages = quotas.tenant_quota_usages(request)
    >>> 'ram' in usages
    False
    >>> usages.get('ram')
    None

Change-Id: Ib0b1ad69c4bf4effd7c10827d23bcc713bdc5ed6
2013-12-20 13:19:51 +01:00
Leandro I. Costantino
340bf16be0 CSV Summary not working inside Admin panel.
When browsing Project usages from 'Admin->Projects->More->View Usages'
an AttributeError exception is thrown due to missing csv_render_class
attribute.
Also, project_id instead of tenant_id in BaseUsage  were expected, so
any request to /admin/projects/[id]/usage/ will always return the current
tenant from session.
This fix reuse logic from project/overview/ into this view.

Change-Id: I7d762569a7de176fdb8545a226e563afac34adae
Closes-Bug: #1255667
2013-12-06 11:05:25 -05:00
Leandro I. Costantino
9bca5d3680 Add volume limits to project overview.
Commit d4b0ab4aa395bf4df2964efcc358100117efdaa0 fixing
bug #1178694 removed volume quotas from project overview.
Cinder is not reporting Snapshot limits today, so that info
can't be added without including quotas again, defeating the
purpose of the original fix.
This fix will only add Volume Qty & Total Storage GB used (including
snapshot size, if any ).
Information is hidden if volume list is empty.

Partial-Bug: #1244875
Change-Id: Ia72e40329ecf08b57fb26cd847f02cececc53579
2013-11-29 06:19:40 -05:00
Paul Belanger
da8c69afa6 Gate on H4xx docstrings for pep8
In an effort to help horizon more friendly to OpenStack hacking
guidelines, we now gate on H40* violations.

Change-Id: Id07294543660368d2f7f5ac363710176ab23b874
Signed-off-by: Paul Belanger <paul.belanger@polybeacon.com>
2013-11-23 12:51:07 -05:00
Paul Belanger
74117eb8b6 Gate on H102 Apache 2.0 license header not found for pep8
Now all files are properly licensed per OpenStack Hacking.

Change-Id: I223d983018568357197b0d9cf5dde12c135c53c9
Signed-off-by: Paul Belanger <paul.belanger@polybeacon.com>
2013-11-19 13:55:04 -05:00
Georgi Demirchev
44cd16753c Sortable instances
New filter that appends a timestamp to the uptime localized string,
managed with tablesorter new parser on client side.

Change-Id: I999b04d3da93bc00003fed954382a0ac99b506a3
Closes-Bug: #1222286
2013-10-22 07:11:53 +03:00
Jenkins
01c917c664 Merge "Handle the case no SimpleTenantUsage Nova extension" 2013-10-15 11:13:44 +00:00
Romain Hardouin
d43e49ae46 Handle the case no SimpleTenantUsage Nova extension
When the SimpleTenantUsage Nova extension is not enabled,
panels that include usages produce an error and
the usage table is useless.

Three panels use the SimpleTenantUsage extension:
- openstack_dashboard.dashboards.admin.overview
- openstack_dashboard.dashboards.admin.projects
- openstack_dashboard.dashboards.project.overview

This fix avoids errors and does not show the usage
table in such a case.

A context variable 'simple_tenant_usage_enabled' is now
available in templates rendered by usage.UsageView subclasses.

Unit tests now mock nova 'extension_supported' API.

Change-Id: Ib306846bf6c947572ba0e7c773125d03b3dbf68b
Closes-Bug: #1211470
2013-10-08 22:22:35 +02:00
Jenkins
f6993da143 Merge "Fix a issue on retrieving default quota in Create Project" 2013-10-08 04:25:22 +00:00
Akihiro MOTOKI
9fa87dad19 Fix a issue on retrieving default quota in Create Project
quota names for security group are different between nova and neutron,
so the same appoach can be used for floating IP. This commit reverts
the change in get_default_quota_data in commit c44552fe66 and changes
get_disabled_quotas to determine security group and rules quotas come
from nova or neutron.

Change-Id: I9e39ac99f1e8c7ccdce64b2e2ab79615cac50892
Closes-Bug: #1235053
2013-10-07 05:49:50 +09:00
Akihiro MOTOKI
0def30491c Fix typos: "gruop" and "remove from"
Change-Id: If1afd82ffff3f4058c87b675913d4a0d31c52c09
Closes-Bug: #1234119
2013-10-02 20:49:09 +09:00
Jenkins
46fefe0e91 Merge "Remove unused LOG" 2013-10-02 00:41:54 +00:00
Akihiro MOTOKI
c44552fe66 Retrieve security group quotas from Neutron if enabled
Secuirty group quota information in Project overview charts,
Admin defaults panel, and Admin create/update project is
retrieved from Neutron secuirty group is enabled.

Neutron security group is enbled when Neutron is used Neutron
security group extension is supported by a backend plugin.

Also removes the logic to remove quotas of floating IP and fixed IP
when neutron is enabled in dashboards/admin/defaults/tabs.py.
quotas.get_default_quota_data() already handles it properly
and this logic is no longer required.

Closes-Bug: #1212600

Change-Id: I59f069931fad519ca4ec135b92df0040ec8fc230
2013-09-29 17:50:00 +09:00
lawrancejing
d33f294ba9 Remove unused LOG
In some files, we import logging and define
LOG, but we never used it later, so i remove
those unused LOG and make horizon code clean.

Fixed: bug #1231761

Change-Id: I1ebf0098c647e7522f5f1a93cfece7a52bdc05c1
2013-09-28 23:57:13 -07:00
Julie Pichon
2ed62bb2e5 Fix volume snapshot creation
The referenced template was wrong, and the quota usages information
had not been switched to using limits.

Thanks to Nuno Santos and Rohan Kanade for the initial versions of
this patch.

Change-Id: I97f578b84cd1cd4babab2580c60f0132026e3c93
Closes-Bug: #1194506
2013-09-18 18:19:19 +01:00
liyingjun
5f8e370f2d Allow admins to update default quotas
Add update default quotas form to edit the default quotas.

Move the editable default quotas tab to a new panel called
"Defaults".

Implements blueprint edit-default-quota

Change-Id: I6e3806226cd2f699f16b93c25e294bc67883738f
2013-08-29 23:18:08 +08:00
Julie Pichon
3852d1ce19 View and update Neutron project quotas
Also ensure that the correct quota is displayed in the Floating IPs
allocation page (Security & Access panel).

Closes-Bug: #1109140

Change-Id: I30d207fbf149bfbcfefeaddf91af49082b7b1f53
2013-08-27 19:13:10 +01:00