Add Backup Strategies table
Commit 2c13af259a39c15e749580ee83598d90cd7f193c has missed files wich are added now. Change-Id: I1b692d7765bfd92dd255e0545b10e7325758935b
This commit is contained in:
parent
721866f6ed
commit
a266b4bed5
28
trove_dashboard/content/backup_strategies/panel.py
Normal file
28
trove_dashboard/content/backup_strategies/panel.py
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
# Copyright 2013 Rackspace Hosting
|
||||||
|
#
|
||||||
|
# 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 BackupStrategies(horizon.Panel):
|
||||||
|
name = _("Backup Strategies")
|
||||||
|
slug = 'backup_strategies'
|
||||||
|
permissions = ('openstack.services.database',
|
||||||
|
'openstack.services.object-store',)
|
||||||
|
|
||||||
|
|
||||||
|
dashboard.Project.register(BackupStrategies)
|
59
trove_dashboard/content/backup_strategies/tables.py
Normal file
59
trove_dashboard/content/backup_strategies/tables.py
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
# Copyright 2013 Rackspace Hosting
|
||||||
|
#
|
||||||
|
# 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 django.utils.translation import ungettext_lazy
|
||||||
|
|
||||||
|
from horizon import tables
|
||||||
|
|
||||||
|
from trove_dashboard import api
|
||||||
|
|
||||||
|
|
||||||
|
class DeleteBackupStrategy(tables.DeleteAction):
|
||||||
|
@staticmethod
|
||||||
|
def action_present(count):
|
||||||
|
return ungettext_lazy(
|
||||||
|
u"Delete Backup Strategy",
|
||||||
|
u"Delete Backup Strategies",
|
||||||
|
count
|
||||||
|
)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def action_past(count):
|
||||||
|
return ungettext_lazy(
|
||||||
|
u"Backup Strategy Deleted",
|
||||||
|
u"Backup Strategies Deleted",
|
||||||
|
count
|
||||||
|
)
|
||||||
|
|
||||||
|
def delete(self, request, obj_id):
|
||||||
|
api.trove.backup_strategy_delete(request, project_id=obj_id)
|
||||||
|
|
||||||
|
|
||||||
|
class BackupStrategiesTable(tables.DataTable):
|
||||||
|
backend = tables.Column("backend", verbose_name=_("Backend"))
|
||||||
|
instance_id = tables.Column("instance_id",
|
||||||
|
verbose_name=_("instance_id"))
|
||||||
|
project_id = tables.Column("project_id",
|
||||||
|
verbose_name=_("Project"))
|
||||||
|
swift_container = tables.Column("swift_container",
|
||||||
|
verbose_name=_("Swift Container"))
|
||||||
|
|
||||||
|
class Meta(object):
|
||||||
|
name = "backup_strategies"
|
||||||
|
verbose_name = _("Backup Strategies")
|
||||||
|
table_actions = (DeleteBackupStrategy,)
|
||||||
|
|
||||||
|
def get_object_id(self, datum):
|
||||||
|
return datum.project_id
|
@ -0,0 +1,7 @@
|
|||||||
|
{% extends 'base.html' %}
|
||||||
|
{% load i18n %}
|
||||||
|
{% block title %}{% trans "Backup Strategies" %}{% endblock %}
|
||||||
|
|
||||||
|
{% block main %}
|
||||||
|
{{ table.render }}
|
||||||
|
{% endblock %}
|
21
trove_dashboard/content/backup_strategies/urls.py
Normal file
21
trove_dashboard/content/backup_strategies/urls.py
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
# Copyright 2013 Rackspace Hosting
|
||||||
|
#
|
||||||
|
# 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.urls import url
|
||||||
|
|
||||||
|
from trove_dashboard.content.backup_strategies import views
|
||||||
|
|
||||||
|
urlpatterns = [
|
||||||
|
url(r'^$', views.IndexView.as_view(), name='index'),
|
||||||
|
]
|
39
trove_dashboard/content/backup_strategies/views.py
Normal file
39
trove_dashboard/content/backup_strategies/views.py
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
# Copyright 2013 Rackspace Hosting
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
"""
|
||||||
|
Views for displaying database backups.
|
||||||
|
"""
|
||||||
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
|
from horizon import exceptions
|
||||||
|
from horizon import tables as horizon_tables
|
||||||
|
|
||||||
|
from trove_dashboard import api
|
||||||
|
from trove_dashboard.content.backup_strategies import tables
|
||||||
|
|
||||||
|
|
||||||
|
class IndexView(horizon_tables.DataTableView):
|
||||||
|
table_class = tables.BackupStrategiesTable
|
||||||
|
template_name = 'project/backup_strategies/index.html'
|
||||||
|
page_title = _("Backup Strategies")
|
||||||
|
|
||||||
|
def get_data(self):
|
||||||
|
try:
|
||||||
|
backups = api.trove.backup_strategy_list(self.request)
|
||||||
|
except Exception:
|
||||||
|
backups = []
|
||||||
|
msg = _('Error getting backup strategies list.')
|
||||||
|
exceptions.handle(self.request, msg)
|
||||||
|
return backups
|
Loading…
x
Reference in New Issue
Block a user