Skip to content

Commit

Permalink
Revert "fix(sql-lab): remove redundant onChange schema property (apac…
Browse files Browse the repository at this point in the history
…he#24422)"

This reverts commit 20e0036.
  • Loading branch information
jinghua-qa committed Jun 22, 2023
1 parent a40d12a commit fb77ac8
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const store = mockStore({
queries: {
LCly_kkIN: {
cached: false,
changed_on: new Date().toISOString(),
changedOn: Date.now(),
db: 'main',
dbId: 1,
id: 'LCly_kkIN',
Expand All @@ -71,7 +71,7 @@ const store = mockStore({
},
lXJa7F9_r: {
cached: false,
changed_on: new Date(1559238500401).toISOString(),
changedOn: 1559238500401,
db: 'main',
dbId: 1,
id: 'lXJa7F9_r',
Expand All @@ -80,7 +80,7 @@ const store = mockStore({
},
'2g2_iRFMl': {
cached: false,
changed_on: new Date(1559238506925).toISOString(),
changedOn: 1559238506925,
db: 'main',
dbId: 1,
id: '2g2_iRFMl',
Expand All @@ -89,7 +89,7 @@ const store = mockStore({
},
erWdqEWPm: {
cached: false,
changed_on: new Date(1559238516395).toISOString(),
changedOn: 1559238516395,
db: 'main',
dbId: 1,
id: 'erWdqEWPm',
Expand Down
3 changes: 3 additions & 0 deletions superset-frontend/src/SqlLab/fixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ export const queries = [
progress: 100,
startDttm: 1476910566092.96,
state: QueryState.SUCCESS,
changedOn: 1476910566000,
tempTable: null,
userId: 1,
executedSql: null,
Expand Down Expand Up @@ -275,6 +276,7 @@ export const queries = [
progress: 100,
startDttm: 1476910570802.2,
state: QueryState.SUCCESS,
changedOn: 1476910572000,
tempTable: null,
userId: 1,
executedSql:
Expand Down Expand Up @@ -308,6 +310,7 @@ export const queryWithNoQueryLimit = {
progress: 100,
startDttm: 1476910566092.96,
state: QueryState.SUCCESS,
changedOn: 1476910566000,
tempTable: null,
userId: 1,
executedSql: null,
Expand Down
5 changes: 2 additions & 3 deletions superset-frontend/src/SqlLab/reducers/sqlLab.js
Original file line number Diff line number Diff line change
Expand Up @@ -614,9 +614,8 @@ export default function sqlLabReducer(state = {}, action) {
(state.queries[id].state !== QueryState.STOPPED &&
state.queries[id].state !== QueryState.FAILED)
) {
const changedOn = Date.parse(changedQuery.changed_on);
if (changedOn > queriesLastUpdate) {
queriesLastUpdate = changedOn;
if (changedQuery.changedOn > queriesLastUpdate) {
queriesLastUpdate = changedQuery.changedOn;
}
const prevState = state.queries[id]?.state;
const currentState = changedQuery.state;
Expand Down
2 changes: 1 addition & 1 deletion superset/charts/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ class ChartEntityResponseSchema(Schema):
id = fields.Integer(metadata={"description": id_description})
slice_name = fields.String(metadata={"description": slice_name_description})
cache_timeout = fields.Integer(metadata={"description": cache_timeout_description})
changed_on = fields.DateTime(metadata={"description": changed_on_description})
changed_on = fields.String(metadata={"description": changed_on_description})
description = fields.String(metadata={"description": description_description})
description_markeddown = fields.String(
metadata={"description": description_markeddown_description}
Expand Down
2 changes: 1 addition & 1 deletion superset/explore/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ class SliceSchema(Schema):
certified_by = fields.String(
metadata={"description": "Person or group that has certified this dashboard."}
)
changed_on = fields.DateTime(
changed_on = fields.String(
metadata={"description": "Timestamp of the last modification."}
)
changed_on_humanized = fields.String(
Expand Down
1 change: 1 addition & 0 deletions superset/models/sql_lab.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ def get_template_processor(self, **kwargs: Any) -> BaseTemplateProcessor:

def to_dict(self) -> dict[str, Any]:
return {
"changedOn": self.changed_on,
"changed_on": self.changed_on.isoformat(),
"dbId": self.database_id,
"db": self.database.database_name if self.database else None,
Expand Down
3 changes: 2 additions & 1 deletion superset/sqllab/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ class ExecutePayloadSchema(Schema):


class QueryResultSchema(Schema):
changed_on = fields.DateTime()
changedOn = fields.DateTime()
changed_on = fields.String()
dbId = fields.Integer()
db = fields.String() # pylint: disable=invalid-name
endDttm = fields.Float()
Expand Down
1 change: 1 addition & 0 deletions tests/integration_tests/queries/api_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,7 @@ def test_get_updated_since(self):
for key, value in data["result"][0].items():
# We can't assert timestamp
if key not in (
"changedOn",
"changed_on",
"end_time",
"start_running_time",
Expand Down

0 comments on commit fb77ac8

Please sign in to comment.