fix(sql-lab): remove redundant onChange schema property (#24422)

This commit is contained in:
Ville Brofeldt
2023-06-16 17:38:26 +03:00
committed by GitHub
parent d6a61c125a
commit 20e0036336
8 changed files with 10 additions and 15 deletions

View File

@@ -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',

View File

@@ -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,

View File

@@ -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;

View File

@@ -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}

View File

@@ -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(

View File

@@ -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,

View File

@@ -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()

View File

@@ -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",