Remove bulk actions from records page
Change-Id: I878dc5328ce223fd9533460b643e28e0cfab6847
This commit is contained in:
parent
4e18e31f7f
commit
094dba75de
@ -16,6 +16,7 @@ import logging
|
||||
from django.core import urlresolvers
|
||||
from django.utils.translation import ugettext_lazy as _ # noqa
|
||||
|
||||
from horizon import exceptions
|
||||
from horizon import tables
|
||||
|
||||
from designatedashboard import api
|
||||
@ -108,7 +109,20 @@ class EditRecord(tables.LinkAction):
|
||||
return record.type in EDITABLE_RECORD_TYPES
|
||||
|
||||
|
||||
class DeleteRecord(tables.BatchAction):
|
||||
class DeleteRecord(tables.DeleteAction):
|
||||
|
||||
'''Link action for navigating to the UpdateRecord view.'''
|
||||
data_type_singular = _("Record")
|
||||
|
||||
def delete(self, request, record_id):
|
||||
domain_id = self.table.kwargs['domain_id']
|
||||
return api.designate.record_delete(request, domain_id, record_id)
|
||||
|
||||
def allowed(self, request, record=None):
|
||||
return record.type in EDITABLE_RECORD_TYPES
|
||||
|
||||
|
||||
class BatchDeleteRecord(tables.BatchAction):
|
||||
|
||||
'''Batch action for deleting domain records.'''
|
||||
|
||||
@ -116,16 +130,12 @@ class DeleteRecord(tables.BatchAction):
|
||||
action_present = _("Delete")
|
||||
action_past = _("Deleted")
|
||||
data_type_singular = _("Record")
|
||||
data_type_plural = _("Records")
|
||||
classes = ('btn-danger', 'btn-delete')
|
||||
|
||||
def action(self, request, record_id):
|
||||
domain_id = self.table.kwargs['domain_id']
|
||||
api.designate.record_delete(request, domain_id, record_id)
|
||||
|
||||
def allowed(self, request, record=None):
|
||||
return record.type in EDITABLE_RECORD_TYPES
|
||||
|
||||
|
||||
class DomainsTable(tables.DataTable):
|
||||
|
||||
@ -189,5 +199,6 @@ class RecordsTable(tables.DataTable):
|
||||
class Meta:
|
||||
name = "records"
|
||||
verbose_name = _("Records")
|
||||
table_actions = (CreateRecord, DeleteRecord,)
|
||||
table_actions = (CreateRecord,)
|
||||
row_actions = (EditRecord, DeleteRecord,)
|
||||
multi_select = False
|
||||
|
@ -12,10 +12,17 @@
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
from designateclient import exceptions as designateclient
|
||||
from openstack_dashboard import exceptions
|
||||
|
||||
NOT_FOUND = exceptions.NOT_FOUND
|
||||
RECOVERABLE = exceptions.RECOVERABLE
|
||||
# + (solumclient.ClientException,)
|
||||
UNAUTHORIZED = exceptions.UNAUTHORIZED
|
||||
NOT_FOUND = exceptions.NOT_FOUND + (
|
||||
designateclient.ResourceNotFound,
|
||||
designateclient.NotFound,
|
||||
)
|
||||
RECOVERABLE = exceptions.RECOVERABLE + (
|
||||
designateclient.BadRequest,
|
||||
designateclient.Conflict,
|
||||
)
|
||||
UNAUTHORIZED = exceptions.UNAUTHORIZED + (
|
||||
designateclient.Forbidden,
|
||||
)
|
||||
|
@ -12,6 +12,8 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from designatedashboard import exceptions
|
||||
|
||||
PANEL = 'domains'
|
||||
|
||||
# The name of the panel to be added to HORIZON_CONFIG. Required.
|
||||
@ -21,6 +23,12 @@ PANEL_DASHBOARD = 'project'
|
||||
# The name of the panel group the PANEL is associated with.
|
||||
PANEL_GROUP = 'dns'
|
||||
|
||||
ADD_EXCEPTIONS = {
|
||||
'recoverable': exceptions.RECOVERABLE,
|
||||
'not_found': exceptions.NOT_FOUND,
|
||||
'unauthorized': exceptions.UNAUTHORIZED,
|
||||
}
|
||||
|
||||
# Python panel class of the PANEL to be added.
|
||||
ADD_PANEL = (
|
||||
'designatedashboard.dashboards.project.dns_domains.panel.DNSDomains')
|
||||
|
Loading…
Reference in New Issue
Block a user