Skip to content
Snippets Groups Projects
Unverified Commit ce5b2111 authored by Nemanja Glumac's avatar Nemanja Glumac Committed by GitHub
Browse files

[QC] Remove unused utils and methods on the `Join` prototype (#38570)

* Remove unused `clearFields` method on a `Join` prototype

* Remove unused `remove` method from the `Join` prototype

* Remove unused `removeJoin` method and helper

* Remove unused `replace` method from the `Join` prototype

* Remove unused `updateJoin` method and helper

* Remove more potentially unused methods from the `Join` prototype

* Mark `joinedTable` method as private
parent 3dcae2fc
No related branches found
No related tags found
No related merge requests found
......@@ -270,20 +270,6 @@ class StructuredQuery extends AtomicQuery {
);
});
/**
* @deprecated use metabase-lib v2 to manage joins
*/
updateJoin(index, join) {
return this._updateQuery(Q.updateJoin, [index, unwrapJoin(join)]);
}
/**
* @deprecated use metabase-lib v2 to manage joins
*/
removeJoin(_index) {
return this._updateQuery(Q.removeJoin, arguments);
}
// AGGREGATIONS
/**
......
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-nocheck
import type {
Join as JoinObject,
JoinFields,
JoinAlias,
JoinCondition,
JoinedFieldReference,
} from "metabase-types/api";
import type { JoinFields, JoinAlias, JoinCondition } from "metabase-types/api";
import DimensionOptions from "metabase-lib/DimensionOptions";
import type Dimension from "metabase-lib/Dimension";
import { FieldDimension } from "metabase-lib/Dimension";
......@@ -23,27 +17,6 @@ class Join extends MBQLObjectClause {
condition: JoinCondition | null | undefined;
fields: JoinFields | null | undefined;
/**
* @deprecated use metabase-lib v2 to manage joins
*/
set(join: any): Join {
return super.set(join);
}
/**
* @deprecated use metabase-lib v2 to manage joins
*/
remove(): StructuredQuery {
return this._query.removeJoin(this._index);
}
/**
* @deprecated use metabase-lib v2 to manage joins
*/
replace(join: Join | JoinObject): StructuredQuery {
return this._query.updateJoin(this._index, join);
}
/**
* @deprecated use metabase-lib v2 to manage joins
*/
......@@ -51,30 +24,6 @@ class Join extends MBQLObjectClause {
return this.alias;
}
private setFields(fields: JoinFields) {
return this.set({ ...this, fields });
}
/**
* @deprecated use metabase-lib v2 to manage joins
*/
addField(field: JoinedFieldReference) {
if (Array.isArray(this.fields)) {
return this.setFields([...this.fields, field]);
} else if (this.fields === "none") {
return this.setFields([field]);
} else {
return this;
}
}
/**
* @deprecated use metabase-lib v2 to manage joins
*/
clearFields() {
return this.setFields("none");
}
private isSingleConditionJoin() {
const { condition } = this;
return Array.isArray(condition) && JOIN_OPERATORS.includes(condition[0]);
......@@ -135,7 +84,7 @@ class Join extends MBQLObjectClause {
/**
* @deprecated use metabase-lib v2 to manage joins
*/
joinedTable() {
private joinedTable() {
return this?.joinedQuery?.().table?.();
}
......@@ -213,15 +162,6 @@ class Join extends MBQLObjectClause {
})
: [];
}
/**
* @deprecated use metabase-lib v2 to manage joins
*/
isValid() {
// MLv2 should ensure there's a valid condition, etc.
const parentTable = this.legacyQuery?.().table?.();
return !!parentTable && !!this.joinedTable();
}
}
// eslint-disable-next-line import/no-default-export -- deprecated usage
......
import { add, update, remove } from "./util";
import { add } from "./util";
// returns canonical list of Joins, with nulls removed
export function getJoins(joins) {
......@@ -18,9 +18,3 @@ function getJoinClause(joins) {
export function addJoin(join, newJoin) {
return getJoinClause(add(getJoins(join), newJoin));
}
export function updateJoin(join, index, updatedJoin) {
return getJoinClause(update(getJoins(join), index, updatedJoin));
}
export function removeJoin(join, index) {
return getJoinClause(remove(getJoins(join), index));
}
......@@ -88,10 +88,6 @@ export { getFilterClause } from "./filter";
export const getJoins = query => J.getJoins(query.joins);
export const addJoin = (query, join) =>
setJoinClause(query, J.addJoin(query.joins, join));
export const updateJoin = (query, index, join) =>
setJoinClause(query, J.updateJoin(query.joins, index, join));
export const removeJoin = (query, index) =>
setJoinClause(query, J.removeJoin(query.joins, index));
// ORDER_BY
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment