mirror of
https://github.com/apache/superset.git
synced 2026-04-19 08:04:53 +00:00
[table] [columns] remove generic checkbox API (#9044)
This commit is contained in:
committed by
GitHub
parent
f0d3892b26
commit
ea399047d9
@@ -79,10 +79,11 @@
|
||||
<input
|
||||
class="form-control"
|
||||
type="checkbox"
|
||||
data-toggle="tooltip" rel="tooltip" title="{{_('Use the edit buttom to change this field')}}"
|
||||
{{'checked' if item[value] }}
|
||||
name="{{ '{}__{}'.format(pk, value) }}"
|
||||
id="{{ '{}__{}'.format(pk, value) }}"
|
||||
data-checkbox-api-prefix="/superset/checkbox/{{ modelview_name }}/{{ pk }}/{{ value }}/">
|
||||
disabled readonly/>
|
||||
{% else %}
|
||||
{{ item[value] }}
|
||||
{% endif %}
|
||||
|
||||
@@ -1045,26 +1045,6 @@ class Superset(BaseSupersetView):
|
||||
msg = _("Chart [{}] has been overwritten").format(slc.slice_name)
|
||||
flash(msg, "info")
|
||||
|
||||
@api
|
||||
@has_access_api
|
||||
@expose("/checkbox/<model_view>/<id_>/<attr>/<value>", methods=["GET"])
|
||||
def checkbox(self, model_view, id_, attr, value):
|
||||
"""endpoint for checking/unchecking any boolean in a sqla model"""
|
||||
modelview_to_model = {
|
||||
"{}ColumnInlineView".format(name.capitalize()): source.column_class
|
||||
for name, source in ConnectorRegistry.sources.items()
|
||||
}
|
||||
model = modelview_to_model[model_view]
|
||||
col = db.session.query(model).get(id_)
|
||||
checked = value == "true"
|
||||
if col:
|
||||
setattr(col, attr, checked)
|
||||
if checked:
|
||||
metrics = col.get_metrics().values()
|
||||
col.datasource.add_missing_metrics(metrics)
|
||||
db.session.commit()
|
||||
return json_success('"OK"')
|
||||
|
||||
@api
|
||||
@has_access_api
|
||||
@expose("/schemas/<db_id>/")
|
||||
|
||||
Reference in New Issue
Block a user