diff --git a/superset-frontend/src/SqlLab/components/SouthPane/SouthPane.test.jsx b/superset-frontend/src/SqlLab/components/SouthPane/SouthPane.test.jsx index 519e729c418..b06488e3b78 100644 --- a/superset-frontend/src/SqlLab/components/SouthPane/SouthPane.test.jsx +++ b/superset-frontend/src/SqlLab/components/SouthPane/SouthPane.test.jsx @@ -61,7 +61,7 @@ const store = mockStore({ queries: { LCly_kkIN: { cached: false, - changedOn: Date.now(), + changed_on: new Date().toISOString(), db: 'main', dbId: 1, id: 'LCly_kkIN', @@ -71,7 +71,7 @@ const store = mockStore({ }, lXJa7F9_r: { cached: false, - changedOn: 1559238500401, + changed_on: new Date(1559238500401).toISOString(), db: 'main', dbId: 1, id: 'lXJa7F9_r', @@ -80,7 +80,7 @@ const store = mockStore({ }, '2g2_iRFMl': { cached: false, - changedOn: 1559238506925, + changed_on: new Date(1559238506925).toISOString(), db: 'main', dbId: 1, id: '2g2_iRFMl', @@ -89,7 +89,7 @@ const store = mockStore({ }, erWdqEWPm: { cached: false, - changedOn: 1559238516395, + changed_on: new Date(1559238516395).toISOString(), db: 'main', dbId: 1, id: 'erWdqEWPm', diff --git a/superset-frontend/src/SqlLab/fixtures.ts b/superset-frontend/src/SqlLab/fixtures.ts index 18faaebea25..ebfd0188851 100644 --- a/superset-frontend/src/SqlLab/fixtures.ts +++ b/superset-frontend/src/SqlLab/fixtures.ts @@ -217,7 +217,6 @@ export const queries = [ progress: 100, startDttm: 1476910566092.96, state: QueryState.SUCCESS, - changedOn: 1476910566000, tempTable: null, userId: 1, executedSql: null, @@ -276,7 +275,6 @@ export const queries = [ progress: 100, startDttm: 1476910570802.2, state: QueryState.SUCCESS, - changedOn: 1476910572000, tempTable: null, userId: 1, executedSql: @@ -310,7 +308,6 @@ export const queryWithNoQueryLimit = { progress: 100, startDttm: 1476910566092.96, state: QueryState.SUCCESS, - changedOn: 1476910566000, tempTable: null, userId: 1, executedSql: null, diff --git a/superset-frontend/src/SqlLab/reducers/sqlLab.js b/superset-frontend/src/SqlLab/reducers/sqlLab.js index 6dcd07a77b6..915bb3f6b73 100644 --- a/superset-frontend/src/SqlLab/reducers/sqlLab.js +++ b/superset-frontend/src/SqlLab/reducers/sqlLab.js @@ -614,8 +614,9 @@ export default function sqlLabReducer(state = {}, action) { (state.queries[id].state !== QueryState.STOPPED && state.queries[id].state !== QueryState.FAILED) ) { - if (changedQuery.changedOn > queriesLastUpdate) { - queriesLastUpdate = changedQuery.changedOn; + const changedOn = Date.parse(changedQuery.changed_on); + if (changedOn > queriesLastUpdate) { + queriesLastUpdate = changedOn; } const prevState = state.queries[id]?.state; const currentState = changedQuery.state; diff --git a/superset/charts/schemas.py b/superset/charts/schemas.py index 0ba4084c892..a5e0a6c44ca 100644 --- a/superset/charts/schemas.py +++ b/superset/charts/schemas.py @@ -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.String(metadata={"description": changed_on_description}) + changed_on = fields.DateTime(metadata={"description": changed_on_description}) description = fields.String(metadata={"description": description_description}) description_markeddown = fields.String( metadata={"description": description_markeddown_description} diff --git a/superset/explore/schemas.py b/superset/explore/schemas.py index f0060360cfe..37044c03942 100644 --- a/superset/explore/schemas.py +++ b/superset/explore/schemas.py @@ -114,7 +114,7 @@ class SliceSchema(Schema): certified_by = fields.String( metadata={"description": "Person or group that has certified this dashboard."} ) - changed_on = fields.String( + changed_on = fields.DateTime( metadata={"description": "Timestamp of the last modification."} ) changed_on_humanized = fields.String( diff --git a/superset/models/sql_lab.py b/superset/models/sql_lab.py index a566f75b43b..aeb4ba39dfd 100644 --- a/superset/models/sql_lab.py +++ b/superset/models/sql_lab.py @@ -135,7 +135,6 @@ class Query( 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, diff --git a/superset/sqllab/schemas.py b/superset/sqllab/schemas.py index 30274d6de92..d388dc0353d 100644 --- a/superset/sqllab/schemas.py +++ b/superset/sqllab/schemas.py @@ -58,8 +58,7 @@ class ExecutePayloadSchema(Schema): class QueryResultSchema(Schema): - changedOn = fields.DateTime() - changed_on = fields.String() + changed_on = fields.DateTime() dbId = fields.Integer() db = fields.String() # pylint: disable=invalid-name endDttm = fields.Float() diff --git a/tests/integration_tests/queries/api_tests.py b/tests/integration_tests/queries/api_tests.py index b3b291cf966..c58817c8e0e 100644 --- a/tests/integration_tests/queries/api_tests.py +++ b/tests/integration_tests/queries/api_tests.py @@ -439,7 +439,6 @@ class TestQueryApi(SupersetTestCase): 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",