mirror of
https://github.com/apache/superset.git
synced 2026-04-18 23:55:00 +00:00
refactor(sql_lab): SQL Lab Persistent Saved State (#17771)
* a lot of console logs * testing * test * added saved_query to remoteId * created useEffect so that title properly changes in modal * Update superset-frontend/src/SqlLab/actions/sqlLab.js Co-authored-by: Lyndsi Kay Williams <55605634+lyndsiWilliams@users.noreply.github.com> Co-authored-by: Lyndsi Kay Williams <55605634+lyndsiWilliams@users.noreply.github.com>
This commit is contained in:
@@ -211,6 +211,11 @@ class SavedQuery(Model, AuditMixinNullable, ExtraJSONMixin, ImportExportMixin):
|
||||
def __repr__(self) -> str:
|
||||
return str(self.label)
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
return {
|
||||
"id": self.id,
|
||||
}
|
||||
|
||||
@property
|
||||
def pop_tab_link(self) -> Markup:
|
||||
return Markup(
|
||||
@@ -285,6 +290,10 @@ class TabState(Model, AuditMixinNullable, ExtraJSONMixin):
|
||||
template_params = Column(Text)
|
||||
hide_left_bar = Column(Boolean, default=False)
|
||||
|
||||
# any saved queries that are associated with the Tab State
|
||||
saved_query_id = Column(Integer, ForeignKey("saved_query.id"), nullable=True)
|
||||
saved_query = relationship("SavedQuery", foreign_keys=[saved_query_id])
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
return {
|
||||
"id": self.id,
|
||||
@@ -300,6 +309,7 @@ class TabState(Model, AuditMixinNullable, ExtraJSONMixin):
|
||||
"autorun": self.autorun,
|
||||
"template_params": self.template_params,
|
||||
"hide_left_bar": self.hide_left_bar,
|
||||
"saved_query": self.saved_query.to_dict() if self.saved_query else None,
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user