{% for sec_service in share_network.sec_services %}
- {% url 'horizon:project:shares:security_service_detail' sec_service.id as sec_service_url%}
+ {% url 'horizon:project:security_services:security_service_detail' sec_service.id as sec_service_url%}
diff --git a/manila_ui/dashboards/project/shares/templates/shares/share_networks/_share_network_update.html b/manila_ui/dashboards/project/share_networks/templates/share_networks/_update.html
similarity index 74%
rename from manila_ui/dashboards/project/shares/templates/shares/share_networks/_share_network_update.html
rename to manila_ui/dashboards/project/share_networks/templates/share_networks/_update.html
index 228e4dd1..021a617d 100644
--- a/manila_ui/dashboards/project/shares/templates/shares/share_networks/_share_network_update.html
+++ b/manila_ui/dashboards/project/share_networks/templates/share_networks/_update.html
@@ -2,7 +2,7 @@
{% load i18n %}
{% block form_id %}{% endblock %}
-{% block form_action %}{% url 'horizon:project:shares:update_share_network' share_network.id %}{% endblock %}
+{% block form_action %}{% url 'horizon:project:share_networks:share_network_update' share_network.id %}{% endblock %}
{% block modal_id %}update_share_network_modal{% endblock %}
{% block modal-header %}{% trans "Edit Share network" %}{% endblock %}
@@ -21,5 +21,5 @@
{% block modal-footer %}
- {% trans "Cancel" %}
+ {% trans "Cancel" %}
{% endblock %}
diff --git a/manila_ui/dashboards/project/shares/templates/shares/share_networks/create_share_network.html b/manila_ui/dashboards/project/share_networks/templates/share_networks/create.html
similarity index 64%
rename from manila_ui/dashboards/project/shares/templates/shares/share_networks/create_share_network.html
rename to manila_ui/dashboards/project/share_networks/templates/share_networks/create.html
index f750449f..96d222b5 100644
--- a/manila_ui/dashboards/project/shares/templates/shares/share_networks/create_share_network.html
+++ b/manila_ui/dashboards/project/share_networks/templates/share_networks/create.html
@@ -3,5 +3,5 @@
{% block title %}{% trans "Create Share Network" %}{% endblock %}
{% block main %}
- {% include 'project/shares/share_networks/_create_share_network.html' %}
+ {% include 'project/share_networks/_create.html' %}
{% endblock %}
diff --git a/manila_ui/dashboards/project/shares/templates/shares/shares/detail.html b/manila_ui/dashboards/project/share_networks/templates/share_networks/detail.html
similarity index 70%
rename from manila_ui/dashboards/project/shares/templates/shares/shares/detail.html
rename to manila_ui/dashboards/project/share_networks/templates/share_networks/detail.html
index 00f595fb..208776dc 100644
--- a/manila_ui/dashboards/project/shares/templates/shares/shares/detail.html
+++ b/manila_ui/dashboards/project/share_networks/templates/share_networks/detail.html
@@ -1,6 +1,6 @@
{% extends 'base.html' %}
{% load i18n %}
-{% block title %}{% trans "Share Details" %}{% endblock %}
+{% block title %}{% trans "Share Network Details" %}{% endblock %}
{% block main %}
diff --git a/manila_ui/dashboards/project/share_networks/templates/share_networks/index.html b/manila_ui/dashboards/project/share_networks/templates/share_networks/index.html
new file mode 100644
index 00000000..a9285d56
--- /dev/null
+++ b/manila_ui/dashboards/project/share_networks/templates/share_networks/index.html
@@ -0,0 +1,11 @@
+{% extends 'base.html' %}
+{% load i18n %}
+{% block title %}{% trans "Share Networks" %}{% endblock %}
+
+{% block main %}
+
+
+ {{ share_networks_table.render }}
+
+
+{% endblock %}
diff --git a/manila_ui/dashboards/project/shares/templates/shares/share_networks/share_network_update.html b/manila_ui/dashboards/project/share_networks/templates/share_networks/update.html
similarity index 100%
rename from manila_ui/dashboards/project/shares/templates/shares/share_networks/share_network_update.html
rename to manila_ui/dashboards/project/share_networks/templates/share_networks/update.html
diff --git a/manila_ui/dashboards/project/share_networks/urls.py b/manila_ui/dashboards/project/share_networks/urls.py
new file mode 100644
index 00000000..7a8a2899
--- /dev/null
+++ b/manila_ui/dashboards/project/share_networks/urls.py
@@ -0,0 +1,37 @@
+# Copyright 2017 Mirantis, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from django.conf import urls
+
+from manila_ui.dashboards.project.share_networks import views
+
+
+urlpatterns = [
+ urls.url(
+ r'^$',
+ views.ShareNetworksView.as_view(),
+ name='index'),
+ urls.url(
+ r'^create_share_network$',
+ views.Create.as_view(),
+ name='share_network_create'),
+ urls.url(
+ r'^(?P[^/]+)/update$',
+ views.Update.as_view(),
+ name='share_network_update'),
+ urls.url(
+ r'^(?P[^/]+)$',
+ views.Detail.as_view(),
+ name='share_network_detail'),
+]
diff --git a/manila_ui/dashboards/project/shares/share_networks/views.py b/manila_ui/dashboards/project/share_networks/views.py
similarity index 67%
rename from manila_ui/dashboards/project/shares/share_networks/views.py
rename to manila_ui/dashboards/project/share_networks/views.py
index 2080c582..ad00d7c8 100644
--- a/manila_ui/dashboards/project/shares/share_networks/views.py
+++ b/manila_ui/dashboards/project/share_networks/views.py
@@ -17,28 +17,55 @@ from django.core.urlresolvers import reverse_lazy
from django.utils.translation import ugettext_lazy as _
from horizon import exceptions
from horizon import forms
+from horizon import tables
from horizon import tabs
from horizon.utils import memoized
from horizon import workflows
-
-from manila_ui.api import manila
-from manila_ui.api import network
-from manila_ui.dashboards.project.shares.share_networks import forms \
- as share_net_forms
-from manila_ui.dashboards.project.shares.share_networks import tabs \
- as share_net_tabs
-from manila_ui.dashboards.project.shares.share_networks \
- import workflows as share_net_workflows
-from manila_ui.dashboards import utils
-
from openstack_dashboard.api import base
from openstack_dashboard.api import neutron
+from manila_ui.api import manila
+from manila_ui.api import network
+from manila_ui.dashboards.project.share_networks import forms as sn_forms
+from manila_ui.dashboards.project.share_networks import tables as sn_tables
+from manila_ui.dashboards.project.share_networks import tabs as sn_tabs
+import manila_ui.dashboards.project.share_networks.workflows as sn_workflows
+from manila_ui.dashboards import utils
+
+
+class ShareNetworksView(tables.MultiTableView):
+ table_classes = (
+ sn_tables.ShareNetworksTable,
+ )
+ template_name = "admin/share_networks/index.html"
+ page_title = _("Share Networks")
+
+ @memoized.memoized_method
+ def get_share_networks_data(self):
+ try:
+ share_networks = manila.share_network_list(
+ self.request, detailed=True)
+ if base.is_service_enabled(self.request, 'network'):
+ neutron_net_names = dict((net.id, net.name) for net in
+ neutron.network_list(self.request))
+ neutron_subnet_names = dict((net.id, net.name) for net in
+ neutron.subnet_list(self.request))
+ for sn in share_networks:
+ sn.neutron_net = neutron_net_names.get(
+ sn.neutron_net_id) or sn.neutron_net_id or "-"
+ sn.neutron_subnet = neutron_subnet_names.get(
+ sn.neutron_subnet_id) or sn.neutron_subnet_id or "-"
+ except Exception:
+ share_networks = []
+ exceptions.handle(
+ self.request, _("Unable to retrieve share networks"))
+ return share_networks
+
class Update(workflows.WorkflowView):
- workflow_class = share_net_workflows.UpdateShareNetworkWorkflow
- template_name = "project/shares/share_networks/share_network_update.html"
- success_url = 'horizon:project:shares:index'
+ workflow_class = sn_workflows.UpdateShareNetworkWorkflow
+ template_name = "project/share_networks/update.html"
+ success_url = 'horizon:project:share_networks:index'
page_title = _('Update Share Network')
def get_initial(self):
@@ -51,13 +78,14 @@ class Update(workflows.WorkflowView):
class Create(forms.ModalFormView):
- form_class = share_net_forms.Create
+ form_class = sn_forms.Create
form_id = "create_share_network"
- template_name = 'project/shares/share_networks/create_share_network.html'
+ template_name = 'project/share_networks/create.html'
modal_header = _("Create Share Network")
submit_label = _("Create")
- submit_url = reverse_lazy("horizon:project:shares:create_share_network")
- success_url = 'horizon:project:shares:index'
+ submit_url = reverse_lazy(
+ "horizon:project:share_networks:share_network_create")
+ success_url = 'horizon:project:share_networks:index'
page_title = _('Create Share Network')
def get_success_url(self):
@@ -65,9 +93,9 @@ class Create(forms.ModalFormView):
class Detail(tabs.TabView):
- tab_group_class = share_net_tabs.ShareNetworkDetailTabs
- template_name = 'project/shares/share_networks/detail.html'
- redirect_url = reverse_lazy('horizon:project:shares:index')
+ tab_group_class = sn_tabs.ShareNetworkDetailTabs
+ template_name = 'project/share_networks/detail.html'
+ redirect_url = reverse_lazy('horizon:project:share_networks:index')
def get_context_data(self, **kwargs):
context = super(Detail, self).get_context_data(**kwargs)
diff --git a/manila_ui/dashboards/project/shares/share_networks/workflows.py b/manila_ui/dashboards/project/share_networks/workflows.py
similarity index 99%
rename from manila_ui/dashboards/project/shares/share_networks/workflows.py
rename to manila_ui/dashboards/project/share_networks/workflows.py
index 6e713b9d..03802f62 100644
--- a/manila_ui/dashboards/project/shares/share_networks/workflows.py
+++ b/manila_ui/dashboards/project/share_networks/workflows.py
@@ -112,7 +112,7 @@ class UpdateShareNetworkWorkflow(workflows.Workflow):
finalize_button_name = _("Update Share Network")
success_message = _('Updated share network "%s".')
failure_message = _('Unable to update share network "%s".')
- success_url = 'horizon:project:shares:index'
+ success_url = 'horizon:project:share_networks:index'
default_steps = (UpdateShareNetworkInfoStep, AddSecurityServiceStep)
def format_status_message(self, message):
diff --git a/manila_ui/dashboards/project/shares/shares/__init__.py b/manila_ui/dashboards/project/share_snapshots/__init__.py
similarity index 100%
rename from manila_ui/dashboards/project/shares/shares/__init__.py
rename to manila_ui/dashboards/project/share_snapshots/__init__.py
diff --git a/manila_ui/dashboards/project/shares/snapshots/forms.py b/manila_ui/dashboards/project/share_snapshots/forms.py
similarity index 74%
rename from manila_ui/dashboards/project/shares/snapshots/forms.py
rename to manila_ui/dashboards/project/share_snapshots/forms.py
index 591c2a5a..3328dc75 100644
--- a/manila_ui/dashboards/project/shares/snapshots/forms.py
+++ b/manila_ui/dashboards/project/share_snapshots/forms.py
@@ -14,7 +14,7 @@
# under the License.
"""
-Views for managing snapshots.
+Views for managing share snapshots.
"""
from django.core.urlresolvers import reverse
@@ -22,7 +22,6 @@ from django.forms import ValidationError # noqa
from django.template.defaultfilters import filesizeformat # noqa
from django.utils.http import urlencode # noqa
from django.utils.translation import ugettext_lazy as _
-
from horizon import exceptions
from horizon import forms
from horizon import messages
@@ -30,19 +29,18 @@ from horizon import messages
from manila_ui.api import manila
-class CreateSnapshotForm(forms.SelfHandlingForm):
- name = forms.CharField(max_length="255", label=_("Snapshot Name"))
+class CreateShareSnapshotForm(forms.SelfHandlingForm):
+ name = forms.CharField(max_length="255", label=_("Share Snapshot Name"))
description = forms.CharField(
widget=forms.Textarea,
label=_("Description"), required=False)
def __init__(self, request, *args, **kwargs):
- super(CreateSnapshotForm, self).__init__(request, *args, **kwargs)
-
+ super(self.__class__, self).__init__(request, *args, **kwargs)
# populate share_id
share_id = kwargs.get('initial', {}).get('share_id', [])
- self.fields['share_id'] = forms.CharField(widget=forms.HiddenInput(),
- initial=share_id)
+ self.fields['share_id'] = forms.CharField(
+ widget=forms.HiddenInput(), initial=share_id)
def handle(self, request, data):
try:
@@ -52,30 +50,30 @@ class CreateSnapshotForm(forms.SelfHandlingForm):
messages.success(request, message)
return snapshot
except Exception:
- redirect = reverse("horizon:project:shares:index")
+ redirect = reverse("horizon:project:share_snapshots:index")
exceptions.handle(request,
_('Unable to create share snapshot.'),
redirect=redirect)
-class UpdateForm(forms.SelfHandlingForm):
- name = forms.CharField(max_length="255", label=_("Snapshot Name"))
- description = forms.CharField(widget=forms.Textarea,
- label=_("Description"), required=False)
+class UpdateShareSnapshotForm(forms.SelfHandlingForm):
+ name = forms.CharField(max_length="255", label=_("Share Snapshot Name"))
+ description = forms.CharField(
+ widget=forms.Textarea, label=_("Description"), required=False)
def handle(self, request, data):
snapshot_id = self.initial['snapshot_id']
try:
manila.share_snapshot_update(
request, snapshot_id, data['name'], data['description'])
- message = _('Updating snapshot "%s"') % data['name']
+ message = _('Updating share snapshot "%s"') % data['name']
messages.success(request, message)
return True
except Exception:
- exceptions.handle(request, _('Unable to update snapshot.'))
+ exceptions.handle(request, _('Unable to update share snapshot.'))
-class AddRule(forms.SelfHandlingForm):
+class AddShareSnapshotRule(forms.SelfHandlingForm):
access_type = forms.ChoiceField(
label=_("Access Type"), required=True,
choices=(('ip', 'ip'), ('user', 'user'), ('cephx', 'cephx'),
@@ -94,7 +92,8 @@ class AddRule(forms.SelfHandlingForm):
messages.success(request, message)
return True
except Exception:
- redirect = reverse("horizon:project:shares:snapshot_manage_rules",
- args=[self.initial['snapshot_id']])
+ redirect = reverse(
+ "horizon:project:share_snapshots:share_snapshot_manage_rules",
+ args=[self.initial['snapshot_id']])
exceptions.handle(
request, _('Unable to add snapshot rule.'), redirect=redirect)
diff --git a/manila_ui/dashboards/project/share_snapshots/panel.py b/manila_ui/dashboards/project/share_snapshots/panel.py
new file mode 100644
index 00000000..8b074ad8
--- /dev/null
+++ b/manila_ui/dashboards/project/share_snapshots/panel.py
@@ -0,0 +1,28 @@
+# Copyright 2017 Mirantis, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from django.utils.translation import ugettext_lazy as _
+import horizon
+from openstack_dashboard.dashboards.project import dashboard
+
+
+class ShareSnapshots(horizon.Panel):
+ name = _("Share Snapshots")
+ slug = 'share_snapshots'
+ permissions = (
+ 'openstack.services.share',
+ )
+
+
+dashboard.Project.register(ShareSnapshots)
diff --git a/manila_ui/dashboards/project/shares/snapshots/tables.py b/manila_ui/dashboards/project/share_snapshots/tables.py
similarity index 69%
rename from manila_ui/dashboards/project/shares/snapshots/tables.py
rename to manila_ui/dashboards/project/share_snapshots/tables.py
index e7947070..fa918588 100644
--- a/manila_ui/dashboards/project/shares/snapshots/tables.py
+++ b/manila_ui/dashboards/project/share_snapshots/tables.py
@@ -20,18 +20,17 @@ from django.utils.translation import pgettext_lazy
from django.utils.translation import string_concat # noqa
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import ungettext_lazy
-
from horizon import exceptions
from horizon import tables
+from openstack_dashboard.usage import quotas
from manila_ui.api import manila
-from openstack_dashboard.usage import quotas
DELETABLE_STATES = ("available", "error")
-class UpdateRow(tables.Row):
+class UpdateShareSnapshotRow(tables.Row):
ajax = True
def get_data(self, request, snapshot_id):
@@ -45,10 +44,10 @@ def get_size(snapshot):
return _("%sGiB") % snapshot.size
-class CreateSnapshot(tables.LinkAction):
- name = "snapshots"
- verbose_name = _("Create Snapshot")
- url = "horizon:project:shares:create_snapshot"
+class CreateShareSnapshot(tables.LinkAction):
+ name = "create_share_snapshot"
+ verbose_name = _("Create Share Snapshot")
+ url = "horizon:project:share_snapshots:share_snapshot_create"
classes = ("ajax-modal", "btn-camera")
policy_rules = (("share", "share:create_snapshot"),)
@@ -63,10 +62,10 @@ class CreateSnapshot(tables.LinkAction):
if usages['snapshots']['available'] <= 0:
if "disabled" not in self.classes:
self.classes = [c for c in self.classes] + ['disabled']
- self.verbose_name = string_concat(self.verbose_name, ' ',
- _("(Quota exceeded)"))
+ self.verbose_name = string_concat(
+ self.verbose_name, ' ', _("(Quota exceeded)"))
else:
- self.verbose_name = _("Create Snapshot")
+ self.verbose_name = _("Create Share Snapshot")
classes = [c for c in self.classes if c != "disabled"]
self.classes = classes
@@ -81,22 +80,22 @@ class CreateSnapshot(tables.LinkAction):
return share.status in ("available", "in-use") and snapshot_support
-class DeleteSnapshot(tables.DeleteAction):
+class DeleteShareSnapshot(tables.DeleteAction):
policy_rules = (("share", "share:delete_snapshot"),)
@staticmethod
def action_present(count):
return ungettext_lazy(
- u"Delete Snapshot",
- u"Delete Snapshots",
+ u"Delete Share Snapshot",
+ u"Delete Share Snapshots",
count
)
@staticmethod
def action_past(count):
return ungettext_lazy(
- u"Deleted Snapshot",
- u"Deleted Snapshots",
+ u"Deleted Share Snapshot",
+ u"Deleted Share Snapshots",
count
)
@@ -123,8 +122,8 @@ class DeleteSnapshot(tables.DeleteAction):
return True
-class CreateShareFromSnapshot(tables.LinkAction):
- name = "create_from_snapshot"
+class CreateShareFromShareSnapshot(tables.LinkAction):
+ name = "create_share_from_share_snapshot"
verbose_name = _("Create Share")
url = "horizon:project:shares:create"
classes = ("ajax-modal", "btn-camera")
@@ -139,22 +138,22 @@ class CreateShareFromSnapshot(tables.LinkAction):
return share.status == "available"
-class EditSnapshot(tables.LinkAction):
- name = "edit_snapshot"
- verbose_name = _("Edit Snapshot")
- url = "horizon:project:shares:edit_snapshot"
+class EditShareSnapshot(tables.LinkAction):
+ name = "edit_share_snapshot"
+ verbose_name = _("Edit Share Snapshot")
+ url = "horizon:project:share_snapshots:share_snapshot_edit"
classes = ("ajax-modal", "btn-camera")
-class SnapshotShareNameColumn(tables.Column):
+class ShareSnapshotShareNameColumn(tables.Column):
def get_link_url(self, snapshot):
return reverse(self.link, args=(snapshot.share_id,))
-class ManageRules(tables.LinkAction):
- name = "snapshot_manage_rules"
- verbose_name = _("Manage Rules")
- url = "horizon:project:shares:snapshot_manage_rules"
+class ManageShareSnapshotRules(tables.LinkAction):
+ name = "share_snapshot_manage_rules"
+ verbose_name = _("Manage Share Snapshot Rules")
+ url = "horizon:project:share_snapshots:share_snapshot_manage_rules"
classes = ("btn-edit",)
policy_rules = (("share", "share:access_get_all"),)
@@ -163,10 +162,10 @@ class ManageRules(tables.LinkAction):
return share.mount_snapshot_support
-class AddRule(tables.LinkAction):
- name = "snapshot_rule_add"
- verbose_name = _("Add rule")
- url = 'horizon:project:shares:snapshot_rule_add'
+class AddShareSnapshotRule(tables.LinkAction):
+ name = "share_snapshot_rule_add"
+ verbose_name = _("Add Share Snapshot Rule")
+ url = 'horizon:project:share_snapshots:share_snapshot_rule_add'
classes = ("ajax-modal", "btn-create")
icon = "plus"
policy_rules = (("share", "share:allow_access"),)
@@ -180,22 +179,22 @@ class AddRule(tables.LinkAction):
return reverse(self.url, args=[self.table.kwargs['snapshot_id']])
-class DeleteRule(tables.DeleteAction):
+class DeleteShareSnapshotRule(tables.DeleteAction):
policy_rules = (("share", "share:deny_access"),)
@staticmethod
def action_present(count):
return ungettext_lazy(
- u"Delete Rule",
- u"Delete Rules",
+ u"Delete Share Snapshot Rule",
+ u"Delete Share Snapshot Rules",
count
)
@staticmethod
def action_past(count):
return ungettext_lazy(
- u"Deleted Rule",
- u"Deleted Rules",
+ u"Deleted Share Snapshot Rule",
+ u"Deleted Share Snapshot Rules",
count
)
@@ -208,7 +207,7 @@ class DeleteRule(tables.DeleteAction):
exceptions.handle(request, msg)
-class UpdateRuleRow(tables.Row):
+class UpdateShareSnapshotRuleRow(tables.Row):
ajax = True
def get_data(self, request, rule_id):
@@ -221,7 +220,7 @@ class UpdateRuleRow(tables.Row):
raise exceptions.NotFound
-class RulesTable(tables.DataTable):
+class ShareSnapshotRulesTable(tables.DataTable):
access_type = tables.Column("access_type", verbose_name=_("Access Type"))
access_to = tables.Column("access_to", verbose_name=_("Access to"))
status = tables.Column("state", verbose_name=_("Status"))
@@ -231,17 +230,19 @@ class RulesTable(tables.DataTable):
class Meta(object):
name = "rules"
- verbose_name = _("Rules")
+ verbose_name = _("Share Snapshot Rules")
status_columns = ["status"]
- row_class = UpdateRuleRow
+ row_class = UpdateShareSnapshotRuleRow
table_actions = (
- AddRule,
- DeleteRule)
+ AddShareSnapshotRule,
+ DeleteShareSnapshotRule,
+ )
row_actions = (
- DeleteRule,)
+ DeleteShareSnapshotRule,
+ )
-class SnapshotsTable(tables.DataTable):
+class ShareSnapshotsTable(tables.DataTable):
STATUS_CHOICES = (
("in-use", True),
("available", True),
@@ -250,43 +251,50 @@ class SnapshotsTable(tables.DataTable):
)
STATUS_DISPLAY_CHOICES = (
("in-use", pgettext_lazy("Current status of snapshot", u"In-use")),
- ("available", pgettext_lazy("Current status of snapshot",
- u"Available")),
+ ("available",
+ pgettext_lazy("Current status of snapshot", u"Available")),
("creating", pgettext_lazy("Current status of snapshot", u"Creating")),
("error", pgettext_lazy("Current status of snapshot", u"Error")),
)
- name = tables.Column("name",
- verbose_name=_("Name"),
- link="horizon:project:shares:snapshot-detail")
- description = tables.Column("description",
- verbose_name=_("Description"),
- truncate=40)
- size = tables.Column(get_size,
- verbose_name=_("Size"),
- attrs={'data-type': 'size'})
- status = tables.Column("status",
- filters=(title,),
- verbose_name=_("Status"),
- status=True,
- status_choices=STATUS_CHOICES,
- display_choices=STATUS_DISPLAY_CHOICES)
- source = SnapshotShareNameColumn("share",
- verbose_name=_("Source"),
- link="horizon:project:shares:detail")
+ name = tables.Column(
+ "name",
+ verbose_name=_("Name"),
+ link="horizon:project:share_snapshots:share_snapshot_detail")
+ description = tables.Column(
+ "description",
+ verbose_name=_("Description"),
+ truncate=40)
+ size = tables.Column(
+ get_size,
+ verbose_name=_("Size"),
+ attrs={'data-type': 'size'})
+ status = tables.Column(
+ "status",
+ filters=(title,),
+ verbose_name=_("Status"),
+ status=True,
+ status_choices=STATUS_CHOICES,
+ display_choices=STATUS_DISPLAY_CHOICES)
+ source = ShareSnapshotShareNameColumn(
+ "share",
+ verbose_name=_("Source"),
+ link="horizon:project:shares:detail")
def get_object_display(self, obj):
return obj.name
class Meta(object):
- name = "snapshots"
- verbose_name = _("Snapshots")
+ name = "share_snapshots"
+ verbose_name = _("Share Snapshots")
status_columns = ["status"]
- row_class = UpdateRow
+ row_class = UpdateShareSnapshotRow
table_actions = (
tables.NameFilterAction,
- DeleteSnapshot)
+ DeleteShareSnapshot,
+ )
row_actions = (
- EditSnapshot,
- CreateShareFromSnapshot,
- ManageRules,
- DeleteSnapshot)
+ EditShareSnapshot,
+ CreateShareFromShareSnapshot,
+ ManageShareSnapshotRules,
+ DeleteShareSnapshot,
+ )
diff --git a/manila_ui/dashboards/project/share_snapshots/tabs.py b/manila_ui/dashboards/project/share_snapshots/tabs.py
new file mode 100644
index 00000000..9d326bc1
--- /dev/null
+++ b/manila_ui/dashboards/project/share_snapshots/tabs.py
@@ -0,0 +1,31 @@
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from django.utils.translation import ugettext_lazy as _
+from horizon import tabs
+
+
+class ShareSnapshotOverviewTab(tabs.Tab):
+ name = _("Share Snapshot Overview")
+ slug = "share_snapshot_overview_tab"
+ template_name = "project/share_snapshots/_detail.html"
+
+ def get_context_data(self, request):
+ return {"snapshot": self.tab_group.kwargs['snapshot']}
+
+
+class ShareSnapshotDetailTabs(tabs.TabGroup):
+ slug = "share_snapshot_details"
+ tabs = (
+ ShareSnapshotOverviewTab,
+ )
diff --git a/manila_ui/dashboards/project/shares/templates/shares/snapshots/_create_snapshot.html b/manila_ui/dashboards/project/share_snapshots/templates/share_snapshots/_create.html
similarity index 57%
rename from manila_ui/dashboards/project/shares/templates/shares/snapshots/_create_snapshot.html
rename to manila_ui/dashboards/project/share_snapshots/templates/share_snapshots/_create.html
index bde30f06..e9ccb5b9 100644
--- a/manila_ui/dashboards/project/shares/templates/shares/snapshots/_create_snapshot.html
+++ b/manila_ui/dashboards/project/share_snapshots/templates/share_snapshots/_create.html
@@ -2,6 +2,6 @@
{% load i18n %}
{% block modal-body-right %}
- {% include "project/shares/snapshots/_limits_snapshots.html" with usages=usages snapshot_quota=True %}
+ {% include "project/share_snapshots/_limits.html" with usages=usages snapshot_quota=True %}
{% endblock %}
diff --git a/manila_ui/dashboards/project/shares/templates/shares/snapshots/_snapshot_detail_overview.html b/manila_ui/dashboards/project/share_snapshots/templates/share_snapshots/_detail.html
similarity index 96%
rename from manila_ui/dashboards/project/shares/templates/shares/snapshots/_snapshot_detail_overview.html
rename to manila_ui/dashboards/project/share_snapshots/templates/share_snapshots/_detail.html
index 23002ced..862a210c 100644
--- a/manila_ui/dashboards/project/shares/templates/shares/snapshots/_snapshot_detail_overview.html
+++ b/manila_ui/dashboards/project/share_snapshots/templates/share_snapshots/_detail.html
@@ -8,7 +8,7 @@
{{ snapshot.name }}
{% trans "ID" %}
{{ snapshot.id }}
- {% url 'horizon:admin:shares:detail' snapshot.share_id as share_url %}
+ {% url 'horizon:project:shares:detail' snapshot.share_id as share_url %}
diff --git a/manila_ui/dashboards/project/shares/templates/shares/shares/_create.html b/manila_ui/dashboards/project/shares/templates/shares/_extend.html
similarity index 71%
rename from manila_ui/dashboards/project/shares/templates/shares/shares/_create.html
rename to manila_ui/dashboards/project/shares/templates/shares/_extend.html
index fefa3d39..8d87895c 100644
--- a/manila_ui/dashboards/project/shares/templates/shares/shares/_create.html
+++ b/manila_ui/dashboards/project/shares/templates/shares/_extend.html
@@ -2,6 +2,6 @@
{% load i18n %}
{% block modal-body-right %}
- {% include "project/shares/shares/_limits.html" with usages=usages %}
+ {% include "project/shares/_extend_limits.html" with usages=usages %}
{% endblock %}
diff --git a/manila_ui/dashboards/project/shares/templates/shares/shares/_extend_limits.html b/manila_ui/dashboards/project/shares/templates/shares/_extend_limits.html
similarity index 100%
rename from manila_ui/dashboards/project/shares/templates/shares/shares/_extend_limits.html
rename to manila_ui/dashboards/project/shares/templates/shares/_extend_limits.html
diff --git a/manila_ui/dashboards/project/shares/templates/shares/shares/_limits.html b/manila_ui/dashboards/project/shares/templates/shares/_limits.html
similarity index 100%
rename from manila_ui/dashboards/project/shares/templates/shares/shares/_limits.html
rename to manila_ui/dashboards/project/shares/templates/shares/_limits.html
diff --git a/manila_ui/dashboards/project/shares/templates/shares/shares/_manage_rules.html b/manila_ui/dashboards/project/shares/templates/shares/_manage_rules.html
similarity index 100%
rename from manila_ui/dashboards/project/shares/templates/shares/shares/_manage_rules.html
rename to manila_ui/dashboards/project/shares/templates/shares/_manage_rules.html
diff --git a/manila_ui/dashboards/project/shares/templates/shares/shares/_revert.html b/manila_ui/dashboards/project/shares/templates/shares/_revert.html
similarity index 100%
rename from manila_ui/dashboards/project/shares/templates/shares/shares/_revert.html
rename to manila_ui/dashboards/project/shares/templates/shares/_revert.html
diff --git a/manila_ui/dashboards/project/shares/templates/shares/shares/_rule_add.html b/manila_ui/dashboards/project/shares/templates/shares/_rule_add.html
similarity index 100%
rename from manila_ui/dashboards/project/shares/templates/shares/shares/_rule_add.html
rename to manila_ui/dashboards/project/shares/templates/shares/_rule_add.html
diff --git a/manila_ui/dashboards/project/shares/templates/shares/shares/_update.html b/manila_ui/dashboards/project/shares/templates/shares/_update.html
similarity index 100%
rename from manila_ui/dashboards/project/shares/templates/shares/shares/_update.html
rename to manila_ui/dashboards/project/shares/templates/shares/_update.html
diff --git a/manila_ui/dashboards/project/shares/templates/shares/shares/_update_metadata.html b/manila_ui/dashboards/project/shares/templates/shares/_update_metadata.html
similarity index 100%
rename from manila_ui/dashboards/project/shares/templates/shares/shares/_update_metadata.html
rename to manila_ui/dashboards/project/shares/templates/shares/_update_metadata.html
diff --git a/manila_ui/dashboards/project/shares/templates/shares/shares/create.html b/manila_ui/dashboards/project/shares/templates/shares/create.html
similarity index 70%
rename from manila_ui/dashboards/project/shares/templates/shares/shares/create.html
rename to manila_ui/dashboards/project/shares/templates/shares/create.html
index 41a37c26..780eb727 100644
--- a/manila_ui/dashboards/project/shares/templates/shares/shares/create.html
+++ b/manila_ui/dashboards/project/shares/templates/shares/create.html
@@ -3,5 +3,5 @@
{% block title %}{% trans "Create Share" %}{% endblock %}
{% block main %}
- {% include 'project/shares/shares/_create.html' %}
+ {% include 'project/shares/_create.html' %}
{% endblock %}
diff --git a/manila_ui/dashboards/project/shares/templates/shares/share_networks/detail.html b/manila_ui/dashboards/project/shares/templates/shares/detail.html
similarity index 100%
rename from manila_ui/dashboards/project/shares/templates/shares/share_networks/detail.html
rename to manila_ui/dashboards/project/shares/templates/shares/detail.html
diff --git a/manila_ui/dashboards/project/shares/templates/shares/shares/extend.html b/manila_ui/dashboards/project/shares/templates/shares/extend.html
similarity index 63%
rename from manila_ui/dashboards/project/shares/templates/shares/shares/extend.html
rename to manila_ui/dashboards/project/shares/templates/shares/extend.html
index 03ae1203..9658518f 100644
--- a/manila_ui/dashboards/project/shares/templates/shares/shares/extend.html
+++ b/manila_ui/dashboards/project/shares/templates/shares/extend.html
@@ -3,5 +3,5 @@
{% block title %}{% trans "Extend Share" %}{% endblock %}
{% block main %}
- {% include 'project/shares/shares/_extend.html' %}
-{% endblock %}
\ No newline at end of file
+ {% include 'project/shares/_extend.html' %}
+{% endblock %}
diff --git a/manila_ui/dashboards/project/shares/templates/shares/index.html b/manila_ui/dashboards/project/shares/templates/shares/index.html
index 7ee65323..1f041e09 100644
--- a/manila_ui/dashboards/project/shares/templates/shares/index.html
+++ b/manila_ui/dashboards/project/shares/templates/shares/index.html
@@ -5,7 +5,7 @@
{% block main %}