From 83da2bf3963db3e4427bced3b4c0681e751e54da Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Thu, 23 Oct 2014 11:45:32 -0400 Subject: Refactor plugin configuration Fork a PluginConfig class out of PluginObject, the base object now supports a simple dictionary config, while using PluginConfig provide access to structured util.config based configuration. Change UI code that deal with plugins configuration to properly use the new structured config objects in order to represent data in appropriate format based on the data type. Use the new util.config objects to represent plugins configuration. Signed-off-by: Simo Sorce Reviewed-by: Patrick Uiterwijk --- templates/admin/plugin_config.html | 61 +++++++++++++++++++++++++++++++------- templates/admin/plugins.html | 4 +-- templates/admin/providers.html | 4 +-- 3 files changed, 55 insertions(+), 14 deletions(-) (limited to 'templates') diff --git a/templates/admin/plugin_config.html b/templates/admin/plugin_config.html index 1372f55..7071c7e 100644 --- a/templates/admin/plugin_config.html +++ b/templates/admin/plugin_config.html @@ -19,18 +19,59 @@
- - {% for o in options_order %} + {% for k, v in config.iteritems() %}
- +
- {% set val = plugin.get_config_value(o) %} - {% if val is string %} - - {% else %} - - {% endif %} - {{ plugin.get_config_desc(o) }} + {%- set value = v.get_value() -%} + {% if v.__class__.__name__ in ['String', 'Template'] -%} + + {% elif v.__class__.__name__ == 'List' -%} + + {% elif v.__class__.__name__ == 'Choice' -%} + {% set entries = v.get_allowed() -%} +
+ {% for e in entries -%} +
+  {{ e }} +
+ {% endfor %} +
+ {% elif v.__class__.__name__ == 'Pick' -%} + {% set entries = v.get_allowed() -%} +
+ {% for e in entries -%} +
+  {{ e }} +
+ {% endfor %} +
+ {% elif v.__class__.__name__ == 'Condition' -%} + + {% else -%} + {{ v.__class__.__name__ }} + {% endif -%} + {{ v.description }}

diff --git a/templates/admin/plugins.html b/templates/admin/plugins.html index 7bbe544..7ef50a0 100644 --- a/templates/admin/plugins.html +++ b/templates/admin/plugins.html @@ -28,7 +28,7 @@ Disable
- {%- if available[p].get_config_desc() %} + {%- if available[p].get_config_obj() %} Configure {% endif %}
@@ -88,7 +88,7 @@ Enable
- {%- if available[p].get_config_desc() %} + {%- if available[p].get_config_obj() %} Configure {% endif %}
diff --git a/templates/admin/providers.html b/templates/admin/providers.html index c0147d8..333b10d 100644 --- a/templates/admin/providers.html +++ b/templates/admin/providers.html @@ -28,7 +28,7 @@

Disable

- {%- if available[p].get_config_desc() %} + {%- if available[p].get_config_obj() %}

Configure

{% endif %}
@@ -54,7 +54,7 @@

Enable

- {%- if available[p].get_config_desc() %} + {%- if available[p].get_config_obj() %}

Configure

{% endif %}
-- cgit