test(frontend): use absolute path for src imports (#9761)

* test(frontend): use absolute path for src imports

* Upgrade prettier, fix eslint
This commit is contained in:
Jesse Yang
2020-05-07 14:18:10 -07:00
committed by GitHub
parent 6237cea952
commit 13c5b133a9
220 changed files with 827 additions and 1730 deletions

View File

@@ -240,7 +240,7 @@ export function startQuery(query) {
}
export function querySuccess(query, results) {
return function(dispatch) {
return function (dispatch) {
const sync =
!query.isDataPreview &&
isFeatureEnabled(FeatureFlag.SQLLAB_BACKEND_PERSISTENCE)
@@ -266,7 +266,7 @@ export function querySuccess(query, results) {
}
export function queryFailed(query, msg, link) {
return function(dispatch) {
return function (dispatch) {
const sync =
!query.isDataPreview &&
isFeatureEnabled(FeatureFlag.SQLLAB_BACKEND_PERSISTENCE)
@@ -308,7 +308,7 @@ export function requestQueryResults(query) {
}
export function fetchQueryResults(query, displayLimit) {
return function(dispatch) {
return function (dispatch) {
dispatch(requestQueryResults(query));
return SupersetClient.get({
@@ -333,7 +333,7 @@ export function fetchQueryResults(query, displayLimit) {
}
export function runQuery(query) {
return function(dispatch) {
return function (dispatch) {
dispatch(startQuery(query));
const postPayload = {
client_id: query.id,
@@ -376,7 +376,7 @@ export function runQuery(query) {
}
export function validateQuery(query) {
return function(dispatch) {
return function (dispatch) {
dispatch(startQueryValidation(query));
const postPayload = {
@@ -409,7 +409,7 @@ export function validateQuery(query) {
}
export function postStopQuery(query) {
return function(dispatch) {
return function (dispatch) {
return SupersetClient.post({
endpoint: '/superset/stop_query/',
postPayload: { client_id: query.id },
@@ -477,7 +477,7 @@ export function migrateQueryEditorFromLocalStorage(
tables,
queries,
) {
return function(dispatch) {
return function (dispatch) {
return SupersetClient.post({
endpoint: '/tabstateview/',
postPayload: { queryEditor },
@@ -520,7 +520,7 @@ export function migrateQueryEditorFromLocalStorage(
}
export function addQueryEditor(queryEditor) {
return function(dispatch) {
return function (dispatch) {
const sync = isFeatureEnabled(FeatureFlag.SQLLAB_BACKEND_PERSISTENCE)
? SupersetClient.post({
endpoint: '/tabstateview/',
@@ -552,7 +552,7 @@ export function addQueryEditor(queryEditor) {
}
export function cloneQueryToNewTab(query, autorun) {
return function(dispatch, getState) {
return function (dispatch, getState) {
const state = getState();
const { queryEditors, tabHistory } = state.sqlLab;
const sourceQueryEditor = queryEditors.find(
@@ -573,7 +573,7 @@ export function cloneQueryToNewTab(query, autorun) {
}
export function setActiveQueryEditor(queryEditor) {
return function(dispatch) {
return function (dispatch) {
const sync = isFeatureEnabled(FeatureFlag.SQLLAB_BACKEND_PERSISTENCE)
? SupersetClient.post({
endpoint: encodeURI(`/tabstateview/${queryEditor.id}/activate`),
@@ -635,7 +635,7 @@ export function setTables(tableSchemas) {
}
export function switchQueryEditor(queryEditor, displayLimit) {
return function(dispatch) {
return function (dispatch) {
if (
isFeatureEnabled(FeatureFlag.SQLLAB_BACKEND_PERSISTENCE) &&
!queryEditor.loaded
@@ -688,7 +688,7 @@ export function setActiveSouthPaneTab(tabId) {
}
export function removeQueryEditor(queryEditor) {
return function(dispatch) {
return function (dispatch) {
const sync = isFeatureEnabled(FeatureFlag.SQLLAB_BACKEND_PERSISTENCE)
? SupersetClient.delete({
endpoint: encodeURI(`/tabstateview/${queryEditor.id}`),
@@ -710,7 +710,7 @@ export function removeQueryEditor(queryEditor) {
}
export function removeQuery(query) {
return function(dispatch) {
return function (dispatch) {
const sync = isFeatureEnabled(FeatureFlag.SQLLAB_BACKEND_PERSISTENCE)
? SupersetClient.delete({
endpoint: encodeURI(
@@ -734,7 +734,7 @@ export function removeQuery(query) {
}
export function queryEditorSetDb(queryEditor, dbId) {
return function(dispatch) {
return function (dispatch) {
const sync = isFeatureEnabled(FeatureFlag.SQLLAB_BACKEND_PERSISTENCE)
? SupersetClient.put({
endpoint: encodeURI(`/tabstateview/${queryEditor.id}`),
@@ -757,7 +757,7 @@ export function queryEditorSetDb(queryEditor, dbId) {
}
export function queryEditorSetSchema(queryEditor, schema) {
return function(dispatch) {
return function (dispatch) {
const sync = isFeatureEnabled(FeatureFlag.SQLLAB_BACKEND_PERSISTENCE)
? SupersetClient.put({
endpoint: encodeURI(`/tabstateview/${queryEditor.id}`),
@@ -790,7 +790,7 @@ export function queryEditorSetTableOptions(queryEditor, options) {
}
export function queryEditorSetAutorun(queryEditor, autorun) {
return function(dispatch) {
return function (dispatch) {
const sync = isFeatureEnabled(FeatureFlag.SQLLAB_BACKEND_PERSISTENCE)
? SupersetClient.put({
endpoint: encodeURI(`/tabstateview/${queryEditor.id}`),
@@ -815,7 +815,7 @@ export function queryEditorSetAutorun(queryEditor, autorun) {
}
export function queryEditorSetTitle(queryEditor, title) {
return function(dispatch) {
return function (dispatch) {
const sync = isFeatureEnabled(FeatureFlag.SQLLAB_BACKEND_PERSISTENCE)
? SupersetClient.put({
endpoint: encodeURI(`/tabstateview/${queryEditor.id}`),
@@ -840,7 +840,7 @@ export function queryEditorSetTitle(queryEditor, title) {
}
export function queryEditorSetSql(queryEditor, sql) {
return function(dispatch) {
return function (dispatch) {
const sync = isFeatureEnabled(FeatureFlag.SQLLAB_BACKEND_PERSISTENCE)
? SupersetClient.put({
endpoint: encodeURI(`/tabstateview/${queryEditor.id}`),
@@ -865,7 +865,7 @@ export function queryEditorSetSql(queryEditor, sql) {
}
export function queryEditorSetQueryLimit(queryEditor, queryLimit) {
return function(dispatch) {
return function (dispatch) {
const sync = isFeatureEnabled(FeatureFlag.SQLLAB_BACKEND_PERSISTENCE)
? SupersetClient.put({
endpoint: encodeURI(`/tabstateview/${queryEditor.id}`),
@@ -894,7 +894,7 @@ export function queryEditorSetQueryLimit(queryEditor, queryLimit) {
}
export function queryEditorSetTemplateParams(queryEditor, templateParams) {
return function(dispatch) {
return function (dispatch) {
const sync = isFeatureEnabled(FeatureFlag.SQLLAB_BACKEND_PERSISTENCE)
? SupersetClient.put({
endpoint: encodeURI(`/tabstateview/${queryEditor.id}`),
@@ -1006,7 +1006,7 @@ function getTableExtendedMetadata(table, query, dispatch) {
}
export function addTable(query, tableName, schemaName) {
return function(dispatch) {
return function (dispatch) {
const table = {
dbId: query.dbId,
queryEditorId: query.id,
@@ -1056,7 +1056,7 @@ export function changeDataPreviewId(oldQueryId, newQuery) {
}
export function reFetchQueryResults(query) {
return function(dispatch) {
return function (dispatch) {
const newQuery = {
id: shortid.generate(),
dbId: query.dbId,
@@ -1075,7 +1075,7 @@ export function reFetchQueryResults(query) {
}
export function expandTable(table) {
return function(dispatch) {
return function (dispatch) {
const sync = isFeatureEnabled(FeatureFlag.SQLLAB_BACKEND_PERSISTENCE)
? SupersetClient.post({
endpoint: encodeURI(`/tableschemaview/${table.id}/expanded`),
@@ -1099,7 +1099,7 @@ export function expandTable(table) {
}
export function collapseTable(table) {
return function(dispatch) {
return function (dispatch) {
const sync = isFeatureEnabled(FeatureFlag.SQLLAB_BACKEND_PERSISTENCE)
? SupersetClient.post({
endpoint: encodeURI(`/tableschemaview/${table.id}/expanded`),
@@ -1123,7 +1123,7 @@ export function collapseTable(table) {
}
export function removeTable(table) {
return function(dispatch) {
return function (dispatch) {
const sync = isFeatureEnabled(FeatureFlag.SQLLAB_BACKEND_PERSISTENCE)
? SupersetClient.delete({
endpoint: encodeURI(`/tableschemaview/${table.id}`),
@@ -1163,7 +1163,7 @@ export function persistEditorHeight(queryEditor, northPercent, southPercent) {
}
export function popStoredQuery(urlId) {
return function(dispatch) {
return function (dispatch) {
return SupersetClient.get({ endpoint: `/kv/${urlId}` })
.then(({ json }) =>
dispatch(
@@ -1180,7 +1180,7 @@ export function popStoredQuery(urlId) {
};
}
export function popSavedQuery(saveQueryId) {
return function(dispatch) {
return function (dispatch) {
return SupersetClient.get({
endpoint: `/savedqueryviewapi/api/get/${saveQueryId}`,
})
@@ -1195,7 +1195,7 @@ export function popSavedQuery(saveQueryId) {
};
}
export function popDatasourceQuery(datasourceKey, sql) {
return function(dispatch) {
return function (dispatch) {
return SupersetClient.get({
endpoint: `/superset/fetch_datasource_metadata?datasourceKey=${datasourceKey}`,
})

View File

@@ -89,11 +89,13 @@ class App extends React.PureComponent {
tabsEl.length > 0 ? tabsEl.outerHeight() : searchHeaderHeight;
const warningHeight = warningEl.length > 0 ? warningEl.outerHeight() : 0;
const alertHeight = alertEl.length > 0 ? alertEl.outerHeight() : 0;
return `${window.innerHeight -
return `${
window.innerHeight -
headerHeight -
tabsHeight -
warningHeight -
alertHeight}px`;
alertHeight
}px`;
}
showLocalStorageUsageWarning(currentUsage) {
this.props.actions.addDangerToast(

View File

@@ -71,8 +71,9 @@ class QueryAutoRefresh extends React.PureComponent {
// only poll /superset/queries/ if there are started or running queries
if (this.shouldCheckForQueries()) {
SupersetClient.get({
endpoint: `/superset/queries/${this.props.queriesLastUpdate -
QUERY_UPDATE_BUFFER_MS}`,
endpoint: `/superset/queries/${
this.props.queriesLastUpdate - QUERY_UPDATE_BUFFER_MS
}`,
timeout: QUERY_TIMEOUT_LIMIT,
})
.then(({ json }) => {

View File

@@ -133,7 +133,7 @@ class QuerySearch extends React.PureComponent {
}
insertParams(baseUrl, params) {
const validParams = params.filter(function(p) {
const validParams = params.filter(function (p) {
return p !== '';
});
return baseUrl + '?' + validParams.join('&');

View File

@@ -98,9 +98,7 @@ class QueryTable extends React.PureComponent {
if (q.endDttm) {
q.duration = fDuration(q.startDttm, q.endDttm);
}
const time = moment(q.startDttm)
.format()
.split('T');
const time = moment(q.startDttm).format().split('T');
q.time = (
<div>
<span>

View File

@@ -252,8 +252,9 @@ class SqlEditor extends React.PureComponent {
};
elementStyle(dimension, elementSize, gutterSize) {
return {
[dimension]: `calc(${elementSize}% - ${gutterSize +
SQL_EDITOR_GUTTER_MARGIN}px)`,
[dimension]: `calc(${elementSize}% - ${
gutterSize + SQL_EDITOR_GUTTER_MARGIN
}px)`,
};
}
requestValidation() {