Skip to content
Snippets Groups Projects
Unverified Commit 710943cf authored by metabase-bot[bot]'s avatar metabase-bot[bot] Committed by GitHub
Browse files

Remove GoogleAnalytics specific logic from the FE (#42827) (#42837)

parent b6c63679
No related branches found
No related tags found
No related merge requests found
...@@ -317,21 +317,6 @@ describe("admin > database > add", () => { ...@@ -317,21 +317,6 @@ describe("admin > database > add", () => {
); );
}); });
}); });
it("should work for Google Analytics", () => {
cy.visit("/admin/databases/create");
chooseDatabase("Google Analytics");
typeAndBlurUsingLabel("Display name", "GA");
typeAndBlurUsingLabel("Google Analytics Account ID", " 9 ");
mockUploadServiceAccountJSON(serviceAccountJSON);
mockSuccessfulDatabaseSave().then(({ request: { body } }) => {
expect(body.details["service-account-json"]).to.equal(
serviceAccountJSON,
);
});
});
}); });
}); });
......
This diff is collapsed.
...@@ -9,21 +9,8 @@ export function getSegmentOrMetricQuestion(query, table, metadata) { ...@@ -9,21 +9,8 @@ export function getSegmentOrMetricQuestion(query, table, metadata) {
export function getDefaultSegmentOrMetricQuestion(table, metadata) { export function getDefaultSegmentOrMetricQuestion(table, metadata) {
const question = metadata.table(table.id).question(); const question = metadata.table(table.id).question();
if (table.entity_type === "entity/GoogleAnalyticsTable") { return question
const dateField = table.fields.find(f => f.name === "ga:date"); .legacyQuery({ useStructuredQuery: true })
if (dateField) { .aggregate(["count"])
return question .question();
.legacyQuery({ useStructuredQuery: true })
.filter(["time-interval", ["field", dateField.id, null], -365, "day"])
.aggregate(["metric", "ga:users"])
.question();
}
} else {
return question
.legacyQuery({ useStructuredQuery: true })
.aggregate(["count"])
.question();
}
return null;
} }
...@@ -288,13 +288,9 @@ export class AggregationPopover extends Component { ...@@ -288,13 +288,9 @@ export class AggregationPopover extends Component {
// we only want to consider active metrics, with the ONE exception that if the currently selected aggregation is a // we only want to consider active metrics, with the ONE exception that if the currently selected aggregation is a
// retired metric then we include it in the list to maintain continuity // retired metric then we include it in the list to maintain continuity
const filter = metric => const filter = metric =>
maybeOverriddenShowMetrics maybeOverriddenShowMetrics &&
? !metric.archived || (!metric.archived || selectedAggregation?.id === metric.id);
(selectedAggregation && selectedAggregation.id === metric.id)
: // GA metrics are more like columns, so they should be displayed even when showMetrics is false
metric.googleAnalyics;
if (table.metrics) { if (table.metrics) {
return table.metrics.filter(filter); return table.metrics.filter(filter);
......
...@@ -33,7 +33,6 @@ export const ENGINE_LOGO: Record<string, string> = { ...@@ -33,7 +33,6 @@ export const ENGINE_LOGO: Record<string, string> = {
bigquery: "bigquery.svg", bigquery: "bigquery.svg",
"bigquery-cloud-sdk": "bigquery.svg", "bigquery-cloud-sdk": "bigquery.svg",
druid: "druid.svg", druid: "druid.svg",
googleanalytics: "googleanalytics.svg",
h2: "h2.svg", h2: "h2.svg",
mongo: "mongo.svg", mongo: "mongo.svg",
mysql: "mysql.svg", mysql: "mysql.svg",
......
...@@ -54,23 +54,4 @@ describe("Metric", () => { ...@@ -54,23 +54,4 @@ describe("Metric", () => {
}); });
}); });
}); });
describe("Google Analytics database", () => {
const metric = metadata.metric("ga:users");
describe("displayName", () => {
it("should return the metric name", () => {
expect(metric.displayName()).toBe("Users");
});
});
describe("aggregationClause", () => {
it('should return ["metric", "ga:users]', () => {
expect(metric.aggregationClause()).toEqual(["metric", "ga:users"]);
});
});
describe("columnName", () => {
it("should return the metric id", () => {
expect(metric.columnName()).toBe("ga:users");
});
});
});
}); });
...@@ -5,8 +5,6 @@ const config = { ...@@ -5,8 +5,6 @@ const config = {
"\\.(css|less)$": "<rootDir>/frontend/test/__mocks__/styleMock.js", "\\.(css|less)$": "<rootDir>/frontend/test/__mocks__/styleMock.js",
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$":
"<rootDir>/frontend/test/__mocks__/fileMock.js", "<rootDir>/frontend/test/__mocks__/fileMock.js",
"^promise-loader\\?global\\!metabase-lib\\/v1\\/metadata\\/utils\\/ga-metadata$":
"<rootDir>/frontend/src/metabase-lib/v1/metadata/utils/ga-metadata.js",
"ace/ext-searchbox": "ace/ext-searchbox":
"<rootDir>/frontend/test/__mocks__/aceSearchBoxExtMock.js", "<rootDir>/frontend/test/__mocks__/aceSearchBoxExtMock.js",
"^cljs/(.*)$": "<rootDir>/target/cljs_dev/$1", "^cljs/(.*)$": "<rootDir>/target/cljs_dev/$1",
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
"moduleNameMapper": { "moduleNameMapper": {
"\\.(css|less)$": "<rootDir>/frontend/test/__mocks__/styleMock.js", "\\.(css|less)$": "<rootDir>/frontend/test/__mocks__/styleMock.js",
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/frontend/test/__mocks__/fileMock.js", "\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/frontend/test/__mocks__/fileMock.js",
"^promise-loader\\?global\\!metabase-lib\\/v1\\/metadata\\/utils\\/ga-metadata$": "<rootDir>/frontend/src/metabase-lib/v1/metadata/utils/ga-metadata.js",
"^cljs/(.*)$": "<rootDir>/target/cljs_dev/$1", "^cljs/(.*)$": "<rootDir>/target/cljs_dev/$1",
"^d3-(.*)$": "<rootDir>/node_modules/d3-$1/dist/d3-$1", "^d3-(.*)$": "<rootDir>/node_modules/d3-$1/dist/d3-$1",
"react-markdown": "<rootDir>/node_modules/react-markdown/react-markdown.min.js", "react-markdown": "<rootDir>/node_modules/react-markdown/react-markdown.min.js",
......
<svg width="32" height="32" fill="none" xmlns="http://www.w3.org/2000/svg"><g clip-path="url(#a)"><path d="M19.375 9.148v13.5c0 1.51 1.043 2.352 2.148 2.352 1.023 0 2.148-.716 2.148-2.352V9.25c0-1.385-1.023-2.25-2.148-2.25-1.125 0-2.148.954-2.148 2.148Z" fill="#F9AB00"/><path d="M13.75 16v6.648c0 1.51 1.043 2.352 2.148 2.352 1.023 0 2.148-.716 2.148-2.352v-6.546c0-1.385-1.023-2.25-2.148-2.25-1.125 0-2.148.954-2.148 2.148ZM10.273 25a2.148 2.148 0 1 0 0-4.296 2.148 2.148 0 0 0 0 4.296Z" fill="#E37400"/></g><defs><clipPath id="a"><path fill="#fff" transform="translate(7 7)" d="M0 0h18v18H0z"/></clipPath></defs></svg>
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