diff --git a/panoramix/forms.py b/panoramix/forms.py index 9debfa9ee..b37ba09eb 100644 --- a/panoramix/forms.py +++ b/panoramix/forms.py @@ -38,19 +38,9 @@ class BetterSelectMultipleField(SelectMultipleField): class OmgWtForm(Form): - field_order = tuple() + fieldsets = {} css_classes = dict() - @property - def fields(self): - fields = [] - for field in self.field_order: - if hasattr(self, field): - obj = getattr(self, field) - if isinstance(obj, Field): - fields.append(getattr(self, field)) - return fields - def get_field(self, fieldname): return getattr(self, fieldname) @@ -179,7 +169,7 @@ class FormFactory(object): default="random", description="Rotation to apply to words in the cloud"), 'line_interpolation': SelectField( - "Line Interpolation", + "Line Style", choices=self.choicify([ 'linear', 'basis', 'cardinal', 'monotone', 'step-before', 'step-after']), @@ -204,7 +194,7 @@ class FormFactory(object): default="150", description="Font size for the biggest value in the list"), 'show_brush': BetterBooleanField( - "Range Selector", default=True, + "Range Filter", default=True, description=( "Whether to display the time range interactive selector")), 'show_legend': BetterBooleanField( @@ -239,7 +229,7 @@ class FormFactory(object): "[integer] Number of period to compare against, " "this is relative to the granularity selected")), 'time_compare': TextField( - "Time Shift Compare", + "Time Shift", default="", description=( "Overlay a timeseries from a " @@ -278,7 +268,7 @@ class FormFactory(object): field_css_classes[field] += ['select2Sortable'] class QueryForm(OmgWtForm): - field_order = copy(viz.form_fields) + fieldsets = copy(viz.fieldsetizer()) css_classes = field_css_classes standalone = HiddenField() async = HiddenField() @@ -286,6 +276,7 @@ class FormFactory(object): slice_id = HiddenField() slice_name = HiddenField() previous_viz_type = HiddenField(default=viz.viz_type) + collapsed_fieldsets = HiddenField() filter_cols = datasource.filterable_column_names or [''] for i in range(10): @@ -300,23 +291,24 @@ class FormFactory(object): setattr( QueryForm, 'flt_eq_' + str(i), TextField("Super", default='')) - for ff in viz.form_fields: - if isinstance(ff, string_types): - ff = [ff] - for s in ff: - if s: - setattr(QueryForm, s, px_form_fields[s]) + for fieldset in viz.fieldsetizer(): + for ff in fieldset['fields']: + if isinstance(ff, string_types): + ff = [ff] + for s in ff: + if s: + setattr(QueryForm, s, px_form_fields[s]) # datasource type specific form elements if datasource.__class__.__name__ == 'SqlaTable': - QueryForm.field_order += ['where', 'having'] + QueryForm.fieldsets += ( + {'label': 'SQL', 'fields': ['where', 'having']},) setattr(QueryForm, 'where', px_form_fields['where']) setattr(QueryForm, 'having', px_form_fields['having']) - if 'granularity' in viz.form_fields: + if 'granularity' in viz.flat_form_fields(): setattr( QueryForm, 'granularity', px_form_fields['granularity_sqla']) field_css_classes['granularity'] = ['form-control', 'select2'] - return QueryForm diff --git a/panoramix/static/panoramix.css b/panoramix/static/panoramix.css index a75335c16..bbdb22b9f 100644 --- a/panoramix/static/panoramix.css +++ b/panoramix/static/panoramix.css @@ -10,6 +10,34 @@ form div { .navbar-brand a { color: white; } +fieldset.fs-style { + font-family: Verdana, Arial, sans-serif; + font-size: small; + font-weight: normal; + border: 1px solid #CCC; + background-color: #F4F4F4; + border-radius: 6px; + padding: 10px; + margin: 10px 0px; +} +legend.legend-style { + font-size: 14px; + padding: 0px 6px; + cursor: pointer; + margin: 0px; + color: #444; + background-color: transparent; + font-weight: bold; +} +.nvtooltip{ + position: relative; !important + z-index: 10; +} + +legend { + width: auto; + border-bottom: 0px; +} .navbar { -webkit-box-shadow: 0px 3px 3px #AAA; -moz-box-shadow: 0px 3px 3px #AAA; diff --git a/panoramix/templates/panoramix/explore.html b/panoramix/templates/panoramix/explore.html index dedad101e..9ed8ea592 100644 --- a/panoramix/templates/panoramix/explore.html +++ b/panoramix/templates/panoramix/explore.html @@ -22,57 +22,74 @@