diff --git a/superset-frontend/src/SqlLab/components/SouthPane/SouthPane.test.jsx b/superset-frontend/src/SqlLab/components/SouthPane/SouthPane.test.jsx index b06488e3b7871..519e729c41847 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, - changed_on: new Date().toISOString(), + changedOn: Date.now(), db: 'main', dbId: 1, id: 'LCly_kkIN', @@ -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', @@ -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', @@ -89,7 +89,7 @@ const store = mockStore({ }, erWdqEWPm: { cached: false, - changed_on: new Date(1559238516395).toISOString(), + changedOn: 1559238516395, db: 'main', dbId: 1, id: 'erWdqEWPm', diff --git a/superset-frontend/src/SqlLab/fixtures.ts b/superset-frontend/src/SqlLab/fixtures.ts index ebfd01888515e..18faaebea25d7 100644 --- a/superset-frontend/src/SqlLab/fixtures.ts +++ b/superset-frontend/src/SqlLab/fixtures.ts @@ -217,6 +217,7 @@ export const queries = [ progress: 100, startDttm: 1476910566092.96, state: QueryState.SUCCESS, + changedOn: 1476910566000, tempTable: null, userId: 1, executedSql: null, @@ -275,6 +276,7 @@ export const queries = [ progress: 100, startDttm: 1476910570802.2, state: QueryState.SUCCESS, + changedOn: 1476910572000, tempTable: null, userId: 1, executedSql: @@ -308,6 +310,7 @@ 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 915bb3f6b730a..6dcd07a77b68b 100644 --- a/superset-frontend/src/SqlLab/reducers/sqlLab.js +++ b/superset-frontend/src/SqlLab/reducers/sqlLab.js @@ -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; diff --git a/superset/charts/schemas.py b/superset/charts/schemas.py index a5e0a6c44cac0..0ba4084c89259 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.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} diff --git a/superset/explore/schemas.py b/superset/explore/schemas.py index 37044c0394284..f0060360cfe49 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.DateTime( + changed_on = fields.String( 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 fbadaaa2f488a..c72f133068435 100644 --- a/superset/models/sql_lab.py +++ b/superset/models/sql_lab.py @@ -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, diff --git a/superset/sqllab/schemas.py b/superset/sqllab/schemas.py index d388dc0353d72..30274d6de923d 100644 --- a/superset/sqllab/schemas.py +++ b/superset/sqllab/schemas.py @@ -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() diff --git a/tests/integration_tests/queries/api_tests.py b/tests/integration_tests/queries/api_tests.py index c58817c8e0ed1..b3b291cf96627 100644 --- a/tests/integration_tests/queries/api_tests.py +++ b/tests/integration_tests/queries/api_tests.py @@ -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",