Andrew Bogott has uploaded a new change for review.
https://gerrit.wikimedia.org/r/277943
Change subject: WIP: Modify designatedashboard to recognize proxy records
......................................................................
WIP: Modify designatedashboard to recognize proxy records
We don't want users editing or deleting dns records that were
created by the proxy panel. This patch replaces the edit/delete
buttons with an 'edit proxies' button which will link directly
to the proxy panel.
Todo: recordIsProxy() needs to be configurable or query the
dynamic proxy API for a list of IPs that can be presumed
proxies.
Change-Id: Ia2e7323cad39b85d0d5063823b4e4abc40901a97
---
M modules/openstack/files/liberty/horizon/overrides.py
1 file changed, 57 insertions(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/operations/puppet
refs/changes/43/277943/1
diff --git a/modules/openstack/files/liberty/horizon/overrides.py
b/modules/openstack/files/liberty/horizon/overrides.py
index 251f607..7c5bce5 100644
--- a/modules/openstack/files/liberty/horizon/overrides.py
+++ b/modules/openstack/files/liberty/horizon/overrides.py
@@ -1,3 +1,6 @@
+from django.core import urlresolvers
+from django.utils.translation import ugettext_lazy as _ # noqa
+
# -- Tidy up the instance creation panel --
from openstack_dashboard.dashboards.project.instances.workflows import
create_instance
@@ -9,3 +12,57 @@
create_instance.SetInstanceDetails,
create_instance.SetAccessControls,
create_instance.SetNetwork)
+
+
+# -- Support proxy records in the designate dashboard --
+
+
+# In the designate dashboard, we have some records that are special
+# and maanged by the proxy dashboard. We need to remove the edit/delete
+# buttons for those records and instead add a button that jumps to
+# the proxy panel.
+from horizon import tables
+from designatedashboard.dashboards.project.dns_domains import tables as
ddtables
+
+
+def recordIsProxy(record):
+ return record.data == '208.80.155.156'
+
+
+# Disable the 'edit' and 'delete' button for proxies...
+class EditRecord(ddtables.EditRecord):
+ def allowed(self, request, record=None):
+ if recordIsProxy(record):
+ return False
+ else:
+ return record.type in ddtables.EDITABLE_RECORD_TYPES
+
+
+class DeleteRecord(ddtables.DeleteRecord):
+ def allowed(self, request, record=None):
+ if recordIsProxy(record):
+ return False
+ else:
+ return record.type in ddtables.EDITABLE_RECORD_TYPES
+
+
+# And put an 'edit proxies' button in their place
+class EditProxies(tables.LinkAction):
+ '''Link action for a record created by the dynamic proxy panel.'''
+ name = "edit_proxies"
+ verbose_name = _("Edit Proxies")
+ classes = ("btn-edit")
+ policy_rules = (("dns", "update_record"),)
+
+ def get_link_url(self, datum=None):
+ return "/project/proxies"
+
+ def allowed(self, request, record=None):
+ return recordIsProxy(record)
+
+
+class RecordsTableWithProxies(ddtables.RecordsTable):
+ class Meta(object):
+ row_actions = (EditRecord, DeleteRecord, EditProxies)
+
+ddtables.RecordsTable = RecordsTableWithProxies
--
To view, visit https://gerrit.wikimedia.org/r/277943
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia2e7323cad39b85d0d5063823b4e4abc40901a97
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Andrew Bogott <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits