Commit 98118b72 by Szabolcs Gelencser

Add instance quotas to dashboard

parent 484ed29e
......@@ -2,9 +2,9 @@
<project version="4">
<component name="ChangeListManager">
<list default="true" id="1fbec8af-5a7c-40f9-b994-83ac07d1ae1d" name="Default" comment="">
<change beforePath="$PROJECT_DIR$/circle/circle/settings/base.py" afterPath="$PROJECT_DIR$/circle/circle/settings/base.py" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
<change beforePath="$PROJECT_DIR$/circle/dashboard/templates/dashboard/index-vm.html" afterPath="$PROJECT_DIR$/circle/dashboard/templates/dashboard/index-vm.html" />
<change beforePath="$PROJECT_DIR$/circle/request/views.py" afterPath="$PROJECT_DIR$/circle/request/views.py" />
<change beforePath="$PROJECT_DIR$/circle/dashboard/views/index.py" afterPath="$PROJECT_DIR$/circle/dashboard/views/index.py" />
</list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="TRACKING_ENABLED" value="true" />
......@@ -33,33 +33,21 @@
</component>
<component name="FileEditorManager">
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
<file leaf-file-name="urls.py" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/circle/request/urls.py">
<file leaf-file-name="index-vm.html" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/circle/dashboard/templates/dashboard/index-vm.html">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="199">
<caret line="29" column="27" lean-forward="false" selection-start-line="29" selection-start-column="27" selection-end-line="29" selection-end-column="27" />
<state relative-caret-position="617">
<caret line="91" column="96" lean-forward="false" selection-start-line="91" selection-start-column="96" selection-end-line="91" selection-end-column="96" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="views.py" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/circle/request/views.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-2844">
<caret line="157" column="49" lean-forward="false" selection-start-line="157" selection-start-column="49" selection-end-line="157" selection-end-column="49" />
<folding>
<element signature="e#731#787#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file leaf-file-name="base.py" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/circle/circle/settings/base.py">
<file leaf-file-name="index.py" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/circle/dashboard/views/index.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="221">
<caret line="317" column="55" lean-forward="false" selection-start-line="317" selection-start-column="55" selection-end-line="317" selection-end-column="55" />
<state relative-caret-position="136">
<caret line="49" column="26" lean-forward="false" selection-start-line="49" selection-start-column="13" selection-end-line="49" selection-end-column="26" />
<folding />
</state>
</provider>
......@@ -77,7 +65,6 @@
</component>
<component name="FindInProjectRecents">
<findStrings>
<find>TransferOwnershipConfirmView</find>
<find>template-transfer-ownership</find>
<find>TransferTemplateOwnershipView</find>
<find>TransferOwnershipView</find>
......@@ -107,6 +94,7 @@
<find>middleware</find>
<find>request</find>
<find>SuperuserRequiredMixin</find>
<find>#TODO</find>
</findStrings>
<replaceStrings>
<replace>'ACTIVE'</replace>
......@@ -167,17 +155,17 @@
<option value="$PROJECT_DIR$/circle/circle/os_policies/keystone_policy.json" />
<option value="$PROJECT_DIR$/circle/circle/urls.py" />
<option value="$PROJECT_DIR$/circle/openstack_auth/plugin/password.py" />
<option value="$PROJECT_DIR$/circle/dashboard/views/index.py" />
<option value="$PROJECT_DIR$/circle/openstack_auth/policy.py" />
<option value="$PROJECT_DIR$/circle/circle/os_policies/circle_policy.json" />
<option value="$PROJECT_DIR$/circle/openstack_auth/user.py" />
<option value="$PROJECT_DIR$/circle/middleware.py" />
<option value="$PROJECT_DIR$/circle/dashboard/templates/dashboard/base.html" />
<option value="$PROJECT_DIR$/circle/request/models.py" />
<option value="$PROJECT_DIR$/circle/circle/middleware.py" />
<option value="$PROJECT_DIR$/circle/circle/settings/base.py" />
<option value="$PROJECT_DIR$/circle/dashboard/templates/dashboard/index-vm.html" />
<option value="$PROJECT_DIR$/circle/request/views.py" />
<option value="$PROJECT_DIR$/circle/circle/middleware.py" />
<option value="$PROJECT_DIR$/circle/dashboard/views/index.py" />
<option value="$PROJECT_DIR$/circle/dashboard/templates/dashboard/index-vm.html" />
</list>
</option>
</component>
......@@ -247,32 +235,6 @@
<item name="cloud" type="462c0819:PsiDirectoryNode" />
<item name="circle" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="cloud" type="b2602c69:ProjectViewProjectNode" />
<item name="cloud" type="462c0819:PsiDirectoryNode" />
<item name="circle" type="462c0819:PsiDirectoryNode" />
<item name="circle" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="cloud" type="b2602c69:ProjectViewProjectNode" />
<item name="cloud" type="462c0819:PsiDirectoryNode" />
<item name="circle" type="462c0819:PsiDirectoryNode" />
<item name="circle" type="462c0819:PsiDirectoryNode" />
<item name="os_policies" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="cloud" type="b2602c69:ProjectViewProjectNode" />
<item name="cloud" type="462c0819:PsiDirectoryNode" />
<item name="circle" type="462c0819:PsiDirectoryNode" />
<item name="circle" type="462c0819:PsiDirectoryNode" />
<item name="settings" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="cloud" type="b2602c69:ProjectViewProjectNode" />
<item name="cloud" type="462c0819:PsiDirectoryNode" />
<item name="circle" type="462c0819:PsiDirectoryNode" />
<item name="request" type="462c0819:PsiDirectoryNode" />
</path>
</expand>
<select />
</subPane>
......@@ -287,7 +249,7 @@
<property name="settings.editor.selected.configurable" value="watcher.settings" />
<property name="NewWatcherDialog.advanced.open" value="true" />
<property name="DefaultHtmlFileTemplate" value="HTML File" />
<property name="SearchEverywhereHistoryKey" value="index-vm&#9;FILE&#9;file:///home/h3yduck/cloud/circle/dashboard/templates/dashboard/index-vm.html&#10;index.&#9;FILE&#9;file:///home/h3yduck/cloud/circle/dashboard/views/index.py&#10;index&#9;FILE&#9;file:///home/h3yduck/cloud/circle/dashboard/templates/dashboard/index.html&#10;bas&#9;FILE&#9;file:///home/h3yduck/cloud/circle/openstack_api/base.py&#10;save&#9;null&#9;null&#10;plainc&#9;null&#9;null&#10;vmdeta&#9;null&#9;null&#10;templatedet&#9;null&#9;null&#10;instancetemp&#9;null&#9;null&#10;instancetem&#9;null&#9;null&#10;url&#9;FILE&#9;file:///home/h3yduck/cloud/circle/dashboard/urls.py&#10;vmcreate&#9;null&#9;null&#10;base&#9;FILE&#9;file:///home/h3yduck/cloud/circle/circle/settings/base.py&#10;opera&#9;FILE&#9;file:///home/h3yduck/cloud/circle/vm/operations.py&#10;operations&#9;FILE&#9;file:///home/h3yduck/cloud/circle/common/operations.py&#10;templat&#9;null&#9;null&#10;vmadd&#9;null&#9;null&#10;vmdetail&#9;null&#9;null&#10;addinterfa&#9;null&#9;null&#10;addin&#9;null&#9;null&#10;server&#9;null&#9;null&#10;Instance&#9;null&#9;null&#10;instance&#9;FILE&#9;file:///home/h3yduck/cloud/circle/vm/models/instance.py&#10;operat&#9;null&#9;null&#10;ins&#9;FILE&#9;file:///home/h3yduck/cloud/circle/vm/models/instance.py&#10;vmdetai&#9;null&#9;null&#10;operationvi&#9;null&#9;null&#10;ser&#9;null&#9;null&#10;server.&#9;FILE&#9;file:///home/h3yduck/.virtualenvs/cloud/local/lib/python2.7/site-packages/novaclient/v2/servers.py&#10;resources.&#9;FILE&#9;file:///home/h3yduck/cloud/circle/request/templates/request/initials/resources.html&#10;vm-de&#9;FILE&#9;file:///home/h3yduck/cloud/circle/dashboard/templates/dashboard/vm-detail.html&#10;vxla&#9;null&#9;null&#10;urls&#9;FILE&#9;file:///home/h3yduck/cloud/circle/dashboard/urls.py&#10;index-v&#9;FILE&#9;file:///home/h3yduck/cloud/circle/dashboard/templates/dashboard/index-vxlans.html&#10;create&#9;FILE&#9;file:///home/h3yduck/cloud/circle/network/templates/network/vxlan-create.html&#10;vxl&#9;null&#9;null&#10;nov&#9;FILE&#9;file:///home/h3yduck/cloud/circle/openstack_api/nova.py&#10;nova.p&#9;FILE&#9;file:///home/h3yduck/cloud/circle/openstack_api/nova.py&#10;vmdetailv&#9;null&#9;null&#10;editor&#9;null&#9;null&#10;networktopo&#9;FILE&#9;file:///home/h3yduck/cloud/circle/network/static/js/horizon.networktopology.js&#10;bow&#9;FILE&#9;file:///home/h3yduck/cloud/circle/bower.json&#10;base.py&#9;FILE&#9;file:///home/h3yduck/cloud/circle/circle/settings/base.py&#10;local&#9;null&#9;null&#10;vnc&#9;null&#9;null&#10;plain&#9;FILE&#9;file:///home/h3yduck/cloud/circle/dashboard/templates/dashboard/vm-plain-image-create.html&#10;forms&#9;null&#9;null&#10;vxlanform&#9;null&#9;null&#10;instanc&#9;FILE&#9;file:///home/h3yduck/cloud/circle/vm/models/instance.py&#10;index-vxla&#9;FILE&#9;file:///home/h3yduck/cloud/circle/dashboard/templates/dashboard/index-vxlans.html" />
<property name="SearchEverywhereHistoryKey" value="indexv&#9;null&#9;null&#10;index-vm&#9;FILE&#9;file:///home/h3yduck/cloud/circle/dashboard/templates/dashboard/index-vm.html&#10;index.&#9;FILE&#9;file:///home/h3yduck/cloud/circle/dashboard/views/index.py&#10;index&#9;FILE&#9;file:///home/h3yduck/cloud/circle/dashboard/templates/dashboard/index.html&#10;bas&#9;FILE&#9;file:///home/h3yduck/cloud/circle/openstack_api/base.py&#10;save&#9;null&#9;null&#10;plainc&#9;null&#9;null&#10;vmdeta&#9;null&#9;null&#10;templatedet&#9;null&#9;null&#10;instancetemp&#9;null&#9;null&#10;instancetem&#9;null&#9;null&#10;url&#9;FILE&#9;file:///home/h3yduck/cloud/circle/dashboard/urls.py&#10;vmcreate&#9;null&#9;null&#10;base&#9;FILE&#9;file:///home/h3yduck/cloud/circle/circle/settings/base.py&#10;opera&#9;FILE&#9;file:///home/h3yduck/cloud/circle/vm/operations.py&#10;operations&#9;FILE&#9;file:///home/h3yduck/cloud/circle/common/operations.py&#10;templat&#9;null&#9;null&#10;vmadd&#9;null&#9;null&#10;vmdetail&#9;null&#9;null&#10;addinterfa&#9;null&#9;null&#10;addin&#9;null&#9;null&#10;server&#9;null&#9;null&#10;Instance&#9;null&#9;null&#10;instance&#9;FILE&#9;file:///home/h3yduck/cloud/circle/vm/models/instance.py&#10;operat&#9;null&#9;null&#10;ins&#9;FILE&#9;file:///home/h3yduck/cloud/circle/vm/models/instance.py&#10;vmdetai&#9;null&#9;null&#10;operationvi&#9;null&#9;null&#10;ser&#9;null&#9;null&#10;server.&#9;FILE&#9;file:///home/h3yduck/.virtualenvs/cloud/local/lib/python2.7/site-packages/novaclient/v2/servers.py&#10;resources.&#9;FILE&#9;file:///home/h3yduck/cloud/circle/request/templates/request/initials/resources.html&#10;vm-de&#9;FILE&#9;file:///home/h3yduck/cloud/circle/dashboard/templates/dashboard/vm-detail.html&#10;vxla&#9;null&#9;null&#10;urls&#9;FILE&#9;file:///home/h3yduck/cloud/circle/dashboard/urls.py&#10;index-v&#9;FILE&#9;file:///home/h3yduck/cloud/circle/dashboard/templates/dashboard/index-vxlans.html&#10;create&#9;FILE&#9;file:///home/h3yduck/cloud/circle/network/templates/network/vxlan-create.html&#10;vxl&#9;null&#9;null&#10;nov&#9;FILE&#9;file:///home/h3yduck/cloud/circle/openstack_api/nova.py&#10;nova.p&#9;FILE&#9;file:///home/h3yduck/cloud/circle/openstack_api/nova.py&#10;vmdetailv&#9;null&#9;null&#10;editor&#9;null&#9;null&#10;networktopo&#9;FILE&#9;file:///home/h3yduck/cloud/circle/network/static/js/horizon.networktopology.js&#10;bow&#9;FILE&#9;file:///home/h3yduck/cloud/circle/bower.json&#10;base.py&#9;FILE&#9;file:///home/h3yduck/cloud/circle/circle/settings/base.py&#10;local&#9;null&#9;null&#10;vnc&#9;null&#9;null&#10;plain&#9;FILE&#9;file:///home/h3yduck/cloud/circle/dashboard/templates/dashboard/vm-plain-image-create.html&#10;forms&#9;null&#9;null&#10;vxlanform&#9;null&#9;null&#10;instanc&#9;FILE&#9;file:///home/h3yduck/cloud/circle/vm/models/instance.py" />
</component>
<component name="RecentsManager">
<key name="MoveFile.RECENT_KEYS">
......@@ -512,7 +474,7 @@
</properties>
</breakpoint>
</default-breakpoints>
<option name="time" value="262" />
<option name="time" value="266" />
</breakpoint-manager>
<watches-manager />
</component>
......@@ -557,48 +519,48 @@
</expressions>
<expressions id="evaluateExpression">
<expression>
<expression-string>view.request.user.permissions</expression-string>
<language-id>HTML</language-id>
<expression-string>quotas.get(&quot;instances&quot;)</expression-string>
<language-id>Python</language-id>
<evaluation-mode>EXPRESSION</evaluation-mode>
</expression>
<expression>
<expression-string>view.request.user.permissions['can_decide_request']</expression-string>
<language-id>HTML</language-id>
<expression-string>openstack_api.nova.tenant_quota_get(self.request, user.project_id)</expression-string>
<language-id>Python</language-id>
<evaluation-mode>EXPRESSION</evaluation-mode>
</expression>
<expression>
<expression-string>view.request.user.permissions.can_decide_request</expression-string>
<language-id>HTML</language-id>
<expression-string>openstack_api.nova.tenant_quota_get(self.request, user.project_id).instances</expression-string>
<language-id>Python</language-id>
<evaluation-mode>EXPRESSION</evaluation-mode>
</expression>
<expression>
<expression-string>id(view.request.user)</expression-string>
<language-id>HTML</language-id>
<expression-string>openstack_api.nova.tenant_quota_get(self.request, user.project_id)[&quot;instances&quot;]</expression-string>
<language-id>Python</language-id>
<evaluation-mode>EXPRESSION</evaluation-mode>
</expression>
<expression>
<expression-string>view.request.user</expression-string>
<language-id>HTML</language-id>
<expression-string>max_instances</expression-string>
<language-id>Python</language-id>
<evaluation-mode>EXPRESSION</evaluation-mode>
</expression>
<expression>
<expression-string>id(user.permissions)</expression-string>
<expression-string>openstack_api.nova.tenant_quota_get(self.request, self.)</expression-string>
<language-id>Python</language-id>
<evaluation-mode>EXPRESSION</evaluation-mode>
</expression>
<expression>
<expression-string>id(user)</expression-string>
<expression-string>openstack_api.nova.tenant_quota_get(self.request)</expression-string>
<language-id>Python</language-id>
<evaluation-mode>EXPRESSION</evaluation-mode>
</expression>
<expression>
<expression-string>user</expression-string>
<language-id>Python</language-id>
<expression-string>view.request.user.permissions</expression-string>
<language-id>HTML</language-id>
<evaluation-mode>EXPRESSION</evaluation-mode>
</expression>
<expression>
<expression-string>&amp;user</expression-string>
<language-id>Python</language-id>
<expression-string>view.request.user.permissions['can_decide_request']</expression-string>
<language-id>HTML</language-id>
<evaluation-mode>EXPRESSION</evaluation-mode>
</expression>
</expressions>
......@@ -836,14 +798,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/circle/dashboard/views/index.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="323">
<caret line="69" column="10" lean-forward="false" selection-start-line="69" selection-start-column="10" selection-end-line="69" selection-end-column="10" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/circle/network/models.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="244">
......@@ -960,14 +914,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/circle/request/urls.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="199">
<caret line="29" column="27" lean-forward="false" selection-start-line="29" selection-start-column="27" selection-end-line="29" selection-end-column="27" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$USER_HOME$/.virtualenvs/cloud/local/lib/python2.7/site-packages/django_tables2/views.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="306">
......@@ -976,26 +922,28 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/circle/circle/middleware.py">
<entry file="file://$USER_HOME$/.virtualenvs/cloud/local/lib/python2.7/site-packages/braces/views/_access.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="221">
<caret line="13" column="44" lean-forward="false" selection-start-line="13" selection-start-column="30" selection-end-line="13" selection-end-column="44" />
<state relative-caret-position="187">
<caret line="24" column="6" lean-forward="false" selection-start-line="24" selection-start-column="6" selection-end-line="24" selection-end-column="6" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/circle/dashboard/templates/dashboard/index-vm.html">
<entry file="file://$PROJECT_DIR$/circle/request/views.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="408">
<caret line="84" column="121" lean-forward="false" selection-start-line="84" selection-start-column="121" selection-end-line="84" selection-end-column="121" />
<folding />
<state relative-caret-position="250">
<caret line="339" column="43" lean-forward="true" selection-start-line="339" selection-start-column="43" selection-end-line="339" selection-end-column="43" />
<folding>
<element signature="e#731#787#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$USER_HOME$/.virtualenvs/cloud/local/lib/python2.7/site-packages/braces/views/_access.py">
<entry file="file://$PROJECT_DIR$/circle/request/urls.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="187">
<caret line="24" column="6" lean-forward="false" selection-start-line="24" selection-start-column="6" selection-end-line="24" selection-end-column="6" />
<state relative-caret-position="199">
<caret line="29" column="27" lean-forward="false" selection-start-line="29" selection-start-column="27" selection-end-line="29" selection-end-column="27" />
<folding />
</state>
</provider>
......@@ -1008,13 +956,27 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/circle/request/views.py">
<entry file="file://$PROJECT_DIR$/circle/circle/middleware.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-2844">
<caret line="157" column="49" lean-forward="false" selection-start-line="157" selection-start-column="49" selection-end-line="157" selection-end-column="49" />
<folding>
<element signature="e#731#787#0" expanded="true" />
</folding>
<state relative-caret-position="221">
<caret line="13" column="72" lean-forward="true" selection-start-line="13" selection-start-column="72" selection-end-line="13" selection-end-column="72" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/circle/dashboard/views/index.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="136">
<caret line="49" column="26" lean-forward="false" selection-start-line="49" selection-start-column="13" selection-end-line="49" selection-end-column="26" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/circle/dashboard/templates/dashboard/index-vm.html">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="617">
<caret line="91" column="96" lean-forward="false" selection-start-line="91" selection-start-column="96" selection-end-line="91" selection-end-column="96" />
<folding />
</state>
</provider>
</entry>
......
......@@ -89,7 +89,7 @@
</div>
<div class="panel-body" id="vm-graph-view" style="display: none">
<p class="pull-right">
<input class="knob" data-fgColor="chartreuse" data-thickness=".4" data-max="#TODO" data-width="100" data-height="100" data-readOnly="true" value="{{ instances|length|add:more_instances }}">
<input class="knob" data-fgColor="chartreuse" data-thickness=".4" data-max="{{ max_instances }}" data-width="100" data-height="100" data-readOnly="true" value="{{ instances|length|add:more_instances }}">
</p>
<span class="bigbig">{% blocktrans with count=running_vm_num %}<span class="big-tag">{{ count }}</span> running{% endblocktrans %}</span>
<ul class="list-inline" style="max-height: 95px; overflow: hidden;">
......
......@@ -42,10 +42,12 @@ class IndexView(LoginRequiredMixin, TemplateView):
context = super(IndexView, self).get_context_data(**kwargs)
instances = openstack_api.nova.server_list(self.request)[0] #TODO: flatten?
quotas = openstack_api.nova.tenant_quota_get(self.request, user.project_id)
context.update({
'instances': instances[:5],
'more_instances': len(instances) - len(instances[:5])
'more_instances': len(instances) - len(instances[:5]),
'max_instances': quotas.get("instances").limit
})
# instances
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment