mirror of https://github.com/apache/superset.git
chore: Removes unused vars (#20194)
* chore: Removes unused vars * Fixes lint * Disables no-unused-vars for the operators
This commit is contained in:
parent
0a50a9b380
commit
d6f9fb5af1
|
@ -59,13 +59,6 @@ import {
|
|||
import { DASHBOARD_LIST } from '../dashboard_list/dashboard_list.helper';
|
||||
import { CHART_LIST } from '../chart_list/chart_list.helper';
|
||||
|
||||
const getTestTitle = (
|
||||
test: Mocha.Suite = (Cypress as any).mocha.getRunner().suite.ctx.test,
|
||||
): string =>
|
||||
test.parent?.title
|
||||
? `${getTestTitle(test.parent)} -- ${test.title}`
|
||||
: test.title;
|
||||
|
||||
// TODO: fix flaky init logic and re-enable
|
||||
const milliseconds = new Date().getTime();
|
||||
const dashboard = `Test Dashboard${milliseconds}`;
|
||||
|
|
|
@ -36,7 +36,7 @@ describe('Dashboard save action', () => {
|
|||
beforeEach(() => {
|
||||
cy.login();
|
||||
cy.visit(WORLD_HEALTH_DASHBOARD);
|
||||
cy.get('#app').then(data => {
|
||||
cy.get('#app').then(() => {
|
||||
cy.get('.dashboard-header-container').then(headerContainerElement => {
|
||||
const dashboardId = headerContainerElement.attr('data-test-id');
|
||||
|
||||
|
@ -57,7 +57,7 @@ describe('Dashboard save action', () => {
|
|||
|
||||
// change to what the title should be
|
||||
it('should save as new dashboard', () => {
|
||||
cy.wait('@copyRequest').then(xhr => {
|
||||
cy.wait('@copyRequest').then(() => {
|
||||
cy.get('[data-test="editable-title"]').then(element => {
|
||||
const dashboardTitle = element.attr('title');
|
||||
expect(dashboardTitle).to.not.equal(`World Bank's Data`);
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
import { PostProcessingContribution } from '@superset-ui/core';
|
||||
import { PostProcessingFactory } from './types';
|
||||
|
||||
/* eslint-disable @typescript-eslint/no-unused-vars */
|
||||
export const contributionOperator: PostProcessingFactory<PostProcessingContribution> =
|
||||
(formData, queryObject) => {
|
||||
if (formData.contributionMode) {
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
import { PostProcessingFlatten } from '@superset-ui/core';
|
||||
import { PostProcessingFactory } from './types';
|
||||
|
||||
/* eslint-disable @typescript-eslint/no-unused-vars */
|
||||
export const flattenOperator: PostProcessingFactory<PostProcessingFlatten> = (
|
||||
formData,
|
||||
queryObject,
|
||||
|
|
|
@ -23,6 +23,7 @@ import {
|
|||
} from '@superset-ui/core';
|
||||
import { PostProcessingFactory } from './types';
|
||||
|
||||
/* eslint-disable @typescript-eslint/no-unused-vars */
|
||||
export const prophetOperator: PostProcessingFactory<PostProcessingProphet> = (
|
||||
formData,
|
||||
queryObject,
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
import { PostProcessingResample } from '@superset-ui/core';
|
||||
import { PostProcessingFactory } from './types';
|
||||
|
||||
/* eslint-disable @typescript-eslint/no-unused-vars */
|
||||
export const resampleOperator: PostProcessingFactory<PostProcessingResample> = (
|
||||
formData,
|
||||
queryObject,
|
||||
|
|
|
@ -24,19 +24,7 @@ import { QueryContext, QueryObject } from './types/Query';
|
|||
import { SetDataMaskHook } from '../chart';
|
||||
import { JsonObject } from '../connection';
|
||||
|
||||
const WRAP_IN_ARRAY = (
|
||||
baseQueryObject: QueryObject,
|
||||
options?: {
|
||||
extras?: {
|
||||
cachedChanges?: any;
|
||||
};
|
||||
ownState?: JsonObject;
|
||||
hooks?: {
|
||||
setDataMask: SetDataMaskHook;
|
||||
setCachedChanges: (newChanges: any) => void;
|
||||
};
|
||||
},
|
||||
) => [baseQueryObject];
|
||||
const WRAP_IN_ARRAY = (baseQueryObject: QueryObject) => [baseQueryObject];
|
||||
|
||||
export type BuildFinalQueryObjects = (
|
||||
baseQueryObject: QueryObject,
|
||||
|
@ -53,23 +41,11 @@ export default function buildQueryContext(
|
|||
}
|
||||
| BuildFinalQueryObjects,
|
||||
): QueryContext {
|
||||
const {
|
||||
queryFields,
|
||||
buildQuery = WRAP_IN_ARRAY,
|
||||
hooks = {},
|
||||
ownState = {},
|
||||
} = typeof options === 'function'
|
||||
? { buildQuery: options, queryFields: {} }
|
||||
: options || {};
|
||||
const queries = buildQuery(buildQueryObject(formData, queryFields), {
|
||||
extras: {},
|
||||
ownState,
|
||||
hooks: {
|
||||
setDataMask: () => {},
|
||||
setCachedChanges: () => {},
|
||||
...hooks,
|
||||
},
|
||||
});
|
||||
const { queryFields, buildQuery = WRAP_IN_ARRAY } =
|
||||
typeof options === 'function'
|
||||
? { buildQuery: options, queryFields: {} }
|
||||
: options || {};
|
||||
const queries = buildQuery(buildQueryObject(formData, queryFields));
|
||||
queries.forEach(query => {
|
||||
if (Array.isArray(query.post_processing)) {
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
|
|
|
@ -26,9 +26,6 @@ import ModalTrigger from 'src/components/ModalTrigger';
|
|||
import { EmptyWrapperType } from 'src/components/TableView/TableView';
|
||||
|
||||
interface EstimateQueryCostButtonProps {
|
||||
dbId: number;
|
||||
schema: string;
|
||||
sql: string;
|
||||
getEstimate: Function;
|
||||
queryCostEstimate: Record<string, any>;
|
||||
selectedText?: string;
|
||||
|
@ -37,9 +34,6 @@ interface EstimateQueryCostButtonProps {
|
|||
}
|
||||
|
||||
const EstimateQueryCostButton = ({
|
||||
dbId,
|
||||
schema,
|
||||
sql,
|
||||
getEstimate,
|
||||
queryCostEstimate = {},
|
||||
selectedText,
|
||||
|
|
|
@ -686,9 +686,6 @@ class SqlEditor extends React.PureComponent {
|
|||
this.props.database.allows_cost_estimate && (
|
||||
<span>
|
||||
<EstimateQueryCostButton
|
||||
dbId={qe.dbId}
|
||||
schema={qe.schema}
|
||||
sql={qe.sql}
|
||||
getEstimate={this.getQueryCostEstimate}
|
||||
queryCostEstimate={qe.queryCostEstimate}
|
||||
selectedText={qe.selectedText}
|
||||
|
|
|
@ -213,7 +213,6 @@ class SliceHeaderControls extends React.PureComponent<
|
|||
downloadAsImage(
|
||||
getScreenshotNodeSelector(this.props.slice.slice_id),
|
||||
this.props.slice.slice_name,
|
||||
{},
|
||||
true,
|
||||
// @ts-ignore
|
||||
)(domEvent).then(() => {
|
||||
|
|
|
@ -146,36 +146,6 @@ const FilterTitleContainer = forwardRef<HTMLDivElement, Props>(
|
|||
</FilterTitle>
|
||||
);
|
||||
};
|
||||
const recursivelyRender = (
|
||||
elementId: string,
|
||||
nodeList: Array<{ id: string; parentId: string | null }>,
|
||||
rendered: Array<string>,
|
||||
): React.ReactNode => {
|
||||
const didAlreadyRender = rendered.indexOf(elementId) >= 0;
|
||||
if (didAlreadyRender) {
|
||||
return null;
|
||||
}
|
||||
let parent = null;
|
||||
const element = nodeList.filter(el => el.id === elementId)[0];
|
||||
if (!element) {
|
||||
return null;
|
||||
}
|
||||
|
||||
rendered.push(elementId);
|
||||
if (element.parentId) {
|
||||
parent = recursivelyRender(element.parentId, nodeList, rendered);
|
||||
}
|
||||
const children = nodeList
|
||||
.filter(item => item.parentId === elementId)
|
||||
.map(item => recursivelyRender(item.id, nodeList, rendered));
|
||||
return (
|
||||
<>
|
||||
{parent}
|
||||
{renderComponent(elementId)}
|
||||
{children}
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
const renderFilterGroups = () => {
|
||||
const items: React.ReactNode[] = [];
|
||||
|
|
|
@ -33,7 +33,7 @@ import { buildQueryContext, QueryFormData } from '@superset-ui/core';
|
|||
* if a viz needs multiple different result sets.
|
||||
*/
|
||||
export default function buildQuery(formData: QueryFormData) {
|
||||
return buildQueryContext(formData, baseQueryObject => [
|
||||
return buildQueryContext(formData, () => [
|
||||
{
|
||||
result_type: 'columns',
|
||||
columns: [],
|
||||
|
|
|
@ -193,13 +193,13 @@ const wsConnect = (): void => {
|
|||
if (lastReceivedEventId) url += `?last_id=${lastReceivedEventId}`;
|
||||
ws = new WebSocket(url);
|
||||
|
||||
ws.addEventListener('open', event => {
|
||||
ws.addEventListener('open', () => {
|
||||
logging.log('WebSocket connected');
|
||||
clearTimeout(wsConnectTimeout);
|
||||
wsConnectRetries = 0;
|
||||
});
|
||||
|
||||
ws.addEventListener('close', event => {
|
||||
ws.addEventListener('close', () => {
|
||||
wsConnectTimeout = setTimeout(() => {
|
||||
wsConnectRetries += 1;
|
||||
if (wsConnectRetries <= wsConnectMaxRetries) {
|
||||
|
@ -211,7 +211,7 @@ const wsConnect = (): void => {
|
|||
}, wsConnectErrorDelay);
|
||||
});
|
||||
|
||||
ws.addEventListener('error', event => {
|
||||
ws.addEventListener('error', () => {
|
||||
// https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/readyState
|
||||
if (ws.readyState < 2) ws.close();
|
||||
});
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
import { SyntheticEvent } from 'react';
|
||||
import domToImage, { Options } from 'dom-to-image';
|
||||
import domToImage from 'dom-to-image';
|
||||
import kebabCase from 'lodash/kebabCase';
|
||||
import { t } from '@superset-ui/core';
|
||||
import { addWarningToast } from 'src/components/MessageToasts/actions';
|
||||
|
@ -50,7 +50,6 @@ const generateFileStem = (description: string, date = new Date()) =>
|
|||
export default function downloadAsImage(
|
||||
selector: string,
|
||||
description: string,
|
||||
domToImageOptions: Options = {},
|
||||
isExactSelector = false,
|
||||
) {
|
||||
return (event: SyntheticEvent) => {
|
||||
|
|
|
@ -29,14 +29,12 @@ const SqlAlchemyTab = ({
|
|||
onInputChange,
|
||||
testConnection,
|
||||
conf,
|
||||
isEditMode = false,
|
||||
testInProgress = false,
|
||||
}: {
|
||||
db: DatabaseObject | null;
|
||||
onInputChange: EventHandler<ChangeEvent<HTMLInputElement>>;
|
||||
testConnection: EventHandler<MouseEvent<HTMLElement>>;
|
||||
conf: { SQLALCHEMY_DOCS_URL: string; SQLALCHEMY_DISPLAY_TEXT: string };
|
||||
isEditMode?: boolean;
|
||||
testInProgress?: boolean;
|
||||
}) => {
|
||||
let fallbackDocsUrl;
|
||||
|
|
|
@ -1275,7 +1275,6 @@ const DatabaseModal: FunctionComponent<DatabaseModalProps> = ({
|
|||
}
|
||||
conf={conf}
|
||||
testConnection={testConnection}
|
||||
isEditMode={isEditMode}
|
||||
testInProgress={testInProgress}
|
||||
/>
|
||||
{isDynamic(db?.backend || db?.engine) && !isEditMode && (
|
||||
|
|
|
@ -80,7 +80,7 @@ const StyledPopoverItem = styled.div`
|
|||
color: ${({ theme }) => theme.colors.grayscale.dark2};
|
||||
`;
|
||||
|
||||
function QueryList({ addDangerToast, addSuccessToast }: QueryListProps) {
|
||||
function QueryList({ addDangerToast }: QueryListProps) {
|
||||
const {
|
||||
state: { loading, resourceCount: queryCount, resourceCollection: queries },
|
||||
fetchData,
|
||||
|
|
|
@ -90,7 +90,6 @@ const StyledPopoverItem = styled.div`
|
|||
function SavedQueryList({
|
||||
addDangerToast,
|
||||
addSuccessToast,
|
||||
user,
|
||||
}: SavedQueryListProps) {
|
||||
const {
|
||||
state: {
|
||||
|
|
Loading…
Reference in New Issue