mirror of
https://github.com/apache/superset.git
synced 2026-05-12 19:35:17 +00:00
chore: make TS enums strictly PascalCase (#26875)
This commit is contained in:
@@ -77,7 +77,7 @@ export default function getInitialState({
|
||||
let queryEditor: QueryEditor;
|
||||
if (activeTab && activeTab.id === id) {
|
||||
queryEditor = {
|
||||
version: activeTab.extra_json?.version ?? QueryEditorVersion.v1,
|
||||
version: activeTab.extra_json?.version ?? QueryEditorVersion.V1,
|
||||
id: id.toString(),
|
||||
loaded: true,
|
||||
name: activeTab.label,
|
||||
|
||||
@@ -318,7 +318,7 @@ export default function sqlLabReducer(state = {}, action) {
|
||||
},
|
||||
[actions.STOP_QUERY]() {
|
||||
return alterInObject(state, 'queries', action.query, {
|
||||
state: QueryState.STOPPED,
|
||||
state: QueryState.Stopped,
|
||||
results: [],
|
||||
});
|
||||
},
|
||||
@@ -332,7 +332,7 @@ export default function sqlLabReducer(state = {}, action) {
|
||||
},
|
||||
[actions.REQUEST_QUERY_RESULTS]() {
|
||||
return alterInObject(state, 'queries', action.query, {
|
||||
state: QueryState.FETCHING,
|
||||
state: QueryState.Fetching,
|
||||
});
|
||||
},
|
||||
[actions.QUERY_SUCCESS]() {
|
||||
@@ -340,7 +340,7 @@ export default function sqlLabReducer(state = {}, action) {
|
||||
// or the final result was unsuccessful
|
||||
if (
|
||||
action.query.state === QueryState.STOPPED ||
|
||||
action.results.status !== QueryState.SUCCESS
|
||||
action.results.status !== QueryState.Success
|
||||
) {
|
||||
return state;
|
||||
}
|
||||
@@ -349,7 +349,7 @@ export default function sqlLabReducer(state = {}, action) {
|
||||
progress: 100,
|
||||
results: action.results,
|
||||
rows: action?.results?.query?.rows || 0,
|
||||
state: QueryState.SUCCESS,
|
||||
state: QueryState.Success,
|
||||
limitingFactor: action?.results?.query?.limitingFactor,
|
||||
tempSchema: action?.results?.query?.tempSchema,
|
||||
tempTable: action?.results?.query?.tempTable,
|
||||
@@ -365,11 +365,11 @@ export default function sqlLabReducer(state = {}, action) {
|
||||
return alterInObject(state, 'queries', action.query, alts);
|
||||
},
|
||||
[actions.QUERY_FAILED]() {
|
||||
if (action.query.state === QueryState.STOPPED) {
|
||||
if (action.query.state === QueryState.Stopped) {
|
||||
return state;
|
||||
}
|
||||
const alts = {
|
||||
state: QueryState.FAILED,
|
||||
state: QueryState.Failed,
|
||||
errors: action.errors,
|
||||
errorMessage: action.msg,
|
||||
endDttm: now(),
|
||||
@@ -648,8 +648,8 @@ export default function sqlLabReducer(state = {}, action) {
|
||||
Object.entries(action.alteredQueries).forEach(([id, changedQuery]) => {
|
||||
if (
|
||||
!state.queries.hasOwnProperty(id) ||
|
||||
(state.queries[id].state !== QueryState.STOPPED &&
|
||||
state.queries[id].state !== QueryState.FAILED)
|
||||
(state.queries[id].state !== QueryState.Stopped &&
|
||||
state.queries[id].state !== QueryState.Failed)
|
||||
) {
|
||||
const changedOn = normalizeTimestamp(changedQuery.changed_on);
|
||||
const timestamp = Date.parse(changedOn);
|
||||
@@ -671,11 +671,11 @@ export default function sqlLabReducer(state = {}, action) {
|
||||
// because of async behavior, sql lab may still poll a couple of seconds
|
||||
// when it started fetching or finished rendering results
|
||||
state:
|
||||
currentState === QueryState.SUCCESS &&
|
||||
currentState === QueryState.Success &&
|
||||
[
|
||||
QueryState.FETCHING,
|
||||
QueryState.SUCCESS,
|
||||
QueryState.RUNNING,
|
||||
QueryState.Fetching,
|
||||
QueryState.Success,
|
||||
QueryState.Running,
|
||||
].includes(prevState)
|
||||
? prevState
|
||||
: currentState,
|
||||
|
||||
@@ -397,7 +397,7 @@ describe('sqlLabReducer', () => {
|
||||
id: 'abcd',
|
||||
changed_on: Date.now(),
|
||||
startDttm: Date.now(),
|
||||
state: QueryState.FETCHING,
|
||||
state: QueryState.Fetching,
|
||||
progress: 100,
|
||||
resultsKey: 'fa3dccc4-c549-4fbf-93c8-b4fb5a6fb8b7',
|
||||
cached: false,
|
||||
@@ -412,7 +412,7 @@ describe('sqlLabReducer', () => {
|
||||
...query,
|
||||
results: {
|
||||
query_id: 1234,
|
||||
status: QueryState.SUCCESS,
|
||||
status: QueryState.Success,
|
||||
data: [],
|
||||
},
|
||||
},
|
||||
@@ -420,7 +420,7 @@ describe('sqlLabReducer', () => {
|
||||
},
|
||||
actions.clearInactiveQueries(Date.now()),
|
||||
);
|
||||
expect(newState.queries.abcd.state).toBe(QueryState.SUCCESS);
|
||||
expect(newState.queries.abcd.state).toBe(QueryState.Success);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user