Skip to content

Commit

Permalink
chore: move bullet string manipulation to frontend (#9773)
Browse files Browse the repository at this point in the history
  • Loading branch information
villebro authored May 11, 2020
1 parent a8d5a8a commit f369ab3
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 44 deletions.
6 changes: 3 additions & 3 deletions superset-frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion superset-frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
"@superset-ui/legacy-plugin-chart-world-map": "^0.13.6",
"@superset-ui/legacy-preset-chart-big-number": "^0.13.5",
"@superset-ui/legacy-preset-chart-deckgl": "^0.2.3",
"@superset-ui/legacy-preset-chart-nvd3": "^0.13.5",
"@superset-ui/legacy-preset-chart-nvd3": "^0.13.9",
"@superset-ui/number-format": "^0.13.3",
"@superset-ui/plugin-chart-word-cloud": "^0.13.9",
"@superset-ui/preset-chart-xy": "^0.13.5",
Expand Down
20 changes: 0 additions & 20 deletions superset/viz.py
Original file line number Diff line number Diff line change
Expand Up @@ -1091,20 +1091,6 @@ def query_obj(self):
d = super().query_obj()
self.metric = form_data.get("metric")

def as_strings(field):
value = form_data.get(field)
return value.split(",") if value else []

def as_floats(field):
return [float(x) for x in as_strings(field)]

self.ranges = as_floats("ranges")
self.range_labels = as_strings("range_labels")
self.markers = as_floats("markers")
self.marker_labels = as_strings("marker_labels")
self.marker_lines = as_floats("marker_lines")
self.marker_line_labels = as_strings("marker_line_labels")

d["metrics"] = [self.metric]
if not self.metric:
raise QueryObjectValidationError(_("Pick a metric to display"))
Expand All @@ -1115,12 +1101,6 @@ def get_data(self, df: pd.DataFrame) -> VizData:
values = df["metric"].values
return {
"measures": values.tolist(),
"ranges": self.ranges or [0, values.max() * 1.1],
"rangeLabels": self.range_labels or None,
"markers": self.markers or None,
"markerLabels": self.marker_labels or None,
"markerLines": self.marker_lines or None,
"markerLineLabels": self.marker_line_labels or None,
}


Expand Down
20 changes: 0 additions & 20 deletions superset/viz_sip38.py
Original file line number Diff line number Diff line change
Expand Up @@ -1120,20 +1120,6 @@ def query_obj(self):
d = super().query_obj()
self.metric = form_data.get("metric")

def as_strings(field):
value = form_data.get(field)
return value.split(",") if value else []

def as_floats(field):
return [float(x) for x in as_strings(field)]

self.ranges = as_floats("ranges")
self.range_labels = as_strings("range_labels")
self.markers = as_floats("markers")
self.marker_labels = as_strings("marker_labels")
self.marker_lines = as_floats("marker_lines")
self.marker_line_labels = as_strings("marker_line_labels")

d["metrics"] = [self.metric]
if not self.metric:
raise QueryObjectValidationError(_("Pick a metric to display"))
Expand All @@ -1144,12 +1130,6 @@ def get_data(self, df: pd.DataFrame) -> VizData:
values = df["metric"].values
return {
"measures": values.tolist(),
"ranges": self.ranges or [0, values.max() * 1.1],
"rangeLabels": self.range_labels or None,
"markers": self.markers or None,
"markerLabels": self.marker_labels or None,
"markerLines": self.marker_lines or None,
"markerLineLabels": self.marker_line_labels or None,
}


Expand Down

0 comments on commit f369ab3

Please sign in to comment.