diff --git a/.prettierrc b/.prettierrc index fe5f744c7a0..bf357fbbc08 100644 --- a/.prettierrc +++ b/.prettierrc @@ -1,4 +1,3 @@ { - "trailingComma": "all", - "arrowParens": "avoid" + "trailingComma": "all" } diff --git a/e2e/runner/cypress-runner-backend.js b/e2e/runner/cypress-runner-backend.js index 6b6bb9cef8b..8f1425f8db6 100755 --- a/e2e/runner/cypress-runner-backend.js +++ b/e2e/runner/cypress-runner-backend.js @@ -114,10 +114,10 @@ const CypressBackend = { // This is needed until we can use NodeJS native `fetch`. function request(url) { return new Promise((resolve, reject) => { - const req = http.get(url, res => { + const req = http.get(url, (res) => { let body = ""; - res.on("data", chunk => { + res.on("data", (chunk) => { body += chunk; }); @@ -126,7 +126,7 @@ const CypressBackend = { }); }); - req.on("error", e => { + req.on("error", (e) => { reject(e); }); }); diff --git a/e2e/runner/cypress-runner-run-tests.js b/e2e/runner/cypress-runner-run-tests.js index 41031f3bc91..3eaf0e20d9e 100644 --- a/e2e/runner/cypress-runner-run-tests.js +++ b/e2e/runner/cypress-runner-run-tests.js @@ -10,7 +10,7 @@ const DEFAULT_PORT = 4000; const getHost = (port = null) => `http://localhost:${port ?? process.env.BACKEND_PORT ?? DEFAULT_PORT}`; -const getSampleAppE2eConfig = suite => ({ +const getSampleAppE2eConfig = (suite) => ({ [suite]: async () => { const { appName, env } = SAMPLE_APP_SETUP_CONFIGS[suite]; const { CLIENT_PORT } = env; diff --git a/e2e/runner/cypress-runner-utils.js b/e2e/runner/cypress-runner-utils.js index b2116e20c70..05089f2919a 100644 --- a/e2e/runner/cypress-runner-utils.js +++ b/e2e/runner/cypress-runner-utils.js @@ -73,7 +73,7 @@ function unBooleanify(map) { } function delay(durationMs) { - return new Promise(resolve => setTimeout(resolve, durationMs)); + return new Promise((resolve) => setTimeout(resolve, durationMs)); } module.exports = { diff --git a/e2e/runner/run_cypress_ci.js b/e2e/runner/run_cypress_ci.js index f6a65c6894d..2182bc25a22 100755 --- a/e2e/runner/run_cypress_ci.js +++ b/e2e/runner/run_cypress_ci.js @@ -27,7 +27,7 @@ const startServer = async () => { await CypressBackend.start(); }; -const runTests = async testSuite => { +const runTests = async (testSuite) => { printBold(`Running ${testSuite} Cypress Tests`); await runCypress(testSuite, process.exit); }; diff --git a/e2e/runner/run_cypress_local.ts b/e2e/runner/run_cypress_local.ts index f3b00d2b703..c08fbcb79d8 100644 --- a/e2e/runner/run_cypress_local.ts +++ b/e2e/runner/run_cypress_local.ts @@ -145,7 +145,7 @@ const cleanup = async (exitCode: string | number = SUCCESS_EXIT_CODE) => { init() .then(() => cleanup(SUCCESS_EXIT_CODE)) - .catch(e => { + .catch((e) => { console.error(e); cleanup(FAILURE_EXIT_CODE); }); diff --git a/e2e/runner/sample-apps-shared/helpers/start-containers.ts b/e2e/runner/sample-apps-shared/helpers/start-containers.ts index 98dfc899609..ddba27d0a40 100644 --- a/e2e/runner/sample-apps-shared/helpers/start-containers.ts +++ b/e2e/runner/sample-apps-shared/helpers/start-containers.ts @@ -42,7 +42,7 @@ export async function startContainers({ } if (!process.env.CI) { - ["exit", "SIGINT", "SIGTERM", "uncaughtException"].forEach(signal => { + ["exit", "SIGINT", "SIGTERM", "uncaughtException"].forEach((signal) => { process.on(signal, () => { console.log(`Parent received ${signal}, killing stopping app...`); diff --git a/e2e/snapshot-creators/default.cy.snap.js b/e2e/snapshot-creators/default.cy.snap.js index 0b5be2e3f49..5b1d66ddd51 100644 --- a/e2e/snapshot-creators/default.cy.snap.js +++ b/e2e/snapshot-creators/default.cy.snap.js @@ -46,7 +46,7 @@ describe("snapshots", () => { snapshot("setup"); addUsersAndGroups(); createCollections(); - withSampleDatabase(SAMPLE_DATABASE => { + withSampleDatabase((SAMPLE_DATABASE) => { ensureTableIdsAreCorrect(SAMPLE_DATABASE); hideNewSampleTables(SAMPLE_DATABASE); createQuestionsAndDashboards(SAMPLE_DATABASE); @@ -112,7 +112,7 @@ describe("snapshots", () => { }); // update the Sample db connection string so it is valid in both CI and locally - cy.request("GET", `/api/database/${SAMPLE_DB_ID}`).then(response => { + cy.request("GET", `/api/database/${SAMPLE_DB_ID}`).then((response) => { response.body.details.db = "./plugins/sample-database.db;USER=GUEST;PASSWORD=guest"; cy.request("PUT", `/api/database/${SAMPLE_DB_ID}`, response.body); @@ -143,14 +143,14 @@ describe("snapshots", () => { ); // Create all users except admin, who was already created in one of the previous steps - Object.keys(_.omit(USERS, "admin")).forEach(user => { + Object.keys(_.omit(USERS, "admin")).forEach((user) => { cy.createUser(user); }); // Make a call to `/api/user` because some things (personal collections) get created there cy.request("GET", "/api/user"); - Object.keys(USERS).forEach(user => { + Object.keys(USERS).forEach((user) => { if (user === "admin") { // we already cached admin user credentials during setup return; @@ -221,17 +221,18 @@ describe("snapshots", () => { }).then(({ body }) => callback && callback(body)); } - postCollection("First collection", undefined, firstCollection => { + postCollection("First collection", undefined, (firstCollection) => { logSelectModel(firstCollection.id, "collection"); postCollection( "Second collection", firstCollection.id, - secondCollection => { + (secondCollection) => { logSelectModel(secondCollection.id, "collection"); postCollection( "Third collection", secondCollection.id, - thirdCollection => logSelectModel(thirdCollection.id, "collection"), + (thirdCollection) => + logSelectModel(thirdCollection.id, "collection"), ); }, ); @@ -309,9 +310,11 @@ describe("snapshots", () => { FEEDBACK_ID, INVOICES_ID, }) { - [ACCOUNTS_ID, ANALYTIC_EVENTS_ID, FEEDBACK_ID, INVOICES_ID].forEach(id => { - cy.request("PUT", `/api/table/${id}`, { visibility_type: "hidden" }); - }); + [ACCOUNTS_ID, ANALYTIC_EVENTS_ID, FEEDBACK_ID, INVOICES_ID].forEach( + (id) => { + cy.request("PUT", `/api/table/${id}`, { visibility_type: "hidden" }); + }, + ); } // TODO: It'd be nice to have one file per snapshot. @@ -387,8 +390,8 @@ function getDefaultInstanceData() { `/api/collection/${collection.id}/items?models=dashboard`, ).then(({ body: { data: dashboards } }) => { for (const dashboard of dashboards) { - if (!instanceData.dashboards.find(d => d.id === dashboard.id)) { - cy.request(`/api/dashboard/${dashboard.id}`).then(response => { + if (!instanceData.dashboards.find((d) => d.id === dashboard.id)) { + cy.request(`/api/dashboard/${dashboard.id}`).then((response) => { instanceData.dashboards.push(response.body); }); } diff --git a/e2e/snapshot-creators/qa-db.cy.snap.js b/e2e/snapshot-creators/qa-db.cy.snap.js index e75be70e781..a7233285322 100644 --- a/e2e/snapshot-creators/qa-db.cy.snap.js +++ b/e2e/snapshot-creators/qa-db.cy.snap.js @@ -57,7 +57,7 @@ function restoreAndAuthenticate() { } function deleteDatabase(idAlias) { - cy.get("@" + idAlias).then(id => { + cy.get("@" + idAlias).then((id) => { return cy.request("DELETE", `/api/database/${id}`); }); } diff --git a/e2e/support/ci_tasks.ts b/e2e/support/ci_tasks.ts index 7814c899512..752a231d144 100644 --- a/e2e/support/ci_tasks.ts +++ b/e2e/support/ci_tasks.ts @@ -41,10 +41,10 @@ const githubApi = ({ }; function extractTestsFromCommentText(body: string) { - const tableLines = body.split("\n").filter(line => line.includes("|")); + const tableLines = body.split("\n").filter((line) => line.includes("|")); const testLines = tableLines.slice(2); - const testData = testLines.map(line => { - const [fileName, testName] = line.split("|").map(cell => cell.trim()); + const testData = testLines.map((line) => { + const [fileName, testName] = line.split("|").map((cell) => cell.trim()); return { fileName, testName }; }); diff --git a/e2e/support/collectFailedTests.js b/e2e/support/collectFailedTests.js index da1ba752545..03cfaf1e59e 100644 --- a/e2e/support/collectFailedTests.js +++ b/e2e/support/collectFailedTests.js @@ -13,10 +13,10 @@ const path = require("path"); * @returns */ const collectFailingTests = (on, config) => { - on("after:run", async results => { + on("after:run", async (results) => { const failedSpecs = results.runs - .filter(run => run.stats.failures > 0) - .map(run => run.spec.relative); + .filter((run) => run.stats.failures > 0) + .map((run) => run.spec.relative); if (failedSpecs.length > 0) { const failedTestFilePath = "../../cypress/test-results/"; diff --git a/e2e/support/commands/downloads/downloadUtils-untyped.js b/e2e/support/commands/downloads/downloadUtils-untyped.js index 1d97d169e67..e26e14a34c4 100644 --- a/e2e/support/commands/downloads/downloadUtils-untyped.js +++ b/e2e/support/commands/downloads/downloadUtils-untyped.js @@ -2,7 +2,7 @@ const fs = require("fs"); const path = require("path"); -const removeDirectory = path => { +const removeDirectory = (path) => { try { if (fs.existsSync(path)) { fs.rmdirSync(path, { maxRetries: 10, recursive: true }); @@ -18,7 +18,7 @@ const removeDirectory = path => { const deleteDownloadsFolder = () => cy.task("removeDirectory", Cypress.config("downloadsFolder")); -const isFileExist = path => fs.existsSync(path); +const isFileExist = (path) => fs.existsSync(path); const findFiles = ({ path, fileName }) => { if (!fs.existsSync(path)) { @@ -27,10 +27,10 @@ const findFiles = ({ path, fileName }) => { return fs .readdirSync(path) - .filter(file => file.includes(fileName) && isDownloaded(file)); + .filter((file) => file.includes(fileName) && isDownloaded(file)); }; -const isDownloaded = file => !file.endsWith(".crdownload"); +const isDownloaded = (file) => !file.endsWith(".crdownload"); // slightly modified version of cy-verify-download // https://github.com/elaichenkov/cy-verify-downloads/blob/master/src/index.js @@ -53,7 +53,7 @@ const verifyDownload = (fileName, options) => { let retries = Math.floor(timeout / interval); - const checkFile = result => { + const checkFile = (result) => { if (result) { return result; } @@ -75,7 +75,7 @@ const verifyDownload = (fileName, options) => { if (contains) { result = cy .task("findFiles", { path: downloadsFolder, fileName }) - .then(files => { + .then((files) => { if (files !== null) { if (files.length > 1) { cy.log( @@ -96,7 +96,7 @@ const verifyDownload = (fileName, options) => { return result.then(checkFile); }; - return resolveValue().then(isExist => { + return resolveValue().then((isExist) => { expect(isExist, `The ${fileName} file has been downloaded successfully`).to .be.true; }); diff --git a/e2e/support/commands/permissions/sandboxTable.js b/e2e/support/commands/permissions/sandboxTable.js index 06a28161487..3efbaa24760 100644 --- a/e2e/support/commands/permissions/sandboxTable.js +++ b/e2e/support/commands/permissions/sandboxTable.js @@ -15,7 +15,7 @@ Cypress.Commands.add( // Extract the name of the table, as well as `schema` and `db_id` that we'll need later on for `cy.updatePermissionsSchemas()` cy.request("GET", "/api/table").then(({ body: tables }) => { const { name, schema, db_id } = tables.find( - table => table.id === table_id, + (table) => table.id === table_id, ); const attr = Object.keys(attribute_remappings).join(", "); // Account for the possiblity of passing multiple user attributes diff --git a/e2e/support/commands/user/authentication.ts b/e2e/support/commands/user/authentication.ts index 2555b698e20..2e82919dd74 100644 --- a/e2e/support/commands/user/authentication.ts +++ b/e2e/support/commands/user/authentication.ts @@ -61,10 +61,10 @@ Cypress.Commands.add( const { email: username, password } = USERS[user]; cy.request("POST", "/api/session", { username, password }).then( - response => { + (response) => { if (setupCache) { cy.log("saving login token for user", user); - cy.getCookie("metabase.DEVICE").then(deviceCookie => { + cy.getCookie("metabase.DEVICE").then((deviceCookie) => { loginCache[user] = { sessionId: response.body.id, deviceId: deviceCookie?.value ?? "my-device-id", diff --git a/e2e/support/commands/user/createUser.js b/e2e/support/commands/user/createUser.js index 60474b1e848..9179d676eb5 100644 --- a/e2e/support/commands/user/createUser.js +++ b/e2e/support/commands/user/createUser.js @@ -1,6 +1,6 @@ import { USERS } from "e2e/support/cypress_data"; -Cypress.Commands.add("createUserFromRawData", user => { +Cypress.Commands.add("createUserFromRawData", (user) => { return cy.request("POST", "/api/user", user).then(({ body: user }) => { // Dismiss `it's ok to play around` modal for the created user cy.request("PUT", `/api/user/${user.id}/modal/qbnewb`, {}); @@ -8,7 +8,7 @@ Cypress.Commands.add("createUserFromRawData", user => { }); }); -Cypress.Commands.add("createUser", user => { +Cypress.Commands.add("createUser", (user) => { cy.log(`Create ${user} user`); cy.createUserFromRawData(USERS[user]); }); diff --git a/e2e/support/commands/visibility/findByTextEnsureVisible.ts b/e2e/support/commands/visibility/findByTextEnsureVisible.ts index 46eb8b53666..8ef864ad6e8 100644 --- a/e2e/support/commands/visibility/findByTextEnsureVisible.ts +++ b/e2e/support/commands/visibility/findByTextEnsureVisible.ts @@ -8,7 +8,7 @@ declare global { } } -Cypress.Commands.add("findByTextEnsureVisible", text => { +Cypress.Commands.add("findByTextEnsureVisible", (text) => { cy.findByText(text).should("be.visible"); }); diff --git a/e2e/support/commands/visibility/isRenderedWithinViewport.js b/e2e/support/commands/visibility/isRenderedWithinViewport.js index 3eb87d3a802..aea550ce487 100644 --- a/e2e/support/commands/visibility/isRenderedWithinViewport.js +++ b/e2e/support/commands/visibility/isRenderedWithinViewport.js @@ -3,7 +3,7 @@ Cypress.Commands.add( { prevSubject: true, }, - subject => { + (subject) => { const viewportTop = 0; const viewportBottom = Cypress.$(cy.state("window")).height(); const element = subject[0].getBoundingClientRect(); diff --git a/e2e/support/commands/visibility/isVisibleInPopover.js b/e2e/support/commands/visibility/isVisibleInPopover.js index 3ecb6d23f2f..77e5ddd3cc7 100644 --- a/e2e/support/commands/visibility/isVisibleInPopover.js +++ b/e2e/support/commands/visibility/isVisibleInPopover.js @@ -5,10 +5,10 @@ Cypress.Commands.add( { prevSubject: true, }, - subject => { + (subject) => { cy.wrap(subject) .closest(POPOVER_ELEMENT) - .then($popover => { + .then(($popover) => { /** * Helper function that: * 1. Obtains the value of element's computed property, but it always returns it in px (for example: "12px") diff --git a/e2e/support/config.js b/e2e/support/config.js index 95b57324841..1af572e7fc7 100644 --- a/e2e/support/config.js +++ b/e2e/support/config.js @@ -37,7 +37,7 @@ const assetsResolverPlugin = { name: "assetsResolver", setup(build) { // Redirect all paths starting with "assets/" to "resources/" - build.onResolve({ filter: /^assets\// }, args => { + build.onResolve({ filter: /^assets\// }, (args) => { return { path: path.join( __dirname, @@ -53,8 +53,8 @@ const assetsResolverPlugin = { const specBlacklist = ["/embedding-sdk/", "/cross-version/"]; function getSplittableSpecs(specs) { - return specs.filter(spec => { - return !specBlacklist.some(blacklistedPath => + return specs.filter((spec) => { + return !specBlacklist.some((blacklistedPath) => spec.includes(blacklistedPath), ); }); diff --git a/e2e/support/cypress.js b/e2e/support/cypress.js index 20b86144533..237d1786509 100644 --- a/e2e/support/cypress.js +++ b/e2e/support/cypress.js @@ -42,7 +42,7 @@ Cypress.on("test:before:run", () => { Cypress.on("test:after:run", (test, runnable) => { if (test.state === "failed") { - const titleToFileName = title => title.replace(/[>]/g, ""); + const titleToFileName = (title) => title.replace(/[>]/g, ""); let { parent } = runnable; let filename = ""; // This while is to be able to support more than one level of parent in the screenshot name @@ -54,7 +54,7 @@ Cypress.on("test:after:run", (test, runnable) => { if (isCI) { // cypress-terminal-report - Cypress.Mochawesome.context.forEach(ctx => { + Cypress.Mochawesome.context.forEach((ctx) => { addContext({ test }, ctx); }); } @@ -77,7 +77,7 @@ Cypress.on("test:after:run", (test, runnable) => { // required for cypress-terminal-report to be able to find logs after the test // is finished -Cypress.Commands.add("addTestContext", context => { +Cypress.Commands.add("addTestContext", (context) => { if (!Cypress.Mochawesome) { Cypress.Mochawesome = createMochawesomeObject(); } @@ -102,7 +102,7 @@ function createMochawesomeObject() { * * @see https://github.com/cypress-io/cypress/issues/2118 */ -Cypress.on("window:load", window => { +Cypress.on("window:load", (window) => { const addEventListener = window.addEventListener; window.addEventListener = function (event) { diff --git a/e2e/support/db_tasks.js b/e2e/support/db_tasks.js index ca3bec7458c..5670e713217 100644 --- a/e2e/support/db_tasks.js +++ b/e2e/support/db_tasks.js @@ -105,7 +105,7 @@ export async function createTestRoles({ } return await Promise.all( - Object.values(dbRoles).map(async sql => { + Object.values(dbRoles).map(async (sql) => { await dbClient.raw(sql); }), ); diff --git a/e2e/support/helpers/api/addOrUpdateDashboardCard.ts b/e2e/support/helpers/api/addOrUpdateDashboardCard.ts index d132b3f64dc..0b715c65cad 100644 --- a/e2e/support/helpers/api/addOrUpdateDashboardCard.ts +++ b/e2e/support/helpers/api/addOrUpdateDashboardCard.ts @@ -26,7 +26,7 @@ export function addOrUpdateDashboardCard({ }, ], }) - .then(response => ({ + .then((response) => ({ ...response, body: response.body.dashcards[0], })); diff --git a/e2e/support/helpers/api/addQuestionToDashboard.ts b/e2e/support/helpers/api/addQuestionToDashboard.ts index 41ba2ef0fb4..9afb3019bc5 100644 --- a/e2e/support/helpers/api/addQuestionToDashboard.ts +++ b/e2e/support/helpers/api/addQuestionToDashboard.ts @@ -23,7 +23,7 @@ export const addQuestionToDashboard = ({ }, ], }) - .then(response => ({ + .then((response) => ({ ...response, body: response.body.dashcards.at(-1), })), diff --git a/e2e/support/helpers/api/createCollection.ts b/e2e/support/helpers/api/createCollection.ts index 62052235cfa..7f1ecf9e40f 100644 --- a/e2e/support/helpers/api/createCollection.ts +++ b/e2e/support/helpers/api/createCollection.ts @@ -22,7 +22,7 @@ export const createCollection = ({ parent_id, authority_level, }) - .then(response => { + .then((response) => { if (alias) { cy.wrap(response.body.id).as(alias); } diff --git a/e2e/support/helpers/api/createDashboardWithQuestions.ts b/e2e/support/helpers/api/createDashboardWithQuestions.ts index 99b8d6d1955..4a5cc664891 100644 --- a/e2e/support/helpers/api/createDashboardWithQuestions.ts +++ b/e2e/support/helpers/api/createDashboardWithQuestions.ts @@ -31,9 +31,9 @@ export const createDashboardWithQuestions = ({ cards ? cards[index] : undefined, ), ), - ).then(dashcardResponses => { + ).then((dashcardResponses) => { const questions = dashcardResponses.map( - dashcardResponse => dashcardResponse.body.card, + (dashcardResponse) => dashcardResponse.body.card, ); return { diff --git a/e2e/support/helpers/api/createNativeQuestionAndDashboard.ts b/e2e/support/helpers/api/createNativeQuestionAndDashboard.ts index 4f43552a29b..905d66ccb3b 100644 --- a/e2e/support/helpers/api/createNativeQuestionAndDashboard.ts +++ b/e2e/support/helpers/api/createNativeQuestionAndDashboard.ts @@ -47,7 +47,7 @@ export const createNativeQuestionAndDashboard = ({ ...cardDetails, }, ], - }).then(response => ({ + }).then((response) => ({ ...response, dashboardId, dashboardTabs: response.body.tabs, diff --git a/e2e/support/helpers/api/createQuestionAndAddToDashboard.ts b/e2e/support/helpers/api/createQuestionAndAddToDashboard.ts index d974bde1b2f..836744fb002 100644 --- a/e2e/support/helpers/api/createQuestionAndAddToDashboard.ts +++ b/e2e/support/helpers/api/createQuestionAndAddToDashboard.ts @@ -35,7 +35,7 @@ export const createQuestionAndAddToDashboard = ( }, ], }) - .then(response => ({ + .then((response) => ({ ...response, body: response.body.dashcards.at(-1), })), diff --git a/e2e/support/helpers/api/createQuestionAndDashboard.ts b/e2e/support/helpers/api/createQuestionAndDashboard.ts index 8eb615fb2fa..2f791aa8438 100644 --- a/e2e/support/helpers/api/createQuestionAndDashboard.ts +++ b/e2e/support/helpers/api/createQuestionAndDashboard.ts @@ -36,7 +36,7 @@ export const createQuestionAndDashboard = ({ }, ], }) - .then(response => ({ + .then((response) => ({ ...response, body: response.body.dashcards[0], questionId, diff --git a/e2e/support/helpers/api/createTimelineWithEvents.ts b/e2e/support/helpers/api/createTimelineWithEvents.ts index 10da3bb0402..d8db34cd0d7 100644 --- a/e2e/support/helpers/api/createTimelineWithEvents.ts +++ b/e2e/support/helpers/api/createTimelineWithEvents.ts @@ -23,10 +23,10 @@ export const createTimelineWithEvents = ({ // @ts-expect-error - Cypress typings don't account for what happens in then() here return createTimeline(timeline).then(({ body: timeline }) => { return cypressWaitAll( - events.map(query => + events.map((query) => createTimelineEvent({ ...query, timeline_id: timeline.id }), ), - ).then(events => { + ).then((events) => { return { timeline, events, diff --git a/e2e/support/helpers/api/updateDashboardCards.ts b/e2e/support/helpers/api/updateDashboardCards.ts index 0f81892e543..8ec0d8dd119 100644 --- a/e2e/support/helpers/api/updateDashboardCards.ts +++ b/e2e/support/helpers/api/updateDashboardCards.ts @@ -23,6 +23,6 @@ export function updateDashboardCards({ }): Cypress.Chainable> { let id = -1; return cy.request("PUT", `/api/dashboard/${dashboard_id}`, { - dashcards: cards.map(card => ({ ...DEFAULT_CARD, id: id--, ...card })), + dashcards: cards.map((card) => ({ ...DEFAULT_CARD, id: id--, ...card })), }); } diff --git a/e2e/support/helpers/component-testing-sdk/component-embedding-sdk-console-helpers.tsx b/e2e/support/helpers/component-testing-sdk/component-embedding-sdk-console-helpers.tsx index 2201671a6f5..69861649d40 100644 --- a/e2e/support/helpers/component-testing-sdk/component-embedding-sdk-console-helpers.tsx +++ b/e2e/support/helpers/component-testing-sdk/component-embedding-sdk-console-helpers.tsx @@ -16,7 +16,7 @@ export function mountSdkContentAndAssertNoKnownErrors( mountSdkContentOptions: MountSdkContentOptions = {}, ) { // Monitor console errors, but don't log them in the Cypress runner UI. - cy.window().then(win => { + cy.window().then((win) => { cy.stub(win.console, "error").log(false).as("consoleError"); }); @@ -29,8 +29,8 @@ export function mountSdkContentAndAssertNoKnownErrors( cy.findByTestId("loading-indicator").should("not.exist"); }); - cy.get("@consoleError").should($console => { - const lifecycleErrors = $console.args.filter(args => { + cy.get("@consoleError").should(($console) => { + const lifecycleErrors = $console.args.filter((args) => { const message = args.join(" "); const hasUnsafeLifecycleWarning = message.includes("UNSAFE_component"); diff --git a/e2e/support/helpers/component-testing-sdk/component-embedding-sdk-helpers.tsx b/e2e/support/helpers/component-testing-sdk/component-embedding-sdk-helpers.tsx index 2d5679ddb0d..912a1568ee9 100644 --- a/e2e/support/helpers/component-testing-sdk/component-embedding-sdk-helpers.tsx +++ b/e2e/support/helpers/component-testing-sdk/component-embedding-sdk-helpers.tsx @@ -23,7 +23,7 @@ export const DEFAULT_SDK_AUTH_PROVIDER_CONFIG = { }; export const mockAuthProviderAndJwtSignIn = (user = USERS.admin) => { - cy.intercept("GET", AUTH_PROVIDER_URL, async req => { + cy.intercept("GET", AUTH_PROVIDER_URL, async (req) => { try { const secret = new TextEncoder().encode(JWT_SHARED_SECRET); const token = await new jose.SignJWT({ diff --git a/e2e/support/helpers/component-testing-sdk/component-embedding-sdk-question-helpers.tsx b/e2e/support/helpers/component-testing-sdk/component-embedding-sdk-question-helpers.tsx index 169b9639b67..e3af9d9deaf 100644 --- a/e2e/support/helpers/component-testing-sdk/component-embedding-sdk-question-helpers.tsx +++ b/e2e/support/helpers/component-testing-sdk/component-embedding-sdk-question-helpers.tsx @@ -24,7 +24,7 @@ export function mountInteractiveQuestion( cy.intercept("GET", "/api/card/*").as("getCard"); cy.intercept("POST", "/api/card/*/query").as("cardQuery"); - cy.get("@questionId").then(questionId => { + cy.get("@questionId").then((questionId) => { mountSdkContent( , mountSdkContentOptions, @@ -47,7 +47,7 @@ export function mountStaticQuestion( cy.intercept("GET", "/api/card/*").as("getCard"); cy.intercept("POST", "/api/card/*/query").as("cardQuery"); - cy.get("@questionId").then(questionId => { + cy.get("@questionId").then((questionId) => { mountSdkContent(); }); diff --git a/e2e/support/helpers/e2e-ad-hoc-question-helpers.js b/e2e/support/helpers/e2e-ad-hoc-question-helpers.js index 66024ca1212..a5346bcb361 100644 --- a/e2e/support/helpers/e2e-ad-hoc-question-helpers.js +++ b/e2e/support/helpers/e2e-ad-hoc-question-helpers.js @@ -140,7 +140,7 @@ export function visitQuestionAdhoc( runQueryIfNeeded(question, autorun); if (mode !== "notebook" && !skipWaiting) { - return cy.wait("@" + alias).then(xhr => callback && callback(xhr)); + return cy.wait("@" + alias).then((xhr) => callback && callback(xhr)); } // Ensure chainability diff --git a/e2e/support/helpers/e2e-command-palette-helpers.js b/e2e/support/helpers/e2e-command-palette-helpers.js index 49abd01c8c8..a5b1c518a93 100644 --- a/e2e/support/helpers/e2e-command-palette-helpers.js +++ b/e2e/support/helpers/e2e-command-palette-helpers.js @@ -31,4 +31,4 @@ export const commandPaletteSearch = (query, viewAll = true) => { } }; -export const commandPaletteAction = name => cy.findByRole("option", { name }); +export const commandPaletteAction = (name) => cy.findByRole("option", { name }); diff --git a/e2e/support/helpers/e2e-custom-column-helpers.ts b/e2e/support/helpers/e2e-custom-column-helpers.ts index b4432c0820a..f329c9b684e 100644 --- a/e2e/support/helpers/e2e-custom-column-helpers.ts +++ b/e2e/support/helpers/e2e-custom-column-helpers.ts @@ -60,10 +60,10 @@ export function enterCustomColumnDetails({ } export function checkExpressionEditorHelperPopoverPosition() { - expressionEditorTextfield().then($target => { + expressionEditorTextfield().then(($target) => { const textfieldPosition = $target[0].getBoundingClientRect(); - cy.findByTestId("expression-helper-popover").then($target => { + cy.findByTestId("expression-helper-popover").then(($target) => { const popoverPosition = $target[0].getBoundingClientRect(); expect(textfieldPosition.top - popoverPosition.top).to.be.lessThan( @@ -117,7 +117,7 @@ export const CustomExpressionEditor = { const parts = text.replaceAll("{{", "{{}{{}").split(/(\{[^}]+\})/); - parts.forEach(part => { + parts.forEach((part) => { cy.wait(delay); switch (part.toLowerCase()) { case "": @@ -183,7 +183,7 @@ export const CustomExpressionEditor = { const alphabet = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789^[]()-,.;_!@#$%&*+=/<>\" ':;\\"; - if (unexpanded.split("").some(char => !alphabet.includes(char))) { + if (unexpanded.split("").some((char) => !alphabet.includes(char))) { throw new Error( `unknown character in CustomExpressionEditor.type in ${part}`, ); @@ -226,7 +226,7 @@ export const CustomExpressionEditor = { // Get the multiline text content of the editor return CustomExpressionEditor.textbox() .get(".cm-line") - .then(lines => { + .then((lines) => { const text: string[] = []; lines.each((_, line) => { text.push(line.textContent ?? ""); @@ -269,7 +269,7 @@ export const CustomExpressionEditor = { return cy.findByTestId("expression-helper"); }, paste(content: string) { - CustomExpressionEditor.textbox().then(el => { + CustomExpressionEditor.textbox().then((el) => { const clipboardData = new DataTransfer(); clipboardData.setData("text/plain", content); diff --git a/e2e/support/helpers/e2e-downloads-helpers.ts b/e2e/support/helpers/e2e-downloads-helpers.ts index 7ac41a930ac..fab666bb30d 100644 --- a/e2e/support/helpers/e2e-downloads-helpers.ts +++ b/e2e/support/helpers/e2e-downloads-helpers.ts @@ -69,7 +69,7 @@ export function downloadAndAssert( * https://github.com/cypress-io/cypress-example-recipes/blob/master/examples/testing-dom__download/cypress/integration/form-submission-spec.js */ - cy.intercept(method, endpoint, req => { + cy.intercept(method, endpoint, (req) => { /** * We must redirect in order to avoid Cypress being stuck on waiting for the new page to load. * Intentionally redirecting to a non-existing page. @@ -107,7 +107,7 @@ export function downloadAndAssert( if (pivoting != null) { cy.findByTestId("keep-data-pivoted") .as("keep-data-pivoted") - .then($checkbox => { + .then(($checkbox) => { const isChecked = $checkbox.prop("checked"); const shouldPivot = pivoting === "pivoted"; @@ -122,7 +122,7 @@ export function downloadAndAssert( cy.wait("@fileDownload") .its("request") - .then(req => { + .then((req) => { // The payload for the xlsx is in the binary form fileType === "xlsx" && Object.assign(req, { encoding: "binary" }); diff --git a/e2e/support/helpers/e2e-dragndrop-helpers.js b/e2e/support/helpers/e2e-dragndrop-helpers.js index fee28f9b7ed..c6571ca5829 100644 --- a/e2e/support/helpers/e2e-dragndrop-helpers.js +++ b/e2e/support/helpers/e2e-dragndrop-helpers.js @@ -8,12 +8,12 @@ export function dragField(startIndex, dropIndex) { // eslint-disable-next-line no-unsafe-element-filtering cy.get("@dragHandle") .eq(dropIndex) - .then($target => { + .then(($target) => { const coordsDrop = $target[0].getBoundingClientRect(); // eslint-disable-next-line no-unsafe-element-filtering cy.get("@dragHandle") .eq(startIndex) - .then(subject => { + .then((subject) => { const coordsDrag = subject[0].getBoundingClientRect(); cy.wrap(subject) .trigger("mousedown", { diff --git a/e2e/support/helpers/e2e-email-helpers.js b/e2e/support/helpers/e2e-email-helpers.js index 1bb635a0767..c1685dc4466 100644 --- a/e2e/support/helpers/e2e-email-helpers.js +++ b/e2e/support/helpers/e2e-email-helpers.js @@ -38,7 +38,7 @@ export const getInbox = () => { const getInboxWithRetry = (timeout = INBOX_TIMEOUT) => { return cy .request("GET", `http://localhost:${WEB_PORT}/email`) - .then(response => { + .then((response) => { if (response.body.length) { return cy.wrap(response); } else if (timeout > 0) { @@ -54,22 +54,22 @@ export const clearInbox = () => { return cy.request("DELETE", `http://localhost:${WEB_PORT}/email/all`); }; -export const viewEmailPage = emailSubject => { +export const viewEmailPage = (emailSubject) => { const webmailInterface = `http://localhost:${WEB_PORT}`; - cy.window().then(win => (win.location.href = webmailInterface)); + cy.window().then((win) => (win.location.href = webmailInterface)); cy.findByText(emailSubject).click(); }; -export const openEmailPage = emailSubject => { +export const openEmailPage = (emailSubject) => { const webmailInterface = `http://localhost:${WEB_PORT}`; - cy.window().then(win => (win.location.href = webmailInterface)); + cy.window().then((win) => (win.location.href = webmailInterface)); cy.findAllByText(emailSubject).first().click(); - return cy.hash().then(path => { + return cy.hash().then((path) => { const htmlPath = `${webmailInterface}${path.slice(1)}/html`; - cy.window().then(win => (win.location.href = htmlPath)); + cy.window().then((win) => (win.location.href = htmlPath)); cy.findByText(emailSubject); }); }; @@ -81,7 +81,7 @@ export const clickSend = () => { cy.wait("@emailSent"); }; -export const openAndAddEmailsToSubscriptions = recipients => { +export const openAndAddEmailsToSubscriptions = (recipients) => { openSharingMenu("Subscriptions"); sidebar().findByText("Set up a dashboard subscription").should("be.visible"); @@ -91,13 +91,13 @@ export const openAndAddEmailsToSubscriptions = recipients => { const input = cy .findByPlaceholderText("Enter user names or email addresses") .click(); - recipients.forEach(recipient => { + recipients.forEach((recipient) => { input.type(`${recipient}{enter}`); }); input.blur(); }; -export const setupSubscriptionWithRecipients = recipients => { +export const setupSubscriptionWithRecipients = (recipients) => { openAndAddEmailsToSubscriptions(recipients); sidebar().findByText("Done").click(); }; diff --git a/e2e/support/helpers/e2e-embedding-helpers.js b/e2e/support/helpers/e2e-embedding-helpers.js index e75f3d64e1f..02013e19b57 100644 --- a/e2e/support/helpers/e2e-embedding-helpers.js +++ b/e2e/support/helpers/e2e-embedding-helpers.js @@ -46,7 +46,7 @@ import { openSharingMenu } from "./e2e-sharing-helpers"; * }); */ export function visitEmbeddedPage(payload, options) { - getEmbeddedPageUrl(payload, options).then(urlOptions => { + getEmbeddedPageUrl(payload, options).then((urlOptions) => { // Always visit embedded page logged out cy.signOut(); @@ -109,7 +109,7 @@ export function getEmbeddedPageUrl( return { url: urlRoot, qs: { ...setFilters, ...qs }, - onBeforeLoad: window => { + onBeforeLoad: (window) => { onBeforeLoad?.(window); if (urlHash) { window.location.hash = urlHash; @@ -157,7 +157,7 @@ export function getEmbeddedPageUrl( * but make sure user is signed out. */ export function visitIframe() { - getIframeUrl().then(iframeUrl => { + getIframeUrl().then((iframeUrl) => { cy.signOut(); cy.visit(iframeUrl); }); @@ -166,7 +166,7 @@ export function visitIframe() { function getIframeUrl() { modal().findByText("Preview").click(); - return cy.document().then(doc => { + return cy.document().then((doc) => { const iframe = doc.querySelector("iframe"); return iframe.src; @@ -253,7 +253,7 @@ export function publishChanges(apiPath, callback) { cy.button(/^(Publish|Publish changes)$/).click(); // TODO this could be simplified when we send one publish request instead of two - cy.wait(["@publishChanges", "@publishChanges"]).then(xhrs => { + cy.wait(["@publishChanges", "@publishChanges"]).then((xhrs) => { // Unfortunately, the order of requests is not always the same. // Therefore, we must first get the one that has the `embedding_params` and then assert on it. const targetXhr = xhrs.find(({ request }) => diff --git a/e2e/support/helpers/e2e-embedding-sdk-interactive-question-helpers.tsx b/e2e/support/helpers/e2e-embedding-sdk-interactive-question-helpers.tsx index 8ff2225f734..a84e6cf1c80 100644 --- a/e2e/support/helpers/e2e-embedding-sdk-interactive-question-helpers.tsx +++ b/e2e/support/helpers/e2e-embedding-sdk-interactive-question-helpers.tsx @@ -32,7 +32,7 @@ export function saveInteractiveQuestionAsNewQuestion(options: { entityPickerModal().within(() => { cy.findByText("Browse").click(); - collectionPickerPath.forEach(collectionName => + collectionPickerPath.forEach((collectionName) => cy.findByText(collectionName).click(), ); diff --git a/e2e/support/helpers/e2e-enterprise-helpers.js b/e2e/support/helpers/e2e-enterprise-helpers.js index 42e164bc3e1..049627b4a98 100644 --- a/e2e/support/helpers/e2e-enterprise-helpers.js +++ b/e2e/support/helpers/e2e-enterprise-helpers.js @@ -10,7 +10,7 @@ const { IS_ENTERPRISE } = Cypress.env(); * * @param {("all"|"none")} featuresScope */ -export const setTokenFeatures = featuresScope => { +export const setTokenFeatures = (featuresScope) => { if (!IS_ENTERPRISE) { throw new Error( "You must run MetabaseĀ® Enterprise Editionā„¢ for token to make sense.\nMake sure you have `MB_EDITION=ee` in your environment variables.", @@ -66,9 +66,9 @@ export const deleteToken = () => { }); }; -export const mockSessionPropertiesTokenFeatures = features => { - cy.intercept({ method: "GET", url: "/api/session/properties" }, request => { - request.on("response", response => { +export const mockSessionPropertiesTokenFeatures = (features) => { + cy.intercept({ method: "GET", url: "/api/session/properties" }, (request) => { + request.on("response", (response) => { if (typeof response.body === "object") { response.body = { ...response.body, @@ -85,7 +85,7 @@ export const mockSessionPropertiesTokenFeatures = features => { // Gets an object that reflects a *partial* premium feature error - it must // be a partial, otherwise we would need to have a stack trace in this error // object. -export const getPartialPremiumFeatureError = name => ({ +export const getPartialPremiumFeatureError = (name) => ({ cause: `${name} is a paid feature not currently available to your instance. Please upgrade to use it. Learn more at metabase.com/upgrade/`, data: { "status-code": 402, diff --git a/e2e/support/helpers/e2e-filter-helpers.js b/e2e/support/helpers/e2e-filter-helpers.js index 4ad2b75ddc5..d70e9c52898 100644 --- a/e2e/support/helpers/e2e-filter-helpers.js +++ b/e2e/support/helpers/e2e-filter-helpers.js @@ -46,7 +46,7 @@ export function setFilterListSource({ values }) { .clear() .type( values - .map(value => { + .map((value) => { if (Array.isArray(value)) { return value.join(", "); } @@ -62,7 +62,7 @@ export function checkFilterListSourceHasValue({ values }) { cy.findByText("Edit").click(); const expectedString = values - .map(value => { + .map((value) => { if (Array.isArray(value)) { return value.join(", "); } diff --git a/e2e/support/helpers/e2e-misc-helpers.js b/e2e/support/helpers/e2e-misc-helpers.js index 1cb9799662c..3d90d271886 100644 --- a/e2e/support/helpers/e2e-misc-helpers.js +++ b/e2e/support/helpers/e2e-misc-helpers.js @@ -8,7 +8,7 @@ export function typeAndBlurUsingLabel(label, value) { } export function visitAlias(alias) { - cy.get(alias).then(url => { + cy.get(alias).then((url) => { cy.visit(url); }); } @@ -45,10 +45,10 @@ export function runButtonOverlay() { */ export function interceptPromise(method, path) { const state = {}; - const promise = new Promise(resolve => { + const promise = new Promise((resolve) => { state.resolve = resolve; }); - cy.intercept(method, path, req => { + cy.intercept(method, path, (req) => { return promise.then(() => { req.continue(); }); @@ -75,7 +75,7 @@ const cypressWaitAllRecursive = (results, commands) => { return; } - return nextCommand.then(result => { + return nextCommand.then((result) => { results.push(result); if (nextCommand == null) { @@ -105,7 +105,7 @@ export function visitQuestion(questionIdOrAlias) { } if (typeof questionIdOrAlias === "string") { - cy.get(questionIdOrAlias).then(id => visitQuestionById(id)); + cy.get(questionIdOrAlias).then((id) => visitQuestionById(id)); } } @@ -171,7 +171,7 @@ export function visitDashboard(dashboardIdOrAlias, { params = {} } = {}) { } if (typeof dashboardIdOrAlias === "string") { - cy.get(dashboardIdOrAlias).then(id => visitDashboardById(id, { params })); + cy.get(dashboardIdOrAlias).then((id) => visitDashboardById(id, { params })); } } @@ -195,7 +195,7 @@ function visitDashboardById(dashboard_id, config) { if (tabs?.length > 0 && validQuestions) { const firstTab = tabs[0]; validQuestions = validQuestions.filter( - card => card.dashboard_tab_id === firstTab.id, + (card) => card.dashboard_tab_id === firstTab.id, ); } @@ -264,7 +264,7 @@ function dashboardHasQuestions(cards) { export function interceptIfNotPreviouslyDefined({ method, url, alias } = {}) { const aliases = Object.keys(cy.state("aliases") ?? {}); - const isAlreadyDefined = aliases.find(a => a === alias); + const isAlreadyDefined = aliases.find((a) => a === alias); if (!isAlreadyDefined) { cy.intercept(method, url).as(alias); @@ -357,7 +357,7 @@ export function saveSavedQuestion() { cy.intercept("PUT", "/api/card/**").as("updateQuestion"); cy.findByText("Save").click(); - cy.findByTestId("save-question-modal").within(modal => { + cy.findByTestId("save-question-modal").within((modal) => { cy.findByText("Save").click(); }); cy.wait("@updateQuestion"); diff --git a/e2e/support/helpers/e2e-mock-app-settings-helpers.js b/e2e/support/helpers/e2e-mock-app-settings-helpers.js index 90b079eb3d5..70605f5b62c 100644 --- a/e2e/support/helpers/e2e-mock-app-settings-helpers.js +++ b/e2e/support/helpers/e2e-mock-app-settings-helpers.js @@ -1,6 +1,6 @@ function mockProperty(propertyOrObject, value, url) { - cy.intercept("GET", url, req => { - req.reply(res => { + cy.intercept("GET", url, (req) => { + req.reply((res) => { if (typeof propertyOrObject === "object") { Object.assign(res.body, propertyOrObject); } diff --git a/e2e/support/helpers/e2e-model-index-helper.js b/e2e/support/helpers/e2e-model-index-helper.js index 36b5888640b..59d96b7d422 100644 --- a/e2e/support/helpers/e2e-model-index-helper.js +++ b/e2e/support/helpers/e2e-model-index-helper.js @@ -4,12 +4,12 @@ export function createModelIndex({ modelId, pkName, valueName }) { ({ body }) => { const pkRef = [ "field", - body.fields.find(f => f.name === pkName).id, + body.fields.find((f) => f.name === pkName).id, null, ]; const valueRef = [ "field", - body.fields.find(f => f.name === valueName).id, + body.fields.find((f) => f.name === valueName).id, null, ]; @@ -17,7 +17,7 @@ export function createModelIndex({ modelId, pkName, valueName }) { pk_ref: pkRef, value_ref: valueRef, model_id: modelId, - }).then(response => { + }).then((response) => { expect(response.body.state).to.equal("indexed"); expect(response.body.id).to.equal(1); }); diff --git a/e2e/support/helpers/e2e-models-metadata-helpers.js b/e2e/support/helpers/e2e-models-metadata-helpers.js index 618d5cdb75f..2185da61913 100644 --- a/e2e/support/helpers/e2e-models-metadata-helpers.js +++ b/e2e/support/helpers/e2e-models-metadata-helpers.js @@ -78,7 +78,7 @@ export function mapColumnTo({ table, column } = {}) { } export function setModelMetadata(modelId, callback) { - return cy.request("GET", `/api/card/${modelId}`).then(response => { + return cy.request("GET", `/api/card/${modelId}`).then((response) => { const { result_metadata } = response.body; return cy.request("PUT", `/api/card/${modelId}`, { result_metadata: result_metadata.map(callback), diff --git a/e2e/support/helpers/e2e-native-editor-helpers.ts b/e2e/support/helpers/e2e-native-editor-helpers.ts index 0bbd77a4c84..1b8ede86222 100644 --- a/e2e/support/helpers/e2e-native-editor-helpers.ts +++ b/e2e/support/helpers/e2e-native-editor-helpers.ts @@ -72,7 +72,7 @@ function nativeEditorType( // HACK: realType does not accept a lot of common escape sequences, // so we implement them manually here for the native editor. - parts.forEach(part => { + parts.forEach((part) => { switch (part.toLowerCase()) { case "": return; diff --git a/e2e/support/helpers/e2e-permissions-helpers.js b/e2e/support/helpers/e2e-permissions-helpers.js index 925a9171a3c..1d88aa9f750 100644 --- a/e2e/support/helpers/e2e-permissions-helpers.js +++ b/e2e/support/helpers/e2e-permissions-helpers.js @@ -27,7 +27,7 @@ export function modifyPermission( if (shouldPropagate !== null) { cy.findByRole("switch") .as("toggle") - .then($el => { + .then(($el) => { if ($el.attr("aria-checked") !== shouldPropagate.toString()) { cy.get("@toggle").click(); } @@ -56,7 +56,7 @@ export function assertPermissionTable(rows) { .find("tbody > tr") .should("have.length", rows.length); - rows.forEach(row => { + rows.forEach((row) => { const [item, ...permissions] = row; getPermissionRowPermissions(item).each(($permissionEl, index) => { @@ -141,14 +141,14 @@ export function assertDatasetReqIsSandboxed(options = {}) { // if options to make assertions on a column's data if (columnId && columnAssertion) { - const colIndex = data.cols.findIndex(c => c.id === columnId); + const colIndex = data.cols.findIndex((c) => c.id === columnId); expect(colIndex).to.be.gte(0); - const values = data.rows.map(row => row[colIndex]); + const values = data.rows.map((row) => row[colIndex]); const assertionFn = _.isFunction(columnAssertion) ? columnAssertion - : val => val === columnAssertion; + : (val) => val === columnAssertion; const errMsg = `Expected every result in column to be equal to: ${columnAssertion}`; expect(values.every(assertionFn)).to.equal(true, errMsg); } diff --git a/e2e/support/helpers/e2e-qa-databases-helpers.js b/e2e/support/helpers/e2e-qa-databases-helpers.js index b9bf8e9693c..2c981beed6b 100644 --- a/e2e/support/helpers/e2e-qa-databases-helpers.js +++ b/e2e/support/helpers/e2e-qa-databases-helpers.js @@ -78,7 +78,7 @@ function addQADatabase(engine, db_display_name, port, enable_actions = false) { expect(status).to.equal(200); cy.wrap(body.id).as(`${engine}ID`); }) - .then(dbId => { + .then((dbId) => { // Make sure we have all the metadata because we'll need to use it in tests assertOnDatabaseMetadata(engine); @@ -96,7 +96,7 @@ function addQADatabase(engine, db_display_name, port, enable_actions = false) { function assertOnDatabaseMetadata(engine) { cy.request("GET", "/api/database").then(({ body }) => { - const { id } = body.data.find(db => { + const { id } = body.data.find((db) => { return db.engine === engine; }); @@ -145,11 +145,11 @@ function recursiveCheckFields(id, i = 0) { .then(({ body: schema }) => { return schema[0].id; }) - .then(tableId => { + .then((tableId) => { cy.request("GET", `/api/table/${tableId}/query_metadata`).then( ({ body: table }) => { const field = table.fields.find( - field => field.semantic_type !== "type/PK", + (field) => field.semantic_type !== "type/PK", ); if (!field.last_analyzed) { recursiveCheckFields(id, ++i); @@ -191,7 +191,7 @@ export const setupWritableDB = (type = "postgres") => { cy.task("connectAndQueryDB", { connectionConfig: connectionConfig[type], query: dbCheckQuery[type], - }).then(results => { + }).then((results) => { if (!results.rows.length) { cy.log(`**-- Adding ${type} DB for actions --**`); cy.task("connectAndQueryDB", { @@ -237,7 +237,7 @@ export function getTableId({ databaseId = WRITABLE_DB_ID, name }) { return cy .request("GET", `/api/database/${databaseId}/metadata`) .then(({ body }) => { - const table = body?.tables?.find(table => table.name === name); + const table = body?.tables?.find((table) => table.name === name); return table ? table.id : null; }); } @@ -246,7 +246,7 @@ export function getTable({ databaseId = WRITABLE_DB_ID, name }) { return cy .request("GET", `/api/database/${databaseId}/metadata`) .then(({ body }) => { - const table = body?.tables?.find(table => table.name === name); + const table = body?.tables?.find((table) => table.name === name); return table || null; }); } @@ -256,7 +256,7 @@ export const createModelFromTableName = ({ modelName = "Test Action Model", idAlias = "modelId", }) => { - getTableId({ name: tableName }).then(tableId => { + getTableId({ name: tableName }).then((tableId) => { createQuestion( { database: WRITABLE_DB_ID, @@ -297,7 +297,7 @@ export function waitForSyncToFinish({ }); } else if (tableName) { const table = body.tables.find( - table => + (table) => table.name === tableName && table.initial_sync_status === "complete", ); diff --git a/e2e/support/helpers/e2e-request-helpers.js b/e2e/support/helpers/e2e-request-helpers.js index 2117ae879c9..d19330a80eb 100644 --- a/e2e/support/helpers/e2e-request-helpers.js +++ b/e2e/support/helpers/e2e-request-helpers.js @@ -24,7 +24,7 @@ export function spyRequestFinished(name = "requestFinishedSpy") { const spy = cy.spy().as(name); return { - interceptor: req => req.continue(res => spy(req, res)), + interceptor: (req) => req.continue((res) => spy(req, res)), spy, }; } diff --git a/e2e/support/helpers/e2e-search-helpers.js b/e2e/support/helpers/e2e-search-helpers.js index 2c8f685a04e..ae3ae0d294b 100644 --- a/e2e/support/helpers/e2e-search-helpers.js +++ b/e2e/support/helpers/e2e-search-helpers.js @@ -22,7 +22,7 @@ export function expectSearchResultContent({ const searchResultItems = cy.get(searchResultItemSelector); - searchResultItems.then($results => { + searchResultItems.then(($results) => { if (strict) { // Check if the length of the search results is the same as the expected length expect($results).to.have.length(expectedSearchResults.length); diff --git a/e2e/support/helpers/e2e-snowplow-helpers.js b/e2e/support/helpers/e2e-snowplow-helpers.js index c8e5bcf6a8c..64ea52dc975 100644 --- a/e2e/support/helpers/e2e-snowplow-helpers.js +++ b/e2e/support/helpers/e2e-snowplow-helpers.js @@ -37,7 +37,7 @@ export const expectGoodSnowplowEvent = (eventData, count = 1) => { "micro/good", ({ body }) => { lastReceivedEvent = body?.[0].event?.unstruct_event?.data?.data; - lastFoundEventCount = body.filter(snowplowEvent => + lastFoundEventCount = body.filter((snowplowEvent) => isDeepMatch( snowplowEvent?.event?.unstruct_event?.data?.data, eventData, @@ -101,7 +101,7 @@ function isArrayDeepMatch(array, partialArray) { return true; } -export const expectGoodSnowplowEvents = count => { +export const expectGoodSnowplowEvents = (count) => { retrySnowplowRequest("micro/good", ({ body }) => body.length >= count) .its("body") .should("have.length", count); @@ -111,7 +111,7 @@ export const expectNoBadSnowplowEvents = () => { sendSnowplowRequest("micro/bad").its("body").should("deep.equal", []); }; -const sendSnowplowRequest = url => { +const sendSnowplowRequest = (url) => { return cy.request({ url: `${SNOWPLOW_URL}/${url}`, json: true, @@ -124,7 +124,7 @@ const retrySnowplowRequest = ( messageOrMessageFn = null, timeout = SNOWPLOW_TIMEOUT, ) => { - return sendSnowplowRequest(url).then(response => { + return sendSnowplowRequest(url).then((response) => { if (condition(response)) { return cy.wrap(response); } else if (timeout > 0) { @@ -145,6 +145,6 @@ const retrySnowplowRequest = ( }); }; -const blockSnowplowRequest = url => { - return cy.intercept("POST", `${SNOWPLOW_URL}/${url}`, req => req.destroy()); +const blockSnowplowRequest = (url) => { + return cy.intercept("POST", `${SNOWPLOW_URL}/${url}`, (req) => req.destroy()); }; diff --git a/e2e/support/helpers/e2e-ui-elements-helpers.js b/e2e/support/helpers/e2e-ui-elements-helpers.js index 6f183a58d98..2a79737a6ff 100644 --- a/e2e/support/helpers/e2e-ui-elements-helpers.js +++ b/e2e/support/helpers/e2e-ui-elements-helpers.js @@ -66,7 +66,7 @@ export function entityPickerModalTab(name) { // displays at least these tabs: export function shouldDisplayTabs(tabs) { - tabs.forEach(tab => { + tabs.forEach((tab) => { entityPickerModalTab(tab).should("exist"); }); } @@ -74,7 +74,7 @@ export function shouldDisplayTabs(tabs) { export function tabsShouldBe(selected, tabs) { cy.log(tabs); cy.findAllByRole("tab").should("have.length", tabs.length); - tabs.forEach(tab => { + tabs.forEach((tab) => { if (tab === selected) { entityPickerModalTab(tab).and("have.attr", "aria-selected", "true"); } else { @@ -203,12 +203,12 @@ export function toggleFilterWidgetValues( filterWidget().eq(0).click(); popover().within(() => { - values.forEach(value => cy.findByText(value).click()); + values.forEach((value) => cy.findByText(value).click()); cy.button(buttonLabel).click(); }); } -export const openQuestionActions = action => { +export const openQuestionActions = (action) => { cy.findByTestId("qb-header-action-panel").icon("ellipsis").click(); if (action) { diff --git a/e2e/support/helpers/e2e-ui-elements-overflow-helpers.js b/e2e/support/helpers/e2e-ui-elements-overflow-helpers.js index 98a7c8ad4aa..1809c80e9e5 100644 --- a/e2e/support/helpers/e2e-ui-elements-overflow-helpers.js +++ b/e2e/support/helpers/e2e-ui-elements-overflow-helpers.js @@ -1,4 +1,4 @@ -export const isScrollableHorizontally = element => { +export const isScrollableHorizontally = (element) => { const { clientHeight, offsetHeight } = element; const style = window.getComputedStyle(element); const borderTopWidth = parseInt(style.borderTopWidth, 10); @@ -10,7 +10,7 @@ export const isScrollableHorizontally = element => { return isHorizontalScrollbarVisible; }; -export const isScrollableVertically = element => { +export const isScrollableVertically = (element) => { const { clientWidth, offsetWidth } = element; const style = window.getComputedStyle(element); const borderLeftWidth = parseInt(style.borderLeftWidth, 10); @@ -34,7 +34,7 @@ export const assertDescendantNotOverflowsContainer = ( return; } - const getMessage = suffix => { + const getMessage = (suffix) => { return [message, suffix].filter(Boolean).join(" "); }; @@ -48,15 +48,15 @@ export const assertDescendantNotOverflowsContainer = ( ); }; -export const assertIsEllipsified = element => { +export const assertIsEllipsified = (element) => { expect(isEllipsified(element), "is ellipsified").to.equal(true); }; -export const assertIsNotEllipsified = element => { +export const assertIsNotEllipsified = (element) => { expect(isEllipsified(element), "is ellipsified").to.equal(false); }; -export const isEllipsified = element => { +export const isEllipsified = (element) => { return ( element.scrollHeight > element.clientHeight || element.scrollWidth > element.clientWidth diff --git a/e2e/support/helpers/e2e-upload-helpers.js b/e2e/support/helpers/e2e-upload-helpers.js index d80c7e99842..94d49e60704 100644 --- a/e2e/support/helpers/e2e-upload-helpers.js +++ b/e2e/support/helpers/e2e-upload-helpers.js @@ -60,7 +60,7 @@ export function uploadFile( cy.intercept("POST", "/api/table/*/append-csv").as("appendCSV"); cy.intercept("POST", "/api/table/*/replace-csv").as("replaceCSV"); - cy.fixture(`${FIXTURE_PATH}/${testFile.fileName}`).then(file => { + cy.fixture(`${FIXTURE_PATH}/${testFile.fileName}`).then((file) => { cy.get(inputId).selectFile( { contents: Cypress.Buffer.from(file), @@ -97,8 +97,8 @@ export function uploadFile( export function headlessUpload(collectionId, file) { cy.fixture(`${FIXTURE_PATH}/${file.fileName}`) - .then(file => Cypress.Blob.binaryStringToBlob(file)) - .then(blob => { + .then((file) => Cypress.Blob.binaryStringToBlob(file)) + .then((blob) => { const formData = new FormData(); formData.append("file", blob, file.fileName); formData.append("collection_id", collectionId); diff --git a/e2e/support/helpers/e2e-visual-tests-helpers.js b/e2e/support/helpers/e2e-visual-tests-helpers.js index 5da08dfa86c..69f169ed172 100644 --- a/e2e/support/helpers/e2e-visual-tests-helpers.js +++ b/e2e/support/helpers/e2e-visual-tests-helpers.js @@ -20,7 +20,7 @@ export function echartsTriggerBlur() { } export function ensureEchartsContainerHasSvg() { - return echartsContainer().should(root => { + return echartsContainer().should((root) => { // Check if there's an SVG child within the element expect(root.find("svg").length, "SVG exists").to.be.equal(1); }); @@ -68,7 +68,7 @@ export function sankeyEdge(color) { } export function chartPathsWithFillColors(colors) { - return colors.map(color => chartPathWithFillColor(color)); + return colors.map((color) => chartPathWithFillColor(color)); } const CIRCLE_PATH = "M1 0A1 1 0 1 1 1 -0.0001"; @@ -85,7 +85,7 @@ export function cartesianChartCircleWithColor(color) { } export function cartesianChartCircleWithColors(colors) { - return colors.map(color => cartesianChartCircleWithColor(color)); + return colors.map((color) => cartesianChartCircleWithColor(color)); } export function otherSeriesChartPaths() { @@ -137,7 +137,7 @@ export function pieSliceWithColor(color) { export function echartsTooltip() { // ECharts may keep two dom instances of the tooltip - return cy.findAllByTestId("echarts-tooltip").should($elements => { + return cy.findAllByTestId("echarts-tooltip").should(($elements) => { // Use a custom function to check if the fixed-position tooltip is visible, // as Cypress's ":visible" or "be.visible" fails to identify a fixed-position tooltip as visible. const visibleTooltips = $elements @@ -224,7 +224,7 @@ export function assertEChartsTooltip({ header, rows, footer, blurAfter }) { } if (rows != null) { - rows.forEach(row => { + rows.forEach((row) => { const { name, ...rest } = row; assertTooltipRow(name, rest); }); @@ -242,7 +242,7 @@ export function assertEChartsTooltip({ header, rows, footer, blurAfter }) { export function assertEChartsTooltipNotContain(rows) { echartsTooltip().within(() => { - rows.forEach(row => { + rows.forEach((row) => { cy.findByText(row).should("not.exist"); }); }); diff --git a/e2e/support/helpers/e2e-viz-settings-helpers.js b/e2e/support/helpers/e2e-viz-settings-helpers.js index f980fdfa9ea..7cf91ff81b7 100644 --- a/e2e/support/helpers/e2e-viz-settings-helpers.js +++ b/e2e/support/helpers/e2e-viz-settings-helpers.js @@ -7,7 +7,7 @@ export function openSeriesSettings(field, isBreakout = false) { .click({ force: true }); } else { cy.findAllByTestId("chart-setting-select") - .then($elements => { + .then(($elements) => { for (const element of $elements) { if (element.value === field) { return cy.wrap(element); diff --git a/e2e/support/integration/visit-dashboard.cy.spec.js b/e2e/support/integration/visit-dashboard.cy.spec.js index e4ec3c2fb6b..23a48f34b92 100644 --- a/e2e/support/integration/visit-dashboard.cy.spec.js +++ b/e2e/support/integration/visit-dashboard.cy.spec.js @@ -4,7 +4,7 @@ import { USERS } from "e2e/support/cypress_data"; import { setup } from "./visit-dashboard"; describe("visitDashboard e2e helper", () => { - Object.keys(Cypress._.omit(USERS, "sandboxed")).forEach(user => { + Object.keys(Cypress._.omit(USERS, "sandboxed")).forEach((user) => { context(`${user.toUpperCase()}`, () => { beforeEach(() => { H.restore(); diff --git a/e2e/support/test_tables.js b/e2e/support/test_tables.js index 474a9102653..7b51bb1d56a 100644 --- a/e2e/support/test_tables.js +++ b/e2e/support/test_tables.js @@ -7,11 +7,11 @@ import { ip_addresses_rows, many_data_types_rows } from "./test_tables_data"; -export const colors27745 = async dbClient => { +export const colors27745 = async (dbClient) => { const tableName = "colors27745"; await dbClient.schema.dropTableIfExists(tableName); - await dbClient.schema.createTable(tableName, table => { + await dbClient.schema.createTable(tableName, (table) => { table.increments("id").primary(); table.string("name").unique().notNullable(); }); @@ -25,11 +25,11 @@ export const colors27745 = async dbClient => { return null; }; -export const scoreboard_actions = async dbClient => { +export const scoreboard_actions = async (dbClient) => { const tableName = "scoreboard_actions"; await dbClient.schema.dropTableIfExists(tableName); - await dbClient.schema.createTable(tableName, table => { + await dbClient.schema.createTable(tableName, (table) => { table.increments("id").primary(); table.string("team_name").unique().notNullable(); table.integer("score").notNullable().defaultTo(0); @@ -57,12 +57,12 @@ export const scoreboard_actions = async dbClient => { return null; }; -export const many_data_types = async dbClient => { +export const many_data_types = async (dbClient) => { const tableName = "many_data_types"; await dbClient.schema.dropTableIfExists(tableName); - await dbClient.schema.createTable(tableName, table => { + await dbClient.schema.createTable(tableName, (table) => { table.increments("id").primary(); table.uuid("uuid"); @@ -102,12 +102,12 @@ export const many_data_types = async dbClient => { return null; }; -export const uuid_pk_table = async dbClient => { +export const uuid_pk_table = async (dbClient) => { const tableName = "uuid_pk_table"; await dbClient.schema.dropTableIfExists(tableName); - await dbClient.schema.createTable(tableName, table => { + await dbClient.schema.createTable(tableName, (table) => { table.uuid("id").primary(); table.string("name"); }); @@ -120,12 +120,12 @@ export const uuid_pk_table = async dbClient => { return null; }; -export const composite_pk_table = async dbClient => { +export const composite_pk_table = async (dbClient) => { const tableName = "composite_pk_table"; await dbClient.schema.dropTableIfExists(tableName); - await dbClient.schema.createTable(tableName, table => { + await dbClient.schema.createTable(tableName, (table) => { table.integer("id1"); table.string("id2"); table.string("name"); @@ -145,12 +145,12 @@ export const composite_pk_table = async dbClient => { return null; }; -export const no_pk_table = async dbClient => { +export const no_pk_table = async (dbClient) => { const tableName = "no_pk_table"; await dbClient.schema.dropTableIfExists(tableName); - await dbClient.schema.createTable(tableName, table => { + await dbClient.schema.createTable(tableName, (table) => { table.string("name"); table.integer("score"); }); @@ -167,12 +167,12 @@ export const no_pk_table = async dbClient => { return null; }; -export const bigint_pk_table = async dbClient => { +export const bigint_pk_table = async (dbClient) => { const tableName = "bigint_pk_table"; await dbClient.schema.dropTableIfExists(tableName); - await dbClient.schema.createTable(tableName, table => { + await dbClient.schema.createTable(tableName, (table) => { table.bigInteger("id").primary(); table.string("name"); }); @@ -186,12 +186,12 @@ export const bigint_pk_table = async dbClient => { return null; }; -export const decimal_pk_table = async dbClient => { +export const decimal_pk_table = async (dbClient) => { const tableName = "decimal_pk_table"; await dbClient.schema.dropTableIfExists(tableName); - await dbClient.schema.createTable(tableName, table => { + await dbClient.schema.createTable(tableName, (table) => { table.decimal("id", 38, 0).primary(); table.string("name"); }); @@ -205,7 +205,7 @@ export const decimal_pk_table = async dbClient => { return null; }; -export const multi_schema = async dbClient => { +export const multi_schema = async (dbClient) => { const schemas = { Domestic: { Animals: [ @@ -229,7 +229,7 @@ export const multi_schema = async dbClient => { for (const [table, rows] of Object.entries(tables)) { await dbClient.schema.withSchema(schema).dropTableIfExists(table); - await dbClient.schema.withSchema(schema).createTable(table, t => { + await dbClient.schema.withSchema(schema).createTable(table, (t) => { t.string("name"); t.integer("score"); }); @@ -240,12 +240,12 @@ export const multi_schema = async dbClient => { return schemas; }; -export const ip_addresses = async dbClient => { +export const ip_addresses = async (dbClient) => { const tableName = "ip_addresses"; await dbClient.schema.dropTableIfExists(tableName); - await dbClient.schema.createTable(tableName, table => { + await dbClient.schema.createTable(tableName, (table) => { table.text("count"); }); @@ -255,10 +255,10 @@ export const ip_addresses = async dbClient => { return null; }; -export const many_schemas = async dbClient => { +export const many_schemas = async (dbClient) => { const alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".split(""); const schemas = Object.fromEntries( - alphabet.map(letter => { + alphabet.map((letter) => { const key = `Schema ${letter}`; const value = [ "Animals", @@ -277,7 +277,7 @@ export const many_schemas = async dbClient => { await dbClient.schema.createSchemaIfNotExists(schemaName); await dbClient.schema.withSchema(schemaName).dropTableIfExists(table); - await dbClient.schema.withSchema(schemaName).createTable(table, t => { + await dbClient.schema.withSchema(schemaName).createTable(table, (t) => { t.string("name"); t.integer("score"); }); @@ -288,11 +288,11 @@ export const many_schemas = async dbClient => { return schemas; }; -export const cached_table = async dbClient => { +export const cached_table = async (dbClient) => { const tableName = "cached_table"; await dbClient.schema.dropTableIfExists(tableName); - await dbClient.schema.createTable(tableName, table => { + await dbClient.schema.createTable(tableName, (table) => { table.increments("id").primary(); table.string("my_text").notNullable(); }); diff --git a/e2e/test-component/scenarios/embedding-sdk/collection-browser.cy.spec.tsx b/e2e/test-component/scenarios/embedding-sdk/collection-browser.cy.spec.tsx index de51c8c1ea9..8a06f5f8038 100644 --- a/e2e/test-component/scenarios/embedding-sdk/collection-browser.cy.spec.tsx +++ b/e2e/test-component/scenarios/embedding-sdk/collection-browser.cy.spec.tsx @@ -17,7 +17,7 @@ describe("scenarios > embedding-sdk > collection browser", () => { cy.intercept("GET", "/api/collection/*").as("getCollection"); }); - ["personal", undefined].forEach(collectionId => { + ["personal", undefined].forEach((collectionId) => { it(`should show the personal collection when collectionId is ${collectionId ? collectionId : "not passed"}`, () => { cy.intercept("GET", "/api/user/current").as("getCurrentUser"); @@ -28,7 +28,7 @@ describe("scenarios > embedding-sdk > collection browser", () => { cy.wait("@getCurrentUser").then(({ response }) => { const personalCollectionId = response?.body.personal_collection_id; - cy.wait("@getCollection").then(collectionInterception => { + cy.wait("@getCollection").then((collectionInterception) => { expect(collectionInterception.request.url).to.include( `/api/collection/${personalCollectionId}`, ); @@ -44,7 +44,7 @@ describe("scenarios > embedding-sdk > collection browser", () => { it("should use the root collection if collectionId is 'root'", () => { mountSdkContent(); - cy.wait("@getCollection").then(interception => { + cy.wait("@getCollection").then((interception) => { expect(interception.request.url).to.include("/api/collection/root"); }); }); diff --git a/e2e/test-component/scenarios/embedding-sdk/create-dashboard.cy.spec.tsx b/e2e/test-component/scenarios/embedding-sdk/create-dashboard.cy.spec.tsx index 330c906e7f5..8eb05aabffc 100644 --- a/e2e/test-component/scenarios/embedding-sdk/create-dashboard.cy.spec.tsx +++ b/e2e/test-component/scenarios/embedding-sdk/create-dashboard.cy.spec.tsx @@ -36,7 +36,7 @@ describe("scenarios > embedding-sdk > create-dashboard modal", () => { cy.wait("@getCurrentUser").then(({ response }) => { const personalCollectionId = response?.body.personal_collection_id; - cy.wait("@createDashboard").then(interception => { + cy.wait("@createDashboard").then((interception) => { expect(interception.request.body.collection_id).to.equal( personalCollectionId, ); @@ -56,7 +56,7 @@ describe("scenarios > embedding-sdk > create-dashboard modal", () => { cy.wait("@getCurrentUser").then(({ response }) => { const personalCollectionId = response?.body.personal_collection_id; - cy.wait("@createDashboard").then(interception => { + cy.wait("@createDashboard").then((interception) => { expect(interception.request.body.collection_id).to.equal( personalCollectionId, ); @@ -81,7 +81,7 @@ describe("scenarios > embedding-sdk > create-dashboard modal", () => { fillAndSubmitForm(); - cy.wait("@createDashboard").then(interception => { + cy.wait("@createDashboard").then((interception) => { expect(interception.request.body.collection_id).to.equal(null); }); }); diff --git a/e2e/test-component/scenarios/embedding-sdk/dashboard-click-behavior.cy.spec.tsx b/e2e/test-component/scenarios/embedding-sdk/dashboard-click-behavior.cy.spec.tsx index a79f8738bb4..95c7c623378 100644 --- a/e2e/test-component/scenarios/embedding-sdk/dashboard-click-behavior.cy.spec.tsx +++ b/e2e/test-component/scenarios/embedding-sdk/dashboard-click-behavior.cy.spec.tsx @@ -110,16 +110,16 @@ describe("scenarios > embedding-sdk > dashboard-click-behavior", () => { it("should not trigger url click behaviors in the sdk (metabase#51099)", () => { // Spies to intercept opening external links. // See "clickLink" in frontend/src/metabase/lib/dom.js to see what we are intercepting. - cy.window().then(win => { + cy.window().then((win) => { cy.spy(win.HTMLAnchorElement.prototype, "click").as("anchorClick"); }); - cy.get("@dashboardId").then(dashboardId => { + cy.get("@dashboardId").then((dashboardId) => { mountSdkContent(); }); cy.wait("@dashcardQuery").then(() => { - cy.location().then(location => { + cy.location().then((location) => { cy.wrap(location.pathname).as("initialPath"); }); @@ -155,7 +155,7 @@ describe("scenarios > embedding-sdk > dashboard-click-behavior", () => { }); // We should never open a window in new tab in this test. - cy.get("@anchorClick").then(clickSpy => { + cy.get("@anchorClick").then((clickSpy) => { const blankClicks = clickSpy .getCalls() .filter( @@ -166,7 +166,7 @@ describe("scenarios > embedding-sdk > dashboard-click-behavior", () => { }); // We should never be navigated away from the current page in this test. - cy.location().then(location => { + cy.location().then((location) => { cy.get("@initialPath").should("eq", location.pathname); }); }); @@ -176,7 +176,7 @@ describe("scenarios > embedding-sdk > dashboard-click-behavior", () => { cy.intercept("GET", "/api/card/*").as("getCard"); cy.intercept("POST", "/api/dataset/query_metadata").as("datasetMetadata"); - cy.get("@dashboardId").then(dashboardId => { + cy.get("@dashboardId").then((dashboardId) => { mountSdkContent(); }); diff --git a/e2e/test-component/scenarios/embedding-sdk/data-picker.cy.spec.tsx b/e2e/test-component/scenarios/embedding-sdk/data-picker.cy.spec.tsx index 16cd2e15fde..d388c97b41b 100644 --- a/e2e/test-component/scenarios/embedding-sdk/data-picker.cy.spec.tsx +++ b/e2e/test-component/scenarios/embedding-sdk/data-picker.cy.spec.tsx @@ -48,9 +48,9 @@ describe("scenarios > embedding-sdk > interactive-question > creating a question describe("multi-stage picker", () => { beforeEach(() => { - cy.intercept("GET", "/api/search*", req => { + cy.intercept("GET", "/api/search*", (req) => { if (req.query.limit === "0") { - req.continue(res => { + req.continue((res) => { // The data picker will fall back to multi-stage picker if there are more than or equal 100 tables and models res.body.total = 100; }); diff --git a/e2e/test-component/scenarios/embedding-sdk/editable-dashboard.cy.spec.tsx b/e2e/test-component/scenarios/embedding-sdk/editable-dashboard.cy.spec.tsx index 396c96ddeb3..28b68ad2a1f 100644 --- a/e2e/test-component/scenarios/embedding-sdk/editable-dashboard.cy.spec.tsx +++ b/e2e/test-component/scenarios/embedding-sdk/editable-dashboard.cy.spec.tsx @@ -40,7 +40,7 @@ describe("scenarios > embedding-sdk > editable-dashboard", () => { }); it("Should not open sidesheet when clicking last edit info (metabase#48354)", () => { - cy.get("@dashboardId").then(dashboardId => { + cy.get("@dashboardId").then((dashboardId) => { mountSdkContent(); }); @@ -86,7 +86,7 @@ describe("scenarios > embedding-sdk > editable-dashboard", () => { successTestCases.forEach(({ name, dashboardIdAlias }) => { it(`should load dashboard content for ${name}`, () => { - cy.get(dashboardIdAlias).then(dashboardId => { + cy.get(dashboardIdAlias).then((dashboardId) => { mountSdkContent(); }); @@ -162,7 +162,7 @@ describe("scenarios > embedding-sdk > editable-dashboard", () => { }); it('should drill dashboards with filter values and not showing "Question not found" error (EMB-84)', () => { - cy.get("@dashboardId").then(dashboardId => { + cy.get("@dashboardId").then((dashboardId) => { mountSdkContent(); }); @@ -172,7 +172,7 @@ describe("scenarios > embedding-sdk > editable-dashboard", () => { * This seems to be the only reliable way to force the error to stay, and we will resolve * the promise that will cause the error to go away manually after asserting that it's not there. */ - cy.intercept("get", "/api/card/*", req => { + cy.intercept("get", "/api/card/*", (req) => { return promise.then(() => { req.continue(); }); @@ -191,7 +191,7 @@ describe("scenarios > embedding-sdk > editable-dashboard", () => { }); it("should not show New Question button in sidebar (metabase#53896)", () => { - cy.get("@dashboardId").then(dashboardId => { + cy.get("@dashboardId").then((dashboardId) => { mountSdkContent(); }); diff --git a/e2e/test-component/scenarios/embedding-sdk/interactive-dashboard.cy.spec.tsx b/e2e/test-component/scenarios/embedding-sdk/interactive-dashboard.cy.spec.tsx index 828db64db7c..dc4f73d354b 100644 --- a/e2e/test-component/scenarios/embedding-sdk/interactive-dashboard.cy.spec.tsx +++ b/e2e/test-component/scenarios/embedding-sdk/interactive-dashboard.cy.spec.tsx @@ -78,7 +78,7 @@ describe("scenarios > embedding-sdk > interactive-dashboard", () => { }); it("should be able to display custom question layout when clicking on dashboard cards", () => { - cy.get("@dashboardId").then(dashboardId => { + cy.get("@dashboardId").then((dashboardId) => { mountSdkContent( embedding-sdk > interactive-dashboard", () => { successTestCases.forEach(({ name, dashboardIdAlias }) => { it(`should load dashboard content for ${name}`, () => { - cy.get(dashboardIdAlias).then(dashboardId => { + cy.get(dashboardIdAlias).then((dashboardId) => { mountSdkContent(); }); @@ -161,7 +161,7 @@ describe("scenarios > embedding-sdk > interactive-dashboard", () => { }); it('should drill dashboards with filter values and not showing "Question not found" error (EMB-84)', () => { - cy.get("@dashboardId").then(dashboardId => { + cy.get("@dashboardId").then((dashboardId) => { mountSdkContent(); }); @@ -174,7 +174,7 @@ describe("scenarios > embedding-sdk > interactive-dashboard", () => { * This seems to be the only reliable way to force the error to stay, and we will resolve * the promise that will cause the error to go away manually after asserting that it's not there. */ - cy.intercept("get", "/api/card/*", req => { + cy.intercept("get", "/api/card/*", (req) => { return promise.then(() => { req.continue(); }); diff --git a/e2e/test-component/scenarios/embedding-sdk/interactive-question-theming.cy.spec.tsx b/e2e/test-component/scenarios/embedding-sdk/interactive-question-theming.cy.spec.tsx index ecfa4ef8da3..4424a27996d 100644 --- a/e2e/test-component/scenarios/embedding-sdk/interactive-question-theming.cy.spec.tsx +++ b/e2e/test-component/scenarios/embedding-sdk/interactive-question-theming.cy.spec.tsx @@ -58,7 +58,7 @@ describe( }, }; - cy.get("@questionId").then(questionId => { + cy.get("@questionId").then((questionId) => { mountSdkContent( @@ -78,18 +78,18 @@ describe( cy.findByTestId("notebook-button") .should("be.visible") .realHover() - .should($el => haveBackgroundColor($el, buttonHoverBg)); + .should(($el) => haveBackgroundColor($el, buttonHoverBg)); // Should be the lightened version of the background color cy.findByTestId("chart-type-selector-button") .should("be.visible") .realHover() - .should($el => haveBackgroundColor($el, buttonHoverBg)); + .should(($el) => haveBackgroundColor($el, buttonHoverBg)); cy.findByTestId("notebook-button").click(); // Should be the lightened version of the background color, same as the notebook button hover. - cy.get(customColumn).should($el => + cy.get(customColumn).should(($el) => haveBackgroundColor($el, buttonHoverBg), ); @@ -97,7 +97,7 @@ describe( cy.get(customColumn) .should("be.visible") .realHover() - .should($el => + .should(($el) => haveBackgroundColor($el, lighten(theme.colors?.background, 0.4)), ); }); @@ -114,7 +114,7 @@ describe( }, }; - cy.get("@questionId").then(questionId => { + cy.get("@questionId").then((questionId) => { mountSdkContent( @@ -131,7 +131,7 @@ describe( cy.findByTestId("notebook-button").click(); // Should be the slightly darker version of the background color, same as the notebook button hover - cy.get(customColumn).should($el => + cy.get(customColumn).should(($el) => haveBackgroundColor($el, darken(theme.colors?.background, 0.05)), ); @@ -139,7 +139,7 @@ describe( cy.get(customColumn) .should("be.visible") .realHover() - .should($el => + .should(($el) => haveBackgroundColor($el, darken(theme.colors?.background, 0.1)), ); }); diff --git a/e2e/test-component/scenarios/embedding-sdk/interactive-question.cy.spec.tsx b/e2e/test-component/scenarios/embedding-sdk/interactive-question.cy.spec.tsx index 7f8ab7a7f8b..c849648a9de 100644 --- a/e2e/test-component/scenarios/embedding-sdk/interactive-question.cy.spec.tsx +++ b/e2e/test-component/scenarios/embedding-sdk/interactive-question.cy.spec.tsx @@ -74,7 +74,7 @@ describe("scenarios > embedding-sdk > interactive-question", () => { // eslint-disable-next-line no-unsafe-element-filtering cy.findAllByTestId("cell-data").last().click(); - cy.on("uncaught:exception", error => { + cy.on("uncaught:exception", (error) => { expect( error.message.includes( "Error converting :aggregation reference: no aggregation at index 0", @@ -98,7 +98,7 @@ describe("scenarios > embedding-sdk > interactive-question", () => { const lastColumnName = "Max of Quantity"; const columnNames = [firstColumnName, lastColumnName]; - columnNames.forEach(columnName => { + columnNames.forEach((columnName) => { tableInteractive().findByText(columnName).should("be.visible"); tableHeaderClick(columnName); @@ -206,7 +206,7 @@ describe("scenarios > embedding-sdk > interactive-question", () => { ); - cy.get("@questionId").then(questionId => { + cy.get("@questionId").then((questionId) => { mountSdkContent(); }); @@ -270,7 +270,7 @@ describe("scenarios > embedding-sdk > interactive-question", () => { const onBeforeSaveSpy = cy.spy().as("onBeforeSaveSpy"); const onSaveSpy = cy.spy().as("onSaveSpy"); - cy.get("@questionId").then(questionId => { + cy.get("@questionId").then((questionId) => { mountSdkContent( embedding-sdk > interactive-question", () => { // Expect the default summarization view to be there. cy.findByTestId("aggregation-picker").should("be.visible"); - cy.on("uncaught:exception", error => { + cy.on("uncaught:exception", (error) => { expect(error.message.includes("Stage 1 does not exist")).to.be.false; }); }); it("does not contain known console errors (metabase#48497)", () => { - cy.get("@questionId").then(questionId => { + cy.get("@questionId").then((questionId) => { mountSdkContentAndAssertNoKnownErrors( , ); @@ -353,7 +353,7 @@ describe("scenarios > embedding-sdk > interactive-question", () => { successTestCases.forEach(({ name, questionIdAlias }) => { it(`should load question content for ${name}`, () => { - cy.get(questionIdAlias).then(questionId => { + cy.get(questionIdAlias).then((questionId) => { mountInteractiveQuestion({ questionId }); }); diff --git a/e2e/test-component/scenarios/embedding-sdk/locale-on-provider.cy.spec.tsx b/e2e/test-component/scenarios/embedding-sdk/locale-on-provider.cy.spec.tsx index ef0a9ccf610..413fde67653 100644 --- a/e2e/test-component/scenarios/embedding-sdk/locale-on-provider.cy.spec.tsx +++ b/e2e/test-component/scenarios/embedding-sdk/locale-on-provider.cy.spec.tsx @@ -50,7 +50,7 @@ describe("scenarios > embedding-sdk > locale set on MetabaseProvider", () => { it("when locale=de-CH it should fallback to `de.json`", () => { setup({ locale: "de-CH" }); - cy.request("/app/locales/de.json").then(response => { + cy.request("/app/locales/de.json").then((response) => { expect(response.status).to.eq(200); }); @@ -60,7 +60,7 @@ describe("scenarios > embedding-sdk > locale set on MetabaseProvider", () => { it("when locale=pt it should fallback to pt_BR.json", () => { setup({ locale: "pt" }); - cy.request("/app/locales/pt_BR.json").then(response => { + cy.request("/app/locales/pt_BR.json").then((response) => { expect(response.status).to.eq(200); }); @@ -70,7 +70,7 @@ describe("scenarios > embedding-sdk > locale set on MetabaseProvider", () => { it("when locale=zh-TW it use it as it's available", () => { setup({ locale: "zh-TW" }); - cy.request("/app/locales/zh_TW.json").then(response => { + cy.request("/app/locales/zh_TW.json").then((response) => { expect(response.status).to.eq(200); }); diff --git a/e2e/test-component/scenarios/embedding-sdk/plugins.cy.spec.tsx b/e2e/test-component/scenarios/embedding-sdk/plugins.cy.spec.tsx index 0d49543bc96..aa8942c6a69 100644 --- a/e2e/test-component/scenarios/embedding-sdk/plugins.cy.spec.tsx +++ b/e2e/test-component/scenarios/embedding-sdk/plugins.cy.spec.tsx @@ -79,7 +79,7 @@ describe("scenarios > embedding-sdk > plugins", () => { }); it("should open a click actions popover with a custom item", () => { - cy.get("@dashboardId").then(dashboardId => { + cy.get("@dashboardId").then((dashboardId) => { mountSdkContent( { + increment: (state) => { state.value += 1; }, }, diff --git a/e2e/test-component/scenarios/embedding-sdk/static-dashboard.cy.spec.tsx b/e2e/test-component/scenarios/embedding-sdk/static-dashboard.cy.spec.tsx index b0932366b73..0f03df24bef 100644 --- a/e2e/test-component/scenarios/embedding-sdk/static-dashboard.cy.spec.tsx +++ b/e2e/test-component/scenarios/embedding-sdk/static-dashboard.cy.spec.tsx @@ -49,7 +49,7 @@ describe("scenarios > embedding-sdk > static-dashboard", () => { }); it("should render dashboard content", () => { - cy.get("@dashboardId").then(dashboardId => { + cy.get("@dashboardId").then((dashboardId) => { mountSdkContent(); }); @@ -68,7 +68,7 @@ describe("scenarios > embedding-sdk > static-dashboard", () => { }); it("should show fullscreen mode control by default", () => { - cy.get("@dashboardId").then(dashboardId => { + cy.get("@dashboardId").then((dashboardId) => { mountSdkContent(); }); @@ -110,7 +110,7 @@ describe("scenarios > embedding-sdk > static-dashboard", () => { successTestCases.forEach(({ name, dashboardIdAlias }) => { it(`should load dashboard content for ${name}`, () => { - cy.get(dashboardIdAlias).then(dashboardId => { + cy.get(dashboardIdAlias).then((dashboardId) => { mountSdkContent(); }); diff --git a/e2e/test-component/scenarios/embedding-sdk/static-question.cy.spec.tsx b/e2e/test-component/scenarios/embedding-sdk/static-question.cy.spec.tsx index 62af07e9e7a..50c5f22ca3b 100644 --- a/e2e/test-component/scenarios/embedding-sdk/static-question.cy.spec.tsx +++ b/e2e/test-component/scenarios/embedding-sdk/static-question.cy.spec.tsx @@ -69,7 +69,7 @@ describe("scenarios > embedding-sdk > static-question", () => { successTestCases.forEach(({ name, questionIdAlias }) => { it(`should load question content for ${name}`, () => { - cy.get(questionIdAlias).then(questionId => { + cy.get(questionIdAlias).then((questionId) => { mountStaticQuestion({ questionId }); }); diff --git a/e2e/test-component/scenarios/embedding-sdk/styles-tests.cy.spec.tsx b/e2e/test-component/scenarios/embedding-sdk/styles-tests.cy.spec.tsx index 8326a986353..c55e82b8e53 100644 --- a/e2e/test-component/scenarios/embedding-sdk/styles-tests.cy.spec.tsx +++ b/e2e/test-component/scenarios/embedding-sdk/styles-tests.cy.spec.tsx @@ -140,7 +140,7 @@ describe("scenarios > embedding-sdk > styles", () => { expect(response?.statusCode).to.equal(200); }); - cy.get("@defaultBrowserFontFamily").then(defaultBrowserFontFamily => { + cy.get("@defaultBrowserFontFamily").then((defaultBrowserFontFamily) => { cy.findByText("This is outside of the provider").should( "have.css", "font-family", @@ -182,7 +182,7 @@ describe("scenarios > embedding-sdk > styles", () => { cy.wait("@getUser"); - cy.get("@defaultBrowserFontFamily").then(defaultBrowserFontFamily => { + cy.get("@defaultBrowserFontFamily").then((defaultBrowserFontFamily) => { cy.findByText("This is outside of the provider").should( "have.css", "font-family", @@ -372,7 +372,7 @@ describe("scenarios > embedding-sdk > styles", () => { { tag: "textarea", jsx: }, ]; - it(`no css rule should match ${elements.map(e => e.tag).join(", ")} outside of the provider`, () => { + it(`no css rule should match ${elements.map((e) => e.tag).join(", ")} outside of the provider`, () => { cy.mount(
{elements.map(({ jsx }) => jsx)} @@ -393,7 +393,7 @@ describe("scenarios > embedding-sdk > styles", () => { }); const expectElementToHaveNoAppliedCssRules = (selector: string) => { - cy.get(selector).then($el => { + cy.get(selector).then(($el) => { const rules = getCssRulesThatApplyToElement($el); if (rules.length > 0) { console.warn("rules matching", selector, rules); @@ -406,12 +406,12 @@ const getCssRulesThatApplyToElement = ($element: JQuery) => { const element = $element[0]; const rulesThatMatch: CSSStyleRule[] = Array.from( document.styleSheets, - ).flatMap(sheet => { + ).flatMap((sheet) => { const cssRules = Array.from(sheet.cssRules).filter( - rule => rule instanceof CSSStyleRule, + (rule) => rule instanceof CSSStyleRule, ) as CSSStyleRule[]; - return cssRules.filter(rule => element.matches(rule.selectorText)); + return cssRules.filter((rule) => element.matches(rule.selectorText)); }); return rulesThatMatch; @@ -420,7 +420,7 @@ const getCssRulesThatApplyToElement = ($element: JQuery) => { function wrapBrowserDefaultFont() { cy.mount(

paragraph with default browser font

); - cy.findByText("paragraph with default browser font").then($element => { + cy.findByText("paragraph with default browser font").then(($element) => { const fontFamily = $element.css("font-family"); cy.wrap(fontFamily).as("defaultBrowserFontFamily"); }); diff --git a/e2e/test-component/scenarios/embedding-sdk/tooltip-reproductions.cy.spec.tsx b/e2e/test-component/scenarios/embedding-sdk/tooltip-reproductions.cy.spec.tsx index ec9354e0fb7..ee0d946b0f4 100644 --- a/e2e/test-component/scenarios/embedding-sdk/tooltip-reproductions.cy.spec.tsx +++ b/e2e/test-component/scenarios/embedding-sdk/tooltip-reproductions.cy.spec.tsx @@ -38,7 +38,7 @@ describe("scenarios > embedding-sdk > tooltip-reproductions", () => { ], }), ) - .then(dashboard => { + .then((dashboard) => { cy.wrap(dashboard.body.id).as("dashboardId"); }); @@ -60,8 +60,8 @@ describe("scenarios > embedding-sdk > tooltip-reproductions", () => { { input: undefined, expected: 201 }, ]; - testCases.forEach(zIndexTestCase => { - cy.get("@dashboardId").then(dashboardId => { + testCases.forEach((zIndexTestCase) => { + cy.get("@dashboardId").then((dashboardId) => { mountSdkContent(, { sdkProviderProps: { theme: { @@ -78,7 +78,7 @@ describe("scenarios > embedding-sdk > tooltip-reproductions", () => { cy.findAllByTestId("echarts-tooltip") .eq(0) .should("exist") - .then($tooltip => { + .then(($tooltip) => { const tooltipElement = $tooltip[0]; // a fixed-position tooltip should be visible diff --git a/e2e/test/scenarios/actions/actions-in-object-detail-view.cy.spec.js b/e2e/test/scenarios/actions/actions-in-object-detail-view.cy.spec.js index 544068f4022..82a9c67c197 100644 --- a/e2e/test/scenarios/actions/actions-in-object-detail-view.cy.spec.js +++ b/e2e/test/scenarios/actions/actions-in-object-detail-view.cy.spec.js @@ -54,7 +54,7 @@ describe( describe("in dashboard", () => { beforeEach(() => { asAdmin(() => { - cy.get("@modelId").then(modelId => { + cy.get("@modelId").then((modelId) => { H.createImplicitActions({ modelId }); H.createQuestionAndDashboard({ @@ -103,7 +103,7 @@ describe( permissionLevels.forEach(({ name, permissionFn }) => { it(`should be able to run update and delete actions when enabled for a ${name} user`, () => { - cy.get("@modelId").then(modelId => { + cy.get("@modelId").then((modelId) => { permissionFn(() => { cy.log( `As ${name} user: verify there are no model actions to run`, @@ -130,7 +130,7 @@ describe( cy.log(`As ${name} user: verify update form gets prefilled`); openUpdateObjectModal(); actionExecuteModal().within(() => { - cy.wait("@prefetchValues").then(request => { + cy.wait("@prefetchValues").then((request) => { const firstScoreRow = request.response.body; actionForm().within(() => { @@ -155,7 +155,7 @@ describe( ); openUpdateObjectModal(); actionExecuteModal().within(() => { - cy.wait("@prefetchValues").then(request => { + cy.wait("@prefetchValues").then((request) => { const secondScoreRow = request.response.body; actionForm().within(() => { @@ -191,7 +191,7 @@ describe( cy.signInAsAdmin(); - cy.get("@modelId").then(modelId => { + cy.get("@modelId").then((modelId) => { H.createImplicitActions({ modelId }); visitObjectDetail(modelId, FIRST_SCORE_ROW_ID); openUpdateObjectModal(); diff --git a/e2e/test/scenarios/actions/actions-on-dashboards.cy.spec.js b/e2e/test/scenarios/actions/actions-on-dashboards.cy.spec.js index b81b53dcc9d..e6dfc9387a2 100644 --- a/e2e/test/scenarios/actions/actions-on-dashboards.cy.spec.js +++ b/e2e/test/scenarios/actions/actions-on-dashboards.cy.spec.js @@ -11,7 +11,7 @@ const TEST_TABLE = "scoreboard_actions"; const TEST_COLUMNS_TABLE = "many_data_types"; const MODEL_NAME = "Test Action Model"; -["mysql", "postgres"].forEach(dialect => { +["mysql", "postgres"].forEach((dialect) => { describe( `Write Actions on Dashboards (${dialect})`, { tags: ["@external", "@actions"] }, @@ -51,7 +51,7 @@ const MODEL_NAME = "Test Action Model"; }); it("action creation modal can be closed on click outside (WRK-67)", () => { - cy.get("@modelId").then(id => { + cy.get("@modelId").then((id) => { cy.visit(`/model/${id}/detail`); cy.wait(["@getModel", "@getModelActions"]); }); @@ -79,12 +79,12 @@ const MODEL_NAME = "Test Action Model"; H.queryWritableDB( `SELECT * FROM ${TEST_TABLE} WHERE id = 1`, dialect, - ).then(result => { + ).then((result) => { expect(result.rows.length).to.equal(1); expect(result.rows[0].score).to.equal(0); }); - cy.get("@modelId").then(id => { + cy.get("@modelId").then((id) => { cy.visit(`/model/${id}/detail`); cy.wait(["@getModel", "@getModelActions"]); }); @@ -103,7 +103,7 @@ const MODEL_NAME = "Test Action Model"; reorderFields(); cy.findByRole("dialog").within(() => { - cy.findAllByText("Number").each(el => { + cy.findAllByText("Number").each((el) => { cy.wrap(el).click(); }); cy.findByText("Save").click(); @@ -136,14 +136,14 @@ const MODEL_NAME = "Test Action Model"; H.queryWritableDB( `SELECT * FROM ${TEST_TABLE} WHERE id = 1`, dialect, - ).then(result => { + ).then((result) => { expect(result.rows.length).to.equal(1); expect(result.rows[0].score).to.equal(55); }); }); it("adds an implicit create action to a dashboard and runs it", () => { - cy.get("@modelId").then(id => { + cy.get("@modelId").then((id) => { H.createImplicitAction({ kind: "create", model_id: id, @@ -172,7 +172,7 @@ const MODEL_NAME = "Test Action Model"; H.queryWritableDB( `SELECT * FROM ${TEST_TABLE} WHERE team_name = 'Zany Zebras'`, dialect, - ).then(result => { + ).then((result) => { expect(result.rows.length).to.equal(1); expect(result.rows[0].score).to.equal(44); @@ -182,7 +182,7 @@ const MODEL_NAME = "Test Action Model"; it("adds an implicit update action to a dashboard and runs it", () => { const actionName = "Update"; - cy.get("@modelId").then(id => { + cy.get("@modelId").then((id) => { H.createImplicitAction({ kind: "update", model_id: id, @@ -224,7 +224,7 @@ const MODEL_NAME = "Test Action Model"; H.queryWritableDB( `SELECT * FROM ${TEST_TABLE} WHERE team_name = 'Emotional Elephants'`, dialect, - ).then(result => { + ).then((result) => { expect(result.rows.length).to.equal(1); expect(result.rows[0].score).to.equal(88); @@ -235,12 +235,12 @@ const MODEL_NAME = "Test Action Model"; H.queryWritableDB( `SELECT * FROM ${TEST_TABLE} WHERE team_name = 'Cuddly Cats'`, dialect, - ).then(result => { + ).then((result) => { expect(result.rows.length).to.equal(1); expect(result.rows[0].id).to.equal(3); }); - cy.get("@modelId").then(id => { + cy.get("@modelId").then((id) => { H.createImplicitAction({ kind: "delete", model_id: id, @@ -267,7 +267,7 @@ const MODEL_NAME = "Test Action Model"; H.queryWritableDB( `SELECT * FROM ${TEST_TABLE} WHERE team_name = 'Cuddly Cats'`, dialect, - ).then(result => { + ).then((result) => { expect(result.rows.length).to.equal(0); }); }); @@ -277,7 +277,7 @@ const MODEL_NAME = "Test Action Model"; name: "Public Dashboard", }; cy.get("@modelId") - .then(id => { + .then((id) => { H.createImplicitAction({ kind: "create", model_id: id, @@ -306,7 +306,7 @@ const MODEL_NAME = "Test Action Model"; cy.log("Visit public dashboard"); cy.get("@dashboardId") - .then(dashboardId => { + .then((dashboardId) => { H.createPublicDashboardLink(dashboardId); }) .then(({ body: { uuid } }) => { @@ -333,7 +333,7 @@ const MODEL_NAME = "Test Action Model"; enable_embedding: true, }; cy.get("@modelId") - .then(id => { + .then((id) => { H.createImplicitAction({ kind: "create", model_id: id, @@ -381,7 +381,7 @@ const MODEL_NAME = "Test Action Model"; describe("hidden fields", () => { it("adds an implicit action and runs it", () => { - cy.get("@modelId").then(id => { + cy.get("@modelId").then((id) => { H.createImplicitAction({ kind: "create", model_id: id, @@ -408,7 +408,7 @@ const MODEL_NAME = "Test Action Model"; H.queryWritableDB( `SELECT * FROM ${TEST_TABLE} WHERE team_name = 'Zany Zebras'`, dialect, - ).then(result => { + ).then((result) => { expect(result.rows.length).to.equal(1); expect(result.rows[0].score).to.equal(44); @@ -421,12 +421,12 @@ const MODEL_NAME = "Test Action Model"; H.queryWritableDB( `SELECT * FROM ${TEST_TABLE} WHERE id = 1`, dialect, - ).then(result => { + ).then((result) => { expect(result.rows.length).to.equal(1); expect(result.rows[0].score).to.equal(0); }); - cy.get("@modelId").then(id => { + cy.get("@modelId").then((id) => { cy.visit(`/model/${id}/detail`); cy.wait(["@getModel", "@getModelActions"]); }); @@ -444,7 +444,7 @@ const MODEL_NAME = "Test Action Model"; reorderFields(); cy.findByRole("dialog").within(() => { - cy.findAllByText("Number").each(el => { + cy.findAllByText("Number").each((el) => { cy.wrap(el).click(); }); @@ -490,12 +490,12 @@ const MODEL_NAME = "Test Action Model"; H.queryWritableDB( `SELECT * FROM ${TEST_TABLE} WHERE id = 1`, dialect, - ).then(result => { + ).then((result) => { expect(result.rows.length).to.equal(1); expect(result.rows[0].score).to.equal(55); }); - cy.get("@modelId").then(id => { + cy.get("@modelId").then((id) => { cy.visit(`/model/${id}/detail`); cy.wait(["@getModel", "@getModelActions"]); }); @@ -541,7 +541,7 @@ const MODEL_NAME = "Test Action Model"; H.queryWritableDB( `SELECT * FROM ${TEST_TABLE} WHERE id = 1`, dialect, - ).then(result => { + ).then((result) => { expect(result.rows.length).to.equal(1); expect(result.rows[0].score).to.equal(56); }); @@ -565,7 +565,7 @@ const MODEL_NAME = "Test Action Model"; }); it("can update various data types via implicit actions", () => { - cy.get("@modelId").then(id => { + cy.get("@modelId").then((id) => { H.createImplicitAction({ kind: "update", model_id: id, @@ -644,7 +644,7 @@ const MODEL_NAME = "Test Action Model"; H.queryWritableDB( `SELECT * FROM ${TEST_COLUMNS_TABLE} WHERE id = 1`, dialect, - ).then(result => { + ).then((result) => { expect(result.rows.length).to.equal(1); const row = result.rows[0]; @@ -666,7 +666,7 @@ const MODEL_NAME = "Test Action Model"; }); it("can insert various data types via implicit actions", () => { - cy.get("@modelId").then(id => { + cy.get("@modelId").then((id) => { H.createImplicitAction({ kind: "create", model_id: id, @@ -715,7 +715,7 @@ const MODEL_NAME = "Test Action Model"; H.queryWritableDB( `SELECT * FROM ${TEST_COLUMNS_TABLE} WHERE string = 'Zany Zebras'`, dialect, - ).then(result => { + ).then((result) => { expect(result.rows.length).to.equal(1); const row = result.rows[0]; @@ -751,7 +751,7 @@ const MODEL_NAME = "Test Action Model"; }); it("does not show json, enum, or binary columns for implicit actions", () => { - cy.get("@modelId").then(id => { + cy.get("@modelId").then((id) => { H.createImplicitAction({ kind: "create", model_id: id, @@ -775,7 +775,7 @@ const MODEL_NAME = "Test Action Model"; }); it("properly loads and updates date and time fields for implicit update actions", () => { - cy.get("@modelId").then(id => { + cy.get("@modelId").then((id) => { H.createImplicitAction({ kind: "update", model_id: id, @@ -853,7 +853,7 @@ const MODEL_NAME = "Test Action Model"; H.queryWritableDB( `SELECT * FROM ${TEST_COLUMNS_TABLE} WHERE id = 1`, dialect, - ).then(result => { + ).then((result) => { const row = result.rows[0]; // the driver adds a time to this date so we have to use .include @@ -937,7 +937,7 @@ const MODEL_NAME = "Test Action Model"; modelName: MODEL_NAME, }); - cy.get("@modelId").then(modelId => { + cy.get("@modelId").then((modelId) => { H.createAction({ ...SAMPLE_WRITABLE_QUERY_ACTION, model_id: modelId, @@ -1026,7 +1026,7 @@ const MODEL_NAME = "Test Action Model"; cy.button(SAMPLE_QUERY_ACTION.name).click(); }); - cy.wait("@executeAction").then(interception => { + cy.wait("@executeAction").then((interception) => { expect( Object.values(interception.request.body.parameters) .sort() @@ -1069,7 +1069,7 @@ describe("action error handling", { tags: ["@external", "@actions"] }, () => { it("should show detailed form errors for constraint violations when executing model actions", () => { const actionName = "Update"; - cy.get("@modelId").then(modelId => { + cy.get("@modelId").then((modelId) => { H.createImplicitAction({ kind: "update", model_id: modelId }); }); @@ -1132,7 +1132,7 @@ describe( it("refetches form values when id changes (metabase#33084)", () => { const actionName = "Update"; - cy.get("@modelId").then(id => { + cy.get("@modelId").then((id) => { H.createImplicitAction({ kind: "update", model_id: id, @@ -1183,7 +1183,7 @@ describe( it("should reflect to updated action on mapping form", () => { const ACTION_NAME = "Update Score"; - cy.get("@modelId").then(id => { + cy.get("@modelId").then((id) => { cy.visit(`/model/${id}/detail`); cy.wait(["@getModel", "@getModelActions"]); }); @@ -1359,7 +1359,7 @@ function reorderFields() { H.dragField(1, 0); } -const clickHelper = buttonName => { +const clickHelper = (buttonName) => { // this is dirty, but it seems to be the only reliable solution to detached elements before cypress v12 // https://github.com/cypress-io/cypress/issues/7306 cy.wait(100); @@ -1378,7 +1378,7 @@ function waitForValidActions() { cy.wait("@getActions").then(({ response }) => { const { body: actions } = response; - actions.forEach(action => { + actions.forEach((action) => { expect(action.parameters).to.have.length.gt(0); }); }); diff --git a/e2e/test/scenarios/actions/actions-reproductions.cy.spec.js b/e2e/test/scenarios/actions/actions-reproductions.cy.spec.js index fddbaf0f3a3..f13105569de 100644 --- a/e2e/test/scenarios/actions/actions-reproductions.cy.spec.js +++ b/e2e/test/scenarios/actions/actions-reproductions.cy.spec.js @@ -43,8 +43,8 @@ describe("metabase#31587", () => { .last() .should("have.text", "Click Me"); - actionButtonContainer.then(actionButtonElem => { - dashCard.then(dashCardElem => { + actionButtonContainer.then((actionButtonElem) => { + dashCard.then((dashCardElem) => { expect(actionButtonElem[0].scrollHeight).to.eq( dashCardElem[0].scrollHeight, ); @@ -71,8 +71,8 @@ describe("metabase#31587", () => { .last() .should("have.text", "Click Me"); - actionButtonContainer.then(actionButtonElem => { - dashCard.then(dashCardElem => { + actionButtonContainer.then((actionButtonElem) => { + dashCard.then((dashCardElem) => { expect(actionButtonElem[0].scrollHeight).to.eq( dashCardElem[0].scrollHeight, ); @@ -202,7 +202,7 @@ describe("Issue 32974", { tags: ["@external", "@actions"] }, () => { }); it("can submit query action linked with dashboard parameters (metabase#32974)", () => { - cy.get("@modelId").then(modelId => { + cy.get("@modelId").then((modelId) => { H.createAction({ ...QUERY_ACTION, model_id: modelId }).then( ({ body: { id: actionId } }) => { cy.wrap(actionId).as("actionId"); @@ -421,7 +421,7 @@ describe("issue 32840", () => { }, ); - cy.get("@modelId").then(modelId => { + cy.get("@modelId").then((modelId) => { H.createAction({ type: "implicit", kind: "row/update", diff --git a/e2e/test/scenarios/actions/model-actions.cy.spec.js b/e2e/test/scenarios/actions/model-actions.cy.spec.js index c242b996558..2b0e3f91b0f 100644 --- a/e2e/test/scenarios/actions/model-actions.cy.spec.js +++ b/e2e/test/scenarios/actions/model-actions.cy.spec.js @@ -89,7 +89,7 @@ describe( }); it("should allow CRUD operations on model actions", () => { - cy.get("@modelId").then(id => { + cy.get("@modelId").then((id) => { cy.visit(`/model/${id}/detail`); cy.wait("@getModel"); }); @@ -180,7 +180,7 @@ describe( cy.findByRole("button", { name: "Create" }).click(); - cy.get("@modelId").then(modelId => { + cy.get("@modelId").then((modelId) => { cy.url().should("include", `/model/${modelId}/detail/actions`); }); }); @@ -206,7 +206,7 @@ describe( }, }); - cy.get("@modelId").then(modelId => { + cy.get("@modelId").then((modelId) => { cy.request("POST", "/api/action", { ...SAMPLE_QUERY_ACTION, model_id: modelId, @@ -285,7 +285,7 @@ describe( it("should show detailed form errors for constraint violations when executing model actions", () => { const actionName = "Update"; - cy.get("@modelId").then(modelId => { + cy.get("@modelId").then((modelId) => { H.createImplicitActions({ modelId }); cy.visit(`/model/${modelId}/detail`); @@ -311,7 +311,7 @@ describe( }, ); -["postgres", "mysql"].forEach(dialect => { +["postgres", "mysql"].forEach((dialect) => { describe( `Write actions on model detail page (${dialect})`, { tags: "@external" }, @@ -347,12 +347,12 @@ describe( H.queryWritableDB( `SELECT * FROM ${WRITABLE_TEST_TABLE} WHERE id = 1`, dialect, - ).then(result => { + ).then((result) => { const row = result.rows[0]; expect(row.score).to.equal(0); }); - cy.get("@writableModelId").then(modelId => { + cy.get("@writableModelId").then((modelId) => { H.createAction({ ...SAMPLE_WRITABLE_QUERY_ACTION, model_id: modelId, @@ -375,7 +375,7 @@ describe( H.queryWritableDB( `SELECT * FROM ${WRITABLE_TEST_TABLE} WHERE id = 1`, dialect, - ).then(result => { + ).then((result) => { const row = result.rows[0]; expect(row.score).to.equal(22); @@ -385,7 +385,7 @@ describe( it("should allow public sharing of actions and execution of public actions", () => { const IMPLICIT_ACTION_NAME = "Update"; - cy.get("@writableModelId").then(modelId => { + cy.get("@writableModelId").then((modelId) => { H.createAction({ ...SAMPLE_WRITABLE_QUERY_ACTION, model_id: modelId, @@ -409,7 +409,7 @@ describe( cy.signOut(); - cy.get("@queryActionPublicUrl").then(url => { + cy.get("@queryActionPublicUrl").then((url) => { cy.visit(url); cy.findByLabelText(TEST_PARAMETER.name).type("1"); cy.button(SAMPLE_QUERY_ACTION.name).click(); @@ -422,14 +422,14 @@ describe( H.queryWritableDB( `SELECT * FROM ${WRITABLE_TEST_TABLE} WHERE id = 1`, dialect, - ).then(result => { + ).then((result) => { const row = result.rows[0]; expect(row.score).to.equal(22); }); }); - cy.get("@implicitActionPublicUrl").then(url => { + cy.get("@implicitActionPublicUrl").then((url) => { cy.visit(url); // team 2 has 10 points, let's give them more @@ -447,7 +447,7 @@ describe( H.queryWritableDB( `SELECT * FROM ${WRITABLE_TEST_TABLE} WHERE id = 2`, dialect, - ).then(result => { + ).then((result) => { const row = result.rows[0]; expect(row.score).to.equal(16); @@ -458,7 +458,7 @@ describe( }); cy.signInAsAdmin(); - cy.get("@writableModelId").then(modelId => { + cy.get("@writableModelId").then((modelId) => { cy.visit(`/model/${modelId}/detail/actions`); cy.wait("@getModel"); }); @@ -468,14 +468,14 @@ describe( cy.signOut(); - cy.get("@queryActionPublicUrl").then(url => { + cy.get("@queryActionPublicUrl").then((url) => { cy.visit(url); cy.findByRole("form").should("not.exist"); cy.button(SAMPLE_QUERY_ACTION.name).should("not.exist"); cy.findByText("Not found").should("be.visible"); }); - cy.get("@implicitActionPublicUrl").then(url => { + cy.get("@implicitActionPublicUrl").then((url) => { cy.visit(url); cy.findByRole("form").should("not.exist"); cy.button(SAMPLE_QUERY_ACTION.name).should("not.exist"); @@ -486,7 +486,7 @@ describe( it("should allow query action execution from the model details page", () => { verifyScoreValue(0, dialect); - cy.get("@writableModelId").then(modelId => { + cy.get("@writableModelId").then((modelId) => { H.createAction({ ...SAMPLE_WRITABLE_QUERY_ACTION, model_id: modelId, @@ -580,7 +580,7 @@ describe( }); it("should allow implicit action execution from the model details page", () => { - cy.get("@writableModelId").then(id => { + cy.get("@writableModelId").then((id) => { cy.visit(`/model/${id}/detail`); cy.wait("@getModel"); }); @@ -622,7 +622,7 @@ describe( H.queryWritableDB( `SELECT * FROM ${WRITABLE_TEST_TABLE} WHERE team_name = 'Zebras'`, dialect, - ).then(result => { + ).then((result) => { expect(result.rows.length).to.equal(1); const row = result.rows[0]; @@ -632,7 +632,7 @@ describe( }); it("should allow public sharing of query action and execution", () => { - cy.get("@writableModelId").then(modelId => { + cy.get("@writableModelId").then((modelId) => { H.createAction({ ...SAMPLE_WRITABLE_QUERY_ACTION, model_id: modelId, @@ -667,7 +667,7 @@ describe( cy.signOut(); - cy.get("@queryActionPublicUrl").then(url => { + cy.get("@queryActionPublicUrl").then((url) => { cy.visit(url); cy.findByLabelText(TEST_PARAMETER.name).type("1"); cy.findByLabelText("New Status").should("not.exist"); @@ -681,7 +681,7 @@ describe( H.queryWritableDB( `SELECT * FROM ${WRITABLE_TEST_TABLE} WHERE id = 1`, dialect, - ).then(result => { + ).then((result) => { const row = result.rows[0]; expect(row.score).to.equal(22); @@ -690,7 +690,7 @@ describe( }); it("should allow public sharing of implicit action and execution", () => { - cy.get("@writableModelId").then(id => { + cy.get("@writableModelId").then((id) => { cy.visit(`/model/${id}/detail`); cy.wait("@getModel"); }); @@ -714,7 +714,7 @@ describe( cy.signOut(); - cy.get("@updatePublicURL").then(url => { + cy.get("@updatePublicURL").then((url) => { cy.visit(url); // team 2 has 10 points, let's give them more @@ -730,7 +730,7 @@ describe( H.queryWritableDB( `SELECT * FROM ${WRITABLE_TEST_TABLE} WHERE id = 2`, dialect, - ).then(result => { + ).then((result) => { const row = result.rows[0]; expect(row.score).to.equal(16); @@ -782,12 +782,12 @@ describe( FROM ${WRITABLE_TEST_TABLE} WHERE id = 1`, dialect, - ).then(result => { + ).then((result) => { const row = result.rows[0]; expect(row.score).to.equal(0); }); - cy.get("@writableModelId").then(modelId => { + cy.get("@writableModelId").then((modelId) => { H.createAction({ ...SAMPLE_WRITABLE_QUERY_ACTION, model_id: modelId, @@ -813,7 +813,7 @@ describe( FROM ${WRITABLE_TEST_TABLE} WHERE id = 1`, dialect, - ).then(result => { + ).then((result) => { const row = result.rows[0]; expect(row.score).to.equal(0); }); @@ -858,7 +858,7 @@ function enableSharingFor(actionName, { publicUrlAlias }) { cy.wait("@enableActionSharing"); cy.findByLabelText("Public action form URL") .invoke("val") - .then(url => { + .then((url) => { cy.wrap(url).as(publicUrlAlias); }); cy.button("Cancel").click(); @@ -898,7 +898,7 @@ function verifyScoreValue(value, dialect) { H.queryWritableDB( `SELECT * FROM ${WRITABLE_TEST_TABLE} WHERE id = 1`, dialect, - ).then(result => { + ).then((result) => { const row = result.rows[0]; expect(row.score).to.equal(value); diff --git a/e2e/test/scenarios/admin-2/authentication.cy.spec.ts b/e2e/test/scenarios/admin-2/authentication.cy.spec.ts index b269cd1d969..15abf9c5989 100644 --- a/e2e/test/scenarios/admin-2/authentication.cy.spec.ts +++ b/e2e/test/scenarios/admin-2/authentication.cy.spec.ts @@ -122,7 +122,7 @@ describe("scenarios > admin > settings > user provisioning", () => { // save to compare with masked token scimTokenInput() .invoke("val") - .then(val => (initialUnmaskedToken = String(val))); + .then((val) => (initialUnmaskedToken = String(val))); cy.findAllByRole("button", { name: /Done/ }).click(); }); @@ -138,7 +138,9 @@ describe("scenarios > admin > settings > user provisioning", () => { .invoke("val") .should("contain", "mb_") .should("contain", "****************************************") - .then(val => expect(val).to.contain(initialUnmaskedToken.slice(0, 7))); + .then((val) => + expect(val).to.contain(initialUnmaskedToken.slice(0, 7)), + ); cy.log("should be able to regenerate a token"); cy.findByRole("button", { name: /Regenerate/ }).click(); @@ -155,7 +157,7 @@ describe("scenarios > admin > settings > user provisioning", () => { .invoke("val") .should("not.contain", "Loading") .should("not.contain", "****************************************") - .then(val => (regeneratedToken = String(val))); + .then((val) => (regeneratedToken = String(val))); cy.findByRole("button", { name: /Done/ }).click(); }); @@ -163,7 +165,7 @@ describe("scenarios > admin > settings > user provisioning", () => { .invoke("val") .should("contain", "mb_") .should("contain", "****************************************") - .then(val => expect(val).to.contain(regeneratedToken.slice(0, 7))); + .then((val) => expect(val).to.contain(regeneratedToken.slice(0, 7))); cy.log("should be able to cancel regenerating a token"); cy.findByRole("button", { name: /Regenerate/ }).click(); @@ -178,7 +180,7 @@ describe("scenarios > admin > settings > user provisioning", () => { .invoke("val") .should("contain", "mb_") .should("contain", "****************************************") - .then(val => expect(val).to.contain(regeneratedToken.slice(0, 7))); + .then((val) => expect(val).to.contain(regeneratedToken.slice(0, 7))); cy.log("should be able to disable scim and info stay"); scimToggle().click(); @@ -237,7 +239,7 @@ describe("scenarios > admin > settings > user provisioning", () => { "should show error when scim token fails to generate when scim is enabled", ); // enable scim and stop mocking get scim api key request - cy.intercept("GET", "/api/ee/scim/api_key", req => { + cy.intercept("GET", "/api/ee/scim/api_key", (req) => { req.continue(); }); cy.request("PUT", "api/setting/scim-enabled", { value: true }); diff --git a/e2e/test/scenarios/admin-2/error-reporting.cy.spec.ts b/e2e/test/scenarios/admin-2/error-reporting.cy.spec.ts index d2207839c17..103d757a9d9 100644 --- a/e2e/test/scenarios/admin-2/error-reporting.cy.spec.ts +++ b/e2e/test/scenarios/admin-2/error-reporting.cy.spec.ts @@ -26,7 +26,7 @@ describe("error reporting modal", () => { cy.button(/Download/i).click(); }); - getDiagnosticInfoFile().then(fileContent => { + getDiagnosticInfoFile().then((fileContent) => { expect(fileContent.entityName).to.equal(undefined); expect(fileContent).to.have.property("frontendErrors"); expect(fileContent).to.have.property("backendErrors"); @@ -93,7 +93,7 @@ describe("error reporting modal", () => { cy.button(/Download/i).click(); }); - getDiagnosticInfoFile().then(fileContent => { + getDiagnosticInfoFile().then((fileContent) => { expect(fileContent.entityName).to.equal("question"); expect(fileContent).to.have.property("frontendErrors"); expect(fileContent).to.have.property("backendErrors"); @@ -116,7 +116,7 @@ describe("error reporting modal", () => { cy.button(/Download/i).click(); }); - getDiagnosticInfoFile().then(fileContent => { + getDiagnosticInfoFile().then((fileContent) => { expect(fileContent.entityName).to.equal("question"); expect(fileContent).to.have.property("frontendErrors"); expect(fileContent).to.have.property("backendErrors"); @@ -149,7 +149,7 @@ describe("error reporting modal", () => { cy.button(/Download/i).click(); }); - getDiagnosticInfoFile().then(fileContent => { + getDiagnosticInfoFile().then((fileContent) => { expect(fileContent.entityName).to.equal("question"); expect(fileContent).to.have.property("frontendErrors"); expect(fileContent).to.have.property("backendErrors"); @@ -177,7 +177,7 @@ describe("error reporting modal", () => { cy.button(/Download/i).click(); }); - getDiagnosticInfoFile().then(fileContent => { + getDiagnosticInfoFile().then((fileContent) => { expect(fileContent.entityName).to.equal("dashboard"); expect(fileContent.url).to.include("/dashboard/"); diff --git a/e2e/test/scenarios/admin-2/people.cy.spec.js b/e2e/test/scenarios/admin-2/people.cy.spec.js index a734751d546..bb44da740b2 100644 --- a/e2e/test/scenarios/admin-2/people.cy.spec.js +++ b/e2e/test/scenarios/admin-2/people.cy.spec.js @@ -151,7 +151,9 @@ describe("scenarios > admin > people", () => { // eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage cy.findByText(FULL_NAME); - cy.location().should(loc => expect(loc.pathname).to.eq("/admin/people")); + cy.location().should((loc) => + expect(loc.pathname).to.eq("/admin/people"), + ); }); it("should allow admin to create new users without first name or last name (metabase#22754)", () => { @@ -219,7 +221,7 @@ describe("scenarios > admin > people", () => { cy.findByText("Deactivate user").click(); clickButton("Deactivate"); cy.findByText(FULL_NAME).should("not.exist"); - cy.location().should(loc => + cy.location().should((loc) => expect(loc.pathname).to.eq("/admin/people"), ); @@ -229,7 +231,7 @@ describe("scenarios > admin > people", () => { cy.icon("refresh").click(); cy.findByText(`Reactivate ${FULL_NAME}?`); clickButton("Reactivate"); - cy.location().should(loc => + cy.location().should((loc) => expect(loc.pathname).to.eq("/admin/people"), ); }); @@ -256,7 +258,9 @@ describe("scenarios > admin > people", () => { // eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage cy.findByText(NEW_FULL_NAME); - cy.location().should(loc => expect(loc.pathname).to.eq("/admin/people")); + cy.location().should((loc) => + expect(loc.pathname).to.eq("/admin/people"), + ); }); it("should reset user password without SMTP set up", () => { @@ -272,7 +276,9 @@ describe("scenarios > admin > people", () => { // eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage cy.findByText(/^temporary password$/i); clickButton("Done"); - cy.location().should(loc => expect(loc.pathname).to.eq("/admin/people")); + cy.location().should((loc) => + expect(loc.pathname).to.eq("/admin/people"), + ); }); it("should not offer to reset passwords when password login is disabled", () => { @@ -589,7 +595,7 @@ describe("scenarios > admin > people", () => { cy.contains( `We’ve sent an invite to ${email} with instructions to log in. If this user is unable to authenticate then you can reset their password.`, ); - cy.url().then(url => { + cy.url().then((url) => { const URL_REGEX = /\/admin\/people\/(?\d+)\/success/; const { userId } = URL_REGEX.exec(url).groups; assertLinkMatchesUrl( @@ -878,7 +884,7 @@ function assertTableRowsCount(length) { } function generateUsers(count, groupIds) { - const users = _.range(count).map(index => ({ + const users = _.range(count).map((index) => ({ first_name: `FirstName ${index}`, last_name: `LastName ${index}`, email: `user_${index}@metabase.com`, @@ -886,13 +892,13 @@ function generateUsers(count, groupIds) { groupIds, })); - users.forEach(u => cy.createUserFromRawData(u)); + users.forEach((u) => cy.createUserFromRawData(u)); return users; } function generateGroups(count) { - _.range(count).map(index => { + _.range(count).map((index) => { cy.request("POST", "api/permissions/group", { name: "Group" + index }); }); } diff --git a/e2e/test/scenarios/admin-2/settings.cy.spec.js b/e2e/test/scenarios/admin-2/settings.cy.spec.js index 196ec34226e..5e7cdd4d0fb 100644 --- a/e2e/test/scenarios/admin-2/settings.cy.spec.js +++ b/e2e/test/scenarios/admin-2/settings.cy.spec.js @@ -126,7 +126,7 @@ H.describeWithSnowplow("scenarios > admin > settings", () => { it("should display an error if the https redirect check fails", () => { cy.visit("/admin/settings/general"); - cy.intercept("GET", "**/api/health", req => { + cy.intercept("GET", "**/api/health", (req) => { req.reply({ forceNetworkError: true }); }).as("httpsCheck"); // switch site url to use https @@ -238,7 +238,7 @@ H.describeWithSnowplow("scenarios > admin > settings", () => { // 1. Get the array of ALL available settings cy.request("GET", "/api/setting").then(({ body }) => { // 2. Create a stubbed version of that array by passing modified "site-url" settings - const STUBBED_BODY = body.map(setting => { + const STUBBED_BODY = body.map((setting) => { if (setting.key === "site-url") { const STUBBED_SITE_URL = Object.assign({}, setting, { is_env_setting: true, @@ -251,7 +251,7 @@ H.describeWithSnowplow("scenarios > admin > settings", () => { }); // 3. Stub the whole response - cy.intercept("GET", "/api/setting", req => { + cy.intercept("GET", "/api/setting", (req) => { req.reply({ body: STUBBED_BODY }); }).as("appSettings"); }); @@ -402,8 +402,8 @@ describe.skip( refresh(); - getCellText().then(res => { - cy.get("@tempResult").then(temp => { + getCellText().then((res) => { + cy.get("@tempResult").then((temp) => { if (res === temp) { cy.wrap(res).as("cachedResult"); } else { @@ -441,7 +441,7 @@ describe.skip( H.NativeEditor.type(nativeQuery); H.runNativeQuery(); - getCellText().then(res => { + getCellText().then((res) => { cy.wrap(res).as("tempResult"); }); @@ -451,7 +451,7 @@ describe.skip( it("should respect previously set cache duration (metabase#18458)", () => { refreshUntilCached(); - cy.get("@cachedResult").then(cachedValue => { + cy.get("@cachedResult").then((cachedValue) => { /** * 5s is longer than what we set the cache to last: * Approx 2s for an Average Runtime x multiplier of 2. @@ -462,7 +462,7 @@ describe.skip( refresh(); - getCellText().then(newValue => { + getCellText().then((newValue) => { expect(newValue).to.not.eq(cachedValue); }); }); @@ -645,7 +645,7 @@ describe("scenarios > admin > license and billing", () => { const STORE_MANAGED_FEATURE_KEY = "metabase-store-managed"; const NO_UPSELL_FEATURE_HEY = "no-upsell"; // mocks data the will be returned by enterprise useLicense hook - const mockBillingTokenFeatures = features => { + const mockBillingTokenFeatures = (features) => { return cy.intercept("GET", "/api/premium-features/token/status", { "valid-thru": "2099-12-31T12:00:00", valid: true, @@ -685,10 +685,10 @@ describe("scenarios > admin > license and billing", () => { // create an admin user who is also connected to our test harbormaster account cy.request("GET", "/api/permissions/group") .then(({ body: groups }) => { - const adminGroup = groups.find(g => g.name === "Administrators"); + const adminGroup = groups.find((g) => g.name === "Administrators"); return cy .createUserFromRawData(harborMasterConnectedAccount) - .then(user => Promise.resolve([adminGroup.id, user])); + .then((user) => Promise.resolve([adminGroup.id, user])); }) .then(([adminGroupId, user]) => { const data = { user_id: user.id, group_id: adminGroupId }; @@ -696,7 +696,7 @@ describe("scenarios > admin > license and billing", () => { .request("POST", "/api/permissions/membership", data) .then(() => Promise.resolve(user)); }) - .then(user => { + .then((user) => { cy.signOut(); // stop being normal admin user and be store connected admin user return cy.request("POST", "/api/session", { username: user.email, @@ -729,7 +729,7 @@ describe("scenarios > admin > license and billing", () => { NO_UPSELL_FEATURE_HEY, ]); // force an error - cy.intercept("GET", "/api/ee/billing", req => { + cy.intercept("GET", "/api/ee/billing", (req) => { req.reply({ statusCode: 500 }); }); cy.visit("/admin/settings/license"); @@ -1018,7 +1018,7 @@ describe("scenarios > admin > settings > map settings", () => { ); // eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage cy.findByText("Load").click(); - cy.wait("@load").then(interception => { + cy.wait("@load").then((interception) => { expect(interception.response.statusCode).to.eq(200); }); }); @@ -1067,7 +1067,7 @@ describe("scenarios > admin > settings > map settings", () => { it("should show an informative error when adding a calid URL that contains GeoJSON that does not use lat/lng coordinates", () => { //intercept call to api/geojson and return projected.geojson. Call to load file actually happens in the BE - cy.fixture("../../e2e/support/assets/projected.geojson").then(data => { + cy.fixture("../../e2e/support/assets/projected.geojson").then((data) => { cy.intercept("GET", "/api/geojson*", data); }); @@ -1098,7 +1098,7 @@ describe("notifications", { tags: "@external" }, () => { failOnStatusCode: false, url: `${H.WEBHOOK_TEST_HOST}/api/session/${H.WEBHOOK_TEST_SESSION_ID}/requests`, method: "DELETE", - }).then(response => { + }).then((response) => { cy.log("Deleted requests."); }); }); @@ -1161,13 +1161,13 @@ describe("notifications", { tags: "@external" }, () => { }, ]; - AUTH_METHODS.forEach(auth => { + AUTH_METHODS.forEach((auth) => { it(`${auth.display} Auth`, () => { cy.visit("/admin/settings/notifications"); cy.findByRole("heading", { name: "Add a webhook" }).click(); H.modal().within(() => { - COMMON_FIELDS.forEach(field => { + COMMON_FIELDS.forEach((field) => { cy.findByLabelText(field.label).type(field.value); }); @@ -1284,7 +1284,7 @@ describe("admin > settings > updates", () => { cy.visit("/admin/settings/updates"); cy.intercept("GET", "/api/session/properties", (req, res) => { - req.continue(res => { + req.continue((res) => { res.body["version-info"] = versionInfo; res.body.version.tag = currentVersion; return res.body; diff --git a/e2e/test/scenarios/admin-2/sso/ldap.cy.spec.js b/e2e/test/scenarios/admin-2/sso/ldap.cy.spec.js index 8b9bf0611e0..270f5c2960f 100644 --- a/e2e/test/scenarios/admin-2/sso/ldap.cy.spec.js +++ b/e2e/test/scenarios/admin-2/sso/ldap.cy.spec.js @@ -240,7 +240,7 @@ const getLdapCard = () => { return cy.findByText("LDAP").parent().parent(); }; -const enterLdapPort = value => { +const enterLdapPort = (value) => { H.typeAndBlurUsingLabel("LDAP Port", value); }; diff --git a/e2e/test/scenarios/admin-2/sso/saml.cy.spec.js b/e2e/test/scenarios/admin-2/sso/saml.cy.spec.js index 668b581d737..934c55c7af1 100644 --- a/e2e/test/scenarios/admin-2/sso/saml.cy.spec.js +++ b/e2e/test/scenarios/admin-2/sso/saml.cy.spec.js @@ -111,7 +111,7 @@ const getSamlCard = () => { }; const enterSamlSettings = () => { - getSamlCertificate().then(certificate => { + getSamlCertificate().then((certificate) => { H.typeAndBlurUsingLabel( /SAML Identity Provider URL/, "https://example.test", diff --git a/e2e/test/scenarios/admin-2/sso/shared/group-mappings-widget.js b/e2e/test/scenarios/admin-2/sso/shared/group-mappings-widget.js index 1e3ed422976..566ed66d1bd 100644 --- a/e2e/test/scenarios/admin-2/sso/shared/group-mappings-widget.js +++ b/e2e/test/scenarios/admin-2/sso/shared/group-mappings-widget.js @@ -61,7 +61,7 @@ export function checkGroupConsistencyAfterDeletingMappings( cy.findByText("readonly"); } -const deleteMappingWithGroups = mappingName => { +const deleteMappingWithGroups = (mappingName) => { cy.findByText(mappingName) .closest("tr") .within(() => { @@ -72,7 +72,7 @@ const deleteMappingWithGroups = mappingName => { cy.button("Remove mapping and delete groups").click(); }; -const createMapping = name => { +const createMapping = (name) => { cy.button("New mapping").click(); cy.findByLabelText("new-group-mapping-name-input").type(name); cy.button("Add").click(); @@ -85,7 +85,7 @@ const addGroupsToMapping = (mappingName, groups) => { cy.findByText("Default").click(); }); - groups.forEach(group => { + groups.forEach((group) => { popover().within(() => { cy.findByText(group).click(); @@ -100,7 +100,7 @@ const addGroupsToMapping = (mappingName, groups) => { cy.realPress("{esc}"); }; -const checkThatGroupHasNoMembers = name => { +const checkThatGroupHasNoMembers = (name) => { cy.findByText(name) .closest("tr") .within(() => cy.findByText("0")); diff --git a/e2e/test/scenarios/admin-2/sso/shared/helpers.js b/e2e/test/scenarios/admin-2/sso/shared/helpers.js index d1b88e6d46f..67b165522cd 100644 --- a/e2e/test/scenarios/admin-2/sso/shared/helpers.js +++ b/e2e/test/scenarios/admin-2/sso/shared/helpers.js @@ -18,7 +18,7 @@ export const getSamlCertificate = () => { }; export const setupSaml = () => { - getSamlCertificate().then(certificate => { + getSamlCertificate().then((certificate) => { cy.request("PUT", "/api/setting", { "saml-enabled": true, "saml-identity-provider-uri": "https://example.test", diff --git a/e2e/test/scenarios/admin-2/whitelabel.cy.spec.js b/e2e/test/scenarios/admin-2/whitelabel.cy.spec.js index fc8028b9bb3..8ab6fee7efe 100644 --- a/e2e/test/scenarios/admin-2/whitelabel.cy.spec.js +++ b/e2e/test/scenarios/admin-2/whitelabel.cy.spec.js @@ -8,7 +8,7 @@ function checkFavicon(url) { } function checkLogo() { - cy.readFile("e2e/support/assets/logo.jpeg", "base64").then(logo_data => { + cy.readFile("e2e/support/assets/logo.jpeg", "base64").then((logo_data) => { cy.get(`img[src="data:image/jpeg;base64,${logo_data}"]`).should("exist"); }); } @@ -106,7 +106,7 @@ describe("formatting > whitelabel", { tags: "@EE" }, () => { beforeEach(() => { cy.log("Add a logo"); cy.readFile("e2e/support/assets/logo.jpeg", "base64").then( - logo_data => { + (logo_data) => { H.updateSetting( "application-logo-url", `data:image/jpeg;base64,${logo_data}`, @@ -159,7 +159,7 @@ describe("formatting > whitelabel", { tags: "@EE" }, () => { ); H.undoToast().findByText("Changes saved").should("be.visible"); cy.readFile("e2e/support/assets/favicon.ico", "base64").then( - base64Url => { + (base64Url) => { const faviconUrl = `data:image/jpeg;base64,${base64Url}`; cy.wrap(faviconUrl).as("faviconUrl"); checkFavicon(faviconUrl); @@ -167,7 +167,7 @@ describe("formatting > whitelabel", { tags: "@EE" }, () => { ); cy.signInAsNormalUser(); cy.visit("/"); - cy.get("@faviconUrl").then(faviconUrl => { + cy.get("@faviconUrl").then((faviconUrl) => { cy.get('head link[rel="icon"]') .get(`[href="${faviconUrl}"]`) .should("have.length", 1); @@ -280,7 +280,7 @@ describe("formatting > whitelabel", { tags: "@EE" }, () => { H.undoToast().findByText("Changes saved").should("be.visible"); cy.readFile("e2e/support/assets/logo.jpeg", "base64").then( - logo_data => { + (logo_data) => { const backgroundImage = `url("data:image/jpeg;base64,${logo_data}")`; cy.signOut(); cy.visit("/"); @@ -347,7 +347,7 @@ describe("formatting > whitelabel", { tags: "@EE" }, () => { H.undoToast().findByText("Changes saved").should("be.visible"); cy.readFile("e2e/support/assets/logo.jpeg", "base64").then( - logo_data => { + (logo_data) => { const backgroundImage = `url("data:image/jpeg;base64,${logo_data}")`; cy.visit("/"); cy.findByTestId("landing-page-illustration").should( @@ -413,7 +413,7 @@ describe("formatting > whitelabel", { tags: "@EE" }, () => { H.visitDashboard("@dashboardId"); cy.readFile("e2e/support/assets/logo.jpeg", "base64").then( - logo_data => { + (logo_data) => { const imageDataUrl = `data:image/jpeg;base64,${logo_data}`; cy.wrap(imageDataUrl).as("imageDataUrl"); cy.findByAltText("No results").should( @@ -425,7 +425,7 @@ describe("formatting > whitelabel", { tags: "@EE" }, () => { ); H.visitQuestion("@questionId"); - cy.get("@imageDataUrl").then(imageDataUrl => { + cy.get("@imageDataUrl").then((imageDataUrl) => { cy.findByAltText("No results").should( "have.attr", "src", @@ -484,7 +484,7 @@ describe("formatting > whitelabel", { tags: "@EE" }, () => { H.modal().findByTestId("collection-picker-button").click(); H.entityPickerModal().within(() => { cy.readFile("e2e/support/assets/logo.jpeg", "base64").then( - logo_data => { + (logo_data) => { const imageDataUrl = `data:image/jpeg;base64,${logo_data}`; cy.wrap(imageDataUrl).as("imageDataUrl"); }, @@ -494,7 +494,7 @@ describe("formatting > whitelabel", { tags: "@EE" }, () => { cy.findByPlaceholderText("Search…").type( "This aren't the objects you're looking for", ); - cy.get("@imageDataUrl").then(imageDataUrl => { + cy.get("@imageDataUrl").then((imageDataUrl) => { cy.findByAltText("No results").should( "have.attr", "src", diff --git a/e2e/test/scenarios/admin/admin-reproductions.cy.spec.js b/e2e/test/scenarios/admin/admin-reproductions.cy.spec.js index 09e5233ad1f..0622c016fd7 100644 --- a/e2e/test/scenarios/admin/admin-reproductions.cy.spec.js +++ b/e2e/test/scenarios/admin/admin-reproductions.cy.spec.js @@ -66,7 +66,7 @@ describe("issue 21532", () => { cy.findByTestId("admin-layout-content"); cy.go("back"); - cy.location().should(location => { + cy.location().should((location) => { expect(location.pathname).to.eq("/"); }); }); diff --git a/e2e/test/scenarios/admin/databases.cy.spec.js b/e2e/test/scenarios/admin/databases.cy.spec.js index 3e0f5d17767..bc4057c184c 100644 --- a/e2e/test/scenarios/admin/databases.cy.spec.js +++ b/e2e/test/scenarios/admin/databases.cy.spec.js @@ -19,7 +19,7 @@ describe( "admin > database > external databases > enable actions", { tags: ["@external", "@actions"] }, () => { - ["mysql", "postgres"].forEach(dialect => { + ["mysql", "postgres"].forEach((dialect) => { it(`should show ${dialect} writable_db with actions enabled`, () => { H.restore(`${dialect}-writable`); cy.signInAsAdmin(); @@ -61,7 +61,7 @@ describe("admin > database > add", () => { function mockUploadServiceAccountJSON(fileContents) { // create blob to act as selected file cy.get("input[type=file]") - .then(async input => { + .then(async (input) => { const blob = await Cypress.Blob.binaryStringToBlob(fileContents); const file = new File([blob], "service-account.json"); const dataTransfer = new DataTransfer(); @@ -75,7 +75,7 @@ describe("admin > database > add", () => { } function mockSuccessfulDatabaseSave() { - cy.intercept("POST", "/api/database", req => { + cy.intercept("POST", "/api/database", (req) => { req.reply({ statusCode: 200, body: { id: 42 }, delay: 100 }); }).as("createDatabase"); @@ -90,7 +90,7 @@ describe("admin > database > add", () => { } cy.wait("@getDatabases").then(({ response }) => { if ( - response.body.data.some(db => db.initial_sync_status !== "complete") + response.body.data.some((db) => db.initial_sync_status !== "complete") ) { waitForDbSync(maxRetries - 1); } @@ -172,8 +172,8 @@ describe("admin > database > add", () => { }); const confirmSSLFields = (visible, hidden) => { - visible.forEach(field => cy.findByText(field)); - hidden.forEach(field => cy.findByText(field).should("not.exist")); + visible.forEach((field) => cy.findByText(field)); + hidden.forEach((field) => cy.findByText(field).should("not.exist")); }; const ssl = "Use a secure connection (SSL)", @@ -465,8 +465,8 @@ describe("scenarios > admin > databases > exceptions", () => { }); it("should handle malformed (null) database details (metabase#25715)", () => { - cy.intercept("GET", `/api/database/${SAMPLE_DB_ID}`, req => { - req.reply(res => { + cy.intercept("GET", `/api/database/${SAMPLE_DB_ID}`, (req) => { + req.reply((res) => { res.body.details = null; }); }).as("loadDatabase"); @@ -486,8 +486,8 @@ describe("scenarios > admin > databases > exceptions", () => { }); it("should handle is_attached_dwh databases", () => { - cy.intercept("GET", `/api/database/${SAMPLE_DB_ID}`, req => { - req.reply(res => { + cy.intercept("GET", `/api/database/${SAMPLE_DB_ID}`, (req) => { + req.reply((res) => { res.body.details = null; res.body.is_attached_dwh = true; }); @@ -512,7 +512,7 @@ describe("scenarios > admin > databases > exceptions", () => { }); it("should show error upon a bad request", () => { - cy.intercept("POST", "/api/database", req => { + cy.intercept("POST", "/api/database", (req) => { req.reply({ statusCode: 400, body: "DATABASE CONNECTION ERROR", @@ -558,7 +558,7 @@ describe("scenarios > admin > databases > exceptions", () => { } : null, }, - req => { + (req) => { req.reply({ statusCode: 500, body: { message: errorMessage }, diff --git a/e2e/test/scenarios/admin/datamodel/datamodel.cy.spec.js b/e2e/test/scenarios/admin/datamodel/datamodel.cy.spec.js index 2f796fd98ca..c818a477bdd 100644 --- a/e2e/test/scenarios/admin/datamodel/datamodel.cy.spec.js +++ b/e2e/test/scenarios/admin/datamodel/datamodel.cy.spec.js @@ -14,7 +14,7 @@ describe("scenarios > admin > datamodel > field > field type", () => { const ordersColumns = ["PRODUCT_ID", "QUANTITY"]; function waitAndAssertOnResponse(alias) { - cy.wait("@" + alias).then(xhr => { + cy.wait("@" + alias).then((xhr) => { expect(xhr.response.body.errors).to.not.exist; }); } @@ -51,7 +51,7 @@ describe("scenarios > admin > datamodel > field > field type", () => { H.restore(); cy.signInAsAdmin(); - ordersColumns.forEach(column => { + ordersColumns.forEach((column) => { cy.wrap( `/admin/datamodel/database/${SAMPLE_DB_ID}/schema/${SAMPLE_DB_SCHEMA_ID}/table/${ORDERS_ID}/field/${ORDERS[column]}/general`, ).as(`ORDERS_${column}_URL`); @@ -106,7 +106,7 @@ describe("scenarios > admin > datamodel > field", () => { H.restore(); cy.signInAsAdmin(); - ["CREATED_AT", "PRODUCT_ID", "QUANTITY"].forEach(name => { + ["CREATED_AT", "PRODUCT_ID", "QUANTITY"].forEach((name) => { cy.wrap( `/admin/datamodel/database/${SAMPLE_DB_ID}/schema/${SAMPLE_DB_SCHEMA_ID}/table/${ORDERS_ID}/field/${ORDERS[name]}/general`, ).as(`ORDERS_${name}_URL`); @@ -473,7 +473,7 @@ describe("scenarios > admin > datamodel > metadata", () => { cy.log("Numeric ratings should be remapped to custom strings"); H.openReviewsTable(); - Object.values(customMap).forEach(rating => { + Object.values(customMap).forEach((rating) => { cy.findAllByText(rating); }); }); @@ -755,7 +755,7 @@ describe("scenarios > admin > datamodel > segments", () => { }); it("should not crash when editing field in segment field detail page (metabase#55322)", () => { - cy.get("@segmentId").then(segmentId => { + cy.get("@segmentId").then((segmentId) => { cy.visit(`/reference/segments/${segmentId}/fields/${ORDERS.TAX}`); }); diff --git a/e2e/test/scenarios/admin/datamodel/editor.cy.spec.js b/e2e/test/scenarios/admin/datamodel/editor.cy.spec.js index 7e01641a6d8..74692fee63e 100644 --- a/e2e/test/scenarios/admin/datamodel/editor.cy.spec.js +++ b/e2e/test/scenarios/admin/datamodel/editor.cy.spec.js @@ -634,7 +634,7 @@ describe("scenarios > admin > datamodel > editor", () => { }); const setDataModelPermissions = ({ tableIds = [] }) => { - const permissions = Object.fromEntries(tableIds.map(id => [id, "all"])); + const permissions = Object.fromEntries(tableIds.map((id) => [id, "all"])); cy.updatePermissionsGraph({ [ALL_USERS_GROUP]: { @@ -676,7 +676,7 @@ const setValueAndBlurInput = (oldValue, newValue) => { cy.findByDisplayValue(oldValue).clear().type(newValue).blur(); }; -const clearAndBlurInput = oldValue => { +const clearAndBlurInput = (oldValue) => { cy.findByDisplayValue(oldValue).clear().blur(); }; @@ -684,17 +684,17 @@ const searchAndSelectValue = (newValue, searchText = newValue) => { H.popover().findByText(newValue).click(); }; -const getFieldSection = fieldName => { +const getFieldSection = (fieldName) => { return cy.findByLabelText(fieldName); }; -const setTableOrder = order => { +const setTableOrder = (order) => { cy.findByLabelText("Sort").click(); H.popover().findByText(order).click(); cy.wait("@updateTable"); }; -const assertTableHeader = columns => { +const assertTableHeader = (columns) => { cy.findAllByTestId("header-cell").should("have.length", columns.length); columns.forEach((column, index) => { diff --git a/e2e/test/scenarios/admin/datamodel/reproductions.cy.spec.ts b/e2e/test/scenarios/admin/datamodel/reproductions.cy.spec.ts index 42af3207e44..ab554ff2412 100644 --- a/e2e/test/scenarios/admin/datamodel/reproductions.cy.spec.ts +++ b/e2e/test/scenarios/admin/datamodel/reproductions.cy.spec.ts @@ -234,7 +234,7 @@ describe("issue 53595", () => { .type("cu"); H.popover().findByText("Currency").should("be.visible"); - H.popover().then($popover => { + H.popover().then(($popover) => { expect(H.isScrollableVertically($popover[0])).to.be.false; }); }); diff --git a/e2e/test/scenarios/admin/performance/clock.cy.spec.ts b/e2e/test/scenarios/admin/performance/clock.cy.spec.ts index 4912ece2c30..7de069990c8 100644 --- a/e2e/test/scenarios/admin/performance/clock.cy.spec.ts +++ b/e2e/test/scenarios/admin/performance/clock.cy.spec.ts @@ -20,7 +20,7 @@ describe("server clock", () => { }); it("can advance the server clock by one day", () => { - cy.request("GET", "/api/setting/report-timezone-long").then(response => { + cy.request("GET", "/api/setting/report-timezone-long").then((response) => { cy.wrap(response.body).as("serverTimeZone"); }); diff --git a/e2e/test/scenarios/admin/performance/helpers/e2e-performance-helpers.ts b/e2e/test/scenarios/admin/performance/helpers/e2e-performance-helpers.ts index f48dbd39424..5a3c553d5a2 100644 --- a/e2e/test/scenarios/admin/performance/helpers/e2e-performance-helpers.ts +++ b/e2e/test/scenarios/admin/performance/helpers/e2e-performance-helpers.ts @@ -140,7 +140,7 @@ export const freezeServerTime = ({ "add-ms": addMilliseconds, time, }) - .then(response => { + .then((response) => { if (wrapServerTimeAs) { cy.wrap(response.body.time).as(wrapServerTimeAs); } diff --git a/e2e/test/scenarios/admin/performance/preemptiveCaching.cy.spec.ts b/e2e/test/scenarios/admin/performance/preemptiveCaching.cy.spec.ts index 3a81275ac52..aa880d6307b 100644 --- a/e2e/test/scenarios/admin/performance/preemptiveCaching.cy.spec.ts +++ b/e2e/test/scenarios/admin/performance/preemptiveCaching.cy.spec.ts @@ -89,7 +89,7 @@ describe( getTableId({ databaseId: WRITABLE_DB_ID, name: WRITABLE_TEST_TABLE, - }).then(tableId => { + }).then((tableId) => { createQuestion( { name: "Cached question", diff --git a/e2e/test/scenarios/admin/performance/schedule.cy.spec.ts b/e2e/test/scenarios/admin/performance/schedule.cy.spec.ts index c41c0abbb72..d2a67415b15 100644 --- a/e2e/test/scenarios/admin/performance/schedule.cy.spec.ts +++ b/e2e/test/scenarios/admin/performance/schedule.cy.spec.ts @@ -80,7 +80,7 @@ describe("scenarios > admin > performance > schedule strategy", () => { ]; - (["root", "database"] as CacheableModel[]).forEach(model => { + (["root", "database"] as CacheableModel[]).forEach((model) => { schedules.forEach(([schedule, cronExpression]) => { it(`can set on ${model}: ${ Object.values(schedule).join(" ") || "default values" @@ -105,7 +105,7 @@ describe("scenarios > admin > performance > schedule strategy", () => { }); } }); - saveCacheStrategyForm().then(xhr => { + saveCacheStrategyForm().then((xhr) => { const { body } = xhr.request; expect(body.model).to.eq(model); expect(body.strategy.schedule).to.eq(cronExpression); @@ -147,10 +147,10 @@ describe("scenarios > admin > performance > schedule strategy", () => { cacheStrategyForm() .findByLabelText("Describe how often the cache should be invalidated") .find("[aria-label]") - .then($labels => { + .then(($labels) => { const labels = $labels .get() - .map($el => $el.getAttribute("aria-label")); + .map(($el) => $el.getAttribute("aria-label")); expect(labels).to.deep.equal(expectedFieldLabels); }); }); diff --git a/e2e/test/scenarios/admin/performance/strategyForm.cy.spec.ts b/e2e/test/scenarios/admin/performance/strategyForm.cy.spec.ts index 83f15de3456..bca78ef2bd5 100644 --- a/e2e/test/scenarios/admin/performance/strategyForm.cy.spec.ts +++ b/e2e/test/scenarios/admin/performance/strategyForm.cy.spec.ts @@ -192,7 +192,7 @@ describe("scenarios > admin > performance > strategy form", () => { } }; - ["default policy", "Sample Database"].forEach(itemName => { + ["default policy", "Sample Database"].forEach((itemName) => { const model = itemName === "default policy" ? "root" : "database"; const expectedNumberOfOptions = itemName === "default policy" ? 4 : 5; @@ -298,8 +298,8 @@ describe("scenarios > admin > performance > strategy form", () => { }); it(`can save a new daily schedule policy - for ${itemName}`, () => { - [12, 1, 11].forEach(time => { - ["AM", "PM"].forEach(amPm => { + [12, 1, 11].forEach((time) => { + ["AM", "PM"].forEach((amPm) => { cy.log(`Test daily at ${time} ${amPm}`); selectScheduleType("daily"); cy.findAllByRole("textbox").eq(1).click(); @@ -336,10 +336,10 @@ describe("scenarios > admin > performance > strategy form", () => { cy.findByLabelText(amPm).next().click(); saveCacheStrategyForm({ strategyType: "schedule", model }); formLauncher(itemName, "currently", "Scheduled: weekly"); - cy.findAllByRole("textbox").then(searchBoxes => { + cy.findAllByRole("textbox").then((searchBoxes) => { const values = Cypress._.map( searchBoxes, - box => (box as HTMLInputElement).value, + (box) => (box as HTMLInputElement).value, ); expect(values).to.deep.equal(["weekly", day, hour]); }); diff --git a/e2e/test/scenarios/admin/query-validator.cy.spec.js b/e2e/test/scenarios/admin/query-validator.cy.spec.js index 022877cba13..823a1e7ffc3 100644 --- a/e2e/test/scenarios/admin/query-validator.cy.spec.js +++ b/e2e/test/scenarios/admin/query-validator.cy.spec.js @@ -93,13 +93,13 @@ describe("query validator", { tags: "@external" }, () => { cy.request(`/api/database/${WRITABLE_DB_ID}/schema/public`).then( ({ body: tables }) => { const scoreboardTable = tables.find( - table => table.name === SCOREBOARD_TABLE, + (table) => table.name === SCOREBOARD_TABLE, ); cy.request(`/api/table/${scoreboardTable.id}/query_metadata`).then( ({ body: { fields } }) => { const teamNameField = fields.find( - field => field.name === "team_name", + (field) => field.name === "team_name", ); H.createQuestion({ @@ -118,12 +118,14 @@ describe("query validator", { tags: "@external" }, () => { cy.request(`/api/database/${WRITABLE_DB_ID}/schema/public`).then( ({ body: tables }) => { - const colorsTable = tables.find(table => table.name === COLORS_TABLE); + const colorsTable = tables.find( + (table) => table.name === COLORS_TABLE, + ); cy.request(`/api/table/${colorsTable.id}/query_metadata`).then( ({ body: { fields } }) => { const colorNameField = fields.find( - field => field.name === "name", + (field) => field.name === "name", ); H.createQuestion({ diff --git a/e2e/test/scenarios/admin/troubleshooting.cy.spec.js b/e2e/test/scenarios/admin/troubleshooting.cy.spec.js index f6035f42b08..9c0dcbd91e6 100644 --- a/e2e/test/scenarios/admin/troubleshooting.cy.spec.js +++ b/e2e/test/scenarios/admin/troubleshooting.cy.spec.js @@ -83,8 +83,8 @@ describe("scenarios > admin > troubleshooting > tasks", () => { function stubPageResponses({ page, alias }) { const offset = page * limit; - cy.intercept("GET", `/api/task?limit=${limit}&offset=${offset}`, req => { - req.reply(res => { + cy.intercept("GET", `/api/task?limit=${limit}&offset=${offset}`, (req) => { + req.reply((res) => { res.body = { data: stubPageRows(page), limit, diff --git a/e2e/test/scenarios/binning/binning-options.cy.spec.js b/e2e/test/scenarios/binning/binning-options.cy.spec.js index 236d504d63d..0313078eeb7 100644 --- a/e2e/test/scenarios/binning/binning-options.cy.spec.js +++ b/e2e/test/scenarios/binning/binning-options.cy.spec.js @@ -319,8 +319,8 @@ function getTitle(title) { } function getAllOptions({ options, isSelected, shouldExpandList } = {}) { - const selectedOption = options.find(option => option === isSelected); - const regularOptions = options.filter(option => option !== isSelected); + const selectedOption = options.find((option) => option === isSelected); + const regularOptions = options.filter((option) => option !== isSelected); // Custom question has two popovers open. // The binning options are in the latest (last) one. @@ -333,7 +333,7 @@ function getAllOptions({ options, isSelected, shouldExpandList } = {}) { cy.findByText("More…").click(); } - regularOptions.forEach(option => { + regularOptions.forEach((option) => { // Implicit assertion - will fail if string is rendered multiple times cy.findByText(option); }); diff --git a/e2e/test/scenarios/binning/binning-reproductions.cy.spec.js b/e2e/test/scenarios/binning/binning-reproductions.cy.spec.js index 0b6cb7b510f..ae6afedee90 100644 --- a/e2e/test/scenarios/binning/binning-reproductions.cy.spec.js +++ b/e2e/test/scenarios/binning/binning-reproductions.cy.spec.js @@ -67,7 +67,7 @@ describe("binning related reproductions", () => { isSelected: true, }); - cy.wait("@dataset").then(xhr => { + cy.wait("@dataset").then((xhr) => { expect(xhr.response.body.error).not.to.exist; }); @@ -356,7 +356,7 @@ describe("binning related reproductions", () => { cy.findByText("LONGITUDE").click(); }); - cy.wait("@dataset").then(xhr => { + cy.wait("@dataset").then((xhr) => { expect(xhr.response.body.error).not.to.exist; }); diff --git a/e2e/test/scenarios/binning/correctness/longitude.cy.spec.js b/e2e/test/scenarios/binning/correctness/longitude.cy.spec.js index f27df9f66f5..bed00334997 100644 --- a/e2e/test/scenarios/binning/correctness/longitude.cy.spec.js +++ b/e2e/test/scenarios/binning/correctness/longitude.cy.spec.js @@ -82,7 +82,7 @@ function assertOnXYAxisLabels() { function assertOnXAxisTicks(values) { if (values) { H.echartsContainer().within(() => { - values.forEach(value => { + values.forEach((value) => { cy.findByText(value); }); }); diff --git a/e2e/test/scenarios/binning/correctness/time-series.cy.spec.js b/e2e/test/scenarios/binning/correctness/time-series.cy.spec.js index f7599d47511..5f6bdb5a4be 100644 --- a/e2e/test/scenarios/binning/correctness/time-series.cy.spec.js +++ b/e2e/test/scenarios/binning/correctness/time-series.cy.spec.js @@ -77,7 +77,7 @@ function assertOnHeaderCells(bucketSize) { } function assertOnTableValues(values) { - values.map(v => { + values.map((v) => { cy.findByText(v).scrollIntoView(); }); } diff --git a/e2e/test/scenarios/binning/qb-explicit-joins.cy.spec.js b/e2e/test/scenarios/binning/qb-explicit-joins.cy.spec.js index 25a771d6bef..10b681d233a 100644 --- a/e2e/test/scenarios/binning/qb-explicit-joins.cy.spec.js +++ b/e2e/test/scenarios/binning/qb-explicit-joins.cy.spec.js @@ -294,7 +294,7 @@ function assertOnXYAxisLabels({ xLabel, yLabel } = {}) { } function waitAndAssertOnRequest(requestAlias) { - cy.wait(requestAlias).then(xhr => { + cy.wait(requestAlias).then((xhr) => { expect(xhr.response.body.error).to.not.exist; }); } @@ -321,7 +321,7 @@ function assertQueryBuilderState({ values && H.echartsContainer().within(() => { - values.forEach(value => { + values.forEach((value) => { cy.findByText(value); }); }); diff --git a/e2e/test/scenarios/binning/qb-implicit-joins.cy.spec.js b/e2e/test/scenarios/binning/qb-implicit-joins.cy.spec.js index 3dd099c4c56..de8fd3faebd 100644 --- a/e2e/test/scenarios/binning/qb-implicit-joins.cy.spec.js +++ b/e2e/test/scenarios/binning/qb-implicit-joins.cy.spec.js @@ -147,7 +147,7 @@ describe("scenarios > binning > from a saved QB question using implicit joins", }); function waitAndAssertOnRequest(requestAlias) { - cy.wait(requestAlias).then(xhr => { + cy.wait(requestAlias).then((xhr) => { expect(xhr.response.body.error).to.not.exist; }); } diff --git a/e2e/test/scenarios/binning/sql.cy.spec.js b/e2e/test/scenarios/binning/sql.cy.spec.js index 99bce8c5d9b..86e21a34ee9 100644 --- a/e2e/test/scenarios/binning/sql.cy.spec.js +++ b/e2e/test/scenarios/binning/sql.cy.spec.js @@ -21,7 +21,7 @@ describe("scenarios > binning > from a saved sql question", () => { wrapId: true, }); - cy.get("@questionId").then(id => (questionId = id)); + cy.get("@questionId").then((id) => (questionId = id)); H.snapshot("binningSql"); }); @@ -124,7 +124,7 @@ describe("scenarios > binning > from a saved sql question", () => { // eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage cy.findByText("Count by CREATED_AT: Year"); - H.visualize(response => { + H.visualize((response) => { assertOnResponse(response); }); @@ -141,7 +141,7 @@ describe("scenarios > binning > from a saved sql question", () => { // eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage cy.findByText("Count by TOTAL: 50 bins"); - H.visualize(response => { + H.visualize((response) => { assertOnResponse(response); }); @@ -158,7 +158,7 @@ describe("scenarios > binning > from a saved sql question", () => { // eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage cy.findByText("Count by LONGITUDE: 10°"); - H.visualize(response => { + H.visualize((response) => { assertOnResponse(response); }); diff --git a/e2e/test/scenarios/collections/cleanup.cy.spec.js b/e2e/test/scenarios/collections/cleanup.cy.spec.js index 0582964ae36..936c92d1841 100644 --- a/e2e/test/scenarios/collections/cleanup.cy.spec.js +++ b/e2e/test/scenarios/collections/cleanup.cy.spec.js @@ -117,8 +117,8 @@ describe("scenarios > collections > clean up", () => { ); // trip is_sample flag - cy.intercept("GET", `/api/collection/${id}`, req => { - req.on("response", res => { + cy.intercept("GET", `/api/collection/${id}`, (req) => { + req.on("response", (res) => { res.send(assocIn(res.body, ["is_sample"], true)); }); }); @@ -154,7 +154,7 @@ describe("scenarios > collections > clean up", () => { }); it("should be able to clean up stale items", () => { - seedMainTestData().then(seedData => { + seedMainTestData().then((seedData) => { const firstAlphabeticalName = "Bulk dashboard 1"; const lastAlphabeticalName = "Bulk question 9"; @@ -236,7 +236,7 @@ describe("scenarios > collections > clean up", () => { assertNoPagination(); H.expectGoodSnowplowEvent( - event => + (event) => isMatching( { event: "moved-to-trash", @@ -255,7 +255,7 @@ describe("scenarios > collections > clean up", () => { // that it exists and is a string. Snowplow will assert that it is in the correct // format H.expectGoodSnowplowEvent( - event => + (event) => event && event.event === "stale_items_archived" && event.collection_id === seedData.collection.id && @@ -304,7 +304,7 @@ describe("scenarios > collections > clean up", () => { // Ensure that stale items in Our Analytics are maked with a null collection id H.expectGoodSnowplowEvent( - event => + (event) => event && event.event === "stale_items_archived" && event.collection_id === null && @@ -323,7 +323,7 @@ describe("scenarios > collections > clean up", () => { .then(({ body: { id } }) => id) .as("collectionId"); - cy.get("@collectionId").then(id => { + cy.get("@collectionId").then((id) => { return bulkCreateQuestions(2, { collection_id: id }).then(() => { H.visitCollection(id); }); @@ -379,7 +379,7 @@ const selectCleanThingsUpCollectionAction = () => { cy.findByText("Clear out unused items").click(); }); }; -const setDateFilter = timeSpan => { +const setDateFilter = (timeSpan) => { dateFilter().click(); H.selectDropdown().findByText(timeSpan).click(); }; @@ -405,7 +405,7 @@ const assertNoPagination = () => { }); }; -const assertStaleItemCount = itemCount => { +const assertStaleItemCount = (itemCount) => { cleanUpModal().within(() => { cy.findAllByTestId("pagination-total").should("have.text", `${itemCount}`); }); @@ -418,7 +418,7 @@ const bulkCreateQuestions = (amount, options, results = []) => { query: { "source-table": STATIC_ORDERS_ID }, type: "model", ...options, - }).then(req => { + }).then((req) => { results.push(req.body); if (amount <= 1) { return results; @@ -431,7 +431,7 @@ const bulkCreateDashboards = (amount, options, results = []) => { return H.createDashboard({ name: `Bulk dashboard ${amount}`, ...options, - }).then(req => { + }).then((req) => { results.push(req.body); if (amount <= 1) { return results; @@ -495,7 +495,7 @@ function seedMainTestData() { cy.get("@cleanUpCollection") .then(({ id }) => bulkCreateQuestions(12, { collection_id: id })) .as("questions") - .then(questions => { + .then((questions) => { veryStaleQuestionIds.push(...questions.slice(0, 4).map(({ id }) => id)); staleQuestionIds.push(...questions.slice(4, 8).map(({ id }) => id)); notStaleQuestionIds.push(...questions.slice(8).map(({ id }) => id)); @@ -506,7 +506,7 @@ function seedMainTestData() { cy.get("@cleanUpCollection") .then(({ id }) => bulkCreateDashboards(9, { collection_id: id })) .as("dashboards") - .then(dashboards => { + .then((dashboards) => { veryStaleDashboardIds.push(...dashboards.slice(0, 3).map(({ id }) => id)); staleDashboardIds.push(...dashboards.slice(3, 6).map(({ id }) => id)); notStaleDashboardIds.push(...dashboards.slice(6).map(({ id }) => id)); @@ -523,7 +523,7 @@ function seedMainTestData() { cy.get("@cleanUpChildCollection") .then(({ id }) => bulkCreateDashboards(5, { collection_id: id })) .as("childDashboards") - .then(dashboards => { + .then((dashboards) => { veryStaleChildDashboardIds.push(...dashboards.map(({ id }) => id)); makeItemsStale(veryStaleChildDashboardIds, "dashboard", "2000-01-01"); }); diff --git a/e2e/test/scenarios/collections/collections.cy.spec.js b/e2e/test/scenarios/collections/collections.cy.spec.js index 4ae2d7b0c5f..bf6b6f1b7d2 100644 --- a/e2e/test/scenarios/collections/collections.cy.spec.js +++ b/e2e/test/scenarios/collections/collections.cy.spec.js @@ -32,7 +32,7 @@ describe("scenarios > collection defaults", () => { describe("new collection modal", () => { it("should be usable on small screens", () => { const COLLECTIONS_COUNT = 5; - _.times(COLLECTIONS_COUNT, index => { + _.times(COLLECTIONS_COUNT, (index) => { cy.request("POST", "/api/collection", { name: `Collection ${index + 1}`, parent_id: null, @@ -48,7 +48,7 @@ describe("scenarios > collection defaults", () => { // eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage cy.findByText("Collection").click(); - cy.findByTestId("new-collection-modal").then(modal => { + cy.findByTestId("new-collection-modal").then((modal) => { cy.findByPlaceholderText("My new fantastic collection").type( "Test collection", ); @@ -254,8 +254,8 @@ describe("scenarios > collection defaults", () => { cy.intercept( "GET", "/api/collection/root/items?models=dashboard**", - req => { - req.on("response", res => { + (req) => { + req.on("response", (res) => { res.send( assocIn(res.body, ["data", 0, "last-edit-info"], { id: 1, @@ -278,8 +278,8 @@ describe("scenarios > collection defaults", () => { cy.intercept( "GET", "/api/collection/root/items?models=dashboard**", - req => { - req.on("response", res => { + (req) => { + req.on("response", (res) => { res.send( assocIn(res.body, ["data", 0, "last-edit-info"], { id: 1, @@ -790,7 +790,7 @@ describe("scenarios > collection defaults", () => { H.createCollection({ name: "Outer collection 2" }); // modify the inner collection so that it shows up in recents - cy.get("@innerCollectionId").then(innerCollectionId => { + cy.get("@innerCollectionId").then((innerCollectionId) => { cy.request("PUT", `/api/collection/${innerCollectionId}`, { name: "Inner collection 1 - modified", }); @@ -842,7 +842,7 @@ describe("scenarios > collection defaults", () => { it("collections list on the home page shouldn't depend on the name of the first 50 objects (metabase#16784)", () => { // Although there are already some objects in the default snapshot (3 questions, 1 dashboard, 3 collections), // let's create 50 more dashboards with the letter of alphabet `D` coming before the first letter of the existing collection `F`. - Cypress._.times(50, i => H.createDashboard({ name: `Dashboard ${i}` })); + Cypress._.times(50, (i) => H.createDashboard({ name: `Dashboard ${i}` })); cy.visit("/"); // There is already a collection named "First collection" in the default snapshot @@ -859,7 +859,7 @@ describe("scenarios > collection defaults", () => { cy.findByText("Collection").click(); }); - cy.findByTestId("new-collection-modal").then(modal => { + cy.findByTestId("new-collection-modal").then((modal) => { cy.findByText("Collection it's saved in").should("be.visible"); cy.findByTestId("collection-picker-button") .findByText("Third collection") @@ -905,7 +905,7 @@ describe("scenarios > collection items listing", () => { } function archiveAll() { - cy.request("GET", "/api/collection/root/items").then(response => { + cy.request("GET", "/api/collection/root/items").then((response) => { response.body.data.forEach(({ model, id }) => { if (model !== "collection") { cy.request( @@ -951,10 +951,10 @@ describe("scenarios > collection items listing", () => { // so the test won't fail if we change the default database archiveAll(); - _.times(ADDED_DASHBOARDS, i => + _.times(ADDED_DASHBOARDS, (i) => H.createDashboard({ name: `dashboard ${i}` }), ); - _.times(ADDED_QUESTIONS, i => + _.times(ADDED_QUESTIONS, (i) => H.createQuestion({ name: `generated question ${i}`, query: TEST_QUESTION_QUERY, @@ -1148,8 +1148,8 @@ describe("scenarios > collection items listing", () => { }); it("should reset pagination if sorting applied on not first page", () => { - _.times(15, i => H.createDashboard(`dashboard ${i}`)); - _.times(15, i => + _.times(15, (i) => H.createDashboard(`dashboard ${i}`)); + _.times(15, (i) => H.createQuestion({ name: `generated question ${i}`, query: TEST_QUESTION_QUERY, @@ -1238,7 +1238,7 @@ function ensureCollectionIsExpanded(collection, { children = [] } = {}) { cy.get("@root") .next("ul") .within(() => { - children.forEach(child => { + children.forEach((child) => { cy.findByText(child); }); }); @@ -1246,7 +1246,7 @@ function ensureCollectionIsExpanded(collection, { children = [] } = {}) { } function moveItemToCollection(itemName, collectionName) { - cy.request("GET", "/api/collection/root/items").then(resp => { + cy.request("GET", "/api/collection/root/items").then((resp) => { const ALL_ITEMS = resp.body.data; const { id, model } = getCollectionItem(ALL_ITEMS, itemName); @@ -1258,7 +1258,7 @@ function moveItemToCollection(itemName, collectionName) { }); function getCollectionItem(collection, itemName) { - return collection.find(item => item.name === itemName); + return collection.find((item) => item.name === itemName); } } diff --git a/e2e/test/scenarios/collections/instance-analytics.cy.spec.js b/e2e/test/scenarios/collections/instance-analytics.cy.spec.js index e0d11e7bac4..339ae9cc377 100644 --- a/e2e/test/scenarios/collections/instance-analytics.cy.spec.js +++ b/e2e/test/scenarios/collections/instance-analytics.cy.spec.js @@ -43,7 +43,7 @@ describe("scenarios > Metabase Analytics Collection (AuditV2) ", () => { { requestTimeout: 15000 }, () => { cy.log("saving edited question"); - getItemId(ANALYTICS_COLLECTION_NAME, PEOPLE_MODEL_NAME).then(id => { + getItemId(ANALYTICS_COLLECTION_NAME, PEOPLE_MODEL_NAME).then((id) => { H.visitModel(id); }); @@ -60,7 +60,7 @@ describe("scenarios > Metabase Analytics Collection (AuditV2) ", () => { cy.findByTestId("qb-header").findByText("Save").click(); - cy.findByTestId("save-question-modal").within(modal => { + cy.findByTestId("save-question-modal").within((modal) => { cy.findByTestId("dashboard-and-collection-picker-button").findByText( "Custom reports", ); @@ -75,7 +75,7 @@ describe("scenarios > Metabase Analytics Collection (AuditV2) ", () => { cy.log("saving copied question"); - getItemId(ANALYTICS_COLLECTION_NAME, PEOPLE_MODEL_NAME).then(id => { + getItemId(ANALYTICS_COLLECTION_NAME, PEOPLE_MODEL_NAME).then((id) => { H.visitModel(id); }); @@ -99,7 +99,7 @@ describe("scenarios > Metabase Analytics Collection (AuditV2) ", () => { cy.log("saving copied dashboard"); - getItemId(ANALYTICS_COLLECTION_NAME, "Person overview").then(id => { + getItemId(ANALYTICS_COLLECTION_NAME, "Person overview").then((id) => { H.visitDashboard(id); }); @@ -130,7 +130,7 @@ describe("scenarios > Metabase Analytics Collection (AuditV2) ", () => { visitCollection(ANALYTICS_COLLECTION_NAME); - cy.findAllByTestId("collection-entry").each(el => { + cy.findAllByTestId("collection-entry").each((el) => { if (el.text() === CUSTOM_REPORTS_COLLECTION_NAME) { cy.wrap(el).within(() => { cy.icon("ellipsis").click(); @@ -154,7 +154,7 @@ describe("scenarios > Metabase Analytics Collection (AuditV2) ", () => { visitCollection("Our analytics"); - cy.findAllByTestId("collection-entry").each(el => { + cy.findAllByTestId("collection-entry").each((el) => { if (el.text() === ANALYTICS_COLLECTION_NAME) { cy.wrap(el).within(() => { cy.icon("ellipsis").click(); @@ -172,9 +172,11 @@ describe("scenarios > Metabase Analytics Collection (AuditV2) ", () => { it("should not allow editing analytics content (metabase#36228)", () => { // dashboard - getItemId(ANALYTICS_COLLECTION_NAME, METRICS_DASHBOARD_NAME).then(id => { - H.visitDashboard(id); - }); + getItemId(ANALYTICS_COLLECTION_NAME, METRICS_DASHBOARD_NAME).then( + (id) => { + H.visitDashboard(id); + }, + ); cy.findByTestId("dashboard-header").within(() => { cy.findByText("Make a copy"); @@ -182,7 +184,7 @@ describe("scenarios > Metabase Analytics Collection (AuditV2) ", () => { }); // model - getItemId(ANALYTICS_COLLECTION_NAME, PEOPLE_MODEL_NAME).then(id => { + getItemId(ANALYTICS_COLLECTION_NAME, PEOPLE_MODEL_NAME).then((id) => { H.visitModel(id); }); @@ -195,7 +197,7 @@ describe("scenarios > Metabase Analytics Collection (AuditV2) ", () => { }); it("should not leak instance analytics database into SQL query builder (metabase#44856)", () => { - getItemId(ANALYTICS_COLLECTION_NAME, PEOPLE_MODEL_NAME).then(id => { + getItemId(ANALYTICS_COLLECTION_NAME, PEOPLE_MODEL_NAME).then((id) => { H.visitModel(id); }); @@ -208,7 +210,7 @@ describe("scenarios > Metabase Analytics Collection (AuditV2) ", () => { }); it("should not leak instance analytics database into permissions editor (metabase#44856)", () => { - getItemId(ANALYTICS_COLLECTION_NAME, PEOPLE_MODEL_NAME).then(id => { + getItemId(ANALYTICS_COLLECTION_NAME, PEOPLE_MODEL_NAME).then((id) => { H.visitModel(id); }); @@ -394,13 +396,13 @@ function getCollectionId(collectionName) { } function visitCollection(collectionName) { - getCollectionId(collectionName).then(id => { + getCollectionId(collectionName).then((id) => { cy.visit(`/collection/${id}`); }); } function getItemId(collectionName, itemName) { - return getCollectionId(collectionName).then(id => { + return getCollectionId(collectionName).then((id) => { cy.request("GET", `/api/collection/${id}/items`).then(({ body }) => { const item = body.data.find(({ name }) => name === itemName); return item.id; diff --git a/e2e/test/scenarios/collections/permissions.cy.spec.js b/e2e/test/scenarios/collections/permissions.cy.spec.js index a9bf2edd183..a8c84086328 100644 --- a/e2e/test/scenarios/collections/permissions.cy.spec.js +++ b/e2e/test/scenarios/collections/permissions.cy.spec.js @@ -21,7 +21,7 @@ describe("collection permissions", () => { describe("item management", () => { Object.entries(PERMISSIONS).forEach(([permission, userGroup]) => { context(`${permission} access`, () => { - userGroup.forEach(user => { + userGroup.forEach((user) => { onlyOn(permission === "curate", () => { describe(`${user} user`, () => { beforeEach(() => { @@ -156,10 +156,10 @@ describe("collection permissions", () => { }); it("archiving sub-collection should redirect to its parent", () => { - cy.request("GET", "/api/collection").then(xhr => { + cy.request("GET", "/api/collection").then((xhr) => { // We need to obtain the ID programatically const { id: THIRD_COLLECTION_ID } = xhr.body.find( - collection => collection.slug === "third_collection", + (collection) => collection.slug === "third_collection", ); cy.intercept( @@ -208,9 +208,9 @@ describe("collection permissions", () => { }); it("visiting already archived collection by its ID shouldn't let you edit it (metabase#12489)", () => { - cy.request("GET", "/api/collection").then(xhr => { + cy.request("GET", "/api/collection").then((xhr) => { const { id: THIRD_COLLECTION_ID } = xhr.body.find( - collection => collection.slug === "third_collection", + (collection) => collection.slug === "third_collection", ); // Archive it cy.request( @@ -254,9 +254,9 @@ describe("collection permissions", () => { }); it("abandoning archive process should keep you in the same collection (metabase#15289)", () => { - cy.request("GET", "/api/collection").then(xhr => { + cy.request("GET", "/api/collection").then((xhr) => { const { id: THIRD_COLLECTION_ID } = xhr.body.find( - collection => collection.slug === "third_collection", + (collection) => collection.slug === "third_collection", ); cy.visit(`/collection/${THIRD_COLLECTION_ID}`); H.openCollectionMenu(); @@ -337,7 +337,7 @@ describe("collection permissions", () => { }); }); - ["/", "/collection/root"].forEach(route => { + ["/", "/collection/root"].forEach((route) => { it("should not be offered to save dashboard in collections they have `read` access to (metabase#15281)", () => { const { first_name, last_name } = USERS[user]; cy.visit(route); diff --git a/e2e/test/scenarios/collections/personal-collections.cy.spec.js b/e2e/test/scenarios/collections/personal-collections.cy.spec.js index 5b3be1f963f..c78f5227f6b 100644 --- a/e2e/test/scenarios/collections/personal-collections.cy.spec.js +++ b/e2e/test/scenarios/collections/personal-collections.cy.spec.js @@ -62,7 +62,7 @@ describe("personal collections", () => { H.popover().findByText("Other users' personal collections").click(); cy.location("pathname").should("eq", "/collection/users"); cy.findByTestId("browsercrumbs").findByText(/All personal collections/i); - Object.values(USERS).forEach(user => { + Object.values(USERS).forEach((user) => { const FULL_NAME = `${user.first_name} ${user.last_name}`; cy.findByText(FULL_NAME); }); @@ -132,7 +132,7 @@ describe("personal collections", () => { }); describe("all users", () => { - Object.keys(USERS).forEach(user => { + Object.keys(USERS).forEach((user) => { describe(`${user} user`, () => { beforeEach(() => { cy.signIn(user); diff --git a/e2e/test/scenarios/collections/revision-history.cy.spec.js b/e2e/test/scenarios/collections/revision-history.cy.spec.js index 7b62d9f394d..00307e0b866 100644 --- a/e2e/test/scenarios/collections/revision-history.cy.spec.js +++ b/e2e/test/scenarios/collections/revision-history.cy.spec.js @@ -46,7 +46,7 @@ describe("revision history", () => { Object.entries(PERMISSIONS).forEach(([permission, userGroup]) => { context(`${permission} access`, () => { - userGroup.forEach(user => { + userGroup.forEach((user) => { // This function `onlyOn` will not generate tests for any other condition. // It helps to make both our tests and Cypress runner sidebar clean onlyOn(permission === "curate", () => { diff --git a/e2e/test/scenarios/collections/trash.cy.spec.js b/e2e/test/scenarios/collections/trash.cy.spec.js index 851cfa0c326..79856c4a385 100644 --- a/e2e/test/scenarios/collections/trash.cy.spec.js +++ b/e2e/test/scenarios/collections/trash.cy.spec.js @@ -113,16 +113,16 @@ describe("scenarios > collections > trash", () => { it("should be able to trash & restore dashboards/collections/questions on entity page and from parent collection", () => { cy.log("create test resources"); cy.log("Bookmark the resources to test metabase#44224"); - createCollection({ name: "Collection A" }).then(collection => { + createCollection({ name: "Collection A" }).then((collection) => { cy.request("POST", `/api/bookmark/collection/${collection.id}`); }); - createDashboard({ name: "Dashboard A" }).then(dashboard => { + createDashboard({ name: "Dashboard A" }).then((dashboard) => { cy.request("POST", `/api/bookmark/dashboard/${dashboard.id}`); }); createNativeQuestion({ name: "Question A", native: { query: "select 1;" }, - }).then(question => { + }).then((question) => { cy.request("POST", `/api/bookmark/card/${question.id}`); }); @@ -131,7 +131,7 @@ describe("scenarios > collections > trash", () => { cy.log("should be able to move to trash from collection view"); toggleEllipsisMenuFor(/Collection A/); H.popover().findByText("Move to trash").click(); - H.expectGoodSnowplowEvent(event => + H.expectGoodSnowplowEvent((event) => isMatching( { event: "moved-to-trash", @@ -147,7 +147,7 @@ describe("scenarios > collections > trash", () => { toggleEllipsisMenuFor("Dashboard A"); H.popover().findByText("Move to trash").click(); - H.expectGoodSnowplowEvent(event => + H.expectGoodSnowplowEvent((event) => isMatching( { event: "moved-to-trash", @@ -163,7 +163,7 @@ describe("scenarios > collections > trash", () => { toggleEllipsisMenuFor("Question A"); H.popover().findByText("Move to trash").click(); - H.expectGoodSnowplowEvent(event => + H.expectGoodSnowplowEvent((event) => isMatching( { event: "moved-to-trash", @@ -207,7 +207,7 @@ describe("scenarios > collections > trash", () => { cy.findByText("Move this collection to trash?"); cy.findByText("Move to trash").click(); }); - H.expectGoodSnowplowEvent(event => + H.expectGoodSnowplowEvent((event) => isMatching( { event: "moved-to-trash", @@ -233,7 +233,7 @@ describe("scenarios > collections > trash", () => { cy.findByText("Move this dashboard to trash?"); cy.findByText("Move to trash").click(); }); - H.expectGoodSnowplowEvent(event => + H.expectGoodSnowplowEvent((event) => isMatching( { event: "moved-to-trash", @@ -263,7 +263,7 @@ describe("scenarios > collections > trash", () => { cy.findByText("Move this question to trash?"); cy.findByText("Move to trash").click(); }); - H.expectGoodSnowplowEvent(event => + H.expectGoodSnowplowEvent((event) => isMatching( { event: "moved-to-trash", @@ -289,9 +289,9 @@ describe("scenarios > collections > trash", () => { cy.log("create test resources"); createCollection({ name: "Collection A" }) .as("collectionA") - .then(a => createCollection({ name: "Collection B", parent_id: a.id })); + .then((a) => createCollection({ name: "Collection B", parent_id: a.id })); - cy.get("@collectionA").then(collectionA => { + cy.get("@collectionA").then((collectionA) => { H.archiveCollection(collectionA.id); }); @@ -593,7 +593,7 @@ describe("scenarios > collections > trash", () => { true, ).as("question"); - cy.get("@question").then(question => { + cy.get("@question").then((question) => { H.visitQuestion(question.id); // should not have disabled actions in top navbar cy.findAllByTestId("qb-header-action-panel").within(() => { @@ -611,7 +611,7 @@ describe("scenarios > collections > trash", () => { }); }); - cy.get("@dashboard").then(dashboard => { + cy.get("@dashboard").then((dashboard) => { H.visitDashboard(dashboard.id); cy.findAllByTestId("dashboard-header").within(() => { @@ -627,7 +627,7 @@ describe("scenarios > collections > trash", () => { it("user should not be shown restore/move/delete options in archive banner if they have view only permissions", () => { createCollection({ name: "Collection A" }).as("collection"); - cy.get("@collection").then(collection => { + cy.get("@collection").then((collection) => { createNativeQuestion( { name: "Question A", @@ -670,7 +670,7 @@ describe("scenarios > collections > trash", () => { cy.signInAsNormalUser(); - cy.get("@collection").then(collection => { + cy.get("@collection").then((collection) => { H.visitCollection(collection.id); archiveBanner().findByText("Restore").should("not.exist"); archiveBanner().findByText("Move").should("not.exist"); @@ -736,7 +736,7 @@ describe("scenarios > collections > trash", () => { assertTrashSelectedInNavigationSidebar(); cy.log("Make sure trash is selected for a trashed collection"); - cy.get("@collection").then(collection => { + cy.get("@collection").then((collection) => { cy.intercept("GET", `/api/collection/${collection.id}`).as( "getCollection", ); @@ -746,7 +746,7 @@ describe("scenarios > collections > trash", () => { }); cy.log("Make sure trash is selected for a trashed dashboard"); - cy.get("@dashboard").then(dashboard => { + cy.get("@dashboard").then((dashboard) => { cy.intercept("GET", `/api/dashboard/${dashboard.id}*`).as("getDashboard"); H.visitDashboard(dashboard.id); cy.wait("@getDashboard"); @@ -755,7 +755,7 @@ describe("scenarios > collections > trash", () => { }); cy.log("Make sure trash is selected for a trashed question"); - cy.get("@question").then(question => { + cy.get("@question").then((question) => { cy.log(question.id); cy.intercept("POST", `/api/card/${question.id}/query`).as( "getQuestionResult", diff --git a/e2e/test/scenarios/collections/uploads.cy.spec.js b/e2e/test/scenarios/collections/uploads.cy.spec.js index 8ccd9fcfdce..18de9f078bb 100644 --- a/e2e/test/scenarios/collections/uploads.cy.spec.js +++ b/e2e/test/scenarios/collections/uploads.cy.spec.js @@ -62,13 +62,13 @@ H.describeWithSnowplow( const tableQuery = `SELECT * FROM information_schema.tables WHERE table_name LIKE '%${testFile.tableName}_%' ORDER BY table_name DESC LIMIT 1;`; - H.queryWritableDB(tableQuery, "postgres").then(result => { + H.queryWritableDB(tableQuery, "postgres").then((result) => { expect(result.rows.length).to.equal(1); const tableName = result.rows[0].table_name; H.queryWritableDB( `SELECT count(*) FROM ${EMPTY_SCHEMA_NAME}.${tableName};`, "postgres", - ).then(result => { + ).then((result) => { expect(Number(result.rows[0].count)).to.equal(testFile.rowCount); }); }); @@ -94,7 +94,7 @@ H.describeWithSnowplow( }); }); - ["postgres", "mysql"].forEach(dialect => { + ["postgres", "mysql"].forEach((dialect) => { describe(`CSV Uploading (${dialect})`, () => { beforeEach(() => { H.restore(`${dialect}-writable`); @@ -115,7 +115,7 @@ H.describeWithSnowplow( H.expectNoBadSnowplowEvents(); }); - H.VALID_CSV_FILES.forEach(testFile => { + H.VALID_CSV_FILES.forEach((testFile) => { it(`Can upload ${testFile.fileName} to a collection`, () => { uploadFileToCollection(testFile); @@ -125,14 +125,14 @@ H.describeWithSnowplow( const tableQuery = `SELECT * FROM information_schema.tables WHERE table_name LIKE '%${testFile.tableName}_%' ORDER BY table_name DESC LIMIT 1;`; - H.queryWritableDB(tableQuery, dialect).then(result => { + H.queryWritableDB(tableQuery, dialect).then((result) => { expect(result.rows.length).to.equal(1); const tableName = result.rows[0].table_name ?? result.rows[0].TABLE_NAME; H.queryWritableDB( `SELECT count(*) as count FROM ${tableName};`, dialect, - ).then(result => { + ).then((result) => { expect(Number(result.rows[0].count)).to.equal( testFile.rowCount, ); @@ -141,7 +141,7 @@ H.describeWithSnowplow( }); }); - H.INVALID_CSV_FILES.forEach(testFile => { + H.INVALID_CSV_FILES.forEach((testFile) => { it(`Cannot upload ${testFile.fileName} to a collection`, () => { uploadFileToCollection(testFile); @@ -151,7 +151,7 @@ H.describeWithSnowplow( const tableQuery = `SELECT * FROM information_schema.tables WHERE table_name LIKE '%${testFile.tableName}_%' ORDER BY table_name DESC LIMIT 1;`; - H.queryWritableDB(tableQuery, dialect).then(result => { + H.queryWritableDB(tableQuery, dialect).then((result) => { expect(result.rows.length).to.equal(0); }); }); @@ -237,7 +237,7 @@ H.describeWithSnowplow( H.visitCollection(FIRST_COLLECTION_ID); cy.fixture(`${FIXTURE_PATH}/${H.VALID_CSV_FILES[2].fileName}`).then( - file => { + (file) => { cy.get("#upload-input").selectFile( { contents: Cypress.Buffer.from(file), @@ -398,7 +398,7 @@ describe("Upload Table Cleanup/Management", { tags: "@external" }, () => { }); function uploadFileToCollection(testFile, viewModel = true) { - cy.get("@collectionId").then(collectionId => + cy.get("@collectionId").then((collectionId) => cy.visit(`/collection/${collectionId}`), ); @@ -441,7 +441,7 @@ function uploadToExisting({ H.popover().findByText(uploadOptions[uploadMode]).click(); - cy.fixture(`${H.FIXTURE_PATH}/${testFile.fileName}`).then(file => { + cy.fixture(`${H.FIXTURE_PATH}/${testFile.fileName}`).then((file) => { cy.get("#upload-file-input").selectFile( { contents: Cypress.Buffer.from(file), diff --git a/e2e/test/scenarios/cross-version/helpers/cross-version-helpers.js b/e2e/test/scenarios/cross-version/helpers/cross-version-helpers.js index 8cc385a0ee3..a07a2e2a69d 100644 --- a/e2e/test/scenarios/cross-version/helpers/cross-version-helpers.js +++ b/e2e/test/scenarios/cross-version/helpers/cross-version-helpers.js @@ -8,7 +8,7 @@ export function parseVersionString(versionString) { return { version: versionString }; // Return versionString if no segments found } - const segmentInts = segments.map(segment => parseInt(segment, 10)); + const segmentInts = segments.map((segment) => parseInt(segment, 10)); const editionIndex = segmentInts[0]; let edition = null; @@ -137,7 +137,7 @@ export function saveQuestion({ majorVersion }) { if (majorVersion < updatedCypressSaveLogicVersion) { cy.button("Save").click(); } else { - cy.findByTestId("save-question-modal").within(modal => { + cy.findByTestId("save-question-modal").within((modal) => { cy.findByText("Save").click(); }); } @@ -168,7 +168,7 @@ export function dismissOkToPlayWithQuestionsModal({ majorVersion }) { export function fillAreaUnderLineChart({ majorVersion }) { if (majorVersion < filledAreaIconRemovedVersion) { - cy.findByTestId("sidebar-left").within(element => { + cy.findByTestId("sidebar-left").within((element) => { cy.icon("area").click(); }); } diff --git a/e2e/test/scenarios/cross-version/source/01-generate-metadata.cy.spec.js b/e2e/test/scenarios/cross-version/source/01-generate-metadata.cy.spec.js index df13e77fa55..4fe79c95626 100644 --- a/e2e/test/scenarios/cross-version/source/01-generate-metadata.cy.spec.js +++ b/e2e/test/scenarios/cross-version/source/01-generate-metadata.cy.spec.js @@ -3,7 +3,7 @@ const { H } = cy; it("should generate metadata", () => { cy.signInAsAdmin(); - H.withSampleDatabase(SAMPLE_DATABASE => { + H.withSampleDatabase((SAMPLE_DATABASE) => { cy.writeFile("e2e/support/cypress_sample_database.json", SAMPLE_DATABASE); }); }); diff --git a/e2e/test/scenarios/custom-column/cc-boolean-functions.cy.spec.ts b/e2e/test/scenarios/custom-column/cc-boolean-functions.cy.spec.ts index d40a79f49ad..3bcf28e44bb 100644 --- a/e2e/test/scenarios/custom-column/cc-boolean-functions.cy.spec.ts +++ b/e2e/test/scenarios/custom-column/cc-boolean-functions.cy.spec.ts @@ -609,7 +609,7 @@ describe("scenarios > custom column > boolean functions", () => { }); it("should be able setup an 'open question' click behavior", () => { - createDashboardWithQuestion().then(dashboard => + createDashboardWithQuestion().then((dashboard) => H.visitDashboard(dashboard.id), ); @@ -642,7 +642,7 @@ describe("scenarios > custom column > boolean functions", () => { }); it("should be able setup an 'open dashboard' click behavior for the same dashboard", () => { - createDashboardWithQuestion().then(dashboard => + createDashboardWithQuestion().then((dashboard) => H.visitDashboard(dashboard.id), ); @@ -680,7 +680,7 @@ describe("scenarios > custom column > boolean functions", () => { it("should be able setup an 'open dashboard' click behavior for another dashboard", () => { createDashboardWithQuestion({ name: "D2" }); - createDashboardWithQuestion({ name: "D1" }).then(dashboard => + createDashboardWithQuestion({ name: "D1" }).then((dashboard) => H.visitDashboard(dashboard.id), ); diff --git a/e2e/test/scenarios/custom-column/cc-cast-functions.cy.spec.ts b/e2e/test/scenarios/custom-column/cc-cast-functions.cy.spec.ts index d2de53653cc..b45078855b7 100644 --- a/e2e/test/scenarios/custom-column/cc-cast-functions.cy.spec.ts +++ b/e2e/test/scenarios/custom-column/cc-cast-functions.cy.spec.ts @@ -169,7 +169,7 @@ function testFilterWithExpressions( H.assertQueryBuilderRowCount(200); H.openNotebook(); - testCases.forEach(testCase => { + testCases.forEach((testCase) => { cy.log(testCase.name); addCustomColumn(testCase); H.getNotebookStep("expression").button("Filter").click(); diff --git a/e2e/test/scenarios/custom-column/cc-typing-suggestion.cy.spec.js b/e2e/test/scenarios/custom-column/cc-typing-suggestion.cy.spec.js index db75a419e89..c82f0e14d13 100644 --- a/e2e/test/scenarios/custom-column/cc-typing-suggestion.cy.spec.js +++ b/e2e/test/scenarios/custom-column/cc-typing-suggestion.cy.spec.js @@ -205,10 +205,10 @@ const addCustomColumn = () => { function verifyHelptextPosition(text) { H.CustomExpressionEditor.get() .findByText(text) - .then($element => { + .then(($element) => { const { left: textLeft } = $element[0].getBoundingClientRect(); - H.CustomExpressionEditor.helpText().then($element => { + H.CustomExpressionEditor.helpText().then(($element) => { const { left: helpTextLeft } = $element[0].getBoundingClientRect(); expect(helpTextLeft).to.be.closeTo(textLeft, 5); diff --git a/e2e/test/scenarios/custom-column/custom-column-reproductions.cy.spec.js b/e2e/test/scenarios/custom-column/custom-column-reproductions.cy.spec.js index 7bcaa0cc16a..2324375171a 100644 --- a/e2e/test/scenarios/custom-column/custom-column-reproductions.cy.spec.js +++ b/e2e/test/scenarios/custom-column/custom-column-reproductions.cy.spec.js @@ -502,7 +502,7 @@ describe("issue 19745", () => { function updateQuestion() { cy.intercept("PUT", "/api/card/*").as("updateQuestion"); cy.findByText("Save").click(); - cy.findByTestId("save-question-modal").within(modal => { + cy.findByTestId("save-question-modal").within((modal) => { cy.findByText("Save").click(); }); cy.wait("@updateQuestion"); @@ -679,7 +679,7 @@ describe("issue 23862", () => { display: "table", }, { - callback: xhr => expect(xhr.response.body.error).not.to.exist, + callback: (xhr) => expect(xhr.response.body.error).not.to.exist, }, ); }); @@ -800,7 +800,7 @@ describe.skip("issue 25189", () => { }); }); -["postgres" /*, "mysql" */].forEach(dialect => { +["postgres" /*, "mysql" */].forEach((dialect) => { describe(`issue 27745 (${dialect})`, { tags: "@external" }, () => { const tableName = "colors27745"; @@ -1359,7 +1359,7 @@ describe("issue 53527", () => { }, }; - const mbqlQuestionDetails = cardId => ({ + const mbqlQuestionDetails = (cardId) => ({ name: "Quotes MBQL", query: { "source-table": `card__${cardId}`, @@ -1436,7 +1436,7 @@ describe("issue 54638", () => { cy.findByText("Learn more") .scrollIntoView() .should("be.visible") - .then($a => { + .then(($a) => { expect($a).to.have.attr("target", "_blank"); // Update attr to open in same tab, since Cypress does not support // testing in multiple tabs. diff --git a/e2e/test/scenarios/custom-column/custom-column.cy.spec.js b/e2e/test/scenarios/custom-column/custom-column.cy.spec.js index 1582f54d804..940b9811334 100644 --- a/e2e/test/scenarios/custom-column/custom-column.cy.spec.js +++ b/e2e/test/scenarios/custom-column/custom-column.cy.spec.js @@ -484,7 +484,7 @@ describe("scenarios > question > custom column", () => { cy.log("Reported failing on 0.38.1-SNAPSHOT (6d77f099)"); cy.findByTestId("step-expression-0-0").should("not.exist"); - H.visualize(response => { + H.visualize((response) => { expect(response.body.error).to.not.exist; }); @@ -524,7 +524,7 @@ describe("scenarios > question > custom column", () => { }, display: "table", }, - { callback: xhr => expect(xhr.response.body.error).not.to.exist }, + { callback: (xhr) => expect(xhr.response.body.error).not.to.exist }, ); // eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage @@ -568,7 +568,7 @@ describe("scenarios > question > custom column", () => { }); cy.button("Done").click(); - H.visualize(response => { + H.visualize((response) => { expect(response.body.error).to.not.exist; }); @@ -1522,8 +1522,8 @@ describe("scenarios > question > custom column > path", () => { idAlias: "modelId", }); - cy.get("@modelId").then(modelId => { - H.setModelMetadata(modelId, field => { + cy.get("@modelId").then((modelId) => { + H.setModelMetadata(modelId, (field) => { if (field.name === CC_NAME) { return { ...field, semantic_type: "type/URL" }; } diff --git a/e2e/test/scenarios/dashboard-cards/click-behavior.cy.spec.js b/e2e/test/scenarios/dashboard-cards/click-behavior.cy.spec.js index e135cb29770..bb6ae25baa0 100644 --- a/e2e/test/scenarios/dashboard-cards/click-behavior.cy.spec.js +++ b/e2e/test/scenarios/dashboard-cards/click-behavior.cy.spec.js @@ -227,7 +227,7 @@ describe("scenarios > dashboard > dashboard cards > click behavior", () => { H.editDashboard(); cy.log("doesn't throw when setting default behavior (metabase#35354)"); - cy.on("uncaught:exception", err => { + cy.on("uncaught:exception", (err) => { expect(err.name.includes("TypeError")).to.be.false; }); @@ -256,7 +256,7 @@ describe("scenarios > dashboard > dashboard cards > click behavior", () => { cy.intercept("GET", "/api/collection", cy.spy().as("collections")); clickLineChartPoint(); - cy.get("@targetDashboardId").then(targetDashboardId => { + cy.get("@targetDashboardId").then((targetDashboardId) => { cy.location().should(({ pathname, search }) => { expect(pathname).to.equal(`/dashboard/${targetDashboardId}`); expect(search).to.equal(""); @@ -283,7 +283,7 @@ describe("scenarios > dashboard > dashboard cards > click behavior", () => { wrapId: true, idAlias: "targetDashboardId", }, - ).then(dashboardId => { + ).then((dashboardId) => { cy.request("PUT", `/api/dashboard/${dashboardId}`, { dashcards: [ createMockDashboardCard({ @@ -317,7 +317,7 @@ describe("scenarios > dashboard > dashboard cards > click behavior", () => { cy.findAllByTestId("field-set") .should("have.length", 1) .should("contain.text", POINT_COUNT); - cy.get("@targetDashboardId").then(targetDashboardId => { + cy.get("@targetDashboardId").then((targetDashboardId) => { cy.location().should(({ pathname, search }) => { expect(pathname).to.equal(`/dashboard/${targetDashboardId}`); expect(search).to.equal( @@ -337,7 +337,7 @@ describe("scenarios > dashboard > dashboard cards > click behavior", () => { wrapId: true, idAlias: "targetDashboardId", }, - ).then(dashboardId => { + ).then((dashboardId) => { cy.request("PUT", `/api/dashboard/${dashboardId}`, { dashcards: [ createMockDashboardCard({ @@ -374,7 +374,7 @@ describe("scenarios > dashboard > dashboard cards > click behavior", () => { .should("have.length", 2) .should("contain.text", POINT_COUNT) .should("contain.text", POINT_CREATED_AT_FORMATTED); - cy.get("@targetDashboardId").then(targetDashboardId => { + cy.get("@targetDashboardId").then((targetDashboardId) => { cy.location().should(({ pathname, search }) => { expect(pathname).to.equal(`/dashboard/${targetDashboardId}`); expect(search).to.equal( @@ -414,8 +414,8 @@ describe("scenarios > dashboard > dashboard cards > click behavior", () => { const TAB_SLUG_MAP = {}; - tabs.forEach(tab => { - cy.get(`@${tab.name}-id`).then(tabId => { + tabs.forEach((tab) => { + cy.get(`@${tab.name}-id`).then((tabId) => { TAB_SLUG_MAP[tab.name] = `${tabId}-${tab.name}`; }); }); @@ -446,7 +446,7 @@ describe("scenarios > dashboard > dashboard cards > click behavior", () => { cy.findAllByTestId("field-set") .should("have.length", 1) .should("contain.text", POINT_COUNT); - cy.get("@targetDashboardId").then(targetDashboardId => { + cy.get("@targetDashboardId").then((targetDashboardId) => { cy.location().should(({ pathname, search }) => { expect(pathname).to.equal(`/dashboard/${targetDashboardId}`); const tabParam = `tab=${TAB_SLUG_MAP[SECOND_TAB.name]}`; @@ -470,13 +470,13 @@ describe("scenarios > dashboard > dashboard cards > click behavior", () => { }); const TAB_SLUG_MAP = {}; - tabs.forEach(tab => { - cy.get(`@${tab.name}-id`).then(tabId => { + tabs.forEach((tab) => { + cy.get(`@${tab.name}-id`).then((tabId) => { TAB_SLUG_MAP[tab.name] = `${tabId}-${tab.name}`; }); }); - cy.get("@targetDashboardId").then(targetDashboardId => { + cy.get("@targetDashboardId").then((targetDashboardId) => { const inexistingTabId = 999; const cardDetails = { visualization_settings: { @@ -519,7 +519,7 @@ describe("scenarios > dashboard > dashboard cards > click behavior", () => { H.saveDashboard({ waitMs: 250 }); clickLineChartPoint(); - cy.get("@targetDashboardId").then(targetDashboardId => { + cy.get("@targetDashboardId").then((targetDashboardId) => { cy.location().should(({ pathname, search }) => { expect(pathname).to.equal(`/dashboard/${targetDashboardId}`); expect(search).to.equal(`?tab=${TAB_SLUG_MAP[SECOND_TAB.name]}`); @@ -532,7 +532,7 @@ describe("scenarios > dashboard > dashboard cards > click behavior", () => { wrapId: true, idAlias: "targetDashboardId", }); - cy.get("@targetDashboardId").then(targetDashboardId => { + cy.get("@targetDashboardId").then((targetDashboardId) => { const inexistingTabId = 999; const cardDetails = { visualization_settings: { @@ -562,7 +562,7 @@ describe("scenarios > dashboard > dashboard cards > click behavior", () => { H.saveDashboard({ waitMs: 250 }); clickLineChartPoint(); - cy.get("@targetDashboardId").then(targetDashboardId => { + cy.get("@targetDashboardId").then((targetDashboardId) => { cy.location().should(({ pathname, search }) => { expect(pathname).to.equal(`/dashboard/${targetDashboardId}`); expect(search).to.equal(""); @@ -585,13 +585,13 @@ describe("scenarios > dashboard > dashboard cards > click behavior", () => { }); const TAB_SLUG_MAP = {}; - tabs.forEach(tab => { - cy.get(`@${tab.name}-id`).then(tabId => { + tabs.forEach((tab) => { + cy.get(`@${tab.name}-id`).then((tabId) => { TAB_SLUG_MAP[tab.name] = `${tabId}-${tab.name}`; }); }); - cy.get("@targetDashboardId").then(targetDashboardId => { + cy.get("@targetDashboardId").then((targetDashboardId) => { const cardDetails = { visualization_settings: { click_behavior: { @@ -624,7 +624,7 @@ describe("scenarios > dashboard > dashboard cards > click behavior", () => { cy.button("Cancel").should("not.exist"); clickLineChartPoint(); - cy.get("@targetDashboardId").then(targetDashboardId => { + cy.get("@targetDashboardId").then((targetDashboardId) => { cy.location().should(({ pathname, search }) => { expect(pathname).to.equal(`/dashboard/${targetDashboardId}`); expect(search).to.equal(`?tab=${TAB_SLUG_MAP[FIRST_TAB.name]}`); @@ -646,7 +646,7 @@ describe("scenarios > dashboard > dashboard cards > click behavior", () => { idAlias: "targetDashboardId", }, ) - .then(dashboardId => { + .then((dashboardId) => { return cy .request("PUT", `/api/dashboard/${dashboardId}`, { dashcards: [ @@ -663,7 +663,7 @@ describe("scenarios > dashboard > dashboard cards > click behavior", () => { }) .then(() => dashboardId); }) - .then(dashboardId => { + .then((dashboardId) => { H.visitDashboard(dashboardId); }); @@ -703,7 +703,7 @@ describe("scenarios > dashboard > dashboard cards > click behavior", () => { .parent() .should("contain.text", DASHBOARD_FILTER_TEXT_WITH_DEFAULT.default); - cy.get("@targetDashboardId").then(targetDashboardId => { + cy.get("@targetDashboardId").then((targetDashboardId) => { cy.location().should(({ pathname, search }) => { expect(pathname).to.equal(`/dashboard/${targetDashboardId}`); expect(search).to.equal( @@ -727,7 +727,7 @@ describe("scenarios > dashboard > dashboard cards > click behavior", () => { idAlias: "targetDashboardId", }, ) - .then(dashboardId => { + .then((dashboardId) => { return cy .request("PUT", `/api/dashboard/${dashboardId}`, { dashcards: [ @@ -744,7 +744,7 @@ describe("scenarios > dashboard > dashboard cards > click behavior", () => { }) .then(() => dashboardId); }) - .then(dashboardId => { + .then((dashboardId) => { H.visitDashboard(dashboardId); }); @@ -789,7 +789,7 @@ describe("scenarios > dashboard > dashboard cards > click behavior", () => { .parent() .should("contain.text", POINT_COUNT); - cy.get("@targetDashboardId").then(targetDashboardId => { + cy.get("@targetDashboardId").then((targetDashboardId) => { cy.location().should(({ pathname, search }) => { expect(pathname).to.equal(`/dashboard/${targetDashboardId}`); expect(search).to.equal( @@ -857,7 +857,7 @@ describe("scenarios > dashboard > dashboard cards > click behavior", () => { cy.intercept("GET", "/api/collection", cy.spy().as("collections")); clickLineChartPoint(); - cy.get("@questionId").then(questionId => { + cy.get("@questionId").then((questionId) => { cy.location() .its("pathname") .should("contain", `/question/${questionId}`); @@ -1018,7 +1018,7 @@ describe("scenarios > dashboard > dashboard cards > click behavior", () => { H.saveDashboard({ waitMs: 250 }); - onNextAnchorClick(anchor => { + onNextAnchorClick((anchor) => { expect(anchor).to.have.attr("href", URL); expect(anchor).to.have.attr("rel", "noopener"); expect(anchor).to.have.attr("target", "_blank"); @@ -1075,7 +1075,7 @@ describe("scenarios > dashboard > dashboard cards > click behavior", () => { cy.button("Add filter").click(); }); - onNextAnchorClick(anchor => { + onNextAnchorClick((anchor) => { expect(anchor).to.have.attr("href", URL_WITH_FILLED_PARAMS); expect(anchor).to.have.attr("rel", "noopener"); expect(anchor).to.have.attr("target", "_blank"); @@ -1135,7 +1135,7 @@ describe("scenarios > dashboard > dashboard cards > click behavior", () => { cy.findAllByTestId("field-set") .should("have.length", 1) .should("contain.text", POINT_COUNT); - cy.get("@originalPathname").then(originalPathname => { + cy.get("@originalPathname").then((originalPathname) => { cy.location().should(({ pathname, search }) => { expect(pathname).to.equal(originalPathname); expect(search).to.equal( @@ -1200,7 +1200,7 @@ describe("scenarios > dashboard > dashboard cards > click behavior", () => { cy.findAllByTestId("field-set") .should("have.length", 1) .should("contain.text", POINT_CREATED_AT_FORMATTED); - cy.get("@originalPathname").then(originalPathname => { + cy.get("@originalPathname").then((originalPathname) => { cy.location().should(({ pathname, search }) => { expect(pathname).to.equal(originalPathname); expect(search).to.equal( @@ -1256,7 +1256,7 @@ describe("scenarios > dashboard > dashboard cards > click behavior", () => { .should("have.length", 2) .should("contain.text", POINT_COUNT) .should("contain.text", POINT_CREATED_AT_FORMATTED); - cy.get("@originalPathname").then(originalPathname => { + cy.get("@originalPathname").then((originalPathname) => { cy.location().should(({ pathname, search }) => { expect(pathname).to.equal(originalPathname); expect(search).to.equal( @@ -1380,7 +1380,7 @@ describe("scenarios > dashboard > dashboard cards > click behavior", () => { .should("have.length", 2) .should("contain.text", POINT_COUNT) .should("contain.text", POINT_CREATED_AT_FORMATTED); - cy.get("@targetDashboardId").then(targetDashboardId => { + cy.get("@targetDashboardId").then((targetDashboardId) => { cy.location().should(({ pathname, search }) => { expect(pathname).to.equal(`/dashboard/${targetDashboardId}`); expect(search).to.equal( @@ -1457,8 +1457,8 @@ describe("scenarios > dashboard > dashboard cards > click behavior", () => { }); const TAB_SLUG_MAP = {}; - tabs.forEach(tab => { - cy.get(`@${tab.name}-id`).then(tabId => { + tabs.forEach((tab) => { + cy.get(`@${tab.name}-id`).then((tabId) => { TAB_SLUG_MAP[tab.name] = `${tabId}-${tab.name}`; }); }); @@ -1499,7 +1499,7 @@ describe("scenarios > dashboard > dashboard cards > click behavior", () => { .should("have.length", 2) .should("contain.text", POINT_COUNT); - cy.get("@targetDashboardId").then(targetDashboardId => { + cy.get("@targetDashboardId").then((targetDashboardId) => { cy.location().should(({ pathname, search }) => { expect(pathname).to.equal(`/dashboard/${targetDashboardId}`); const tabParam = `tab=${TAB_SLUG_MAP[SECOND_TAB.name]}`; @@ -1613,7 +1613,7 @@ describe("scenarios > dashboard > dashboard cards > click behavior", () => { cy.findAllByTestId("field-set") .should("have.length", 1) .should("contain.text", POINT_COUNT); - cy.get("@originalPathname").then(originalPathname => { + cy.get("@originalPathname").then((originalPathname) => { cy.location().should(({ pathname, search }) => { expect(pathname).to.equal(originalPathname); expect(search).to.equal( @@ -1632,7 +1632,7 @@ describe("scenarios > dashboard > dashboard cards > click behavior", () => { cy.findByPlaceholderText("Search the list").type("Dell Adams"); cy.button("Update filter").click(); }); - onNextAnchorClick(anchor => { + onNextAnchorClick((anchor) => { expect(anchor).to.have.attr("href", URL_WITH_FILLED_PARAMS); expect(anchor).to.have.attr("rel", "noopener"); expect(anchor).to.have.attr("target", "_blank"); @@ -1669,7 +1669,7 @@ describe("scenarios > dashboard > dashboard cards > click behavior", () => { idAlias: "targetDashboardId", }, ); - cy.get("@targetDashboardId").then(targetDashboardId => { + cy.get("@targetDashboardId").then((targetDashboardId) => { H.createQuestionAndDashboard({ questionDetails, dashboardDetails, @@ -1699,7 +1699,7 @@ describe("scenarios > dashboard > dashboard cards > click behavior", () => { }); }); - cy.url().then(originalUrl => { + cy.url().then((originalUrl) => { clickLineChartPoint(); cy.url().should("eq", originalUrl); }); @@ -1723,7 +1723,7 @@ describe("scenarios > dashboard > dashboard cards > click behavior", () => { idAlias: "targetQuestionId", }, ); - cy.get("@targetQuestionId").then(targetQuestionId => { + cy.get("@targetQuestionId").then((targetQuestionId) => { H.createQuestionAndDashboard({ questionDetails, dashboardDetails, @@ -1753,7 +1753,7 @@ describe("scenarios > dashboard > dashboard cards > click behavior", () => { }); }); - cy.url().then(originalUrl => { + cy.url().then((originalUrl) => { clickLineChartPoint(); cy.url().should("eq", originalUrl); }); @@ -1804,7 +1804,7 @@ describe("scenarios > dashboard > dashboard cards > click behavior", () => { cy.findByPlaceholderText("Search the list").type("Dell Adams"); cy.button("Add filter").click(); }); - onNextAnchorClick(anchor => { + onNextAnchorClick((anchor) => { expect(anchor).to.have.attr("href", URL_WITH_FILLED_PARAMS); expect(anchor).to.have.attr("rel", "noopener"); expect(anchor).to.have.attr("target", "_blank"); @@ -1928,7 +1928,7 @@ describe("scenarios > dashboard > dashboard cards > click behavior", () => { }, ); }) - .then(uuid => { + .then((uuid) => { H.createQuestionAndDashboard({ dashboardDetails: { name: "Dashboard", @@ -2271,17 +2271,17 @@ describe("scenarios > dashboard > dashboard cards > click behavior", () => { ], }), ], - }).then(dashboard => { + }).then((dashboard) => { cy.wrap(dashboard.id).as("targetDashboardId"); - dashboard.tabs.forEach(tab => { + dashboard.tabs.forEach((tab) => { cy.wrap(tab.id).as(`${tab.name}-id`); }); H.visitDashboard(dashboard.id); }); const TAB_SLUG_MAP = {}; - tabs.forEach(tab => { - cy.get(`@${tab.name}-id`).then(tabId => { + tabs.forEach((tab) => { + cy.get(`@${tab.name}-id`).then((tabId) => { TAB_SLUG_MAP[tab.name] = `${tabId}-${tab.name}`; }); }); @@ -2304,7 +2304,7 @@ describe("scenarios > dashboard > dashboard cards > click behavior", () => { // test click behavior routing to same dashboard, different tab getTableCell(1).click(); - cy.get("@targetDashboardId").then(targetDashboardId => { + cy.get("@targetDashboardId").then((targetDashboardId) => { cy.location().should(({ pathname, search }) => { expect(pathname).to.equal(`/dashboard/${targetDashboardId}`); expect(search).to.equal( @@ -2364,7 +2364,7 @@ describe("scenarios > dashboard > dashboard cards > click behavior", () => { H.modal().within(() => { const urlInput = cy.findAllByRole("textbox").eq(0); - cy.get("@targetDashboardId").then(targetDashboardId => { + cy.get("@targetDashboardId").then((targetDashboardId) => { urlInput.type( `http://localhost:4000/dashboard/${targetDashboardId}?source={{source}}&category={{category}}&count={{count}}`, { @@ -2381,7 +2381,7 @@ describe("scenarios > dashboard > dashboard cards > click behavior", () => { // test top header row H.getDashboardCard().findByText("Doohickey").click(); - cy.get("@targetDashboardId").then(targetDashboardId => { + cy.get("@targetDashboardId").then((targetDashboardId) => { cy.location().should(({ pathname, search }) => { expect(pathname).to.equal(`/dashboard/${targetDashboardId}`); expect(search).to.equal("?category=Doohickey&count=&source="); @@ -2390,7 +2390,7 @@ describe("scenarios > dashboard > dashboard cards > click behavior", () => { // test left header row H.getDashboardCard().findByText("Affiliate").click(); - cy.get("@targetDashboardId").then(targetDashboardId => { + cy.get("@targetDashboardId").then((targetDashboardId) => { cy.location().should(({ pathname, search }) => { expect(pathname).to.equal(`/dashboard/${targetDashboardId}`); expect(search).to.equal("?category=&count=&source=Affiliate"); @@ -2449,7 +2449,7 @@ describe("scenarios > dashboard > dashboard cards > click behavior", () => { H.modal().within(() => { const urlInput = cy.findAllByRole("textbox").eq(0); - cy.get("@targetDashboardId").then(targetDashboardId => { + cy.get("@targetDashboardId").then((targetDashboardId) => { urlInput.type( `http://localhost:4000/dashboard/${targetDashboardId}?source={{source}}`, { @@ -2466,7 +2466,7 @@ describe("scenarios > dashboard > dashboard cards > click behavior", () => { // test pivoted column H.getDashboardCard().findByText("Organic").click(); - cy.get("@targetDashboardId").then(targetDashboardId => { + cy.get("@targetDashboardId").then((targetDashboardId) => { cy.location().should(({ pathname, search }) => { expect(pathname).to.equal(`/dashboard/${targetDashboardId}`); expect(search).to.equal("?source=Organic"); @@ -2512,7 +2512,7 @@ describe("scenarios > dashboard > dashboard cards > click behavior", () => { H.modal().within(() => { const urlInput = cy.findAllByRole("textbox").eq(0); - cy.get("@targetDashboardId").then(targetDashboardId => { + cy.get("@targetDashboardId").then((targetDashboardId) => { urlInput.type( `http://localhost:4000/dashboard/${targetDashboardId}?discount={{sum_2}}&total={{sum}}`, { @@ -2531,7 +2531,7 @@ describe("scenarios > dashboard > dashboard cards > click behavior", () => { H.getDashboardCard().within(() => { H.chartPathWithFillColor("#88BF4D").eq(2).click(); }); - cy.get("@targetDashboardId").then(targetDashboardId => { + cy.get("@targetDashboardId").then((targetDashboardId) => { cy.location().should(({ pathname, search }) => { expect(pathname).to.equal(`/dashboard/${targetDashboardId}`); expect(search).to.equal( @@ -2544,7 +2544,7 @@ describe("scenarios > dashboard > dashboard cards > click behavior", () => { H.getDashboardCard().within(() => { H.chartPathWithFillColor("#88BF4D").eq(1).click(); }); - cy.get("@targetDashboardId").then(targetDashboardId => { + cy.get("@targetDashboardId").then((targetDashboardId) => { cy.location().should(({ pathname, search }) => { expect(pathname).to.equal(`/dashboard/${targetDashboardId}`); expect(search).to.equal("?discount=&total=420.3189231596888"); @@ -2565,7 +2565,7 @@ describe("scenarios > dashboard > dashboard cards > click behavior", () => { name: "second-tab", }, ], - }).then(targetDashboard => { + }).then((targetDashboard) => { const baseClickBehavior = { type: "link", linkType: "dashboard", @@ -2637,7 +2637,7 @@ describe("scenarios > dashboard > dashboard cards > click behavior", () => { wrapId: true, idAlias: "targetDashboardId", }, - ).then(dashboardId => { + ).then((dashboardId) => { cy.request("PUT", `/api/dashboard/${dashboardId}`, { dashcards: [ createMockDashboardCard({ @@ -2663,7 +2663,7 @@ describe("scenarios > dashboard > dashboard cards > click behavior", () => { H.saveDashboard(); }); - cy.get("@targetDashboardId").then(targetDashboardId => { + cy.get("@targetDashboardId").then((targetDashboardId) => { cy.log("remove filter from the target dashboard"); cy.request("PUT", `/api/dashboard/${targetDashboardId}`, { @@ -2709,8 +2709,8 @@ describe("scenarios > dashboard > dashboard cards > click behavior", () => { * * WARNING: For the assertions to work, ensure that a click event occurs on an anchor element afterwards. */ -const onNextAnchorClick = callback => { - cy.window().then(window => { +const onNextAnchorClick = (callback) => { + cy.window().then((window) => { const originalClick = window.HTMLAnchorElement.prototype.click; window.HTMLAnchorElement.prototype.click = function () { @@ -2900,7 +2900,7 @@ const testChangingBackToDefaultBehavior = () => { assertDrillThroughMenuOpen(); }; -const getTableCell = index => { +const getTableCell = (index) => { // eslint-disable-next-line no-unsafe-element-filtering return cy .findAllByRole("row") @@ -2944,7 +2944,7 @@ const createDashboardWithTabsLocal = ({ dashcards, tabs, }).then(({ body: dashboard }) => { - dashboard.tabs.forEach(tab => { + dashboard.tabs.forEach((tab) => { cy.wrap(tab.id).as(`${tab.name}-id`); }); }); diff --git a/e2e/test/scenarios/dashboard-cards/dashboard-card-fetching.cy.spec.js b/e2e/test/scenarios/dashboard-cards/dashboard-card-fetching.cy.spec.js index e9fde36581b..c0939fb0f55 100644 --- a/e2e/test/scenarios/dashboard-cards/dashboard-card-fetching.cy.spec.js +++ b/e2e/test/scenarios/dashboard-cards/dashboard-card-fetching.cy.spec.js @@ -33,7 +33,7 @@ describe("dashboard card fetching", () => { it("should pass same dashboard_load_id to every query to enable metadata cache sharing", () => { createDashboardWithCards({ cards }).then(H.visitDashboard); - cy.wait(["@dashcardQuery", "@dashcardQuery"]).then(interceptions => { + cy.wait(["@dashcardQuery", "@dashcardQuery"]).then((interceptions) => { const query1 = interceptions[0].request.body; const query2 = interceptions[1].request.body; diff --git a/e2e/test/scenarios/dashboard-cards/dashboard-card-reproductions.cy.spec.js b/e2e/test/scenarios/dashboard-cards/dashboard-card-reproductions.cy.spec.js index d5180c816af..f4c4b78d995 100644 --- a/e2e/test/scenarios/dashboard-cards/dashboard-card-reproductions.cy.spec.js +++ b/e2e/test/scenarios/dashboard-cards/dashboard-card-reproductions.cy.spec.js @@ -28,7 +28,7 @@ describe("issue 18067", () => { tableAlias: "testTable", }); - cy.get("@testTable").then(testTable => { + cy.get("@testTable").then((testTable) => { const dashboardDetails = { name: "18067 dashboard", }; @@ -98,7 +98,7 @@ describe("issue 15993", () => { // eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage cy.findByText("Quantity is equal to 0"); - const getVisualizationSettings = targetId => ({ + const getVisualizationSettings = (targetId) => ({ column_settings: { '["name","0"]': { click_behavior: { @@ -186,7 +186,7 @@ describe("issue 16334", () => { // Make sure the original visualization didn't change H.pieSlices().should("have.length", 2); - const getVisualizationSettings = targetId => ({ + const getVisualizationSettings = (targetId) => ({ column_settings: { [`["ref",["field",${REVIEWS.RATING},null]]`]: { click_behavior: { @@ -285,7 +285,7 @@ describe("issue 17160", () => { ], }); - createTargetDashboard().then(targetDashboardId => { + createTargetDashboard().then((targetDashboardId) => { cy.wrap(targetDashboardId).as("targetDashboardId"); // Create a click behaviour for the question card @@ -426,13 +426,13 @@ describe("issue 17160", () => { } function visitSourceDashboard() { - cy.get("@sourceDashboardId").then(id => { + cy.get("@sourceDashboardId").then((id) => { H.visitDashboard(id); }); } function visitPublicSourceDashboard() { - cy.get("@sourceDashboardUUID").then(uuid => { + cy.get("@sourceDashboardUUID").then((uuid) => { cy.visit(`/public/dashboard/${uuid}`); cy.findByTextEnsureVisible("Enormous Wool Car"); @@ -462,7 +462,7 @@ describe("issue 17160", () => { // 2. Check click behavior connected to a dashboard visitSourceDashboard(); - cy.get("@targetDashboardId").then(id => { + cy.get("@targetDashboardId").then((id) => { cy.intercept("POST", `/api/dashboard/${id}/dashcard/*/card/*/query`).as( "targetDashcardQuery", ); @@ -711,7 +711,7 @@ describe("issue 22265", () => { database: 1, }, }; - cy.get("@invalidQuestionId").then(invalidQuestionId => { + cy.get("@invalidQuestionId").then((invalidQuestionId) => { cy.request("PUT", `/api/card/${invalidQuestionId}`, questionDetailUpdate); }); @@ -1073,7 +1073,7 @@ describe("issue 31628", () => { const setupDashboardWithQuestionInCards = (question, cards) => { H.createDashboard().then(({ body: dashboard }) => { H.cypressWaitAll( - cards.map(card => { + cards.map((card) => { return H.createQuestionAndAddToDashboard( question, dashboard.id, @@ -1086,12 +1086,12 @@ describe("issue 31628", () => { }); }; - const assertDescendantsNotOverflowDashcards = descendantsSelector => { - cy.findAllByTestId("dashcard").should(dashcards => { + const assertDescendantsNotOverflowDashcards = (descendantsSelector) => { + cy.findAllByTestId("dashcard").should((dashcards) => { dashcards.each((dashcardIndex, dashcard) => { const descendants = dashcard.querySelectorAll(descendantsSelector); - descendants.forEach(descendant => { + descendants.forEach((descendant) => { H.assertDescendantNotOverflowsContainer( descendant, dashcard, @@ -1148,7 +1148,7 @@ describe("issue 31628", () => { */ const scalarContainer = cy.findByTestId("scalar-container"); - scalarContainer.then($element => H.assertIsEllipsified($element[0])); + scalarContainer.then(($element) => H.assertIsEllipsified($element[0])); //TODO: Need to hover on the actual text, not just the container. This is a weird one scalarContainer.realHover({ position: "bottom" }); @@ -1185,7 +1185,9 @@ describe("issue 31628", () => { */ const scalarContainer = cy.findByTestId("scalar-container"); - scalarContainer.then($element => H.assertIsNotEllipsified($element[0])); + scalarContainer.then(($element) => + H.assertIsNotEllipsified($element[0]), + ); scalarContainer.realHover(); cy.findByRole("tooltip").should("not.exist"); @@ -1200,7 +1202,7 @@ describe("issue 31628", () => { */ const scalarTitle = cy.findByTestId("scalar-title"); - scalarTitle.then($element => H.assertIsEllipsified($element[0])); + scalarTitle.then(($element) => H.assertIsEllipsified($element[0])); scalarTitle.realHover(); cy.findByRole("tooltip") @@ -1233,7 +1235,9 @@ describe("issue 31628", () => { */ const scalarContainer = cy.findByTestId("scalar-container"); - scalarContainer.then($element => H.assertIsNotEllipsified($element[0])); + scalarContainer.then(($element) => + H.assertIsNotEllipsified($element[0]), + ); scalarContainer.realHover(); cy.findByRole("tooltip").should("not.exist"); @@ -1248,7 +1252,7 @@ describe("issue 31628", () => { */ const scalarTitle = cy.findByTestId("scalar-title"); - scalarTitle.then($element => H.assertIsNotEllipsified($element[0])); + scalarTitle.then(($element) => H.assertIsNotEllipsified($element[0])); scalarTitle.realHover(); cy.findByRole("tooltip").should("not.exist"); @@ -1308,7 +1312,9 @@ describe("issue 31628", () => { */ const scalarContainer = cy.findByTestId("scalar-container"); - scalarContainer.then($element => H.assertIsNotEllipsified($element[0])); + scalarContainer.then(($element) => + H.assertIsNotEllipsified($element[0]), + ); scalarContainer.realHover(); cy.findByRole("tooltip").should("not.exist"); @@ -1323,7 +1329,7 @@ describe("issue 31628", () => { */ const scalarTitle = cy.findByTestId("legend-caption-title"); - scalarTitle.then($element => H.assertIsEllipsified($element[0])); + scalarTitle.then(($element) => H.assertIsEllipsified($element[0])); scalarTitle.realHover(); cy.findByRole("tooltip") @@ -1348,7 +1354,9 @@ describe("issue 31628", () => { previousValue.within(() => { cy.contains("34.7%").should("exist"); cy.contains("• vs. previous month: 527").should("not.exist"); - previousValue.then($element => H.assertIsNotEllipsified($element[0])); + previousValue.then(($element) => + H.assertIsNotEllipsified($element[0]), + ); }); }); @@ -1361,7 +1369,9 @@ describe("issue 31628", () => { cy.contains("34.7%").should("exist"); cy.contains("34.72%").should("not.exist"); cy.contains("• vs. previous month: 527").should("not.exist"); - previousValue.then($element => H.assertIsNotEllipsified($element[0])); + previousValue.then(($element) => + H.assertIsNotEllipsified($element[0]), + ); }); }); @@ -1374,7 +1384,9 @@ describe("issue 31628", () => { cy.contains("35%").should("exist"); cy.contains("34.72%").should("not.exist"); cy.contains("• vs. previous month: 527").should("not.exist"); - previousValue.then($element => H.assertIsNotEllipsified($element[0])); + previousValue.then(($element) => + H.assertIsNotEllipsified($element[0]), + ); }); }); @@ -1385,7 +1397,7 @@ describe("issue 31628", () => { previousValue .findByText("35%") - .then($element => H.assertIsEllipsified($element[0])); + .then(($element) => H.assertIsEllipsified($element[0])); }); }); @@ -1404,7 +1416,9 @@ describe("issue 31628", () => { */ let scalarContainer = cy.findByTestId("scalar-container"); - scalarContainer.then($element => H.assertIsNotEllipsified($element[0])); + scalarContainer.then(($element) => + H.assertIsNotEllipsified($element[0]), + ); scalarContainer.realHover(); cy.findByRole("tooltip").should("not.exist"); @@ -1419,7 +1433,7 @@ describe("issue 31628", () => { */ scalarContainer = cy.findByTestId("legend-caption-title"); - scalarContainer.then($element => H.assertIsEllipsified($element[0])); + scalarContainer.then(($element) => H.assertIsEllipsified($element[0])); scalarContainer.realHover(); cy.findByRole("tooltip") @@ -1443,7 +1457,9 @@ describe("issue 31628", () => { previousValue.within(() => { cy.contains("34.72%").should("exist"); cy.contains("• vs. previous month: 527").should("exist"); - previousValue.then($element => H.assertIsNotEllipsified($element[0])); + previousValue.then(($element) => + H.assertIsNotEllipsified($element[0]), + ); }); /** @@ -1470,7 +1486,9 @@ describe("issue 31628", () => { */ let scalarContainer = cy.findByTestId("scalar-container"); - scalarContainer.then($element => H.assertIsNotEllipsified($element[0])); + scalarContainer.then(($element) => + H.assertIsNotEllipsified($element[0]), + ); scalarContainer.realHover(); cy.findByRole("tooltip").should("not.exist"); @@ -1485,7 +1503,7 @@ describe("issue 31628", () => { */ scalarContainer = cy.findByTestId("legend-caption-title"); - scalarContainer.then($element => H.assertIsEllipsified($element[0])); + scalarContainer.then(($element) => H.assertIsEllipsified($element[0])); scalarContainer.realHover(); cy.findByRole("tooltip") @@ -1509,7 +1527,9 @@ describe("issue 31628", () => { previousValue.within(() => { cy.contains("34.72%").should("exist"); cy.contains("• vs. previous month: 527").should("exist"); - previousValue.then($element => H.assertIsNotEllipsified($element[0])); + previousValue.then(($element) => + H.assertIsNotEllipsified($element[0]), + ); }); /** @@ -1673,7 +1693,7 @@ describe("issue 43219", () => { const cardsCount = 10; - const getQuestionAlias = index => `question-${index}`; + const getQuestionAlias = (index) => `question-${index}`; beforeEach(() => { H.restore(); @@ -1749,11 +1769,11 @@ describe("issue 48878", () => { let fetchCardRequestsCount = 0; - cy.intercept("GET", "/api/card/*", request => { + cy.intercept("GET", "/api/card/*", (request) => { // we only want to simulate the race condition 4th time this request is triggered if (fetchCardRequestsCount === 2) { request.continue( - () => new Promise(resolve => setTimeout(resolve, 2000)), + () => new Promise((resolve) => setTimeout(resolve, 2000)), ); } else { request.continue(); @@ -1889,7 +1909,7 @@ SELECT 'group_2', 'sub_group_2', 52, 'group_2__sub_group_2'; "graph.metrics": ["VALUE_SUM"], }, }, - }).then(response => { + }).then((response) => { H.visitDashboard(response.body.dashboard_id); }); diff --git a/e2e/test/scenarios/dashboard-cards/dashboard-card-resizing.cy.spec.js b/e2e/test/scenarios/dashboard-cards/dashboard-card-resizing.cy.spec.js index 5a041d27387..187b1585a38 100644 --- a/e2e/test/scenarios/dashboard-cards/dashboard-card-resizing.cy.spec.js +++ b/e2e/test/scenarios/dashboard-cards/dashboard-card-resizing.cy.spec.js @@ -96,16 +96,16 @@ const VISUALIZATION_SIZES = { }, }; -const getMinSize = visualizationType => +const getMinSize = (visualizationType) => _.get(VISUALIZATION_SIZES, [visualizationType, "min"], undefined); -const getDefaultSize = visualizationType => +const getDefaultSize = (visualizationType) => _.get(VISUALIZATION_SIZES, [visualizationType, "default"], undefined); const { ORDERS, ORDERS_ID, PEOPLE } = SAMPLE_DATABASE; -const getMockQuestionName = vizType => `MOCK_${vizType}_QUESTION`; +const getMockQuestionName = (vizType) => `MOCK_${vizType}_QUESTION`; -const getCommonQuestionFields = vizType => ({ +const getCommonQuestionFields = (vizType) => ({ name: getMockQuestionName(vizType), query: { "source-table": ORDERS_ID, @@ -116,7 +116,7 @@ const getCommonQuestionFields = vizType => ({ }); // covers table, bar, line, pie, row, area, combo, pivot, funnel, detail, and waterfall questions -const createMockChartQuestion = vizType => { +const createMockChartQuestion = (vizType) => { const question = getCommonQuestionFields(vizType); return { ...question, @@ -127,7 +127,7 @@ const createMockChartQuestion = vizType => { display: vizType, visualization_settings: { "graph.dimensions": [ - Object.keys(ORDERS).find(key => ORDERS[key] === ORDERS.CREATED_AT), + Object.keys(ORDERS).find((key) => ORDERS[key] === ORDERS.CREATED_AT), ], "graph.series_order_dimension": null, "graph.series_order": null, @@ -137,7 +137,7 @@ const createMockChartQuestion = vizType => { }; // covers scalar, gauge, and progress questions -const createMockScalarQuestion = vizType => { +const createMockScalarQuestion = (vizType) => { const question = getCommonQuestionFields(vizType); return { ...question, @@ -172,8 +172,8 @@ const TEST_QUESTIONS = [ "object", "smartscalar", "waterfall", - ].map(vizType => createMockChartQuestion(vizType)), - ...["scalar", "gauge", "progress"].map(vizType => + ].map((vizType) => createMockChartQuestion(vizType)), + ...["scalar", "gauge", "progress"].map((vizType) => createMockScalarQuestion(vizType), ), createMockMapQuestion(), @@ -198,7 +198,7 @@ describe( }); it("should display all visualization cards with their default sizes", () => { - TEST_QUESTIONS.forEach(question => { + TEST_QUESTIONS.forEach((question) => { H.createQuestion(question); }); H.createDashboard().then(({ body: { id: dashId } }) => { @@ -225,7 +225,7 @@ describe( * because Cypress is too fast. */ cy.intercept("POST", "/api/card/**/query").as("cardQuery"); - sortedCards.forEach(question => { + sortedCards.forEach((question) => { cy.findByLabelText(question.name).should("be.visible").click(); cy.wait("@cardQuery"); }); @@ -244,7 +244,7 @@ describe( it("should not allow cards to be resized smaller than min height", () => { const cardIds = []; - TEST_QUESTIONS.forEach(question => { + TEST_QUESTIONS.forEach((question) => { H.createQuestion(question).then(({ body: { id } }) => { cardIds.push(id); }); @@ -363,8 +363,8 @@ describe("issue 31701", () => { }); const assertLinkCardOverflow = (link, card) => { - link.then(linkElem => { - card.then(dashCardElem => { + link.then((linkElem) => { + card.then((dashCardElem) => { expect(linkElem[0].scrollHeight).to.eq(dashCardElem[0].scrollHeight); }); }); diff --git a/e2e/test/scenarios/dashboard-cards/dashboard-drill.cy.spec.js b/e2e/test/scenarios/dashboard-cards/dashboard-drill.cy.spec.js index ce4029a05fe..9dadde3cd6e 100644 --- a/e2e/test/scenarios/dashboard-cards/dashboard-drill.cy.spec.js +++ b/e2e/test/scenarios/dashboard-cards/dashboard-drill.cy.spec.js @@ -24,7 +24,7 @@ describe("scenarios > dashboard > dashboard drill", () => { }); it("should handle URL click through on a table", () => { - createDashboardWithQuestion({}, dashboardId => { + createDashboardWithQuestion({}, (dashboardId) => { H.visitDashboard(dashboardId); cy.findByTestId("dashboard-header").icon("pencil").click(); @@ -140,10 +140,10 @@ describe("scenarios > dashboard > dashboard drill", () => { }; createQuestion( { query, visualization_settings: questionSettings }, - questionId => { + (questionId) => { createDashboard( { questionId, visualization_settings: dashCardSettings }, - dashboardIdA => H.visitDashboard(dashboardIdA), + (dashboardIdA) => H.visitDashboard(dashboardIdA), ); }, ); @@ -159,7 +159,7 @@ describe("scenarios > dashboard > dashboard drill", () => { }); it("should handle question click through on a table", () => { - createDashboardWithQuestion({}, dashboardId => + createDashboardWithQuestion({}, (dashboardId) => H.visitDashboard(dashboardId), ); @@ -206,13 +206,13 @@ describe("scenarios > dashboard > dashboard drill", () => { }); it("should handle dashboard click through on a table", () => { - createQuestion({}, questionId => { + createQuestion({}, (questionId) => { createDashboard( { dashboardName: "start dash", questionId }, - dashboardIdA => { + (dashboardIdA) => { createDashboardWithQuestion( { dashboardName: "end dash" }, - dashboardIdB => { + (dashboardIdB) => { H.visitDashboard(dashboardIdA); }, ); @@ -274,7 +274,7 @@ describe("scenarios > dashboard > dashboard drill", () => { }); it("should open the same dashboard when a custom URL click behavior points to the same dashboard (metabase#22702)", () => { - createDashboardWithQuestion({}, dashboardId => { + createDashboardWithQuestion({}, (dashboardId) => { H.visitDashboard(dashboardId); H.editDashboard(); H.showDashboardCardActions(); @@ -310,7 +310,7 @@ describe("scenarios > dashboard > dashboard drill", () => { // This was flaking. Example: https://dashboard.cypress.io/projects/a394u1/runs/2109/test-results/91a15b66-4b80-40bf-b569-de28abe21f42 it.skip("should handle cross-filter on a table", () => { - createDashboardWithQuestion({}, dashboardId => + createDashboardWithQuestion({}, (dashboardId) => H.visitDashboard(dashboardId), ); cy.icon("pencil").click(); @@ -555,7 +555,7 @@ describe("scenarios > dashboard > dashboard drill", () => { cy.findByText("View details").click(); cy.log("Reported on v0.29.3"); - cy.wait("@dataset").then(xhr => { + cy.wait("@dataset").then((xhr) => { expect(xhr.response.body.error).not.to.exist; }); cy.findByTestId("object-detail").findByText("Fantastic Wool Shirt"); @@ -703,12 +703,15 @@ describe("scenarios > dashboard > dashboard drill", () => { }, }; - createQuestion({ visualization_settings: questionSettings }, questionId => { - createDashboard( - { questionId, visualization_settings: dashCardSettings }, - dashboardIdA => H.visitDashboard(dashboardIdA), - ); - }); + createQuestion( + { visualization_settings: questionSettings }, + (questionId) => { + createDashboard( + { questionId, visualization_settings: dashCardSettings }, + (dashboardIdA) => H.visitDashboard(dashboardIdA), + ); + }, + ); // formatting works, so we see "USD" in the table // eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage @@ -832,7 +835,7 @@ describe("scenarios > dashboard > dashboard drill", () => { .contains("1") .click(); - cy.wait("@dataset").then(xhr => { + cy.wait("@dataset").then((xhr) => { expect(xhr.response.body.error).to.not.exist; }); cy.findByTestId("object-detail").within(() => { @@ -1014,7 +1017,7 @@ function createDashboardWithQuestion( { dashboardName = "dashboard" } = {}, callback, ) { - createQuestion({}, questionId => { + createQuestion({}, (questionId) => { createDashboard({ dashboardName, questionId }, callback); }); } diff --git a/e2e/test/scenarios/dashboard-filters-2/dashboard-filters-2-stage-4.cy.spec.ts b/e2e/test/scenarios/dashboard-filters-2/dashboard-filters-2-stage-4.cy.spec.ts index b2d3632610d..20bc4799ee7 100644 --- a/e2e/test/scenarios/dashboard-filters-2/dashboard-filters-2-stage-4.cy.spec.ts +++ b/e2e/test/scenarios/dashboard-filters-2/dashboard-filters-2-stage-4.cy.spec.ts @@ -261,7 +261,7 @@ describe("scenarios > dashboard > filters > query stages", () => { }); cy.log("public dashboard"); - QSHelpers.getDashboardId().then(dashboardId => + QSHelpers.getDashboardId().then((dashboardId) => H.visitPublicDashboard(dashboardId), ); QSHelpers.waitForPublicDashboardData(); @@ -276,7 +276,7 @@ describe("scenarios > dashboard > filters > query stages", () => { }); cy.log("embedded dashboard"); - QSHelpers.getDashboardId().then(dashboardId => { + QSHelpers.getDashboardId().then((dashboardId) => { H.visitEmbeddedPage({ resource: { dashboard: dashboardId }, params: {}, @@ -424,7 +424,7 @@ describe("scenarios > dashboard > filters > query stages", () => { }); cy.log("public dashboard"); - QSHelpers.getDashboardId().then(dashboardId => + QSHelpers.getDashboardId().then((dashboardId) => H.visitPublicDashboard(dashboardId), ); QSHelpers.waitForPublicDashboardData(); @@ -439,7 +439,7 @@ describe("scenarios > dashboard > filters > query stages", () => { }); cy.log("embedded dashboard"); - QSHelpers.getDashboardId().then(dashboardId => { + QSHelpers.getDashboardId().then((dashboardId) => { H.visitEmbeddedPage({ resource: { dashboard: dashboardId }, params: {}, @@ -493,7 +493,7 @@ describe("scenarios > dashboard > filters > query stages", () => { }); cy.log("public dashboard"); - QSHelpers.getDashboardId().then(dashboardId => + QSHelpers.getDashboardId().then((dashboardId) => H.visitPublicDashboard(dashboardId), ); QSHelpers.waitForPublicDashboardData(); @@ -514,7 +514,7 @@ describe("scenarios > dashboard > filters > query stages", () => { }); cy.log("embedded dashboard"); - QSHelpers.getDashboardId().then(dashboardId => { + QSHelpers.getDashboardId().then((dashboardId) => { H.visitEmbeddedPage({ resource: { dashboard: dashboardId }, params: {}, @@ -574,7 +574,7 @@ describe("scenarios > dashboard > filters > query stages", () => { }); cy.log("public dashboard"); - QSHelpers.getDashboardId().then(dashboardId => + QSHelpers.getDashboardId().then((dashboardId) => H.visitPublicDashboard(dashboardId), ); QSHelpers.waitForPublicDashboardData(); @@ -601,7 +601,7 @@ describe("scenarios > dashboard > filters > query stages", () => { }); cy.log("embedded dashboard"); - QSHelpers.getDashboardId().then(dashboardId => { + QSHelpers.getDashboardId().then((dashboardId) => { H.visitEmbeddedPage({ resource: { dashboard: dashboardId }, params: {}, diff --git a/e2e/test/scenarios/dashboard-filters-2/dashboard-filters-2-stage.cy.spec.ts b/e2e/test/scenarios/dashboard-filters-2/dashboard-filters-2-stage.cy.spec.ts index 8ba883f03b8..8bfcb5ad932 100644 --- a/e2e/test/scenarios/dashboard-filters-2/dashboard-filters-2-stage.cy.spec.ts +++ b/e2e/test/scenarios/dashboard-filters-2/dashboard-filters-2-stage.cy.spec.ts @@ -1174,7 +1174,7 @@ describe("scenarios > dashboard > filters > query stages", () => { }); cy.log("public dashboard"); - QSHelpers.getDashboardId().then(dashboardId => + QSHelpers.getDashboardId().then((dashboardId) => H.visitPublicDashboard(dashboardId), ); QSHelpers.waitForPublicDashboardData(); @@ -1189,7 +1189,7 @@ describe("scenarios > dashboard > filters > query stages", () => { }); cy.log("embedded dashboard"); - QSHelpers.getDashboardId().then(dashboardId => { + QSHelpers.getDashboardId().then((dashboardId) => { H.visitEmbeddedPage({ resource: { dashboard: dashboardId }, params: {}, @@ -1337,7 +1337,7 @@ describe("scenarios > dashboard > filters > query stages", () => { }); cy.log("public dashboard"); - QSHelpers.getDashboardId().then(dashboardId => + QSHelpers.getDashboardId().then((dashboardId) => H.visitPublicDashboard(dashboardId), ); QSHelpers.waitForPublicDashboardData(); @@ -1352,7 +1352,7 @@ describe("scenarios > dashboard > filters > query stages", () => { }); cy.log("embedded dashboard"); - QSHelpers.getDashboardId().then(dashboardId => { + QSHelpers.getDashboardId().then((dashboardId) => { H.visitEmbeddedPage({ resource: { dashboard: dashboardId }, params: {}, @@ -1406,7 +1406,7 @@ describe("scenarios > dashboard > filters > query stages", () => { }); cy.log("public dashboard"); - QSHelpers.getDashboardId().then(dashboardId => + QSHelpers.getDashboardId().then((dashboardId) => H.visitPublicDashboard(dashboardId), ); QSHelpers.waitForPublicDashboardData(); @@ -1427,7 +1427,7 @@ describe("scenarios > dashboard > filters > query stages", () => { }); cy.log("embedded dashboard"); - QSHelpers.getDashboardId().then(dashboardId => { + QSHelpers.getDashboardId().then((dashboardId) => { H.visitEmbeddedPage({ resource: { dashboard: dashboardId }, params: {}, @@ -1487,7 +1487,7 @@ describe("scenarios > dashboard > filters > query stages", () => { }); cy.log("public dashboard"); - QSHelpers.getDashboardId().then(dashboardId => + QSHelpers.getDashboardId().then((dashboardId) => H.visitPublicDashboard(dashboardId), ); QSHelpers.waitForPublicDashboardData(); @@ -1514,7 +1514,7 @@ describe("scenarios > dashboard > filters > query stages", () => { }); cy.log("embedded dashboard"); - QSHelpers.getDashboardId().then(dashboardId => { + QSHelpers.getDashboardId().then((dashboardId) => { H.visitEmbeddedPage({ resource: { dashboard: dashboardId }, params: {}, diff --git a/e2e/test/scenarios/dashboard-filters-2/dashboard-filters-misc.cy.spec.ts b/e2e/test/scenarios/dashboard-filters-2/dashboard-filters-misc.cy.spec.ts index 4329b78724a..3d64f04a209 100644 --- a/e2e/test/scenarios/dashboard-filters-2/dashboard-filters-misc.cy.spec.ts +++ b/e2e/test/scenarios/dashboard-filters-2/dashboard-filters-misc.cy.spec.ts @@ -151,7 +151,7 @@ describe("pivot tables", () => { query: createPivotableQuery(this.baseQuestion), name: "Question - pivot viz", display: "pivot", - }).then(response => { + }).then((response) => { const card = response.body; QSHelpers.createAndVisitDashboard([card]); }); diff --git a/e2e/test/scenarios/dashboard-filters-2/shared/dashboard-filters-query-stages.ts b/e2e/test/scenarios/dashboard-filters-2/shared/dashboard-filters-query-stages.ts index f35cdc979d9..4020ee7c0a9 100644 --- a/e2e/test/scenarios/dashboard-filters-2/shared/dashboard-filters-query-stages.ts +++ b/e2e/test/scenarios/dashboard-filters-2/shared/dashboard-filters-query-stages.ts @@ -100,7 +100,7 @@ export function createBaseQuestions() { query: { "source-table": ORDERS_ID, }, - }).then(response => cy.wrap(response.body).as("ordersQuestion")); + }).then((response) => cy.wrap(response.body).as("ordersQuestion")); cy.then(function () { H.createQuestion({ @@ -109,7 +109,7 @@ export function createBaseQuestions() { query: { "source-table": `card__${this.ordersQuestion.id}`, }, - }).then(response => cy.wrap(response.body).as("baseQuestion")); + }).then((response) => cy.wrap(response.body).as("baseQuestion")); H.createQuestion({ type: "model", @@ -117,7 +117,7 @@ export function createBaseQuestions() { query: { "source-table": `card__${this.ordersQuestion.id}`, }, - }).then(response => cy.wrap(response.body).as("baseModel")); + }).then((response) => cy.wrap(response.body).as("baseModel")); }); } @@ -332,25 +332,25 @@ export function createAndVisitDashboardWithCardMatrix( type: "question", query: createQuery(this.baseQuestion), name: "Question-based Question", - }).then(response => cy.wrap(response.body).as("qbq")); + }).then((response) => cy.wrap(response.body).as("qbq")); H.createQuestion({ type: "question", query: createQuery(this.baseModel), name: "Model-based Question", - }).then(response => cy.wrap(response.body).as("mbq")); + }).then((response) => cy.wrap(response.body).as("mbq")); H.createQuestion({ type: "model", name: "Question-based Model", query: createQuery(this.baseQuestion), - }).then(response => cy.wrap(response.body).as("qbm")); + }).then((response) => cy.wrap(response.body).as("qbm")); H.createQuestion({ type: "model", name: "Model-based Model", query: createQuery(this.baseModel), - }).then(response => cy.wrap(response.body).as("mbm")); + }).then((response) => cy.wrap(response.body).as("mbm")); }); cy.then(function () { @@ -382,7 +382,7 @@ export function createAndVisitDashboard(cards: Card[]) { card_id: card.id, })), ], - }).then(dashboard => { + }).then((dashboard) => { H.visitDashboard(dashboard.id); cy.wrap(dashboard.id).as("dashboardId"); cy.wait("@getDashboard"); @@ -736,7 +736,7 @@ export function goBackToDashboard() { export function getDashboardId(): Cypress.Chainable { return cy .get("@dashboardId") - .then(dashboardId => dashboardId as unknown as number); + .then((dashboardId) => dashboardId as unknown as number); } export function waitForPublicDashboardData() { @@ -793,7 +793,7 @@ export function verifyPopoverMappingOptions(sections: MappingSection[]) { ); H.popover().within(() => { - getPopoverItems().then($items => { + getPopoverItems().then(($items) => { let index = 0; for (const [sectionName, columnNames] of sections) { diff --git a/e2e/test/scenarios/dashboard-filters/dashboard-chained-filters.cy.spec.js b/e2e/test/scenarios/dashboard-filters/dashboard-chained-filters.cy.spec.js index 09815f56511..bb125198bc7 100644 --- a/e2e/test/scenarios/dashboard-filters/dashboard-chained-filters.cy.spec.js +++ b/e2e/test/scenarios/dashboard-filters/dashboard-chained-filters.cy.spec.js @@ -185,13 +185,13 @@ describe("scenarios > dashboard > chained filter", () => { cy.signInAsAdmin(); H.resyncDatabase({ tableName: TEST_TABLE, tableAlias: "testTable" }); - cy.get("@testTable").then(testTable => { + cy.get("@testTable").then((testTable) => { const testTableId = testTable.id; const uuidFieldId = testTable.fields.find( - field => field.name === "uuid", + (field) => field.name === "uuid", ).id; const idFieldId = testTable.fields.find( - field => field.name === "id", + (field) => field.name === "id", ).id; cy.wrap(testTableId).as("testTableId"); diff --git a/e2e/test/scenarios/dashboard-filters/dashboard-filter-data-permissions.cy.spec.js b/e2e/test/scenarios/dashboard-filters/dashboard-filter-data-permissions.cy.spec.js index 6da493825d1..4818e5d7426 100644 --- a/e2e/test/scenarios/dashboard-filters/dashboard-filter-data-permissions.cy.spec.js +++ b/e2e/test/scenarios/dashboard-filters/dashboard-filter-data-permissions.cy.spec.js @@ -66,7 +66,7 @@ describe("support > permissions (metabase#8472)", () => { method: "GET", url: `/api/dashboard/${ORDERS_DASHBOARD_ID}`, failOnStatusCode: false, - }).should(xhr => { + }).should((xhr) => { expect(xhr.status).to.equal(403); }); }); diff --git a/e2e/test/scenarios/dashboard-filters/dashboard-filters-auto-apply.cy.spec.js b/e2e/test/scenarios/dashboard-filters/dashboard-filters-auto-apply.cy.spec.js index be547221257..c3428bac6ea 100644 --- a/e2e/test/scenarios/dashboard-filters/dashboard-filters-auto-apply.cy.spec.js +++ b/e2e/test/scenarios/dashboard-filters/dashboard-filters-auto-apply.cy.spec.js @@ -426,7 +426,7 @@ describe( describe("public embeds", () => { it("should apply filters after clicking the apply button when auto-apply filters is turned off", () => { createDashboard({ dashboardDetails: { auto_apply_filters: false } }); - cy.get("@dashboardId").then(dashboardId => { + cy.get("@dashboardId").then((dashboardId) => { H.visitPublicDashboard(dashboardId); }); @@ -471,7 +471,7 @@ describe( }, }, }); - cy.get("@dashboardId").then(dashboardId => { + cy.get("@dashboardId").then((dashboardId) => { const embeddingPayload = { resource: { dashboard: dashboardId }, params: {}, @@ -529,7 +529,7 @@ describe( auto_apply_filters: false, }, }); - cy.get("@dashboardId").then(dashboardId => { + cy.get("@dashboardId").then((dashboardId) => { visitFullAppEmbeddingUrl({ url: `/dashboard/${dashboardId}`, qs: { side_nav: false, logo: false }, @@ -695,7 +695,7 @@ const createDashboard = ({ }; const getParameterMapping = ({ card_id }, parameters) => ({ - parameter_mappings: parameters.map(parameter => { + parameter_mappings: parameters.map((parameter) => { return { card_id, parameter_id: parameter.id, @@ -717,7 +717,7 @@ const openSlowDashboard = (params = {}) => { "cardQuery", ); - cy.get("@dashboardId").then(dashboardId => { + cy.get("@dashboardId").then((dashboardId) => { return cy.visit({ url: `/dashboard/${dashboardId}`, qs: params, @@ -732,7 +732,7 @@ const openSlowPublicDashboard = (params = {}) => { "cardQuery", ); - cy.get("@dashboardId").then(dashboardId => { + cy.get("@dashboardId").then((dashboardId) => { H.visitPublicDashboard(dashboardId, { params }); }); @@ -744,7 +744,7 @@ const openSlowEmbeddingDashboard = (params = {}) => { "cardQuery", ); - cy.get("@dashboardId").then(dashboardId => { + cy.get("@dashboardId").then((dashboardId) => { const embeddingPayload = { resource: { dashboard: dashboardId }, params: {}, @@ -762,7 +762,7 @@ const openSlowFullAppEmbeddingDashboard = (params = {}) => { "cardQuery", ); - cy.get("@dashboardId").then(dashboardId => { + cy.get("@dashboardId").then((dashboardId) => { visitFullAppEmbeddingUrl({ url: `/dashboard/${dashboardId}`, qs: params, diff --git a/e2e/test/scenarios/dashboard-filters/dashboard-filters-auto-wiring.cy.spec.js b/e2e/test/scenarios/dashboard-filters/dashboard-filters-auto-wiring.cy.spec.js index e002de0224d..a59530f5bee 100644 --- a/e2e/test/scenarios/dashboard-filters/dashboard-filters-auto-wiring.cy.spec.js +++ b/e2e/test/scenarios/dashboard-filters/dashboard-filters-auto-wiring.cy.spec.js @@ -34,7 +34,7 @@ describe("dashboard filters auto-wiring", () => { describe("parameter mapping", () => { it("should wire parameters to cards with matching fields", () => { - createDashboardWithCards({ cards }).then(dashboardId => { + createDashboardWithCards({ cards }).then((dashboardId) => { H.visitDashboard(dashboardId); }); @@ -80,7 +80,7 @@ describe("dashboard filters auto-wiring", () => { }); it("should not wire parameters to cards that already have a parameter, despite matching fields", () => { - createDashboardWithCards({ cards }).then(dashboardId => { + createDashboardWithCards({ cards }).then((dashboardId) => { H.visitDashboard(dashboardId); }); @@ -141,7 +141,7 @@ describe("dashboard filters auto-wiring", () => { size_y: 4, }, ], - }).then(dashboardId => { + }).then((dashboardId) => { H.visitDashboard(dashboardId); }); }); @@ -156,7 +156,7 @@ describe("dashboard filters auto-wiring", () => { }); it("should undo parameter wiring when 'Undo' is clicked", () => { - createDashboardWithCards({ cards }).then(dashboardId => { + createDashboardWithCards({ cards }).then((dashboardId) => { H.visitDashboard(dashboardId); }); @@ -209,7 +209,7 @@ describe("dashboard filters auto-wiring", () => { }, ]; - createDashboardWithCards({ cards }).then(dashboardId => { + createDashboardWithCards({ cards }).then((dashboardId) => { H.visitDashboard(dashboardId); }); @@ -238,7 +238,7 @@ describe("dashboard filters auto-wiring", () => { describe("multiple tabs", () => { it("should not wire parameters to cards in different tabs", () => { - createDashboardWithCards({ cards }).then(dashboardId => { + createDashboardWithCards({ cards }).then((dashboardId) => { H.visitDashboardAndCreateTab({ dashboardId, save: false, @@ -275,7 +275,7 @@ describe("dashboard filters auto-wiring", () => { describe("add a card", () => { it("should wire parameters to cards that are added to the dashboard", () => { - createDashboardWithCards({ cards }).then(dashboardId => { + createDashboardWithCards({ cards }).then((dashboardId) => { H.visitDashboard(dashboardId); }); @@ -319,7 +319,7 @@ describe("dashboard filters auto-wiring", () => { }); it("should undo parameter wiring when 'Undo' is clicked", () => { - createDashboardWithCards({ cards }).then(dashboardId => { + createDashboardWithCards({ cards }).then((dashboardId) => { H.visitDashboard(dashboardId); }); @@ -357,7 +357,7 @@ describe("dashboard filters auto-wiring", () => { describe("multiple tabs", () => { it("should not wire parameters to cards that are added to the dashboard in a different tab", () => { - createDashboardWithCards({ cards }).then(dashboardId => { + createDashboardWithCards({ cards }).then((dashboardId) => { H.visitDashboard(dashboardId); }); @@ -416,7 +416,7 @@ describe("dashboard filters auto-wiring", () => { describe("replace a card", () => { it("should show auto-wire suggestion toast when a card is replaced", () => { - createDashboardWithCards({ cards }).then(dashboardId => { + createDashboardWithCards({ cards }).then((dashboardId) => { H.visitDashboard(dashboardId); }); @@ -545,11 +545,11 @@ describe("dashboard filters auto-wiring", () => { H.selectDashboardFilter(H.getDashboardCard(0), "ID"); H.saveDashboard(); - cy.get("@ordersQuestionId").then(ordersQuestionId => { + cy.get("@ordersQuestionId").then((ordersQuestionId) => { addQuestionFromQueryBuilder({ questionId: ordersQuestionId }); }); - cy.get("@reviewsQuestionId").then(reviewsQuestionId => { + cy.get("@reviewsQuestionId").then((reviewsQuestionId) => { addQuestionFromQueryBuilder({ questionId: reviewsQuestionId, saveDashboardAfterAdd: false, @@ -591,7 +591,7 @@ describe("dashboard filters auto-wiring", () => { describe("dismiss toasts", () => { it("should dismiss auto-wire toasts on filter removal", () => { - createDashboardWithCards({ cards }).then(dashboardId => { + createDashboardWithCards({ cards }).then((dashboardId) => { H.visitDashboard(dashboardId); }); @@ -614,7 +614,7 @@ describe("dashboard filters auto-wiring", () => { }); it("should dismiss auto-wire toasts on card removal", () => { - createDashboardWithCards({ cards }).then(dashboardId => { + createDashboardWithCards({ cards }).then((dashboardId) => { H.visitDashboard(dashboardId); }); @@ -639,7 +639,7 @@ describe("dashboard filters auto-wiring", () => { }); it("should dismiss toasts on timeout", () => { - createDashboardWithCards({ cards }).then(dashboardId => { + createDashboardWithCards({ cards }).then((dashboardId) => { H.visitDashboard(dashboardId); }); @@ -700,7 +700,7 @@ describe("dashboard filters auto-wiring", () => { const dashboardDetails = { parameters: [sourceParameter, categoryParameter], }; - const getParameterMappings = card => [ + const getParameterMappings = (card) => [ { card_id: card.id, parameter_id: sourceParameter.id, @@ -794,10 +794,10 @@ function removeFilterFromDashCard(dashcardIndex = 0) { } function getTableCell(columnName, rowIndex) { - cy.findAllByRole("columnheader").then($columnHeaders => { + cy.findAllByRole("columnheader").then(($columnHeaders) => { const columnHeaderIndex = $columnHeaders .toArray() - .findIndex($columnHeader => $columnHeader.textContent === columnName); + .findIndex(($columnHeader) => $columnHeader.textContent === columnName); // eslint-disable-next-line no-unsafe-element-filtering const row = cy.findAllByRole("row").eq(rowIndex); // eslint-disable-next-line no-unsafe-element-filtering diff --git a/e2e/test/scenarios/dashboard-filters/dashboard-filters-explicit-join.cy.spec.js b/e2e/test/scenarios/dashboard-filters/dashboard-filters-explicit-join.cy.spec.js index c8ea3452bc4..360ab58590d 100644 --- a/e2e/test/scenarios/dashboard-filters/dashboard-filters-explicit-join.cy.spec.js +++ b/e2e/test/scenarios/dashboard-filters/dashboard-filters-explicit-join.cy.spec.js @@ -101,7 +101,7 @@ describe("scenarios > dashboard > filters", () => { }); function selectFromDropdown(values) { - values.forEach(value => { + values.forEach((value) => { cy.findByLabelText(value).should("be.visible").click(); }); } diff --git a/e2e/test/scenarios/dashboard-filters/dashboard-filters-number-source.cy.spec.js b/e2e/test/scenarios/dashboard-filters/dashboard-filters-number-source.cy.spec.js index a3925b42e7f..c29b4d2fc49 100644 --- a/e2e/test/scenarios/dashboard-filters/dashboard-filters-number-source.cy.spec.js +++ b/e2e/test/scenarios/dashboard-filters/dashboard-filters-number-source.cy.spec.js @@ -176,7 +176,7 @@ const getDashboardResource = ({ dashboard_id }) => ({ params: {}, }); -const getTargetDashboard = sourceSettings => ({ +const getTargetDashboard = (sourceSettings) => ({ parameters: [ { ...targetParameter, @@ -189,7 +189,7 @@ const getTargetDashboard = sourceSettings => ({ }, }); -const getListDashboard = values_query_type => { +const getListDashboard = (values_query_type) => { return getTargetDashboard({ values_source_type: "static-list", values_query_type, diff --git a/e2e/test/scenarios/dashboard-filters/dashboard-filters-reset-clear.cy.spec.ts b/e2e/test/scenarios/dashboard-filters/dashboard-filters-reset-clear.cy.spec.ts index 0b5ddc301d3..be4371bff12 100644 --- a/e2e/test/scenarios/dashboard-filters/dashboard-filters-reset-clear.cy.spec.ts +++ b/e2e/test/scenarios/dashboard-filters/dashboard-filters-reset-clear.cy.spec.ts @@ -615,7 +615,7 @@ describe("scenarios > dashboard > filters > reset & clear", () => { value .split(",") .filter(Boolean) - .forEach(value => { + .forEach((value) => { cy.findAllByRole("listitem").contains(value).click(); }); }); @@ -631,7 +631,7 @@ describe("scenarios > dashboard > filters > reset & clear", () => { value .split(",") .filter(Boolean) - .forEach(value => { + .forEach((value) => { cy.findAllByRole("listitem").contains(value).click(); }); }); @@ -784,7 +784,7 @@ function createDashboardWithParameters( cards: [ { card_id: questionId, - parameter_mappings: parameters?.map(parameter => ({ + parameter_mappings: parameters?.map((parameter) => ({ parameter_id: parameter.id, card_id: questionId, target: ["dimension", targetField], @@ -1059,7 +1059,7 @@ function createDashboardWithParameterInEachTab({ ], }, ], - }).then(dashboard => H.visitDashboard(dashboard.id)); + }).then((dashboard) => H.visitDashboard(dashboard.id)); } function checkResetAllFiltersWorksAcrossTabs({ diff --git a/e2e/test/scenarios/dashboard-filters/dashboard-filters-source.cy.spec.js b/e2e/test/scenarios/dashboard-filters/dashboard-filters-source.cy.spec.js index b60835e91c7..61f7eff8a9f 100644 --- a/e2e/test/scenarios/dashboard-filters/dashboard-filters-source.cy.spec.js +++ b/e2e/test/scenarios/dashboard-filters/dashboard-filters-source.cy.spec.js @@ -297,8 +297,10 @@ describe( }); H.getTable({ databaseId: WRITABLE_DB_ID, name: TABLE_NAME }).then( - table => { - const countField = table.fields.find(field => field.name === "count"); + (table) => { + const countField = table.fields.find( + (field) => field.name === "count", + ); cy.request("PUT", `/api/field/${countField.id}`, { semantic_type: "type/Quantity", }); @@ -451,7 +453,7 @@ const getDashboardResource = ({ dashboard_id }) => ({ params: {}, }); -const getTargetDashboard = sourceSettings => ({ +const getTargetDashboard = (sourceSettings) => ({ parameters: [ { ...targetParameter, @@ -464,7 +466,7 @@ const getTargetDashboard = sourceSettings => ({ }, }); -const getStructuredDashboard = questionId => { +const getStructuredDashboard = (questionId) => { return getTargetDashboard({ values_source_type: "card", values_source_config: { @@ -474,7 +476,7 @@ const getStructuredDashboard = questionId => { }); }; -const getNativeDashboard = questionId => { +const getNativeDashboard = (questionId) => { return getTargetDashboard({ values_source_type: "card", values_source_config: { @@ -484,7 +486,7 @@ const getNativeDashboard = questionId => { }); }; -const getListDashboard = values_query_type => { +const getListDashboard = (values_query_type) => { return getTargetDashboard({ values_source_type: "static-list", values_query_type, diff --git a/e2e/test/scenarios/dashboard-filters/dashboard-filters-sql-number.cy.spec.js b/e2e/test/scenarios/dashboard-filters/dashboard-filters-sql-number.cy.spec.js index 91ba883b673..d2855be1fdd 100644 --- a/e2e/test/scenarios/dashboard-filters/dashboard-filters-sql-number.cy.spec.js +++ b/e2e/test/scenarios/dashboard-filters/dashboard-filters-sql-number.cy.spec.js @@ -125,7 +125,7 @@ describe("scenarios > dashboard > filters > SQL > number", () => { }, ]; - const parameterMapping = filterDetails.map(filter => ({ + const parameterMapping = filterDetails.map((filter) => ({ parameter_id: filter.id, target: ["variable", ["template-tag", filter.slug]], })); @@ -155,7 +155,7 @@ describe("scenarios > dashboard > filters > SQL > number", () => { id, card_id, ...dashcardDetails, - parameter_mappings: parameterMapping.map(mapping => ({ + parameter_mappings: parameterMapping.map((mapping) => ({ ...mapping, card_id, })), diff --git a/e2e/test/scenarios/dashboard-filters/dashboard-filters-sql-required-field-filter.cy.spec.js b/e2e/test/scenarios/dashboard-filters/dashboard-filters-sql-required-field-filter.cy.spec.js index c2cab83f4fe..ffb9fcfa61d 100644 --- a/e2e/test/scenarios/dashboard-filters/dashboard-filters-sql-required-field-filter.cy.spec.js +++ b/e2e/test/scenarios/dashboard-filters/dashboard-filters-sql-required-field-filter.cy.spec.js @@ -24,7 +24,7 @@ const questionDetails = { }, }; -const questionDetailsWithRequiredFilter = produce(questionDetails, draft => { +const questionDetailsWithRequiredFilter = produce(questionDetails, (draft) => { draft.native["template-tags"].filter.required = true; }); diff --git a/e2e/test/scenarios/dashboard-filters/dashboard-filters-text-category.cy.spec.js b/e2e/test/scenarios/dashboard-filters/dashboard-filters-text-category.cy.spec.js index 39fb5a715cf..3c8f65615c6 100644 --- a/e2e/test/scenarios/dashboard-filters/dashboard-filters-text-category.cy.spec.js +++ b/e2e/test/scenarios/dashboard-filters/dashboard-filters-text-category.cy.spec.js @@ -262,7 +262,7 @@ describe("scenarios > dashboard > filters > text/category", () => { }); function waitDashboardCardQuery() { - cy.get("@dashCardId").then(id => { + cy.get("@dashCardId").then((id) => { cy.wait(`@dashcardQuery${id}`); }); } diff --git a/e2e/test/scenarios/dashboard-filters/parameters.cy.spec.js b/e2e/test/scenarios/dashboard-filters/parameters.cy.spec.js index c22f275ba80..806d5da3adf 100644 --- a/e2e/test/scenarios/dashboard-filters/parameters.cy.spec.js +++ b/e2e/test/scenarios/dashboard-filters/parameters.cy.spec.js @@ -598,7 +598,7 @@ describe("scenarios > dashboard > parameters", () => { describe("when parameters are (dis)connected to dashcards", () => { beforeEach(() => { - createDashboardWithCards({ cards }).then(dashboardId => + createDashboardWithCards({ cards }).then((dashboardId) => H.visitDashboard(dashboardId), ); @@ -735,7 +735,9 @@ describe("scenarios > dashboard > parameters", () => { cy.visit("/collection/root"); cy.wait("@getPinnedItems"); - cy.get("@dashboardId").then(dashboardId => H.visitDashboard(dashboardId)); + cy.get("@dashboardId").then((dashboardId) => + H.visitDashboard(dashboardId), + ); H.filterWidget() .findByRole("listitem") @@ -763,7 +765,9 @@ describe("scenarios > dashboard > parameters", () => { cy.log("reset filter values from url by visiting dashboard by id"); - cy.get("@dashboardId").then(dashboardId => H.visitDashboard(dashboardId)); + cy.get("@dashboardId").then((dashboardId) => + H.visitDashboard(dashboardId), + ); H.filterWidget().icon("close").click(); @@ -773,7 +777,9 @@ describe("scenarios > dashboard > parameters", () => { cy.log("verify filter value is not specified after reload"); - cy.get("@dashboardId").then(dashboardId => H.visitDashboard(dashboardId)); + cy.get("@dashboardId").then((dashboardId) => + H.visitDashboard(dashboardId), + ); H.getDashboardCard() .findByText("761 Fish Hill Road") diff --git a/e2e/test/scenarios/dashboard-filters/temporal-unit-parameters.cy.spec.js b/e2e/test/scenarios/dashboard-filters/temporal-unit-parameters.cy.spec.js index 0eacba3a041..6704b784016 100644 --- a/e2e/test/scenarios/dashboard-filters/temporal-unit-parameters.cy.spec.js +++ b/e2e/test/scenarios/dashboard-filters/temporal-unit-parameters.cy.spec.js @@ -175,7 +175,7 @@ const nativeTimeQuestionDetails = { }, }; -const getNativeTimeQuestionBasedQuestionDetails = card => ({ +const getNativeTimeQuestionBasedQuestionDetails = (card) => ({ query: { "source-table": `card__${card.id}`, aggregation: [["count"]], @@ -191,7 +191,7 @@ const parameterDetails = { sectionId: "temporal-unit", }; -const getParameterMapping = card => ({ +const getParameterMapping = (card) => ({ card_id: card.id, parameter_id: parameterDetails.id, target: [ @@ -437,7 +437,7 @@ describe("scenarios > dashboard > temporal unit parameters", () => { }); it("should connect a parameter to multiple questions within a dashcard and drill thru", () => { - createDashboardWithMultiSeriesCard().then(dashboard => + createDashboardWithMultiSeriesCard().then((dashboard) => H.visitDashboard(dashboard.id), ); @@ -484,7 +484,7 @@ describe("scenarios > dashboard > temporal unit parameters", () => { it("should pass a temporal unit with 'update dashboard filter' click behavior", () => { createDashboardWithMappedQuestion({ extraQuestions: [nativeUnitQuestionDetails], - }).then(dashboard => { + }).then((dashboard) => { cy.wrap(dashboard.id).as("dashboardId"); H.visitDashboard(dashboard.id); }); @@ -601,7 +601,7 @@ describe("scenarios > dashboard > temporal unit parameters", () => { dashboardDetails: { name: "Target dashboard", }, - }).then(dashboard => cy.wrap(dashboard.id).as("targetDashboardId")); + }).then((dashboard) => cy.wrap(dashboard.id).as("targetDashboardId")); H.createDashboardWithQuestions({ dashboardDetails: { name: "Source dashboard", @@ -625,7 +625,7 @@ describe("scenarios > dashboard > temporal unit parameters", () => { cy.findByText("UNIT").should("be.visible"); cy.findByText(parameterDetails.name).should("not.exist"); }); - cy.get("@targetDashboardId").then(targetDashboardId => { + cy.get("@targetDashboardId").then((targetDashboardId) => { H.modal().within(() => { cy.findByPlaceholderText("e.g. http://acme.com/id/{{user_id}}").type( `http://localhost:4000/dashboard/${targetDashboardId}?${parameterDetails.slug}={{UNIT}}`, @@ -654,7 +654,7 @@ describe("scenarios > dashboard > temporal unit parameters", () => { it("should not allow to use temporal unit parameter values with SQL queries", () => { H.createNativeQuestion(nativeQuestionWithTextParameterDetails); - createDashboardWithMappedQuestion().then(dashboard => + createDashboardWithMappedQuestion().then((dashboard) => H.visitDashboard(dashboard.id), ); @@ -800,7 +800,7 @@ describe("scenarios > dashboard > temporal unit parameters", () => { describe("parameter settings", () => { it("should be able to set available temporal units", () => { - createDashboardWithMappedQuestion().then(dashboard => + createDashboardWithMappedQuestion().then((dashboard) => H.visitDashboard(dashboard.id), ); @@ -827,7 +827,7 @@ describe("scenarios > dashboard > temporal unit parameters", () => { }); it("should clear the default value if it is no longer within the allowed unit list", () => { - createDashboardWithMappedQuestion().then(dashboard => + createDashboardWithMappedQuestion().then((dashboard) => H.visitDashboard(dashboard.id), ); @@ -852,7 +852,7 @@ describe("scenarios > dashboard > temporal unit parameters", () => { }); it("should be able to set the default value and make it required", () => { - createDashboardWithMappedQuestion().then(dashboard => + createDashboardWithMappedQuestion().then((dashboard) => cy.wrap(dashboard.id).as("dashboardId"), ); H.visitDashboard("@dashboardId"); @@ -926,14 +926,14 @@ describe("scenarios > dashboard > temporal unit parameters", () => { describe("query string parameters", () => { it("should be able to parse the parameter value from the url", () => { - createDashboardWithMappedQuestion().then(dashboard => { + createDashboardWithMappedQuestion().then((dashboard) => { H.visitDashboard(dashboard.id, { params: { unit_of_time: "year" } }); }); H.getDashboardCard().findByText("Created At: Year").should("be.visible"); }); it("should ignore invalid temporal unit values from the url", () => { - createDashboardWithMappedQuestion().then(dashboard => { + createDashboardWithMappedQuestion().then((dashboard) => { H.visitDashboard(dashboard.id, { params: { unit_of_time: "invalid" } }); }); H.filterWidget().within(() => { @@ -953,7 +953,7 @@ describe("scenarios > dashboard > temporal unit parameters", () => { }, ], }, - }).then(dashboard => { + }).then((dashboard) => { H.visitDashboard(dashboard.id, { params: { unit_of_time: "year" } }); }); H.filterWidget().findByText("Year").should("be.visible"); @@ -963,7 +963,7 @@ describe("scenarios > dashboard > temporal unit parameters", () => { describe("permissions", () => { it("should add a temporal unit parameter and connect it to a card and drill thru", () => { - createDashboardWithMappedQuestion().then(dashboard => { + createDashboardWithMappedQuestion().then((dashboard) => { cy.signIn("nodata"); H.visitDashboard(dashboard.id); }); @@ -984,7 +984,7 @@ describe("scenarios > dashboard > temporal unit parameters", () => { }); it("should be able to use temporal unit parameters in a public dashboard", () => { - createDashboardWithMappedQuestion().then(dashboard => { + createDashboardWithMappedQuestion().then((dashboard) => { cy.request("POST", `/api/dashboard/${dashboard.id}/public_link`).then( ({ body: { uuid } }) => { cy.signOut(); @@ -1006,7 +1006,7 @@ describe("scenarios > dashboard > temporal unit parameters", () => { [parameterDetails.slug]: "enabled", }, }, - }).then(dashboard => { + }).then((dashboard) => { H.visitEmbeddedPage({ resource: { dashboard: dashboard.id }, params: {}, diff --git a/e2e/test/scenarios/dashboard/dashboard-back-navigation.cy.spec.js b/e2e/test/scenarios/dashboard/dashboard-back-navigation.cy.spec.js index 27007962186..625ed372215 100644 --- a/e2e/test/scenarios/dashboard/dashboard-back-navigation.cy.spec.js +++ b/e2e/test/scenarios/dashboard/dashboard-back-navigation.cy.spec.js @@ -254,7 +254,7 @@ describe( // could be a regular dashboard with card and filters createDashboardWithSlowCard(); - cy.get("@dashboardId").then(dashboardId => { + cy.get("@dashboardId").then((dashboardId) => { cy.visit(`/dashboard/${dashboardId}`); cy.wait("@dashboard"); cy.wait("@dashcardQuery"); @@ -297,7 +297,7 @@ describe( // so it will affect interception of @dashcardQuery and mess up the number of requests it("should restore a dashboard with loading cards and re-fetch query data", () => { createDashboardWithSlowCard(); - cy.get("@dashboardId").then(dashboardId => { + cy.get("@dashboardId").then((dashboardId) => { cy.visit({ url: `/dashboard/${dashboardId}`, qs: { sleep: 60 }, diff --git a/e2e/test/scenarios/dashboard/dashboard-management.cy.spec.js b/e2e/test/scenarios/dashboard/dashboard-management.cy.spec.js index 4c8b5e1d6cf..86effd89a4d 100644 --- a/e2e/test/scenarios/dashboard/dashboard-management.cy.spec.js +++ b/e2e/test/scenarios/dashboard/dashboard-management.cy.spec.js @@ -26,7 +26,7 @@ describe("managing dashboard from the dashboard's edit menu", () => { Object.entries(PERMISSIONS).forEach(([permission, userGroup]) => { context(`${permission} access`, () => { - userGroup.forEach(user => { + userGroup.forEach((user) => { onlyOn(permission === "curate", () => { describe(`${user} user`, () => { beforeEach(() => { @@ -74,7 +74,7 @@ describe("managing dashboard from the dashboard's edit menu", () => { }); it("should shallow duplicate a dashboard but not its cards", () => { - cy.get("@originalDashboardId").then(id => { + cy.get("@originalDashboardId").then((id) => { cy.intercept("POST", `/api/dashboard/${id}/copy`).as( "copyDashboard", ); @@ -129,7 +129,7 @@ describe("managing dashboard from the dashboard's edit menu", () => { }); it("should deep duplicate a dashboard and its cards", () => { - cy.get("@originalDashboardId").then(id => { + cy.get("@originalDashboardId").then((id) => { cy.intercept("POST", `/api/dashboard/${id}/copy`).as( "copyDashboard", ); @@ -170,7 +170,7 @@ describe("managing dashboard from the dashboard's edit menu", () => { }); it("should deep duplicate a dashboard and its cards to a collection created on the go", () => { - cy.get("@originalDashboardId").then(id => { + cy.get("@originalDashboardId").then((id) => { cy.intercept("POST", `/api/dashboard/${id}/copy`).as( "copyDashboard", ); @@ -232,7 +232,7 @@ describe("managing dashboard from the dashboard's edit menu", () => { }); it("should be able to move/undo move a dashboard (metabase#13059, metabase#25705)", () => { - cy.get("@originalDashboardId").then(id => { + cy.get("@originalDashboardId").then((id) => { H.appBar().contains("Our analytics"); H.popover().findByText("Move").click(); @@ -264,7 +264,7 @@ describe("managing dashboard from the dashboard's edit menu", () => { }); it("should be able to archive/unarchive a dashboard", () => { - cy.get("@originalDashboardId").then(id => { + cy.get("@originalDashboardId").then((id) => { H.popover() .findByText("Move to trash") .should("be.visible") @@ -376,7 +376,7 @@ describe("managing dashboard from the dashboard's edit menu", () => { }); function assertOnRequest(xhr_alias) { - cy.wait("@" + xhr_alias).then(xhr => { + cy.wait("@" + xhr_alias).then((xhr) => { expect(xhr.status).not.to.eq(403); }); cy.findByText("Sorry, you don’t have permission to see that.").should( diff --git a/e2e/test/scenarios/dashboard/dashboard-questions.cy.spec.js b/e2e/test/scenarios/dashboard/dashboard-questions.cy.spec.js index 4bb89aa6817..69a23eb1e37 100644 --- a/e2e/test/scenarios/dashboard/dashboard-questions.cy.spec.js +++ b/e2e/test/scenarios/dashboard/dashboard-questions.cy.spec.js @@ -173,7 +173,7 @@ describe("Dashboard > Dashboard Questions", () => { { wrapId: true, idAlias: "anotherDashboardId" }, ); - cy.get("@anotherDashboardId").then(anotherDashboardId => { + cy.get("@anotherDashboardId").then((anotherDashboardId) => { H.createQuestion( { name: "Total Orders", @@ -362,7 +362,7 @@ describe("Dashboard > Dashboard Questions", () => { { wrapId: true }, ); - cy.get("@dashboardId").then(dashboardId => { + cy.get("@dashboardId").then((dashboardId) => { //Simulate having picked the dashboard in the entity picker previously cy.request("POST", "/api/activity/recents", { context: "selection", @@ -505,7 +505,7 @@ describe("Dashboard > Dashboard Questions", () => { cy.findByTestId("public-link-input") .invoke("val") .should("not.be.empty") - .then(publicLink => { + .then((publicLink) => { cy.signOut(); cy.visit(publicLink); cy.findByTestId("embed-frame-header") @@ -623,7 +623,7 @@ describe("Dashboard > Dashboard Questions", () => { ); // there has to be a card already in the trash from this dashboard for this to reproduce - cy.get("@deletedCardId").then(deletedCardId => { + cy.get("@deletedCardId").then((deletedCardId) => { cy.request("PUT", `/api/card/${deletedCardId}`, { archived: true }); }); @@ -653,7 +653,7 @@ describe("Dashboard > Dashboard Questions", () => { { wrapId: true, idAlias: "dashboardWithTitleId" }, ); - cy.get("@dashboardWithTitleId").then(dashboardId => { + cy.get("@dashboardWithTitleId").then((dashboardId) => { // add a text card to the dashboard H.visitDashboard(dashboardId); H.editDashboard(); @@ -831,7 +831,7 @@ describe("Dashboard > Dashboard Questions", () => { { wrapId: true, idAlias: "purpleDashboardId" }, ); - cy.get("@blueDashboardId").then(blueDashboardId => { + cy.get("@blueDashboardId").then((blueDashboardId) => { H.visitDashboard(blueDashboardId); }); @@ -843,7 +843,7 @@ describe("Dashboard > Dashboard Questions", () => { H.sidebar().findByText("Average Quantity by Month Question").click(); H.saveDashboard(); - cy.get("@purpleDashboardId").then(purpleDashboardId => { + cy.get("@purpleDashboardId").then((purpleDashboardId) => { H.visitDashboard(purpleDashboardId); }); @@ -876,8 +876,8 @@ describe("Dashboard > Dashboard Questions", () => { let shouldError = true; // Simulate an error to ensure that it's passed back and shown in the modal. - cy.get("@avgQuanityQuestionId").then(questionId => { - cy.intercept("PUT", `**/api/card/${questionId}**`, req => { + cy.get("@avgQuanityQuestionId").then((questionId) => { + cy.intercept("PUT", `**/api/card/${questionId}**`, (req) => { if (shouldError === true) { shouldError = false; req.reply({ @@ -904,7 +904,7 @@ describe("Dashboard > Dashboard Questions", () => { cy.button("Move it").click(); }); - cy.get("@purpleDashboardId").then(purpleDashboardId => { + cy.get("@purpleDashboardId").then((purpleDashboardId) => { H.visitDashboard(purpleDashboardId); }); @@ -1099,7 +1099,7 @@ describe("Dashboard > Dashboard Questions", () => { { wrapId: true, idAlias: "personalDashboardId" }, ); - cy.get("@personalDashboardId").then(personalDashboardId => { + cy.get("@personalDashboardId").then((personalDashboardId) => { H.visitDashboard(personalDashboardId); }); @@ -1115,7 +1115,7 @@ describe("Dashboard > Dashboard Questions", () => { cy.signOut(); cy.signIn("normal"); - cy.get("@totalOrdersQuestionId").then(totalOrdersQuestionId => { + cy.get("@totalOrdersQuestionId").then((totalOrdersQuestionId) => { H.visitQuestion(totalOrdersQuestionId); }); @@ -1329,7 +1329,7 @@ function seedMigrationToolData() { collection_id: S.FIRST_COLLECTION_ID, }, }).then(({ body: { dashboard_id, card_id } }) => { - cy.get("@questionThreeCard").then(questionThreeCard => { + cy.get("@questionThreeCard").then((questionThreeCard) => { H.updateDashboardCards({ dashboard_id, cards: [ @@ -1351,7 +1351,7 @@ function seedMigrationToolData() { collection_id: S.FIRST_COLLECTION_ID, }, }).then(({ body: { dashboard_id, card_id } }) => { - cy.get("@questionThreeCard").then(questionThreeCard => { + cy.get("@questionThreeCard").then((questionThreeCard) => { H.updateDashboardCards({ dashboard_id, cards: [ diff --git a/e2e/test/scenarios/dashboard/dashboard-reproductions.cy.spec.js b/e2e/test/scenarios/dashboard/dashboard-reproductions.cy.spec.js index b3dff62d3cb..ef099fb3ef6 100644 --- a/e2e/test/scenarios/dashboard/dashboard-reproductions.cy.spec.js +++ b/e2e/test/scenarios/dashboard/dashboard-reproductions.cy.spec.js @@ -50,8 +50,8 @@ describe("issue 12578", () => { H.popover().findByText("1 minute").click(); // Mock slow card request - cy.intercept("POST", "/api/dashboard/*/dashcard/*/card/*/query", req => { - req.on("response", res => { + cy.intercept("POST", "/api/dashboard/*/dashcard/*/card/*/query", (req) => { + req.on("response", (res) => { res.setDelay(99999); }); }).as("dashcardQuery"); @@ -82,23 +82,23 @@ describe("issue 12926", () => { }; function slowDownCardQuery(as) { - cy.intercept("POST", "/api/card/*/query", req => { - req.on("response", res => { + cy.intercept("POST", "/api/card/*/query", (req) => { + req.on("response", (res) => { res.setDelay(300000); }); }).as(as); } function slowDownDashcardQuery() { - cy.intercept("POST", "/api/dashboard/*/dashcard/*/card/*/query", req => { - req.on("response", res => { + cy.intercept("POST", "/api/dashboard/*/dashcard/*/card/*/query", (req) => { + req.on("response", (res) => { res.setDelay(5000); }); }).as("dashcardQuerySlowed"); } function restoreDashcardQuery() { - cy.intercept("POST", "/api/dashboard/*/dashcard/*/card/*/query", req => { + cy.intercept("POST", "/api/dashboard/*/dashcard/*/card/*/query", (req) => { // calling req.continue() will make cypress skip all previously added intercepts req.continue(); }).as("dashcardQueryRestored"); @@ -129,7 +129,7 @@ describe("issue 12926", () => { cy.visit(`/dashboard/${dashboard_id}`); }); - cy.window().then(win => { + cy.window().then((win) => { cy.spy(win.XMLHttpRequest.prototype, "abort").as("xhrAbort"); }); @@ -199,7 +199,7 @@ describe("issue 12926", () => { H.saveDashboard(); - cy.wait("@cardQuerySlowed").then(xhrProxy => + cy.wait("@cardQuerySlowed").then((xhrProxy) => expect(xhrProxy.state).to.eq("Errored"), ); @@ -287,7 +287,7 @@ describe("issue 16559", () => { H.restore(); cy.signInAsAdmin(); - H.createDashboard(dashboardDetails).then(response => { + H.createDashboard(dashboardDetails).then((response) => { H.visitDashboard(response.body.id); }); @@ -541,8 +541,8 @@ describe("issue 21830", () => { url: "/api/dashboard/*/dashcard/*/card/*/query", middleware: true, }, - req => { - req.on("response", res => { + (req) => { + req.on("response", (res) => { // throttle the response to simulate a mobile 3G connection res.setThrottle(100); }); @@ -631,7 +631,7 @@ describe("issue 28756", () => { cy.signInAsNormalUser(); cy.clock(); - cy.get("@dashboardId").then(dashboardId => { + cy.get("@dashboardId").then((dashboardId) => { H.visitDashboard(dashboardId); cy.tick(TOAST_TIMEOUT); @@ -693,7 +693,7 @@ describe("issue 29076", () => { }); describe("issue 31274", () => { - const createTextCards = length => { + const createTextCards = (length) => { return Array.from({ length }).map((_, index) => { return H.getTextCardDetails({ size_x: 2, @@ -776,7 +776,7 @@ describe("issue 31697", () => { }, }; - const getQuestionDetails = segment => ({ + const getQuestionDetails = (segment) => ({ display: "line", query: { "source-table": ORDERS_ID, @@ -817,7 +817,7 @@ describe("issue 31766", () => { cy.intercept("PUT", "/api/card/*").as("updateQuestion"); cy.findByText("Save").click(); - cy.findByTestId("save-question-modal").within(modal => { + cy.findByTestId("save-question-modal").within((modal) => { cy.findByText("Save").click(); }); } @@ -889,7 +889,7 @@ describe("issue 31766", () => { describe("issue 34382", () => { const createDashboardWithCards = () => { const getParameterMapping = ({ card_id }, parameters) => ({ - parameter_mappings: parameters.map(parameter => ({ + parameter_mappings: parameters.map((parameter) => ({ card_id, parameter_id: parameter.id, target: ["dimension", ["field", PRODUCTS.CATEGORY, null]], @@ -1013,7 +1013,7 @@ describe("should not redirect users to other pages when linking an entity (metab H.visitDashboard(ORDERS_DASHBOARD_ID); H.editDashboard(); - cy.url().then(url => { + cy.url().then((url) => { cy.wrap(url).as("originUrl"); }); @@ -1025,7 +1025,7 @@ describe("should not redirect users to other pages when linking an entity (metab cy.findByText(TEST_DASHBOARD_NAME).click(); }); - cy.url().then(currentURL => { + cy.url().then((currentURL) => { cy.get("@originUrl").should("eq", currentURL); }); @@ -1044,7 +1044,7 @@ describe("should not redirect users to other pages when linking an entity (metab H.visitDashboard(ORDERS_DASHBOARD_ID); H.editDashboard(); - cy.url().then(url => { + cy.url().then((url) => { cy.wrap(url).as("originUrl"); }); @@ -1057,7 +1057,7 @@ describe("should not redirect users to other pages when linking an entity (metab cy.findByText(TEST_QUESTION_NAME).click(); }); - cy.url().then(currentURL => { + cy.url().then((currentURL) => { cy.get("@originUrl").should("eq", currentURL); }); @@ -1285,7 +1285,7 @@ describe("issue 39863", () => { dashboard_tab_id: TAB_2.id, }), ], - }).then(dashboard => H.visitDashboard(dashboard.id)); + }).then((dashboard) => H.visitDashboard(dashboard.id)); // Initial query for 1st tab cy.wait("@dashcardQuery"); @@ -1348,7 +1348,7 @@ describe("issue 39863", () => { dashboard_tab_id: TAB_2.id, }), ], - }).then(dashboard => H.visitDashboard(dashboard.id)); + }).then((dashboard) => H.visitDashboard(dashboard.id)); // Initial query for 1st tab cy.wait("@dashcardQuery"); @@ -1420,7 +1420,7 @@ describe("issue 40695", () => { card_id: ORDERS_COUNT_QUESTION_ID, }), ], - }).then(dashboard => H.visitDashboard(dashboard.id)); + }).then((dashboard) => H.visitDashboard(dashboard.id)); H.editDashboard(); cy.findByTestId("edit-bar").button("Cancel").click(); @@ -1503,7 +1503,7 @@ describe("issue 42165", () => { }); it("should use card name instead of series names when navigating to QB from dashcard title", () => { - cy.get("@dashboardId").then(dashboardId => { + cy.get("@dashboardId").then((dashboardId) => { H.visitDashboard(dashboardId); H.filterWidget().click(); @@ -1526,7 +1526,7 @@ describe("issue 47170", () => { cy.request("POST", `/api/bookmark/dashboard/${ORDERS_DASHBOARD_ID}`); H.createDashboard({ name: "Dashboard A" }, { wrapId: true }).then( - dashboardId => { + (dashboardId) => { cy.request("POST", `/api/bookmark/dashboard/${dashboardId}`); }, ); @@ -1537,8 +1537,10 @@ describe("issue 47170", () => { url: "/api/dashboard/*", middleware: true, }, - req => { - req.continue(res => new Promise(resolve => setTimeout(resolve, 1000))); + (req) => { + req.continue( + (res) => new Promise((resolve) => setTimeout(resolve, 1000)), + ); }, ); }); @@ -1642,7 +1644,7 @@ describe("issue 49556", () => { ], }), ], - }).then(dashboard => H.visitDashboard(dashboard.id)); + }).then((dashboard) => H.visitDashboard(dashboard.id)); }); it("unlinks the filter when it is removed (metabase#49556)", () => { diff --git a/e2e/test/scenarios/dashboard/dashboard.cy.spec.js b/e2e/test/scenarios/dashboard/dashboard.cy.spec.js index 4305ca89942..4b87f7a04ff 100644 --- a/e2e/test/scenarios/dashboard/dashboard.cy.spec.js +++ b/e2e/test/scenarios/dashboard/dashboard.cy.spec.js @@ -93,7 +93,7 @@ describe("scenarios > dashboard", () => { }); H.queryBuilderHeader().findByText("Save").click(); - cy.findByTestId("save-question-modal").within(modal => { + cy.findByTestId("save-question-modal").within((modal) => { cy.findByLabelText("Name").clear().type(newQuestionName); cy.findByLabelText("Where do you want to save this?").should( "not.exist", @@ -129,7 +129,7 @@ describe("scenarios > dashboard", () => { H.appBar().findByText("New").click(); H.popover().findByText("Dashboard").should("be.visible").click(); const NEW_DASHBOARD = "Foo"; - cy.findByTestId("new-dashboard-modal").then(modal => { + cy.findByTestId("new-dashboard-modal").then((modal) => { cy.findByRole("heading", { name: "New dashboard" }); cy.findByLabelText("Name").type(NEW_DASHBOARD).blur(); cy.findByTestId("collection-picker-button") @@ -409,7 +409,7 @@ describe("scenarios > dashboard", () => { H.showDashboardCardActions(); H.getDashboardCardMenu().click(); H.popover().findByText("Edit model").should("be.visible").click(); - cy.get("@slug").then(slug => { + cy.get("@slug").then((slug) => { cy.location("pathname").should("eq", `/model/${slug}/query`); }); }); @@ -435,7 +435,7 @@ describe("scenarios > dashboard", () => { H.showDashboardCardActions(); H.getDashboardCardMenu().click(); H.popover().findByText("Edit metric").should("be.visible").click(); - cy.get("@slug").then(slug => { + cy.get("@slug").then((slug) => { cy.location("pathname").should("eq", `/metric/${slug}/query`); }); }); @@ -551,7 +551,7 @@ describe("scenarios > dashboard", () => { H.sidesheet().within(() => { cy.log("Markdown content should not be bigger than its container"); - cy.findByTestId("editable-text").then($markdown => { + cy.findByTestId("editable-text").then(($markdown) => { const el = $markdown[0]; // vertical @@ -574,7 +574,7 @@ describe("scenarios > dashboard", () => { ); cy.findByTestId("editable-text") .click() - .then($el => { + .then(($el) => { const lineHeight = parseFloat( window.getComputedStyle($el[0]).lineHeight, ); @@ -998,7 +998,7 @@ describe("scenarios > dashboard", () => { H.filterWidget().as("filterWidget").click(); - ["Doohickey", "Gadget", "Gizmo", "Widget"].forEach(category => { + ["Doohickey", "Gadget", "Gizmo", "Widget"].forEach((category) => { cy.findByText(category); }); @@ -1113,7 +1113,7 @@ describe("scenarios > dashboard", () => { H.createDashboard({ name: "Auto-scroll test", dashcards }).then( ({ body: dashboard }) => { const targetCard = dashboard.dashcards.find( - dc => dc.visualization_settings?.text === TARGET_TEXT, + (dc) => dc.visualization_settings?.text === TARGET_TEXT, ); cy.log("should not be visible (below the fold)"); @@ -1458,7 +1458,7 @@ H.describeWithSnowplow("scenarios > dashboard", () => { }, }), ], - }).then(dashboard => H.visitDashboard(dashboard.id)); + }).then((dashboard) => H.visitDashboard(dashboard.id)); // new dashboards should default to 'fixed' width H.assertDashboardFixedWidth(); @@ -1503,7 +1503,7 @@ function checkOptionsForFilter(filter) { } function assertScrollBarExists() { - cy.get("body").then($body => { + cy.get("body").then(($body) => { const bodyWidth = $body[0].getBoundingClientRect().width; cy.window().its("innerWidth").should("be.gte", bodyWidth); }); @@ -1757,7 +1757,7 @@ describe("scenarios > dashboard > entity id support", () => { { name: "Tab 2", id: -2 }, ], dashcards: [], - }).then(dashboard => { + }).then((dashboard) => { cy.visit( `/dashboard/entity/${dashboard.entity_id}?tab=${dashboard.tabs[1].entity_id}`, ); diff --git a/e2e/test/scenarios/dashboard/tabs.cy.spec.js b/e2e/test/scenarios/dashboard/tabs.cy.spec.js index bf8adee7778..c4c25fdb35d 100644 --- a/e2e/test/scenarios/dashboard/tabs.cy.spec.js +++ b/e2e/test/scenarios/dashboard/tabs.cy.spec.js @@ -116,7 +116,7 @@ describe("scenarios > dashboard > tabs", () => { ], }), ], - }).then(dashboard => H.visitDashboard(dashboard.id)); + }).then((dashboard) => H.visitDashboard(dashboard.id)); assertFiltersVisibility({ visible: [DASHBOARD_DATE_FILTER, DASHBOARD_TEXT_FILTER], @@ -205,14 +205,14 @@ describe("scenarios > dashboard > tabs", () => { cy.log("should stay on the same tab"); cy.findByRole("tab", { selected: true }).should("have.text", "Tab 1"); - H.getDashboardCard(0).then(element => { + H.getDashboardCard(0).then((element) => { cy.wrap({ width: element.outerWidth(), height: element.outerHeight(), }).as("card1OriginalSize"); }); - H.getDashboardCard(1).then(element => { + H.getDashboardCard(1).then((element) => { cy.wrap(element.offset()).as("card2OriginalPosition"); }); @@ -238,8 +238,8 @@ describe("scenarios > dashboard > tabs", () => { cy.log("size should stay the same"); - H.getDashboardCard(1).then(element => { - cy.get("@card1OriginalSize").then(originalSize => { + H.getDashboardCard(1).then((element) => { + cy.get("@card1OriginalSize").then((originalSize) => { expect({ width: element.outerWidth(), height: element.outerHeight(), @@ -257,8 +257,8 @@ describe("scenarios > dashboard > tabs", () => { cy.log("second card should be in the original position"); - H.getDashboardCard().then(element => { - cy.get("@card2OriginalPosition").then(originalPosition => { + H.getDashboardCard().then((element) => { + cy.get("@card2OriginalPosition").then((originalPosition) => { const position = element.offset(); // approximately to avoid possibly flakiness, we just want it to be in the same grid cell expect(position.left).to.approximately(originalPosition.left, 10); @@ -397,7 +397,7 @@ describe("scenarios > dashboard > tabs", () => { cy.spy().as("firstTabQuerySpy"), ).as("firstTabQuery"); - cy.get("@secondTabDashcardId").then(secondTabDashcardId => { + cy.get("@secondTabDashcardId").then((secondTabDashcardId) => { cy.intercept( "POST", `/api/dashboard/${ORDERS_DASHBOARD_ID}/dashcard/${secondTabDashcardId}/card/${ORDERS_COUNT_QUESTION_ID}/query`, @@ -414,10 +414,10 @@ describe("scenarios > dashboard > tabs", () => { .its("body"); }; - firstQuestion().then(r => { + firstQuestion().then((r) => { cy.wrap(r.view_count).should("equal", 1); }); - secondQuestion().then(r => { + secondQuestion().then((r) => { cy.wrap(r.view_count).should("equal", 1); }); @@ -426,11 +426,11 @@ describe("scenarios > dashboard > tabs", () => { cy.get("@firstTabQuerySpy").should("have.been.calledOnce"); cy.get("@secondTabQuerySpy").should("not.have.been.called"); - cy.wait("@firstTabQuery").then(r => { - firstQuestion().then(r => { + cy.wait("@firstTabQuery").then((r) => { + firstQuestion().then((r) => { expect(r.view_count).to.equal(3); // 1 (previously) + 1 (firstQuestion) + 1 (firstTabQuery) }); - secondQuestion().then(r => { + secondQuestion().then((r) => { expect(r.view_count).to.equal(2); // 1 (previously) + 1 (secondQuestion) }); }); @@ -439,11 +439,11 @@ describe("scenarios > dashboard > tabs", () => { H.goToTab("Tab 2"); cy.get("@secondTabQuerySpy").should("have.been.calledOnce"); cy.get("@firstTabQuerySpy").should("have.been.calledOnce"); - cy.wait("@secondTabQuery").then(r => { - firstQuestion().then(r => { + cy.wait("@secondTabQuery").then((r) => { + firstQuestion().then((r) => { expect(r.view_count).to.equal(4); // 3 (previously) + 1 (firstQuestion) }); - secondQuestion().then(r => { + secondQuestion().then((r) => { expect(r.view_count).to.equal(4); // 2 (previously) + 1 (secondQuestion) + 1 (secondTabQuery) }); }); @@ -454,10 +454,10 @@ describe("scenarios > dashboard > tabs", () => { cy.get("@firstTabQuerySpy").should("have.been.calledOnce"); cy.get("@secondTabQuerySpy").should("have.been.calledOnce"); - firstQuestion().then(r => { + firstQuestion().then((r) => { expect(r.view_count).to.equal(5); // 4 (previously) + 1 (firstQuestion) }); - secondQuestion().then(r => { + secondQuestion().then((r) => { expect(r.view_count).to.equal(5); // 4 (previously) + 1 (secondQuestion) }); @@ -472,7 +472,7 @@ describe("scenarios > dashboard > tabs", () => { `/api/public/dashboard/${uuid}/dashcard/${ORDERS_DASHBOARD_DASHCARD_ID}/card/${ORDERS_QUESTION_ID}?parameters=%5B%5D`, cy.spy().as("publicFirstTabQuerySpy"), ).as("publicFirstTabQuery"); - cy.get("@secondTabDashcardId").then(secondTabDashcardId => { + cy.get("@secondTabDashcardId").then((secondTabDashcardId) => { cy.intercept( "GET", `/api/public/dashboard/${uuid}/dashcard/${secondTabDashcardId}/card/${ORDERS_COUNT_QUESTION_ID}?parameters=%5B%5D`, @@ -486,11 +486,11 @@ describe("scenarios > dashboard > tabs", () => { // Check first tab requests cy.get("@publicFirstTabQuerySpy").should("have.been.calledOnce"); cy.get("@publicSecondTabQuerySpy").should("not.have.been.called"); - cy.wait("@publicFirstTabQuery").then(r => { - firstQuestion().then(r => { + cy.wait("@publicFirstTabQuery").then((r) => { + firstQuestion().then((r) => { expect(r.view_count).to.equal(7); // 5 (previously) + 1 (firstQuestion) + 1 (publicFirstTabQuery) }); - secondQuestion().then(r => { + secondQuestion().then((r) => { expect(r.view_count).to.equal(6); // 5 (previously) + 1 (secondQuestion) }); }); @@ -499,11 +499,11 @@ describe("scenarios > dashboard > tabs", () => { H.goToTab("Tab 2"); cy.get("@publicSecondTabQuerySpy").should("have.been.calledOnce"); cy.get("@publicFirstTabQuerySpy").should("have.been.calledOnce"); - cy.wait("@publicSecondTabQuery").then(r => { - firstQuestion().then(r => { + cy.wait("@publicSecondTabQuery").then((r) => { + firstQuestion().then((r) => { expect(r.view_count).to.equal(8); // 7 (previously) + 1 (firstQuestion) }); - secondQuestion().then(r => { + secondQuestion().then((r) => { expect(r.view_count).to.equal(8); // 6 (previously) + 1 (secondQuestion) + 1 (publicSecondTabQuery) }); }); @@ -512,11 +512,11 @@ describe("scenarios > dashboard > tabs", () => { // This is a bug. publicFirstTabQuery should not be called again cy.get("@publicFirstTabQuerySpy").should("have.been.calledTwice"); cy.get("@publicSecondTabQuerySpy").should("have.been.calledOnce"); - cy.wait("@publicFirstTabQuery").then(r => { - firstQuestion().then(r => { + cy.wait("@publicFirstTabQuery").then((r) => { + firstQuestion().then((r) => { expect(r.view_count).to.equal(10); // 8 (previously) + 1 (firstQuestion) + 1 (publicFirstTabQuery) }); - secondQuestion().then(r => { + secondQuestion().then((r) => { expect(r.view_count).to.equal(9); // 8 (previously) + 1 (secondQuestion) }); }); @@ -552,10 +552,10 @@ describe("scenarios > dashboard > tabs", () => { .its("body"); }; - firstQuestion().then(r => { + firstQuestion().then((r) => { expect(r.view_count).to.equal(1); // 1 (firstQuestion) }); - secondQuestion().then(r => { + secondQuestion().then((r) => { expect(r.view_count).to.equal(1); // 1 (secondQuestion) }); @@ -582,11 +582,11 @@ describe("scenarios > dashboard > tabs", () => { cy.get("@firstTabQuerySpy").should("have.been.calledOnce"); cy.get("@secondTabQuerySpy").should("not.have.been.called"); - cy.wait("@firstTabQuery").then(r => { - firstQuestion().then(r => { + cy.wait("@firstTabQuery").then((r) => { + firstQuestion().then((r) => { expect(r.view_count).to.equal(3); // 1 (previously) + 1 (firstQuestion) + 1 (first tab query) }); - secondQuestion().then(r => { + secondQuestion().then((r) => { expect(r.view_count).to.equal(2); // 1 (previously) + 1 (secondQuestion) }); }); @@ -594,11 +594,11 @@ describe("scenarios > dashboard > tabs", () => { H.goToTab("Tab 2"); cy.get("@secondTabQuerySpy").should("have.been.calledOnce"); cy.get("@firstTabQuerySpy").should("have.been.calledOnce"); - cy.wait("@secondTabQuery").then(r => { - firstQuestion().then(r => { + cy.wait("@secondTabQuery").then((r) => { + firstQuestion().then((r) => { expect(r.view_count).to.equal(4); // 3 (previously) + 1 (firstQuestion) }); - secondQuestion().then(r => { + secondQuestion().then((r) => { expect(r.view_count).to.equal(4); // 2 (previously) + 1 (secondQuestion) + 1 (second tab query) }); }); @@ -607,11 +607,11 @@ describe("scenarios > dashboard > tabs", () => { // This is a bug. firstTabQuery should not be called again cy.get("@firstTabQuerySpy").should("have.been.calledTwice"); cy.get("@secondTabQuerySpy").should("have.been.calledOnce"); - cy.wait("@firstTabQuery").then(r => { - firstQuestion().then(r => { + cy.wait("@firstTabQuery").then((r) => { + firstQuestion().then((r) => { expect(r.view_count).to.equal(6); // 4 (previously) + 1 (firstQuestion) + 1 (first tab query) }); - secondQuestion().then(r => { + secondQuestion().then((r) => { expect(r.view_count).to.equal(5); // 4 (previously) + 1 (secondQuestion) }); }); @@ -809,7 +809,7 @@ H.describeWithSnowplow("scenarios > dashboard > tabs", () => { */ function delayResponse(delayMs) { return function (req) { - req.on("response", res => { + req.on("response", (res) => { res.setDelay(delayMs); }); }; @@ -858,14 +858,14 @@ const createNumberFilterMapping = ({ card_id }) => { function assertFiltersVisibility({ visible = [], hidden = [] }) { cy.findByTestId("dashboard-parameters-widget-container", () => { - visible.forEach(filter => cy.findByText(filter.name).should("exist")); - hidden.forEach(filter => cy.findByText(filter.name).should("not.exist")); + visible.forEach((filter) => cy.findByText(filter.name).should("exist")); + hidden.forEach((filter) => cy.findByText(filter.name).should("not.exist")); }); // Ensure all filters are visible in edit mode H.editDashboard(); cy.findByTestId("edit-dashboard-parameters-widget-container", () => { - [...visible, ...hidden].forEach(filter => + [...visible, ...hidden].forEach((filter) => cy.findByText(filter.name).should("exist"), ); }); diff --git a/e2e/test/scenarios/dashboard/title-drill.cy.spec.js b/e2e/test/scenarios/dashboard/title-drill.cy.spec.js index 5ccfd42593a..d249b7dc059 100644 --- a/e2e/test/scenarios/dashboard/title-drill.cy.spec.js +++ b/e2e/test/scenarios/dashboard/title-drill.cy.spec.js @@ -30,7 +30,7 @@ describe("scenarios > dashboard > title drill", () => { describe("as a user with access to underlying data", () => { it("should let you click through the title to the query builder (metabase#13042)", () => { - cy.get("@questionId").then(questionId => { + cy.get("@questionId").then((questionId) => { cy.findByTestId("loading-indicator").should("not.exist"); H.getDashboardCard().findByRole("link", { name: "Q1" }).as("title"); @@ -60,7 +60,7 @@ describe("scenarios > dashboard > title drill", () => { }); it("should let you click through the title to the query builder (metabase#13042)", () => { - cy.get("@questionId").then(questionId => { + cy.get("@questionId").then((questionId) => { cy.findByTestId("loading-indicator").should("not.exist"); H.getDashboardCard().findByRole("link", { name: "Q1" }).as("title"); @@ -308,7 +308,7 @@ describe("scenarios > dashboard > title drill", () => { // make sure the results match H.queryBuilderMain().findByText("42").should("be.visible"); - cy.get("@questionId").then(questionId => { + cy.get("@questionId").then((questionId) => { cy.location("href").should( "include", `/question/${questionId}-gui-question?category=Doohickey&id=#`, @@ -379,7 +379,7 @@ describe("scenarios > dashboard > title drill", () => { idAlias: "questionId", }); - cy.get("@questionId").then(questionId => { + cy.get("@questionId").then((questionId) => { const nestedQuestionDetails = { ...baseNestedQuestionDetails, query: { diff --git a/e2e/test/scenarios/dashboard/x-rays.cy.spec.js b/e2e/test/scenarios/dashboard/x-rays.cy.spec.js index b43d90c0b04..57b5d044cee 100644 --- a/e2e/test/scenarios/dashboard/x-rays.cy.spec.js +++ b/e2e/test/scenarios/dashboard/x-rays.cy.spec.js @@ -84,7 +84,7 @@ describe("scenarios > x-rays", { tags: "@slow" }, () => { cy.icon("warning").should("not.exist"); }); - ["X-ray", "Compare to the rest"].forEach(action => { + ["X-ray", "Compare to the rest"].forEach((action) => { it(`"${action.toUpperCase()}" should work on a nested question made from base native question (metabase#15655)`, () => { if (action === "Compare to the rest") { cy.log( @@ -126,7 +126,7 @@ describe("scenarios > x-rays", { tags: "@slow" }, () => { timeout: 15 * 1000, }); - cy.wait("@xray").then(xhr => { + cy.wait("@xray").then((xhr) => { expect(xhr.response.body.cause).not.to.exist; expect(xhr.response.statusCode).not.to.eq(500); }); @@ -407,7 +407,7 @@ function waitForSatisfyingResponse( throw `${maxRequests} requests exceeded`; // fail the test } - cy.wait(alias).then(interception => { + cy.wait(alias).then((interception) => { const isMatch = Cypress._.isMatch(interception.response, partialResponse); if (!isMatch) { waitForSatisfyingResponse(alias, partialResponse, maxRequests, level + 1); diff --git a/e2e/test/scenarios/embedding-sdk/static-dashboard-cors.cy.spec.js b/e2e/test/scenarios/embedding-sdk/static-dashboard-cors.cy.spec.js index 3cdc5c5b256..af6f6384920 100644 --- a/e2e/test/scenarios/embedding-sdk/static-dashboard-cors.cy.spec.js +++ b/e2e/test/scenarios/embedding-sdk/static-dashboard-cors.cy.spec.js @@ -56,7 +56,7 @@ describe("scenarios > embedding-sdk > static-dashboard", () => { exp: Math.round(Date.now() / 1000) + 10 * 60, // 10 minute expiration }, secret: JWT_SHARED_SECRET, - }).then(jwtToken => { + }).then((jwtToken) => { const ssoUrl = new URL("/auth/sso", Cypress.config().baseUrl); ssoUrl.searchParams.set("jwt", jwtToken); ssoUrl.searchParams.set("token", "true"); @@ -64,7 +64,7 @@ describe("scenarios > embedding-sdk > static-dashboard", () => { cy.wrap(body).as("metabaseSsoResponse"); }); }); - cy.get("@metabaseSsoResponse").then(ssoResponse => { + cy.get("@metabaseSsoResponse").then((ssoResponse) => { cy.intercept("GET", "/sso/metabase", ssoResponse); }); }); @@ -75,11 +75,11 @@ describe("scenarios > embedding-sdk > static-dashboard", () => { }); cy.signOut(); - cy.get("@dashboardId").then(dashboardId => { + cy.get("@dashboardId").then((dashboardId) => { visitFullAppEmbeddingUrl({ url: EMBEDDING_SDK_STORY_HOST, qs: { id: STORYBOOK_ID, viewMode: "story" }, - onBeforeLoad: window => { + onBeforeLoad: (window) => { window.METABASE_INSTANCE_URL = Cypress.config().baseUrl; window.DASHBOARD_ID = dashboardId; }, @@ -98,11 +98,11 @@ describe("scenarios > embedding-sdk > static-dashboard", () => { "enable-embedding-sdk": true, }); cy.signOut(); - cy.get("@dashboardId").then(dashboardId => { + cy.get("@dashboardId").then((dashboardId) => { visitFullAppEmbeddingUrl({ url: EMBEDDING_SDK_STORY_HOST, qs: { id: STORYBOOK_ID, viewMode: "story" }, - onBeforeLoad: window => { + onBeforeLoad: (window) => { window.METABASE_INSTANCE_URL = Cypress.config().baseUrl; window.DASHBOARD_ID = dashboardId; }, @@ -132,14 +132,14 @@ describe("scenarios > embedding-sdk > static-dashboard", () => { "enable-embedding-sdk": true, }); cy.signOut(); - cy.get("@dashboardId").then(dashboardId => { + cy.get("@dashboardId").then((dashboardId) => { visitFullAppEmbeddingUrl({ url: "http://my-site.local:6006/iframe.html", qs: { id: STORYBOOK_ID, viewMode: "story", }, - onBeforeLoad: window => { + onBeforeLoad: (window) => { window.METABASE_INSTANCE_URL = Cypress.config().baseUrl; window.DASHBOARD_ID = dashboardId; }, @@ -159,11 +159,11 @@ describe("scenarios > embedding-sdk > static-dashboard", () => { "embedding-app-origins-sdk": "my-site.local:6006", }); cy.signOut(); - cy.get("@dashboardId").then(dashboardId => { + cy.get("@dashboardId").then((dashboardId) => { visitFullAppEmbeddingUrl({ url: "http://my-site.local:6006/iframe.html", qs: { id: STORYBOOK_ID, viewMode: "story" }, - onBeforeLoad: window => { + onBeforeLoad: (window) => { window.METABASE_INSTANCE_URL = Cypress.config().baseUrl; window.DASHBOARD_ID = dashboardId; }, diff --git a/e2e/test/scenarios/embedding/embed-resource-downloads.cy.spec.ts b/e2e/test/scenarios/embedding/embed-resource-downloads.cy.spec.ts index ba26faf8eb8..29772842089 100644 --- a/e2e/test/scenarios/embedding/embed-resource-downloads.cy.spec.ts +++ b/e2e/test/scenarios/embedding/embed-resource-downloads.cy.spec.ts @@ -165,7 +165,7 @@ H.describeWithSnowplowEE( }); it("should be able to download a static embedded dashcard as CSV", () => { - cy.get("@dashboardId").then(dashboardId => { + cy.get("@dashboardId").then((dashboardId) => { H.visitEmbeddedPage( { resource: { dashboard: Number(dashboardId) }, @@ -339,7 +339,7 @@ H.describeWithSnowplowEE( it("should be able to download a static embedded dashcard as CSV", () => { const value = 9999; - cy.get("@questionId").then(questionId => { + cy.get("@questionId").then((questionId) => { H.visitEmbeddedPage( { resource: { question: Number(questionId) }, diff --git a/e2e/test/scenarios/embedding/embedding-dashboard.cy.spec.js b/e2e/test/scenarios/embedding/embedding-dashboard.cy.spec.js index 39dc6213750..5d9343eeff8 100644 --- a/e2e/test/scenarios/embedding/embedding-dashboard.cy.spec.js +++ b/e2e/test/scenarios/embedding/embedding-dashboard.cy.spec.js @@ -25,7 +25,7 @@ describe("scenarios > embedding > dashboard parameters", () => { human_readable_field_id: PEOPLE.NAME, }); - [ORDERS.USER_ID, PEOPLE.NAME, PEOPLE.ID].forEach(id => + [ORDERS.USER_ID, PEOPLE.NAME, PEOPLE.ID].forEach((id) => cy.request("PUT", `/api/field/${id}`, { has_field_values: "search" }), ); @@ -154,7 +154,7 @@ describe("scenarios > embedding > dashboard parameters", () => { }); it("should only display filters mapped to cards on the selected tab", () => { - cy.get("@dashboardId").then(dashboardId => { + cy.get("@dashboardId").then((dashboardId) => { cy.request("PUT", `/api/dashboard/${dashboardId}`, { embedding_params: { id: "enabled", @@ -281,7 +281,7 @@ describe("scenarios > embedding > dashboard parameters", () => { context("API", () => { beforeEach(() => { - cy.get("@dashboardId").then(dashboardId => { + cy.get("@dashboardId").then((dashboardId) => { cy.request("PUT", `/api/dashboard/${dashboardId}`, { embedding_params: { id: "enabled", @@ -358,7 +358,7 @@ describe("scenarios > embedding > dashboard parameters", () => { cy.log("should accept url parameters"); - cy.location().then(location => + cy.location().then((location) => cy.visit(`${location.origin}${location.pathname}?id=1&id=3`), ); @@ -367,7 +367,7 @@ describe("scenarios > embedding > dashboard parameters", () => { }); it("should render error message when `params` is not an object (metabase#14474)", () => { - cy.get("@dashboardId").then(dashboardId => { + cy.get("@dashboardId").then((dashboardId) => { cy.request("PUT", `/api/dashboard/${dashboardId}`, { embedding_params: { id: "enabled", @@ -508,7 +508,7 @@ describe("scenarios > embedding > dashboard parameters", () => { downloadUrl: "/api/embed/dashboard/*/dashcard/*/card/*/csv*", downloadMethod: "GET", }, - sheet => { + (sheet) => { expect(sheet["A1"].v).to.eq("ID"); expect(sheet["A2"].v).to.eq(9); expect(sheet["B1"].v).to.eq("EAN"); @@ -522,7 +522,7 @@ describe("scenarios > embedding > dashboard parameters", () => { it("should send 'X-Metabase-Client' header for api requests", () => { cy.intercept("GET", "api/embed/dashboard/*").as("getEmbeddedDashboard"); - cy.get("@dashboardId").then(dashboardId => { + cy.get("@dashboardId").then((dashboardId) => { cy.request("PUT", `/api/dashboard/${dashboardId}`, { embedding_params: {}, enable_embedding: true, @@ -534,7 +534,7 @@ describe("scenarios > embedding > dashboard parameters", () => { }; H.visitEmbeddedPage(payload, { - onBeforeLoad: window => { + onBeforeLoad: (window) => { window.Cypress = undefined; }, }); @@ -578,7 +578,7 @@ describe("scenarios > embedding > dashboard parameters with defaults", () => { }); }); - cy.get("@dashboardId").then(dashboardId => { + cy.get("@dashboardId").then((dashboardId) => { const payload = { resource: { dashboard: dashboardId }, params: { source: [] }, @@ -601,13 +601,13 @@ describe("scenarios > embedding > dashboard parameters with defaults", () => { it("locked parameters require a value to be specified in the JWT", () => { const nameParameter = dashboardDetails.parameters.find( - parameter => parameter.name === "Name", + (parameter) => parameter.name === "Name", ); const sourceParameter = dashboardDetails.parameters.find( - parameter => parameter.name === "Source", + (parameter) => parameter.name === "Source", ); - cy.get("@dashboardId").then(dashboardId => { + cy.get("@dashboardId").then((dashboardId) => { cy.request("PUT", `api/dashboard/${dashboardId}`, { enable_embedding: true, embedding_params: { @@ -635,13 +635,13 @@ describe("scenarios > embedding > dashboard parameters with defaults", () => { it("locked parameters should still render results in the preview by default (metabase#47570)", () => { const nameParameter = dashboardDetails.parameters.find( - parameter => parameter.name === "Name", + (parameter) => parameter.name === "Name", ); const sourceParameter = dashboardDetails.parameters.find( - parameter => parameter.name === "Source", + (parameter) => parameter.name === "Source", ); - cy.get("@dashboardId").then(dashboardId => { + cy.get("@dashboardId").then((dashboardId) => { cy.request("PUT", `api/dashboard/${dashboardId}`, { enable_embedding: true, embedding_params: { @@ -735,7 +735,7 @@ describe("scenarios > embedding > dashboard appearance", () => { H.getIframeBody() .findByTestId("embed-frame") .invoke("attr", "data-embed-theme") - .then(embedTheme => { + .then((embedTheme) => { expect(embedTheme).to.eq("light"); // default value }); @@ -745,7 +745,7 @@ describe("scenarios > embedding > dashboard appearance", () => { H.getIframeBody() .findByTestId("embed-frame") .invoke("attr", "data-embed-theme") - .then(embedTheme => { + .then((embedTheme) => { expect(embedTheme).to.eq("night"); }); @@ -834,7 +834,7 @@ describe("scenarios > embedding > dashboard appearance", () => { ], }); }) - .then(dashboard => { + .then((dashboard) => { H.visitDashboard(dashboard.id); }); @@ -861,7 +861,7 @@ describe("scenarios > embedding > dashboard appearance", () => { H.getIframeBody() .findByTestId("embed-frame") .invoke("attr", "data-embed-theme") - .then(embedTheme => { + .then((embedTheme) => { expect(embedTheme).to.eq("light"); // default value }); @@ -871,7 +871,7 @@ describe("scenarios > embedding > dashboard appearance", () => { H.getIframeBody() .findByTestId("embed-frame") .invoke("attr", "data-embed-theme") - .then(embedTheme => { + .then((embedTheme) => { expect(embedTheme).to.eq("night"); }); @@ -946,13 +946,13 @@ describe("scenarios > embedding > dashboard appearance", () => { ], }); }) - .then(dashboard => { + .then((dashboard) => { return H.getEmbeddedPageUrl({ resource: { dashboard: dashboard.id }, params: {}, }); }) - .then(urlOptions => { + .then((urlOptions) => { const baseUrl = Cypress.config("baseUrl"); Cypress.config("baseUrl", null); cy.visit( @@ -980,7 +980,7 @@ describe("scenarios > embedding > dashboard appearance", () => { // }); }); - cy.get("#iframe").should($iframe => { + cy.get("#iframe").should(($iframe) => { const [iframe] = $iframe; expect(iframe.clientHeight).to.be.greaterThan(1000); }); diff --git a/e2e/test/scenarios/embedding/embedding-linked-filters.cy.spec.js b/e2e/test/scenarios/embedding/embedding-linked-filters.cy.spec.js index 3e56b207c00..a62330f258b 100644 --- a/e2e/test/scenarios/embedding/embedding-linked-filters.cy.spec.js +++ b/e2e/test/scenarios/embedding/embedding-linked-filters.cy.spec.js @@ -37,7 +37,7 @@ describe("scenarios > embedding > dashboard > linked filters (metabase#13639, me }); it("works when both filters are enabled and their values are set through UI", () => { - cy.get("@dashboardId").then(dashboard_id => { + cy.get("@dashboardId").then((dashboard_id) => { const payload = { resource: { dashboard: dashboard_id }, params: {}, @@ -100,7 +100,7 @@ describe("scenarios > embedding > dashboard > linked filters (metabase#13639, me }); it("works when both filters are enabled and their values are set through UI with auto-apply filters disabled", () => { - cy.get("@dashboardId").then(dashboard_id => { + cy.get("@dashboardId").then((dashboard_id) => { const payload = { resource: { dashboard: dashboard_id }, params: {}, @@ -174,7 +174,7 @@ describe("scenarios > embedding > dashboard > linked filters (metabase#13639, me }); it("works when main filter's value is set through URL", () => { - cy.get("@dashboardId").then(dashboard_id => { + cy.get("@dashboardId").then((dashboard_id) => { const payload = { resource: { dashboard: dashboard_id }, params: {}, @@ -218,7 +218,7 @@ describe("scenarios > embedding > dashboard > linked filters (metabase#13639, me }); it("works when main filter's value is set through URL and when it is hidden at the same time", () => { - cy.get("@dashboardId").then(dashboard_id => { + cy.get("@dashboardId").then((dashboard_id) => { const payload = { resource: { dashboard: dashboard_id }, params: {}, @@ -262,7 +262,7 @@ describe("scenarios > embedding > dashboard > linked filters (metabase#13639, me }); it("works when main filter is locked", () => { - cy.get("@dashboardId").then(dashboard_id => { + cy.get("@dashboardId").then((dashboard_id) => { cy.request("PUT", `/api/dashboard/${dashboard_id}`, { embedding_params: { city: "enabled", @@ -314,7 +314,7 @@ describe("scenarios > embedding > dashboard > linked filters (metabase#13639, me }); it("works when both filters are enabled and their values are set through UI", () => { - cy.get("@guiDashboardId").then(dashboard_id => { + cy.get("@guiDashboardId").then((dashboard_id) => { const payload = { resource: { dashboard: dashboard_id }, params: {}, @@ -343,7 +343,7 @@ describe("scenarios > embedding > dashboard > linked filters (metabase#13639, me }); it("works when main filter's value is set through URL", () => { - cy.get("@guiDashboardId").then(dashboard_id => { + cy.get("@guiDashboardId").then((dashboard_id) => { const payload = { resource: { dashboard: dashboard_id }, params: {}, @@ -373,7 +373,7 @@ describe("scenarios > embedding > dashboard > linked filters (metabase#13639, me cy.log("Make sure we can set multiple values"); cy.window().then( - win => + (win) => (win.location.search = "?category=Widget&id_filter=4&id_filter=29"), ); @@ -418,7 +418,7 @@ describe("scenarios > embedding > dashboard > linked filters (metabase#13639, me }); it("works when the default filter is hidden", () => { - cy.get("@guiDashboardId").then(dashboard_id => { + cy.get("@guiDashboardId").then((dashboard_id) => { const payload = { resource: { dashboard: dashboard_id }, params: {}, @@ -447,7 +447,7 @@ describe("scenarios > embedding > dashboard > linked filters (metabase#13639, me }); it("works when the default filter is locked", () => { - cy.get("@guiDashboardId").then(dashboard_id => { + cy.get("@guiDashboardId").then((dashboard_id) => { cy.request("PUT", `/api/dashboard/${dashboard_id}`, { embedding_params: { id_filter: "locked", diff --git a/e2e/test/scenarios/embedding/embedding-native.cy.spec.js b/e2e/test/scenarios/embedding/embedding-native.cy.spec.js index 429712aa990..8a195735dac 100644 --- a/e2e/test/scenarios/embedding/embedding-native.cy.spec.js +++ b/e2e/test/scenarios/embedding/embedding-native.cy.spec.js @@ -73,7 +73,7 @@ describe("scenarios > embedding > native questions", () => { assert.deepEqual(actual, expected); }); - cy.get("@questionId").then(questionId => { + cy.get("@questionId").then((questionId) => { const payload = { resource: { question: questionId }, params: { total: [] }, @@ -202,7 +202,7 @@ describe("scenarios > embedding > native questions", () => { }); it("should hide filters via url", () => { - cy.get("@questionId").then(questionId => { + cy.get("@questionId").then((questionId) => { cy.request("PUT", `/api/card/${questionId}`, { enable_embedding: true, embedding_params: { @@ -236,7 +236,7 @@ describe("scenarios > embedding > native questions", () => { }); it("should set multiple filter values via url", () => { - cy.get("@questionId").then(questionId => { + cy.get("@questionId").then((questionId) => { cy.request("PUT", `/api/card/${questionId}`, { enable_embedding: true, embedding_params: { @@ -281,7 +281,7 @@ describe("scenarios > embedding > native questions", () => { }); it("should lock all parameters", () => { - cy.get("@questionId").then(questionId => { + cy.get("@questionId").then((questionId) => { cy.request("PUT", `/api/card/${questionId}`, { enable_embedding: true, embedding_params: { @@ -326,7 +326,7 @@ describe("scenarios > embedding > native questions", () => { wrapId: true, }); - cy.get("@questionId").then(questionId => { + cy.get("@questionId").then((questionId) => { cy.request("PUT", `/api/card/${questionId}`, { enable_embedding: true, embedding_params: { @@ -338,7 +338,7 @@ describe("scenarios > embedding > native questions", () => { }); it("locked parameters require a value to be specified in the JWT", () => { - cy.get("@questionId").then(questionId => { + cy.get("@questionId").then((questionId) => { const payload = { resource: { question: questionId }, params: { source: null }, @@ -393,7 +393,7 @@ describe("scenarios > embedding > native questions with default parameters", () }); it("card parameter defaults should apply for disabled parameters, but not for editable or locked parameters", () => { - cy.get("@questionId").then(questionId => { + cy.get("@questionId").then((questionId) => { const payload = { resource: { question: questionId }, params: { source: [] }, diff --git a/e2e/test/scenarios/embedding/embedding-questions.cy.spec.js b/e2e/test/scenarios/embedding/embedding-questions.cy.spec.js index 837290135f4..00d94ce926d 100644 --- a/e2e/test/scenarios/embedding/embedding-questions.cy.spec.js +++ b/e2e/test/scenarios/embedding/embedding-questions.cy.spec.js @@ -321,7 +321,7 @@ describe("scenarios > embedding > questions > downloads", () => { context("without token", () => { it("should not be possible to disable downloads", () => { - cy.get("@questionId").then(questionId => { + cy.get("@questionId").then((questionId) => { H.visitQuestion(questionId); H.openStaticEmbeddingModal({ activeTab: "lookAndFeel" }); @@ -367,7 +367,7 @@ describe("scenarios > embedding > questions > downloads", () => { cy.log( "Trying to prevent downloads via query params doesn't have any effect", ); - cy.url().then(url => { + cy.url().then((url) => { cy.visit(url + "&downloads=false"); }); @@ -381,7 +381,7 @@ describe("scenarios > embedding > questions > downloads", () => { beforeEach(() => H.setTokenFeatures("all")); it("should be possible to disable downloads", () => { - cy.get("@questionId").then(questionId => { + cy.get("@questionId").then((questionId) => { H.visitQuestion(questionId); H.openStaticEmbeddingModal({ diff --git a/e2e/test/scenarios/embedding/embedding-reproductions.cy.spec.js b/e2e/test/scenarios/embedding/embedding-reproductions.cy.spec.js index 7342d6bad3f..853902802f6 100644 --- a/e2e/test/scenarios/embedding/embedding-reproductions.cy.spec.js +++ b/e2e/test/scenarios/embedding/embedding-reproductions.cy.spec.js @@ -359,7 +359,7 @@ describe("issues 20845, 25031", () => { }; } const defaultFilterValues = [undefined, "10"]; - defaultFilterValues.forEach(value => { + defaultFilterValues.forEach((value) => { const conditionalPartOfTestTitle = value ? "and the required filter with the default value" : ""; @@ -417,7 +417,7 @@ describe("issues 20845, 25031", () => { }); it(`QUESTION: locked parameter should work with numeric values ${conditionalPartOfTestTitle} (metabase#20845)`, () => { - cy.get("@questionId").then(questionId => { + cy.get("@questionId").then((questionId) => { cy.request("PUT", `/api/card/${questionId}`, { enable_embedding: true, embedding_params: { @@ -427,7 +427,7 @@ describe("issues 20845, 25031", () => { // This issue is not possible to reproduce using UI from this point on. // We have to manually send the payload in order to make sure it works for both strings and integers. - ["string", "integer"].forEach(type => { + ["string", "integer"].forEach((type) => { cy.log( `Make sure it works with ${type.toUpperCase()} in the payload`, ); @@ -446,7 +446,7 @@ describe("issues 20845, 25031", () => { }); it(`DASHBOARD: locked parameter should work with numeric values ${conditionalPartOfTestTitle} (metabase#25031)`, () => { - cy.get("@dashboardId").then(dashboardId => { + cy.get("@dashboardId").then((dashboardId) => { H.visitDashboard(dashboardId); cy.request("PUT", `/api/dashboard/${dashboardId}`, { enable_embedding: true, @@ -457,7 +457,7 @@ describe("issues 20845, 25031", () => { // This issue is not possible to reproduce using UI from this point on. // We have to manually send the payload in order to make sure it works for both strings and integers. - ["string", "integer"].forEach(type => { + ["string", "integer"].forEach((type) => { cy.log( `Make sure it works with ${type.toUpperCase()} in the payload`, ); @@ -489,7 +489,7 @@ describe("issues 20845, 25031", () => { describe("issue 27643", { tags: "@external" }, () => { const PG_DB_ID = 2; const TEMPLATE_TAG_NAME = "expected_invoice"; - const getQuestionDetails = fieldId => { + const getQuestionDetails = (fieldId) => { return { name: "27643", database: PG_DB_ID, @@ -544,7 +544,7 @@ describe("issue 27643", { tags: "@external" }, () => { }; cy.get("@postgresInvoicesExpectedInvoiceId") - .then(fieldId => { + .then((fieldId) => { H.createNativeQuestionAndDashboard({ questionDetails: getQuestionDetails(fieldId), dashboardDetails, @@ -578,7 +578,7 @@ describe("issue 27643", { tags: "@external" }, () => { H.getDashboardCard().should("contain", "false"); cy.log("Test the embedded dashboard"); - cy.get("@dashboardId").then(dashboard => { + cy.get("@dashboardId").then((dashboard) => { H.visitEmbeddedPage({ resource: { dashboard }, params: {}, @@ -590,7 +590,7 @@ describe("issue 27643", { tags: "@external" }, () => { }); cy.log("Test the public dashboard"); - cy.get("@dashboardId").then(dashboardId => { + cy.get("@dashboardId").then((dashboardId) => { // We were signed out due to the previous visitEmbeddedPage cy.signInAsAdmin(); H.visitPublicDashboard(dashboardId); @@ -604,7 +604,7 @@ describe("issue 27643", { tags: "@external" }, () => { describe("should allow a native question filter to map to a boolean field filter parameter (metabase#27643)", () => { beforeEach(() => { - cy.get("@postgresInvoicesExpectedInvoiceId").then(fieldId => { + cy.get("@postgresInvoicesExpectedInvoiceId").then((fieldId) => { H.createNativeQuestion(getQuestionDetails(fieldId), { wrapId: true, idAlias: "questionId", @@ -621,7 +621,7 @@ describe("issue 27643", { tags: "@external" }, () => { cy.findAllByRole("gridcell").should("contain", "false"); cy.log("Test the embedded question"); - cy.get("@questionId").then(question => { + cy.get("@questionId").then((question) => { H.visitEmbeddedPage({ resource: { question }, params: {}, @@ -633,7 +633,7 @@ describe("issue 27643", { tags: "@external" }, () => { }); cy.log("Test the public question"); - cy.get("@questionId").then(questionId => { + cy.get("@questionId").then((questionId) => { // We were signed out due to the previous visitEmbeddedPage cy.signInAsAdmin(); H.visitPublicQuestion(questionId); @@ -681,7 +681,7 @@ describe("issue 30535", () => { acceptTerms: false, }); - cy.document().then(doc => { + cy.document().then((doc) => { const iframe = doc.querySelector("iframe"); cy.signOut(); @@ -1119,8 +1119,8 @@ describe("issue 8490", () => { url: "/api/embed/dashboard/*", middleware: true, }, - req => { - req.on("response", res => { + (req) => { + req.on("response", (res) => { const MINUTE = 60 * 1000; res.setDelay(MINUTE); }); @@ -1132,8 +1132,8 @@ describe("issue 8490", () => { url: "/api/embed/card/*", middleware: true, }, - req => { - req.on("response", res => { + (req) => { + req.on("response", (res) => { const MINUTE = 60 * 1000; res.setDelay(MINUTE); }); @@ -1141,7 +1141,7 @@ describe("issue 8490", () => { ).as("questionRequest"); cy.log("test a static embedded dashboard"); - cy.get("@dashboardId").then(dashboardId => { + cy.get("@dashboardId").then((dashboardId) => { H.visitEmbeddedPage( { resource: { dashboard: dashboardId }, @@ -1159,7 +1159,7 @@ describe("issue 8490", () => { cy.findByTestId("embed-frame").findByText("ė”œė”©...").should("be.visible"); cy.log("test a static embedded question"); - cy.get("@lineChartQuestionId").then(lineChartQuestionId => { + cy.get("@lineChartQuestionId").then((lineChartQuestionId) => { H.visitEmbeddedPage( { resource: { question: lineChartQuestionId }, @@ -1191,7 +1191,7 @@ describe("issue 8490", () => { () => dashboardLoaderPromise, ).as("dashboardRequest"); - cy.get("@dashboardId").then(dashboardId => { + cy.get("@dashboardId").then((dashboardId) => { H.visitEmbeddedPage( { resource: { dashboard: dashboardId }, @@ -1258,7 +1258,7 @@ describe("issue 8490", () => { ).as("questionRequest"); cy.log("assert the line chart"); - cy.get("@lineChartQuestionId").then(lineChartQuestionId => { + cy.get("@lineChartQuestionId").then((lineChartQuestionId) => { H.visitEmbeddedPage( { resource: { question: lineChartQuestionId }, @@ -1296,14 +1296,14 @@ describe("issue 50373", () => { method: "GET", url: /^\/app\/dist\/(.*)\.js$/, }, - req => { + (req) => { // When running in development (e.g. with `yarn dev`), // the *.hot.bundle.js hot-reloaded file is served by the dev server. if (req.url.includes("hot.bundle.js")) { return; } - req.on("response", res => { + req.on("response", (res) => { expect( res.headers["cache-control"], `Invalid Cache-Control header for ${req.url}`, diff --git a/e2e/test/scenarios/embedding/embedding-smoketests.cy.spec.js b/e2e/test/scenarios/embedding/embedding-smoketests.cy.spec.js index 04139d6f6e2..238ebf862d6 100644 --- a/e2e/test/scenarios/embedding/embedding-smoketests.cy.spec.js +++ b/e2e/test/scenarios/embedding/embedding-smoketests.cy.spec.js @@ -129,7 +129,7 @@ describe("scenarios > embedding > smoke tests", { tags: "@OSS" }, () => { question: ORDERS_QUESTION_ID, dashboard: ORDERS_DASHBOARD_ID, }; - ["question", "dashboard"].forEach(object => { + ["question", "dashboard"].forEach((object) => { it(`should be able to publish/embed and then unpublish a ${object} without filters`, () => { cy.request("PUT", "/api/setting/enable-embedding-static", { value: true, @@ -298,7 +298,7 @@ describe("scenarios > embedding > smoke tests", { tags: "@OSS" }, () => { cy.findByText("Preview").click(); }); - cy.document().then(doc => { + cy.document().then((doc) => { const iframe = doc.querySelector("iframe"); cy.signOut(); diff --git a/e2e/test/scenarios/embedding/embedding-snippets.cy.spec.js b/e2e/test/scenarios/embedding/embedding-snippets.cy.spec.js index d09343ceedf..c2b7d774952 100644 --- a/e2e/test/scenarios/embedding/embedding-snippets.cy.spec.js +++ b/e2e/test/scenarios/embedding/embedding-snippets.cy.spec.js @@ -16,7 +16,7 @@ function highlightedTexts() { return cy.findAllByTestId("highlighted-text"); } -features.forEach(feature => { +features.forEach((feature) => { describe(`[tokenFeatures=${feature}] scenarios > embedding > code snippets`, () => { beforeEach(() => { H.restore(); diff --git a/e2e/test/scenarios/embedding/interactive-embedding.cy.spec.js b/e2e/test/scenarios/embedding/interactive-embedding.cy.spec.js index b3a67270795..c37bd923b7c 100644 --- a/e2e/test/scenarios/embedding/interactive-embedding.cy.spec.js +++ b/e2e/test/scenarios/embedding/interactive-embedding.cy.spec.js @@ -248,9 +248,9 @@ describe("scenarios > embedding > full app", () => { H.popover().findByText("Orders").click(); // Multi-stage data picker - cy.intercept("GET", "/api/search*", req => { + cy.intercept("GET", "/api/search*", (req) => { if (req.query.limit === "0") { - req.continue(res => { + req.continue((res) => { // The data picker will fall back to multi-stage picker if there are more than or equal 100 tables and models res.body.total = 100; }); @@ -817,9 +817,9 @@ describe("scenarios > embedding > full app", () => { searchParameters, } = {}) { if (isMultiStageDataPicker) { - cy.intercept("GET", "/api/search*", req => { + cy.intercept("GET", "/api/search*", (req) => { if (req.query.limit === "0") { - req.continue(res => { + req.continue((res) => { // The data picker will fall back to multi-stage picker if there are more than or equal 100 tables and models res.body.total = 100; }); @@ -854,7 +854,7 @@ describe("scenarios > embedding > full app", () => { function selectCard({ cardName, cardType, collectionNames }) { H.popover().within(() => { cy.findByText(cardTypeToLabel[cardType]).click(); - collectionNames.forEach(collectionName => + collectionNames.forEach((collectionName) => cy.findByText(collectionName).click(), ); cy.findByText(cardName).click(); @@ -1376,7 +1376,7 @@ describe("scenarios > embedding > full app", () => { size_y: 8, }), ], - }).then(dashboard => { + }).then((dashboard) => { visitDashboardUrl({ url: `/dashboard/${dashboard.id}`, qs: { header: false }, @@ -1501,7 +1501,7 @@ describe("scenarios > embedding > full app", () => { .findByText("I am a very long text card") .should("not.be.visible"); cy.findByTestId("dashboard-parameters-widget-container").then( - $dashboardParameters => { + ($dashboardParameters) => { const dashboardParametersRect = $dashboardParameters[0].getBoundingClientRect(); expect(dashboardParametersRect.x).to.equal(0); @@ -1523,7 +1523,7 @@ describe("scenarios > embedding > full app", () => { text: "I am a text card", }), ], - }).then(dashboard => { + }).then((dashboard) => { H.visitFullAppEmbeddingUrl({ url: `/dashboard/${dashboard.id}`, onBeforeLoad(window) { @@ -1538,7 +1538,7 @@ describe("scenarios > embedding > full app", () => { type: "frame", frame: { mode: "fit", - height: Cypress.sinon.match(value => value > 1000), + height: Cypress.sinon.match((value) => value > 1000), }, }, }); @@ -1550,7 +1550,7 @@ describe("scenarios > embedding > full app", () => { type: "frame", frame: { mode: "fit", - height: Cypress.sinon.match(value => value < 1000), + height: Cypress.sinon.match((value) => value < 1000), }, }, }); @@ -1574,8 +1574,8 @@ describe("scenarios > embedding > full app", () => { it("should allow downloading question results when logged in via Google SSO (metabase#39848)", () => { const CSRF_TOKEN = "abcdefgh"; - cy.intercept("GET", "/api/user/current", req => { - req.on("response", res => { + cy.intercept("GET", "/api/user/current", (req) => { + req.on("response", (res) => { res.headers["X-Metabase-Anti-CSRF-Token"] = CSRF_TOKEN; }); }); @@ -1591,7 +1591,7 @@ describe("scenarios > embedding > full app", () => { H.exportFromDashcard(".csv"); - cy.wait("@CsvDownload").then(interception => { + cy.wait("@CsvDownload").then((interception) => { expect( interception.request.headers["x-metabase-anti-csrf-token"], ).to.equal(CSRF_TOKEN); @@ -1629,18 +1629,18 @@ describe("scenarios > embedding > full app", () => { }); }); -const visitQuestionUrl = urlOptions => { +const visitQuestionUrl = (urlOptions) => { H.visitFullAppEmbeddingUrl(urlOptions); cy.wait("@getCardQuery"); }; -const visitDashboardUrl = urlOptions => { +const visitDashboardUrl = (urlOptions) => { H.visitFullAppEmbeddingUrl(urlOptions); cy.wait("@getDashboard"); cy.wait("@getDashCardQuery"); }; -const visitXrayDashboardUrl = urlOptions => { +const visitXrayDashboardUrl = (urlOptions) => { H.visitFullAppEmbeddingUrl(urlOptions); cy.wait("@getXrayDashboard"); }; @@ -1648,7 +1648,7 @@ const visitXrayDashboardUrl = urlOptions => { const addLinkClickBehavior = ({ dashboardId, linkTemplate }) => { cy.request("GET", `/api/dashboard/${dashboardId}`).then(({ body }) => { cy.request("PUT", `/api/dashboard/${dashboardId}`, { - dashcards: body.dashcards.map(card => ({ + dashcards: body.dashcards.map((card) => ({ ...card, visualization_settings: { click_behavior: { @@ -1666,7 +1666,7 @@ const sideNav = () => { return cy.findByTestId("main-navbar-root"); }; -const selectDataSource = dataSource => { +const selectDataSource = (dataSource) => { H.popover().findByRole("link", { name: dataSource }).click(); }; @@ -1674,6 +1674,6 @@ const selectDataSource = dataSource => { * * @param {string} dataSource When using with QA database, the first option would be the table from the QA database. */ -const selectFirstDataSource = dataSource => { +const selectFirstDataSource = (dataSource) => { H.popover().findAllByRole("link", { name: dataSource }).first().click(); }; diff --git a/e2e/test/scenarios/embedding/shared/embedding-dashboard.js b/e2e/test/scenarios/embedding/shared/embedding-dashboard.js index 76c46a9aebf..532d8baa66a 100644 --- a/e2e/test/scenarios/embedding/shared/embedding-dashboard.js +++ b/e2e/test/scenarios/embedding/shared/embedding-dashboard.js @@ -50,7 +50,7 @@ export const questionDetails = { display: "scalar", }; -export const questionDetailsWithDefaults = produce(questionDetails, draft => { +export const questionDetailsWithDefaults = produce(questionDetails, (draft) => { const tags = draft.native["template-tags"]; tags.id.default = [1, 2]; tags.name.default = ["Lina Heaney"]; diff --git a/e2e/test/scenarios/filters-reproductions/dashboard-filters-reproductions.cy.spec.js b/e2e/test/scenarios/filters-reproductions/dashboard-filters-reproductions.cy.spec.js index 7443d871b1d..00e63fbb882 100644 --- a/e2e/test/scenarios/filters-reproductions/dashboard-filters-reproductions.cy.spec.js +++ b/e2e/test/scenarios/filters-reproductions/dashboard-filters-reproductions.cy.spec.js @@ -127,7 +127,7 @@ describe("issue 8030 + 32444", () => { ).as("getCardQuery2"); }; - const addFilterValue = value => { + const addFilterValue = (value) => { H.filterWidget().click(); cy.findByText(value).click(); cy.button("Add filter").click(); @@ -1133,7 +1133,7 @@ describe("issue 21528", () => { }); it("should show dashboard ID filter values when mapped to a native question with a foreign key field filter", () => { - cy.get("@questionId").then(questionId => { + cy.get("@questionId").then((questionId) => { cy.visit(`/question/${questionId}`); }); @@ -1576,14 +1576,16 @@ describe("issue 25322", () => { ); }; - const throttleFieldValuesRequest = dashboard_id => { + const throttleFieldValuesRequest = (dashboard_id) => { const matcher = { method: "GET", url: `/api/dashboard/${dashboard_id}/params/${parameterDetails.id}/values`, middleware: true, }; - cy.intercept(matcher, req => req.on("response", res => res.setDelay(100))); + cy.intercept(matcher, (req) => + req.on("response", (res) => res.setDelay(100)), + ); }; beforeEach(() => { @@ -2206,11 +2208,11 @@ describe("issues 29347, 29346", () => { }, }; - const getRemappedValue = fieldValue => { + const getRemappedValue = (fieldValue) => { return `N${fieldValue}`; }; - const addFieldRemapping = fieldId => { + const addFieldRemapping = (fieldId) => { cy.request("PUT", `/api/field/${fieldId}`, { semantic_type: "type/Category", }); @@ -2259,7 +2261,7 @@ describe("issues 29347, 29346", () => { ); }; - const filterOnRemappedValues = fieldValue => { + const filterOnRemappedValues = (fieldValue) => { H.filterWidget().within(() => { cy.findByText(filterDetails.name).click(); }); @@ -2270,18 +2272,18 @@ describe("issues 29347, 29346", () => { }); }; - const verifyRemappedValues = fieldValue => { + const verifyRemappedValues = (fieldValue) => { verifyRemappedFilterValues(filterValue); verifyRemappedCardValues(fieldValue); }; - const verifyRemappedFilterValues = fieldValue => { + const verifyRemappedFilterValues = (fieldValue) => { H.filterWidget().within(() => { cy.findByText(getRemappedValue(fieldValue)).should("be.visible"); }); }; - const verifyRemappedCardValues = fieldValue => { + const verifyRemappedCardValues = (fieldValue) => { H.getDashboardCard().within(() => { cy.findAllByText(getRemappedValue(fieldValue)).should("have.length", 2); }); @@ -2332,7 +2334,7 @@ describe("issues 29347, 29346", () => { it("should be able to filter on remapped values (metabase#29347, metabase#29346)", () => { createDashboard(); - cy.get("@dashboardId").then(dashboardId => + cy.get("@dashboardId").then((dashboardId) => H.visitEmbeddedPage({ resource: { dashboard: dashboardId }, params: {}, @@ -2349,7 +2351,7 @@ describe("issues 29347, 29346", () => { it("should be able to filter on remapped values in the token (metabase#29347, metabase#29346)", () => { createDashboard({ dashboardDetails: lockedDashboardDetails }); - cy.get("@dashboardId").then(dashboardId => { + cy.get("@dashboardId").then((dashboardId) => { H.visitEmbeddedPage({ resource: { dashboard: dashboardId }, params: { @@ -2365,7 +2367,7 @@ describe("issues 29347, 29346", () => { it("should be able to filter on remapped values in the url (metabase#29347, metabase#29346)", () => { createDashboard(); - cy.get("@dashboardId").then(dashboardId => { + cy.get("@dashboardId").then((dashboardId) => { H.visitEmbeddedPage( { resource: { dashboard: dashboardId }, @@ -2391,7 +2393,7 @@ describe("issues 29347, 29346", () => { it("should be able to filter on remapped values (metabase#29347, metabase#29346)", () => { createDashboard(); - cy.get("@dashboardId").then(dashboardId => + cy.get("@dashboardId").then((dashboardId) => H.visitPublicDashboard(dashboardId), ); cy.wait("@dashboard"); @@ -2405,7 +2407,7 @@ describe("issues 29347, 29346", () => { it("should be able to filter on remapped values in the url (metabase#29347, metabase#29346)", () => { createDashboard(); - cy.get("@dashboardId").then(dashboardId => { + cy.get("@dashboardId").then((dashboardId) => { H.visitPublicDashboard(dashboardId, { params: { [filterDetails.slug]: filterValue }, }); @@ -2496,7 +2498,7 @@ describe("issue 38245", () => { tabs: [TAB_1, TAB_2], parameters: [DASHBOARD_TEXT_FILTER], dashcards: [], - }).then(dashboard => H.visitDashboard(dashboard.id)); + }).then((dashboard) => H.visitDashboard(dashboard.id)); H.editDashboard(); H.openQuestionsSidebar(); @@ -2552,7 +2554,7 @@ describe("issue 43154", () => { }, }; - const questionDetails = modelId => ({ + const questionDetails = (modelId) => ({ name: "Question", type: "question", query: { @@ -2560,7 +2562,7 @@ describe("issue 43154", () => { }, }); - const questionWithAggregationDetails = modelId => ({ + const questionWithAggregationDetails = (modelId) => ({ name: "Question", type: "question", query: { @@ -2620,7 +2622,7 @@ describe("issue 42829", () => { semantic_type: "type/State", }; - const getQuestionDetails = modelId => ({ + const getQuestionDetails = (modelId) => ({ name: "SQL model-based question", type: "question", query: { @@ -2648,7 +2650,7 @@ describe("issue 42829", () => { }, }; - const getParameterMapping = questionId => ({ + const getParameterMapping = (questionId) => ({ parameter_id: parameterDetails.id, card_id: questionId, target: ["dimension", ["field", "STATE", { "base-type": "type/Text" }]], @@ -2677,7 +2679,7 @@ describe("issue 42829", () => { H.createNativeQuestion(modelDetails).then(({ body: model }) => { // populate result_metadata cy.request("POST", `/api/card/${model.id}/query`); - H.setModelMetadata(model.id, field => { + H.setModelMetadata(model.id, (field) => { if (field.display_name === "STATE") { return { ...field, ...stateFieldDetails }; } @@ -2708,14 +2710,14 @@ describe("issue 42829", () => { }); it("should be able to get field values coming from a sql model-based question in a public dashboard (metabase#42829)", () => { - cy.get("@dashboardId").then(dashboardId => + cy.get("@dashboardId").then((dashboardId) => H.visitPublicDashboard(dashboardId), ); filterAndVerifyResults(); }); it("should be able to get field values coming from a sql model-based question in a embedded dashboard (metabase#42829)", () => { - cy.get("@dashboardId").then(dashboardId => + cy.get("@dashboardId").then((dashboardId) => H.visitEmbeddedPage({ resource: { dashboard: dashboardId }, params: {}, @@ -2949,13 +2951,13 @@ describe("issue 44288", () => { cy.log("public dashboards"); cy.signInAsAdmin(); - cy.get("@dashboardId").then(dashboardId => + cy.get("@dashboardId").then((dashboardId) => H.visitPublicDashboard(dashboardId), ); verifyFilter(); cy.log("embedded dashboards"); - cy.get("@dashboardId").then(dashboardId => + cy.get("@dashboardId").then((dashboardId) => H.visitEmbeddedPage({ resource: { dashboard: dashboardId }, params: {}, @@ -3010,7 +3012,7 @@ describe("issue 32804", () => { parameters: [parameterDetails], }; - const getQuestion2Details = card => ({ + const getQuestion2Details = (card) => ({ name: "Q2", query: { "source-table": `card__${card.id}`, @@ -3022,7 +3024,7 @@ describe("issue 32804", () => { }, }); - const getParameterMapping = card => ({ + const getParameterMapping = (card) => ({ card_id: card.id, parameter_id: parameterDetails.id, target: [ @@ -3619,7 +3621,7 @@ describe("issue 34955", () => { }); it("should connect specific date filter (`Between`) to the temporal custom column (metabase#34955-1)", () => { - cy.get("@dashboardId").then(dashboard_id => { + cy.get("@dashboardId").then((dashboard_id) => { // Apply filter through URL to prevent the typing flakes cy.visit(`/dashboard/${dashboard_id}?on=&between=2024-01-01~2024-03-01`); // eslint-disable-next-line no-unsafe-element-filtering @@ -3635,7 +3637,7 @@ describe("issue 34955", () => { // TODO: Once the issue is fixed, merge into a single repro to avoid unnecessary overhead! it.skip("should connect specific date filter (`On`) to the temporal custom column (metabase#34955-2)", () => { - cy.get("@dashboardId").then(dashboard_id => { + cy.get("@dashboardId").then((dashboard_id) => { // Apply filter through URL to prevent the typing flakes cy.visit(`/dashboard/${dashboard_id}?on=2024-01-01&between=`); cy.findAllByTestId("field-set-content") @@ -3676,7 +3678,7 @@ describe("issue 35852", () => { it("should show filter values for a model based on sql query (metabase#35852)", () => { H.createNativeQuestion(model).then(({ body: { id: modelId } }) => { - H.setModelMetadata(modelId, field => { + H.setModelMetadata(modelId, (field) => { if (field.display_name === "CATEGORY") { return { ...field, @@ -3880,12 +3882,12 @@ describe("issue 45670", { tags: ["@external"] }, () => { function getField() { return cy.request("GET", "/api/table").then(({ body: tables }) => { - const table = tables.find(table => table.name === tableName); + const table = tables.find((table) => table.name === tableName); return cy .request("GET", `/api/table/${table.id}/query_metadata`) .then(({ body: metadata }) => { const { fields } = metadata; - return fields.find(field => field.name === "boolean"); + return fields.find((field) => field.name === "boolean"); }); }); } @@ -3926,7 +3928,7 @@ describe("issue 45670", { tags: ["@external"] }, () => { }); it("should be able to pass query string parameters for boolean parameters in dashboards (metabase#45670)", () => { - getField().then(field => { + getField().then((field) => { H.createNativeQuestion(getQuestionDetails(field.id)).then( ({ body: card }) => { H.createDashboard(dashboardDetails).then(({ body: dashboard }) => { @@ -3987,7 +3989,7 @@ describe("issue 48351", () => { size_y: 8, }), ], - }).then(dashboard1 => { + }).then((dashboard1) => { H.createDashboardWithTabs({ name: "Dashboard 2", tabs: [ @@ -4024,7 +4026,7 @@ describe("issue 48351", () => { size_y: 8, }), ], - }).then(dashboard2 => H.visitDashboard(dashboard2.id)); + }).then((dashboard2) => H.visitDashboard(dashboard2.id)); }); H.goToTab("Tab 4"); H.getDashboardCard().within(() => @@ -4117,10 +4119,10 @@ describe("issue 40396", { tags: "@external " }, () => { it("should be possible to use dashboard filters with native enum fields (metabase#40396)", () => { cy.log("create a dashboard with a question with a type/Enum field"); cy.request("GET", "/api/table").then(({ body: tables }) => { - const table = tables.find(table => table.name === tableName); + const table = tables.find((table) => table.name === tableName); cy.request("GET", `/api/table/${table.id}/query_metadata`).then( ({ body: metadata }) => { - const field = metadata.fields.find(field => field.name === "enum"); + const field = metadata.fields.find((field) => field.name === "enum"); cy.request("PUT", `/api/field/${field.id}`, { semantic_type: "type/Enum", }); @@ -4300,7 +4302,7 @@ describe("issue 17061", () => { }, }; - const getParameterMapping = cardId => ({ + const getParameterMapping = (cardId) => ({ parameter_id: parameterDetails.id, card_id: cardId, target: ["dimension", ["field", "STATE", { "base-type": "type/Text" }]], diff --git a/e2e/test/scenarios/filters-reproductions/dashboard-filters-with-question-revert.cy.spec.js b/e2e/test/scenarios/filters-reproductions/dashboard-filters-with-question-revert.cy.spec.js index 8ebd38db107..f3506244db4 100644 --- a/e2e/test/scenarios/filters-reproductions/dashboard-filters-with-question-revert.cy.spec.js +++ b/e2e/test/scenarios/filters-reproductions/dashboard-filters-with-question-revert.cy.spec.js @@ -86,7 +86,7 @@ describe("issue 35954", () => { cy.log("Drill down to the question from the dashboard"); cy.findByTestId("legend-caption-title").click(); - cy.get("@questionId").then(id => { + cy.get("@questionId").then((id) => { cy.location("pathname").should( "eq", `/question/${id}-${questionDetails.name}`, @@ -119,7 +119,7 @@ describe("issue 35954", () => { cy.findByLabelText(`Back to ${dashboardDetails.name}`).click(); - cy.get("@dashboardId").then(id => { + cy.get("@dashboardId").then((id) => { cy.location("pathname").should( "eq", `/dashboard/${id}-${dashboardDetails.name.toLowerCase()}`, diff --git a/e2e/test/scenarios/filters-reproductions/filters-reproductions.cy.spec.js b/e2e/test/scenarios/filters-reproductions/filters-reproductions.cy.spec.js index 066f7ba9bf8..66b928e75a7 100644 --- a/e2e/test/scenarios/filters-reproductions/filters-reproductions.cy.spec.js +++ b/e2e/test/scenarios/filters-reproductions/filters-reproductions.cy.spec.js @@ -52,7 +52,7 @@ describe.skip("issue 12496", () => { .eq(picker) .find("input") .eq(input); - const setup = unit => { + const setup = (unit) => { H.createQuestion( { name: `Orders by Created At: ${unit}`, @@ -584,7 +584,7 @@ describe("issue 25378", () => { cy.button("Add filter").click(); }); - H.visualize(response => { + H.visualize((response) => { expect(response.body.error).to.not.exist; }); }); @@ -727,7 +727,7 @@ describe("issue 25994", () => { cy.button("Add filter").click(); }); - H.visualize(response => { + H.visualize((response) => { expect(response.body.error).to.not.exist; }); }); @@ -1261,7 +1261,7 @@ describe("issue 44435", () => { }, }); - cy.findByTestId("filter-pill").then($pill => { + cy.findByTestId("filter-pill").then(($pill) => { const pillWidth = $pill[0].getBoundingClientRect().width; cy.window().its("innerWidth").should("be.gt", pillWidth); }); @@ -1439,7 +1439,7 @@ describe("issue 49321", () => { // eslint-disable-next-line no-unsafe-element-filtering H.popover().last().findByText("Contains").click(); - H.popover().then($popover => { + H.popover().then(($popover) => { const { width } = $popover[0].getBoundingClientRect(); cy.wrap(width).as("initialWidth"); }); @@ -1448,8 +1448,8 @@ describe("issue 49321", () => { .findByPlaceholderText("Enter some text") .type("aaaaaaaaaa, bbbbbbbbbbb,"); - cy.get("@initialWidth").then(initialWidth => { - H.popover().should($popover => { + cy.get("@initialWidth").then((initialWidth) => { + H.popover().should(($popover) => { const { width } = $popover[0].getBoundingClientRect(); expect(width).to.eq(initialWidth); }); @@ -1582,11 +1582,11 @@ describe("issue 50731", () => { H.popover() .should("be.visible") - .and($element => { + .and(($element) => { const [container] = $element; const descendants = container.querySelectorAll("*"); - descendants.forEach(descendant => { + descendants.forEach((descendant) => { H.assertDescendantNotOverflowsContainer(descendant, container); }); }); diff --git a/e2e/test/scenarios/filters/filter-bigint.cy.spec.ts b/e2e/test/scenarios/filters/filter-bigint.cy.spec.ts index 3265c9cba78..c5c8edbe783 100644 --- a/e2e/test/scenarios/filters/filter-bigint.cy.spec.ts +++ b/e2e/test/scenarios/filters/filter-bigint.cy.spec.ts @@ -277,8 +277,8 @@ SELECT CAST('${POSITIVE_DECIMAL_VALUE}' AS DECIMAL) AS NUMBER`, target: ["dimension", ["field", fieldId, { "base-type": baseType }]], }); - getTableId(tableName).then(tableId => { - getFieldId(tableId, "id").then(fieldId => { + getTableId(tableName).then((tableId) => { + getFieldId(tableId, "id").then((fieldId) => { H.createQuestion(getTargetQuestionDetails(tableId)).then( ({ body: card }) => { H.createDashboard(dashboardDetails).then( @@ -428,7 +428,7 @@ SELECT CAST('${POSITIVE_DECIMAL_VALUE}' AS DECIMAL) AS NUMBER`, parameters, enable_embedding: true, embedding_params: Object.fromEntries( - parameters.map(parameter => [parameter.slug, "enabled"]), + parameters.map((parameter) => [parameter.slug, "enabled"]), ), }; @@ -463,7 +463,7 @@ SELECT CAST('${POSITIVE_DECIMAL_VALUE}' AS DECIMAL) AS NUMBER`, dashboard_id: dashboard.id, card_id: targetCard.id, card: { - parameter_mappings: parameters.map(parameter => + parameter_mappings: parameters.map((parameter) => getParameterMapping(parameter.id, targetCard.id), ), }, @@ -937,8 +937,8 @@ SELECT CAST('${POSITIVE_DECIMAL_VALUE}' AS DECIMAL) AS NUMBER`, tableName: string; baseType: string; }) { - getTableId(tableName).then(tableId => { - getFieldId(tableId, "id").then(fieldId => { + getTableId(tableName).then((tableId) => { + getFieldId(tableId, "id").then((fieldId) => { const parameterDetails: Parameter = { id: "0dcd2f82-2e7d-4989-9362-5c94744a6585", name: "ID", @@ -1047,7 +1047,7 @@ SELECT CAST('${POSITIVE_DECIMAL_VALUE}' AS DECIMAL) AS NUMBER`, }, }); - getTableId(tableName).then(tableId => { + getTableId(tableName).then((tableId) => { H.createQuestion(getQuestionDetails(tableId), { visitQuestion: true }); }); } @@ -1089,7 +1089,7 @@ SELECT CAST('${POSITIVE_DECIMAL_VALUE}' AS DECIMAL) AS NUMBER`, it("query builder + object detail", { tags: "@external" }, () => { function setupQuestion({ tableName }: { tableName: string }) { - getTableId(tableName).then(tableId => + getTableId(tableName).then((tableId) => H.createQuestion( { database: WRITABLE_DB_ID, @@ -1199,7 +1199,7 @@ SELECT CAST('${POSITIVE_DECIMAL_VALUE}' AS DECIMAL) AS NUMBER`, display: "table", }); - getTableId(tableName).then(tableId => { + getTableId(tableName).then((tableId) => { H.createQuestion(getTargetQuestionDetails(tableId), { wrapId: true, visitQuestion: true, @@ -1239,7 +1239,7 @@ SELECT CAST('${POSITIVE_DECIMAL_VALUE}' AS DECIMAL) AS NUMBER`, formattedMinValue: string; formattedMaxValue: string; }) { - cy.get("@questionId").then(questionId => { + cy.get("@questionId").then((questionId) => { H.downloadAndAssert( { fileType: "csv", @@ -1416,7 +1416,7 @@ function getTableId(tableName: string) { return cy .request("GET", "/api/table") .then(({ body: tables }: { body: Table[] }) => { - const table = tables.find(table => table.name === tableName); + const table = tables.find((table) => table.name === tableName); if (!table) { throw new TypeError(`Table with name ${tableName} cannot be found`); } @@ -1429,7 +1429,7 @@ function getFieldId(tableId: TableId, fieldName: string) { .request("GET", `/api/table/${tableId}/query_metadata`) .then(({ body: table }: { body: Table }) => { const fields = table.fields ?? []; - const field = fields.find(field => field.name === fieldName); + const field = fields.find((field) => field.name === fieldName); if (!field) { throw new TypeError(`Field with name ${fieldName} cannot be found`); } @@ -1442,13 +1442,13 @@ function getFieldId(tableId: TableId, fieldName: string) { function visitPublicQuestion() { cy.signInAsAdmin(); - cy.get("@questionId").then(questionId => { + cy.get("@questionId").then((questionId) => { H.visitPublicQuestion(Number(questionId)); }); } function visitEmbeddedQuestion() { - cy.get("@questionId").then(questionId => { + cy.get("@questionId").then((questionId) => { const payload = { resource: { question: Number(questionId) }, params: {}, @@ -1459,13 +1459,13 @@ function visitEmbeddedQuestion() { function visitPublicDashboard() { cy.signInAsAdmin(); - cy.get("@dashboardId").then(dashboardId => { + cy.get("@dashboardId").then((dashboardId) => { H.visitPublicDashboard(Number(dashboardId)); }); } function visitEmbeddedDashboard() { - cy.get("@dashboardId").then(dashboardId => { + cy.get("@dashboardId").then((dashboardId) => { const payload = { resource: { dashboard: Number(dashboardId) }, params: {}, diff --git a/e2e/test/scenarios/filters/filter-sources.cy.spec.js b/e2e/test/scenarios/filters/filter-sources.cy.spec.js index 93ea812edda..01be3e8da6c 100644 --- a/e2e/test/scenarios/filters/filter-sources.cy.spec.js +++ b/e2e/test/scenarios/filters/filter-sources.cy.spec.js @@ -109,7 +109,7 @@ const nativeQuestion = { visualization_settings: {}, }; -const nestedQuestion = card => ({ +const nestedQuestion = (card) => ({ display: "table", dataset_query: { database: SAMPLE_DB_ID, @@ -121,7 +121,7 @@ const nestedQuestion = card => ({ visualization_settings: {}, }); -const nestedQuestionWithExpression = card => ({ +const nestedQuestionWithExpression = (card) => ({ display: "table", dataset_query: { database: SAMPLE_DB_ID, @@ -136,7 +136,7 @@ const nestedQuestionWithExpression = card => ({ visualization_settings: {}, }); -const nestedQuestionWithJoin = card => ({ +const nestedQuestionWithJoin = (card) => ({ display: "table", dataset_query: { database: SAMPLE_DB_ID, @@ -168,7 +168,7 @@ const nestedQuestionWithJoin = card => ({ visualization_settings: {}, }); -const nestedQuestionWithJoinAndFields = card => ({ +const nestedQuestionWithJoinAndFields = (card) => ({ display: "table", dataset_query: { database: SAMPLE_DB_ID, @@ -200,7 +200,7 @@ const nestedQuestionWithJoinAndFields = card => ({ visualization_settings: {}, }); -const nestedQuestionWithAggregations = card => ({ +const nestedQuestionWithAggregations = (card) => ({ display: "table", dataset_query: { database: SAMPLE_DB_ID, diff --git a/e2e/test/scenarios/filters/filter-types.cy.spec.js b/e2e/test/scenarios/filters/filter-types.cy.spec.js index 07796a67487..cb0daa9dd11 100644 --- a/e2e/test/scenarios/filters/filter-types.cy.spec.js +++ b/e2e/test/scenarios/filters/filter-types.cy.spec.js @@ -474,13 +474,13 @@ describe("scenarios > filters > filter types", () => { H.clauseStepPopover().findByText(columnName).click(); H.selectFilterOperator(operator); H.clauseStepPopover().within(() => { - values.forEach(value => { + values.forEach((value) => { cy.findByLabelText("Filter value") .focus() .type(`${value},`, { delay: 50 }) .blur(); }); - options.forEach(option => cy.findByText(option).click()); + options.forEach((option) => cy.findByText(option).click()); cy.button("Add filter").click(); }); @@ -509,7 +509,7 @@ describe("scenarios > filters > filter types", () => { H.clauseStepPopover().findByText(columnName).click(); H.selectFilterOperator(operator); H.clauseStepPopover().within(() => { - values.forEach(value => { + values.forEach((value) => { cy.findByLabelText("Filter value") .focus() .type(`${value},`, { delay: 50 }) @@ -604,7 +604,7 @@ describe("scenarios > filters > filter types", () => { cy.findByText("Exclude…").click(); cy.findByText(label).click(); if (options) { - options.forEach(option => cy.findByText(option).click()); + options.forEach((option) => cy.findByText(option).click()); cy.button("Add filter").click(); } }); diff --git a/e2e/test/scenarios/filters/filter.cy.spec.js b/e2e/test/scenarios/filters/filter.cy.spec.js index f22e3f9cc4d..8c34eb439e0 100644 --- a/e2e/test/scenarios/filters/filter.cy.spec.js +++ b/e2e/test/scenarios/filters/filter.cy.spec.js @@ -32,7 +32,7 @@ describe("scenarios > question > filter", () => { .findByText("Products → Category is not Gizmo") .should("be.visible"); - H.visualize(response => { + H.visualize((response) => { expect(response.body.error).to.not.exist; }); @@ -553,7 +553,7 @@ describe("scenarios > question > filter", () => { // eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage cy.contains('contains([Reviewer], "MULLER", "case-insensitive")'); cy.button("Update").click(); - cy.wait("@dataset").then(xhr => { + cy.wait("@dataset").then((xhr) => { expect(xhr.response.body.data.rows).to.have.lengthOf(1); }); // eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage @@ -904,7 +904,7 @@ describe("scenarios > question > filter", () => { }); }); - ["True", "False"].forEach(condition => { + ["True", "False"].forEach((condition) => { const regexCondition = new RegExp(`${condition}`, "i"); // We must use and return strings instead of boolean and numbers const integerAssociatedWithCondition = condition === "True" ? "0" : "1"; diff --git a/e2e/test/scenarios/filters/operators.cy.spec.js b/e2e/test/scenarios/filters/operators.cy.spec.js index d454dd84ef2..caf8608b69e 100644 --- a/e2e/test/scenarios/filters/operators.cy.spec.js +++ b/e2e/test/scenarios/filters/operators.cy.spec.js @@ -76,8 +76,8 @@ describe("operators in questions", () => { }); cy.findByRole("menu").within(() => { - expected.text.expected.map(e => cy.contains(e).should("exist")); - expected.text.unexpected.map(e => cy.contains(e).should("not.exist")); + expected.text.expected.map((e) => cy.contains(e).should("exist")); + expected.text.unexpected.map((e) => cy.contains(e).should("not.exist")); }); }); @@ -90,8 +90,10 @@ describe("operators in questions", () => { }); cy.findByRole("menu").within(() => { - expected.number.expected.map(e => cy.contains(e).should("exist")); - expected.number.unexpected.map(e => cy.contains(e).should("not.exist")); + expected.number.expected.map((e) => cy.contains(e).should("exist")); + expected.number.unexpected.map((e) => + cy.contains(e).should("not.exist"), + ); }); }); @@ -105,16 +107,16 @@ describe("operators in questions", () => { }); H.clauseStepPopover().within(() => { - expected.relativeDates.expected.map(e => + expected.relativeDates.expected.map((e) => cy.contains(e).should("exist"), ); - expected.specificDates.expected.map(e => + expected.specificDates.expected.map((e) => cy.contains(e).should("not.exist"), ); - expected.excludeDates.expected.map(e => + expected.excludeDates.expected.map((e) => cy.contains(e).should("not.exist"), ); - expected.relativeDates.unexpected.map(e => + expected.relativeDates.unexpected.map((e) => cy.contains(e).should("not.exist"), ); }); @@ -130,16 +132,16 @@ describe("operators in questions", () => { }); H.popover().within(() => { - expected.specificDates.expected.map(e => + expected.specificDates.expected.map((e) => cy.contains(e).should("exist"), ); - expected.relativeDates.expected.map(e => + expected.relativeDates.expected.map((e) => cy.contains(e).should("not.exist"), ); - expected.excludeDates.expected.map(e => + expected.excludeDates.expected.map((e) => cy.contains(e).should("not.exist"), ); - expected.specificDates.unexpected.map(e => + expected.specificDates.unexpected.map((e) => cy.contains(e).should("not.exist"), ); }); @@ -154,14 +156,16 @@ describe("operators in questions", () => { }); H.popover().within(() => { - expected.excludeDates.expected.map(e => cy.contains(e).should("exist")); - expected.relativeDates.expected.map(e => + expected.excludeDates.expected.map((e) => + cy.contains(e).should("exist"), + ); + expected.relativeDates.expected.map((e) => cy.contains(e).should("not.exist"), ); - expected.specificDates.expected.map(e => + expected.specificDates.expected.map((e) => cy.contains(e).should("not.exist"), ); - expected.excludeDates.unexpected.map(e => + expected.excludeDates.unexpected.map((e) => cy.contains(e).should("not.exist"), ); }); @@ -176,8 +180,8 @@ describe("operators in questions", () => { }); cy.findByRole("menu").within(() => { - expected.id.expected.map(e => cy.contains(e).should("exist")); - expected.id.unexpected.map(e => cy.contains(e).should("not.exist")); + expected.id.expected.map((e) => cy.contains(e).should("exist")); + expected.id.unexpected.map((e) => cy.contains(e).should("not.exist")); }); }); @@ -190,8 +194,8 @@ describe("operators in questions", () => { }); cy.findByRole("menu").within(() => { - expected.geo.expected.map(e => cy.contains(e).should("exist")); - expected.geo.unexpected.map(e => cy.contains(e).should("not.exist")); + expected.geo.expected.map((e) => cy.contains(e).should("exist")); + expected.geo.unexpected.map((e) => cy.contains(e).should("not.exist")); }); }); }); diff --git a/e2e/test/scenarios/filters/relative-datetime.cy.spec.js b/e2e/test/scenarios/filters/relative-datetime.cy.spec.js index 6fed38b86b4..abf47f935fb 100644 --- a/e2e/test/scenarios/filters/relative-datetime.cy.spec.js +++ b/e2e/test/scenarios/filters/relative-datetime.cy.spec.js @@ -21,10 +21,10 @@ describe("scenarios > question > relative-datetime", () => { }); describe("starting from", () => { - const date = values => + const date = (values) => values.reduce((val, [num, unit]) => val.add(num, unit), now.clone()); - STARTING_FROM_UNITS.forEach(unit => + STARTING_FROM_UNITS.forEach((unit) => it(`should work with Past filters (${unit} ago)`, () => { nativeSQL([ now, @@ -39,7 +39,7 @@ describe("scenarios > question > relative-datetime", () => { }), ); - STARTING_FROM_UNITS.forEach(unit => + STARTING_FROM_UNITS.forEach((unit) => it(`should work with Next filters (${unit} from now)`, () => { nativeSQL([ now, @@ -233,10 +233,10 @@ describe("scenarios > question > relative-datetime", () => { }); }); -const nativeSQL = values => { +const nativeSQL = (values) => { cy.intercept("POST", "/api/dataset").as("dataset"); - const queries = values.map(value => { + const queries = values.map((value) => { const date = moment(value).utc(); return `SELECT '${date.toISOString()}'::timestamp as "testcol"`; }); @@ -255,7 +255,7 @@ const nativeSQL = values => { cy.wait("@dataset"); }; -const openCreatedAt = tab => { +const openCreatedAt = (tab) => { H.tableHeaderClick("Created At"); H.popover().within(() => { cy.findByText("Filter by this column").click(); @@ -270,16 +270,16 @@ const addStartingFrom = () => { .click(); }; -const setRelativeDatetimeUnit = unit => { +const setRelativeDatetimeUnit = (unit) => { cy.findByRole("textbox", { name: "Unit" }).click(); cy.findByRole("option", { name: unit }).click(); }; -const setRelativeDatetimeValue = value => { +const setRelativeDatetimeValue = (value) => { cy.findByLabelText("Interval").click().clear().type(value).blur(); }; -const setStartingFromValue = value => { +const setStartingFromValue = (value) => { cy.findByLabelText("Starting from interval") .click() .clear() diff --git a/e2e/test/scenarios/filters/time-series-chrome.cy.spec.ts b/e2e/test/scenarios/filters/time-series-chrome.cy.spec.ts index f699291e5b9..942a9aacf16 100644 --- a/e2e/test/scenarios/filters/time-series-chrome.cy.spec.ts +++ b/e2e/test/scenarios/filters/time-series-chrome.cy.spec.ts @@ -57,7 +57,7 @@ describe("time-series chrome filter widget", () => { ); cy.log("Make sure we display all the operators"); - operators.forEach(operator => { + operators.forEach((operator) => { cy.findByRole("option", { name: operator }).should("be.visible"); }); }); diff --git a/e2e/test/scenarios/filters/view.cy.spec.js b/e2e/test/scenarios/filters/view.cy.spec.js index b395945ad3a..c53414cbfcc 100644 --- a/e2e/test/scenarios/filters/view.cy.spec.js +++ b/e2e/test/scenarios/filters/view.cy.spec.js @@ -51,8 +51,8 @@ describe("scenarios > question > view", () => { { wrapId: true }, ); - cy.get("@questionId").then(questionId => { - cy.get("@dashboardId").then(dashboardId => { + cy.get("@questionId").then((questionId) => { + cy.get("@dashboardId").then((dashboardId) => { H.addOrUpdateDashboardCard({ dashboard_id: dashboardId, card_id: questionId, diff --git a/e2e/test/scenarios/i18n/i18n.cy.spec.ts b/e2e/test/scenarios/i18n/i18n.cy.spec.ts index e80acc912cf..c3f0fdf3c93 100644 --- a/e2e/test/scenarios/i18n/i18n.cy.spec.ts +++ b/e2e/test/scenarios/i18n/i18n.cy.spec.ts @@ -32,10 +32,10 @@ describe("Pages accessible within one click from the homepage should work in pop cy.intercept("PUT", "/api/user/*").as("updateUserSettings"); }); - locales.forEach(localeName => { + locales.forEach((localeName) => { it(`Pages should be reachable when locale is ${localeName}`, () => { selectLocale(localeName); - paths.forEach(path => { + paths.forEach((path) => { cy.visit(path); cy.findByRole("main"); cy.findAllByTestId("error-boundary").should("not.exist"); diff --git a/e2e/test/scenarios/joins/joins-reproductions.cy.spec.js b/e2e/test/scenarios/joins/joins-reproductions.cy.spec.js index 0233adbd581..72e30f97157 100644 --- a/e2e/test/scenarios/joins/joins-reproductions.cy.spec.js +++ b/e2e/test/scenarios/joins/joins-reproductions.cy.spec.js @@ -91,7 +91,7 @@ describe("issue 12928", () => { H.visualize(); - cy.get("@joinedQuestionId").then(joinedQuestionId => { + cy.get("@joinedQuestionId").then((joinedQuestionId) => { H.assertJoinValid({ lhsTable: SOURCE_QUESTION_NAME, rhsTable: JOINED_QUESTION_NAME, @@ -149,7 +149,7 @@ describe("issue 14793", () => { H.popover().findByText("Automatic insights…").click(); H.popover().findByText("X-ray").click(); - cy.wait("@xray").then(xhr => { + cy.wait("@xray").then((xhr) => { for (let i = 0; i < XRAY_DATASETS; ++i) { cy.wait("@postDataset"); } @@ -326,7 +326,7 @@ describe("issue 17767", () => { cy.findByText("Reviews").click(); }); - H.visualize(response => { + H.visualize((response) => { expect(response.body.error).to.not.exist; }); @@ -403,7 +403,7 @@ describe("issue 18502", () => { // eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage cy.findByText("Birth Date: Month").click(); - H.visualize(response => { + H.visualize((response) => { expect(response.body.error).to.not.exist; }); @@ -469,7 +469,7 @@ describe("issue 18512", () => { H.popover().findByText("Products → Created At: Month").click(); H.popover().findByText("Products → Created At: Month").click(); - H.visualize(response => { + H.visualize((response) => { expect(response.body.error).to.not.exist; }); @@ -663,7 +663,7 @@ describe("issue 20519", () => { .contains("Two") .should("exist"); - H.visualize(response => { + H.visualize((response) => { expect(response.body.error).not.to.exist; }); @@ -695,7 +695,7 @@ describe("issue 22859 - multiple levels of nesting", () => { }; function getJoinedTableColumnHeader() { - cy.get("@q1Id").then(id => { + cy.get("@q1Id").then((id) => { cy.findByText(`Question ${id} → ID`); }); } @@ -707,7 +707,7 @@ describe("issue 22859 - multiple levels of nesting", () => { H.createQuestion(questionDetails, { wrapId: true, idAlias: "q1Id" }); // Join Orders table with the previously saved question and save it again - cy.get("@q1Id").then(id => { + cy.get("@q1Id").then((id) => { const nestedQuestionDetails = { name: "22859-Q2", query: { @@ -743,7 +743,7 @@ describe("issue 22859 - multiple levels of nesting", () => { }); it("model based on multi-level nested saved question should work (metabase#22859-1)", () => { - cy.get("@q2Id").then(id => { + cy.get("@q2Id").then((id) => { // Convert the second question to a model cy.request("PUT", `/api/card/${id}`, { type: "model" }); @@ -1085,7 +1085,7 @@ describe("issue 31769", () => { cy.signInAsAdmin(); H.createQuestion({ name: "Q1", query: Q1 }).then(() => { - H.createQuestion({ name: "Q2", query: Q2 }).then(response => { + H.createQuestion({ name: "Q2", query: Q2 }).then((response) => { cy.wrap(response.body.id).as("card_id_q2"); H.startNewQuestion(); }); @@ -1103,7 +1103,7 @@ describe("issue 31769", () => { // Asserting there're two columns from Q1 and two columns from Q2 cy.findAllByTestId("header-cell").should("have.length", 4); - cy.get("@card_id_q2").then(cardId => { + cy.get("@card_id_q2").then((cardId) => { H.tableInteractive() .findByText("Q2 - Products → Category → Category") .should("exist"); diff --git a/e2e/test/scenarios/metrics/browse.cy.spec.ts b/e2e/test/scenarios/metrics/browse.cy.spec.ts index 98c32d0ea42..4b171c400cf 100644 --- a/e2e/test/scenarios/metrics/browse.cy.spec.ts +++ b/e2e/test/scenarios/metrics/browse.cy.spec.ts @@ -126,7 +126,7 @@ describe("scenarios > browse > metrics", () => { cy.visit("/browse/metrics"); H.navigationSidebar().findByText("Metrics").should("be.visible"); - ALL_METRICS.forEach(metric => { + ALL_METRICS.forEach((metric) => { findMetric(metric.name).should("be.visible"); }); }); @@ -149,7 +149,7 @@ describe("scenarios > browse > metrics", () => { }); it("should open the collections in a new tab when alt-clicking a metric", () => { - cy.on("window:before:load", win => { + cy.on("window:before:load", (win) => { // prevent Cypress opening in a new window/tab and spy on this method cy.stub(win, "open").as("open"); }); @@ -190,7 +190,7 @@ describe("scenarios > browse > metrics", () => { metricsTable() .findByText(/This is a/) .should("be.visible") - .then(el => H.assertIsEllipsified(el[0])); + .then((el) => H.assertIsEllipsified(el[0])); metricsTable() .findByText(/This is a/) @@ -379,7 +379,7 @@ describe("scenarios > browse > metrics", () => { findMetric(ORDERS_SCALAR_MODEL_METRIC.name).should("not.exist"); toggleVerifiedMetricsFilter(); - cy.get<{ request: Request }>("@setSetting").should(xhr => { + cy.get<{ request: Request }>("@setSetting").should((xhr) => { expect(xhr.request.body).to.deep.equal({ value: false }); }); @@ -387,7 +387,7 @@ describe("scenarios > browse > metrics", () => { findMetric(ORDERS_SCALAR_MODEL_METRIC.name).should("be.visible"); toggleVerifiedMetricsFilter(); - cy.get<{ request: Request }>("@setSetting").should(xhr => { + cy.get<{ request: Request }>("@setSetting").should((xhr) => { expect(xhr.request.body).to.deep.equal({ value: true }); }); cy.wait("@setSetting"); @@ -402,8 +402,8 @@ describe("scenarios > browse > metrics", () => { }); it("should respect the user setting on wether or not to only show verified metrics", () => { - cy.intercept("GET", "/api/session/properties", req => { - req.continue(res => { + cy.intercept("GET", "/api/session/properties", (req) => { + req.continue((res) => { res.body["browse-filter-only-verified-metrics"] = true; res.send(); }); @@ -418,8 +418,8 @@ describe("scenarios > browse > metrics", () => { .findByLabelText("Show verified metrics only") .should("be.checked"); - cy.intercept("GET", "/api/session/properties", req => { - req.continue(res => { + cy.intercept("GET", "/api/session/properties", (req) => { + req.continue((res) => { res.body["browse-filter-only-verified-metrics"] = true; res.send(); }); @@ -437,7 +437,7 @@ describe("scenarios > browse > metrics", () => { function createMetrics( metrics: StructuredQuestionDetailsWithName[] = ALL_METRICS, ) { - metrics.forEach(metric => H.createQuestion(metric)); + metrics.forEach((metric) => H.createQuestion(metric)); } function metricsTable() { diff --git a/e2e/test/scenarios/metrics/metrics-editing.cy.spec.js b/e2e/test/scenarios/metrics/metrics-editing.cy.spec.js index 7c62c8cf640..dbe18efd4b0 100644 --- a/e2e/test/scenarios/metrics/metrics-editing.cy.spec.js +++ b/e2e/test/scenarios/metrics/metrics-editing.cy.spec.js @@ -553,7 +553,7 @@ function addStringCategoryFilter({ tableName, columnName, values }) { cy.findByText(tableName).click(); } cy.findByText(columnName).click(); - values.forEach(value => cy.findByText(value).click()); + values.forEach((value) => cy.findByText(value).click()); cy.button("Add filter").click(); }); } diff --git a/e2e/test/scenarios/metrics/reproductions/metrics-reproductions.cy.spec.ts b/e2e/test/scenarios/metrics/reproductions/metrics-reproductions.cy.spec.ts index 030b010015c..cef8248ba21 100644 --- a/e2e/test/scenarios/metrics/reproductions/metrics-reproductions.cy.spec.ts +++ b/e2e/test/scenarios/metrics/reproductions/metrics-reproductions.cy.spec.ts @@ -7,8 +7,8 @@ describe("issue 47058", () => { beforeEach(() => { H.restore(); cy.signInAsNormalUser(); - cy.intercept("GET", "/api/card/*/query_metadata", req => - req.continue(() => new Promise(resolve => setTimeout(resolve, 1000))), + cy.intercept("GET", "/api/card/*/query_metadata", (req) => + req.continue(() => new Promise((resolve) => setTimeout(resolve, 1000))), ).as("metadata"); H.createQuestion({ @@ -118,7 +118,7 @@ describe("issue 44171", () => { cy.findByText("Total").click(); }); cy.button("Save changes").click(); - cy.get("@dashboardId").then(id => { + cy.get("@dashboardId").then((id) => { H.visitDashboard(id); }); @@ -186,7 +186,7 @@ describe("issue 32037", () => { H.appBar().should("be.visible"); cy.button("Save changes").should("not.exist"); - cy.get("@metricPathname").then(metricPathname => { + cy.get("@metricPathname").then((metricPathname) => { cy.location("pathname").should("eq", metricPathname); }); }); diff --git a/e2e/test/scenarios/models/model-indexes.cy.spec.js b/e2e/test/scenarios/models/model-indexes.cy.spec.js index 5e9e0353795..03a2ddcd474 100644 --- a/e2e/test/scenarios/models/model-indexes.cy.spec.js +++ b/e2e/test/scenarios/models/model-indexes.cy.spec.js @@ -26,7 +26,7 @@ describe("scenarios > model indexes", () => { { wrapId: true, idAlias: "modelId" }, ); - cy.get("@modelId").then(_modelId => { + cy.get("@modelId").then((_modelId) => { modelId = _modelId; }); }); @@ -155,7 +155,7 @@ describe("scenarios > model indexes", () => { }, ); - cy.get("@people_model_id").then(peopleModelId => { + cy.get("@people_model_id").then((peopleModelId) => { createModelIndex({ modelId: peopleModelId, pkName: "ID", @@ -221,7 +221,7 @@ function editTitleMetadata() { H.openColumnOptions("Title"); } -const expectCardQueries = num => - cy.get("@cardGet.all").then(interceptions => { +const expectCardQueries = (num) => + cy.get("@cardGet.all").then((interceptions) => { expect(interceptions).to.have.length(num); }); diff --git a/e2e/test/scenarios/models/models-metadata.cy.spec.js b/e2e/test/scenarios/models/models-metadata.cy.spec.js index c500234d27d..140742a6e4e 100644 --- a/e2e/test/scenarios/models/models-metadata.cy.spec.js +++ b/e2e/test/scenarios/models/models-metadata.cy.spec.js @@ -78,7 +78,7 @@ describe("scenarios > models metadata", () => { // Ensure back navigation works correctly metabase#55162 H.openQuestionActions("Edit metadata"); cy.go("back"); - cy.get("@questionId").then(id => { + cy.get("@questionId").then((id) => { cy.location("pathname").should("equal", `/model/${id}-gui-model`); }); }); @@ -319,8 +319,8 @@ describe("scenarios > models metadata", () => { { wrapId: true, idAlias: "modelId" }, ); - cy.get("@modelId").then(modelId => { - H.setModelMetadata(modelId, field => { + cy.get("@modelId").then((modelId) => { + H.setModelMetadata(modelId, (field) => { if (field.display_name === "USER_ID") { return { ...field, @@ -344,7 +344,7 @@ describe("scenarios > models metadata", () => { }); it("should allow drills on FK columns", () => { - cy.get("@modelId").then(modelId => { + cy.get("@modelId").then((modelId) => { cy.visit(`/model/${modelId}`); cy.wait("@dataset"); @@ -375,7 +375,7 @@ describe("scenarios > models metadata", () => { }); it("should show implicit joins on FK columns with real DB columns (#37067)", () => { - cy.get("@modelId").then(modelId => { + cy.get("@modelId").then((modelId) => { cy.visit(`/model/${modelId}`); cy.wait("@dataset"); @@ -408,8 +408,8 @@ describe("scenarios > models metadata", () => { }); it("should allow drills on FK columns from dashboards (metabase#42130)", () => { - cy.get("@modelId").then(modelId => { - H.createDashboard().then(response => { + cy.get("@modelId").then((modelId) => { + H.createDashboard().then((response) => { const dashboardId = response.body.id; H.addOrUpdateDashboardCard({ dashboard_id: dashboardId, @@ -481,7 +481,7 @@ describe("scenarios > models metadata", () => { { idAlias: "modelId", wrapId: true }, ); - cy.get("@modelId").then(modelId => { + cy.get("@modelId").then((modelId) => { H.setModelMetadata(modelId, (field, index) => ({ ...field, id: ORDERS.ID, diff --git a/e2e/test/scenarios/models/models.cy.spec.js b/e2e/test/scenarios/models/models.cy.spec.js index 69421cb396d..aecdd6cdba3 100644 --- a/e2e/test/scenarios/models/models.cy.spec.js +++ b/e2e/test/scenarios/models/models.cy.spec.js @@ -37,7 +37,7 @@ describe("scenarios > models", () => { }); it("allows to turn a GUI question into a model", () => { - cy.get("@productsQuestionId").then(id => { + cy.get("@productsQuestionId").then((id) => { cy.request("PUT", `/api/card/${id}`, { name: "Products Model", }); @@ -114,7 +114,7 @@ describe("scenarios > models", () => { table: "Products", }); - cy.get("@questionId").then(questionId => { + cy.get("@questionId").then((questionId) => { saveQuestionBasedOnModel({ modelId: questionId, name: "Q1" }); }); @@ -156,7 +156,7 @@ describe("scenarios > models", () => { H.openQuestionActions(); assertIsModel(); - cy.get("@questionId").then(questionId => { + cy.get("@questionId").then((questionId) => { cy.wait("@dataset").then(({ response }) => { expect(response.body.json_query.query["source-table"]).to.equal( `card__${questionId}`, @@ -183,7 +183,7 @@ describe("scenarios > models", () => { table: "People", }); - cy.get("@questionId").then(questionId => { + cy.get("@questionId").then((questionId) => { saveQuestionBasedOnModel({ modelId: questionId, name: "Q1" }); }); @@ -429,7 +429,7 @@ describe("scenarios > models", () => { // eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage cy.findByText("Save").click(); - cy.findByTestId("save-question-modal").within(modal => { + cy.findByTestId("save-question-modal").within((modal) => { cy.findByText("Save").click(); }); @@ -588,7 +588,7 @@ describe("scenarios > models", () => { // eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage cy.findByText("Save").click({ force: true }); - cy.findByTestId("save-question-modal").within(modal => { + cy.findByTestId("save-question-modal").within((modal) => { cy.findByText("Save").click({ force: true }); }); @@ -685,7 +685,7 @@ describe("scenarios > models", () => { it("should allow using models in native queries", () => { cy.intercept("POST", "/api/dataset").as("query"); - cy.get("@modelId").then(id => { + cy.get("@modelId").then((id) => { H.startNewNativeQuestion(); H.NativeEditor.type(`select * from {{#${id}}}`, { parseSpecialCharSequences: false, diff --git a/e2e/test/scenarios/models/reproductions.cy.spec.js b/e2e/test/scenarios/models/reproductions.cy.spec.js index a46045a2426..e6f96b821e8 100644 --- a/e2e/test/scenarios/models/reproductions.cy.spec.js +++ b/e2e/test/scenarios/models/reproductions.cy.spec.js @@ -621,7 +621,7 @@ describe("filtering based on the remapped column name should result in a correct describe("issue 23024", () => { function addModelToDashboardAndVisit() { H.createDashboard().then(({ body: { id } }) => { - cy.get("@modelId").then(cardId => { + cy.get("@modelId").then((cardId) => { H.addOrUpdateDashboardCard({ dashboard_id: id, card_id: cardId, @@ -650,8 +650,8 @@ describe("issue 23024", () => { { wrapId: true, idAlias: "modelId" }, ); - cy.get("@modelId").then(modelId => { - H.setModelMetadata(modelId, field => { + cy.get("@modelId").then((modelId) => { + H.setModelMetadata(modelId, (field) => { if (field.display_name === "CATEGORY") { return { ...field, @@ -805,7 +805,7 @@ describe("issue 25537", () => { query: { "source-table": ORDERS_ID }, type: "model", }; - const setLocale = locale => { + const setLocale = (locale) => { cy.request("GET", "/api/user/current").then(({ body: { id: user_id } }) => { cy.request("PUT", `/api/user/${user_id}`, { locale }); }); @@ -943,7 +943,7 @@ describe("issue 28971", () => { cy.findByText("Orders").click(); }); cy.button("Save").click(); - cy.findByTestId("save-question-modal").within(modal => { + cy.findByTestId("save-question-modal").within((modal) => { cy.findByText("Save").click(); }); cy.wait("@createCard"); @@ -984,7 +984,7 @@ describe("issue 28971", () => { cy.findByText("Orders").click(); }); cy.button("Save").click(); - cy.findByTestId("save-question-modal").within(modal => { + cy.findByTestId("save-question-modal").within((modal) => { cy.findByText("Save").click(); }); cy.wait("@createCard"); @@ -1447,7 +1447,7 @@ describe("issue 29951", { requestTimeout: 10000, viewportWidth: 1600 }, () => { }, type: "model", }; - const removeExpression = name => { + const removeExpression = (name) => { H.getNotebookStep("expression") .findByText(name) .findByLabelText("close icon") @@ -1675,7 +1675,7 @@ describe("issue 32483", () => { H.createQuestion(questionDetails, { wrapId: true }); - cy.get("@questionId").then(questionId => { + cy.get("@questionId").then((questionId) => { const modelDetails = { type: "model", name: "Orders + People Question Model", @@ -1975,8 +1975,8 @@ describe("issue 40252", () => { H.createNativeQuestion(modelA, { wrapId: true, idAlias: "modelA" }); H.createNativeQuestion(modelB, { wrapId: true, idAlias: "modelB" }); - cy.get("@modelA").then(modelAId => { - cy.get("@modelB").then(modelBId => { + cy.get("@modelA").then((modelAId) => { + cy.get("@modelB").then((modelBId) => { const questionDetails = { name: "40252", type: "model", diff --git a/e2e/test/scenarios/models/reproductions.cy.spec.ts b/e2e/test/scenarios/models/reproductions.cy.spec.ts index cb46886dbf3..6889d517bea 100644 --- a/e2e/test/scenarios/models/reproductions.cy.spec.ts +++ b/e2e/test/scenarios/models/reproductions.cy.spec.ts @@ -336,7 +336,7 @@ describe("issue 39150", { viewportWidth: 1600 }, () => { H.saveQuestion("Nested Model", { wrapId: true, idAlias: "nestedModelId" }); cy.log("Make sure this works for the deeply nested models as well"); - cy.get("@nestedModelId").then(nestedModelId => { + cy.get("@nestedModelId").then((nestedModelId) => { H.createQuestion( { type: "model", @@ -1367,7 +1367,7 @@ describe("issue 32037", () => { H.tableInteractive().should("be.visible"); cy.button("Save changes").should("not.exist"); - cy.get("@modelPathname").then(modelPathname => { + cy.get("@modelPathname").then((modelPathname) => { cy.location("pathname").should("eq", modelPathname); }); } diff --git a/e2e/test/scenarios/native-filters/native-filters-reproductions.cy.spec.js b/e2e/test/scenarios/native-filters/native-filters-reproductions.cy.spec.js index ff4799ade59..11587ad7996 100644 --- a/e2e/test/scenarios/native-filters/native-filters-reproductions.cy.spec.js +++ b/e2e/test/scenarios/native-filters/native-filters-reproductions.cy.spec.js @@ -197,7 +197,7 @@ describe("issue 12581", () => { // eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage cy.findByText("Save").click(); - cy.findByTestId("save-question-modal").within(modal => { + cy.findByTestId("save-question-modal").within((modal) => { cy.findByText("Save").click(); }); @@ -334,7 +334,7 @@ describe("issue 14302", () => { }); }); -["nodata+nosql", "nosql"].forEach(test => { +["nodata+nosql", "nosql"].forEach((test) => { describe("issue 15163", () => { const nativeFilter = { id: "dd7f3e66-b659-7d1c-87b3-ab627317581c", @@ -424,7 +424,7 @@ describe("issue 14302", () => { // eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage cy.findByText("New Title").click(); - cy.wait("@cardQuery", { timeout: 5000 }).then(xhr => { + cy.wait("@cardQuery", { timeout: 5000 }).then((xhr) => { expect(xhr.response.body.error).not.to.exist; }); @@ -610,7 +610,7 @@ describe("issue 16739", () => { cy.signInAsAdmin(); }); - ["normal", "nodata"].forEach(user => { + ["normal", "nodata"].forEach((user) => { //Very related to the metabase#15981, only this time the issue happens with the "Field Filter" without the value being set. it(`filter feature flag shouldn't cause run-overlay of results in native editor for ${user} user (metabase#16739)`, () => { H.createNativeQuestion({ @@ -730,7 +730,7 @@ describe("issue 17019", () => { cy.findByTestId("public-link-popover-content") .findByTestId("public-link-input") .invoke("val") - .then(publicLink => { + .then((publicLink) => { cy.visit(publicLink); }); @@ -745,8 +745,8 @@ describe("issue 17019", () => { describe("issue 17490", () => { function mockDatabaseTables() { - cy.intercept("GET", "/api/database?include=tables", req => { - req.reply(res => { + cy.intercept("GET", "/api/database?include=tables", (req) => { + req.reply((res) => { const mockTables = new Array(7).fill({ id: 42, // id is hard coded, but it doesn't matter for this repro db_id: 1, @@ -755,7 +755,7 @@ describe("issue 17490", () => { schema: "PUBLIC", }); - res.body.data = res.body.data.map(d => ({ + res.body.data = res.body.data.map((d) => ({ ...d, tables: [...d.tables, ...mockTables], })); @@ -888,7 +888,7 @@ describe("issue 21246", () => { wrapId: true, }); - cy.get("@questionId").then(id => { + cy.get("@questionId").then((id) => { cy.visit(`/question/${id}`); cy.wait("@dataset"); @@ -901,7 +901,7 @@ describe("issue 21246", () => { const fieldFilterValue = "filter=2024-02"; const dateFilterValue = "datevariable=2024-02-19"; - cy.get("@questionId").then(id => { + cy.get("@questionId").then((id) => { // Let's set filter values directly through URL, rather than through the UI // for the sake of speed and reliability cy.visit(`/question/${id}?${fieldFilterValue}`); diff --git a/e2e/test/scenarios/native-filters/sql-filters-reset-clear.cy.spec.ts b/e2e/test/scenarios/native-filters/sql-filters-reset-clear.cy.spec.ts index d86652ae818..f0fa6046709 100644 --- a/e2e/test/scenarios/native-filters/sql-filters-reset-clear.cy.spec.ts +++ b/e2e/test/scenarios/native-filters/sql-filters-reset-clear.cy.spec.ts @@ -145,10 +145,10 @@ describe("scenarios > filters > sql filters > reset & clear", () => { defaultValueFormatted: "January 1, 2024", otherValue: "01/01/2020", otherValueFormatted: "January 1, 2020", - setValue: value => { + setValue: (value) => { addDateFilter(value); }, - updateValue: value => { + updateValue: (value) => { updateDateFilter(value); }, }); @@ -210,11 +210,11 @@ describe("scenarios > filters > sql filters > reset & clear", () => { defaultValueFormatted: "Gizmo", otherValue: "{backspace}Gadget", otherValueFormatted: "Gadget", - setValue: value => { + setValue: (value) => { H.popover().findByRole("textbox").clear().type(value).blur(); H.popover().button("Add filter").click(); }, - updateValue: value => { + updateValue: (value) => { H.popover().findByRole("textbox").clear().type(value).blur(); H.popover().button("Update filter").click(); }, @@ -224,11 +224,11 @@ describe("scenarios > filters > sql filters > reset & clear", () => { defaultValueFormatted: "Gizmo", otherValue: "{backspace}Gadget", otherValueFormatted: "Gadget", - setValue: value => { + setValue: (value) => { H.popover().findByRole("textbox").clear().type(value).blur(); H.popover().button("Add filter").click(); }, - updateValue: value => { + updateValue: (value) => { H.popover().findByRole("textbox").clear().type(value).blur(); H.popover().button("Update filter").click(); }, diff --git a/e2e/test/scenarios/native-filters/sql-filters-source.cy.spec.js b/e2e/test/scenarios/native-filters/sql-filters-source.cy.spec.js index 9c972171b4f..1af04b26903 100644 --- a/e2e/test/scenarios/native-filters/sql-filters-source.cy.spec.js +++ b/e2e/test/scenarios/native-filters/sql-filters-source.cy.spec.js @@ -916,7 +916,7 @@ describe("scenarios > filters > sql filters > values source > number parameter", }); }); -const getQuestionResource = questionId => ({ +const getQuestionResource = (questionId) => ({ resource: { question: questionId }, params: {}, }); @@ -964,7 +964,7 @@ const getTextTargetQuestion = ({ query, tag, parameter }) => { }); }; -const getStructuredTextTargetQuestion = questionId => { +const getStructuredTextTargetQuestion = (questionId) => { return getTextTargetQuestion({ query: "SELECT * FROM PRODUCTS WHERE CATEGORY = {{tag}}", parameter: { @@ -977,7 +977,7 @@ const getStructuredTextTargetQuestion = questionId => { }); }; -const getNativeTextTargetQuestion = questionId => { +const getNativeTextTargetQuestion = (questionId) => { return getTextTargetQuestion({ query: "SELECT * FROM PRODUCTS WHERE EAN = {{tag}}", parameter: { @@ -1021,7 +1021,7 @@ const getDimensionTargetQuestion = ({ tag, parameter }) => { }); }; -const getStructuredDimensionTargetQuestion = questionId => { +const getStructuredDimensionTargetQuestion = (questionId) => { return getDimensionTargetQuestion({ tag: { dimension: ["field", PRODUCTS.CATEGORY, null], @@ -1037,7 +1037,7 @@ const getStructuredDimensionTargetQuestion = questionId => { }); }; -const getNativeDimensionTargetQuestion = questionId => { +const getNativeDimensionTargetQuestion = (questionId) => { return getDimensionTargetQuestion({ tag: { dimension: ["field", PRODUCTS.EAN, null], @@ -1072,13 +1072,13 @@ const getListDimensionTargetQuestion = ({ const updateQuestion = () => { cy.findByText("Save").click(); - cy.findByTestId("save-question-modal").within(modal => { + cy.findByTestId("save-question-modal").within((modal) => { cy.findByText("Save").click(); }); cy.wait("@updateQuestion"); }; -const checkFilterValueInList = value => { +const checkFilterValueInList = (value) => { // eslint-disable-next-line no-unsafe-element-filtering H.popover() .last() @@ -1087,7 +1087,7 @@ const checkFilterValueInList = value => { }); }; -const checkFilterValueNotInList = value => { +const checkFilterValueNotInList = (value) => { // eslint-disable-next-line no-unsafe-element-filtering H.popover() .last() diff --git a/e2e/test/scenarios/native/native-database-source.cy.spec.js b/e2e/test/scenarios/native/native-database-source.cy.spec.js index db030f68a28..d99c350472e 100644 --- a/e2e/test/scenarios/native/native-database-source.cy.spec.js +++ b/e2e/test/scenarios/native/native-database-source.cy.spec.js @@ -69,7 +69,7 @@ describe( selectDatabase(additionalPG); cy.log("Delete previously persisted database."); - cy.get("@postgresID").then(databaseId => { + cy.get("@postgresID").then((databaseId) => { cy.request("DELETE", `/api/database/${databaseId}`); }); diff --git a/e2e/test/scenarios/native/native-reproductions.cy.spec.js b/e2e/test/scenarios/native/native-reproductions.cy.spec.js index d9be1dc84d8..47e7dc51ad4 100644 --- a/e2e/test/scenarios/native/native-reproductions.cy.spec.js +++ b/e2e/test/scenarios/native/native-reproductions.cy.spec.js @@ -473,7 +473,7 @@ describe("issue 21550", () => { cy.icon("chevrondown").click({ force: true }); }); - cy.get("pre").then($pre => { + cy.get("pre").then(($pre) => { const preWidth = $pre[0].getBoundingClientRect().width; const clientWidth = $pre[0].clientWidth; const BORDERS = 2; // 1px left and right @@ -562,7 +562,7 @@ describe("issue 21597", { tags: "@external" }, () => { it("display the relevant error message in save question modal (metabase#21597)", () => { const message = 'Invalid Field Filter: Field 164574 "PRODUCTS"."CATEGORY" belongs to Database 2276 "sample-dataset", but the query is against Database 2275 "test-data"'; - cy.intercept({ method: "POST", url: "/api/card" }, request => { + cy.intercept({ method: "POST", url: "/api/card" }, (request) => { request.reply({ body: { message: message, @@ -786,7 +786,7 @@ describe("issue 35785", () => { cy.findByTestId("qb-header").findByRole("button", { name: "Save" }).click(); - cy.findByTestId("save-question-modal").within(modal => { + cy.findByTestId("save-question-modal").within((modal) => { cy.findByText("Save").click(); }); @@ -833,7 +833,7 @@ describe("issue 22991", () => { cy.signInAsNormalUser(); H.startNewNativeQuestion(); - cy.get("@questionId").then(questionId => { + cy.get("@questionId").then((questionId) => { // can't use cy.type because it does not simulate the bug H.NativeEditor.type(`select * from {{${questionId}}}`); }); diff --git a/e2e/test/scenarios/native/native-reproductions.cy.spec.ts b/e2e/test/scenarios/native/native-reproductions.cy.spec.ts index 016eb189523..28849b7690f 100644 --- a/e2e/test/scenarios/native/native-reproductions.cy.spec.ts +++ b/e2e/test/scenarios/native/native-reproductions.cy.spec.ts @@ -217,7 +217,7 @@ describe("issue 53194", () => { beforeEach(() => { H.restore(); cy.signInAsAdmin(); - Object.values(REVIEWS).forEach(fieldId => { + Object.values(REVIEWS).forEach((fieldId) => { cy.request("PUT", `/api/field/${fieldId}`, { visibility_type: "sensitive", }); @@ -275,18 +275,18 @@ describe("issue 53171", () => { it("title and icons in data reference sidebar should not overflow (metabase#53171)", () => { H.startNewNativeQuestion(); - cy.get("@longNameQuestionId").then(longNameQuestion => { + cy.get("@longNameQuestionId").then((longNameQuestion) => { H.NativeEditor.type(`{{#${longNameQuestion}`); }); - cy.findByTestId("sidebar-content").within($container => { + cy.findByTestId("sidebar-content").within(($container) => { const [container] = $container; - cy.findByTestId("sidebar-header").should($header => { + cy.findByTestId("sidebar-header").should(($header) => { const [header] = $header; const headerDescendants = header.querySelectorAll("*"); - headerDescendants.forEach(descendant => { + headerDescendants.forEach((descendant) => { H.assertDescendantNotOverflowsContainer(descendant, container); }); }); @@ -300,7 +300,7 @@ describe("issue 53171", () => { function verifyIconVisibleAndSized(iconName: IconName, size: number) { cy.icon(iconName) .should("be.visible") - .and(icon => { + .and((icon) => { expect(icon.outerWidth()).to.equal(size); expect(icon.outerHeight()).to.equal(size); }); @@ -326,7 +326,7 @@ describe("issue 54124", () => { it("should be possible to close the data reference sidebar (metabase#54124)", () => { H.startNewNativeQuestion(); - cy.get("@questionId").then(questionId => { + cy.get("@questionId").then((questionId) => { H.NativeEditor.type( `{{#${questionId}-reference-question }}{leftarrow}{leftarrow}{leftarrow}`, ); @@ -412,6 +412,6 @@ describe("issue 52806", () => { H.visitQuestionAdhoc(questionDetails); cy.findByTestId("main-logo-link").click(); H.modal().button("Discard changes").click(); - cy.location().should(location => expect(location.search).to.eq("")); + cy.location().should((location) => expect(location.search).to.eq("")); }); }); diff --git a/e2e/test/scenarios/native/native.cy.spec.js b/e2e/test/scenarios/native/native.cy.spec.js index 72e66fbcfec..3153c0288dc 100644 --- a/e2e/test/scenarios/native/native.cy.spec.js +++ b/e2e/test/scenarios/native/native.cy.spec.js @@ -132,7 +132,7 @@ describe("scenarios > question > native", () => { cy.findByLabelText("Name").type("Products on Category"); cy.findByText("Save").click(); - cy.wait("@card").should(xhr => { + cy.wait("@card").should((xhr) => { const requestBody = xhr.request?.body; expect(requestBody?.parameters?.length).to.equal(1); const parameter = requestBody.parameters[0]; @@ -190,7 +190,7 @@ describe("scenarios > question > native", () => { // eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage cy.findByText("This has a value"); - FILTERS.forEach(operator => { + FILTERS.forEach((operator) => { cy.log("Apply a filter"); H.filter(); H.popover().findByText("V").click(); @@ -265,7 +265,7 @@ describe("scenarios > question > native", () => { cy.findByText("Save").click(); // parameters[] should reflect the template tags - cy.wait("@card").then(xhr => { + cy.wait("@card").then((xhr) => { const requestBody = xhr.request?.body; expect(requestBody?.parameters?.length).to.equal(2); cy.wrap(xhr.response.body.id).as("questionId"); @@ -275,10 +275,10 @@ describe("scenarios > question > native", () => { cy.findByText("Not now").click(); // Now load the question again and parameters[] should still be there - cy.get("@questionId").then(questionId => { + cy.get("@questionId").then((questionId) => { cy.intercept("GET", `/api/card/${questionId}`).as("cardQuestion"); cy.visit(`/question/${questionId}?cat=Gizmo&stars=3`); - cy.wait("@cardQuestion").should(xhr => { + cy.wait("@cardQuestion").should((xhr) => { const responseBody = xhr.response?.body; expect(responseBody?.parameters?.length).to.equal(2); }); @@ -500,7 +500,7 @@ describe("no native access", { tags: ["@external", "@quarantine"] }, () => { }); it("should not display the query when you do not have native access to the data source", () => { - cy.get("@questionId").then(questionId => + cy.get("@questionId").then((questionId) => cy.visit(`/question/${questionId}`), ); diff --git a/e2e/test/scenarios/native/native_subquery.cy.spec.js b/e2e/test/scenarios/native/native_subquery.cy.spec.js index c8697845962..baba2d45fc6 100644 --- a/e2e/test/scenarios/native/native_subquery.cy.spec.js +++ b/e2e/test/scenarios/native/native_subquery.cy.spec.js @@ -190,7 +190,7 @@ describe("scenarios > question > native subquery", () => { // check the original name is in the query cy.visit(`/question/${questionId2}`); cy.findByText("Open Editor").click(); - cy.get("@questionId").then(questionId => { + cy.get("@questionId").then((questionId) => { H.NativeEditor.get() .should("be.visible") .and("contain", `{{#${questionId}-a-people-question-1}}`); @@ -205,7 +205,7 @@ describe("scenarios > question > native subquery", () => { // check the name has changed cy.visit(`/question/${questionId2}`); cy.findByText("Open Editor").click(); - cy.get("@questionId").then(questionId => { + cy.get("@questionId").then((questionId) => { H.NativeEditor.get() .should("be.visible") .and("contain", `{{#${questionId}-a-people-question-1-changed}}`); @@ -222,7 +222,7 @@ describe("scenarios > question > native subquery", () => { query: "select * from PEOPLE where STATE = 'WA'", }, }) - .then(response => { + .then((response) => { cy.wrap(response.body.id).as("nestedQuestionId"); const tagID = `#${response.body.id}`; @@ -242,7 +242,7 @@ describe("scenarios > question > native subquery", () => { }, }); }) - .then(response => { + .then((response) => { cy.wrap(response.body.id).as("toplevelQuestionId"); cy.visit(`/question/${response.body.id}`); diff --git a/e2e/test/scenarios/native/snippets.cy.spec.js b/e2e/test/scenarios/native/snippets.cy.spec.js index f6a71420fd6..6d84f6c3697 100644 --- a/e2e/test/scenarios/native/snippets.cy.spec.js +++ b/e2e/test/scenarios/native/snippets.cy.spec.js @@ -178,7 +178,7 @@ describe("scenarios > question > snippets (EE)", () => { H.setTokenFeatures("all"); }); - ["admin", "normal"].forEach(user => { + ["admin", "normal"].forEach((user) => { it(`${user} user can create a snippet (metabase#21581)`, () => { cy.intercept("POST", "/api/native-query-snippet").as("snippetCreated"); @@ -292,7 +292,7 @@ describe("scenarios > question > snippets (EE)", () => { }); }); - ["admin", "nocollection"].map(user => { + ["admin", "nocollection"].map((user) => { it("should display nested snippets in their folder", () => { createNestedSnippet(); diff --git a/e2e/test/scenarios/navigation/navbar.cy.spec.js b/e2e/test/scenarios/navigation/navbar.cy.spec.js index 3b5a0b4f0ef..1c8a4529144 100644 --- a/e2e/test/scenarios/navigation/navbar.cy.spec.js +++ b/e2e/test/scenarios/navigation/navbar.cy.spec.js @@ -32,7 +32,7 @@ describe("scenarios > navigation > navbar", () => { }, ); - cy.get("@questionId").then(id => { + cy.get("@questionId").then((id) => { cy.request("POST", `/api/bookmark/card/${id}`); H.visitQuestion(id); }); @@ -52,7 +52,7 @@ describe("scenarios > navigation > navbar", () => { }); it("should display error ui when data fetching fails", () => { - cy.intercept("GET", "/api/database", req => req.reply(500)); + cy.intercept("GET", "/api/database", (req) => req.reply(500)); cy.visit("/"); H.navigationSidebar().findByText(/An error occurred/); }); diff --git a/e2e/test/scenarios/onboarding/add-initial-data.cy.spec.ts b/e2e/test/scenarios/onboarding/add-initial-data.cy.spec.ts index 9c59509649b..83ca5974087 100644 --- a/e2e/test/scenarios/onboarding/add-initial-data.cy.spec.ts +++ b/e2e/test/scenarios/onboarding/add-initial-data.cy.spec.ts @@ -19,7 +19,7 @@ H.describeWithSnowplow( H.mockSessionPropertiesTokenFeatures({ attached_dwh: true }); }); - H.CSV_FILES.forEach(testFile => { + H.CSV_FILES.forEach((testFile) => { it(`${testFile.valid ? "Can" : "Cannot"} upload ${ testFile.fileName } to "Our analytics" using DWH`, () => { diff --git a/e2e/test/scenarios/onboarding/auth/forgot_password.cy.spec.js b/e2e/test/scenarios/onboarding/auth/forgot_password.cy.spec.js index 51abbbe6b21..8b13d7eeef1 100644 --- a/e2e/test/scenarios/onboarding/auth/forgot_password.cy.spec.js +++ b/e2e/test/scenarios/onboarding/auth/forgot_password.cy.spec.js @@ -41,7 +41,7 @@ describe("scenarios > auth > password", { tags: "@external" }, () => { }); }); -const getResetLink = html => { +const getResetLink = (html) => { const [, anchor] = html.match(//); const [, href] = anchor.match(/href="([^"]+)"/); return href; diff --git a/e2e/test/scenarios/onboarding/auth/signin.cy.spec.js b/e2e/test/scenarios/onboarding/auth/signin.cy.spec.js index f8779021b1c..a6f557994fb 100644 --- a/e2e/test/scenarios/onboarding/auth/signin.cy.spec.js +++ b/e2e/test/scenarios/onboarding/auth/signin.cy.spec.js @@ -94,7 +94,7 @@ describe("scenarios > auth > signin", () => { cy.findAllByRole("gridcell", { name: "37.65" }); }); - sizes.forEach(size => { + sizes.forEach((size) => { it(`should redirect from /auth/forgot_password back to /auth/login (viewport: ${size}) (metabase#12658)`, () => { if (Array.isArray(size)) { cy.viewport(size[0], size[1]); diff --git a/e2e/test/scenarios/onboarding/auth/sso.cy.spec.js b/e2e/test/scenarios/onboarding/auth/sso.cy.spec.js index 1837162eba5..124de9b1f49 100644 --- a/e2e/test/scenarios/onboarding/auth/sso.cy.spec.js +++ b/e2e/test/scenarios/onboarding/auth/sso.cy.spec.js @@ -14,7 +14,7 @@ describe("scenarios > auth > signin > SSO", () => { }); }); - ["ldap_auth", "google_auth"].forEach(auth => { + ["ldap_auth", "google_auth"].forEach((auth) => { it(`login history tab should be available with ${auth} enabled (metabase#15558)`, () => { H.mockCurrentUserProperty(auth, true); cy.visit("/account/profile"); diff --git a/e2e/test/scenarios/onboarding/command-palette.cy.spec.js b/e2e/test/scenarios/onboarding/command-palette.cy.spec.js index 179da3782b1..e3495d3caea 100644 --- a/e2e/test/scenarios/onboarding/command-palette.cy.spec.js +++ b/e2e/test/scenarios/onboarding/command-palette.cy.spec.js @@ -18,8 +18,8 @@ describe("command palette", () => { cy.intercept( "GET", "**/search?q=Company&context=command-palette&include_dashboard_questions=true&limit=20", - req => { - req.reply(res => { + (req) => { + req.reply((res) => { const orderedNames = ["Products", "Orders", "Reviews", "People"]; res.body.data = res.body.data.sort((a, b) => { return orderedNames.indexOf(a.name) - orderedNames.indexOf(b.name); diff --git a/e2e/test/scenarios/onboarding/embedding-homepage.cy.spec.ts b/e2e/test/scenarios/onboarding/embedding-homepage.cy.spec.ts index e2eb407bac4..4348b45e580 100644 --- a/e2e/test/scenarios/onboarding/embedding-homepage.cy.spec.ts +++ b/e2e/test/scenarios/onboarding/embedding-homepage.cy.spec.ts @@ -8,8 +8,8 @@ H.describeWithSnowplow( H.resetSnowplow(); cy.signInAsAdmin(); - cy.intercept("GET", "/api/session/properties", req => { - req.continue(res => { + cy.intercept("GET", "/api/session/properties", (req) => { + req.continue((res) => { res.body["embedding-homepage"] = "visible"; res.body["example-dashboard-id"] = 1; res.body["setup-license-active-at-setup"] = true; diff --git a/e2e/test/scenarios/onboarding/home/browse.cy.spec.ts b/e2e/test/scenarios/onboarding/home/browse.cy.spec.ts index 4adb7ca8fe8..12019109d1b 100644 --- a/e2e/test/scenarios/onboarding/home/browse.cy.spec.ts +++ b/e2e/test/scenarios/onboarding/home/browse.cy.spec.ts @@ -47,7 +47,7 @@ describe("browse > models", () => { }); it("can browse to a model in a new tab by meta-clicking", () => { - cy.on("window:before:load", win => { + cy.on("window:before:load", (win) => { // prevent Cypress opening in a new window/tab and spy on this method cy.stub(win, "open").as("open"); }); @@ -140,7 +140,7 @@ H.describeWithSnowplow("scenarios > browse", () => { it("The Browse models page shows an error message if the search endpoint throws an error", () => { cy.visit("/"); - cy.intercept("GET", "/api/search*", req => { + cy.intercept("GET", "/api/search*", (req) => { req.reply({ statusCode: 400 }); }); H.navigationSidebar().findByLabelText("Browse models").click(); @@ -151,7 +151,7 @@ H.describeWithSnowplow("scenarios > browse", () => { it("The Browse metrics page shows an error message if the search endpoint throws an error", () => { cy.visit("/"); - cy.intercept("GET", "/api/search*", req => { + cy.intercept("GET", "/api/search*", (req) => { req.reply({ statusCode: 400 }); }); H.navigationSidebar().findByLabelText("Browse metrics").click(); diff --git a/e2e/test/scenarios/onboarding/home/homepage.cy.spec.js b/e2e/test/scenarios/onboarding/home/homepage.cy.spec.js index 62e1dee615e..03dd9107b0b 100644 --- a/e2e/test/scenarios/onboarding/home/homepage.cy.spec.js +++ b/e2e/test/scenarios/onboarding/home/homepage.cy.spec.js @@ -60,11 +60,11 @@ describe("scenarios > home > homepage", () => { cy.signInAsAdmin(); cy.addSQLiteDatabase(); - cy.intercept("/api/database", req => { - req.continue(res => { + cy.intercept("/api/database", (req) => { + req.continue((res) => { res.body.data[1].initial_sync_status = "incomplete"; - return new Promise(resolve => { + return new Promise((resolve) => { setTimeout(() => { resolve(); // Setting this to be arbitrarly long so that the repeat assertion @@ -225,8 +225,8 @@ describe("scenarios > home > homepage", () => { { url: "/", }, - req => { - req.continue(res => { + (req) => { + req.continue((res) => { res.body = res.body.replace( 'src="app/dist/app-main', 'src="bad-link.js', @@ -236,7 +236,7 @@ describe("scenarios > home > homepage", () => { }, ); - cy.on("window:before:load", win => { + cy.on("window:before:load", (win) => { cy.spy(win.console, "error").as("errorConsole"); }); @@ -410,8 +410,8 @@ describe("scenarios > home > custom homepage", () => { method: "GET", middleware: true, }, - req => { - req.continue(res => { + (req) => { + req.continue((res) => { res.delay = 1000; res.send(); }); @@ -604,7 +604,7 @@ H.describeWithSnowplow("scenarios > setup", () => { }); }); -const pinItem = name => { +const pinItem = (name) => { cy.findByText(name).closest("tr").icon("ellipsis").click(); H.popover().icon("pin").click(); diff --git a/e2e/test/scenarios/onboarding/navbar/new-menu.cy.spec.js b/e2e/test/scenarios/onboarding/navbar/new-menu.cy.spec.js index 4b2cca8bbe2..ca096d57643 100644 --- a/e2e/test/scenarios/onboarding/navbar/new-menu.cy.spec.js +++ b/e2e/test/scenarios/onboarding/navbar/new-menu.cy.spec.js @@ -32,7 +32,7 @@ describe("metabase > scenarios > navbar > new menu", () => { cy.findByText("Collection").click(); }); - cy.findByTestId("new-collection-modal").then(modal => { + cy.findByTestId("new-collection-modal").then((modal) => { cy.findByTestId("collection-picker-button").findByText("Our analytics"); cy.findByPlaceholderText("My new fantastic collection").type( diff --git a/e2e/test/scenarios/onboarding/navbar/whats-new.cy.spec.js b/e2e/test/scenarios/onboarding/navbar/whats-new.cy.spec.js index d223cc50334..e5fbc7b6b33 100644 --- a/e2e/test/scenarios/onboarding/navbar/whats-new.cy.spec.js +++ b/e2e/test/scenarios/onboarding/navbar/whats-new.cy.spec.js @@ -56,8 +56,8 @@ describe("nav > what's new notification", () => { function mockVersions({ currentVersion, versions = [] }) { const [latest, ...older] = versions; - cy.intercept("GET", "/api/session/properties", req => { - req.reply(res => { + cy.intercept("GET", "/api/session/properties", (req) => { + req.reply((res) => { res.body["version"] = { tag: currentVersion }; res.body["version-info"] = createMockVersionInfo({ latest, older }); }); diff --git a/e2e/test/scenarios/onboarding/notifications.cy.spec.js b/e2e/test/scenarios/onboarding/notifications.cy.spec.js index 62f5897f210..b033120f24a 100644 --- a/e2e/test/scenarios/onboarding/notifications.cy.spec.js +++ b/e2e/test/scenarios/onboarding/notifications.cy.spec.js @@ -162,8 +162,8 @@ describe("scenarios > account > notifications", () => { }); it("should be able to see created notifications that a user is not subscribed to", () => { - cy.get("@admin_id").then(admin_id => - cy.get("@card_id").then(card_id => { + cy.get("@admin_id").then((admin_id) => + cy.get("@card_id").then((card_id) => { H.createQuestionAlert({ admin_id, card_id, diff --git a/e2e/test/scenarios/onboarding/onboarding-checklist.cy.spec.ts b/e2e/test/scenarios/onboarding/onboarding-checklist.cy.spec.ts index bf10bd59543..96898ef120a 100644 --- a/e2e/test/scenarios/onboarding/onboarding-checklist.cy.spec.ts +++ b/e2e/test/scenarios/onboarding/onboarding-checklist.cy.spec.ts @@ -159,7 +159,7 @@ H.describeWithSnowplow("Onboarding checklist events", () => { ); H.expectGoodSnowplowEvents(PAGE_VIEW); - items.forEach(i => { + items.forEach((i) => { cy.findByTestId(`${i}-item`).click(); H.expectGoodSnowplowEvent({ event: "onboarding_checklist_item_expanded", diff --git a/e2e/test/scenarios/onboarding/reference/databases.cy.spec.js b/e2e/test/scenarios/onboarding/reference/databases.cy.spec.js index c008b84ebe2..b54146f5134 100644 --- a/e2e/test/scenarios/onboarding/reference/databases.cy.spec.js +++ b/e2e/test/scenarios/onboarding/reference/databases.cy.spec.js @@ -64,7 +64,7 @@ describe("scenarios > reference > databases", () => { describe("multiple databases sorting order", () => { beforeEach(() => { - ["d", "b", "a", "c"].forEach(name => { + ["d", "b", "a", "c"].forEach((name) => { cy.addSQLiteDatabase({ name }); }); }); diff --git a/e2e/test/scenarios/onboarding/setup/setup.cy.spec.ts b/e2e/test/scenarios/onboarding/setup/setup.cy.spec.ts index 16d254b52e5..f228b9ff64a 100644 --- a/e2e/test/scenarios/onboarding/setup/setup.cy.spec.ts +++ b/e2e/test/scenarios/onboarding/setup/setup.cy.spec.ts @@ -9,7 +9,7 @@ const { admin } = USERS; const locales = ["en", "xx"]; describe("scenarios > setup", () => { - locales.forEach(locale => { + locales.forEach((locale) => { beforeEach(() => H.restore("blank")); it( @@ -438,7 +438,7 @@ describe("scenarios > setup (EE)", () => { H.main().findByText("Looking for more?").should("exist"); - cy.wait("@tokenStatus").then(request => { + cy.wait("@tokenStatus").then((request) => { expect(request.response?.body.valid).to.equal(true); }); }); diff --git a/e2e/test/scenarios/onboarding/urls.cy.spec.js b/e2e/test/scenarios/onboarding/urls.cy.spec.js index 74162bcaca2..11dfcfe9a90 100644 --- a/e2e/test/scenarios/onboarding/urls.cy.spec.js +++ b/e2e/test/scenarios/onboarding/urls.cy.spec.js @@ -32,7 +32,7 @@ describe("URLs", () => { [ `/browse/databases/${SAVED_QUESTIONS_VIRTUAL_DB_ID}`, `/browse/databases/${SAVED_QUESTIONS_VIRTUAL_DB_ID}-saved-questions`, - ].forEach(url => { + ].forEach((url) => { it("should open 'Saved Questions' database correctly", () => { cy.visit(url); cy.findByRole("heading", { name: "Databases" }); diff --git a/e2e/test/scenarios/organization/entity-picker.cy.spec.ts b/e2e/test/scenarios/organization/entity-picker.cy.spec.ts index bb7005a041f..894b17acfc2 100644 --- a/e2e/test/scenarios/organization/entity-picker.cy.spec.ts +++ b/e2e/test/scenarios/organization/entity-picker.cy.spec.ts @@ -1136,8 +1136,8 @@ function createTestCards() { }, ]; - types.forEach(type => { - suffixes.forEach(suffix => { + types.forEach((type) => { + suffixes.forEach((suffix) => { collections.forEach(({ id, name }) => { H.createQuestion({ ...cardDetails, @@ -1149,7 +1149,7 @@ function createTestCards() { }); }); - suffixes.forEach(suffix => { + suffixes.forEach((suffix) => { H.createQuestion({ ...cardDetails, name: `Orders Dashboard question ${suffix}`, @@ -1175,8 +1175,8 @@ function createTestCollections() { }, ]; - suffixes.forEach(suffix => { - collections.forEach(collection => + suffixes.forEach((suffix) => { + collections.forEach((collection) => H.createCollection({ ...collection, name: `${collection.name} ${suffix}`, @@ -1204,8 +1204,8 @@ function createTestDashboards() { }, ]; - suffixes.forEach(suffix => { - dashboards.forEach(dashboard => + suffixes.forEach((suffix) => { + dashboards.forEach((dashboard) => H.createDashboard({ ...dashboard, name: `${dashboard.name} ${suffix}` }), ); }); @@ -1245,7 +1245,7 @@ function createTestDashboardWithEmptyCard( } function selectQuestionFromDashboard(dashboardDetails?: H.DashboardDetails) { - createTestDashboardWithEmptyCard(dashboardDetails).then(dashboard => { + createTestDashboardWithEmptyCard(dashboardDetails).then((dashboard) => { H.visitDashboard(dashboard.id); H.editDashboard(); H.getDashboardCard().button("Select question").click(); @@ -1291,11 +1291,11 @@ function assertSearchResults({ notFoundItems?: string[]; totalFoundItemsCount?: number; }) { - foundItems.forEach(item => { + foundItems.forEach((item) => { cy.findByText(item).should("exist"); }); - notFoundItems.forEach(item => { + notFoundItems.forEach((item) => { cy.findByText(item).should("not.exist"); }); @@ -1312,7 +1312,7 @@ function assertSearchResults({ } function testCardSearchForNormalUser({ tabs }: { tabs: string[] }) { - tabs.forEach(tab => { + tabs.forEach((tab) => { cy.log("root collection - automatically selected"); H.entityPickerModal().within(() => { H.entityPickerModalTab(tab).click(); @@ -1411,7 +1411,7 @@ function testCardSearchForInaccessibleRootCollection({ tabs: string[]; isRootSelected: boolean; }) { - tabs.forEach(tab => { + tabs.forEach((tab) => { if (isRootSelected) { cy.log("inaccessible root collection - automatically selected"); H.entityPickerModal().within(() => { @@ -1507,7 +1507,7 @@ function testCardSearchForInaccessibleRootCollection({ } function testCardSearchForAllPersonalCollections({ tabs }: { tabs: string[] }) { - tabs.forEach(tab => { + tabs.forEach((tab) => { H.entityPickerModal().within(() => { H.entityPickerModalTab(tab).click(); cy.findByText("All personal collections").click(); diff --git a/e2e/test/scenarios/organization/official-collections.cy.spec.js b/e2e/test/scenarios/organization/official-collections.cy.spec.js index 196085fc96a..7e7ddf132ac 100644 --- a/e2e/test/scenarios/organization/official-collections.cy.spec.js +++ b/e2e/test/scenarios/organization/official-collections.cy.spec.js @@ -40,7 +40,7 @@ describe("official collections", () => { cy.visit("/collection/root"); startNewCollectionCreation(); - cy.findByTestId("new-collection-modal").then(modal => { + cy.findByTestId("new-collection-modal").then((modal) => { assertNoCollectionTypeInput(); cy.findByLabelText("Close").click(); }); @@ -85,7 +85,7 @@ describe("official collections", () => { openCollection("First collection"); startNewCollectionCreation(); - cy.findByTestId("new-collection-modal").then(modal => { + cy.findByTestId("new-collection-modal").then((modal) => { assertNoCollectionTypeInput(); cy.findByLabelText("Close").click(); }); @@ -108,7 +108,7 @@ describe("official collections", () => { H.popover().findByText("Make collection official").should("exist"); startNewCollectionCreation(); - cy.findByTestId("new-collection-modal").then(modal => { + cy.findByTestId("new-collection-modal").then((modal) => { assertHasCollectionTypeInput(); cy.findByPlaceholderText("My new fantastic collection").type( "Personal collection child", @@ -125,7 +125,7 @@ describe("official collections", () => { H.popover().findByText("Make collection official").should("exist"); startNewCollectionCreation(); - cy.findByTestId("new-collection-modal").then(modal => { + cy.findByTestId("new-collection-modal").then((modal) => { assertHasCollectionTypeInput(); cy.findByLabelText("Close").click(); }); @@ -149,7 +149,7 @@ function testOfficialBadgePresence(expectBadge = true) { H.createCollection({ name: COLLECTION_NAME, authority_level: "official", - }).then(response => { + }).then((response) => { const { id: collectionId } = response.body; H.createQuestion({ name: "Official Question", @@ -209,7 +209,7 @@ function testOfficialQuestionBadgeInRegularDashboard(expectBadge = true) { H.createCollection({ name: COLLECTION_NAME, authority_level: "official", - }).then(response => { + }).then((response) => { const { id: collectionId } = response.body; H.createQuestionAndDashboard({ questionDetails: { @@ -237,7 +237,7 @@ function openCollection(collectionName) { function createAndOpenOfficialCollection({ name }) { startNewCollectionCreation(); - cy.findByTestId("new-collection-modal").then(modal => { + cy.findByTestId("new-collection-modal").then((modal) => { cy.findByPlaceholderText("My new fantastic collection").type(name); cy.findByText("Official").click(); cy.findByText("Create").click(); diff --git a/e2e/test/scenarios/organization/timelines-collection.cy.spec.js b/e2e/test/scenarios/organization/timelines-collection.cy.spec.js index 1fc21e7968c..bed11b6416d 100644 --- a/e2e/test/scenarios/organization/timelines-collection.cy.spec.js +++ b/e2e/test/scenarios/organization/timelines-collection.cy.spec.js @@ -730,11 +730,11 @@ H.describeWithSnowplow("scenarios > collections > timelines", () => { }); }); -const openMenu = name => { +const openMenu = (name) => { return cy.findByText(name).parent().parent().icon("ellipsis").click(); }; -const setFormattingSettings = settings => { +const setFormattingSettings = (settings) => { cy.request("PUT", "api/setting/custom-formatting", { value: settings, }); diff --git a/e2e/test/scenarios/permissions/admin-permissions.cy.spec.js b/e2e/test/scenarios/permissions/admin-permissions.cy.spec.js index 27fcdf0103c..ced50233ce8 100644 --- a/e2e/test/scenarios/permissions/admin-permissions.cy.spec.js +++ b/e2e/test/scenarios/permissions/admin-permissions.cy.spec.js @@ -55,7 +55,7 @@ describe("scenarios > admin > permissions", { tags: "@OSS" }, () => { cy.findAllByRole("option").contains("Query builder and native").click(); // stub out the PUT and save - cy.intercept("PUT", "/api/permissions/graph", req => { + cy.intercept("PUT", "/api/permissions/graph", (req) => { req.reply(500, "Server error"); }); // eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage @@ -390,7 +390,7 @@ describe("scenarios > admin > permissions", { tags: "@OSS" }, () => { "Query builder and native", ); - cy.get("@graph").then(data => { + cy.get("@graph").then((data) => { cy.request("PUT", "/api/permissions/graph", { groups: {}, revision: data.response.body.revision, @@ -416,7 +416,7 @@ describe("scenarios > admin > permissions", { tags: "@OSS" }, () => { "Query builder and native", ); - cy.get("@graph").then(data => { + cy.get("@graph").then((data) => { cy.request("PUT", "/api/permissions/graph", { groups: {}, revision: data.response.body.revision, @@ -585,8 +585,8 @@ describe("scenarios > admin > permissions", () => { }; // When the app calls for session properties, give them a modified API response - cy.intercept("/api/session/properties", req => { - req.continue(res => { + cy.intercept("/api/session/properties", (req) => { + req.continue((res) => { res.body = { ...res.body, ...tempState }; }); }).as("sessionProps"); @@ -636,8 +636,8 @@ describe("scenarios > admin > permissions", () => { }; // When the app calls for session properties, give them a modified API response - cy.intercept("/api/session/properties", req => { - req.continue(res => { + cy.intercept("/api/session/properties", (req) => { + req.continue((res) => { res.body = { ...res.body, ...tempState }; }); }).as("sessionProps"); @@ -693,7 +693,7 @@ describe("scenarios > admin > permissions", () => { cy.button("Yes").click(); }); - cy.wait("@updateGraph").then(interception => { + cy.wait("@updateGraph").then((interception) => { const requestGroupIds = Object.keys(interception.request.body.groups); const responseGroupIds = Object.keys(interception.response.body.groups); expect(requestGroupIds).to.deep.equal(responseGroupIds); @@ -727,7 +727,7 @@ describe("scenarios > admin > permissions", () => { cy.button("Yes").click(); }); - cy.wait("@updateGraph").then(interception => { + cy.wait("@updateGraph").then((interception) => { cy.log("should skip graph in request and response"); expect(interception.response.body).to.not.haveOwnProperty("groups"); }); @@ -746,7 +746,7 @@ describe("scenarios > admin > permissions", () => { cy.button("Yes").click(); }); - cy.wait("@updateGraph").then(interception => { + cy.wait("@updateGraph").then((interception) => { cy.log("should not send previously saved edits"); expect(interception.request.body.groups).to.not.haveOwnProperty( USER_GROUPS.ALL_USERS_GROUP, diff --git a/e2e/test/scenarios/permissions/download-permissions.cy.spec.js b/e2e/test/scenarios/permissions/download-permissions.cy.spec.js index d1f9790b837..ba47181315b 100644 --- a/e2e/test/scenarios/permissions/download-permissions.cy.spec.js +++ b/e2e/test/scenarios/permissions/download-permissions.cy.spec.js @@ -178,7 +178,7 @@ describe("scenarios > admin > permissions > data > downloads", () => { it("lets user download results from native queries", () => { cy.signInAsNormalUser(); - cy.get("@nativeQuestionId").then(id => { + cy.get("@nativeQuestionId").then((id) => { H.visitQuestion(id); H.downloadAndAssert( @@ -212,7 +212,7 @@ describe("scenarios > admin > permissions > data > downloads", () => { cy.signInAsNormalUser(); - cy.get("@nativeQuestionId").then(id => { + cy.get("@nativeQuestionId").then((id) => { H.visitQuestion(id); cy.findByText("Showing first 2,000 rows"); @@ -240,7 +240,7 @@ describe("scenarios > admin > permissions > data > downloads", () => { cy.signInAsNormalUser(); - cy.get("@nativeQuestionId").then(id => { + cy.get("@nativeQuestionId").then((id) => { H.visitQuestion(id); H.downloadAndAssert( diff --git a/e2e/test/scenarios/permissions/permissions-reproductions.cy.spec.js b/e2e/test/scenarios/permissions/permissions-reproductions.cy.spec.js index 765264ba037..7175e27867f 100644 --- a/e2e/test/scenarios/permissions/permissions-reproductions.cy.spec.js +++ b/e2e/test/scenarios/permissions/permissions-reproductions.cy.spec.js @@ -56,7 +56,7 @@ describe.skip("issue 13347", { tags: "@external" }, () => { ); }); - ["QB", "Native"].forEach(test => { + ["QB", "Native"].forEach((test) => { it(`${test.toUpperCase()} version:\n should be able to select question (from "Saved Questions") which belongs to the database user doesn't have data-permissions for (metabase#13347)`, () => { cy.signIn("none"); @@ -196,7 +196,7 @@ describe("issue 19603", () => { // Archive second collection (nested under the first one) cy.request("GET", "/api/collection/").then(({ body }) => { - const { id } = body.find(c => c.slug === "second_collection"); + const { id } = body.find((c) => c.slug === "second_collection"); H.archiveCollection(id); }); @@ -491,7 +491,7 @@ describe("issue 22727", () => { // eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage cy.findByText("Save").click(); - cy.findByTestId("save-question-modal").then(modal => { + cy.findByTestId("save-question-modal").then((modal) => { // This part reproduces https://github.com/metabase/metabase/issues/20717 cy.findByText(/^Replace original qeustion/).should("not.exist"); @@ -655,7 +655,7 @@ describe("issue 24966", () => { cy.findByLabelText("Widget").click(); cy.button("Add filter").click(); cy.location("search").should("eq", "?text=Widget"); - cy.get("@dashcardId").then(id => { + cy.get("@dashcardId").then((id) => { H.assertDatasetReqIsSandboxed({ requestAlias: `@dashcardQuery${id}` }); }); }); diff --git a/e2e/test/scenarios/permissions/permissions-reproductions.cy.spec.ts b/e2e/test/scenarios/permissions/permissions-reproductions.cy.spec.ts index a8d2c860608..60cea091512 100644 --- a/e2e/test/scenarios/permissions/permissions-reproductions.cy.spec.ts +++ b/e2e/test/scenarios/permissions/permissions-reproductions.cy.spec.ts @@ -80,7 +80,7 @@ describe("issue 11994", () => { it("does not offer to save combo question viewed in raw mode (metabase#11994)", () => { H.visitQuestion("@comboQuestionId"); - cy.location().then(questionLocation => { + cy.location().then((questionLocation) => { cy.icon("table2").click(); cy.location("href").should("eq", questionLocation.href); }); @@ -96,7 +96,7 @@ describe("issue 39221", () => { H.restore(); }); - ["admin", "normal"].forEach(user => { + ["admin", "normal"].forEach((user) => { it(`${user.toUpperCase()}: updating user-specific setting should not result in fetching all site settings (metabase#39221)`, () => { cy.signOut(); cy.signIn(user as "admin" | "normal"); diff --git a/e2e/test/scenarios/permissions/sandboxing/helpers/e2e-sandboxing-helpers.ts b/e2e/test/scenarios/permissions/sandboxing/helpers/e2e-sandboxing-helpers.ts index dc5b9161eb7..2e6b8626508 100644 --- a/e2e/test/scenarios/permissions/sandboxing/helpers/e2e-sandboxing-helpers.ts +++ b/e2e/test/scenarios/permissions/sandboxing/helpers/e2e-sandboxing-helpers.ts @@ -180,7 +180,7 @@ function addCustomColumnsToQuestion() { * all of them reside in a single collection */ export const createSandboxingDashboardAndQuestions = () => { - customViews.forEach(view => H.createQuestion(view)); + customViews.forEach((view) => H.createQuestion(view)); H.createCollection({ name: "Sandboxing", alias: "sandboxingCollectionId" }); @@ -188,14 +188,14 @@ export const createSandboxingDashboardAndQuestions = () => { H.createDashboardWithQuestions({ dashboardName: "Dashboard with sandboxable questions", dashboardDetails: { collection_id: collectionId }, - questions: questionData.map(questionDetails => ({ + questions: questionData.map((questionDetails) => ({ ...questionDetails, collection_id: collectionId, })), }).then(({ dashboard, questions }) => { cy.log("Add question based on saved question"); const savedQuestionId = questions.find( - q => q.name === savedQuestion.name, + (q) => q.name === savedQuestion.name, )?.id; H.createQuestionAndAddToDashboard( { @@ -210,7 +210,7 @@ export const createSandboxingDashboardAndQuestions = () => { ); cy.log("Add question based on model"); - const modelId = questions.find(q => q.name === model.name)?.id; + const modelId = questions.find((q) => q.name === model.name)?.id; H.createQuestionAndAddToDashboard( { name: "Question based on model", @@ -303,20 +303,20 @@ export const assignAttributeToUser = ({ attributeValue: string; }) => { cy.request("GET", "/api/user") - .then(response => { + .then((response) => { const userData = response.body.data.find( (u: { email: string }) => u.email === user.email, ); return userData.id; }) - .then(userId => { + .then((userId) => { return cy.request("GET", `/api/user/${userId}`); }) - .then(response => { + .then((response) => { const user = response.body; return user; }) - .then(user => { + .then((user) => { cy.request("PUT", `/api/user/${user.id}`, { ...user, login_attributes: { @@ -381,7 +381,7 @@ export const configureSandboxPolicy = (policy: SandboxPolicy) => { cy.log("Ensure the summary contains the correct text"); cy.findByLabelText(/Summary/) .invoke("text") - .should(summary => { + .should((summary) => { expect(summary).to.contain("Users in data can view"); if (filterColumn) { expect(summary).to.contain(`${filterColumn} field equals`); @@ -400,7 +400,7 @@ const getQuestionDescription = ( ) => { // Extract the card ID from the response URL const cardId = Number(response?.url?.match(/\/card\/(\d+)/)?.[1]); - const questionName = (questions.find(q => q.id === cardId) as any)?.name as + const questionName = (questions.find((q) => q.id === cardId) as any)?.name as | string | undefined; const query = JSON.stringify(response.body.json_query.query); @@ -416,7 +416,7 @@ export function rowsShouldContainGizmosAndWidgets({ questions: CollectionItem[]; }) { expect(responses.length).to.equal(questions.length); - responses.forEach(response => { + responses.forEach((response) => { const { questionDesc } = getQuestionDescription(response, questions); expect( JSON.stringify(response.body), @@ -428,13 +428,13 @@ export function rowsShouldContainGizmosAndWidgets({ ).to.be.false; const rows = response.body.data.rows; expect( - rows.some(row => row.includes("Gizmo")), + rows.some((row) => row.includes("Gizmo")), `Results include at least one Gizmo in ${questionDesc}`, ).to.be.true; expect( rows.some( - row => + (row) => row.includes("Widget") || row.includes("Gadget") || row.includes("Doohickey"), @@ -457,7 +457,7 @@ export function rowsShouldContainOnlyOneCategory({ }) { expect(responses.length).to.equal(questions.length); - responses.forEach(response => { + responses.forEach((response) => { const { questionDesc } = getQuestionDescription(response, questions); cy.log(`Results contain only ${productCategory}s in: ${questionDesc}`); expect(response?.body.data.is_sandboxed).to.be.true; @@ -466,7 +466,7 @@ export function rowsShouldContainOnlyOneCategory({ expect( rows.every( - row => + (row) => row.includes(productCategory) || // With implicit joins, some rows might have a null product row[0] === null, @@ -474,10 +474,10 @@ export function rowsShouldContainOnlyOneCategory({ `Every result should have have a ${productCategory} in: ${questionDesc}`, ).to.be.true; productCategories - .filter(category => category !== productCategory) - .forEach(otherCategory => { + .filter((category) => category !== productCategory) + .forEach((otherCategory) => { expect( - !rows.some(row => row.includes(otherCategory)), + !rows.some((row) => row.includes(otherCategory)), `No results should have ${otherCategory}s in: ${questionDesc}`, ).to.be.true; }); @@ -487,7 +487,7 @@ export function rowsShouldContainOnlyOneCategory({ export const valuesShouldContainGizmosAndWidgets = ( valuesArray: (FieldValue | ParameterValue)[], ) => { - const values = valuesArray.map(val => val[0]); + const values = valuesArray.map((val) => val[0]); expect(values).to.contain("Gizmo"); expect(values).to.contain("Widget"); }; @@ -496,7 +496,7 @@ export const valuesShouldContainOnlyOneCategory = ( valuesArray: (FieldValue | ParameterValue)[], productCategory: (typeof productCategories)[number], ) => { - const values = valuesArray.map(val => val[0]); + const values = valuesArray.map((val) => val[0]); expect(values).to.deep.equal([productCategory]); }; @@ -509,9 +509,9 @@ export const getDashcardResponses = ( expect(questions.length).to.be.greaterThan(0); return cy .wait(new Array(questions.length).fill("@dashcardQuery")) - .then(interceptions => { + .then((interceptions) => { const responses = interceptions.map( - i => i.response as unknown as DashcardQueryResponse, + (i) => i.response as unknown as DashcardQueryResponse, ); return { questions, responses }; }); @@ -520,10 +520,10 @@ export const getDashcardResponses = ( export const getCardResponses = (questions: CollectionItem[]) => { expect(questions.length).to.be.greaterThan(0); return H.cypressWaitAll( - questions.map(question => + questions.map((question) => cy.request("POST", `/api/card/${question.id}/query`), ), - ).then(responses => { + ).then((responses) => { return { responses: responses, questions: questions }; }) as Cypress.Chainable<{ responses: DatasetResponse[]; @@ -568,11 +568,11 @@ export const assertNoResultsOrValuesAreSandboxed = ( }), ); - getFieldValuesForProductCategories().then(response => + getFieldValuesForProductCategories().then((response) => valuesShouldContainGizmosAndWidgets(response.body.values), ); - getParameterValuesForProductCategories().then(response => + getParameterValuesForProductCategories().then((response) => valuesShouldContainGizmosAndWidgets(response.body.values), ); }; @@ -584,10 +584,10 @@ export const assertAllResultsAndValuesAreSandboxed = ( ) => { checkNotNull(dashboard); - getDashcardResponses(dashboard, questions).then(data => + getDashcardResponses(dashboard, questions).then((data) => rowsShouldContainOnlyOneCategory({ ...data, productCategory }), ); - getCardResponses(questions).then(data => + getCardResponses(questions).then((data) => rowsShouldContainOnlyOneCategory({ ...data, productCategory }), ); H.visitQuestionAdhoc(adhocQuestionData).then(({ response }) => @@ -598,10 +598,10 @@ export const assertAllResultsAndValuesAreSandboxed = ( }), ); - getFieldValuesForProductCategories().then(response => + getFieldValuesForProductCategories().then((response) => valuesShouldContainOnlyOneCategory(response.body.values, productCategory), ); - getParameterValuesForProductCategories().then(response => + getParameterValuesForProductCategories().then((response) => valuesShouldContainOnlyOneCategory(response.body.values, productCategory), ); }; diff --git a/e2e/test/scenarios/permissions/sandboxing/sandboxing-via-api.cy.spec.js b/e2e/test/scenarios/permissions/sandboxing/sandboxing-via-api.cy.spec.js index 7dc30b66ed7..c557c4d9c42 100644 --- a/e2e/test/scenarios/permissions/sandboxing/sandboxing-via-api.cy.spec.js +++ b/e2e/test/scenarios/permissions/sandboxing/sandboxing-via-api.cy.spec.js @@ -187,7 +187,7 @@ describe("admin > permissions > sandboxes (tested via the API)", () => { function verifyCategoryList(visibleCategories) { H.popover().within(() => { - allCategories.forEach(value => { + allCategories.forEach((value) => { if (visibleCategories.includes(value)) { cy.findByText(value).should("be.visible"); } else { @@ -443,7 +443,7 @@ describe("admin > permissions > sandboxes (tested via the API)", () => { }); }); - ["remapped", "default"].forEach(test => { + ["remapped", "default"].forEach((test) => { it(`${test.toUpperCase()} version:\n drill-through should work on implicit joined tables with sandboxes (metabase#13641)`, () => { const QUESTION_NAME = "13641"; @@ -520,7 +520,7 @@ describe("admin > permissions > sandboxes (tested via the API)", () => { cy.findByText("See these Orders").click(); cy.log("Reported failing on v1.37.0.2"); - cy.wait("@dataset").then(xhr => { + cy.wait("@dataset").then((xhr) => { expect(xhr.response.body.error).not.to.exist; }); // eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage @@ -673,7 +673,7 @@ describe("admin > permissions > sandboxes (tested via the API)", () => { cy.signInAsSandboxedUser(); H.openOrdersTable({ - callback: xhr => expect(xhr.response.body.error).not.to.exist, + callback: (xhr) => expect(xhr.response.body.error).not.to.exist, }); cy.wait("@datasetQuery"); @@ -808,7 +808,7 @@ describe("admin > permissions > sandboxes (tested via the API)", () => { cy.signOut(); cy.signInAsSandboxedUser(); H.openOrdersTable({ - callback: xhr => expect(xhr.response.body.error).not.to.exist, + callback: (xhr) => expect(xhr.response.body.error).not.to.exist, }); H.assertQueryBuilderRowCount(11); // test that user is sandboxed - normal users has over 2000 rows H.assertDatasetReqIsSandboxed({ @@ -828,7 +828,7 @@ describe("admin > permissions > sandboxes (tested via the API)", () => { }); }); - ["remapped", "default"].forEach(test => { + ["remapped", "default"].forEach((test) => { it(`${test.toUpperCase()} version:\n should work on questions with joins, with sandboxed target table, where target fields cannot be filtered (metabase#13642)`, () => { const QUESTION_NAME = "13642"; const PRODUCTS_ALIAS = "Products"; @@ -902,7 +902,7 @@ describe("admin > permissions > sandboxes (tested via the API)", () => { // eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage cy.findByText("See these Orders").click(); - cy.wait("@dataset").then(xhr => { + cy.wait("@dataset").then((xhr) => { expect(xhr.response.body.error).not.to.exist; }); // eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage @@ -970,7 +970,7 @@ describe("admin > permissions > sandboxes (tested via the API)", () => { // eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage cy.findByText(/Products? → ID/).click(); - H.visualize(response => { + H.visualize((response) => { expect(response.body.error).to.not.exist; }); @@ -1137,7 +1137,7 @@ describe("admin > permissions > sandboxes (tested via the API)", () => { cy.signInAsSandboxedUser(); H.openOrdersTable({ - callback: xhr => expect(xhr.response.body.error).not.to.exist, + callback: (xhr) => expect(xhr.response.body.error).not.to.exist, }); // eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage @@ -1191,7 +1191,7 @@ describe("admin > permissions > sandboxes (tested via the API)", () => { cy.signInAsSandboxedUser(); H.openReviewsTable({ - callback: xhr => expect(xhr.response.body.error).not.to.exist, + callback: (xhr) => expect(xhr.response.body.error).not.to.exist, }); H.assertQueryBuilderRowCount(57); // test that user is sandboxed - normal users has 1,112 rows H.assertDatasetReqIsSandboxed(); @@ -1234,7 +1234,7 @@ describe("admin > permissions > sandboxes (tested via the API)", () => { .findByPlaceholderText("Enter user names or email addresses") .click(); H.popover().findByText("User 1").click(); - H.sendEmailAndAssert(email => { + H.sendEmailAndAssert((email) => { expect(email.html).to.include("Orders in a dashboard"); expect(email.html).to.include("37.65"); expect(email.html).not.to.include("148.23"); // Order for user with ID 3 diff --git a/e2e/test/scenarios/permissions/sandboxing/sandboxing-via-ui.cy.spec.ts b/e2e/test/scenarios/permissions/sandboxing/sandboxing-via-ui.cy.spec.ts index a085d087995..b9e0bff8358 100644 --- a/e2e/test/scenarios/permissions/sandboxing/sandboxing-via-ui.cy.spec.ts +++ b/e2e/test/scenarios/permissions/sandboxing/sandboxing-via-ui.cy.spec.ts @@ -46,7 +46,7 @@ describe( cy.signInAsAdmin(); H.setTokenFeatures("all"); preparePermissions(); - createSandboxingDashboardAndQuestions().then(result => { + createSandboxingDashboardAndQuestions().then((result) => { const { data } = result.body; for (const item of data) { if (/Dashboard/i.test(item.name)) { @@ -188,18 +188,18 @@ describe( cy.log("Should not return any data, and return an error"); cy.wait( new Array(sandboxableQuestions.length).fill("@dashcardQuery"), - ).then(interceptions => { + ).then((interceptions) => { interceptions.forEach(({ response }) => { expect(response?.body.data.rows).to.have.length(0); expect(response?.body.error_type).to.contain("invalid-query"); }); }); - getFieldValuesForProductCategories().then(response => { + getFieldValuesForProductCategories().then((response) => { expect(response.body.values).to.have.length(0); }); - getParameterValuesForProductCategories().then(response => { + getParameterValuesForProductCategories().then((response) => { expect(response.body.values).to.have.length(0); }); }); @@ -275,7 +275,7 @@ describe( }, }; - Object.values(users).forEach(user => + Object.values(users).forEach((user) => // @ts-expect-error - this isn't typed yet cy.createUserFromRawData(user), ); diff --git a/e2e/test/scenarios/permissions/view-data.cy.spec.js b/e2e/test/scenarios/permissions/view-data.cy.spec.js index a463fbd1fda..9e9086f90e3 100644 --- a/e2e/test/scenarios/permissions/view-data.cy.spec.js +++ b/e2e/test/scenarios/permissions/view-data.cy.spec.js @@ -293,7 +293,7 @@ describe( "People", "Products", "Reviews", - ].map(tableName => [ + ].map((tableName) => [ tableName, "Impersonated", "No", @@ -374,7 +374,7 @@ describe( "People", "Products", "Reviews", - ].map(tableName => [ + ].map((tableName) => [ tableName, "Can view", "No", diff --git a/e2e/test/scenarios/question-reproductions/reproductions-1.cy.spec.js b/e2e/test/scenarios/question-reproductions/reproductions-1.cy.spec.js index b94131a4ca8..46eb71b1f18 100644 --- a/e2e/test/scenarios/question-reproductions/reproductions-1.cy.spec.js +++ b/e2e/test/scenarios/question-reproductions/reproductions-1.cy.spec.js @@ -240,7 +240,7 @@ describe("postgres > user > query", { tags: "@external" }, () => { cy.signInAsAdmin(); cy.request(`/api/database/${WRITABLE_DB_ID}/schema/public`).then( ({ body }) => { - const tableId = body.find(table => table.name === "orders").id; + const tableId = body.find((table) => table.name === "orders").id; H.openTable({ database: WRITABLE_DB_ID, table: tableId, @@ -297,7 +297,7 @@ describe("postgres > question > custom columns", { tags: "@external" }, () => { cy.request(`/api/database/${WRITABLE_DB_ID}/schema/public`).then( ({ body }) => { - const tableId = body.find(table => table.name === "orders").id; + const tableId = body.find((table) => table.name === "orders").id; H.openTable({ database: WRITABLE_DB_ID, table: tableId, @@ -574,7 +574,7 @@ describe("issue 17514", () => { // eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage cy.findByText("Save").click(); - cy.findByTestId("save-question-modal").within(modal => { + cy.findByTestId("save-question-modal").within((modal) => { cy.findByText("Save").click(); }); @@ -661,7 +661,7 @@ describe("issue 17910", () => { cy.intercept("POST", "/api/card").as("card"); // eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage cy.findByText("Save").click(); - cy.findByTestId("save-question-modal").within(modal => { + cy.findByTestId("save-question-modal").within((modal) => { cy.findByText("Save").click(); }); cy.wait("@card"); @@ -690,7 +690,7 @@ describe("issue 17963", { tags: "@mongo" }, () => { cy.signInAsAdmin(); cy.request(`/api/database/${WRITABLE_DB_ID}/schema/`).then(({ body }) => { - const tableId = body.find(table => table.name === "orders").id; + const tableId = body.find((table) => table.name === "orders").id; H.openTable({ database: WRITABLE_DB_ID, table: tableId, @@ -967,10 +967,10 @@ describe("issue 19341", () => { ); cy.findByTestId("loading-indicator").should("not.exist"); - cy.findAllByTestId("result-item").then($result => { + cy.findAllByTestId("result-item").then(($result) => { const searchResults = $result.toArray(); const modelTypes = new Set( - searchResults.map(k => k.getAttribute("data-model-type")), + searchResults.map((k) => k.getAttribute("data-model-type")), ); expect(modelTypes).not.to.include("card"); @@ -1144,7 +1144,7 @@ const createQ1PlusQ2Question = (questionId1, questionId2) => { const assertQ1PlusQ2Joins = () => { H.getNotebookStep("join").within(() => { - cy.findAllByTestId("notebook-cell-item").then(items => { + cy.findAllByTestId("notebook-cell-item").then((items) => { cy.wrap(items[0]).should("contain", QUESTION_1.name); cy.wrap(items[1]).should("contain", QUESTION_2.name); }); @@ -1279,7 +1279,7 @@ describe("issue 20809", () => { cy.button("Done").click(); - H.visualize(response => { + H.visualize((response) => { expect(response.body.error).to.not.exist; }); diff --git a/e2e/test/scenarios/question-reproductions/reproductions-2.cy.spec.js b/e2e/test/scenarios/question-reproductions/reproductions-2.cy.spec.js index 87ca726ee74..83179c62508 100644 --- a/e2e/test/scenarios/question-reproductions/reproductions-2.cy.spec.js +++ b/e2e/test/scenarios/question-reproductions/reproductions-2.cy.spec.js @@ -485,14 +485,14 @@ describe("issue 30165", () => { H.NativeEditor.focus().type(" WHERE TOTAL < 20"); H.queryBuilderHeader().findByText("Save").click(); - cy.findByTestId("save-question-modal").within(modal => { + cy.findByTestId("save-question-modal").within((modal) => { cy.findByText("Save").click(); }); cy.wait("@updateQuestion"); H.NativeEditor.focus().type(" LIMIT 10"); H.queryBuilderHeader().findByText("Save").click(); - cy.findByTestId("save-question-modal").within(modal => { + cy.findByTestId("save-question-modal").within((modal) => { cy.findByText("Save").click(); }); cy.wait("@updateQuestion"); @@ -665,7 +665,7 @@ describe("issue 43216", () => { function updateQuestion() { H.queryBuilderHeader().findByText("Save").click(); - cy.findByTestId("save-question-modal").within(modal => { + cy.findByTestId("save-question-modal").within((modal) => { cy.findByText("Save").click(); }); } diff --git a/e2e/test/scenarios/question-reproductions/reproductions-3.cy.spec.js b/e2e/test/scenarios/question-reproductions/reproductions-3.cy.spec.js index e85b4e302ad..636860ba48d 100644 --- a/e2e/test/scenarios/question-reproductions/reproductions-3.cy.spec.js +++ b/e2e/test/scenarios/question-reproductions/reproductions-3.cy.spec.js @@ -154,7 +154,7 @@ describe("issue 34414", () => { }); it("populate field values after re-adding filter on virtual table field (metabase#34414)", () => { - H.createQuestion(INVOICE_MODEL_DETAILS).then(response => { + H.createQuestion(INVOICE_MODEL_DETAILS).then((response) => { const modelId = response.body.id; H.visitQuestionAdhoc({ @@ -548,7 +548,7 @@ describe( cy.intercept("POST", "/api/dataset").as("dataset"); cy.request(`/api/database/${WRITABLE_DB_ID}/schema/`).then(({ body }) => { - const tableId = body.find(table => table.name === "orders").id; + const tableId = body.find((table) => table.name === "orders").id; H.openTable({ database: WRITABLE_DB_ID, table: tableId, @@ -562,7 +562,7 @@ describe( H.tableInteractiveBody() .findAllByRole("gridcell") .first() - .then($cell => { + .then(($cell) => { // Ids are non-deterministic so we have to obtain the id from the cell, and store its value. const id = $cell.text(); @@ -700,7 +700,7 @@ describe("issue 42957", () => { }, ); - cy.get("@collectionId").then(collectionId => { + cy.get("@collectionId").then((collectionId) => { H.createQuestion({ name: "Question", type: "question", @@ -978,7 +978,7 @@ describe("issue 44415", () => { }); it("should be able to edit a table question in the notebook editor before running its query (metabase#44415)", () => { - cy.get("@questionId").then(questionId => + cy.get("@questionId").then((questionId) => cy.visit(`/question/${questionId}/notebook`), ); @@ -993,7 +993,7 @@ describe("issue 44415", () => { H.visualize(); cy.findByTestId("qb-filters-panel").should("not.exist"); - cy.get("@questionId").then(questionId => { + cy.get("@questionId").then((questionId) => { cy.url().should("not.include", `/question/${questionId}`); cy.url().should("include", "question#"); }); @@ -1519,7 +1519,7 @@ describe("issue 44668", () => { cy.findByText("Count").should("be.visible"); // y-axis // x-axis values - ["AK", "AL", "AR", "AZ", "CA"].forEach(state => { + ["AK", "AL", "AR", "AZ", "CA"].forEach((state) => { cy.findByText(state).should("be.visible"); }); }); @@ -1553,7 +1553,7 @@ describe("issue 44668", () => { H.queryBuilderMain() .findByLabelText("Legend") .within(() => { - ["68", "56", "49", "20", "90"].forEach(value => { + ["68", "56", "49", "20", "90"].forEach((value) => { cy.findByText(`abc_${value}`).should("exist"); }); }); @@ -1755,7 +1755,7 @@ describe("issue 45063", { tags: "@flaky" }, () => { cy.log("populate result_metadata"); cy.request("POST", `/api/card/${model.id}/query`); cy.log("map columns to database fields"); - H.setModelMetadata(model.id, field => { + H.setModelMetadata(model.id, (field) => { if (field.name === fieldName) { return { ...field, id: fieldId, semantic_type: fieldSemanticType }; } @@ -1976,8 +1976,8 @@ describe("issue 41464", () => { url: "/api/dataset", middleware: true, }, - req => { - req.on("response", res => { + (req) => { + req.on("response", (res) => { // Throttle the response to 50kbps res.setThrottle(50); }); @@ -2024,8 +2024,8 @@ describe.skip("issue 45359", () => { }); cy.document() - .then(document => document.fonts.ready) - .then(fonts => { + .then((document) => document.fonts.ready) + .then((fonts) => { cy.wrap(fonts).invoke("check", "16px Lato").should("be.true"); }); }); @@ -2041,18 +2041,18 @@ describe("issue 45452", () => { H.openOrdersTable(); H.summarize(); - cy.findByTestId("summarize-aggregation-item-list").then($el => { + cy.findByTestId("summarize-aggregation-item-list").then(($el) => { const element = $el[0]; expectNoScrollbarContainer(element); }); - cy.findByTestId("summarize-breakout-column-list").then($el => { + cy.findByTestId("summarize-breakout-column-list").then(($el) => { const element = $el[0]; expectNoScrollbarContainer(element); }); // the sidebar is the only element with a scrollbar - cy.findByTestId("sidebar-content").then($el => { + cy.findByTestId("sidebar-content").then(($el) => { const element = $el[0]; expect(element.scrollHeight > element.clientHeight).to.be.true; expect(element.offsetWidth > element.clientWidth).to.be.true; @@ -2094,7 +2094,7 @@ describe("issue 41612", () => { H.queryBuilderHeader().button("Save").click(); H.modal().button("Save").click(); - cy.wait("@createQuestion").then(xhr => { + cy.wait("@createQuestion").then((xhr) => { const card = xhr.request.body; expect(card.visualization_settings["graph.metrics"]).to.deep.equal([ "count", @@ -2130,7 +2130,7 @@ describe("issue 36027", () => { }; H.createQuestion({ query: BASE_QUERY }, { wrapId: true }).then( - baseQuestionId => { + (baseQuestionId) => { H.createQuestion( { display: "waterfall", @@ -2180,7 +2180,7 @@ describe("issue 36027", () => { // x-axis values ["January 2023", "January 2024", "January 2025", "January 2026"].forEach( - state => { + (state) => { cy.findByText(state).should("be.visible"); }, ); @@ -2195,7 +2195,7 @@ describe("issue 36027", () => { "15,000", "18,000", "21,000", - ].forEach(state => { + ].forEach((state) => { cy.findByText(state).should("be.visible"); }); }); @@ -2212,7 +2212,7 @@ describe("issue 12586", () => { H.openOrdersTable(); H.summarize(); - cy.intercept("POST", "/api/dataset", req => req.destroy()); + cy.intercept("POST", "/api/dataset", (req) => req.destroy()); H.rightSidebar().button("Done").click(); H.main() @@ -2360,8 +2360,8 @@ describe("issue 50038", () => { idAlias: "otherQuestionId", }); - cy.get("@questionId").then(questionId => { - cy.get("@otherQuestionId").then(otherQuestionId => { + cy.get("@questionId").then((questionId) => { + cy.get("@otherQuestionId").then((otherQuestionId) => { H.createQuestion( { name: "Joined question", @@ -2388,7 +2388,7 @@ describe("issue 50038", () => { }); function assertEqualHeight(selector, otherSelector) { - selector.invoke("outerHeight").then(height => { + selector.invoke("outerHeight").then((height) => { otherSelector.invoke("outerHeight").should("eq", height); }); } diff --git a/e2e/test/scenarios/question-reproductions/reproductions.cy.spec.ts b/e2e/test/scenarios/question-reproductions/reproductions.cy.spec.ts index fe69445c47e..88195ae2ab4 100644 --- a/e2e/test/scenarios/question-reproductions/reproductions.cy.spec.ts +++ b/e2e/test/scenarios/question-reproductions/reproductions.cy.spec.ts @@ -165,13 +165,13 @@ describe("issue 39487", () => { } function measureInitialValues() { - measureDatetimeFilterPickerHeight().then(initialPickerHeight => { + measureDatetimeFilterPickerHeight().then((initialPickerHeight) => { cy.wrap(initialPickerHeight).as("initialPickerHeight"); }); - measureNextButtonRect().then(nextButtonRect => { + measureNextButtonRect().then((nextButtonRect) => { cy.wrap(nextButtonRect).as("nextButtonRect"); }); - measurePreviousButtonRect().then(previousButtonRect => { + measurePreviousButtonRect().then((previousButtonRect) => { cy.wrap(previousButtonRect).as("previousButtonRect"); }); } @@ -183,24 +183,24 @@ describe("issue 39487", () => { } function assertDatetimeFilterPickerHeightDidNotChange() { - cy.get("@initialPickerHeight").then(initialPickerHeight => { - measureDatetimeFilterPickerHeight().then(height => { + cy.get("@initialPickerHeight").then((initialPickerHeight) => { + measureDatetimeFilterPickerHeight().then((height) => { expect(height).to.eq(initialPickerHeight); }); }); } function assertPreviousButtonRectDidNotChange() { - cy.get("@previousButtonRect").then(previousButtonRect => { - measurePreviousButtonRect().then(rect => { + cy.get("@previousButtonRect").then((previousButtonRect) => { + measurePreviousButtonRect().then((rect) => { expect(rect).to.deep.eq(previousButtonRect); }); }); } function assertNextButtonRectDidNotChange() { - cy.get("@nextButtonRect").then(nextButtonRect => { - measureNextButtonRect().then(rect => { + cy.get("@nextButtonRect").then((nextButtonRect) => { + measureNextButtonRect().then((rect) => { expect(rect).to.deep.eq(nextButtonRect); }); }); @@ -306,7 +306,7 @@ describe("issue 49270", () => { H.openOrdersTable(); cy.icon("sum").click(); - cy.intercept("POST", "/api/dataset", request => { + cy.intercept("POST", "/api/dataset", (request) => { request.reply({ statusCode: 500, delay: 1000 }); }); @@ -357,7 +357,7 @@ describe("issue 53170", () => { cy.findByLabelText("Add column").click(); H.popover().within(() => { cy.findByText("Combine columns").click(); - cy.button("Done").then($button => { + cy.button("Done").then(($button) => { const buttonRight = $button[0].getBoundingClientRect().right; cy.window().its("innerWidth").should("be.gt", buttonRight); }); diff --git a/e2e/test/scenarios/question/column-compare.cy.spec.ts b/e2e/test/scenarios/question/column-compare.cy.spec.ts index f758311efc4..ba88d5ec6b3 100644 --- a/e2e/test/scenarios/question/column-compare.cy.spec.ts +++ b/e2e/test/scenarios/question/column-compare.cy.spec.ts @@ -393,7 +393,7 @@ describe.skip("scenarios > question", () => { toggleColumnPickerItems(["Value difference"]); H.popover().button("Done").click(); - cy.get("@questionId").then(questionId => { + cy.get("@questionId").then((questionId) => { H.expectGoodSnowplowEvent({ event: "column_compare_via_shortcut", custom_expressions_used: CUSTOM_EXPRESSIONS_USED, @@ -448,7 +448,7 @@ describe.skip("scenarios > question", () => { toggleColumnPickerItems(["Value difference"]); H.popover().button("Done").click(); - cy.get("@questionId").then(questionId => { + cy.get("@questionId").then((questionId) => { H.expectGoodSnowplowEvent({ event: "column_compare_via_shortcut", custom_expressions_used: CUSTOM_EXPRESSIONS_USED, @@ -508,7 +508,7 @@ describe.skip("scenarios > question", () => { toggleColumnPickerItems(["Value difference"]); H.popover().button("Done").click(); - cy.get("@questionId").then(questionId => { + cy.get("@questionId").then((questionId) => { H.expectGoodSnowplowEvent({ event: "column_compare_via_shortcut", custom_expressions_used: CUSTOM_EXPRESSIONS_USED, @@ -574,7 +574,7 @@ describe.skip("scenarios > question", () => { toggleColumnPickerItems(["Value difference"]); H.popover().button("Done").click(); - cy.get("@questionId").then(questionId => { + cy.get("@questionId").then((questionId) => { H.expectGoodSnowplowEvent({ event: "column_compare_via_shortcut", custom_expressions_used: CUSTOM_EXPRESSIONS_USED, @@ -635,7 +635,7 @@ describe.skip("scenarios > question", () => { toggleColumnPickerItems(["Value difference"]); H.popover().button("Done").click(); - cy.get("@questionId").then(questionId => { + cy.get("@questionId").then((questionId) => { H.expectGoodSnowplowEvent({ event: "column_compare_via_shortcut", custom_expressions_used: CUSTOM_EXPRESSIONS_USED, @@ -691,7 +691,7 @@ describe.skip("scenarios > question", () => { toggleColumnPickerItems(["Value difference"]); H.popover().button("Done").click(); - cy.get("@questionId").then(questionId => { + cy.get("@questionId").then((questionId) => { H.expectGoodSnowplowEvent({ event: "column_compare_via_shortcut", custom_expressions_used: CUSTOM_EXPRESSIONS_USED, @@ -748,7 +748,7 @@ describe.skip("scenarios > question", () => { toggleColumnPickerItems(["Value difference"]); H.popover().button("Done").click(); - cy.get("@questionId").then(questionId => { + cy.get("@questionId").then((questionId) => { H.expectGoodSnowplowEvent({ event: "column_compare_via_shortcut", custom_expressions_used: CUSTOM_EXPRESSIONS_USED, @@ -811,7 +811,7 @@ describe.skip("scenarios > question", () => { toggleColumnPickerItems(["Value difference"]); H.popover().button("Done").click(); - cy.get("@questionId").then(questionId => { + cy.get("@questionId").then((questionId) => { H.expectGoodSnowplowEvent({ event: "column_compare_via_shortcut", custom_expressions_used: CUSTOM_EXPRESSIONS_USED, @@ -874,7 +874,7 @@ describe.skip("scenarios > question", () => { toggleColumnPickerItems(["Value difference"]); H.popover().button("Done").click(); - cy.get("@questionId").then(questionId => { + cy.get("@questionId").then((questionId) => { H.expectGoodSnowplowEvent({ event: "column_compare_via_shortcut", custom_expressions_used: CUSTOM_EXPRESSIONS_USED, @@ -929,7 +929,7 @@ describe.skip("scenarios > question", () => { toggleColumnPickerItems(["Value difference"]); H.popover().button("Done").click(); - cy.get("@questionId").then(questionId => { + cy.get("@questionId").then((questionId) => { H.expectGoodSnowplowEvent({ event: "column_compare_via_shortcut", custom_expressions_used: CUSTOM_EXPRESSIONS_USED, @@ -986,7 +986,7 @@ describe.skip("scenarios > question", () => { toggleColumnPickerItems(["Value difference"]); H.popover().button("Done").click(); - cy.get("@questionId").then(questionId => { + cy.get("@questionId").then((questionId) => { H.expectGoodSnowplowEvent({ event: "column_compare_via_shortcut", custom_expressions_used: CUSTOM_EXPRESSIONS_USED, @@ -1043,7 +1043,7 @@ describe.skip("scenarios > question", () => { toggleColumnPickerItems(["Value difference"]); H.popover().button("Done").click(); - cy.get("@questionId").then(questionId => { + cy.get("@questionId").then((questionId) => { H.expectGoodSnowplowEvent({ event: "column_compare_via_shortcut", custom_expressions_used: CUSTOM_EXPRESSIONS_USED, @@ -1149,7 +1149,7 @@ describe.skip("scenarios > question", () => { toggleColumnPickerItems(["Value difference"]); H.popover().button("Done").click(); - cy.get("@questionId").then(questionId => { + cy.get("@questionId").then((questionId) => { H.expectGoodSnowplowEvent({ event: "column_compare_via_shortcut", custom_expressions_used: CUSTOM_EXPRESSIONS_USED_MOVING_AVERAGE, @@ -1211,7 +1211,7 @@ describe.skip("scenarios > question", () => { toggleColumnPickerItems(["Value difference"]); H.popover().button("Done").click(); - cy.get("@questionId").then(questionId => { + cy.get("@questionId").then((questionId) => { H.expectGoodSnowplowEvent({ event: "column_compare_via_shortcut", custom_expressions_used: CUSTOM_EXPRESSIONS_USED_MOVING_AVERAGE, @@ -1273,7 +1273,7 @@ describe.skip("scenarios > question", () => { toggleColumnPickerItems(["Value difference"]); H.popover().button("Done").click(); - cy.get("@questionId").then(questionId => { + cy.get("@questionId").then((questionId) => { H.expectGoodSnowplowEvent({ event: "column_compare_via_shortcut", custom_expressions_used: CUSTOM_EXPRESSIONS_USED_MOVING_AVERAGE, @@ -1344,7 +1344,7 @@ describe.skip("scenarios > question", () => { toggleColumnPickerItems(["Value difference"]); H.popover().button("Done").click(); - cy.get("@questionId").then(questionId => { + cy.get("@questionId").then((questionId) => { H.expectGoodSnowplowEvent({ event: "column_compare_via_shortcut", custom_expressions_used: CUSTOM_EXPRESSIONS_USED_MOVING_AVERAGE, @@ -1401,7 +1401,7 @@ describe.skip("scenarios > question", () => { toggleColumnPickerItems(["Value difference"]); H.popover().button("Done").click(); - cy.get("@questionId").then(questionId => { + cy.get("@questionId").then((questionId) => { H.expectGoodSnowplowEvent({ event: "column_compare_via_shortcut", custom_expressions_used: CUSTOM_EXPRESSIONS_USED_MOVING_AVERAGE, @@ -1459,7 +1459,7 @@ describe.skip("scenarios > question", () => { toggleColumnPickerItems(["Value difference"]); H.popover().button("Done").click(); - cy.get("@questionId").then(questionId => { + cy.get("@questionId").then((questionId) => { H.expectGoodSnowplowEvent({ event: "column_compare_via_shortcut", custom_expressions_used: CUSTOM_EXPRESSIONS_USED_MOVING_AVERAGE, @@ -1522,7 +1522,7 @@ describe.skip("scenarios > question", () => { toggleColumnPickerItems(["Value difference"]); H.popover().button("Done").click(); - cy.get("@questionId").then(questionId => { + cy.get("@questionId").then((questionId) => { H.expectGoodSnowplowEvent({ event: "column_compare_via_shortcut", custom_expressions_used: CUSTOM_EXPRESSIONS_USED_MOVING_AVERAGE, @@ -1586,7 +1586,7 @@ describe.skip("scenarios > question", () => { toggleColumnPickerItems(["Value difference"]); H.popover().button("Done").click(); - cy.get("@questionId").then(questionId => { + cy.get("@questionId").then((questionId) => { H.expectGoodSnowplowEvent({ event: "column_compare_via_shortcut", custom_expressions_used: CUSTOM_EXPRESSIONS_USED_MOVING_AVERAGE, @@ -1648,7 +1648,7 @@ describe.skip("scenarios > question", () => { toggleColumnPickerItems(["Value difference"]); H.popover().button("Done").click(); - cy.get("@questionId").then(questionId => { + cy.get("@questionId").then((questionId) => { H.expectGoodSnowplowEvent({ event: "column_compare_via_shortcut", custom_expressions_used: CUSTOM_EXPRESSIONS_USED_MOVING_AVERAGE, @@ -1706,7 +1706,7 @@ describe.skip("scenarios > question", () => { toggleColumnPickerItems(["Value difference"]); H.popover().button("Done").click(); - cy.get("@questionId").then(questionId => { + cy.get("@questionId").then((questionId) => { H.expectGoodSnowplowEvent({ event: "column_compare_via_shortcut", custom_expressions_used: CUSTOM_EXPRESSIONS_USED_MOVING_AVERAGE, @@ -1765,7 +1765,7 @@ describe.skip("scenarios > question", () => { toggleColumnPickerItems(["Value difference"]); H.popover().button("Done").click(); - cy.get("@questionId").then(questionId => { + cy.get("@questionId").then((questionId) => { H.expectGoodSnowplowEvent({ event: "column_compare_via_shortcut", custom_expressions_used: CUSTOM_EXPRESSIONS_USED_MOVING_AVERAGE, diff --git a/e2e/test/scenarios/question/multiple-column-breakouts.cy.spec.ts b/e2e/test/scenarios/question/multiple-column-breakouts.cy.spec.ts index dd396591650..dd8ab6089e3 100644 --- a/e2e/test/scenarios/question/multiple-column-breakouts.cy.spec.ts +++ b/e2e/test/scenarios/question/multiple-column-breakouts.cy.spec.ts @@ -710,7 +710,7 @@ describe("scenarios > question > multiple column breakouts", () => { setParametersAndAssertResults("@publicDashcardQuery"); cy.log("set parameters in an embedded dashboard"); - cy.get("@dashboardId").then(dashboardId => + cy.get("@dashboardId").then((dashboardId) => H.visitEmbeddedPage({ resource: { dashboard: dashboardId }, params: {}, diff --git a/e2e/test/scenarios/question/nested.cy.spec.js b/e2e/test/scenarios/question/nested.cy.spec.js index 2bc589f9a5f..fe3034ded49 100644 --- a/e2e/test/scenarios/question/nested.cy.spec.js +++ b/e2e/test/scenarios/question/nested.cy.spec.js @@ -152,7 +152,7 @@ describe("scenarios > question > nested", () => { idAlias: "metricId", }); - cy.get("@metricId").then(metricId => { + cy.get("@metricId").then((metricId) => { // "capture" the original query because we will need to re-use it later in a nested question as "source-query" const baseQuestionDetails = { name: "12507", @@ -207,7 +207,7 @@ describe("scenarios > question > nested", () => { query: ordersJoinProductsQuery, }; - ["default", "remapped"].forEach(scenario => { + ["default", "remapped"].forEach((scenario) => { if (scenario === "remapped") { cy.log("Remap Product ID's display value to `title`"); H.remapDisplayValueToFK({ @@ -223,7 +223,7 @@ describe("scenarios > question > nested", () => { cy.contains("37.65"); // should handle multi-level nesting - cy.get("@nestedQuestionId").then(id => { + cy.get("@nestedQuestionId").then((id) => { visitNestedQueryAdHoc(id); cy.contains("37.65"); }); @@ -431,7 +431,7 @@ describe("scenarios > question > nested", () => { // eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage cy.findByText(/^Sum of/).click(); H.popover().findByText("VAL").click(); - cy.wait("@dataset").then(xhr => { + cy.wait("@dataset").then((xhr) => { expect(xhr.response.body.error).not.to.exist; }); cy.get("@consoleWarn").should( diff --git a/e2e/test/scenarios/question/new.cy.spec.js b/e2e/test/scenarios/question/new.cy.spec.js index fd31fd4d4db..dac0e7bc6a1 100644 --- a/e2e/test/scenarios/question/new.cy.spec.js +++ b/e2e/test/scenarios/question/new.cy.spec.js @@ -63,10 +63,10 @@ describe("scenarios > question > new", () => { const searchResultItems = cy.findAllByTestId("result-item"); - searchResultItems.then($results => { + searchResultItems.then(($results) => { const types = $results .toArray() - .map(element => element.getAttribute("data-model-type")); + .map((element) => element.getAttribute("data-model-type")); // Search results include both saved questions and database tables expect(types).to.include("card"); @@ -326,7 +326,7 @@ describe("scenarios > question > new", () => { logRecent("collection", SECOND_COLLECTION_ID); // report recent interaction for collection w/ write access logRecent("collection", THIRD_COLLECTION_ID); // report recent interaction for collection w/o write access logRecent("dashboard", ORDERS_DASHBOARD_ID); // report recent interaction for dashboard w/ write access - cy.get("@dashboardId").then(id => { + cy.get("@dashboardId").then((id) => { logRecent("dashboard", id); // report recent interaction for dashboard w/o write access }); @@ -587,7 +587,7 @@ describe("scenarios > question > new", () => { H.queryBuilderHeader().button("Save").click(); - cy.findByTestId("save-question-modal").within(modal => { + cy.findByTestId("save-question-modal").within((modal) => { cy.findByLabelText(/Where do you want to save/).click(); }); diff --git a/e2e/test/scenarios/question/notebook-data-source.cy.spec.ts b/e2e/test/scenarios/question/notebook-data-source.cy.spec.ts index 7b2b4f9fff4..66c724b13ab 100644 --- a/e2e/test/scenarios/question/notebook-data-source.cy.spec.ts +++ b/e2e/test/scenarios/question/notebook-data-source.cy.spec.ts @@ -433,7 +433,7 @@ describe("issue 28106", () => { cy.get("@schemasList").realMouseWheel({ deltaY: 100 }); cy.wait(100); - cy.get("@schemasList").then($element => { + cy.get("@schemasList").then(($element) => { const list = $element[0]; const isScrolledAllTheWayDown = list.scrollHeight - list.scrollTop === list.clientHeight; diff --git a/e2e/test/scenarios/question/notebook-link-to-data-source.cy.spec.ts b/e2e/test/scenarios/question/notebook-link-to-data-source.cy.spec.ts index 7967f520688..1dd30262443 100644 --- a/e2e/test/scenarios/question/notebook-link-to-data-source.cy.spec.ts +++ b/e2e/test/scenarios/question/notebook-link-to-data-source.cy.spec.ts @@ -33,9 +33,9 @@ describe("scenarios > notebook > link to data source", () => { H.restore(); cy.signInAsAdmin(); - cy.on("window:before:load", win => { + cy.on("window:before:load", (win) => { // prevent Cypress opening in a new window/tab and spy on this method - cy.stub(win, "open").callsFake(url => { + cy.stub(win, "open").callsFake((url) => { expect(win.open).to.be.calledOnce; // replace the current page with the linked data source upon ctrl/meta click win.location.assign(url); @@ -350,7 +350,7 @@ describe("scenarios > notebook > link to data source", () => { .click(clickConfig); cy.log("Make sure the source model is rendered in a simple mode"); - cy.get("@nestedModelId").then(id => { + cy.get("@nestedModelId").then((id) => { cy.location("pathname").should( "eq", `/model/${id}-nested-model-based-on-a-question`, @@ -382,7 +382,7 @@ describe("scenarios > notebook > link to data source", () => { .click(clickConfig); cy.log("Make sure the source model is rendered in a simple mode"); - cy.get("@nestedModelId").then(id => { + cy.get("@nestedModelId").then((id) => { cy.location("pathname").should( "eq", `/model/${id}-nested-model-based-on-a-model`, diff --git a/e2e/test/scenarios/question/notebook-native-preview-sidebar.cy.spec.ts b/e2e/test/scenarios/question/notebook-native-preview-sidebar.cy.spec.ts index 2c4bee7d1a3..eaf0a2cdfdd 100644 --- a/e2e/test/scenarios/question/notebook-native-preview-sidebar.cy.spec.ts +++ b/e2e/test/scenarios/question/notebook-native-preview-sidebar.cy.spec.ts @@ -121,7 +121,7 @@ describe("scenarios > question > notebook > native query preview sidebar", () => * - https://stackoverflow.com/a/52142935/8815185 * - https://github.com/cypress-io/cypress/discussions/21150#discussioncomment-2620947 */ - cy.once("fail", err => { + cy.once("fail", (err) => { expect(err.message).to.include( "`cy.click()` failed because this element", ); @@ -239,7 +239,7 @@ describe("scenarios > question > notebook > native query preview sidebar", () => H.openNotebook(); cy.findByTestId("native-query-preview-sidebar") .should("be.visible") - .then($sidebar => { + .then(($sidebar) => { const sidebarWidth = $sidebar[0].getBoundingClientRect().width; expect(sidebarWidth).to.be.closeTo(maxSidebarWidth, toleranceDelta); }); @@ -254,7 +254,7 @@ describe("scenarios > question > notebook > native query preview sidebar", () => cy.findByLabelText("View SQL").click(); cy.findByTestId("native-query-preview-sidebar") .should("be.visible") - .then($sidebar => { + .then(($sidebar) => { const sidebarWidth = $sidebar[0].getBoundingClientRect().width; expect(sidebarWidth).to.be.closeTo(minSidebarWidth, toleranceDelta); }); @@ -496,7 +496,7 @@ function resizeSidebar(amountX: number, cb: ResizeSidebarCallback) { "updateSidebarWidth", ); - cy.findByTestId("native-query-preview-sidebar").then($sidebar => { + cy.findByTestId("native-query-preview-sidebar").then(($sidebar) => { const initialSidebarWidth = $sidebar[0].getBoundingClientRect().width; const options = { @@ -519,7 +519,7 @@ function resizeSidebar(amountX: number, cb: ResizeSidebarCallback) { cy.wait(["@updateSidebarWidth", "@sessionProperties"]); - cy.findByTestId("native-query-preview-sidebar").then($sidebar => { + cy.findByTestId("native-query-preview-sidebar").then(($sidebar) => { const sidebarWidth = $sidebar[0].getBoundingClientRect().width; cb(initialSidebarWidth, sidebarWidth); }); diff --git a/e2e/test/scenarios/question/notebook.cy.spec.js b/e2e/test/scenarios/question/notebook.cy.spec.js index edf2941711b..5b6e2e2c665 100644 --- a/e2e/test/scenarios/question/notebook.cy.spec.js +++ b/e2e/test/scenarios/question/notebook.cy.spec.js @@ -150,8 +150,8 @@ describe("scenarios > question > notebook", { tags: "@slow" }, () => { url: "/api/dataset", middleware: true, }, - req => { - req.on("response", res => { + (req) => { + req.on("response", (res) => { // Throttle the response to 500 Kbps to simulate a mobile 3G connection res.setThrottle(500); }); @@ -546,7 +546,7 @@ describe("scenarios > question > notebook", { tags: "@slow" }, () => { cy.request(`/api/database/${WRITABLE_DB_ID}/schema/public`).then( ({ body }) => { - const tableId = body.find(table => table.name === "products").id; + const tableId = body.find((table) => table.name === "products").id; H.openTable({ database: WRITABLE_DB_ID, table: tableId, @@ -796,7 +796,7 @@ describe("scenarios > question > notebook", { tags: "@slow" }, () => { }, ); - cy.get("@metricId").then(metricId => { + cy.get("@metricId").then((metricId) => { const questionDetails = { query: { "source-table": ORDERS_ID, @@ -834,7 +834,7 @@ describe("scenarios > question > notebook", { tags: "@slow" }, () => { }, ); - cy.get("@metricId").then(metricId => { + cy.get("@metricId").then((metricId) => { const questionDetails = { query: { "source-table": `card__${metricId}`, @@ -1000,7 +1000,7 @@ describe("scenarios > question > notebook", { tags: "@slow" }, () => { cy.findAllByTestId("notebook-cell-item") .filter(`:contains(${CUSTOM_COLUMN_LONG_NAME})`) - .then(items => { + .then((items) => { for (let index = 0; index < items.length; ++index) { cy.wrap(items[index]).within(() => { assertRemoveClauseIconSize(); @@ -1135,7 +1135,7 @@ describe("scenarios > question > notebook", { tags: "@slow" }, () => { { visitQuestion: true, wrapId: true }, ); - cy.get("@questionId").then(PRODUCT_QUESTION_ID => { + cy.get("@questionId").then((PRODUCT_QUESTION_ID) => { cy.findByRole("button", { name: /Editor/ }).click(); cy.findByRole("button", { name: /Visualization/ }).click(); diff --git a/e2e/test/scenarios/question/offset.cy.spec.ts b/e2e/test/scenarios/question/offset.cy.spec.ts index df24a6605cb..4488e2e3083 100644 --- a/e2e/test/scenarios/question/offset.cy.spec.ts +++ b/e2e/test/scenarios/question/offset.cy.spec.ts @@ -524,7 +524,7 @@ describe("scenarios > question > offset", () => { cy.findAllByTestId("notebook-cell-item").findByText(name).click(); H.CustomExpressionEditor.value().should("equal", formula); - cy.on("uncaught:exception", error => { + cy.on("uncaught:exception", (error) => { // this check is intended to catch possible normalization errors if BE or FE code changes // does not run by default expect(error.message.includes("Error normalizing")).to.be.false; diff --git a/e2e/test/scenarios/question/query-external.cy.spec.js b/e2e/test/scenarios/question/query-external.cy.spec.js index 962a44fcccf..880b02c7e5a 100644 --- a/e2e/test/scenarios/question/query-external.cy.spec.js +++ b/e2e/test/scenarios/question/query-external.cy.spec.js @@ -31,7 +31,7 @@ supportedDatabases.forEach(({ database, snapshotName, dbName }) => { it(`can query ${database} database`, () => { cy.get("@schema").then(({ body }) => { const tabelId = body.find( - table => table.name.toLowerCase() === "orders", + (table) => table.name.toLowerCase() === "orders", ).id; H.openTable({ database: WRITABLE_DB_ID, diff --git a/e2e/test/scenarios/question/question-management.cy.spec.js b/e2e/test/scenarios/question/question-management.cy.spec.js index 10ce70e8862..9c9346895a8 100644 --- a/e2e/test/scenarios/question/question-management.cy.spec.js +++ b/e2e/test/scenarios/question/question-management.cy.spec.js @@ -25,7 +25,7 @@ describe( Object.entries(PERMISSIONS).forEach(([permission, userGroup]) => { context(`${permission} access`, () => { - userGroup.forEach(user => { + userGroup.forEach((user) => { onlyOn(permission === "curate", () => { describe(`${user} user`, () => { beforeEach(() => { @@ -210,7 +210,7 @@ describe( ); // Simulate a couple gets, so that the dashboards appears in recents for various users - cy.get("@dashboardId").then(dashboardId => { + cy.get("@dashboardId").then((dashboardId) => { cy.request(`/api/dashboard/${dashboardId}`); cy.request(`/api/dashboard/${ORDERS_DASHBOARD_ID}`); }); @@ -454,7 +454,7 @@ H.describeWithSnowplow("send snowplow question events", () => { }); function assertRequestNot403(xhr_alias) { - cy.wait("@" + xhr_alias).then(xhr => { + cy.wait("@" + xhr_alias).then((xhr) => { expect(xhr.status).not.to.eq(403); }); } @@ -479,13 +479,13 @@ function findPickerItem(name) { } function findActivePickerItem(name) { - return findPickerItem(name).then($button => { + return findPickerItem(name).then(($button) => { expect($button).to.have.attr("data-active", "true"); }); } function findInactivePickerItem(name) { - return findPickerItem(name).then($button => { + return findPickerItem(name).then(($button) => { expect($button).not.to.have.attr("data-active", "true"); }); } diff --git a/e2e/test/scenarios/question/saved.cy.spec.js b/e2e/test/scenarios/question/saved.cy.spec.js index 37a19920d08..16d461c6bd1 100644 --- a/e2e/test/scenarios/question/saved.cy.spec.js +++ b/e2e/test/scenarios/question/saved.cy.spec.js @@ -46,7 +46,7 @@ describe("scenarios > question > saved", () => { // Save the question H.queryBuilderHeader().button("Save").click(); - cy.findByTestId("save-question-modal").within(modal => { + cy.findByTestId("save-question-modal").within((modal) => { cy.findByText("Save").click(); }); cy.wait("@cardCreate"); @@ -66,7 +66,7 @@ describe("scenarios > question > saved", () => { H.queryBuilderHeader().button("Save").click(); - cy.findByTestId("save-question-modal").within(modal => { + cy.findByTestId("save-question-modal").within((modal) => { cy.findByText("Save question").should("be.visible"); cy.findByTestId("save-question-button").should("be.enabled"); @@ -105,7 +105,7 @@ describe("scenarios > question > saved", () => { // check that save will give option to replace // eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage cy.findByText("Save").click(); - cy.findByTestId("save-question-modal").within(modal => { + cy.findByTestId("save-question-modal").within((modal) => { cy.findByText('Replace original question, "Orders"'); cy.findByText("Save as new question"); cy.findByText("Cancel").click(); @@ -283,7 +283,7 @@ describe("scenarios > question > saved", () => { H.openQuestionActions(); H.popover().findByText("Duplicate").click(); - H.modal().should($el => { + H.modal().should(($el) => { const $modal = $el[0]; expect($modal.clientWidth).to.be.equal($modal.scrollWidth); }); @@ -382,7 +382,7 @@ describe("scenarios > question > saved", () => { cy.findAllByTestId("header-cell") .filter(":contains(Tax)") .as("headerCell") - .then($cell => { + .then(($cell) => { const originalWidth = $cell[0].getBoundingClientRect().width; cy.wrap(originalWidth).as("originalWidth"); }); @@ -409,8 +409,8 @@ describe("scenarios > question > saved", () => { // Wait until column width gets updated cy.wait(10); - cy.get("@originalWidth").then(originalWidth => { - cy.get("@headerCell").should($newCell => { + cy.get("@originalWidth").then((originalWidth) => { + cy.get("@headerCell").should(($newCell) => { const newWidth = $newCell[0].getBoundingClientRect().width; expect(newWidth).to.be.gte(originalWidth + stepX * 2); }); @@ -426,7 +426,7 @@ describe("scenarios > question > saved", () => { ); savedQuestionTitle.blur(); - savedQuestionTitle.should("be.visible").should($el => { + savedQuestionTitle.should("be.visible").should(($el) => { // clientHeight: height of the textarea // scrollHeight: height of the text content, including content not visible on the screen const heightDifference = $el[0].clientHeight - $el[0].scrollHeight; @@ -478,7 +478,7 @@ describe("scenarios > question > saved", () => { } } - HIDDEN_TYPES.forEach(visibilityType => { + HIDDEN_TYPES.forEach((visibilityType) => { it(`should show a View-only tag when the source table is marked as ${visibilityType}`, () => { hideTable("Orders", visibilityType); diff --git a/e2e/test/scenarios/question/settings.cy.spec.js b/e2e/test/scenarios/question/settings.cy.spec.js index d1cc2e29d0b..a110990d302 100644 --- a/e2e/test/scenarios/question/settings.cy.spec.js +++ b/e2e/test/scenarios/question/settings.cy.spec.js @@ -483,13 +483,13 @@ describe("scenarios > question > settings", () => { ]; H.tableInteractive().within(() => { - columnNames.forEach(text => cy.findByText(text).should("be.visible")); + columnNames.forEach((text) => cy.findByText(text).should("be.visible")); }); H.openVizSettingsSidebar(); cy.findByTestId("chartsettings-sidebar").within(() => { - columnNames.forEach(text => cy.findByText(text).should("be.visible")); + columnNames.forEach((text) => cy.findByText(text).should("be.visible")); cy.findByText("More Columns").should("not.exist"); cy.icon("eye_outline").first().click(); diff --git a/e2e/test/scenarios/search/search-filters.cy.spec.js b/e2e/test/scenarios/search/search-filters.cy.spec.js index 7849d128724..4b3a3ee1fcd 100644 --- a/e2e/test/scenarios/search/search-filters.cy.spec.js +++ b/e2e/test/scenarios/search/search-filters.cy.spec.js @@ -133,7 +133,7 @@ describe("scenarios > search", () => { { wrapId: true, idAlias: "modelId" }, ); - cy.get("@modelId").then(modelId => { + cy.get("@modelId").then((modelId) => { createModelIndex({ modelId, pkName: "ID", @@ -152,7 +152,7 @@ describe("scenarios > search", () => { }); const regex = new RegExp(`${type}$`); - cy.findAllByTestId("search-result-item").each(result => { + cy.findAllByTestId("search-result-item").each((result) => { cy.wrap(result) .should("have.attr", "aria-label") .and("match", regex); @@ -177,7 +177,7 @@ describe("scenarios > search", () => { }); const regex = new RegExp(`${type}$`); - cy.findAllByTestId("search-result-item").each(result => { + cy.findAllByTestId("search-result-item").each((result) => { cy.wrap(result) .should("have.attr", "aria-label") .and("match", regex); @@ -199,9 +199,9 @@ describe("scenarios > search", () => { cy.url().should("not.contain", "type"); - cy.findAllByTestId("search-result-item").then($results => { + cy.findAllByTestId("search-result-item").then(($results) => { const uniqueResults = new Set( - $results.toArray().map(el => { + $results.toArray().map((el) => { const label = el.getAttribute("aria-label"); return label.split(" ").slice(-1)[0]; }), @@ -387,7 +387,7 @@ describe("scenarios > search", () => { }); }); - ["normal", "sandboxed"].forEach(userType => { + ["normal", "sandboxed"].forEach((userType) => { it(`should allow ${userType} (non-admin) user to see users and filter by created_by`, () => { cy.signIn(userType); cy.visit("/"); @@ -440,7 +440,7 @@ describe("scenarios > search", () => { cy.findByTestId("qb-header-action-panel") .findByText("Save") .click(); - cy.findByTestId("save-question-modal").within(modal => { + cy.findByTestId("save-question-modal").within((modal) => { cy.findByText("Save").click(); }); }, @@ -456,7 +456,7 @@ describe("scenarios > search", () => { cy.findByTestId("qb-header-action-panel") .findByText("Save") .click(); - cy.findByTestId("save-question-modal").within(modal => { + cy.findByTestId("save-question-modal").within((modal) => { cy.findByText("Save").click(); }); }, @@ -634,7 +634,7 @@ describe("scenarios > search", () => { }); }); - ["normal", "sandboxed"].forEach(userType => { + ["normal", "sandboxed"].forEach((userType) => { it(`should allow ${userType} (non-admin) user to see users and filter by last_edited_by`, () => { cy.signIn(userType); cy.visit("/"); @@ -772,7 +772,7 @@ describe("scenarios > search", () => { cy.findByTestId("qb-header-action-panel") .findByText("Save") .click(); - cy.findByTestId("save-question-modal").within(modal => { + cy.findByTestId("save-question-modal").within((modal) => { cy.findByText("Save").click(); }); cy.signOut(); @@ -876,7 +876,7 @@ describe("scenarios > search", () => { cy.findByText('Results for "orders"').should("exist"); }); - cy.findAllByTestId("search-result-item").each(result => { + cy.findAllByTestId("search-result-item").each((result) => { cy.wrap(result).within(() => { cy.findByLabelText("verified_filled icon").should("exist"); }); @@ -895,7 +895,7 @@ describe("scenarios > search", () => { cy.wait("@search"); - cy.findAllByTestId("search-result-item").each(result => { + cy.findAllByTestId("search-result-item").each((result) => { cy.wrap(result).within(() => { cy.findByLabelText("verified_filled icon").should("exist"); }); @@ -915,7 +915,7 @@ describe("scenarios > search", () => { let verifiedElementCount = 0; let unverifiedElementCount = 0; cy.findAllByTestId("search-result-item") - .each($el => { + .each(($el) => { if (!$el.find('[aria-label="verified_filled icon"]').length) { unverifiedElementCount++; } else { @@ -1075,10 +1075,10 @@ function expectSearchResultItemNameContent( { itemNames }, { strict } = { strict: true }, ) { - cy.findAllByTestId("search-result-item-name").then($searchResultLabel => { + cy.findAllByTestId("search-result-item-name").then(($searchResultLabel) => { const searchResultLabelList = $searchResultLabel .toArray() - .map(el => el.textContent); + .map((el) => el.textContent); if (strict) { expect(searchResultLabelList).to.have.length(itemNames.length); diff --git a/e2e/test/scenarios/search/search-pagination.cy.spec.js b/e2e/test/scenarios/search/search-pagination.cy.spec.js index 16d8956c8cb..86207ba5e71 100644 --- a/e2e/test/scenarios/search/search-pagination.cy.spec.js +++ b/e2e/test/scenarios/search/search-pagination.cy.spec.js @@ -15,7 +15,7 @@ describe("scenarios > search", () => { }); it("should not search on an empty string", () => { - cy.intercept("/api/search", req => { + cy.intercept("/api/search", (req) => { expect("Unexpected call to /api/search").to.be.false; }); H.visitFullAppEmbeddingUrl({ @@ -57,8 +57,8 @@ describe("scenarios > search", () => { }); }); -const generateQuestions = count => { - _.range(count).map(i => +const generateQuestions = (count) => { + _.range(count).map((i) => H.createQuestion({ name: `generated_question ${i}`, query: { diff --git a/e2e/test/scenarios/search/search-snowplow.cy.spec.js b/e2e/test/scenarios/search/search-snowplow.cy.spec.js index f473c143c14..ed00ff8ed9e 100644 --- a/e2e/test/scenarios/search/search-snowplow.cy.spec.js +++ b/e2e/test/scenarios/search/search-snowplow.cy.spec.js @@ -24,7 +24,7 @@ H.describeWithSnowplow("scenarios > search > snowplow", () => { H.commandPaletteSearch("Orders", false); //Passing a function to ensure that runtime_milliseconds is populated as a number - H.expectGoodSnowplowEvent(data => { + H.expectGoodSnowplowEvent((data) => { if (!data) { return false; } @@ -51,7 +51,7 @@ H.describeWithSnowplow("scenarios > search > snowplow", () => { H.commandPaletteSearch("Orders", false); //Passing a function to ensure that runtime_milliseconds is populated as a number - H.expectGoodSnowplowEvent(data => { + H.expectGoodSnowplowEvent((data) => { if (!data) { return false; } @@ -178,7 +178,7 @@ H.describeWithSnowplow("scenarios > search > snowplow", () => { cy.findByTestId("type-search-filter").click(); H.popover().within(() => { - cy.findAllByTestId("type-filter-checkbox").each($el => { + cy.findAllByTestId("type-filter-checkbox").each(($el) => { cy.wrap($el).click(); }); cy.findByText("Apply").click(); diff --git a/e2e/test/scenarios/search/search-typeahead.cy.spec.js b/e2e/test/scenarios/search/search-typeahead.cy.spec.js index eb28ce2ab04..50f7ac5be5c 100644 --- a/e2e/test/scenarios/search/search-typeahead.cy.spec.js +++ b/e2e/test/scenarios/search/search-typeahead.cy.spec.js @@ -1,7 +1,7 @@ const { H } = cy; import { USERS } from "e2e/support/cypress_data"; -["admin", "normal"].forEach(user => { +["admin", "normal"].forEach((user) => { describe(`search > ${user} user`, () => { beforeEach(() => { H.restore(); diff --git a/e2e/test/scenarios/search/search.cy.spec.js b/e2e/test/scenarios/search/search.cy.spec.js index 2c599890737..a4046039d3a 100644 --- a/e2e/test/scenarios/search/search.cy.spec.js +++ b/e2e/test/scenarios/search/search.cy.spec.js @@ -140,7 +140,7 @@ describe("scenarios > search", () => { //Enseure that text is ellipsified cy.findByTestId("result-description") .findByText(/Lorem ipsum dolor sit amet./) - .then(el => H.assertIsEllipsified(el[0])); + .then((el) => H.assertIsEllipsified(el[0])); //Ensure that images are not being rendered in the descriptions cy.findByTestId("result-description") @@ -165,7 +165,7 @@ describe("scenarios > search", () => { "search-results-floating-container", ); - parentContainer.invoke("outerWidth").then(parentWidth => { + parentContainer.invoke("outerWidth").then((parentWidth) => { resultDescription .invoke("outerWidth") .should( @@ -198,8 +198,8 @@ describe("scenarios > search", () => { method: "GET", middleware: true, }, - req => { - req.continue(res => { + (req) => { + req.continue((res) => { res.delay = 1000; res.send(); }); @@ -243,7 +243,7 @@ describe("scenarios > search", () => { cy.findByText('Results for "orders"').should("exist"); }); - cy.location().should(loc => { + cy.location().should((loc) => { expect(loc.pathname).to.eq("/search"); expect(loc.search).to.eq("?q=orders"); }); @@ -308,7 +308,7 @@ describe("issue 28788", () => { cy.wait("@search"); cy.icon("hourglass").should("not.exist"); - cy.findByTestId("search-bar-results-container").then($container => { + cy.findByTestId("search-bar-results-container").then(($container) => { expect(H.isScrollableHorizontally($container[0])).to.be.false; }); }); diff --git a/e2e/test/scenarios/sharing/alert/alert-permissions.cy.spec.js b/e2e/test/scenarios/sharing/alert/alert-permissions.cy.spec.js index 3f48cdc160c..b42ab6c5941 100644 --- a/e2e/test/scenarios/sharing/alert/alert-permissions.cy.spec.js +++ b/e2e/test/scenarios/sharing/alert/alert-permissions.cy.spec.js @@ -35,9 +35,9 @@ describe("scenarios > alert > alert permissions", { tags: "@external" }, () => { beforeEach(cy.signInAsAdmin); it("should let you see all created alerts", () => { - cy.request("/api/notification").then(response => { + cy.request("/api/notification").then((response) => { const questionAlerts = response.body.filter( - notification => notification.payload_type === "notification/card", + (notification) => notification.payload_type === "notification/card", ); expect(questionAlerts).to.have.length(3); }); diff --git a/e2e/test/scenarios/sharing/alert/email-alert.cy.spec.js b/e2e/test/scenarios/sharing/alert/email-alert.cy.spec.js index 75808d6fbde..ae2476f1484 100644 --- a/e2e/test/scenarios/sharing/alert/email-alert.cy.spec.js +++ b/e2e/test/scenarios/sharing/alert/email-alert.cy.spec.js @@ -21,7 +21,7 @@ describe("scenarios > alert > email_alert", { tags: "@external" }, () => { cy.request("/api/notification").then(({ body }) => { const questionAlerts = body.filter( - notification => notification.payload_type === "notification/card", + (notification) => notification.payload_type === "notification/card", ); expect(questionAlerts).to.have.length(0); }); diff --git a/e2e/test/scenarios/sharing/downloads/downloads.cy.spec.js b/e2e/test/scenarios/sharing/downloads/downloads.cy.spec.js index 8f264eb0c65..86d91f8153c 100644 --- a/e2e/test/scenarios/sharing/downloads/downloads.cy.spec.js +++ b/e2e/test/scenarios/sharing/downloads/downloads.cy.spec.js @@ -49,7 +49,7 @@ describe("scenarios > question > download", () => { H.expectNoBadSnowplowEvents(); }); - testCases.forEach(fileType => { + testCases.forEach((fileType) => { it(`downloads ${fileType} file`, () => { H.startNewQuestion(); H.entityPickerModal().within(() => { @@ -61,7 +61,7 @@ describe("scenarios > question > download", () => { // eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage cy.contains("18,760"); - H.downloadAndAssert({ fileType }, sheet => { + H.downloadAndAssert({ fileType }, (sheet) => { expect(sheet["A1"].v).to.eq("Count"); expect(sheet["A2"].v).to.eq(18760); }); @@ -76,7 +76,7 @@ describe("scenarios > question > download", () => { }); }); - testCases.forEach(fileType => { + testCases.forEach((fileType) => { it(`should allow downloading unformatted ${fileType} data`, () => { const fieldRef = ["field", ORDERS.TOTAL, null]; const columnKey = `["ref",${JSON.stringify(fieldRef)}]`; @@ -103,7 +103,7 @@ describe("scenarios > question > download", () => { H.queryBuilderMain().findByText("USD 39.72").should("exist"); - cy.get("@questionId").then(questionId => { + cy.get("@questionId").then((questionId) => { const opts = { questionId, fileType }; H.downloadAndAssert( @@ -111,7 +111,7 @@ describe("scenarios > question > download", () => { ...opts, enableFormatting: true, }, - sheet => { + (sheet) => { expect(sheet["A1"].v).to.eq("Total"); expect(sheet["A2"].w).to.eq("USD 39.72"); }, @@ -122,7 +122,7 @@ describe("scenarios > question > download", () => { ...opts, enableFormatting: false, }, - sheet => { + (sheet) => { expect(sheet["A1"].v).to.eq("Total"); expect(sheet["A2"].v).to.eq(39.718145389078366); }, @@ -153,7 +153,7 @@ describe("scenarios > question > download", () => { enableFormatting: true, fileType: "csv", }, - sheet => { + (sheet) => { expect(sheet["B1"].v).to.eq("Doohickey"); expect(sheet["B2"].w).to.eq("13"); }, @@ -165,7 +165,7 @@ describe("scenarios > question > download", () => { pivoting: "non-pivoted", fileType: "csv", }, - sheet => { + (sheet) => { expect(sheet["B1"].v).to.eq("Category"); expect(sheet["B2"].w).to.eq("Doohickey"); }, @@ -241,8 +241,8 @@ describe("scenarios > question > download", () => { H.queryBuilderMain().findByText("Left Total").should("exist"); H.queryBuilderMain().findByText("Right Total").should("exist"); - cy.get("@questionId").then(questionId => { - testCases.forEach(fileType => { + cy.get("@questionId").then((questionId) => { + testCases.forEach((fileType) => { const opts = { questionId, fileType }; H.downloadAndAssert( @@ -250,7 +250,7 @@ describe("scenarios > question > download", () => { ...opts, enableFormatting: true, }, - sheet => { + (sheet) => { expect(sheet["A1"].v).to.eq("Left Total"); expect(sheet["A2"].v).to.closeTo(159.35, 0.01); expect(sheet["B1"].v).to.eq("Right Total"); @@ -362,7 +362,7 @@ describe("scenarios > question > download", () => { dashboardId, dashcardId: id, }, - sheet => { + (sheet) => { expect(sheet["A1"].v).to.eq("ID"); expect(sheet["A2"].v).to.eq(1); @@ -508,7 +508,7 @@ function assertOrdersExport(length) { dashboardId: ORDERS_DASHBOARD_ID, isDashboard: true, }, - sheet => { + (sheet) => { expect(sheet["A1"].v).to.eq("ID"); expect(sheet["A2"].v).to.eq(1); expect(sheet["B1"].v).to.eq("User ID"); diff --git a/e2e/test/scenarios/sharing/downloads/sharing-download-reproductions.cy.spec.js b/e2e/test/scenarios/sharing/downloads/sharing-download-reproductions.cy.spec.js index ddd918a4915..db5347fdced 100644 --- a/e2e/test/scenarios/sharing/downloads/sharing-download-reproductions.cy.spec.js +++ b/e2e/test/scenarios/sharing/downloads/sharing-download-reproductions.cy.spec.js @@ -26,9 +26,9 @@ describe("issue 10803", () => { ); }); - testCases.forEach(fileType => { + testCases.forEach((fileType) => { it(`should format the date properly for ${fileType} in saved questions (metabase#10803)`, () => { - cy.get("@questionId").then(questionId => { + cy.get("@questionId").then((questionId) => { H.downloadAndAssert( { fileType, questionId, logResults: true, raw: true }, testWorkbookDatetimes, @@ -82,7 +82,7 @@ describe.skip("issue 18219", () => { cy.signInAsAdmin(); }); - testCases.forEach(fileType => { + testCases.forEach((fileType) => { it("should format temporal units on export (metabase#18219)", () => { H.createQuestion(questionDetails).then(({ body: { id: questionId } }) => { H.visitQuestion(questionId); @@ -209,7 +209,7 @@ describe("issue 18382", () => { H.visitQuestionAdhoc(questionDetails); }); - testCases.forEach(fileType => { + testCases.forEach((fileType) => { it(`should handle the old syntax in downloads for ${fileType} (metabase#18382)`, () => { // TODO: Please remove this line when issue gets fixed cy.skipOn(fileType === "csv"); @@ -251,7 +251,7 @@ describe("issue 18440", () => { }); }); - testCases.forEach(fileType => { + testCases.forEach((fileType) => { it(`export should include a column with remapped values for ${fileType} (metabase#18440-1)`, () => { H.visitQuestionAdhoc(questionDetails); @@ -358,7 +358,7 @@ describe("issue 18729", () => { cy.signInAsAdmin(); }); - ["csv", "xlsx"].forEach(fileType => { + ["csv", "xlsx"].forEach((fileType) => { it(`should properly format the 'X of Y'dates in ${fileType} exports (metabase#18729)`, () => { H.visitQuestionAdhoc(questionDetails); @@ -379,7 +379,7 @@ describe("issue 19889", () => { function saveAndOverwrite() { cy.findByText("Save").click(); - cy.findByTestId("save-question-modal").within(modal => { + cy.findByTestId("save-question-modal").within((modal) => { cy.findByText("Save").click(); }); } @@ -414,9 +414,9 @@ describe("issue 19889", () => { cy.findByText("Started from").click(); // Give DOM some time to update }); - testCases.forEach(fileType => { + testCases.forEach((fileType) => { it("should order columns correctly in unsaved native query exports", () => { - H.downloadAndAssert({ fileType, raw: true }, sheet => { + H.downloadAndAssert({ fileType, raw: true }, (sheet) => { expect(sheet["A1"].v).to.equal("column b"); expect(sheet["B1"].v).to.equal("column a"); expect(sheet["C1"].v).to.equal("column c"); @@ -426,8 +426,8 @@ describe("issue 19889", () => { it("should order columns correctly in saved native query exports", () => { saveAndOverwrite(); - cy.get("@questionId").then(questionId => { - H.downloadAndAssert({ fileType, questionId, raw: true }, sheet => { + cy.get("@questionId").then((questionId) => { + H.downloadAndAssert({ fileType, questionId, raw: true }, (sheet) => { expect(sheet["A1"].v).to.equal("column b"); expect(sheet["B1"].v).to.equal("column a"); expect(sheet["C1"].v).to.equal("column c"); @@ -444,10 +444,10 @@ describe("issue 19889", () => { saveAndOverwrite(); - cy.get("@questionId").then(questionId => { + cy.get("@questionId").then((questionId) => { H.visitQuestion(questionId); - H.downloadAndAssert({ fileType, questionId, raw: true }, sheet => { + H.downloadAndAssert({ fileType, questionId, raw: true }, (sheet) => { expect(sheet["A1"].v).to.equal("column x"); expect(sheet["B1"].v).to.equal("column y"); expect(sheet["C1"].v).to.equal("column c"); @@ -486,7 +486,7 @@ describe("metabase#28834", () => { it("should be able to export unsaved native query results as CSV even after the query has changed", () => { const fileType = "csv"; - H.downloadAndAssert({ fileType, raw: true }, sheet => { + H.downloadAndAssert({ fileType, raw: true }, (sheet) => { expect(sheet["A1"].v).to.equal("column a"); expect(sheet["A2"].v).to.equal("1"); expect(sheet["A3"]).to.be.undefined; @@ -495,7 +495,7 @@ describe("metabase#28834", () => { it("should be able to export unsaved native query results as XLSX even after the query has changed", () => { const fileType = "xlsx"; - H.downloadAndAssert({ fileType, raw: true }, sheet => { + H.downloadAndAssert({ fileType, raw: true }, (sheet) => { expect(sheet["A1"].v).to.equal("column a"); expect(sheet["A2"].v).to.equal(1); expect(sheet["A3"]).to.be.undefined; diff --git a/e2e/test/scenarios/sharing/public-dashboard.cy.spec.js b/e2e/test/scenarios/sharing/public-dashboard.cy.spec.js index 5620fbce56c..f1be3a91031 100644 --- a/e2e/test/scenarios/sharing/public-dashboard.cy.spec.js +++ b/e2e/test/scenarios/sharing/public-dashboard.cy.spec.js @@ -127,14 +127,14 @@ describe("scenarios > public > dashboard", () => { "placeholder", "Loading…", ); - cy.findByTestId("public-link-input").should($input => { + cy.findByTestId("public-link-input").should(($input) => { expect($input.val()).to.match(PUBLIC_DASHBOARD_REGEX); }); }); }); it("should only allow non-admin users to see a public link if one has already been created", () => { - cy.get("@dashboardId").then(id => { + cy.get("@dashboardId").then((id) => { H.createPublicDashboardLink(id); cy.signOut(); }); @@ -150,7 +150,7 @@ describe("scenarios > public > dashboard", () => { "placeholder", "Loading…", ); - cy.findByTestId("public-link-input").should($input => { + cy.findByTestId("public-link-input").should(($input) => { expect($input.val()).to.match(PUBLIC_DASHBOARD_REGEX); }); cy.findByText("Remove public URL").should("not.exist"); @@ -161,7 +161,7 @@ describe("scenarios > public > dashboard", () => { Object.entries(USERS).map(([userType, setUser]) => describe(`${userType}`, () => { it("should be able to view public dashboards", () => { - cy.get("@dashboardId").then(id => { + cy.get("@dashboardId").then((id) => { cy.request("POST", `/api/dashboard/${id}/public_link`).then( ({ body: { uuid } }) => { setUser(); @@ -184,7 +184,7 @@ describe("scenarios > public > dashboard", () => { ); it("should respect 'disable auto-apply filters' in a public dashboard", () => { - cy.get("@dashboardId").then(id => { + cy.get("@dashboardId").then((id) => { cy.request("PUT", `/api/dashboard/${id}`, { auto_apply_filters: false, }); @@ -209,7 +209,7 @@ describe("scenarios > public > dashboard", () => { }); it("should only display filters mapped to cards on the selected tab", () => { - cy.get("@dashboardId").then(id => { + cy.get("@dashboardId").then((id) => { H.visitPublicDashboard(id); }); @@ -228,7 +228,7 @@ describe("scenarios > public > dashboard", () => { }); it("should respect dashboard width setting in a public dashboard", () => { - cy.get("@dashboardId").then(id => { + cy.get("@dashboardId").then((id) => { H.visitPublicDashboard(id); }); @@ -236,7 +236,7 @@ describe("scenarios > public > dashboard", () => { H.assertDashboardFixedWidth(); // toggle full-width - cy.get("@dashboardId").then(id => { + cy.get("@dashboardId").then((id) => { cy.signInAsAdmin(); cy.request("PUT", `/api/dashboard/${id}`, { width: "full", @@ -248,7 +248,7 @@ describe("scenarios > public > dashboard", () => { }); it("should render when a filter passed with value starting from '0' (metabase#41483)", () => { - cy.get("@dashboardId").then(id => { + cy.get("@dashboardId").then((id) => { H.visitPublicDashboard(id, { params: { text: "002" }, }); @@ -292,13 +292,13 @@ describe("scenarios > public > dashboard", () => { // This is a hacky way to intercept the link click we create an a element // with href on fly and remove it afterwards in lib/dom.js - cy.window().then(win => { + cy.window().then((win) => { cy.spy(win.document.body, "appendChild").as("appendChild"); }); H.getDashboardCard().findByText("39.72").click(); - cy.get("@appendChild").then(appendChild => { + cy.get("@appendChild").then((appendChild) => { // last call is a link const element = appendChild.lastCall.args[0]; @@ -321,7 +321,7 @@ describe("scenarios [EE] > public > dashboard", () => { it("should set the window title to `{dashboard name} Ā· {application name}`", () => { H.updateSetting("application-name", "Custom Application Name"); - cy.get("@dashboardId").then(id => { + cy.get("@dashboardId").then((id) => { H.visitPublicDashboard(id); cy.title().should("eq", "Test Dashboard Ā· Custom Application Name"); @@ -333,7 +333,7 @@ describe("scenarios [EE] > public > dashboard", () => { // We don't have a de-CH.json file, so it should fallback to de.json, see metabase#51039 for more details cy.intercept("/app/locales/de.json").as("deLocale"); - cy.get("@dashboardId").then(id => { + cy.get("@dashboardId").then((id) => { H.visitPublicDashboard(id, { hash: { locale: "de-CH" }, }); diff --git a/e2e/test/scenarios/sharing/public-question.cy.spec.js b/e2e/test/scenarios/sharing/public-question.cy.spec.js index 5dee03d5ded..f72e21365c1 100644 --- a/e2e/test/scenarios/sharing/public-question.cy.spec.js +++ b/e2e/test/scenarios/sharing/public-question.cy.spec.js @@ -76,7 +76,7 @@ describe("scenarios > public > question", () => { cy.wait("@publicQuery"); // Make sure we can download the public question (metabase#21993) - cy.get("@uuid").then(publicUuid => { + cy.get("@uuid").then((publicUuid) => { H.downloadAndAssert( { fileType: "xlsx", questionId: id, publicUuid }, H.assertSheetRowsCount(5), @@ -96,7 +96,7 @@ describe("scenarios > public > question", () => { cy.findByTestId("public-link-popover-content").within(() => { cy.findByText("Public link").should("be.visible"); - cy.findByTestId("public-link-input").should($input => { + cy.findByTestId("public-link-input").should(($input) => { expect($input.val()).to.match(PUBLIC_QUESTION_REGEX); }); cy.findByText("Remove public URL").should("not.exist"); @@ -153,7 +153,7 @@ describe("scenarios > public > question", () => { }, ); - cy.get("@questionId").then(id => { + cy.get("@questionId").then((id) => { H.createPublicQuestionLink(id).then(({ body: { uuid } }) => { cy.signOut(); cy.signInAsNormalUser().then(() => { @@ -183,7 +183,7 @@ describe("scenarios > public > question", () => { path: ["Our analytics"], }, ); - cy.get("@questionId").then(id => { + cy.get("@questionId").then((id) => { H.createPublicQuestionLink(id).then(({ body: { uuid } }) => { cy.signOut(); cy.signInAsNormalUser().then(() => { @@ -217,14 +217,14 @@ describe("scenarios > question > public link with extension", () => { }); it("should download a json file when a public link with .json is shared", () => { - downloadPublicFileURL("json", response => { + downloadPublicFileURL("json", (response) => { expect(response.body[0]).to.deep.eq({ ID: 1 }); }); }); - ["csv", "xlsx"].forEach(fileType => + ["csv", "xlsx"].forEach((fileType) => it(`should download a ${fileType} file when a public link with .${fileType} is shared`, () => { - downloadPublicFileURL(fileType, response => { + downloadPublicFileURL(fileType, (response) => { const { SheetNames, Sheets } = xlsx.read(response.body, { type: "binary", }); @@ -273,7 +273,7 @@ describe("scenarios [EE] > public > question", () => { // We don't have a de-CH.json file, so it should fallback to de.json, see metabase#51039 for more details cy.intercept("/app/locales/de.json").as("deLocale"); - cy.get("@questionId").then(id => { + cy.get("@questionId").then((id) => { H.visitPublicQuestion(id, { params: { some_parameter: "some_value", @@ -293,13 +293,13 @@ describe("scenarios [EE] > public > question", () => { }); const visitPublicURL = () => { - cy.findByTestId("public-link-input").should($input => { + cy.findByTestId("public-link-input").should(($input) => { // Copied URL has no get params expect($input.val()).to.match(PUBLIC_QUESTION_REGEX); }); cy.findByTestId("public-link-input") .invoke("val") - .then(publicURL => { + .then((publicURL) => { cy.signOut(); cy.visit(publicURL); }); @@ -317,13 +317,13 @@ const downloadPublicFileURL = (fileType, validationCallback) => { new RegExp(`\\/public\\/question\\/.*\\.${fileType}`), ); - cy.get("@publicUrl").then(url => { + cy.get("@publicUrl").then((url) => { cy.request({ method: "GET", url: url, followRedirect: true, encoding: "binary", - }).then(response => { + }).then((response) => { validationCallback(response); }); }); diff --git a/e2e/test/scenarios/sharing/public-resource-downloads.cy.spec.ts b/e2e/test/scenarios/sharing/public-resource-downloads.cy.spec.ts index e08d3b733fa..4a9cf02bf6e 100644 --- a/e2e/test/scenarios/sharing/public-resource-downloads.cy.spec.ts +++ b/e2e/test/scenarios/sharing/public-resource-downloads.cy.spec.ts @@ -33,7 +33,7 @@ H.describeWithSnowplowEE( .findByTestId("public-link-input") .should("contain.value", "/public/") .invoke("val") - .then(url => { + .then((url) => { publicLink = url as string; }); @@ -114,7 +114,7 @@ H.describeWithSnowplowEE( .findByTestId("public-link-input") .should("contain.value", "/public/") .invoke("val") - .then(url => { + .then((url) => { publicLink = url as string; }); diff --git a/e2e/test/scenarios/sharing/public-sharing-embed-button-behavior.cy.spec.js b/e2e/test/scenarios/sharing/public-sharing-embed-button-behavior.cy.spec.js index c088bcb0f43..3cecee5accf 100644 --- a/e2e/test/scenarios/sharing/public-sharing-embed-button-behavior.cy.spec.js +++ b/e2e/test/scenarios/sharing/public-sharing-embed-button-behavior.cy.spec.js @@ -1,6 +1,6 @@ const { H } = cy; -["dashboard", "question"].forEach(resource => { +["dashboard", "question"].forEach((resource) => { describe(`embed modal behavior for ${resource}s`, () => { beforeEach(() => { H.restore(); @@ -18,7 +18,7 @@ const { H } = cy; describe("when user is admin", () => { it(`should always show the embed button for ${resource}`, () => { - cy.get("@resourceId").then(id => { + cy.get("@resourceId").then((id) => { visitResource(resource, id); }); @@ -39,7 +39,7 @@ const { H } = cy; it(`should not show embed button for ${resource}`, () => { cy.signInAsNormalUser(); - cy.get("@resourceId").then(id => { + cy.get("@resourceId").then((id) => { visitResource(resource, id); }); @@ -58,7 +58,7 @@ const { H } = cy; describe("when user is admin", () => { it(`should show the embed menu for ${resource}`, () => { - cy.get("@resourceId").then(id => { + cy.get("@resourceId").then((id) => { visitResource(resource, id); }); @@ -67,7 +67,7 @@ const { H } = cy; }); it(`should let the user create a public link for ${resource}`, () => { - cy.get("@resourceId").then(id => { + cy.get("@resourceId").then((id) => { createPublicResourceLink(resource, id); visitResource(resource, id); }); @@ -82,7 +82,7 @@ const { H } = cy; it(`should show a disabled public link button if the ${resource} doesn't have a public link`, () => { cy.signInAsNormalUser(); - cy.get("@resourceId").then(id => { + cy.get("@resourceId").then((id) => { visitResource(resource, id); }); @@ -93,7 +93,7 @@ const { H } = cy; }); it(`should show the public link button if the ${resource} has a public link`, () => { - cy.get("@resourceId").then(id => { + cy.get("@resourceId").then((id) => { createPublicResourceLink(resource, id); visitResource(resource, id); }); @@ -104,7 +104,7 @@ const { H } = cy; cy.signInAsNormalUser(); - cy.get("@resourceId").then(id => { + cy.get("@resourceId").then((id) => { visitResource(resource, id); }); @@ -126,7 +126,7 @@ const { H } = cy; describe("when user is admin", () => { it(`should show a disabled menu item for public links for ${resource} and allow the user to access the embed modal`, () => { - cy.get("@resourceId").then(id => { + cy.get("@resourceId").then((id) => { visitResource(resource, id); }); @@ -153,7 +153,7 @@ const { H } = cy; it(`should show a disabled button for ${resource}`, () => { cy.signInAsNormalUser(); - cy.get("@resourceId").then(id => { + cy.get("@resourceId").then((id) => { visitResource(resource, id); }); @@ -261,7 +261,7 @@ describe("#39152 sharing an unsaved question", () => { }); }); -["dashboard", "question"].forEach(resource => { +["dashboard", "question"].forEach((resource) => { H.describeWithSnowplow(`public ${resource} sharing snowplow events`, () => { beforeEach(() => { H.restore(); @@ -282,7 +282,7 @@ describe("#39152 sharing an unsaved question", () => { describe(`when embedding ${resource}`, () => { describe("when interacting with public link popover", () => { it("should send `public_link_copied` event when copying public link", () => { - cy.get("@resourceId").then(id => { + cy.get("@resourceId").then((id) => { visitResource(resource, id); }); @@ -330,7 +330,7 @@ describe("#39152 sharing an unsaved question", () => { }); it("should send `public_link_removed` when removing the public link", () => { - cy.get("@resourceId").then(id => { + cy.get("@resourceId").then((id) => { visitResource(resource, id); }); @@ -346,7 +346,7 @@ describe("#39152 sharing an unsaved question", () => { describe("when interacting with public embedding", () => { it("should send `public_embed_code_copied` event when copying the public embed iframe", () => { - cy.get("@resourceId").then(id => { + cy.get("@resourceId").then((id) => { visitResource(resource, id); }); @@ -355,7 +355,7 @@ describe("#39152 sharing an unsaved question", () => { H.modal().findByText("Get embedding code").click(); // mock clipboardData so that copy-to-clipboard doesn't use window.prompt, pausing the tests - cy.window().then(win => { + cy.window().then((win) => { win.clipboardData = { setData: (...args) => // eslint-disable-next-line no-console @@ -373,7 +373,7 @@ describe("#39152 sharing an unsaved question", () => { }); it("should send `public_link_removed` event when removing the public embed", () => { - cy.get("@resourceId").then(id => { + cy.get("@resourceId").then((id) => { visitResource(resource, id); }); @@ -392,7 +392,7 @@ describe("#39152 sharing an unsaved question", () => { describe("when interacting with static embedding", () => { it("should send `static_embed_code_copied` when copying the static embed code", () => { - cy.get("@resourceId").then(id => { + cy.get("@resourceId").then((id) => { visitResource(resource, id); }); H.openStaticEmbeddingModal(); @@ -533,7 +533,7 @@ describe("#39152 sharing an unsaved question", () => { }); it("should send `static_embed_code_copied` when copying the static embed code", () => { - cy.get("@resourceId").then(id => { + cy.get("@resourceId").then((id) => { visitResource(resource, id); }); H.openStaticEmbeddingModal({ acceptTerms: false }); @@ -656,7 +656,7 @@ describe("#39152 sharing an unsaved question", () => { }); it("should send `static_embed_discarded` when discarding changes in the static embed modal", () => { - cy.get("@resourceId").then(id => { + cy.get("@resourceId").then((id) => { enableEmbeddingForResource({ resource, id }); visitResource(resource, id); }); @@ -680,7 +680,7 @@ describe("#39152 sharing an unsaved question", () => { cy.then(function () { this.timeAfterResourceCreation = Date.now(); }); - cy.get("@resourceId").then(id => { + cy.get("@resourceId").then((id) => { visitResource(resource, id); }); H.openStaticEmbeddingModal(); @@ -744,7 +744,7 @@ describe("#39152 sharing an unsaved question", () => { }); it("should send `static_embed_unpublished` when unpublishing changes in the static embed modal", () => { - cy.get("@resourceId").then(id => { + cy.get("@resourceId").then((id) => { enableEmbeddingForResource({ resource, id }); visitResource(resource, id); }); @@ -875,7 +875,7 @@ function assertValidPublicLink({ resource, shouldHaveRemoveLink }) { cy.findByTestId("public-link-input") .should("be.visible") .invoke("val") - .should(value => { + .should((value) => { expect(value).to.match(regex); }); @@ -886,7 +886,7 @@ function assertValidPublicLink({ resource, shouldHaveRemoveLink }) { } function closeTo(value, offset) { - return comparedValue => { + return (comparedValue) => { return Math.abs(comparedValue - value) <= offset; }; } diff --git a/e2e/test/scenarios/sharing/public-sharing.cy.spec.js b/e2e/test/scenarios/sharing/public-sharing.cy.spec.js index 5d0edc974b6..a34dee54722 100644 --- a/e2e/test/scenarios/sharing/public-sharing.cy.spec.js +++ b/e2e/test/scenarios/sharing/public-sharing.cy.spec.js @@ -86,11 +86,11 @@ describe("scenarios > admin > settings > public sharing", () => { cy.wrap(dashboardId).as("dashboardId"); cy.request("POST", `/api/dashboard/${dashboardId}/public_link`, {}); }) - .then(response => { + .then((response) => { cy.wrap(response.body.uuid).as("dashboardUuid"); }); - cy.get("@dashboardId").then(dashboardId => + cy.get("@dashboardId").then((dashboardId) => H.visitDashboardAndCreateTab({ dashboardId }), ); @@ -100,7 +100,7 @@ describe("scenarios > admin > settings > public sharing", () => { cy.findByText("Shared Dashboards").should("be.visible"); // eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage cy.findByText(expectedDashboardName).should("be.visible"); - cy.get("@dashboardUuid").then(dashboardUuid => { + cy.get("@dashboardUuid").then((dashboardUuid) => { cy.findByText( `${location.origin}/public/dashboard/${dashboardUuid}`, ).click(); @@ -111,7 +111,7 @@ describe("scenarios > admin > settings > public sharing", () => { cy.visit("/admin/settings/public-sharing"); }); - cy.get("@dashboardId").then(dashboardId => { + cy.get("@dashboardId").then((dashboardId) => { cy.findByText(expectedDashboardName).click(); cy.log( "Sometimes the URL will be updated with the tab ID, so we need to account for that", @@ -150,7 +150,7 @@ describe("scenarios > admin > settings > public sharing", () => { cy.wrap(questionId).as("questionId"); cy.request("POST", `/api/card/${questionId}/public_link`, {}); }) - .then(response => { + .then((response) => { cy.wrap(response.body.uuid).as("questionUuid"); }); @@ -160,7 +160,7 @@ describe("scenarios > admin > settings > public sharing", () => { cy.findByText("Shared Questions").should("be.visible"); // eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage cy.findByText(expectedQuestionName).should("be.visible"); - cy.get("@questionUuid").then(questionUuid => { + cy.get("@questionUuid").then((questionUuid) => { cy.findByText( `${location.origin}/public/question/${questionUuid}`, ).click(); @@ -170,7 +170,7 @@ describe("scenarios > admin > settings > public sharing", () => { cy.visit("/admin/settings/public-sharing"); }); - cy.get("@questionId").then(questionId => { + cy.get("@questionId").then((questionId) => { cy.findByText(expectedQuestionName).click(); cy.url().should( "eq", @@ -205,7 +205,7 @@ describe("scenarios > admin > settings > public sharing", () => { cy.wrap(modelId).as("modelId"); }); - cy.get("@modelId").then(modelId => { + cy.get("@modelId").then((modelId) => { H.createAction({ ...DEFAULT_ACTION_DETAILS, name: expectedActionName, @@ -217,7 +217,7 @@ describe("scenarios > admin > settings > public sharing", () => { }); cy.get("@actionId") - .then(actionId => { + .then((actionId) => { cy.request("POST", `/api/action/${actionId}/public_link`, {}); }) .then(({ body }) => { @@ -230,7 +230,7 @@ describe("scenarios > admin > settings > public sharing", () => { cy.findByText("Shared Action Forms").should("be.visible"); // eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage cy.findByText(expectedActionName).should("be.visible"); - cy.get("@actionUuid").then(actionUuid => { + cy.get("@actionUuid").then((actionUuid) => { cy.findByText(`${location.origin}/public/action/${actionUuid}`).click(); cy.findByRole("heading", { name: expectedActionName }).should( "be.visible", diff --git a/e2e/test/scenarios/sharing/sharing-reproductions.cy.spec.js b/e2e/test/scenarios/sharing/sharing-reproductions.cy.spec.js index 1089ab63ee0..e8f85ad7f99 100644 --- a/e2e/test/scenarios/sharing/sharing-reproductions.cy.spec.js +++ b/e2e/test/scenarios/sharing/sharing-reproductions.cy.spec.js @@ -46,7 +46,7 @@ describe("issue 18009", { tags: "@external" }, () => { // eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage cy.findByText("To:").click(); - H.sendEmailAndAssert(email => { + H.sendEmailAndAssert((email) => { expect(email.html).not.to.include( "An error occurred while displaying this card.", ); @@ -100,7 +100,7 @@ describe("issue 18344", { tags: "@external" }, () => { // eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage cy.findByText("To:").click(); - H.sendEmailAndAssert(email => { + H.sendEmailAndAssert((email) => { expect(email.html).to.include("OrdersFoo"); }); }); @@ -180,7 +180,7 @@ describe("issue 18669", { tags: "@external" }, () => { parameters: [filterDetails], }; - const getFilterMapping = card => ({ + const getFilterMapping = (card) => ({ parameter_mappings: [ { parameter_id: filterDetails.id, @@ -350,7 +350,7 @@ describe("issue 21559", { tags: "@external" }, () => { `${admin.first_name} ${admin.last_name}`, ]); - H.sendEmailAndAssert(email => { + H.sendEmailAndAssert((email) => { expect(email.html).to.include("img"); // Bar chart is sent as img (inline attachment) expect(email.html).not.to.include("80.52"); // Scalar displays its value in HTML }); @@ -447,7 +447,7 @@ describe("issue 24223", () => { const dashboardDetails = { parameters }; - const mapFiltersToCard = card_id => ({ + const mapFiltersToCard = (card_id) => ({ parameter_mappings: [ { parameter_id: dropdownFilter.id, @@ -608,7 +608,7 @@ describe("issue 25473", () => { }); it("public sharing: dashboard text filter on a custom column should accept text input (metabase#25473-1)", () => { - cy.get("@dashboardId").then(id => { + cy.get("@dashboardId").then((id) => { H.visitPublicDashboard(id); }); @@ -616,7 +616,7 @@ describe("issue 25473", () => { }); it("signed embedding: dashboard text filter on a custom column should accept text input (metabase#25473-2)", () => { - cy.get("@dashboardId").then(id => { + cy.get("@dashboardId").then((id) => { cy.request("PUT", `/api/dashboard/${id}`, { embedding_params: { [dashboardFilter.slug]: "enabled", @@ -800,7 +800,7 @@ describe("issue 17658", { tags: "@external" }, () => { cy.request("GET", "/api/collection/tree?tree=true").then( ({ body: collections }) => { const { id } = collections.find( - collection => collection.name === collectionName, + (collection) => collection.name === collectionName, ); // Move dashboard @@ -1021,10 +1021,10 @@ describe("issue 49525", { tags: "@external" }, () => { cy.findByText("Questions to attach").click(); }); - H.sendEmailAndAssert(email => { + H.sendEmailAndAssert((email) => { // Get the CSV attachment data const csvAttachment = email.attachments.find( - attachment => attachment.contentType === "text/csv", + (attachment) => attachment.contentType === "text/csv", ); expect(csvAttachment).to.exist; @@ -1034,7 +1034,7 @@ describe("issue 49525", { tags: "@external" }, () => { method: "GET", url: `http://localhost:${WEB_PORT}/email/${email.id}/attachment/${csvAttachment.fileName}`, encoding: "utf8", - }).then(response => { + }).then((response) => { const csvContent = response.body; const rows = csvContent.split("\n"); const headers = rows[0]; diff --git a/e2e/test/scenarios/sharing/subscriptions.cy.spec.js b/e2e/test/scenarios/sharing/subscriptions.cy.spec.js index 15897a5bede..fff154de45a 100644 --- a/e2e/test/scenarios/sharing/subscriptions.cy.spec.js +++ b/e2e/test/scenarios/sharing/subscriptions.cy.spec.js @@ -384,7 +384,7 @@ describe("scenarios > dashboard > subscriptions", () => { // Click anywhere outside to close the popover // eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage cy.findByText("15705D").click(); - H.sendEmailAndAssert(email => { + H.sendEmailAndAssert((email) => { expect(email.html).not.to.include( "An error occurred while displaying this card.", ); @@ -404,7 +404,7 @@ describe("scenarios > dashboard > subscriptions", () => { // Click outside popover to close it and at the same time check that the text card content is shown as expected // eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage cy.findByText(TEXT_CARD).click(); - H.sendEmailAndAssert(email => { + H.sendEmailAndAssert((email) => { expect(email.html).to.include(TEXT_CARD); }); }); @@ -435,7 +435,7 @@ describe("scenarios > dashboard > subscriptions", () => { }, ); - H.sendEmailAndAssert(email => { + H.sendEmailAndAssert((email) => { expect(email.html).to.include(dashboardDetails.name); expect(email.html).to.include(questionDetails.name); }); @@ -753,7 +753,7 @@ function assignRecipients({ cy.findByText("Email it").click(); const userInput = users - .map(user => `${user.first_name} ${user.last_name}{enter}`) + .map((user) => `${user.first_name} ${user.last_name}{enter}`) .join(""); cy.findByPlaceholderText("Enter user names or email addresses") diff --git a/e2e/test/scenarios/visualizations-charts/bar_chart.cy.spec.js b/e2e/test/scenarios/visualizations-charts/bar_chart.cy.spec.js index 6bed0bbb6b0..9cfc44e87f7 100644 --- a/e2e/test/scenarios/visualizations-charts/bar_chart.cy.spec.js +++ b/e2e/test/scenarios/visualizations-charts/bar_chart.cy.spec.js @@ -493,7 +493,7 @@ describe("scenarios > visualizations > bar chart", () => { questions: [multiMetric], }).then(({ dashboard }) => { H.createQuestion(sumTotalByMonth, { wrapId: true }).then(() => { - cy.get("@questionId").then(questionId => { + cy.get("@questionId").then((questionId) => { H.cypressWaitAll([ H.createQuestionAndAddToDashboard(avgTotalByMonth, dashboard.id, { series: [ @@ -583,9 +583,9 @@ describe("scenarios > visualizations > bar chart", () => { "#88BF4D", "#98D9D9", ]); - firstMetric.then($metricOne => { + firstMetric.then(($metricOne) => { const { height: heightMetricOne } = $metricOne[0].getBoundingClientRect(); - secondMetric.then($metricTwo => { + secondMetric.then(($metricTwo) => { const { height: heightMetricTwo } = $metricTwo[0].getBoundingClientRect(); diff --git a/e2e/test/scenarios/visualizations-charts/funnel.cy.spec.js b/e2e/test/scenarios/visualizations-charts/funnel.cy.spec.js index e4085390b7e..b79b9689ebe 100644 --- a/e2e/test/scenarios/visualizations-charts/funnel.cy.spec.js +++ b/e2e/test/scenarios/visualizations-charts/funnel.cy.spec.js @@ -32,7 +32,7 @@ describe("scenarios > visualizations > funnel chart", () => { H.getDraggableElements() .first() .invoke("text") - .then(name => { + .then((name) => { cy.log(`mode row ${name} down 2`); cy.findAllByTestId("funnel-chart-header") .first() diff --git a/e2e/test/scenarios/visualizations-charts/line-bar-tooltips.cy.spec.js b/e2e/test/scenarios/visualizations-charts/line-bar-tooltips.cy.spec.js index ff10466506c..59b8cd05c81 100644 --- a/e2e/test/scenarios/visualizations-charts/line-bar-tooltips.cy.spec.js +++ b/e2e/test/scenarios/visualizations-charts/line-bar-tooltips.cy.spec.js @@ -354,7 +354,7 @@ describe("scenarios > visualizations > line/bar chart > tooltips", () => { beforeEach(() => { setup({ question: SUM_OF_TOTAL, - }).then(dashboardId => { + }).then((dashboardId) => { H.visitDashboard(dashboardId); }); }); @@ -392,7 +392,7 @@ describe("scenarios > visualizations > line/bar chart > tooltips", () => { setup({ question: SUM_OF_TOTAL, addedSeriesQuestion: AVG_OF_TOTAL, - }).then(dashboardId => { + }).then((dashboardId) => { H.visitDashboard(dashboardId); }); }); @@ -465,7 +465,7 @@ describe("scenarios > visualizations > line/bar chart > tooltips", () => { beforeEach(() => { setup({ question: AVG_OF_TOTAL_CUM_SUM_QUANTITY, - }).then(dashboardId => { + }).then((dashboardId) => { H.visitDashboard(dashboardId); }); }); @@ -532,7 +532,7 @@ describe("scenarios > visualizations > line/bar chart > tooltips", () => { x: 4, y: 4, }, - }).then(dashboardId => { + }).then((dashboardId) => { H.visitDashboard(dashboardId); }); H.cartesianChartCircleWithColor("#A989C5") @@ -544,10 +544,10 @@ describe("scenarios > visualizations > line/bar chart > tooltips", () => { H.assertEChartsTooltip({ header: "2022" }); // Ensuring the circle is not covered by the tooltip element - cy.get("@firstCircle").then($circle => { + cy.get("@firstCircle").then(($circle) => { const circleRect = $circle[0].getBoundingClientRect(); - H.echartsTooltip().then($tooltip => { + H.echartsTooltip().then(($tooltip) => { const tooltipRect = $tooltip[0].getBoundingClientRect(); const isCovered = circleRect.top < tooltipRect.bottom && @@ -563,7 +563,7 @@ describe("scenarios > visualizations > line/bar chart > tooltips", () => { it("tooltips should be hidden when click popover is visible", () => { setup({ question: AVG_OF_TOTAL_CUM_SUM_QUANTITY, - }).then(dashboardId => { + }).then((dashboardId) => { H.visitDashboard(dashboardId); }); @@ -585,7 +585,7 @@ describe("scenarios > visualizations > line/bar chart > tooltips", () => { setup({ question: AVG_OF_TOTAL_CUM_SUM_QUANTITY, addedSeriesQuestion: AVG_DISCOUNT_SUM_DISCOUNT, - }).then(dashboardId => { + }).then((dashboardId) => { H.visitDashboard(dashboardId); }); }); @@ -605,7 +605,7 @@ describe("scenarios > visualizations > line/bar chart > tooltips", () => { const updatedAddedAvgSeriesName = "Q2 Custom 1"; const updatedAddedSumSeriesName = "Q2 Custom 2"; - [...originalSeriesColors, ...addedSeriesColors].forEach(color => { + [...originalSeriesColors, ...addedSeriesColors].forEach((color) => { showTooltipForCircleInSeries(color, circleIndex); H.assertEChartsTooltip({ header: "2023", @@ -647,7 +647,7 @@ describe("scenarios > visualizations > line/bar chart > tooltips", () => { saveDashCardVisualizationOptions(); - [...originalSeriesColors, ...addedSeriesColors].forEach(color => { + [...originalSeriesColors, ...addedSeriesColors].forEach((color) => { showTooltipForCircleInSeries(color, circleIndex); H.assertEChartsTooltip({ header: "2023", @@ -689,7 +689,7 @@ describe("scenarios > visualizations > line/bar chart > tooltips", () => { beforeEach(() => { setup({ question: { ...SUM_OF_TOTAL, display: "bar" }, - }).then(dashboardId => { + }).then((dashboardId) => { H.visitDashboard(dashboardId); }); }); @@ -739,7 +739,7 @@ describe("scenarios > visualizations > line/bar chart > tooltips", () => { setup({ question: { ...SUM_OF_TOTAL, display: "bar" }, addedSeriesQuestion: { ...AVG_OF_TOTAL, display: "bar" }, - }).then(dashboardId => { + }).then((dashboardId) => { H.visitDashboard(dashboardId); }); }); @@ -818,7 +818,7 @@ describe("scenarios > visualizations > line/bar chart > tooltips", () => { it("should show percent change in tooltip for timeseries axis", () => { setup({ question: SUM_OF_TOTAL_MONTH, - }).then(dashboardId => { + }).then((dashboardId) => { H.visitDashboard(dashboardId); }); @@ -852,7 +852,7 @@ describe("scenarios > visualizations > line/bar chart > tooltips", () => { it("should not show percent change when previous month is missing from result data", () => { setup({ question: SUM_OF_TOTAL_MONTH_EXCLUDE_MAY_AUG, - }).then(dashboardId => { + }).then((dashboardId) => { H.visitDashboard(dashboardId); }); @@ -911,7 +911,7 @@ describe("scenarios > visualizations > line/bar chart > tooltips", () => { it("should not show if x-axis is not timeseries", () => { setup({ question: SUM_OF_TOTAL_MONTH_ORDINAL, - }).then(dashboardId => { + }).then((dashboardId) => { H.visitDashboard(dashboardId); }); @@ -1000,7 +1000,7 @@ describe("scenarios > visualizations > line/bar chart > tooltips", () => { const DST_DAY_CHANGES = [null, "+27.5%", "-26.16%"]; it("should not omit percent change on April", () => { - setup({ question: SUM_OF_TOTAL_APRIL }).then(dashboardId => { + setup({ question: SUM_OF_TOTAL_APRIL }).then((dashboardId) => { H.visitDashboard(dashboardId); }); @@ -1023,7 +1023,7 @@ describe("scenarios > visualizations > line/bar chart > tooltips", () => { }); it("should not omit percent change the week after DST begins", () => { - setup({ question: SUM_OF_TOTAL_DST_WEEK }).then(dashboardId => { + setup({ question: SUM_OF_TOTAL_DST_WEEK }).then((dashboardId) => { H.visitDashboard(dashboardId); }); @@ -1047,7 +1047,7 @@ describe("scenarios > visualizations > line/bar chart > tooltips", () => { }); it("should not omit percent change the day after DST begins", () => { - setup({ question: SUM_OF_TOTAL_DST_DAY }).then(dashboardId => { + setup({ question: SUM_OF_TOTAL_DST_DAY }).then((dashboardId) => { H.visitDashboard(dashboardId); }); diff --git a/e2e/test/scenarios/visualizations-charts/line_chart.cy.spec.js b/e2e/test/scenarios/visualizations-charts/line_chart.cy.spec.js index cdc8b90a3f5..5ae39ab2602 100644 --- a/e2e/test/scenarios/visualizations-charts/line_chart.cy.spec.js +++ b/e2e/test/scenarios/visualizations-charts/line_chart.cy.spec.js @@ -32,7 +32,7 @@ describe("scenarios > visualizations > line chart", () => { H.echartsContainer() .findByText("Count") - .then(label => { + .then((label) => { const { x, y } = H.getXYTransform(label); cy.wrap({ x, y }).as("leftAxisLabelPosition"); }); @@ -41,7 +41,7 @@ describe("scenarios > visualizations > line chart", () => { cy.findByText("Right").click(); H.echartsContainer() .findByText("Count") - .then(label => { + .then((label) => { const { x: xRight, y: yRight } = H.getXYTransform(label); cy.get("@leftAxisLabelPosition").then(({ x: xLeft, y: yLeft }) => { expect(yRight).to.be.eq(yLeft); @@ -541,7 +541,7 @@ describe("scenarios > visualizations > line chart", () => { // making sure the grabber icon is there cy.findAllByTestId("chart-setting-select") - .then($elements => { + .then(($elements) => { for (const element of $elements) { if (element.value === "Sum of Total") { return cy.wrap(element); @@ -552,10 +552,10 @@ describe("scenarios > visualizations > line chart", () => { .icon("grabber"); cy.log("Drag and drop the first y-axis field to the last position"); - cy.findAllByTestId("chart-setting-select").then(initial => { + cy.findAllByTestId("chart-setting-select").then((initial) => { H.dragField(0, 1); - cy.findAllByTestId("chart-setting-select").should(content => { + cy.findAllByTestId("chart-setting-select").should((content) => { expect(content[0].value).to.eq(initial[0].value); // Created At: Month expect(content[1].value).to.eq(initial[2].value); // Sum of Total expect(content[2].value).to.eq(initial[1].value); // Count @@ -751,7 +751,7 @@ describe("scenarios > visualizations > line chart", () => { cy.icon("pencil").click(); cy.findByTestId("dashcard").realHover(); cy.icon("palette").click(); - series.forEach(serie => { + series.forEach((serie) => { const [old_name, new_name] = serie; cy.findByDisplayValue(old_name).clear().type(new_name).blur(); diff --git a/e2e/test/scenarios/visualizations-charts/maps.cy.spec.js b/e2e/test/scenarios/visualizations-charts/maps.cy.spec.js index e374e987fa7..963e3c164bf 100644 --- a/e2e/test/scenarios/visualizations-charts/maps.cy.spec.js +++ b/e2e/test/scenarios/visualizations-charts/maps.cy.spec.js @@ -34,7 +34,7 @@ describe("scenarios > visualizations > maps", () => { // open. That makes it difficult to select each in Cypress, so we click // inside both of them before reopening them one-by-one. :( // Please see: https://github.com/metabase/metabase/issues/18063#issuecomment-927836691 - ["Latitude field", "Longitude field"].map(field => + ["Latitude field", "Longitude field"].map((field) => H.leftSidebar().within(() => { toggleFieldSelectElement(field); }), @@ -123,7 +123,7 @@ describe("scenarios > visualizations > maps", () => { cy.findByText(/See these People/i).click(); cy.log("Reported as a regression since v0.37.0"); - cy.wait("@dataset").then(xhr => { + cy.wait("@dataset").then((xhr) => { expect(xhr.request.body.query.filter).not.to.contain("Texas"); }); // eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage diff --git a/e2e/test/scenarios/visualizations-charts/pie_chart.cy.spec.js b/e2e/test/scenarios/visualizations-charts/pie_chart.cy.spec.js index c772de4262c..fa2223e3834 100644 --- a/e2e/test/scenarios/visualizations-charts/pie_chart.cy.spec.js +++ b/e2e/test/scenarios/visualizations-charts/pie_chart.cy.spec.js @@ -131,7 +131,7 @@ describe("scenarios > visualizations > pie chart", () => { ["Gadget", "false"], ["Gizmo", "false"], ["Widget", "false"], - ].map(args => checkLegendItemAriaCurrent(args[0], args[1])); + ].map((args) => checkLegendItemAriaCurrent(args[0], args[1])); }); it("should not truncate legend titles when enabling percentages (metabase#48207)", () => { diff --git a/e2e/test/scenarios/visualizations-charts/rows.cy.spec.js b/e2e/test/scenarios/visualizations-charts/rows.cy.spec.js index 4cfe6c5004e..5b3c94f0f4e 100644 --- a/e2e/test/scenarios/visualizations-charts/rows.cy.spec.js +++ b/e2e/test/scenarios/visualizations-charts/rows.cy.spec.js @@ -8,7 +8,7 @@ describe("scenarios > visualizations > rows", () => { // Until we enable multi-browser support, this repro will be skipped by Cypress in CI // Issue was specific to Firefox only - it is still possible to test it locally - ["0", "null"].forEach(testValue => { + ["0", "null"].forEach((testValue) => { it( `should not collapse rows when last value is ${testValue} (metabase#14285)`, { browser: "firefox" }, @@ -36,7 +36,7 @@ describe("scenarios > visualizations > rows", () => { ); cy.findByTestId("query-visualization-root").within(() => { - ["a", "b", "c", "d", "e", "f"].forEach(letter => { + ["a", "b", "c", "d", "e", "f"].forEach((letter) => { cy.findByText(letter); }); }); @@ -71,10 +71,10 @@ describe("scenarios > visualizations > rows", () => { ); cy.findByTestId("query-visualization-root").within(() => { - ["a", "b", "c", "d", "e", "f"].forEach(letter => { + ["a", "b", "c", "d", "e", "f"].forEach((letter) => { cy.findByText(letter); }); - [51, 41, 31, 21, 11, 4].forEach(value => { + [51, 41, 31, 21, 11, 4].forEach((value) => { cy.findByText(value); }); cy.findByText("COLUMN_TWO"); @@ -84,11 +84,11 @@ describe("scenarios > visualizations > rows", () => { cy.findAllByRole("graphics-symbol").eq(0).as("firstBar"); cy.get("@firstBar") .invoke("width") - .then(prevWidth => { + .then((prevWidth) => { cy.get("@firstBar") .realHover() .invoke("width") - .then(newWidth => { + .then((newWidth) => { // eslint-disable-next-line no-unsafe-element-filtering expect(prevWidth).eq(newWidth); }); diff --git a/e2e/test/scenarios/visualizations-charts/scatter.cy.spec.js b/e2e/test/scenarios/visualizations-charts/scatter.cy.spec.js index 2259024525e..cea689079a3 100644 --- a/e2e/test/scenarios/visualizations-charts/scatter.cy.spec.js +++ b/e2e/test/scenarios/visualizations-charts/scatter.cy.spec.js @@ -167,8 +167,8 @@ select 10 as size, 2 as x, 5 as y`, cy.wrap(width).as("radius" + index); }); - cy.get("@radius0").then(r0 => { - cy.get("@radius1").then(r1 => { + cy.get("@radius0").then((r0) => { + cy.get("@radius1").then((r1) => { assert.notEqual(r0, r1); }); }); @@ -209,12 +209,12 @@ select 10 as size, 2 as x, 5 as y`, // Resizing animation due to the sidebar cy.wait(200); - const columnsToRemove = allTooltipRows.slice(2).map(row => row.name); + const columnsToRemove = allTooltipRows.slice(2).map((row) => row.name); H.leftSidebar().within(() => { cy.findByText("Display").click(); - columnsToRemove.map(columnName => { + columnsToRemove.map((columnName) => { cy.findByRole("textbox", { name: "Enter column names" }) .parent() .findByText(columnName) diff --git a/e2e/test/scenarios/visualizations-charts/visualizations-charts-reproductions.cy.spec.js b/e2e/test/scenarios/visualizations-charts/visualizations-charts-reproductions.cy.spec.js index 851af7d4dfd..6f91df84ccd 100644 --- a/e2e/test/scenarios/visualizations-charts/visualizations-charts-reproductions.cy.spec.js +++ b/e2e/test/scenarios/visualizations-charts/visualizations-charts-reproductions.cy.spec.js @@ -84,7 +84,7 @@ describe("issue 16170", { tags: "@mongo" }, () => { }); }); - ["Zero", "Nothing"].forEach(replacementValue => { + ["Zero", "Nothing"].forEach((replacementValue) => { it(`replace missing values with "${replacementValue}" should work on Mongo (metabase#16170)`, () => { H.openVizSettingsSidebar(); @@ -289,7 +289,7 @@ describe("issue 18061", () => { cy.wait("@getCard"); cy.wait("@cardQuery"); - cy.window().then(w => (w.beforeReload = true)); + cy.window().then((w) => (w.beforeReload = true)); H.queryBuilderHeader().findByTestId("filters-visibility-control").click(); cy.findByTestId("qb-filters-panel") @@ -384,7 +384,7 @@ describe("issue 18063", () => { // Click on the popovers to close both popovers that open automatically. // Please see: https://github.com/metabase/metabase/issues/18063#issuecomment-927836691 - ["Latitude field", "Longitude field"].forEach(field => + ["Latitude field", "Longitude field"].forEach((field) => H.leftSidebar().within(() => { toggleFieldSelectElement(field); }), @@ -650,7 +650,7 @@ describe("issue 21665", () => { }); it("multi-series cards shouldnt cause frontend to reload (metabase#21665)", () => { - cy.get("@questionId").then(questionId => { + cy.get("@questionId").then((questionId) => { editQ2NativeQuery("select order by --", questionId); }); @@ -837,7 +837,7 @@ describe("issue 27279", () => { // need to add a single space on either side of the text as it is used as padding // in ECharts const xAxisTicks = ["F2021", "V2021", "S2022", "F2022"].map( - str => ` ${str} `, + (str) => ` ${str} `, ); compareValuesInOrder( H.echartsContainer() @@ -927,7 +927,7 @@ describe("issue 27427", () => { method: "GET", url: `/api/pulse/preview_card/${id}`, failOnStatusCode: false, - }).then(response => { + }).then((response) => { callback(response); }); }); diff --git a/e2e/test/scenarios/visualizations-charts/visualizations-charts-reproductions.cy.spec.ts b/e2e/test/scenarios/visualizations-charts/visualizations-charts-reproductions.cy.spec.ts index 94c7aba372c..e1dd5eb1f40 100644 --- a/e2e/test/scenarios/visualizations-charts/visualizations-charts-reproductions.cy.spec.ts +++ b/e2e/test/scenarios/visualizations-charts/visualizations-charts-reproductions.cy.spec.ts @@ -27,7 +27,7 @@ describe("issue 43075", () => { H.popover().findByText("Break out by…").click(); H.popover().findByText("Category").click(); - cy.window().then(win => { + cy.window().then((win) => { expect(win.document.documentElement.scrollHeight).to.be.lte( win.document.documentElement.offsetHeight, ); diff --git a/e2e/test/scenarios/visualizations-charts/waterfall.cy.spec.js b/e2e/test/scenarios/visualizations-charts/waterfall.cy.spec.js index f2ff29d3334..4ed639c81c1 100644 --- a/e2e/test/scenarios/visualizations-charts/waterfall.cy.spec.js +++ b/e2e/test/scenarios/visualizations-charts/waterfall.cy.spec.js @@ -146,12 +146,12 @@ describe("scenarios > visualizations > waterfall", () => { cy.findByText("Sum of Total").should("not.exist"); // x-axis labels (some) - ["2022", "2023", "2026", "Total"].forEach(label => { + ["2022", "2023", "2026", "Total"].forEach((label) => { cy.findByText(label).should("exist"); }); // y-axis labels (some) - ["0", "3,000", "6,000", "18,000", "21,000"].forEach(label => { + ["0", "3,000", "6,000", "18,000", "21,000"].forEach((label) => { cy.findByText(label).should("exist"); }); }); @@ -175,12 +175,12 @@ describe("scenarios > visualizations > waterfall", () => { cy.findByText("Count").should("not.exist"); // x-axis labels (some) - ["2022", "2023", "2026", "Total"].forEach(label => { + ["2022", "2023", "2026", "Total"].forEach((label) => { cy.findByText(label).should("exist"); }); // y-axis labels (some) - ["0", "300,000", "900,000", "1,800,000"].forEach(label => { + ["0", "300,000", "900,000", "1,800,000"].forEach((label) => { cy.findByText(label).should("exist"); }); }); diff --git a/e2e/test/scenarios/visualizations-tabular/drillthroughs/chart_drill.cy.spec.js b/e2e/test/scenarios/visualizations-tabular/drillthroughs/chart_drill.cy.spec.js index c7472ad1351..8ee05a133e5 100644 --- a/e2e/test/scenarios/visualizations-tabular/drillthroughs/chart_drill.cy.spec.js +++ b/e2e/test/scenarios/visualizations-tabular/drillthroughs/chart_drill.cy.spec.js @@ -64,7 +64,7 @@ describe("scenarios > visualizations > drillthroughs > chart drill", () => { }); }); - ["month", "month-of-year"].forEach(granularity => { + ["month", "month-of-year"].forEach((granularity) => { it(`brush filter should work post-aggregation for ${granularity} granularity (metabase#18011)`, () => { cy.intercept("POST", "/api/dataset").as("dataset"); @@ -503,7 +503,7 @@ describe("scenarios > visualizations > drillthroughs > chart drill", () => { cy.findByText("See these People").click(); // We should see the resulting dataset of that drill-through - cy.wait("@dataset").then(xhr => { + cy.wait("@dataset").then((xhr) => { expect(xhr.response.body.error).not.to.exist; }); cy.findByText("Macy Olson"); diff --git a/e2e/test/scenarios/visualizations-tabular/drillthroughs/column_extract_drill.cy.spec.js b/e2e/test/scenarios/visualizations-tabular/drillthroughs/column_extract_drill.cy.spec.js index cfc88d21553..e066584d5d0 100644 --- a/e2e/test/scenarios/visualizations-tabular/drillthroughs/column_extract_drill.cy.spec.js +++ b/e2e/test/scenarios/visualizations-tabular/drillthroughs/column_extract_drill.cy.spec.js @@ -329,7 +329,7 @@ H.describeWithSnowplow("extract action", () => { H.createQuestion(questionDetails).then(({ body: { id: modelId } }) => { // set semantic type to URL - H.setModelMetadata(modelId, field => { + H.setModelMetadata(modelId, (field) => { if (field.name === CC_NAME) { return { ...field, semantic_type: "type/URL" }; } @@ -344,7 +344,7 @@ H.describeWithSnowplow("extract action", () => { cy.findByTestId("table-scroll-container").scrollTo("right"); - const urlCase = URL_CASES.find(c => c.option === "Path"); + const urlCase = URL_CASES.find((c) => c.option === "Path"); extractColumnAndCheck({ column: CC_NAME, option: urlCase.option, diff --git a/e2e/test/scenarios/visualizations-tabular/drillthroughs/table_drills.cy.spec.js b/e2e/test/scenarios/visualizations-tabular/drillthroughs/table_drills.cy.spec.js index c43749b1229..720f7120b36 100644 --- a/e2e/test/scenarios/visualizations-tabular/drillthroughs/table_drills.cy.spec.js +++ b/e2e/test/scenarios/visualizations-tabular/drillthroughs/table_drills.cy.spec.js @@ -237,7 +237,7 @@ describe("scenarios > visualizations > drillthroughs > table_drills", () => { cy.get("[data-testid=cell-data]").contains(drillCellText).first().click(); H.popover().within(() => { cy.findByText("Break out by…").click(); - menuItems.forEach(item => { + menuItems.forEach((item) => { cy.findByText(item).click(); }); }); diff --git a/e2e/test/scenarios/visualizations-tabular/object_detail.cy.spec.js b/e2e/test/scenarios/visualizations-tabular/object_detail.cy.spec.js index fb417d7891c..6a319d50227 100644 --- a/e2e/test/scenarios/visualizations-tabular/object_detail.cy.spec.js +++ b/e2e/test/scenarios/visualizations-tabular/object_detail.cy.spec.js @@ -479,7 +479,7 @@ function changeSorting(columnName, direction) { cy.wait("@dataset"); } -["postgres", "mysql"].forEach(dialect => { +["postgres", "mysql"].forEach((dialect) => { describe( `Object Detail > composite keys (${dialect})`, { tags: ["@external"] }, @@ -494,7 +494,7 @@ function changeSorting(columnName, direction) { }); it("can show object detail modal for items with composite keys", () => { - H.getTableId({ name: TEST_TABLE }).then(tableId => { + H.getTableId({ name: TEST_TABLE }).then((tableId) => { cy.visit(`/question#?db=${WRITABLE_DB_ID}&table=${tableId}`); }); @@ -511,7 +511,7 @@ function changeSorting(columnName, direction) { // this bug only manifests on tables without single integer primary keys // it is also reproducible on tables with string keys - H.getTableId({ name: TEST_TABLE }).then(tableId => { + H.getTableId({ name: TEST_TABLE }).then((tableId) => { cy.visit(`/question#?db=${WRITABLE_DB_ID}&table=${tableId}`); }); @@ -545,7 +545,7 @@ function changeSorting(columnName, direction) { }); it("can show object detail modal for items with no primary key", () => { - H.getTableId({ name: TEST_TABLE }).then(tableId => { + H.getTableId({ name: TEST_TABLE }).then((tableId) => { cy.visit(`/question#?db=${WRITABLE_DB_ID}&table=${tableId}`); }); diff --git a/e2e/test/scenarios/visualizations-tabular/pivot_tables.cy.spec.js b/e2e/test/scenarios/visualizations-tabular/pivot_tables.cy.spec.js index b71010bb55e..d38b0a838f1 100644 --- a/e2e/test/scenarios/visualizations-tabular/pivot_tables.cy.spec.js +++ b/e2e/test/scenarios/visualizations-tabular/pivot_tables.cy.spec.js @@ -650,7 +650,7 @@ describe("scenarios > visualizations > pivot tables", { tags: "@slow" }, () => { }); }); - TEST_CASES.forEach(test => { + TEST_CASES.forEach((test) => { describe(test.case, () => { beforeEach(() => { cy.visit("collection/root"); @@ -670,7 +670,7 @@ describe("scenarios > visualizations > pivot tables", { tags: "@slow" }, () => { cy.findByTestId("public-link-popover-content") .findByTestId("public-link-input") .invoke("val") - .then($value => { + .then(($value) => { cy.visit($value); }); cy.findByTestId("embed-frame-header").contains(test.subject); @@ -1049,7 +1049,7 @@ describe("scenarios > visualizations > pivot tables", { tags: "@slow" }, () => { cy.findByText("Row totals").should("be.visible"); }); - cy.get("@questionId").then(id => H.visitQuestion(id)); + cy.get("@questionId").then((id) => H.visitQuestion(id)); H.queryBuilderMain().within(() => { cy.findByLabelText(PIVOT_TABLE_BODY_LABEL).scrollTo(10000, 0); @@ -1058,7 +1058,7 @@ describe("scenarios > visualizations > pivot tables", { tags: "@slow" }, () => { }); describe("column resizing", () => { - const getCellWidth = textEl => + const getCellWidth = (textEl) => textEl.closest("[data-testid=pivot-table-cell]").width(); it("should persist column sizes in visualization settings", () => { @@ -1075,10 +1075,10 @@ describe("scenarios > visualizations > pivot tables", { tags: "@slow" }, () => { dragColumnHeader(totalHeaderColHandle, 100); cy.findByTestId("pivot-table").within(() => { - cy.findByText("User → Source").should($headerTextEl => { + cy.findByText("User → Source").should(($headerTextEl) => { expect(getCellWidth($headerTextEl)).equal(80); // min width is 80 }); - cy.findByText("Row totals").should($headerTextEl => { + cy.findByText("Row totals").should(($headerTextEl) => { expect(getCellWidth($headerTextEl)).equal(200); }); }); @@ -1091,10 +1091,10 @@ describe("scenarios > visualizations > pivot tables", { tags: "@slow" }, () => { cy.reload(); // reload to make sure the settings are persisted cy.findByTestId("pivot-table").within(() => { - cy.findByText("User → Source").then($headerTextEl => { + cy.findByText("User → Source").then(($headerTextEl) => { expect(getCellWidth($headerTextEl)).equal(80); }); - cy.findByText("Row totals").then($headerTextEl => { + cy.findByText("Row totals").then(($headerTextEl) => { expect(getCellWidth($headerTextEl)).equal(200); }); }); @@ -1102,8 +1102,8 @@ describe("scenarios > visualizations > pivot tables", { tags: "@slow" }, () => { }); it("should not have to wait for data to show fields in summarisation (metabase#26467)", () => { - cy.intercept("POST", "api/card/pivot/*/query", req => { - req.on("response", res => { + cy.intercept("POST", "api/card/pivot/*/query", (req) => { + req.on("response", (res) => { res.setDelay(20_000); }); }); @@ -1512,7 +1512,7 @@ function assertOnPivotFields() { function dragColumnHeader(el, xDistance = 50) { const HANDLE_WIDTH = xDistance > 0 ? 2 : -2; - el.then($el => { + el.then(($el) => { const currentXPos = $el[0].getBoundingClientRect().x; el.trigger("mousedown", { which: 1 }) .trigger("mousemove", { @@ -1544,7 +1544,7 @@ function sortColumnResults(column, direction) { // Click anywhere to dismiss the popover from UI cy.get("body").click("topLeft"); - cy.location("hash").then(hash => { + cy.location("hash").then((hash) => { // Get rid of the leading `#` const base64EncodedQuery = hash.slice(1); const decodedQuery = atob(base64EncodedQuery); diff --git a/e2e/test/scenarios/visualizations-tabular/table-column-settings.cy.spec.js b/e2e/test/scenarios/visualizations-tabular/table-column-settings.cy.spec.js index ffddb303027..6e3b3bad49c 100644 --- a/e2e/test/scenarios/visualizations-tabular/table-column-settings.cy.spec.js +++ b/e2e/test/scenarios/visualizations-tabular/table-column-settings.cy.spec.js @@ -33,7 +33,7 @@ const tableQuestionWithJoin = { }, }; -const tableQuestionWithJoinOnQuestion = card => ({ +const tableQuestionWithJoinOnQuestion = (card) => ({ display: "table", query: { "source-table": ORDERS_ID, @@ -165,7 +165,7 @@ const nativeQuestion = { limit: 5, }; -const nestedQuestion = card => ({ +const nestedQuestion = (card) => ({ display: "table", query: { "source-table": `card__${card.id}`, @@ -173,7 +173,7 @@ const nestedQuestion = card => ({ limit: 5, }); -const nestedQuestionWithJoinOnTable = card => ({ +const nestedQuestionWithJoinOnTable = (card) => ({ display: "table", query: { "source-table": `card__${card.id}`, @@ -193,7 +193,7 @@ const nestedQuestionWithJoinOnTable = card => ({ }, }); -const nestedQuestionWithJoinOnQuestion = card => ({ +const nestedQuestionWithJoinOnQuestion = (card) => ({ display: "table", query: { "source-table": `card__${card.id}`, @@ -823,11 +823,11 @@ describe("scenarios > visualizations > table column settings", () => { }); }); -const showColumn = column => { +const showColumn = (column) => { cy.findByTestId(`${column}-show-button`).click(); }; -const hideColumn = column => { +const hideColumn = (column) => { cy.findByTestId(`${column}-hide-button`).click(); }; @@ -849,14 +849,14 @@ const visibleColumns = () => { return cy.findByTestId("visible-columns"); }; -const getColumn = columnName => { +const getColumn = (columnName) => { return visibleColumns().contains("[role=listitem]", columnName); }; -const assertColumnEnabled = column => { +const assertColumnEnabled = (column) => { column.should("have.attr", "data-enabled", "true"); }; -const assertColumnHidden = column => { +const assertColumnHidden = (column) => { column.should("have.attr", "data-enabled", "false"); }; diff --git a/e2e/test/scenarios/visualizations-tabular/table.cy.spec.js b/e2e/test/scenarios/visualizations-tabular/table.cy.spec.js index 6cff21738ea..aa79bcc9ce2 100644 --- a/e2e/test/scenarios/visualizations-tabular/table.cy.spec.js +++ b/e2e/test/scenarios/visualizations-tabular/table.cy.spec.js @@ -103,13 +103,13 @@ describe("scenarios > visualizations > table", () => { }); const assertUnchangedWidths = () => { - cy.get("@firstWidth").then(firstWidth => { + cy.get("@firstWidth").then((firstWidth) => { H.tableHeaderColumn("first_column") .invoke("outerWidth") .should("eq", firstWidth); }); - cy.get("@secondWidth").then(secondWidth => { + cy.get("@secondWidth").then((secondWidth) => { H.tableHeaderColumn("second_column") .invoke("outerWidth") .should("eq", secondWidth); @@ -371,7 +371,7 @@ describe("scenarios > visualizations > table", () => { cy.findByPlaceholderText("Search by Password").blur(); }); - H.popover().then($popover => { + H.popover().then(($popover) => { expect(H.isScrollableHorizontally($popover[0])).to.be.false; }); }); @@ -379,8 +379,8 @@ describe("scenarios > visualizations > table", () => { it("should show the slow loading text when the query is taking too long", () => { H.openOrdersTable({ mode: "notebook" }); - cy.intercept("POST", "/api/dataset", req => { - req.on("response", res => { + cy.intercept("POST", "/api/dataset", (req) => { + req.on("response", (res) => { res.setDelay(10000); }); }); @@ -413,7 +413,7 @@ describe("scenarios > visualizations > table > dashboards context", () => { cy.findByTestId("public-link-input") .invoke("val") .should("not.be.empty") - .then(publicLink => { + .then((publicLink) => { cy.signOut(); cy.visit(publicLink); }); @@ -541,7 +541,7 @@ describe("scenarios > visualizations > table > dashboards context", () => { cy.findAllByTestId("header-cell") .filter(":contains(ID)") .as("headerCell") - .then($cell => { + .then(($cell) => { const originalWidth = $cell[0].getBoundingClientRect().width; cy.wrap(originalWidth).as("originalWidth"); }); @@ -561,8 +561,8 @@ describe("scenarios > visualizations > table > dashboards context", () => { H.saveDashboard(); - cy.get("@originalWidth").then(originalWidth => { - cy.get("@headerCell").should($newCell => { + cy.get("@originalWidth").then((originalWidth) => { + cy.get("@headerCell").should(($newCell) => { const newWidth = $newCell[0].getBoundingClientRect().width; expect(newWidth).to.be.gte(originalWidth + resizeByWidth); }); @@ -571,8 +571,8 @@ describe("scenarios > visualizations > table > dashboards context", () => { // Ensure it persists after page reload cy.reload(); - cy.get("@originalWidth").then(originalWidth => { - cy.get("@headerCell").should($newCell => { + cy.get("@originalWidth").then((originalWidth) => { + cy.get("@headerCell").should(($newCell) => { const newWidth = $newCell[0].getBoundingClientRect().width; expect(newWidth).to.be.gte(originalWidth + resizeByWidth); }); @@ -688,9 +688,9 @@ describe("scenarios > visualizations > table > conditional formatting", () => { H.getTable({ name: "many_data_types" }).then( ({ id: tableId, fields }) => { - const booleanField = fields.find(field => field.name === "boolean"); - const stringField = fields.find(field => field.name === "string"); - const idField = fields.find(field => field.name === "id"); + const booleanField = fields.find((field) => field.name === "boolean"); + const stringField = fields.find((field) => field.name === "string"); + const idField = fields.find((field) => field.name === "id"); H.visitQuestionAdhoc({ dataset_query: { diff --git a/e2e/test/scenarios/visualizations-tabular/visualizations-tabular-reproductions.cy.spec.js b/e2e/test/scenarios/visualizations-tabular/visualizations-tabular-reproductions.cy.spec.js index 6d840e7a0ec..59365a8ff98 100644 --- a/e2e/test/scenarios/visualizations-tabular/visualizations-tabular-reproductions.cy.spec.js +++ b/e2e/test/scenarios/visualizations-tabular/visualizations-tabular-reproductions.cy.spec.js @@ -20,7 +20,7 @@ describe("issue 6010", () => { }); }; - const createQuestion = metric_id => { + const createQuestion = (metric_id) => { return H.createQuestion({ name: "Question", display: "line", @@ -643,8 +643,8 @@ describe.skip("issue 42049", () => { }); it("should not mess up columns order (metabase#42049)", () => { - cy.intercept("POST", "/api/card/*/query", req => { - req.on("response", res => { + cy.intercept("POST", "/api/card/*/query", (req) => { + req.on("response", (res) => { const createdAt = res.body.data.cols[1]; createdAt.field_ref[1] = "created_at"; // simulate named field ref @@ -808,7 +808,7 @@ describe("issue 14148", { tags: "@external" }, () => { }, }, { - callback: xhr => + callback: (xhr) => expect(xhr.response.body.cause || "").not.to.contain("ERROR"), }, ), @@ -886,7 +886,7 @@ describe("issue 7884", () => { }, }; - const getNestedQuestionDetails = sourceQuestionId => ({ + const getNestedQuestionDetails = (sourceQuestionId) => ({ query: { "source-table": `card__${sourceQuestionId}`, }, diff --git a/e2e/validate-e2e-test-files.js b/e2e/validate-e2e-test-files.js index df1344f363c..464ab71b881 100644 --- a/e2e/validate-e2e-test-files.js +++ b/e2e/validate-e2e-test-files.js @@ -15,7 +15,7 @@ function validateE2EFileNames(files) { return; } - const invalidFileNames = files.filter(fullPath => { + const invalidFileNames = files.filter((fullPath) => { return !path.basename(fullPath).match(E2E_FILE_EXTENSION); }); diff --git a/enterprise/frontend/src/embedding-sdk/bin/generate-cli-snippets-for-testing.ts b/enterprise/frontend/src/embedding-sdk/bin/generate-cli-snippets-for-testing.ts index 50f21163a71..0148f6e94ae 100644 --- a/enterprise/frontend/src/embedding-sdk/bin/generate-cli-snippets-for-testing.ts +++ b/enterprise/frontend/src/embedding-sdk/bin/generate-cli-snippets-for-testing.ts @@ -39,17 +39,17 @@ const generateComponentSnippets = ({ isNextJs: false, }); const nextJsAnalyticsPageSnippetContent = getNextJsAnalyticsPageSnippet({ - resolveImport: path => `./${path}`, + resolveImport: (path) => `./${path}`, }); const nextJsPagesWrapperSnippetContent = getNextJsPagesWrapperOrAppWrapperSnippet({ router: "pages", - resolveImport: path => `./${path}`, + resolveImport: (path) => `./${path}`, }); const nextJsAppWrapperSnippetContent = getNextJsPagesWrapperOrAppWrapperSnippet({ router: "app", - resolveImport: path => `./${path}`, + resolveImport: (path) => `./${path}`, }); for (const { fileName, content } of snippets) { @@ -80,17 +80,17 @@ const generateComponentSnippets = ({ const generateNextJsSnippets = ({ folderName }: { folderName: string }) => { const nextJsAnalyticsPageSnippetContent = getNextJsAnalyticsPageSnippet({ - resolveImport: path => `./${path}`, + resolveImport: (path) => `./${path}`, }); const nextJsPagesWrapperSnippetContent = getNextJsPagesWrapperOrAppWrapperSnippet({ router: "pages", - resolveImport: path => `./${path}`, + resolveImport: (path) => `./${path}`, }); const nextJsAppWrapperSnippetContent = getNextJsPagesWrapperOrAppWrapperSnippet({ router: "app", - resolveImport: path => `./${path}`, + resolveImport: (path) => `./${path}`, }); generateComponentSnippets({ diff --git a/enterprise/frontend/src/embedding-sdk/bin/generate-nextjs-compat.ts b/enterprise/frontend/src/embedding-sdk/bin/generate-nextjs-compat.ts index d5ef4ba3917..9b9c251bb88 100644 --- a/enterprise/frontend/src/embedding-sdk/bin/generate-nextjs-compat.ts +++ b/enterprise/frontend/src/embedding-sdk/bin/generate-nextjs-compat.ts @@ -19,7 +19,7 @@ export type ComponentDefinition = { // { mainComponent: "MetabaseProvider", subComponents: [] }, const COMPONENTS_TO_EXPORT: ComponentDefinition[] = getPublicComponents().filter( - component => component.mainComponent !== "MetabaseProvider", + (component) => component.mainComponent !== "MetabaseProvider", ); // END OF CONFIGURATION @@ -91,7 +91,7 @@ const ${mainComponent} = dynamic( ${subComponents .map( - subComponent => `${mainComponent}.${subComponent} = dynamic( + (subComponent) => `${mainComponent}.${subComponent} = dynamic( () => import("./main.bundle.js").then((m) => { return { default: m.${mainComponent}.${subComponent} }; @@ -109,7 +109,7 @@ ${match(type) }; const generateAllComponents = (type: "cjs" | "js") => { - return COMPONENTS_TO_EXPORT.map(component => + return COMPONENTS_TO_EXPORT.map((component) => generateCodeFor({ component, type }), ).join("\n"); }; diff --git a/enterprise/frontend/src/embedding-sdk/bin/get-public-components.ts b/enterprise/frontend/src/embedding-sdk/bin/get-public-components.ts index 6292d03af3a..9547bdce7f2 100644 --- a/enterprise/frontend/src/embedding-sdk/bin/get-public-components.ts +++ b/enterprise/frontend/src/embedding-sdk/bin/get-public-components.ts @@ -21,7 +21,7 @@ export function getPublicComponents() { const componentForNextJsCompatList: ComponentDefinition[] = []; - sdkPublicIndexSourceFile.forEachDescendant(node => { + sdkPublicIndexSourceFile.forEachDescendant((node) => { switch (node.getKind()) { case SyntaxKind.ExportSpecifier: { if (!isType(node as ExportSpecifier) && isReactComponent(node)) { @@ -49,7 +49,7 @@ function findSubComponents(node: ExportSpecifier) { ).findReferencesAsNodes(); return sdkComponentReferences - .map(reference => { + .map((reference) => { if ( // Find all `InteractiveQuestion.Xxx` references. reference.getParent()?.getKind() === diff --git a/enterprise/frontend/src/embedding-sdk/cli/run.ts b/enterprise/frontend/src/embedding-sdk/cli/run.ts index e64570d07b3..2f48e3a0021 100644 --- a/enterprise/frontend/src/embedding-sdk/cli/run.ts +++ b/enterprise/frontend/src/embedding-sdk/cli/run.ts @@ -55,14 +55,14 @@ export const CLI_STEPS: CliStepConfig[] = [ { id: "askForTenancyColumns", executeStep: askForTenancyColumns, - runIf: state => !state.useSampleDatabase && hasValidLicense(state), + runIf: (state) => !state.useSampleDatabase && hasValidLicense(state), }, { id: "setupPermissions", executeStep: setupPermissions, // We need at least one table with a tenancy column to set up sandboxing. - runIf: state => + runIf: (state) => !state.useSampleDatabase && hasValidLicense(state) && Object.keys(state.tenancyColumnNames ?? {}).length > 0, diff --git a/enterprise/frontend/src/embedding-sdk/cli/snippets/user-switcher-snippet.ts b/enterprise/frontend/src/embedding-sdk/cli/snippets/user-switcher-snippet.ts index c0fb9f3adb2..98635f04e37 100644 --- a/enterprise/frontend/src/embedding-sdk/cli/snippets/user-switcher-snippet.ts +++ b/enterprise/frontend/src/embedding-sdk/cli/snippets/user-switcher-snippet.ts @@ -1,7 +1,7 @@ import { HARDCODED_USERS } from "../constants/hardcoded-users"; export const getUserSwitcherSnippet = () => { - const users = HARDCODED_USERS.map(user => ({ + const users = HARDCODED_USERS.map((user) => ({ email: user.email, firstName: user.firstName, })); diff --git a/enterprise/frontend/src/embedding-sdk/cli/steps/add-database-connection.ts b/enterprise/frontend/src/embedding-sdk/cli/steps/add-database-connection.ts index 1a0f84ce9b7..1736c832fdf 100644 --- a/enterprise/frontend/src/embedding-sdk/cli/steps/add-database-connection.ts +++ b/enterprise/frontend/src/embedding-sdk/cli/steps/add-database-connection.ts @@ -9,7 +9,7 @@ import { addDatabaseConnection } from "../utils/add-database-connection"; import { askForDatabaseConnectionInfo } from "../utils/ask-for-db-connection-info"; import { fetchInstanceSettings } from "../utils/fetch-instance-settings"; -export const addDatabaseConnectionStep: CliStepMethod = async state => { +export const addDatabaseConnectionStep: CliStepMethod = async (state) => { const settings = await fetchInstanceSettings({ instanceUrl: state.instanceUrl ?? "", }); @@ -31,7 +31,7 @@ export const addDatabaseConnectionStep: CliStepMethod = async state => { message: "What database are you connecting to?", source(term) { return term - ? engineChoices.filter(choice => + ? engineChoices.filter((choice) => choice.name.toLowerCase().includes(term.toLowerCase()), ) : engineChoices; @@ -74,4 +74,4 @@ export const addDatabaseConnectionStep: CliStepMethod = async state => { const getEngineChoices = (settings: Settings) => Object.entries(settings.engines) .map(([key, engine]) => ({ name: engine["driver-name"], value: key })) - .filter(engine => CLI_SHOWN_DB_ENGINES.includes(engine.value)); + .filter((engine) => CLI_SHOWN_DB_ENGINES.includes(engine.value)); diff --git a/enterprise/frontend/src/embedding-sdk/cli/steps/ask-if-has-database.ts b/enterprise/frontend/src/embedding-sdk/cli/steps/ask-if-has-database.ts index b1f68d550b7..e1f617810dd 100644 --- a/enterprise/frontend/src/embedding-sdk/cli/steps/ask-if-has-database.ts +++ b/enterprise/frontend/src/embedding-sdk/cli/steps/ask-if-has-database.ts @@ -6,7 +6,7 @@ import { printHelperText } from "embedding-sdk/cli/utils/print"; /** * Asks the user first if they have a database to connect to. */ -export const askIfHasDatabase: CliStepMethod = async state => { +export const askIfHasDatabase: CliStepMethod = async (state) => { const hasDatabase = await toggle({ message: "Do you have a database to connect to? This will be used to embed your data.", diff --git a/enterprise/frontend/src/embedding-sdk/cli/steps/ask-tenancy-columns.ts b/enterprise/frontend/src/embedding-sdk/cli/steps/ask-tenancy-columns.ts index 44f76f2b8be..46f670da121 100644 --- a/enterprise/frontend/src/embedding-sdk/cli/steps/ask-tenancy-columns.ts +++ b/enterprise/frontend/src/embedding-sdk/cli/steps/ask-tenancy-columns.ts @@ -4,7 +4,7 @@ import toggle from "inquirer-toggle"; import type { CliStepMethod } from "../types/cli"; import { printHelperText } from "../utils/print"; -export const askForTenancyColumns: CliStepMethod = async state => { +export const askForTenancyColumns: CliStepMethod = async (state) => { // The sample database does not have tenancy columns. if (state.useSampleDatabase) { return [{ type: "success" }, state]; @@ -50,12 +50,12 @@ export const askForTenancyColumns: CliStepMethod = async state => { // We only select the fields that have a foreign key. // We exclude the last tenant id field. ...(table.fields - ?.filter(field => field.name !== lastTenancyColumnName) - ?.map(f => ({ name: f.name, value: f.name })) ?? []), + ?.filter((field) => field.name !== lastTenancyColumnName) + ?.map((f) => ({ name: f.name, value: f.name })) ?? []), ]; const lastTenantField = table.fields?.find( - field => field.name === lastTenancyColumnName, + (field) => field.name === lastTenancyColumnName, ); // if we found the same column name in the previous table, @@ -72,7 +72,7 @@ export const askForTenancyColumns: CliStepMethod = async state => { message: `What is the multi-tenancy column for ${table.name}?`, source(term) { return term - ? fieldChoices.filter(choice => choice.name.includes(term)) + ? fieldChoices.filter((choice) => choice.name.includes(term)) : fieldChoices; }, }); diff --git a/enterprise/frontend/src/embedding-sdk/cli/steps/check-docker-container-exist.ts b/enterprise/frontend/src/embedding-sdk/cli/steps/check-docker-container-exist.ts index 3b9b1c957fa..c156b8a114e 100644 --- a/enterprise/frontend/src/embedding-sdk/cli/steps/check-docker-container-exist.ts +++ b/enterprise/frontend/src/embedding-sdk/cli/steps/check-docker-container-exist.ts @@ -13,7 +13,7 @@ const execAsync = promisify(exec); /** * Check if the Docker daemon is running. */ -export const checkIfDockerContainerExists: CliStepMethod = async state => { +export const checkIfDockerContainerExists: CliStepMethod = async (state) => { const doesContainerExist = await doesDockerContainerExist(CONTAINER_NAME); if (doesContainerExist) { diff --git a/enterprise/frontend/src/embedding-sdk/cli/steps/check-docker-running.ts b/enterprise/frontend/src/embedding-sdk/cli/steps/check-docker-running.ts index c471a2723cb..c24d419fdf4 100644 --- a/enterprise/frontend/src/embedding-sdk/cli/steps/check-docker-running.ts +++ b/enterprise/frontend/src/embedding-sdk/cli/steps/check-docker-running.ts @@ -9,7 +9,7 @@ const exec = promisify(execCallback); /** * Check if the Docker daemon is running. */ -export const checkIsDockerRunning: CliStepMethod = async state => { +export const checkIsDockerRunning: CliStepMethod = async (state) => { const spinner = ora("Checking if Docker is running…").start(); const errorResponse: CliError = { diff --git a/enterprise/frontend/src/embedding-sdk/cli/steps/check-if-react-project.ts b/enterprise/frontend/src/embedding-sdk/cli/steps/check-if-react-project.ts index b2b31d460f6..c714e7d20f5 100644 --- a/enterprise/frontend/src/embedding-sdk/cli/steps/check-if-react-project.ts +++ b/enterprise/frontend/src/embedding-sdk/cli/steps/check-if-react-project.ts @@ -16,7 +16,7 @@ import { const isReactVersionSupported = (version: string) => semver.satisfies(semver.coerce(version)!, "18.x || 19.x"); -export const checkIfReactProject: CliStepMethod = async state => { +export const checkIfReactProject: CliStepMethod = async (state) => { const spinner = ora("Checking if this is a React project…").start(); if (!(await hasPackageJson())) { diff --git a/enterprise/frontend/src/embedding-sdk/cli/steps/check-sdk-available.ts b/enterprise/frontend/src/embedding-sdk/cli/steps/check-sdk-available.ts index 90ac5ebd051..7f9dab9dbc5 100644 --- a/enterprise/frontend/src/embedding-sdk/cli/steps/check-sdk-available.ts +++ b/enterprise/frontend/src/embedding-sdk/cli/steps/check-sdk-available.ts @@ -5,7 +5,7 @@ import { installSdk } from "../steps/install-sdk"; import type { CliStepMethod } from "../types/cli"; import { getPackageVersions } from "../utils/get-package-version"; -export const checkSdkAvailable: CliStepMethod = async state => { +export const checkSdkAvailable: CliStepMethod = async (state) => { const spinner = ora("Checking if SDK is installed…").start(); const projectDependencies = await getPackageVersions(SDK_PACKAGE_NAME); diff --git a/enterprise/frontend/src/embedding-sdk/cli/steps/create-api-key.ts b/enterprise/frontend/src/embedding-sdk/cli/steps/create-api-key.ts index 4036f0b81d9..0ddd87ecabd 100644 --- a/enterprise/frontend/src/embedding-sdk/cli/steps/create-api-key.ts +++ b/enterprise/frontend/src/embedding-sdk/cli/steps/create-api-key.ts @@ -2,7 +2,7 @@ import ora from "ora"; import type { CliStepMethod } from "embedding-sdk/cli/types/cli"; -export const createApiKey: CliStepMethod = async state => { +export const createApiKey: CliStepMethod = async (state) => { if (!state.instanceUrl || !state.cookie) { return [ { diff --git a/enterprise/frontend/src/embedding-sdk/cli/steps/create-models-and-xrays.ts b/enterprise/frontend/src/embedding-sdk/cli/steps/create-models-and-xrays.ts index b6940036e68..3f357cb85cb 100644 --- a/enterprise/frontend/src/embedding-sdk/cli/steps/create-models-and-xrays.ts +++ b/enterprise/frontend/src/embedding-sdk/cli/steps/create-models-and-xrays.ts @@ -7,7 +7,7 @@ import type { DashboardInfo } from "../types/dashboard"; import { createModelFromTable } from "../utils/create-model-from-table"; import { createXrayDashboardFromModel } from "../utils/xray-models"; -export const createModelsAndXrays: CliStepMethod = async state => { +export const createModelsAndXrays: CliStepMethod = async (state) => { const { instanceUrl = "", databaseId, diff --git a/enterprise/frontend/src/embedding-sdk/cli/steps/generate-component-files.ts b/enterprise/frontend/src/embedding-sdk/cli/steps/generate-component-files.ts index cff6778fa25..cc67e96b4cf 100644 --- a/enterprise/frontend/src/embedding-sdk/cli/steps/generate-component-files.ts +++ b/enterprise/frontend/src/embedding-sdk/cli/steps/generate-component-files.ts @@ -16,7 +16,7 @@ import { import { printError, printSuccess } from "../utils/print"; import { getGeneratedComponentsDefaultPath } from "../utils/snippets-helpers"; -export const generateReactComponentFiles: CliStepMethod = async state => { +export const generateReactComponentFiles: CliStepMethod = async (state) => { const { instanceUrl, apiKey, dashboards = [], token } = state; if (!instanceUrl || !apiKey) { @@ -85,7 +85,7 @@ export const generateReactComponentFiles: CliStepMethod = async state => { // Generate index.js file with all the component exports. const exportIndexContent = sampleComponents - .map(file => `export * from "./${file.fileName}"`) + .map((file) => `export * from "./${file.fileName}"`) .join("\n") .trim(); diff --git a/enterprise/frontend/src/embedding-sdk/cli/steps/generate-credentials-file.ts b/enterprise/frontend/src/embedding-sdk/cli/steps/generate-credentials-file.ts index d8e5d6af2fc..b7e7c8fcb27 100644 --- a/enterprise/frontend/src/embedding-sdk/cli/steps/generate-credentials-file.ts +++ b/enterprise/frontend/src/embedding-sdk/cli/steps/generate-credentials-file.ts @@ -4,7 +4,7 @@ import { SAMPLE_CREDENTIALS_FILE_NAME } from "../constants/config"; import type { CliStepMethod } from "../types/cli"; import { addFileToGitIgnore } from "../utils/add-file-to-git-ignore"; -export const generateCredentialsFile: CliStepMethod = async state => { +export const generateCredentialsFile: CliStepMethod = async (state) => { await addFileToGitIgnore(SAMPLE_CREDENTIALS_FILE_NAME); const credentials = { diff --git a/enterprise/frontend/src/embedding-sdk/cli/steps/generate-credentials.ts b/enterprise/frontend/src/embedding-sdk/cli/steps/generate-credentials.ts index 5f674a42c69..bfcac87d629 100644 --- a/enterprise/frontend/src/embedding-sdk/cli/steps/generate-credentials.ts +++ b/enterprise/frontend/src/embedding-sdk/cli/steps/generate-credentials.ts @@ -10,13 +10,13 @@ import { printWithPadding, } from "../utils/print"; -export const generateCredentials: CliStepMethod = async state => { +export const generateCredentials: CliStepMethod = async (state) => { printEmptyLines(); printWithPadding("Setting up a local Metabase instance via Docker."); const email = await input({ message: "What is the email address you want to use for the admin user?", - validate: email => + validate: (email) => isEmail(email) || OUTPUT_STYLES.error("Please enter a valid email address."), }); diff --git a/enterprise/frontend/src/embedding-sdk/cli/steps/generate-express-server-file.ts b/enterprise/frontend/src/embedding-sdk/cli/steps/generate-express-server-file.ts index 021041c1f75..fa760c11dc7 100644 --- a/enterprise/frontend/src/embedding-sdk/cli/steps/generate-express-server-file.ts +++ b/enterprise/frontend/src/embedding-sdk/cli/steps/generate-express-server-file.ts @@ -9,7 +9,7 @@ import { getExpressServerSnippet } from "../snippets"; import type { CliStepMethod } from "../types/cli"; import { printError } from "../utils/print"; -export const generateExpressServerFile: CliStepMethod = async state => { +export const generateExpressServerFile: CliStepMethod = async (state) => { const { instanceUrl } = state; if (!instanceUrl) { @@ -25,7 +25,7 @@ export const generateExpressServerFile: CliStepMethod = async state => { mockServerDir = await input({ message: "Where should we save the example Express mock server folder?", default: "mock-server", - validate: value => { + validate: (value) => { if (!value) { return "The path cannot be empty."; } diff --git a/enterprise/frontend/src/embedding-sdk/cli/steps/install-sdk.ts b/enterprise/frontend/src/embedding-sdk/cli/steps/install-sdk.ts index c215d91fb4b..e483edbd13d 100644 --- a/enterprise/frontend/src/embedding-sdk/cli/steps/install-sdk.ts +++ b/enterprise/frontend/src/embedding-sdk/cli/steps/install-sdk.ts @@ -60,7 +60,7 @@ const installPackage = async (packageName: string) => { } }; -export const installSdk: CliStepMethod = async state => { +export const installSdk: CliStepMethod = async (state) => { const shouldStart = await toggle({ message: "Would you like to install the SDK now?", default: true, diff --git a/enterprise/frontend/src/embedding-sdk/cli/steps/pick-database-tables.ts b/enterprise/frontend/src/embedding-sdk/cli/steps/pick-database-tables.ts index 0f58ef3f706..2f0eb867516 100644 --- a/enterprise/frontend/src/embedding-sdk/cli/steps/pick-database-tables.ts +++ b/enterprise/frontend/src/embedding-sdk/cli/steps/pick-database-tables.ts @@ -11,7 +11,7 @@ import { } from "../utils/propagate-error-response"; import { retry } from "../utils/retry"; -export const pickDatabaseTables: CliStepMethod = async state => { +export const pickDatabaseTables: CliStepMethod = async (state) => { const { instanceUrl, databaseId, cookie = "" } = state; const spinner = ora("Fetching database schemas and tables…").start(); @@ -78,7 +78,7 @@ export const pickDatabaseTables: CliStepMethod = async state => { if (!state.useSampleDatabase) { chosenTableIds = await checkbox({ - validate: choices => { + validate: (choices) => { if (choices.length === 0) { return "Pick 1 - 3 tables to embed."; } @@ -90,7 +90,7 @@ export const pickDatabaseTables: CliStepMethod = async state => { return true; }, message: "Pick 1 - 3 tables to embed:", - choices: tablesWithoutMetadata.map(table => ({ + choices: tablesWithoutMetadata.map((table) => ({ name: table.name, value: table.id, })), @@ -99,8 +99,8 @@ export const pickDatabaseTables: CliStepMethod = async state => { // The user does not know about the sample database's structure, // so we pick a couple tables for them. chosenTableIds = tablesWithoutMetadata - .filter(item => SAMPLE_DATABASE_SELECTED_TABLES.includes(item.name)) - .map(table => table.id); + .filter((item) => SAMPLE_DATABASE_SELECTED_TABLES.includes(item.name)) + .map((table) => table.id); } spinner.start("Fetching table metadata..."); @@ -128,7 +128,7 @@ export const pickDatabaseTables: CliStepMethod = async state => { await propagateErrorResponse(res); const metadataResult = (await res.json()) as { tables: Table[] }; - const table = metadataResult.tables.find(t => t.id === tableId); + const table = metadataResult.tables.find((t) => t.id === tableId); if (!table) { throw new Error(`Table "${tableId}" not found.`); diff --git a/enterprise/frontend/src/embedding-sdk/cli/steps/poll-metabase-instance.ts b/enterprise/frontend/src/embedding-sdk/cli/steps/poll-metabase-instance.ts index 0f8594d4481..cedef86b388 100644 --- a/enterprise/frontend/src/embedding-sdk/cli/steps/poll-metabase-instance.ts +++ b/enterprise/frontend/src/embedding-sdk/cli/steps/poll-metabase-instance.ts @@ -3,12 +3,12 @@ import ora from "ora"; import type { CliStepMethod } from "embedding-sdk/cli/types/cli"; const delay = (duration: number) => - new Promise(resolve => setTimeout(resolve, duration)); + new Promise((resolve) => setTimeout(resolve, duration)); const HEALTH_CHECK_MAX_ATTEMPTS = 60 * 5; const HEALTH_CHECK_WAIT = 1000; -export const pollMetabaseInstance: CliStepMethod = async state => { +export const pollMetabaseInstance: CliStepMethod = async (state) => { let attempts = 0; const spinner = ora( diff --git a/enterprise/frontend/src/embedding-sdk/cli/steps/setup-embedding-settings.ts b/enterprise/frontend/src/embedding-sdk/cli/steps/setup-embedding-settings.ts index dbaa049b1e9..511a64c38bf 100644 --- a/enterprise/frontend/src/embedding-sdk/cli/steps/setup-embedding-settings.ts +++ b/enterprise/frontend/src/embedding-sdk/cli/steps/setup-embedding-settings.ts @@ -9,7 +9,7 @@ import { propagateErrorResponse } from "../utils/propagate-error-response"; * This step must be after the license setup step, otherwise the JWT * configuration will not be applied. */ -export const setupEmbeddingSettings: CliStepMethod = async state => { +export const setupEmbeddingSettings: CliStepMethod = async (state) => { const { cookie = "" } = state; const spinner = ora("Enabling embedding features...").start(); diff --git a/enterprise/frontend/src/embedding-sdk/cli/steps/setup-license.ts b/enterprise/frontend/src/embedding-sdk/cli/steps/setup-license.ts index c4f9a843e45..b0792cb489c 100644 --- a/enterprise/frontend/src/embedding-sdk/cli/steps/setup-license.ts +++ b/enterprise/frontend/src/embedding-sdk/cli/steps/setup-license.ts @@ -20,7 +20,7 @@ const VISIT_STORE_MESSAGE = `Please visit ${chalk.blue( trialUrl, )} to get a license key.`; -export const setupLicense: CliStepMethod = async state => { +export const setupLicense: CliStepMethod = async (state) => { const setupMessage = state.useSampleDatabase ? SETUP_PRO_LICENSE_MESSAGE_WITH_SAMPLE_DATABASE : SETUP_PRO_LICENSE_MESSAGE; @@ -73,7 +73,7 @@ export const setupLicense: CliStepMethod = async state => { const token = await input({ message: "Enter your Metabase Pro license key:", required: true, - validate: value => { + validate: (value) => { if (value.length !== 64 || !/^[0-9A-Fa-f]+$/.test(value)) { return "License key must be a 64-character hexadecimal string."; } diff --git a/enterprise/frontend/src/embedding-sdk/cli/steps/setup-metabase-instance.ts b/enterprise/frontend/src/embedding-sdk/cli/steps/setup-metabase-instance.ts index cbb886b05e7..7c70298ea87 100644 --- a/enterprise/frontend/src/embedding-sdk/cli/steps/setup-metabase-instance.ts +++ b/enterprise/frontend/src/embedding-sdk/cli/steps/setup-metabase-instance.ts @@ -6,7 +6,7 @@ import { INSTANCE_CONFIGURED_MESSAGE } from "../constants/messages"; import type { CliOutput, CliStepMethod } from "../types/cli"; import { retry } from "../utils/retry"; -export const setupMetabaseInstance: CliStepMethod = async state => { +export const setupMetabaseInstance: CliStepMethod = async (state) => { const spinner = ora(); // If the user tries to setup the instance manually diff --git a/enterprise/frontend/src/embedding-sdk/cli/steps/setup-permission.ts b/enterprise/frontend/src/embedding-sdk/cli/steps/setup-permission.ts index 5fb52b34abb..69969af7bfa 100644 --- a/enterprise/frontend/src/embedding-sdk/cli/steps/setup-permission.ts +++ b/enterprise/frontend/src/embedding-sdk/cli/steps/setup-permission.ts @@ -11,7 +11,7 @@ import { } from "../utils/propagate-error-response"; import { sampleTenantIdsFromTables } from "../utils/sample-tenancy-column-values"; -export const setupPermissions: CliStepMethod = async state => { +export const setupPermissions: CliStepMethod = async (state) => { const { cookie = "", instanceUrl = "", diff --git a/enterprise/frontend/src/embedding-sdk/cli/steps/show-metabase-cli-title.ts b/enterprise/frontend/src/embedding-sdk/cli/steps/show-metabase-cli-title.ts index 0d7bd9891f7..86922da0012 100644 --- a/enterprise/frontend/src/embedding-sdk/cli/steps/show-metabase-cli-title.ts +++ b/enterprise/frontend/src/embedding-sdk/cli/steps/show-metabase-cli-title.ts @@ -4,7 +4,7 @@ import { SHOW_ON_STARTUP_MESSAGE } from "../constants/messages"; import type { CliStepMethod } from "../types/cli"; import { printEmptyLines, printTitle, printWithPadding } from "../utils/print"; -export const showMetabaseCliTitle: CliStepMethod = state => { +export const showMetabaseCliTitle: CliStepMethod = (state) => { printTitle(`Welcome to the Metabase Embedding SDK CLI`); printTitle(`View docs at ${SDK_DOCS_LINK}`); printEmptyLines(); diff --git a/enterprise/frontend/src/embedding-sdk/cli/steps/show-post-setup-steps.ts b/enterprise/frontend/src/embedding-sdk/cli/steps/show-post-setup-steps.ts index 0c2f29f3260..2f269f8e4ae 100644 --- a/enterprise/frontend/src/embedding-sdk/cli/steps/show-post-setup-steps.ts +++ b/enterprise/frontend/src/embedding-sdk/cli/steps/show-post-setup-steps.ts @@ -11,7 +11,7 @@ import { getNextJsSetupMessages } from "../utils/get-nextjs-setup-message"; import { checkIsInNextJsProject } from "../utils/nextjs-helpers"; import { printEmptyLines, printWithPadding } from "../utils/print"; -export const showPostSetupSteps: CliStepMethod = async state => { +export const showPostSetupSteps: CliStepMethod = async (state) => { const isNextJs = await checkIsInNextJsProject(); const START_SERVER_STEP = ` diff --git a/enterprise/frontend/src/embedding-sdk/cli/steps/start-local-metabase-container.ts b/enterprise/frontend/src/embedding-sdk/cli/steps/start-local-metabase-container.ts index 6419d187acb..e1d0f0d5234 100644 --- a/enterprise/frontend/src/embedding-sdk/cli/steps/start-local-metabase-container.ts +++ b/enterprise/frontend/src/embedding-sdk/cli/steps/start-local-metabase-container.ts @@ -30,7 +30,7 @@ const randInt = (min: number, max: number) => const exec = promisify(execCallback); -export const startLocalMetabaseContainer: CliStepMethod = async state => { +export const startLocalMetabaseContainer: CliStepMethod = async (state) => { let port = DEFAULT_PORT; const container = await getLocalMetabaseContainer(); diff --git a/enterprise/frontend/src/embedding-sdk/cli/utils/get-nextjs-setup-message.ts b/enterprise/frontend/src/embedding-sdk/cli/utils/get-nextjs-setup-message.ts index 18b097a5580..b55a50285bb 100644 --- a/enterprise/frontend/src/embedding-sdk/cli/utils/get-nextjs-setup-message.ts +++ b/enterprise/frontend/src/embedding-sdk/cli/utils/get-nextjs-setup-message.ts @@ -37,7 +37,7 @@ export const getNextJsSetupMessages = async ({ if (hasNextJsCustomAppOrRootLayout) { const layoutSnippet = getNextJsPagesWrapperOrAppWrapperSnippet({ router, - resolveImport: pathName => + resolveImport: (pathName) => getImportPathForRootLayout(componentPath, pathName), }); @@ -65,5 +65,5 @@ ${green(layoutSnippet)}`; snippets.push(afterSetupMessage); - return snippets.map(snippet => snippet.trim()); + return snippets.map((snippet) => snippet.trim()); }; diff --git a/enterprise/frontend/src/embedding-sdk/cli/utils/get-tenancy-isolation-sandboxes.ts b/enterprise/frontend/src/embedding-sdk/cli/utils/get-tenancy-isolation-sandboxes.ts index 228d1ce4094..a0ff305c238 100644 --- a/enterprise/frontend/src/embedding-sdk/cli/utils/get-tenancy-isolation-sandboxes.ts +++ b/enterprise/frontend/src/embedding-sdk/cli/utils/get-tenancy-isolation-sandboxes.ts @@ -25,7 +25,7 @@ export function getTenancyIsolationSandboxes(options: Options): Sandbox[] { // Define column-based tenant isolation for each chosen tables for (const tableId in tenancyColumnNames) { - const table = chosenTables.find(t => Number(t.id) === Number(tableId)); + const table = chosenTables.find((t) => Number(t.id) === Number(tableId)); const tenancyColumnName = tenancyColumnNames[tableId]; @@ -35,7 +35,7 @@ export function getTenancyIsolationSandboxes(options: Options): Sandbox[] { for (const groupId of groupIds) { const tenancyField = table.fields?.find( - f => f.name === tenancyColumnName, + (f) => f.name === tenancyColumnName, ); if (!tenancyField) { diff --git a/enterprise/frontend/src/embedding-sdk/cli/utils/nextjs-helpers.ts b/enterprise/frontend/src/embedding-sdk/cli/utils/nextjs-helpers.ts index ff4c52d6a64..f6e3eb4b9bb 100644 --- a/enterprise/frontend/src/embedding-sdk/cli/utils/nextjs-helpers.ts +++ b/enterprise/frontend/src/embedding-sdk/cli/utils/nextjs-helpers.ts @@ -116,7 +116,7 @@ async function generateNextJsCustomAppOrRootLayoutFile(componentPath: string) { const snippet = getNextJsPagesWrapperOrAppWrapperSnippet({ router, - resolveImport: pathName => + resolveImport: (pathName) => getImportPathForRootLayout(componentPath, pathName), }); diff --git a/enterprise/frontend/src/embedding-sdk/cli/utils/retry.ts b/enterprise/frontend/src/embedding-sdk/cli/utils/retry.ts index 6d721b2c85c..fc8a19cd396 100644 --- a/enterprise/frontend/src/embedding-sdk/cli/utils/retry.ts +++ b/enterprise/frontend/src/embedding-sdk/cli/utils/retry.ts @@ -1,5 +1,5 @@ const waitFor = (delayMs: number) => - new Promise(resolve => setTimeout(resolve, delayMs)); + new Promise((resolve) => setTimeout(resolve, delayMs)); export async function retry( task: () => Promise, diff --git a/enterprise/frontend/src/embedding-sdk/cli/utils/sample-tenancy-column-values.ts b/enterprise/frontend/src/embedding-sdk/cli/utils/sample-tenancy-column-values.ts index 06598fac830..ce30a1ed5d6 100644 --- a/enterprise/frontend/src/embedding-sdk/cli/utils/sample-tenancy-column-values.ts +++ b/enterprise/frontend/src/embedding-sdk/cli/utils/sample-tenancy-column-values.ts @@ -71,7 +71,7 @@ export async function sampleTenantIds( ): Promise { const { limit, table, columnName, databaseId, instanceUrl, cookie } = options; - const field = table.fields?.find(f => f.name === columnName); + const field = table.fields?.find((f) => f.name === columnName); if (!table || !field) { return null; @@ -105,5 +105,7 @@ export async function sampleTenantIds( const dataset = (await res.json()) as Dataset; - return dataset.data.rows.flat().filter(value => value !== null) as TenantId[]; + return dataset.data.rows + .flat() + .filter((value) => value !== null) as TenantId[]; } diff --git a/enterprise/frontend/src/embedding-sdk/components/private/InteractiveQuestion/components/Breakout/Breakout.tsx b/enterprise/frontend/src/embedding-sdk/components/private/InteractiveQuestion/components/Breakout/Breakout.tsx index 8cd0ec54fc7..a33c1a72ccf 100644 --- a/enterprise/frontend/src/embedding-sdk/components/private/InteractiveQuestion/components/Breakout/Breakout.tsx +++ b/enterprise/frontend/src/embedding-sdk/components/private/InteractiveQuestion/components/Breakout/Breakout.tsx @@ -33,7 +33,7 @@ export const BreakoutInner = ({ return ( - {breakoutItems.map(item => ( + {breakoutItems.map((item) => ( ({ item, name: item.longDisplayName }))} + items={breakoutItems.map((item) => ({ + item, + name: item.longDisplayName, + }))} addButtonLabel={t`Add another grouping`} onSelectItem={onSelectItem} onAddItem={onAddItem} diff --git a/enterprise/frontend/src/embedding-sdk/components/private/InteractiveQuestion/components/Breakout/BreakoutDropdown/BreakoutDropdown.tsx b/enterprise/frontend/src/embedding-sdk/components/private/InteractiveQuestion/components/Breakout/BreakoutDropdown/BreakoutDropdown.tsx index 0824c9265b9..7a833299b6f 100644 --- a/enterprise/frontend/src/embedding-sdk/components/private/InteractiveQuestion/components/Breakout/BreakoutDropdown/BreakoutDropdown.tsx +++ b/enterprise/frontend/src/embedding-sdk/components/private/InteractiveQuestion/components/Breakout/BreakoutDropdown/BreakoutDropdown.tsx @@ -35,7 +35,7 @@ export const BreakoutDropdownInner = ({ .with(0, () => t`Group`) .with(1, () => t`1 grouping`) .otherwise( - value => + (value) => c( "{0} refers to a number greater than 1 (i.e. 2 groupings, 10 groupings)", ).t`${value} groupings`, diff --git a/enterprise/frontend/src/embedding-sdk/components/private/InteractiveQuestion/components/Breakout/use-breakout-data.ts b/enterprise/frontend/src/embedding-sdk/components/private/InteractiveQuestion/components/Breakout/use-breakout-data.ts index 65282ad03cc..9a5a316696a 100644 --- a/enterprise/frontend/src/embedding-sdk/components/private/InteractiveQuestion/components/Breakout/use-breakout-data.ts +++ b/enterprise/frontend/src/embedding-sdk/components/private/InteractiveQuestion/components/Breakout/use-breakout-data.ts @@ -32,7 +32,7 @@ export const useBreakoutData = ({ const breakouts = query ? Lib.breakouts(query, stageIndex) : []; const items: BreakoutListItem[] = query - ? breakouts.map(breakout => + ? breakouts.map((breakout) => getBreakoutListItem(query, stageIndex, breakout), ) : []; diff --git a/enterprise/frontend/src/embedding-sdk/components/private/InteractiveQuestion/components/Editor.tsx b/enterprise/frontend/src/embedding-sdk/components/private/InteractiveQuestion/components/Editor.tsx index ea3b222069a..cf9653ddead 100644 --- a/enterprise/frontend/src/embedding-sdk/components/private/InteractiveQuestion/components/Editor.tsx +++ b/enterprise/frontend/src/embedding-sdk/components/private/InteractiveQuestion/components/Editor.tsx @@ -34,7 +34,7 @@ export const Editor = ({ onApply = () => {} }: EditorProps) => { return isQuestionRunnable(question, isDirty); }, [question, isDirty]); - const reportTimezone = useSelector(state => + const reportTimezone = useSelector((state) => getSetting(state, "report-timezone-long"), ); diff --git a/enterprise/frontend/src/embedding-sdk/components/private/InteractiveQuestion/components/Filter/FilterBadgeList.tsx b/enterprise/frontend/src/embedding-sdk/components/private/InteractiveQuestion/components/Filter/FilterBadgeList.tsx index 46aabfbc0c2..32e9d96db48 100644 --- a/enterprise/frontend/src/embedding-sdk/components/private/InteractiveQuestion/components/Filter/FilterBadgeList.tsx +++ b/enterprise/frontend/src/embedding-sdk/components/private/InteractiveQuestion/components/Filter/FilterBadgeList.tsx @@ -20,7 +20,7 @@ export const FilterBadgeList = ({ return ( ({ item, name: item.displayName }))} + items={filterItems.map((item) => ({ item, name: item.displayName }))} onAddItem={onAddItem} onSelectItem={onSelectItem} onRemoveItem={onRemoveItem} diff --git a/enterprise/frontend/src/embedding-sdk/components/private/InteractiveQuestion/components/Filter/FilterDropdown/FilterDropdown.tsx b/enterprise/frontend/src/embedding-sdk/components/private/InteractiveQuestion/components/Filter/FilterDropdown/FilterDropdown.tsx index f50c0e88790..c7e14266c4c 100644 --- a/enterprise/frontend/src/embedding-sdk/components/private/InteractiveQuestion/components/Filter/FilterDropdown/FilterDropdown.tsx +++ b/enterprise/frontend/src/embedding-sdk/components/private/InteractiveQuestion/components/Filter/FilterDropdown/FilterDropdown.tsx @@ -43,7 +43,7 @@ const FilterDropdownInner = ({ .with(0, () => t`Filter`) .with(1, () => t`1 filter`) .otherwise( - value => + (value) => c("{0} refers to a number greater than 1 (i.e. 2 filters, 10 filters)") .t`${value} filters`, ); diff --git a/enterprise/frontend/src/embedding-sdk/components/private/InteractiveQuestion/components/Filter/FilterPicker/FilterPicker.tsx b/enterprise/frontend/src/embedding-sdk/components/private/InteractiveQuestion/components/Filter/FilterPicker/FilterPicker.tsx index 83f77e59249..161e9558e89 100644 --- a/enterprise/frontend/src/embedding-sdk/components/private/InteractiveQuestion/components/Filter/FilterPicker/FilterPicker.tsx +++ b/enterprise/frontend/src/embedding-sdk/components/private/InteractiveQuestion/components/Filter/FilterPicker/FilterPicker.tsx @@ -38,7 +38,7 @@ const FilterPickerInner = ({ stageIndex={stageIndex} onClose={onClose} onBack={onBack} - onSelect={filter => + onSelect={(filter) => filterItem ? filterItem?.onUpdateFilter(filter) : onAddFilter(filter) } filter={filterItem?.filter} diff --git a/enterprise/frontend/src/embedding-sdk/components/private/InteractiveQuestion/components/Filter/hooks/use-filter-data.ts b/enterprise/frontend/src/embedding-sdk/components/private/InteractiveQuestion/components/Filter/hooks/use-filter-data.ts index ad8f4c85814..7c4bf9371e3 100644 --- a/enterprise/frontend/src/embedding-sdk/components/private/InteractiveQuestion/components/Filter/hooks/use-filter-data.ts +++ b/enterprise/frontend/src/embedding-sdk/components/private/InteractiveQuestion/components/Filter/hooks/use-filter-data.ts @@ -41,7 +41,7 @@ export const useFilterData = (): SDKFilterItem[] => { const filters = useMemo( () => query - ? getFilterItems(query).map(filterItem => ({ + ? getFilterItems(query).map((filterItem) => ({ ...filterItem, ...Lib.displayInfo(query, filterItem.stageIndex, filterItem.filter), })) diff --git a/enterprise/frontend/src/embedding-sdk/components/private/InteractiveQuestion/components/QuestionSettings/QuestionSettings.tsx b/enterprise/frontend/src/embedding-sdk/components/private/InteractiveQuestion/components/QuestionSettings/QuestionSettings.tsx index 836b2b49b4b..ddd4c3700da 100644 --- a/enterprise/frontend/src/embedding-sdk/components/private/InteractiveQuestion/components/QuestionSettings/QuestionSettings.tsx +++ b/enterprise/frontend/src/embedding-sdk/components/private/InteractiveQuestion/components/QuestionSettings/QuestionSettings.tsx @@ -48,7 +48,7 @@ const QuestionSettingsContent = ({ transformedSeries, handleChangeSettings, false, - ).filter(w => !!w.widget); + ).filter((w) => !!w.widget); } catch (e) { return []; } diff --git a/enterprise/frontend/src/embedding-sdk/components/private/InteractiveQuestion/components/Summarize/SummarizeBadgeList.tsx b/enterprise/frontend/src/embedding-sdk/components/private/InteractiveQuestion/components/Summarize/SummarizeBadgeList.tsx index b4981d06c5b..775b834c318 100644 --- a/enterprise/frontend/src/embedding-sdk/components/private/InteractiveQuestion/components/Summarize/SummarizeBadgeList.tsx +++ b/enterprise/frontend/src/embedding-sdk/components/private/InteractiveQuestion/components/Summarize/SummarizeBadgeList.tsx @@ -19,7 +19,7 @@ export const SummarizeBadgeList = ({ return ( ({ item, name: item.displayName }))} + items={aggregationItems.map((item) => ({ item, name: item.displayName }))} addButtonLabel={t`Add another summary`} onSelectItem={onSelectItem} onAddItem={onAddItem} diff --git a/enterprise/frontend/src/embedding-sdk/components/private/InteractiveQuestion/components/Summarize/SummarizeDropdown/SummarizeDropdown.tsx b/enterprise/frontend/src/embedding-sdk/components/private/InteractiveQuestion/components/Summarize/SummarizeDropdown/SummarizeDropdown.tsx index 9761b459898..729b02a41fe 100644 --- a/enterprise/frontend/src/embedding-sdk/components/private/InteractiveQuestion/components/Summarize/SummarizeDropdown/SummarizeDropdown.tsx +++ b/enterprise/frontend/src/embedding-sdk/components/private/InteractiveQuestion/components/Summarize/SummarizeDropdown/SummarizeDropdown.tsx @@ -24,7 +24,7 @@ export const SummarizeDropdown = ( const label = match(aggregationItems.length) .with(0, () => t`Summarize`) .with(1, () => t`1 summary`) - .otherwise(value => jt`${value} summaries`); + .otherwise((value) => jt`${value} summaries`); const [selectedAggregationItem, setSelectedAggregationItem] = useState(); diff --git a/enterprise/frontend/src/embedding-sdk/components/private/InteractiveQuestion/components/Summarize/SummarizePicker/SummarizePicker.tsx b/enterprise/frontend/src/embedding-sdk/components/private/InteractiveQuestion/components/Summarize/SummarizePicker/SummarizePicker.tsx index 816d46a320b..6943dfd8b38 100644 --- a/enterprise/frontend/src/embedding-sdk/components/private/InteractiveQuestion/components/Summarize/SummarizePicker/SummarizePicker.tsx +++ b/enterprise/frontend/src/embedding-sdk/components/private/InteractiveQuestion/components/Summarize/SummarizePicker/SummarizePicker.tsx @@ -60,7 +60,7 @@ export const SummarizeBadgeList = ({ return ( ({ item, name: item.displayName }))} + items={aggregationItems.map((item) => ({ item, name: item.displayName }))} addButtonLabel="Add grouping" onSelectItem={onSelectItem} onAddItem={onAddItem} diff --git a/enterprise/frontend/src/embedding-sdk/components/private/InteractiveQuestion/components/Summarize/use-summarize-data.ts b/enterprise/frontend/src/embedding-sdk/components/private/InteractiveQuestion/components/Summarize/use-summarize-data.ts index 86b4f76bd24..4c57bcc79aa 100644 --- a/enterprise/frontend/src/embedding-sdk/components/private/InteractiveQuestion/components/Summarize/use-summarize-data.ts +++ b/enterprise/frontend/src/embedding-sdk/components/private/InteractiveQuestion/components/Summarize/use-summarize-data.ts @@ -31,7 +31,7 @@ export const useSummarizeData = () => { const aggregationItems: SDKAggregationItem[] = useMemo( () => query - ? getAggregationItems({ query, stageIndex }).map(aggregationItem => { + ? getAggregationItems({ query, stageIndex }).map((aggregationItem) => { const onRemoveAggregation = () => { if (query) { const nextQuery = Lib.removeClause( diff --git a/enterprise/frontend/src/embedding-sdk/components/private/InteractiveQuestion/components/util/BadgeList/BadgeList.stories.tsx b/enterprise/frontend/src/embedding-sdk/components/private/InteractiveQuestion/components/util/BadgeList/BadgeList.stories.tsx index effba8ec542..90f1092fc58 100644 --- a/enterprise/frontend/src/embedding-sdk/components/private/InteractiveQuestion/components/util/BadgeList/BadgeList.stories.tsx +++ b/enterprise/frontend/src/embedding-sdk/components/private/InteractiveQuestion/components/util/BadgeList/BadgeList.stories.tsx @@ -15,7 +15,7 @@ export default { export const DefaultLayoutBadgeList = { render() { const [items, setItems] = useState( - Array.from(Array(5).keys()).map(i => ({ + Array.from(Array(5).keys()).map((i) => ({ name: `item ${i}`, item: i, })), @@ -35,14 +35,14 @@ export const DefaultLayoutBadgeList = { }; const onAddItem = () => - setItems(nextItems => [ + setItems((nextItems) => [ ...nextItems, { name: `item ${nextItems.length}`, item: nextItems.length }, ]); const onRemoveItem = (_item?: number, index?: number) => { if (typeof index === "number") { - setItems(nextItems => [ + setItems((nextItems) => [ ...nextItems.slice(0, index), ...nextItems.slice(index + 1), ]); diff --git a/enterprise/frontend/src/embedding-sdk/components/private/InteractiveQuestion/components/util/BadgeList/BadgeListItem/BadgeListItem.tsx b/enterprise/frontend/src/embedding-sdk/components/private/InteractiveQuestion/components/util/BadgeList/BadgeListItem/BadgeListItem.tsx index 71721ff8f3a..1661732d8d5 100644 --- a/enterprise/frontend/src/embedding-sdk/components/private/InteractiveQuestion/components/util/BadgeList/BadgeListItem/BadgeListItem.tsx +++ b/enterprise/frontend/src/embedding-sdk/components/private/InteractiveQuestion/components/util/BadgeList/BadgeListItem/BadgeListItem.tsx @@ -32,7 +32,7 @@ const _BadgeListItem = ( radius="xl" size="sm" ml={0} - onClick={e => { + onClick={(e) => { e.stopPropagation(); onRemoveItem?.(); }} diff --git a/enterprise/frontend/src/embedding-sdk/components/private/InteractiveQuestion/context/InteractiveQuestionProvider.tsx b/enterprise/frontend/src/embedding-sdk/components/private/InteractiveQuestion/context/InteractiveQuestionProvider.tsx index b21777729de..93e21b3702a 100644 --- a/enterprise/frontend/src/embedding-sdk/components/private/InteractiveQuestion/context/InteractiveQuestionProvider.tsx +++ b/enterprise/frontend/src/embedding-sdk/components/private/InteractiveQuestion/context/InteractiveQuestionProvider.tsx @@ -41,7 +41,7 @@ const FILTER_MODEL_MAP: Record = const mapEntityTypeFilterToDataPickerModels = ( entityTypeFilter: InteractiveQuestionProviderProps["entityTypeFilter"], ): InteractiveQuestionContextType["modelsFilterList"] => { - return entityTypeFilter?.map(entityType => FILTER_MODEL_MAP[entityType]); + return entityTypeFilter?.map((entityType) => FILTER_MODEL_MAP[entityType]); }; export const InteractiveQuestionProvider = ({ diff --git a/enterprise/frontend/src/embedding-sdk/components/private/InteractiveQuestionDefaultView/InteractiveQuestionDefaultView.tsx b/enterprise/frontend/src/embedding-sdk/components/private/InteractiveQuestionDefaultView/InteractiveQuestionDefaultView.tsx index 6e3062f8e1f..0e9ffee09bf 100644 --- a/enterprise/frontend/src/embedding-sdk/components/private/InteractiveQuestionDefaultView/InteractiveQuestionDefaultView.tsx +++ b/enterprise/frontend/src/embedding-sdk/components/private/InteractiveQuestionDefaultView/InteractiveQuestionDefaultView.tsx @@ -211,7 +211,7 @@ const DefaultViewSaveModal = ({ closeOnSuccess onClose={close} onCreate={onCreate} - onSave={async question => { + onSave={async (question) => { await onSave(question); close(); }} diff --git a/enterprise/frontend/src/embedding-sdk/components/private/PublicComponentWrapper/withPublicComponentWrapper.tsx b/enterprise/frontend/src/embedding-sdk/components/private/PublicComponentWrapper/withPublicComponentWrapper.tsx index 962499f4396..4668885fb39 100644 --- a/enterprise/frontend/src/embedding-sdk/components/private/PublicComponentWrapper/withPublicComponentWrapper.tsx +++ b/enterprise/frontend/src/embedding-sdk/components/private/PublicComponentWrapper/withPublicComponentWrapper.tsx @@ -5,7 +5,7 @@ import { PublicComponentWrapper } from "./PublicComponentWrapper"; export function withPublicComponentWrapper

( WrappedComponent: React.ComponentType

, ): React.FC

{ - const WithPublicComponentWrapper: React.FC

= props => { + const WithPublicComponentWrapper: React.FC

= (props) => { return ( diff --git a/enterprise/frontend/src/embedding-sdk/components/private/SdkGlobalFontsStyles.tsx b/enterprise/frontend/src/embedding-sdk/components/private/SdkGlobalFontsStyles.tsx index 68e8d145c77..74549308d0c 100644 --- a/enterprise/frontend/src/embedding-sdk/components/private/SdkGlobalFontsStyles.tsx +++ b/enterprise/frontend/src/embedding-sdk/components/private/SdkGlobalFontsStyles.tsx @@ -18,7 +18,7 @@ export const SdkFontsGlobalStyles = ({ baseUrl }: { baseUrl: string }) => { // custom fonts ${fontFiles?.map( - file => css` + (file) => css` @font-face { font-family: "Custom"; src: url(${encodeURI(file.src)}) format("${file.fontFormat}"); diff --git a/enterprise/frontend/src/embedding-sdk/components/private/SdkThemeProvider.tsx b/enterprise/frontend/src/embedding-sdk/components/private/SdkThemeProvider.tsx index 05e5cf5b12b..a99aab3ee05 100644 --- a/enterprise/frontend/src/embedding-sdk/components/private/SdkThemeProvider.tsx +++ b/enterprise/frontend/src/embedding-sdk/components/private/SdkThemeProvider.tsx @@ -19,7 +19,7 @@ interface Props { export const SdkThemeProvider = ({ theme, children }: Props) => { const font = useSelector(getFont); - const appColors = useSelector(state => + const appColors = useSelector((state) => getApplicationColors(getSettings(state)), ); diff --git a/enterprise/frontend/src/embedding-sdk/components/private/SdkUsageProblem/SdkUsageProblemBanner.stories.tsx b/enterprise/frontend/src/embedding-sdk/components/private/SdkUsageProblem/SdkUsageProblemBanner.stories.tsx index 1762490a724..409f6b4e39f 100644 --- a/enterprise/frontend/src/embedding-sdk/components/private/SdkUsageProblem/SdkUsageProblemBanner.stories.tsx +++ b/enterprise/frontend/src/embedding-sdk/components/private/SdkUsageProblem/SdkUsageProblemBanner.stories.tsx @@ -14,7 +14,7 @@ export default { decorators: [CommonSdkStoryWrapper], }; -const Template: StoryFn = args => { +const Template: StoryFn = (args) => { return ( diff --git a/enterprise/frontend/src/embedding-sdk/components/private/SimpleDataPicker/SimpleDataPicker.stories.tsx b/enterprise/frontend/src/embedding-sdk/components/private/SimpleDataPicker/SimpleDataPicker.stories.tsx index b1bb7536013..ecb8ccb8d37 100644 --- a/enterprise/frontend/src/embedding-sdk/components/private/SimpleDataPicker/SimpleDataPicker.stories.tsx +++ b/enterprise/frontend/src/embedding-sdk/components/private/SimpleDataPicker/SimpleDataPicker.stories.tsx @@ -73,7 +73,7 @@ const meta: Meta = { onClick: action("on-click"), options: SHORT_OPTIONS, }, - render: args => { + render: (args) => { return ( @@ -90,7 +90,7 @@ export default meta; type Story = StoryObj; export const WithoutPopover: Story = { - render: args => , + render: (args) => , }; export const NoOptions: Story = { diff --git a/enterprise/frontend/src/embedding-sdk/components/private/SimpleDataPicker/SimpleDataPicker.tsx b/enterprise/frontend/src/embedding-sdk/components/private/SimpleDataPicker/SimpleDataPicker.tsx index 8182ad47137..8aa4f486a31 100644 --- a/enterprise/frontend/src/embedding-sdk/components/private/SimpleDataPicker/SimpleDataPicker.tsx +++ b/enterprise/frontend/src/embedding-sdk/components/private/SimpleDataPicker/SimpleDataPicker.tsx @@ -33,7 +33,7 @@ export function SimpleDataPicker({ } return sortEntities( - data.data.map(entity => { + data.data.map((entity) => { return { ...entity, id: @@ -50,7 +50,7 @@ export function SimpleDataPicker({ { + onChange={(isOpen) => { if (!isOpen) { close(); } @@ -64,7 +64,7 @@ export function SimpleDataPicker({ { + onClick={(tableId) => { close(); setSourceTableFn(tableId); }} diff --git a/enterprise/frontend/src/embedding-sdk/components/private/SimpleDataPicker/SimpleDataPickerView.tsx b/enterprise/frontend/src/embedding-sdk/components/private/SimpleDataPicker/SimpleDataPickerView.tsx index 7395f416252..fc458289551 100644 --- a/enterprise/frontend/src/embedding-sdk/components/private/SimpleDataPicker/SimpleDataPickerView.tsx +++ b/enterprise/frontend/src/embedding-sdk/components/private/SimpleDataPicker/SimpleDataPickerView.tsx @@ -55,7 +55,7 @@ export function SimpleDataPickerView({ leftSection={} mb="sm" placeholder={t`Search…`} - onChange={e => setSearchText(e.target.value ?? "")} + onChange={(e) => setSearchText(e.target.value ?? "")} /> ) : ( /** @@ -69,7 +69,7 @@ export function SimpleDataPickerView({ {displayOptions.length >= 1 ? ( - {displayOptions.map(option => { + {displayOptions.map((option) => { const isSelected = selectedEntity === option.id; const iconColor = isSelected ? "--mb-color-text-white" diff --git a/enterprise/frontend/src/embedding-sdk/components/public/CollectionBrowser/CollectionBrowser.stories.tsx b/enterprise/frontend/src/embedding-sdk/components/public/CollectionBrowser/CollectionBrowser.stories.tsx index 837970ab591..0b76ab35d7a 100644 --- a/enterprise/frontend/src/embedding-sdk/components/public/CollectionBrowser/CollectionBrowser.stories.tsx +++ b/enterprise/frontend/src/embedding-sdk/components/public/CollectionBrowser/CollectionBrowser.stories.tsx @@ -14,7 +14,7 @@ export default { decorators: [CommonSdkStoryWrapper], }; -const Template: StoryFn> = args => { +const Template: StoryFn> = (args) => { return ; }; diff --git a/enterprise/frontend/src/embedding-sdk/components/public/CollectionBrowser/CollectionBrowser.tsx b/enterprise/frontend/src/embedding-sdk/components/public/CollectionBrowser/CollectionBrowser.tsx index 59af7b9213f..a22cadf7889 100644 --- a/enterprise/frontend/src/embedding-sdk/components/public/CollectionBrowser/CollectionBrowser.tsx +++ b/enterprise/frontend/src/embedding-sdk/components/public/CollectionBrowser/CollectionBrowser.tsx @@ -80,7 +80,7 @@ export const CollectionBrowserInner = ({ }: Omit & { collectionId: CollectionId; }) => { - const baseCollectionId = useSdkSelector(state => + const baseCollectionId = useSdkSelector((state) => getCollectionIdSlugFromReference(state, collectionId), ); @@ -106,7 +106,7 @@ export const CollectionBrowserInner = ({ }; const collectionTypes = visibleEntityTypes - .map(entityType => ENTITY_NAME_MAP[entityType]) + .map((entityType) => ENTITY_NAME_MAP[entityType]) .filter(isNotNull); return ( diff --git a/enterprise/frontend/src/embedding-sdk/components/public/CollectionBrowser/CollectionBrowser.unit.spec.tsx b/enterprise/frontend/src/embedding-sdk/components/public/CollectionBrowser/CollectionBrowser.unit.spec.tsx index 210cc6995d3..355e400c1f4 100644 --- a/enterprise/frontend/src/embedding-sdk/components/public/CollectionBrowser/CollectionBrowser.unit.spec.tsx +++ b/enterprise/frontend/src/embedding-sdk/components/public/CollectionBrowser/CollectionBrowser.unit.spec.tsx @@ -63,7 +63,7 @@ describe("CollectionBrowser", () => { within(screen.getByTestId("items-table-head")) .getAllByRole("button") - .forEach(el => { + .forEach((el) => { columnNames.push(el.textContent); }); diff --git a/enterprise/frontend/src/embedding-sdk/components/public/CreateDashboardModal/CreateDashboardModal.stories.tsx b/enterprise/frontend/src/embedding-sdk/components/public/CreateDashboardModal/CreateDashboardModal.stories.tsx index e8d857515e2..3f442fb681a 100644 --- a/enterprise/frontend/src/embedding-sdk/components/public/CreateDashboardModal/CreateDashboardModal.stories.tsx +++ b/enterprise/frontend/src/embedding-sdk/components/public/CreateDashboardModal/CreateDashboardModal.stories.tsx @@ -23,9 +23,9 @@ export default { decorators: [CommonSdkStoryWrapper], }; -const Template: StoryFn> = args => ( - -); +const Template: StoryFn> = ( + args, +) => ; export const Default = { render: Template, diff --git a/enterprise/frontend/src/embedding-sdk/components/public/CreateQuestion/CreateQuestion.stories.tsx b/enterprise/frontend/src/embedding-sdk/components/public/CreateQuestion/CreateQuestion.stories.tsx index 44b944f8427..7ff480c6954 100644 --- a/enterprise/frontend/src/embedding-sdk/components/public/CreateQuestion/CreateQuestion.stories.tsx +++ b/enterprise/frontend/src/embedding-sdk/components/public/CreateQuestion/CreateQuestion.stories.tsx @@ -17,7 +17,7 @@ export default { decorators: [CommonSdkStoryWrapper], }; -const Template: StoryFn = args => { +const Template: StoryFn = (args) => { return ( diff --git a/enterprise/frontend/src/embedding-sdk/components/public/InteractiveDashboard/EditableDashboard.unit.spec.tsx b/enterprise/frontend/src/embedding-sdk/components/public/InteractiveDashboard/EditableDashboard.unit.spec.tsx index 9e77917c656..4535c7e5772 100644 --- a/enterprise/frontend/src/embedding-sdk/components/public/InteractiveDashboard/EditableDashboard.unit.spec.tsx +++ b/enterprise/frontend/src/embedding-sdk/components/public/InteractiveDashboard/EditableDashboard.unit.spec.tsx @@ -123,7 +123,7 @@ const setup = async ({ dashboards: { [dashboard.id]: { ...dashboard, - dashcards: dashcards.map(dc => dc.id), + dashcards: dashcards.map((dc) => dc.id), }, }, dashcards: indexBy(dashcards, "id"), diff --git a/enterprise/frontend/src/embedding-sdk/components/public/InteractiveDashboard/InteractiveDashboard.stories.tsx b/enterprise/frontend/src/embedding-sdk/components/public/InteractiveDashboard/InteractiveDashboard.stories.tsx index 1f717982d08..ce117a29d9f 100644 --- a/enterprise/frontend/src/embedding-sdk/components/public/InteractiveDashboard/InteractiveDashboard.stories.tsx +++ b/enterprise/frontend/src/embedding-sdk/components/public/InteractiveDashboard/InteractiveDashboard.stories.tsx @@ -27,7 +27,7 @@ export default { }, }; -const Template: StoryFn = args => { +const Template: StoryFn = (args) => { return ; }; diff --git a/enterprise/frontend/src/embedding-sdk/components/public/InteractiveDashboard/InteractiveDashboard.unit.spec.tsx b/enterprise/frontend/src/embedding-sdk/components/public/InteractiveDashboard/InteractiveDashboard.unit.spec.tsx index e3235386776..bf8f1a8b620 100644 --- a/enterprise/frontend/src/embedding-sdk/components/public/InteractiveDashboard/InteractiveDashboard.unit.spec.tsx +++ b/enterprise/frontend/src/embedding-sdk/components/public/InteractiveDashboard/InteractiveDashboard.unit.spec.tsx @@ -112,7 +112,7 @@ const setup = async ({ dashboards: { [dashboard.id]: { ...dashboard, - dashcards: dashcards.map(dc => dc.id), + dashcards: dashcards.map((dc) => dc.id), }, }, dashcards: indexBy(dashcards, "id"), diff --git a/enterprise/frontend/src/embedding-sdk/components/public/InteractiveQuestion/InteractiveQuestion-multiple-questions.unit.spec.tsx b/enterprise/frontend/src/embedding-sdk/components/public/InteractiveQuestion/InteractiveQuestion-multiple-questions.unit.spec.tsx index 594c53e3e96..094604dbce8 100644 --- a/enterprise/frontend/src/embedding-sdk/components/public/InteractiveQuestion/InteractiveQuestion-multiple-questions.unit.spec.tsx +++ b/enterprise/frontend/src/embedding-sdk/components/public/InteractiveQuestion/InteractiveQuestion-multiple-questions.unit.spec.tsx @@ -78,7 +78,7 @@ const setup = ({ const children = (

- {mocks.map(mock => ( + {mocks.map((mock) => ( ))}
diff --git a/enterprise/frontend/src/embedding-sdk/components/public/InteractiveQuestion/InteractiveQuestion.stories.tsx b/enterprise/frontend/src/embedding-sdk/components/public/InteractiveQuestion/InteractiveQuestion.stories.tsx index 482cbf594d6..049710de047 100644 --- a/enterprise/frontend/src/embedding-sdk/components/public/InteractiveQuestion/InteractiveQuestion.stories.tsx +++ b/enterprise/frontend/src/embedding-sdk/components/public/InteractiveQuestion/InteractiveQuestion.stories.tsx @@ -38,7 +38,7 @@ export default { }, }; -const Template: StoryFn = args => { +const Template: StoryFn = (args) => { return ( diff --git a/enterprise/frontend/src/embedding-sdk/components/public/StaticDashboard/CypressStaticDashboardWithCors.stories.tsx b/enterprise/frontend/src/embedding-sdk/components/public/StaticDashboard/CypressStaticDashboardWithCors.stories.tsx index 05a4b6fd0b1..330866ee735 100644 --- a/enterprise/frontend/src/embedding-sdk/components/public/StaticDashboard/CypressStaticDashboardWithCors.stories.tsx +++ b/enterprise/frontend/src/embedding-sdk/components/public/StaticDashboard/CypressStaticDashboardWithCors.stories.tsx @@ -14,7 +14,7 @@ export default { decorators: [CommonSdkStoryCorsWrapper], }; -const Template: StoryFn = args => { +const Template: StoryFn = (args) => { return ; }; diff --git a/enterprise/frontend/src/embedding-sdk/components/public/StaticDashboard/StaticDashboard.stories.tsx b/enterprise/frontend/src/embedding-sdk/components/public/StaticDashboard/StaticDashboard.stories.tsx index 23dfaa06c25..3693bd1ad3a 100644 --- a/enterprise/frontend/src/embedding-sdk/components/public/StaticDashboard/StaticDashboard.stories.tsx +++ b/enterprise/frontend/src/embedding-sdk/components/public/StaticDashboard/StaticDashboard.stories.tsx @@ -23,7 +23,7 @@ export default { }, }; -const Template: StoryFn = args => { +const Template: StoryFn = (args) => { return ; }; diff --git a/enterprise/frontend/src/embedding-sdk/components/public/StaticDashboard/StaticDashboard.unit.spec.tsx b/enterprise/frontend/src/embedding-sdk/components/public/StaticDashboard/StaticDashboard.unit.spec.tsx index ec4c894d897..569ddac4614 100644 --- a/enterprise/frontend/src/embedding-sdk/components/public/StaticDashboard/StaticDashboard.unit.spec.tsx +++ b/enterprise/frontend/src/embedding-sdk/components/public/StaticDashboard/StaticDashboard.unit.spec.tsx @@ -85,7 +85,7 @@ const setup = async (options: SetupOptions = {}) => { dashboards: { [dashboard.id]: { ...dashboard, - dashcards: dashcards.map(dc => dc.id), + dashcards: dashcards.map((dc) => dc.id), }, }, dashcards: indexBy(dashcards, "id"), diff --git a/enterprise/frontend/src/embedding-sdk/components/public/StaticQuestion/StaticQuestion.stories.tsx b/enterprise/frontend/src/embedding-sdk/components/public/StaticQuestion/StaticQuestion.stories.tsx index 8fde72b7a7e..1e3d2d85401 100644 --- a/enterprise/frontend/src/embedding-sdk/components/public/StaticQuestion/StaticQuestion.stories.tsx +++ b/enterprise/frontend/src/embedding-sdk/components/public/StaticQuestion/StaticQuestion.stories.tsx @@ -25,7 +25,7 @@ export default { }, }; -const Template: StoryFn = args => { +const Template: StoryFn = (args) => { return ; }; diff --git a/enterprise/frontend/src/embedding-sdk/hooks/private/use-load-question.ts b/enterprise/frontend/src/embedding-sdk/hooks/private/use-load-question.ts index 6fec1034f72..6eba9e5f455 100644 --- a/enterprise/frontend/src/embedding-sdk/hooks/private/use-load-question.ts +++ b/enterprise/frontend/src/embedding-sdk/hooks/private/use-load-question.ts @@ -140,7 +140,7 @@ export function useLoadQuestion({ previousQuestion: question, originalQuestion, cancelDeferred: deferred(), - optimisticUpdateQuestion: question => + optimisticUpdateQuestion: (question) => mergeQuestionState({ question }), shouldRunQueryOnQuestionChange: run, }), @@ -158,7 +158,7 @@ export function useLoadQuestion({ ...params, originalQuestion, cancelDeferred: deferred(), - onQuestionChange: question => mergeQuestionState({ question }), + onQuestionChange: (question) => mergeQuestionState({ question }), onClearQueryResults: () => mergeQuestionState({ queryResults: [null] }), }), diff --git a/enterprise/frontend/src/embedding-sdk/hooks/private/use-sdk-usage-problem.ts b/enterprise/frontend/src/embedding-sdk/hooks/private/use-sdk-usage-problem.ts index 5fd71bb5713..5e73cce087f 100644 --- a/enterprise/frontend/src/embedding-sdk/hooks/private/use-sdk-usage-problem.ts +++ b/enterprise/frontend/src/embedding-sdk/hooks/private/use-sdk-usage-problem.ts @@ -24,7 +24,7 @@ export function useSdkUsageProblem({ // their customer would see an alarming error message on production. const isEnabled = useSetting("enable-embedding-sdk") ?? true; - const hasTokenFeature = useSdkSelector(state => { + const hasTokenFeature = useSdkSelector((state) => { // We also assume that the feature is enabled if the token-features are missing. // Same reason as above. if (!state.settings.values?.["token-features"]) { diff --git a/enterprise/frontend/src/embedding-sdk/hooks/public/use-available-fonts.ts b/enterprise/frontend/src/embedding-sdk/hooks/public/use-available-fonts.ts index fd54ad0d77b..88323a56204 100644 --- a/enterprise/frontend/src/embedding-sdk/hooks/public/use-available-fonts.ts +++ b/enterprise/frontend/src/embedding-sdk/hooks/public/use-available-fonts.ts @@ -3,6 +3,8 @@ import { getSetting } from "metabase/selectors/settings"; export const useAvailableFonts = () => { return { - availableFonts: useSelector(state => getSetting(state, "available-fonts")), + availableFonts: useSelector((state) => + getSetting(state, "available-fonts"), + ), }; }; diff --git a/enterprise/frontend/src/embedding-sdk/lib/load-static-question.ts b/enterprise/frontend/src/embedding-sdk/lib/load-static-question.ts index 22051c5a63c..3f1de5124f3 100644 --- a/enterprise/frontend/src/embedding-sdk/lib/load-static-question.ts +++ b/enterprise/frontend/src/embedding-sdk/lib/load-static-question.ts @@ -27,8 +27,8 @@ export async function loadStaticQuestion(options: Options) { if (sqlParameters && card?.parameters) { const parameters: ParameterQueryInput[] = card.parameters - .filter(parameter => parameter.target) - .map(parameter => ({ + .filter((parameter) => parameter.target) + .map((parameter) => ({ id: parameter.id, type: parameter.type, target: parameter.target!, diff --git a/enterprise/frontend/src/embedding-sdk/lib/theme/get-embedding-theme.ts b/enterprise/frontend/src/embedding-sdk/lib/theme/get-embedding-theme.ts index 78a6696d296..311ac694ab1 100644 --- a/enterprise/frontend/src/embedding-sdk/lib/theme/get-embedding-theme.ts +++ b/enterprise/frontend/src/embedding-sdk/lib/theme/get-embedding-theme.ts @@ -23,7 +23,7 @@ const SDK_BASE_FONT_SIZE = `${DEFAULT_SDK_FONT_SIZE}px`; // Strip any key that has the value of "undefined" const stripUndefinedKeys = (x: T): unknown => _.isObject(x) - ? _.pick(_.mapObject(x, stripUndefinedKeys), v => !_.isUndefined(v)) + ? _.pick(_.mapObject(x, stripUndefinedKeys), (v) => !_.isUndefined(v)) : x; /** diff --git a/enterprise/frontend/src/embedding-sdk/store/auth.ts b/enterprise/frontend/src/embedding-sdk/store/auth.ts index e84d13f485d..de335dc9e20 100644 --- a/enterprise/frontend/src/embedding-sdk/store/auth.ts +++ b/enterprise/frontend/src/embedding-sdk/store/auth.ts @@ -156,27 +156,28 @@ const safeStringify = (value: unknown) => { * The default implementation of the function to get the refresh token. * Only supports sessions by default. */ -export const defaultGetRefreshTokenFn: MetabaseFetchRequestTokenFn = - async url => { - const response = await fetch(url, { - method: "GET", - credentials: "include", - }); +export const defaultGetRefreshTokenFn: MetabaseFetchRequestTokenFn = async ( + url, +) => { + const response = await fetch(url, { + method: "GET", + credentials: "include", + }); - if (!response.ok) { - throw new Error( - `Failed to fetch the session, HTTP status: ${response.status}`, - ); - } + if (!response.ok) { + throw new Error( + `Failed to fetch the session, HTTP status: ${response.status}`, + ); + } - const asText = await response.text(); + const asText = await response.text(); - try { - return JSON.parse(asText); - } catch (ex) { - return asText; - } - }; + try { + return JSON.parse(asText); + } catch (ex) { + return asText; + } +}; const sessionSchema = Yup.object({ id: Yup.string().required(), diff --git a/enterprise/frontend/src/embedding-sdk/store/reducer.ts b/enterprise/frontend/src/embedding-sdk/store/reducer.ts index d7eb8e40017..9d0c1d6f842 100644 --- a/enterprise/frontend/src/embedding-sdk/store/reducer.ts +++ b/enterprise/frontend/src/embedding-sdk/store/reducer.ts @@ -80,8 +80,8 @@ const initialState: SdkState = { fetchRefreshTokenFn: null, }; -export const sdk = createReducer(initialState, builder => { - builder.addCase(refreshTokenAsync.pending, state => { +export const sdk = createReducer(initialState, (builder) => { + builder.addCase(refreshTokenAsync.pending, (state) => { state.token = { ...state.token, loading: true }; }); @@ -98,11 +98,11 @@ export const sdk = createReducer(initialState, builder => { state.loginStatus = { status: "error", error }; }); - builder.addCase(initAuth.pending, state => { + builder.addCase(initAuth.pending, (state) => { state.loginStatus = { status: "loading" }; }); - builder.addCase(initAuth.fulfilled, state => { + builder.addCase(initAuth.fulfilled, (state) => { state.loginStatus = { status: "success" }; }); diff --git a/enterprise/frontend/src/embedding-sdk/store/use-sdk-selector.unit.spec.ts b/enterprise/frontend/src/embedding-sdk/store/use-sdk-selector.unit.spec.ts index dd451016569..ee1962a002b 100644 --- a/enterprise/frontend/src/embedding-sdk/store/use-sdk-selector.unit.spec.ts +++ b/enterprise/frontend/src/embedding-sdk/store/use-sdk-selector.unit.spec.ts @@ -8,7 +8,7 @@ import { describe("useSdkSelector", () => { it("should throw an error if used outside of the MetabaseProvider", () => { expect(() => { - renderHook(() => useSdkSelector(s => s.sdk.token)); + renderHook(() => useSdkSelector((s) => s.sdk.token)); }).toThrow(Error(USE_OUTSIDE_OF_CONTEXT_MESSAGE)); }); }); diff --git a/enterprise/frontend/src/embedding-sdk/test/sdk-compatibility-warning.unit.spec.tsx b/enterprise/frontend/src/embedding-sdk/test/sdk-compatibility-warning.unit.spec.tsx index 9d7f259faba..237fea3228f 100644 --- a/enterprise/frontend/src/embedding-sdk/test/sdk-compatibility-warning.unit.spec.tsx +++ b/enterprise/frontend/src/embedding-sdk/test/sdk-compatibility-warning.unit.spec.tsx @@ -66,7 +66,7 @@ const setup = async ({ let consoleWarnSpy: jest.SpyInstance; const getWarnMessages = (): string[] => - consoleWarnSpy.mock.calls.map(callArguments => callArguments.join(" ")); + consoleWarnSpy.mock.calls.map((callArguments) => callArguments.join(" ")); describe("SDK auth errors", () => { beforeEach(() => { @@ -85,7 +85,7 @@ describe("SDK auth errors", () => { await setup({ sdkVersion: "0.52.10", mbVersion: "v1.55.0" }); expect( - getWarnMessages().filter(message => + getWarnMessages().filter((message) => message.includes( "SDK version 0.52.10 is not compatible with MB version v1.55.0, this might cause issues.", ), @@ -97,7 +97,7 @@ describe("SDK auth errors", () => { await setup({ sdkVersion: "0.55.10", mbVersion: "v1.55.1" }); expect( - getWarnMessages().filter(message => + getWarnMessages().filter((message) => message.includes("is not compatible"), ), ).toHaveLength(0); @@ -107,7 +107,7 @@ describe("SDK auth errors", () => { await setup({ sdkVersion: "unknown", mbVersion: "v1.55.1" }); expect( - getWarnMessages().filter(message => + getWarnMessages().filter((message) => message.includes("is not compatible"), ), ).toHaveLength(0); diff --git a/enterprise/frontend/src/embedding-sdk/test/sdk-config-errors.unit.spec.tsx b/enterprise/frontend/src/embedding-sdk/test/sdk-config-errors.unit.spec.tsx index a37b9a65f10..986ffb26908 100644 --- a/enterprise/frontend/src/embedding-sdk/test/sdk-config-errors.unit.spec.tsx +++ b/enterprise/frontend/src/embedding-sdk/test/sdk-config-errors.unit.spec.tsx @@ -52,8 +52,8 @@ let consoleErrorSpy: jest.SpyInstance; */ const expectErrorMessage = async (message: string) => { try { - const errors = consoleErrorSpy.mock.calls.map(call => call[2]); - const errorMessages = errors.map(error => + const errors = consoleErrorSpy.mock.calls.map((call) => call[2]); + const errorMessages = errors.map((error) => error instanceof Error ? error.message : error, ); expect(errorMessages).toContainEqual(expect.stringContaining(message)); diff --git a/enterprise/frontend/src/metabase-enterprise/advanced_permissions/components/ImpersonationModal/ImpersonationModalView.tsx b/enterprise/frontend/src/metabase-enterprise/advanced_permissions/components/ImpersonationModal/ImpersonationModalView.tsx index de7787028d8..894a9046ebd 100644 --- a/enterprise/frontend/src/metabase-enterprise/advanced_permissions/components/ImpersonationModal/ImpersonationModalView.tsx +++ b/enterprise/frontend/src/metabase-enterprise/advanced_permissions/components/ImpersonationModal/ImpersonationModalView.tsx @@ -55,7 +55,7 @@ export const ImpersonationModalView = ({ ? [selectedAttribute, ...attributes] : attributes; - return selectableAttributes.map(attribute => ({ + return selectableAttributes.map((attribute) => ({ name: attribute, value: attribute, })); diff --git a/enterprise/frontend/src/metabase-enterprise/advanced_permissions/graph.unit.spec.ts b/enterprise/frontend/src/metabase-enterprise/advanced_permissions/graph.unit.spec.ts index 46caf91b998..73043ddb9a7 100644 --- a/enterprise/frontend/src/metabase-enterprise/advanced_permissions/graph.unit.spec.ts +++ b/enterprise/frontend/src/metabase-enterprise/advanced_permissions/graph.unit.spec.ts @@ -48,7 +48,7 @@ describe("upgradeViewPermissionsIfNeeded", () => { createGraph({ [schema]: { [tableId]: DataPermissionValue.SANDBOXED } }), ])( "should upgrade data access permission if it is not fully granted except impersonated", - graph => { + (graph) => { const updatedGraph = upgradeViewPermissionsIfNeeded( graph, groupId, diff --git a/enterprise/frontend/src/metabase-enterprise/advanced_permissions/index.js b/enterprise/frontend/src/metabase-enterprise/advanced_permissions/index.js index 0a6aac53580..8b435e72702 100644 --- a/enterprise/frontend/src/metabase-enterprise/advanced_permissions/index.js +++ b/enterprise/frontend/src/metabase-enterprise/advanced_permissions/index.js @@ -85,10 +85,10 @@ if (hasPremiumFeature("advanced_permissions")) { />, ); - PLUGIN_ADVANCED_PERMISSIONS.isBlockPermission = value => + PLUGIN_ADVANCED_PERMISSIONS.isBlockPermission = (value) => value === BLOCK_PERMISSION_OPTION.value; - PLUGIN_ADVANCED_PERMISSIONS.getDatabaseLimitedAccessPermission = value => { + PLUGIN_ADVANCED_PERMISSIONS.getDatabaseLimitedAccessPermission = (value) => { if (value === IMPERSONATED_PERMISSION_OPTION.value) { return DataPermissionValue.UNRESTRICTED; } @@ -103,7 +103,7 @@ if (hasPremiumFeature("advanced_permissions")) { } }; - PLUGIN_ADVANCED_PERMISSIONS.isRestrictivePermission = value => { + PLUGIN_ADVANCED_PERMISSIONS.isRestrictivePermission = (value) => { return value === DataPermissionValue.BLOCKED; }; @@ -121,13 +121,13 @@ if (hasPremiumFeature("advanced_permissions")) { PLUGIN_DATA_PERMISSIONS.permissionsPayloadExtraSelectors.push( (state, data) => { const impersonations = getImpersonations(state); - const impersonationGroupIds = impersonations.map(i => `${i.group_id}`); + const impersonationGroupIds = impersonations.map((i) => `${i.group_id}`); return [{ impersonations }, impersonationGroupIds]; }, ); PLUGIN_DATA_PERMISSIONS.hasChanges.push( - state => getImpersonations(state).length > 0, + (state) => getImpersonations(state).length > 0, ); PLUGIN_ADMIN_PERMISSIONS_DATABASE_ACTIONS[ diff --git a/enterprise/frontend/src/metabase-enterprise/advanced_permissions/reducer.ts b/enterprise/frontend/src/metabase-enterprise/advanced_permissions/reducer.ts index 3f40a71f34d..81732f3ef9d 100644 --- a/enterprise/frontend/src/metabase-enterprise/advanced_permissions/reducer.ts +++ b/enterprise/frontend/src/metabase-enterprise/advanced_permissions/reducer.ts @@ -49,7 +49,7 @@ export const advancedPermissionsSlice = createSlice({ reducers: { updateImpersonation(state, { payload }: PayloadAction) { const impersonationIndex = state.impersonations.findIndex( - impersonation => + (impersonation) => impersonation.db_id === payload.db_id && impersonation.group_id === payload.group_id, ); @@ -61,7 +61,7 @@ export const advancedPermissionsSlice = createSlice({ } }, }, - extraReducers: builder => { + extraReducers: (builder) => { builder .addCase(LOAD_DATA_PERMISSIONS, () => initialState) .addCase(SAVE_DATA_PERMISSIONS, () => initialState) @@ -72,7 +72,7 @@ export const advancedPermissionsSlice = createSlice({ if (payload?.permissionInfo?.permission === DataPermission.VIEW_DATA) { state.impersonations = state.impersonations.filter( - impersonation => + (impersonation) => impersonation.group_id !== payload.groupId && impersonation.db_id !== payload.entityId.databaseId, ); diff --git a/enterprise/frontend/src/metabase-enterprise/advanced_permissions/selectors.ts b/enterprise/frontend/src/metabase-enterprise/advanced_permissions/selectors.ts index bb48e8ac501..2ab06802fb4 100644 --- a/enterprise/frontend/src/metabase-enterprise/advanced_permissions/selectors.ts +++ b/enterprise/frontend/src/metabase-enterprise/advanced_permissions/selectors.ts @@ -6,7 +6,7 @@ export const getImpersonation = (databaseId: DatabaseId, groupId: GroupId) => (state: AdvancedPermissionsStoreState) => state.plugins.advancedPermissionsPlugin.impersonations.find( - impersonation => + (impersonation) => impersonation.db_id === databaseId && impersonation.group_id === groupId, ); diff --git a/enterprise/frontend/src/metabase-enterprise/api/audit-info.ts b/enterprise/frontend/src/metabase-enterprise/api/audit-info.ts index d3cd0f627a9..87e158a7512 100644 --- a/enterprise/frontend/src/metabase-enterprise/api/audit-info.ts +++ b/enterprise/frontend/src/metabase-enterprise/api/audit-info.ts @@ -3,7 +3,7 @@ import type { AuditInfo } from "metabase-enterprise/audit_app/types/state"; import { EnterpriseApi } from "./api"; export const auditInfoApi = EnterpriseApi.injectEndpoints({ - endpoints: builder => ({ + endpoints: (builder) => ({ getAuditInfo: builder.query({ query: () => ({ method: "GET", diff --git a/enterprise/frontend/src/metabase-enterprise/api/billing-info.ts b/enterprise/frontend/src/metabase-enterprise/api/billing-info.ts index 967b16551c4..2d31a50ad1c 100644 --- a/enterprise/frontend/src/metabase-enterprise/api/billing-info.ts +++ b/enterprise/frontend/src/metabase-enterprise/api/billing-info.ts @@ -3,7 +3,7 @@ import type { BillingInfo } from "metabase-types/api"; import { EnterpriseApi } from "./api"; export const billingInfoApi = EnterpriseApi.injectEndpoints({ - endpoints: builder => ({ + endpoints: (builder) => ({ getBillingInfo: builder.query({ query: () => ({ method: "GET", diff --git a/enterprise/frontend/src/metabase-enterprise/api/collection.ts b/enterprise/frontend/src/metabase-enterprise/api/collection.ts index 93f57fc33b8..d7a15babde0 100644 --- a/enterprise/frontend/src/metabase-enterprise/api/collection.ts +++ b/enterprise/frontend/src/metabase-enterprise/api/collection.ts @@ -7,7 +7,7 @@ import type { import { EnterpriseApi } from "./api"; export const collectionApi = EnterpriseApi.injectEndpoints({ - endpoints: builder => ({ + endpoints: (builder) => ({ listStaleCollectionItems: builder.query< ListStaleCollectionItemsResponse, ListStaleCollectionItemsRequest @@ -17,7 +17,7 @@ export const collectionApi = EnterpriseApi.injectEndpoints({ url: `/api/ee/stale/${collectionId}`, params, }), - providesTags: response => + providesTags: (response) => provideCollectionItemListTags(response?.data ?? [], [ "card", "dashboard", diff --git a/enterprise/frontend/src/metabase-enterprise/api/gdrive.ts b/enterprise/frontend/src/metabase-enterprise/api/gdrive.ts index 70ef925ef0d..f161f6a342c 100644 --- a/enterprise/frontend/src/metabase-enterprise/api/gdrive.ts +++ b/enterprise/frontend/src/metabase-enterprise/api/gdrive.ts @@ -3,7 +3,7 @@ import type { DatabaseId, Settings } from "metabase-types/api"; import { EnterpriseApi } from "./api"; export const gdriveApi = EnterpriseApi.injectEndpoints({ - endpoints: builder => ({ + endpoints: (builder) => ({ getServiceAccount: builder.query<{ email: string }, void>({ query: () => ({ method: "GET", @@ -23,7 +23,7 @@ export const gdriveApi = EnterpriseApi.injectEndpoints({ { success: boolean }, { url: string } >({ - query: body => ({ + query: (body) => ({ method: "POST", url: "/api/ee/gsheets/folder", body: body, diff --git a/enterprise/frontend/src/metabase-enterprise/api/query-validation.ts b/enterprise/frontend/src/metabase-enterprise/api/query-validation.ts index b182c9eb30c..e0493ecf6d5 100644 --- a/enterprise/frontend/src/metabase-enterprise/api/query-validation.ts +++ b/enterprise/frontend/src/metabase-enterprise/api/query-validation.ts @@ -6,9 +6,9 @@ import type { import { EnterpriseApi } from "./api"; export const queryValidationAPI = EnterpriseApi.injectEndpoints({ - endpoints: builder => ({ + endpoints: (builder) => ({ getInvalidCards: builder.query({ - query: params => ({ + query: (params) => ({ method: "GET", url: "/api/ee/query-reference-validation/invalid-cards", params, diff --git a/enterprise/frontend/src/metabase-enterprise/api/scim.ts b/enterprise/frontend/src/metabase-enterprise/api/scim.ts index d1bf1a30f21..97580a081e3 100644 --- a/enterprise/frontend/src/metabase-enterprise/api/scim.ts +++ b/enterprise/frontend/src/metabase-enterprise/api/scim.ts @@ -6,7 +6,7 @@ import type { import { EnterpriseApi } from "./api"; export const scimApi = EnterpriseApi.injectEndpoints({ - endpoints: builder => ({ + endpoints: (builder) => ({ getScimToken: builder.query({ query: () => ({ method: "GET", diff --git a/enterprise/frontend/src/metabase-enterprise/api/upload-management.ts b/enterprise/frontend/src/metabase-enterprise/api/upload-management.ts index cbfb64861df..1c627826dfd 100644 --- a/enterprise/frontend/src/metabase-enterprise/api/upload-management.ts +++ b/enterprise/frontend/src/metabase-enterprise/api/upload-management.ts @@ -7,7 +7,7 @@ import type { import { EnterpriseApi } from "./api"; export const uploadManagementApi = EnterpriseApi.injectEndpoints({ - endpoints: builder => ({ + endpoints: (builder) => ({ listUploadTables: builder.query({ query: () => ({ method: "GET", diff --git a/enterprise/frontend/src/metabase-enterprise/application_permissions/reducer.js b/enterprise/frontend/src/metabase-enterprise/application_permissions/reducer.js index 8b71d7ecc12..61c22a32e34 100644 --- a/enterprise/frontend/src/metabase-enterprise/application_permissions/reducer.js +++ b/enterprise/frontend/src/metabase-enterprise/application_permissions/reducer.js @@ -13,7 +13,7 @@ const INITIALIZE_APPLICATION_PERMISSIONS = "metabase-enterprise/general-permissions/INITIALIZE_APPLICATION_PERMISSIONS"; export const initializeApplicationPermissions = createThunkAction( INITIALIZE_APPLICATION_PERMISSIONS, - () => async dispatch => { + () => async (dispatch) => { dispatch(loadApplicationPermissions()); }, ); diff --git a/enterprise/frontend/src/metabase-enterprise/application_permissions/selectors.ts b/enterprise/frontend/src/metabase-enterprise/application_permissions/selectors.ts index c663c680bff..e889fbdf65a 100644 --- a/enterprise/frontend/src/metabase-enterprise/application_permissions/selectors.ts +++ b/enterprise/frontend/src/metabase-enterprise/application_permissions/selectors.ts @@ -34,12 +34,12 @@ export function getPermissionWarning( export const canManageSubscriptions = createSelector( (state: ApplicationPermissionsState) => state.currentUser, - user => user?.permissions?.can_access_subscription ?? false, + (user) => user?.permissions?.can_access_subscription ?? false, ); export const canAccessSettings = createSelector( (state: ApplicationPermissionsState) => state.currentUser, - user => user?.permissions?.can_access_setting ?? false, + (user) => user?.permissions?.can_access_setting ?? false, ); const getApplicationPermission = ( @@ -96,7 +96,7 @@ export const getApplicationPermissionEditor = createSelector( return null; } - const entities = groups.flat().map(group => { + const entities = groups.flat().map((group) => { const isAdmin = isAdminGroup(group); return { diff --git a/enterprise/frontend/src/metabase-enterprise/audit_app/components/AuditParameters.jsx b/enterprise/frontend/src/metabase-enterprise/audit_app/components/AuditParameters.jsx index 11557d1a6aa..9b65c322fc9 100644 --- a/enterprise/frontend/src/metabase-enterprise/audit_app/components/AuditParameters.jsx +++ b/enterprise/frontend/src/metabase-enterprise/audit_app/components/AuditParameters.jsx @@ -56,7 +56,7 @@ export default class AuditParameters extends Component { const isEmpty = hasResults === false && inputValues && - Object.values(inputValues).every(v => v === ""); + Object.values(inputValues).every((v) => v === ""); return (
@@ -68,7 +68,7 @@ export default class AuditParameters extends Component { value={inputValues[key] || ""} placeholder={placeholder} disabled={isEmpty || disabled} - onChange={e => { + onChange={(e) => { this.changeValue(key, e.target.value); }} icon={icon} diff --git a/enterprise/frontend/src/metabase-enterprise/audit_app/components/AuditTableVisualization/AuditTableVisualization.jsx b/enterprise/frontend/src/metabase-enterprise/audit_app/components/AuditTableVisualization/AuditTableVisualization.jsx index 647731905a2..14c4163be06 100644 --- a/enterprise/frontend/src/metabase-enterprise/audit_app/components/AuditTableVisualization/AuditTableVisualization.jsx +++ b/enterprise/frontend/src/metabase-enterprise/audit_app/components/AuditTableVisualization/AuditTableVisualization.jsx @@ -60,7 +60,7 @@ export class AuditTableVisualization extends Component { super(props); } - handleColumnHeaderClick = column => { + handleColumnHeaderClick = (column) => { const { isSortable, onSortingChange, sorting } = this.props; if (!isSortable || !onSortingChange) { @@ -112,7 +112,7 @@ export class AuditTableVisualization extends Component { const canRemoveRows = !!onRemoveRow; const columnIndexes = settings["table.columns"] .filter(({ enabled }) => enabled) - .map(({ name }) => _.findIndex(cols, col => col.name === name)); + .map(({ name }) => _.findIndex(cols, (col) => col.name === name)); if (rows.length === 0) { return ( @@ -129,12 +129,12 @@ export class AuditTableVisualization extends Component { {isSelectable && ( elem)} - onChange={e => this.handleAllSelectClick(e, rows)} + checked={Object.values(rowChecked).some((elem) => elem)} + onChange={(e) => this.handleAllSelectClick(e, rows)} /> )} - {columnIndexes.map(colIndex => { + {columnIndexes.map((colIndex) => { const column = cols[colIndex]; const isSortedByColumn = sorting && sorting.column === getColumnName(column); @@ -167,7 +167,7 @@ export class AuditTableVisualization extends Component { + onChange={(e) => this.handleRowSelectClick( { ...e, originRow: rowIndex }, row, @@ -178,7 +178,7 @@ export class AuditTableVisualization extends Component { )} - {columnIndexes.map(colIndex => { + {columnIndexes.map((colIndex) => { const value = row[colIndex]; const column = cols[colIndex]; const clicked = { column, value, origin: { row, cols } }; diff --git a/enterprise/frontend/src/metabase-enterprise/audit_app/components/AuditTableVisualization/AuditTableVisualization.styled.tsx b/enterprise/frontend/src/metabase-enterprise/audit_app/components/AuditTableVisualization/AuditTableVisualization.styled.tsx index d88edc1ab39..a526dfad153 100644 --- a/enterprise/frontend/src/metabase-enterprise/audit_app/components/AuditTableVisualization/AuditTableVisualization.styled.tsx +++ b/enterprise/frontend/src/metabase-enterprise/audit_app/components/AuditTableVisualization/AuditTableVisualization.styled.tsx @@ -9,13 +9,13 @@ interface HeaderCellProps { } export const HeaderCell = styled.th` - cursor: ${props => props.isSortable && "pointer"}; - color: ${props => props.isSortedByColumn && "var(--mb-color-brand)"}; - text-align: ${props => props.isRightAligned && "right"}; + cursor: ${(props) => props.isSortable && "pointer"}; + color: ${(props) => props.isSortedByColumn && "var(--mb-color-brand)"}; + text-align: ${(props) => props.isRightAligned && "right"}; white-space: nowrap; &:hover { - color: ${props => props.isSortable && "var(--mb-color-brand)"}; + color: ${(props) => props.isSortable && "var(--mb-color-brand)"}; } `; @@ -25,9 +25,9 @@ interface RowCellProps { } export const RowCell = styled.td` - color: ${props => props.isClickable && "var(--mb-color-brand)"}; - cursor: ${props => props.isClickable && "pointer"}; - text-align: ${props => props.isRightAligned && "right"}; + color: ${(props) => props.isClickable && "var(--mb-color-brand)"}; + cursor: ${(props) => props.isClickable && "pointer"}; + text-align: ${(props) => props.isRightAligned && "right"}; `; export const RemoveRowButton = styled(IconButtonWrapper)` diff --git a/enterprise/frontend/src/metabase-enterprise/audit_app/containers/AuditTable.jsx b/enterprise/frontend/src/metabase-enterprise/audit_app/containers/AuditTable.jsx index f19ab291abf..39573d4ced4 100644 --- a/enterprise/frontend/src/metabase-enterprise/audit_app/containers/AuditTable.jsx +++ b/enterprise/frontend/src/metabase-enterprise/audit_app/containers/AuditTable.jsx @@ -18,7 +18,7 @@ import { AuditMode } from "../lib/mode"; import { PaginationControlsContainer } from "./AuditTable.styled"; import QuestionLoadAndDisplay from "./QuestionLoadAndDisplay"; -const mapStateToProps = state => ({ +const mapStateToProps = (state) => ({ metadata: getMetadata(state), }); @@ -51,7 +51,7 @@ function AuditTable({ const [loadedCount, setLoadedCount] = useState(0); const { handleNextPage, handlePreviousPage, page } = usePagination(); - const handleOnLoad = results => { + const handleOnLoad = (results) => { setLoadedCount(results[0].row_count); onLoad?.(results); }; @@ -64,7 +64,7 @@ function AuditTable({ const question = new Question(card, metadata); const shouldShowPagination = page > 0 || loadedCount === pageSize; - const handleChangeLocation = url => dispatch(push(url)); + const handleChangeLocation = (url) => dispatch(push(url)); return (
diff --git a/enterprise/frontend/src/metabase-enterprise/audit_app/containers/AuditTableWithSearch.jsx b/enterprise/frontend/src/metabase-enterprise/audit_app/containers/AuditTableWithSearch.jsx index 59f5b493e01..48516752d30 100644 --- a/enterprise/frontend/src/metabase-enterprise/audit_app/containers/AuditTableWithSearch.jsx +++ b/enterprise/frontend/src/metabase-enterprise/audit_app/containers/AuditTableWithSearch.jsx @@ -25,7 +25,7 @@ const AuditTableWithSearch = ({ placeholder = t`Search`, table, ...props }) => ( {...props} table={ search - ? updateIn(table, ["card", "dataset_query", "args"], args => + ? updateIn(table, ["card", "dataset_query", "args"], (args) => (args || []).concat(search), ) : table diff --git a/enterprise/frontend/src/metabase-enterprise/audit_app/containers/UnsubscribeUserModal/UnsubscribeUserModal.jsx b/enterprise/frontend/src/metabase-enterprise/audit_app/containers/UnsubscribeUserModal/UnsubscribeUserModal.jsx index f0454ac55ce..6c63b074ad2 100644 --- a/enterprise/frontend/src/metabase-enterprise/audit_app/containers/UnsubscribeUserModal/UnsubscribeUserModal.jsx +++ b/enterprise/frontend/src/metabase-enterprise/audit_app/containers/UnsubscribeUserModal/UnsubscribeUserModal.jsx @@ -8,7 +8,7 @@ import { AuditApi } from "metabase-enterprise/services"; import UnsubscribeUserForm from "../../components/UnsubscribeUserForm"; -const mapDispatchToProps = dispatch => ({ +const mapDispatchToProps = (dispatch) => ({ onUnsubscribe: async ({ id }) => { await AuditApi.unsubscribe_user({ id }); dispatch(addUndo({ message: t`Unsubscribe successful` })); diff --git a/enterprise/frontend/src/metabase-enterprise/audit_app/index.js b/enterprise/frontend/src/metabase-enterprise/audit_app/index.js index 95f2903ff73..f8279e0e0ad 100644 --- a/enterprise/frontend/src/metabase-enterprise/audit_app/index.js +++ b/enterprise/frontend/src/metabase-enterprise/audit_app/index.js @@ -12,7 +12,7 @@ import { getUserMenuRotes } from "./routes"; import { isAuditDb } from "./utils"; if (hasPremiumFeature("audit_app")) { - PLUGIN_ADMIN_USER_MENU_ITEMS.push(user => [ + PLUGIN_ADMIN_USER_MENU_ITEMS.push((user) => [ { title: t`Unsubscribe from all subscriptions / alerts`, link: `/admin/people/${user.id}/unsubscribe`, diff --git a/enterprise/frontend/src/metabase-enterprise/audit_app/lib/mode.js b/enterprise/frontend/src/metabase-enterprise/audit_app/lib/mode.js index 6f1ec09c146..4f8003b54f1 100644 --- a/enterprise/frontend/src/metabase-enterprise/audit_app/lib/mode.js +++ b/enterprise/frontend/src/metabase-enterprise/audit_app/lib/mode.js @@ -1,7 +1,7 @@ import { push } from "react-router-redux"; import _ from "underscore"; -export const getColumnName = column => column.remapped_to || column.name; +export const getColumnName = (column) => column.remapped_to || column.name; export const getRowValuesByColumns = (row, cols) => cols.reduce((acc, col, index) => { @@ -14,23 +14,23 @@ export const getRowValuesByColumns = (row, cols) => export const columnNameToUrl = { // No admin page for collections but still want to link to it - collection_id: value => `/collection/${value}`, - user_id: value => `/admin/audit/member/${value}`, - creator_id: value => `/admin/audit/member/${value}`, - viewed_by_id: value => `/admin/audit/member/${value}`, - saved_by_id: value => `/admin/audit/member/${value}`, - dashboard_id: value => `/admin/audit/dashboard/${value}`, - card_id: value => `/admin/audit/question/${value}`, - database_id: value => `/admin/audit/database/${value}`, + collection_id: (value) => `/collection/${value}`, + user_id: (value) => `/admin/audit/member/${value}`, + creator_id: (value) => `/admin/audit/member/${value}`, + viewed_by_id: (value) => `/admin/audit/member/${value}`, + saved_by_id: (value) => `/admin/audit/member/${value}`, + dashboard_id: (value) => `/admin/audit/dashboard/${value}`, + card_id: (value) => `/admin/audit/question/${value}`, + database_id: (value) => `/admin/audit/database/${value}`, // NOTE: disable schema links until schema detail is implemented // schema: value => `/admin/audit/schema/${value}`, - table_id: value => `/admin/audit/table/${value}`, + table_id: (value) => `/admin/audit/table/${value}`, // NOTE: query_hash uses standard Base64 encoding which isn't URL safe so make sure to escape it - query_hash: value => + query_hash: (value) => `/admin/audit/query/${encodeURIComponent(String(value))}`, recipients: (_, clicked) => { const pulseIdIndex = clicked.origin.cols.findIndex( - col => getColumnName(col) === "pulse_id", + (col) => getColumnName(col) === "pulse_id", ); const pulseId = clicked.origin.row[pulseIdIndex]; @@ -67,7 +67,7 @@ const AuditDrill = ({ question, clicked }) => { if (origin && column && column.name === "card_id") { const queryHashColIndex = _.findIndex( origin.cols, - col => col.name === "query_hash", + (col) => col.name === "query_hash", ); const value = origin.row[queryHashColIndex]; if (value) { diff --git a/enterprise/frontend/src/metabase-enterprise/auth/components/SessionTimeoutSetting/SessionTimeoutSetting.tsx b/enterprise/frontend/src/metabase-enterprise/auth/components/SessionTimeoutSetting/SessionTimeoutSetting.tsx index d8db72cfade..a809d7c394e 100644 --- a/enterprise/frontend/src/metabase-enterprise/auth/components/SessionTimeoutSetting/SessionTimeoutSetting.tsx +++ b/enterprise/frontend/src/metabase-enterprise/auth/components/SessionTimeoutSetting/SessionTimeoutSetting.tsx @@ -54,7 +54,7 @@ const SessionTimeoutSetting = ({ const [value, setValue] = useState(setting.value ?? DEFAULT_VALUE); const handleValueChange = (newValue: Partial) => { - setValue(prev => ({ ...prev, ...newValue })); + setValue((prev) => ({ ...prev, ...newValue })); }; const error = validate(value); @@ -67,7 +67,7 @@ const SessionTimeoutSetting = ({ handleCommitSettings(value); }; - const handleUnitChange: ChangeEventHandler = e => { + const handleUnitChange: ChangeEventHandler = (e) => { const unit = e.target.value; handleValueChange({ unit }); handleCommitSettings({ ...value, unit }); @@ -92,7 +92,7 @@ const SessionTimeoutSetting = ({ data-testid="session-timeout-input" placeholder="" value={value?.amount.toString()} - onChange={e => + onChange={(e) => handleValueChange({ amount: parseInt(e.target.value, 10) }) } onBlur={handleBlurChange} diff --git a/enterprise/frontend/src/metabase-enterprise/auth/components/SettingsJWTForm/SettingsJWTForm.tsx b/enterprise/frontend/src/metabase-enterprise/auth/components/SettingsJWTForm/SettingsJWTForm.tsx index 0f03ee09bd5..a2c3187e920 100644 --- a/enterprise/frontend/src/metabase-enterprise/auth/components/SettingsJWTForm/SettingsJWTForm.tsx +++ b/enterprise/frontend/src/metabase-enterprise/auth/components/SettingsJWTForm/SettingsJWTForm.tsx @@ -49,7 +49,7 @@ export const SettingsJWTForm = ({ }, [elements]); const fields = useMemo(() => { - return _.mapObject(settings, setting => ({ + return _.mapObject(settings, (setting) => ({ name: setting.key, label: setting.display_name, description: setting.description, @@ -166,7 +166,7 @@ const getAttributeValues = ( values: SettingValues, ) => { return Object.fromEntries( - JWT_ATTRS.map(key => [ + JWT_ATTRS.map((key) => [ key, DEFAULTABLE_JWT_ATTRS.has(key) ? (values[key] ?? settings[key]?.default) diff --git a/enterprise/frontend/src/metabase-enterprise/auth/components/SettingsSAMLForm/SettingsSAMLForm.jsx b/enterprise/frontend/src/metabase-enterprise/auth/components/SettingsSAMLForm/SettingsSAMLForm.jsx index 1a115a2848b..2c1a2e4c828 100644 --- a/enterprise/frontend/src/metabase-enterprise/auth/components/SettingsSAMLForm/SettingsSAMLForm.jsx +++ b/enterprise/frontend/src/metabase-enterprise/auth/components/SettingsSAMLForm/SettingsSAMLForm.jsx @@ -59,7 +59,7 @@ const SettingsSAMLForm = ({ elements = [], settingValues = {}, onSubmit }) => { const FAKE_ACS_URL_KEY = "FAKE_ACS_URL_KEY"; const handleSubmit = useCallback( - values => { + (values) => { const { [FAKE_ACS_URL_KEY]: _, ...realValues } = values; return onSubmit({ ...realValues, "saml-enabled": true }); }, diff --git a/enterprise/frontend/src/metabase-enterprise/auth/components/SettingsSAMLForm/SettingsSAMLForm.styled.tsx b/enterprise/frontend/src/metabase-enterprise/auth/components/SettingsSAMLForm/SettingsSAMLForm.styled.tsx index b3c21846f56..b833b0cae37 100644 --- a/enterprise/frontend/src/metabase-enterprise/auth/components/SettingsSAMLForm/SettingsSAMLForm.styled.tsx +++ b/enterprise/frontend/src/metabase-enterprise/auth/components/SettingsSAMLForm/SettingsSAMLForm.styled.tsx @@ -6,12 +6,12 @@ interface SAMLFormSectionProps { } export const SAMLFormSection = styled.div` - padding: 1rem 2rem ${props => (props.isSSLSection ? "0.5rem" : "1rem")}; + padding: 1rem 2rem ${(props) => (props.isSSLSection ? "0.5rem" : "1rem")}; margin-bottom: 1rem; border: 1px solid var(--mb-color-border); border-radius: 0.5rem; /* The section containing the GroupMappingsWidget needs to be wider */ - width: ${props => (props.wide ? "780px" : "520px")}; + width: ${(props) => (props.wide ? "780px" : "520px")}; /* Even in a wide section, the input is better if same width as elsewhere */ input { diff --git a/enterprise/frontend/src/metabase-enterprise/auth/index.js b/enterprise/frontend/src/metabase-enterprise/auth/index.js index 19e677549f6..572fed2fe83 100644 --- a/enterprise/frontend/src/metabase-enterprise/auth/index.js +++ b/enterprise/frontend/src/metabase-enterprise/auth/index.js @@ -29,11 +29,11 @@ import { SsoButton } from "./components/SsoButton"; import JwtAuthCard from "./containers/JwtAuthCard"; import SamlAuthCard from "./containers/SamlAuthCard"; -PLUGIN_ADMIN_SETTINGS_UPDATES.push(sections => - updateIn(sections, ["authentication", "settings"], settings => { +PLUGIN_ADMIN_SETTINGS_UPDATES.push((sections) => + updateIn(sections, ["authentication", "settings"], (settings) => { const [apiKeySettings, otherSettings] = _.partition( settings, - s => s.key === "api-keys", + (s) => s.key === "api-keys", ); return [ ...otherSettings, @@ -77,7 +77,7 @@ PLUGIN_ADMIN_SETTINGS_UPDATES.push(sections => }), ); -PLUGIN_ADMIN_SETTINGS_UPDATES.push(sections => ({ +PLUGIN_ADMIN_SETTINGS_UPDATES.push((sections) => ({ ...sections, "authentication/saml": { getHidden: () => !hasPremiumFeature("sso_saml"), @@ -235,7 +235,7 @@ const SSO_PROVIDER = { Button: SsoButton, }; -PLUGIN_AUTH_PROVIDERS.push(providers => { +PLUGIN_AUTH_PROVIDERS.push((providers) => { if ( (hasPremiumFeature("sso_jwt") || hasPremiumFeature("sso_saml")) && MetabaseSettings.get("other-sso-enabled?") @@ -247,14 +247,14 @@ PLUGIN_AUTH_PROVIDERS.push(providers => { !MetabaseSettings.isPasswordLoginEnabled() && !MetabaseSettings.isLdapEnabled() ) { - providers = providers.filter(p => p.name !== "password"); + providers = providers.filter((p) => p.name !== "password"); } return providers; }); if (hasPremiumFeature("disable_password_login")) { PLUGIN_IS_PASSWORD_USER.push( - user => + (user) => !user.google_auth && !user.ldap_auth && MetabaseSettings.isPasswordLoginEnabled(), @@ -284,8 +284,8 @@ if (hasPremiumFeature("sso_ldap")) { ), }); - PLUGIN_ADMIN_SETTINGS_UPDATES.push(sections => - updateIn(sections, ["authentication/ldap", "settings"], settings => [ + PLUGIN_ADMIN_SETTINGS_UPDATES.push((sections) => + updateIn(sections, ["authentication/ldap", "settings"], (settings) => [ { key: "ldap-user-provisioning-enabled?", display_name: t`User Provisioning`, diff --git a/enterprise/frontend/src/metabase-enterprise/auth/middleware/session-middleware.js b/enterprise/frontend/src/metabase-enterprise/auth/middleware/session-middleware.js index ef59ff38bf1..e137288a112 100644 --- a/enterprise/frontend/src/metabase-enterprise/auth/middleware/session-middleware.js +++ b/enterprise/frontend/src/metabase-enterprise/auth/middleware/session-middleware.js @@ -23,7 +23,7 @@ export const createSessionMiddleware = ( ) => { let intervalId; - const sessionMiddlware = store => next => action => { + const sessionMiddlware = (store) => (next) => (action) => { if (intervalId == null || resetActions.includes(action.type)) { clearInterval(intervalId); diff --git a/enterprise/frontend/src/metabase-enterprise/browse/models/BrowseModels.unit.spec.tsx b/enterprise/frontend/src/metabase-enterprise/browse/models/BrowseModels.unit.spec.tsx index 6a785e93778..0348d8ec607 100644 --- a/enterprise/frontend/src/metabase-enterprise/browse/models/BrowseModels.unit.spec.tsx +++ b/enterprise/frontend/src/metabase-enterprise/browse/models/BrowseModels.unit.spec.tsx @@ -26,7 +26,7 @@ const setup = (modelCount: number, recentModelCount = 5) => { const mockRecentModels = mockModels .slice(0, recentModelCount) - .map(model => + .map((model) => createMockRecentModel(model as unknown as RecentCollectionItem), ); setupRecentViewsEndpoints(mockRecentModels); diff --git a/enterprise/frontend/src/metabase-enterprise/caching/components/InvalidateNowButton.tsx b/enterprise/frontend/src/metabase-enterprise/caching/components/InvalidateNowButton.tsx index afc1e74b0c2..9ab657f511c 100644 --- a/enterprise/frontend/src/metabase-enterprise/caching/components/InvalidateNowButton.tsx +++ b/enterprise/frontend/src/metabase-enterprise/caching/components/InvalidateNowButton.tsx @@ -71,7 +71,7 @@ const InvalidateNowFormBody = ({ <>
{ + onClick={(e) => { confirmInvalidation(); e.preventDefault(); return false; diff --git a/enterprise/frontend/src/metabase-enterprise/caching/components/ResetButtonContainer.styled.tsx b/enterprise/frontend/src/metabase-enterprise/caching/components/ResetButtonContainer.styled.tsx index c44014ef896..eef49c170ae 100644 --- a/enterprise/frontend/src/metabase-enterprise/caching/components/ResetButtonContainer.styled.tsx +++ b/enterprise/frontend/src/metabase-enterprise/caching/components/ResetButtonContainer.styled.tsx @@ -5,7 +5,7 @@ import type { FormSubmitButtonProps } from "metabase/forms"; import { FormSubmitButton } from "metabase/forms"; export const ResetAllFormSubmitButton = styled(FormSubmitButton, { - shouldForwardProp: prop => prop !== "highlightOnHover", + shouldForwardProp: (prop) => prop !== "highlightOnHover", })` ${({ highlightOnHover }) => highlightOnHover diff --git a/enterprise/frontend/src/metabase-enterprise/caching/components/ResetButtonContainer.tsx b/enterprise/frontend/src/metabase-enterprise/caching/components/ResetButtonContainer.tsx index 82cfa3c4147..5961f776f15 100644 --- a/enterprise/frontend/src/metabase-enterprise/caching/components/ResetButtonContainer.tsx +++ b/enterprise/frontend/src/metabase-enterprise/caching/components/ResetButtonContainer.tsx @@ -42,7 +42,7 @@ const ResetAllToDefaultButtonFormBody = () => { px="1rem" py=".75rem" lh="1" - onClick={e => { + onClick={(e) => { confirmResetAllToDefault(); e.preventDefault(); return false; diff --git a/enterprise/frontend/src/metabase-enterprise/caching/components/StrategyEditorForQuestionsAndDashboards/StrategyEditorForQuestionsAndDashboards.tsx b/enterprise/frontend/src/metabase-enterprise/caching/components/StrategyEditorForQuestionsAndDashboards/StrategyEditorForQuestionsAndDashboards.tsx index 350d6461ca5..e8f1ed3f201 100644 --- a/enterprise/frontend/src/metabase-enterprise/caching/components/StrategyEditorForQuestionsAndDashboards/StrategyEditorForQuestionsAndDashboards.tsx +++ b/enterprise/frontend/src/metabase-enterprise/caching/components/StrategyEditorForQuestionsAndDashboards/StrategyEditorForQuestionsAndDashboards.tsx @@ -75,16 +75,16 @@ const _StrategyEditorForQuestionsAndDashboards = ({ const dashboardIds = useMemo( () => configs - .filter(config => config.model === "dashboard") - .map(c => c.model_id), + .filter((config) => config.model === "dashboard") + .map((c) => c.model_id), [configs], ); const questionIds = useMemo( () => configs - .filter(config => config.model === "question") - .map(c => c.model_id), + .filter((config) => config.model === "question") + .map((c) => c.model_id), [configs], ); @@ -137,7 +137,7 @@ const _StrategyEditorForQuestionsAndDashboards = ({ } // Filter out items that have no match in the dashboard and question list const hydratedCacheableItems: CacheableItem[] = [...items.values()].filter( - item => item.name !== undefined, + (item) => item.name !== undefined, ); return hydratedCacheableItems; @@ -148,7 +148,7 @@ const _StrategyEditorForQuestionsAndDashboards = ({ * disappears from the table, it should no longer be the target */ function removeTargetIfNoLongerInTable() { const isTargetIdInTable = cacheableItems.some( - item => item.id === targetId, + (item) => item.id === targetId, ); if (targetId !== null && !isTargetIdInTable) { setTargetId(null); @@ -254,7 +254,7 @@ const _StrategyEditorForQuestionsAndDashboards = ({ w="100%" direction="row" justify="space-between" - onKeyDown={e => { + onKeyDown={(e) => { if (e.key === "Escape" && !e.ctrlKey && !e.metaKey) { closeForm(); } diff --git a/enterprise/frontend/src/metabase-enterprise/caching/components/StrategyEditorForQuestionsAndDashboards/utils.unit.spec.tsx b/enterprise/frontend/src/metabase-enterprise/caching/components/StrategyEditorForQuestionsAndDashboards/utils.unit.spec.tsx index 2655628fc03..1a204957b8c 100644 --- a/enterprise/frontend/src/metabase-enterprise/caching/components/StrategyEditorForQuestionsAndDashboards/utils.unit.spec.tsx +++ b/enterprise/frontend/src/metabase-enterprise/caching/components/StrategyEditorForQuestionsAndDashboards/utils.unit.spec.tsx @@ -154,7 +154,9 @@ describe("StrategyEditorForQuestionsAndDashboards utilities", () => { const b = formatValueForSorting(rowB, "policy") as string; return a.localeCompare(b); }); - const strategies = sorted.map(row => getShortStrategyLabel(row.strategy)); + const strategies = sorted.map((row) => + getShortStrategyLabel(row.strategy), + ); expect(strategies).toEqual([ "Adaptive", "Duration: 1h", @@ -173,7 +175,7 @@ describe("StrategyEditorForQuestionsAndDashboards utilities", () => { const b = formatValueForSorting(rowB, "collection") as string; return a.localeCompare(b); }); - const collections = sorted.map(row => + const collections = sorted.map((row) => row.collection ? getCollectionPathAsString(row.collection) : null, ); expect(collections).toEqual([ diff --git a/enterprise/frontend/src/metabase-enterprise/caching/components/StrategyFormLauncherPanel.tsx b/enterprise/frontend/src/metabase-enterprise/caching/components/StrategyFormLauncherPanel.tsx index d753595bc13..07c3f7374c6 100644 --- a/enterprise/frontend/src/metabase-enterprise/caching/components/StrategyFormLauncherPanel.tsx +++ b/enterprise/frontend/src/metabase-enterprise/caching/components/StrategyFormLauncherPanel.tsx @@ -35,7 +35,7 @@ export const StrategyFormLauncherPanel = ({ isStrategyFormDirty: boolean; shouldShowResetButton: boolean; }) => { - const databaseIds = useMemo(() => databases.map(db => db.id), [databases]); + const databaseIds = useMemo(() => databases.map((db) => db.id), [databases]); const { handleSubmit: resetAllToDefault, @@ -60,7 +60,7 @@ export const StrategyFormLauncherPanel = ({ /> - {databases?.map(db => ( + {databases?.map((db) => ( !!value && durationUnits.has(value), + (value) => !!value && durationUnits.has(value), ), refresh_automatically: Yup.boolean().nullable().default(false), }); diff --git a/enterprise/frontend/src/metabase-enterprise/caching/hooks/useResetToDefaultForm.tsx b/enterprise/frontend/src/metabase-enterprise/caching/hooks/useResetToDefaultForm.tsx index 532da57fbec..b5c80e5ed57 100644 --- a/enterprise/frontend/src/metabase-enterprise/caching/hooks/useResetToDefaultForm.tsx +++ b/enterprise/frontend/src/metabase-enterprise/caching/hooks/useResetToDefaultForm.tsx @@ -20,7 +20,7 @@ export const useResetToDefaultForm = ({ useEffect(() => { // Avoid stale context in the form if (!isFormVisible) { - setVersionNumber(n => n + 1); + setVersionNumber((n) => n + 1); } }, [isFormVisible]); diff --git a/enterprise/frontend/src/metabase-enterprise/clean_up/CleanupCollectionModal/CleanupCollectionBulkActions.tsx b/enterprise/frontend/src/metabase-enterprise/clean_up/CleanupCollectionModal/CleanupCollectionBulkActions.tsx index 63d9094cd36..89524a621cb 100644 --- a/enterprise/frontend/src/metabase-enterprise/clean_up/CleanupCollectionModal/CleanupCollectionBulkActions.tsx +++ b/enterprise/frontend/src/metabase-enterprise/clean_up/CleanupCollectionModal/CleanupCollectionBulkActions.tsx @@ -31,14 +31,14 @@ export const CleanupCollectionBulkActions = ({ const handleUndo = async (items: CollectionItem[]) => { return Promise.all( - items.map(item => item?.setArchived?.(false, { notify: false })), + items.map((item) => item?.setArchived?.(false, { notify: false })), ) .then(() => resetPagination()) .finally(() => setUndo(undefined)); }; const handleBulkArchive = async () => { - const actions = selected.map(item => { + const actions = selected.map((item) => { return archiveAndTrack({ archive: () => item.setArchived @@ -51,7 +51,7 @@ export const CleanupCollectionBulkActions = ({ }); Promise.allSettled(actions) - .then(results => { + .then((results) => { resetPagination(); const successfullyArchivedItems = results @@ -65,7 +65,7 @@ export const CleanupCollectionBulkActions = ({ const id = Date.now(); const timeoutId = setTimeout(() => { - setUndo(undo => (undo?.id === id ? undefined : undo)); + setUndo((undo) => (undo?.id === id ? undefined : undo)); }, 5000) as unknown as number; const message = ngettext( diff --git a/enterprise/frontend/src/metabase-enterprise/clean_up/CleanupCollectionModal/CleanupCollectionModal.tsx b/enterprise/frontend/src/metabase-enterprise/clean_up/CleanupCollectionModal/CleanupCollectionModal.tsx index 0f2d66b1e8e..dabcfd306aa 100644 --- a/enterprise/frontend/src/metabase-enterprise/clean_up/CleanupCollectionModal/CleanupCollectionModal.tsx +++ b/enterprise/frontend/src/metabase-enterprise/clean_up/CleanupCollectionModal/CleanupCollectionModal.tsx @@ -99,13 +99,13 @@ const _CleanupCollectionModal = ({ const itemsData = staleItemsData?.data; const total = staleItemsData?.total ?? 0; const items: StaleCollectionItem[] = useMemo(() => { - return (itemsData ?? []).map(item => Search.wrapEntity(item, dispatch)); + return (itemsData ?? []).map((item) => Search.wrapEntity(item, dispatch)); }, [itemsData, dispatch]); // selection cont. const { getIsSelected } = selection; const hasUnselected = useMemo(() => { - return items.some(item => !getIsSelected(item)); + return items.some((item) => !getIsSelected(item)); }, [getIsSelected, items]); // pagination cont. diff --git a/enterprise/frontend/src/metabase-enterprise/clean_up/CleanupCollectionModal/CleanupCollectionModalFilters.tsx b/enterprise/frontend/src/metabase-enterprise/clean_up/CleanupCollectionModal/CleanupCollectionModalFilters.tsx index 8dd05b879bd..2134900372d 100644 --- a/enterprise/frontend/src/metabase-enterprise/clean_up/CleanupCollectionModal/CleanupCollectionModalFilters.tsx +++ b/enterprise/frontend/src/metabase-enterprise/clean_up/CleanupCollectionModal/CleanupCollectionModalFilters.tsx @@ -33,7 +33,7 @@ export const CleanupCollectionModalFilters = ({ leftSection={} data={dateFilterOptions} value={dateFilter} - onChange={option => { + onChange={(option) => { option && isDateFilter(option) && onDateFilterChange(option); }} mx=".5rem" @@ -46,7 +46,7 @@ export const CleanupCollectionModalFilters = ({ label={{t`Include items in sub-collections`}} role="switch" checked={recursiveFilter} - onChange={e => onRecursiveFilterChange(e.target.checked)} + onChange={(e) => onRecursiveFilterChange(e.target.checked)} /> diff --git a/enterprise/frontend/src/metabase-enterprise/clean_up/CleanupCollectionModal/CleanupCollectionTable.tsx b/enterprise/frontend/src/metabase-enterprise/clean_up/CleanupCollectionModal/CleanupCollectionTable.tsx index 67c594770fd..41c3d2cbe41 100644 --- a/enterprise/frontend/src/metabase-enterprise/clean_up/CleanupCollectionModal/CleanupCollectionTable.tsx +++ b/enterprise/frontend/src/metabase-enterprise/clean_up/CleanupCollectionModal/CleanupCollectionTable.tsx @@ -87,7 +87,7 @@ export const CleanupCollectionTable = ({ - {items.map(item => ( + {items.map((item) => ( {/* Select */} (0); const [page, setPage] = useState(initialPage ?? 0); - const onNextPage = useCallback(() => setPage(prev => prev + 1), [setPage]); + const onNextPage = useCallback(() => setPage((prev) => prev + 1), [setPage]); const onPreviousPage = useCallback( - () => setPage(prev => prev - 1), + () => setPage((prev) => prev - 1), [setPage], ); const resetPage = useCallback( diff --git a/enterprise/frontend/src/metabase-enterprise/clean_up/CleanupCollectionModal/utils.ts b/enterprise/frontend/src/metabase-enterprise/clean_up/CleanupCollectionModal/utils.ts index edbcecf1890..035573743e6 100644 --- a/enterprise/frontend/src/metabase-enterprise/clean_up/CleanupCollectionModal/utils.ts +++ b/enterprise/frontend/src/metabase-enterprise/clean_up/CleanupCollectionModal/utils.ts @@ -69,7 +69,7 @@ export type DateFilterOption = { export type DateFilterOptions = DateFilterOption[]; const dateFiltersMap = _.object( - dateFilterOptions.map<[DateFilter, DateFilterOption]>(option => [ + dateFilterOptions.map<[DateFilter, DateFilterOption]>((option) => [ option.value, option, ]), @@ -92,7 +92,9 @@ export const getDateFilterValue = (dateFilter: DateFilter) => { }; export const getDateFilterLabel = (dateFilter: DateFilter) => { - const option = dateFilterOptions.find(option => option.value === dateFilter); + const option = dateFilterOptions.find( + (option) => option.value === dateFilter, + ); const label = option?.label; if (!label) { diff --git a/enterprise/frontend/src/metabase-enterprise/clean_up/index.tsx b/enterprise/frontend/src/metabase-enterprise/clean_up/index.tsx index f7b53d26ece..d3a7482b287 100644 --- a/enterprise/frontend/src/metabase-enterprise/clean_up/index.tsx +++ b/enterprise/frontend/src/metabase-enterprise/clean_up/index.tsx @@ -17,7 +17,7 @@ import { canCleanUp } from "./utils"; if (hasPremiumFeature("collection_cleanup")) { PLUGIN_COLLECTIONS.canCleanUp = canCleanUp; - PLUGIN_COLLECTIONS.useGetCleanUpMenuItems = collection => { + PLUGIN_COLLECTIONS.useGetCleanUpMenuItems = (collection) => { const canCleanupCollection = canCleanUp(collection); const { currentData: collectionItems } = useListCollectionItemsQuery( diff --git a/enterprise/frontend/src/metabase-enterprise/collections/components/CollectionInstanceAnalyticsIcon.unit.spec.tsx b/enterprise/frontend/src/metabase-enterprise/collections/components/CollectionInstanceAnalyticsIcon.unit.spec.tsx index 1c7af5017a6..cbb4811d67e 100644 --- a/enterprise/frontend/src/metabase-enterprise/collections/components/CollectionInstanceAnalyticsIcon.unit.spec.tsx +++ b/enterprise/frontend/src/metabase-enterprise/collections/components/CollectionInstanceAnalyticsIcon.unit.spec.tsx @@ -51,7 +51,7 @@ describe("CollectionInstanceAnalyticsIcon", () => { return screen.getByLabelText("audit icon"); } - ["collection", "dashboard", "model", "question"].forEach(entity => { + ["collection", "dashboard", "model", "question"].forEach((entity) => { it(`displays the correct tooltip for ${entity}`, async () => { renderInstanceAnalyticsCollection({ entity: entity, diff --git a/enterprise/frontend/src/metabase-enterprise/collections/utils.ts b/enterprise/frontend/src/metabase-enterprise/collections/utils.ts index 93c695a6fba..4bbf4b6422e 100644 --- a/enterprise/frontend/src/metabase-enterprise/collections/utils.ts +++ b/enterprise/frontend/src/metabase-enterprise/collections/utils.ts @@ -76,14 +76,14 @@ export const filterOutItemsFromInstanceAnalytics = < /** Cache of ids of instance analytics collections */ const cache = new Set(); - return items.filter(item => { + return items.filter((item) => { if (cache.has(item.collection.id)) { return false; } const ancestors = item.collection.effective_ancestors || []; const path = [item.collection, ...ancestors]; if (path.some(isInstanceAnalyticsCollection)) { - path.map(c => c.id).forEach(id => cache.add(id)); + path.map((c) => c.id).forEach((id) => cache.add(id)); return false; } return true; diff --git a/enterprise/frontend/src/metabase-enterprise/content_verification/VerifiedFilter/VerifiedFilter.tsx b/enterprise/frontend/src/metabase-enterprise/content_verification/VerifiedFilter/VerifiedFilter.tsx index 616d359a812..6f35554abc5 100644 --- a/enterprise/frontend/src/metabase-enterprise/content_verification/VerifiedFilter/VerifiedFilter.tsx +++ b/enterprise/frontend/src/metabase-enterprise/content_verification/VerifiedFilter/VerifiedFilter.tsx @@ -5,6 +5,6 @@ import type { SearchFilterComponent } from "metabase/search/types"; export const VerifiedFilter: SearchFilterComponent<"verified"> = { label: () => t`Verified items only`, type: "toggle", - fromUrl: value => value === "true", + fromUrl: (value) => value === "true", toUrl: (value: boolean) => (value ? "true" : null), }; diff --git a/enterprise/frontend/src/metabase-enterprise/embedding/components/EmbeddingAppSameSiteCookieDescription/EmbeddingAppSameSiteCookieDescription.tsx b/enterprise/frontend/src/metabase-enterprise/embedding/components/EmbeddingAppSameSiteCookieDescription/EmbeddingAppSameSiteCookieDescription.tsx index 9963c2d9f21..85597f65ad8 100644 --- a/enterprise/frontend/src/metabase-enterprise/embedding/components/EmbeddingAppSameSiteCookieDescription/EmbeddingAppSameSiteCookieDescription.tsx +++ b/enterprise/frontend/src/metabase-enterprise/embedding/components/EmbeddingAppSameSiteCookieDescription/EmbeddingAppSameSiteCookieDescription.tsx @@ -11,7 +11,7 @@ import { Box, Center, Stack, Text } from "metabase/ui"; import { SameSiteAlert } from "./EmbeddingAppSameSiteCookieDescription.styled"; export const EmbeddingAppSameSiteCookieDescription = () => { - const docsUrl = useSelector(state => + const docsUrl = useSelector((state) => // eslint-disable-next-line no-unconditional-metabase-links-render -- Admin settings getDocsUrl(state, { page: "embedding/interactive-embedding", @@ -70,5 +70,5 @@ function authorizedOriginsContainsNonInstanceDomain( } const origins = authorizedOriginsString.split(" "); - return origins.some(origin => !isSameOrigin(origin)); + return origins.some((origin) => !isSameOrigin(origin)); } diff --git a/enterprise/frontend/src/metabase-enterprise/embedding/components/InteractiveEmbeddingSettings.tsx b/enterprise/frontend/src/metabase-enterprise/embedding/components/InteractiveEmbeddingSettings.tsx index 1ea02df38a0..c6f7dd9f437 100644 --- a/enterprise/frontend/src/metabase-enterprise/embedding/components/InteractiveEmbeddingSettings.tsx +++ b/enterprise/frontend/src/metabase-enterprise/embedding/components/InteractiveEmbeddingSettings.tsx @@ -47,7 +47,7 @@ export function InteractiveEmbeddingSettings({ updateSetting({ key: "enable-embedding-interactive" }, value); } - const quickStartUrl = useSelector(state => + const quickStartUrl = useSelector((state) => // eslint-disable-next-line no-unconditional-metabase-links-render -- This is used in admin settings getDocsUrl(state, { page: "embedding/interactive-embedding-quick-start-guide", diff --git a/enterprise/frontend/src/metabase-enterprise/google_drive/GdriveConnectionModal.tsx b/enterprise/frontend/src/metabase-enterprise/google_drive/GdriveConnectionModal.tsx index d9289c3c524..4eba4f5c3c9 100644 --- a/enterprise/frontend/src/metabase-enterprise/google_drive/GdriveConnectionModal.tsx +++ b/enterprise/frontend/src/metabase-enterprise/google_drive/GdriveConnectionModal.tsx @@ -121,7 +121,7 @@ function GoogleSheetsConnectModal({ dispatch(reloadSettings()); onClose(); }) - .catch(response => { + .catch((response) => { setErrorMessage(response?.data?.message ?? "Something went wrong"); }); }; @@ -170,7 +170,7 @@ function GoogleSheetsConnectModal({ my="sm" disabled={isSavingFolderLink} value={folderLink} - onChange={e => setFolderLink(e.target.value)} + onChange={(e) => setFolderLink(e.target.value)} placeholder="https://drive.google.com/drive/folders/abc123-xyz456" /> { + .catch((response) => { setErrorMessage(response?.data?.message ?? "Something went wrong"); }); }; diff --git a/enterprise/frontend/src/metabase-enterprise/group_managers/actions.js b/enterprise/frontend/src/metabase-enterprise/group_managers/actions.js index 73a24258774..375be3e999b 100644 --- a/enterprise/frontend/src/metabase-enterprise/group_managers/actions.js +++ b/enterprise/frontend/src/metabase-enterprise/group_managers/actions.js @@ -61,7 +61,7 @@ export const confirmUpdateMembership = createThunkAction( export const DELETE_GROUP = "metabase-enterprise/group_managers/DELETE_GROUP"; export const deleteGroup = createThunkAction( DELETE_GROUP, - group => async (dispatch, getState) => { + (group) => async (dispatch, getState) => { const groups = Groups.selectors.getList(getState()); const isLastGroup = groups.length === 1; diff --git a/enterprise/frontend/src/metabase-enterprise/group_managers/components/UserTypeToggle/UserTypeToggle.tsx b/enterprise/frontend/src/metabase-enterprise/group_managers/components/UserTypeToggle/UserTypeToggle.tsx index b1f366a292a..bcdba5fa4b7 100644 --- a/enterprise/frontend/src/metabase-enterprise/group_managers/components/UserTypeToggle/UserTypeToggle.tsx +++ b/enterprise/frontend/src/metabase-enterprise/group_managers/components/UserTypeToggle/UserTypeToggle.tsx @@ -18,7 +18,7 @@ export const UserTypeToggle = ({ const tooltipText = isManager ? t`Turn into Member` : t`Turn into Manager`; const icon = isManager ? "arrow_down" : "arrow_up"; - const handleChangeType: MouseEventHandler = e => { + const handleChangeType: MouseEventHandler = (e) => { e.stopPropagation(); onChange(!isManager); }; diff --git a/enterprise/frontend/src/metabase-enterprise/group_managers/utils.ts b/enterprise/frontend/src/metabase-enterprise/group_managers/utils.ts index 49b7f0aa0d5..44c6f5a350f 100644 --- a/enterprise/frontend/src/metabase-enterprise/group_managers/utils.ts +++ b/enterprise/frontend/src/metabase-enterprise/group_managers/utils.ts @@ -22,7 +22,7 @@ export const groupManagerAllowedPathGetter = ( }; export const getRevokedAllGroupManagersPath = (adminPaths: AdminPath[]) => { - const allowedItems = adminPaths.filter(item => item.key !== "people"); + const allowedItems = adminPaths.filter((item) => item.key !== "people"); return allowedItems.length > 0 ? allowedItems[0].path : "/"; }; @@ -32,7 +32,7 @@ export const getRevokeManagerPeopleRedirect = ( adminPaths: AdminPath[], ) => { const isRemovingLastManagerMembership = - currentUserMemberships.filter(m => m.is_group_manager).length === 1; + currentUserMemberships.filter((m) => m.is_group_manager).length === 1; if (isRemovingLastManagerMembership) { return getRevokedAllGroupManagersPath(adminPaths); @@ -46,7 +46,7 @@ export const getRevokeManagerGroupsRedirect = ( adminPaths: AdminPath[], ) => { const isRemovingLastManagerMembership = - currentUserMemberships.filter(m => m.is_group_manager).length === 1; + currentUserMemberships.filter((m) => m.is_group_manager).length === 1; if (!isRemovingLastManagerMembership) { return "/admin/people/groups"; @@ -62,7 +62,7 @@ export const getRemoveMembershipConfirmation = ( ): Partial | null => { const isRemovingSelf = currentUserMemberships.find( - membership => membership.membership_id === deletedMembershipId, + (membership) => membership.membership_id === deletedMembershipId, ) != null; return isRemovingSelf && !currentUser.is_superuser diff --git a/enterprise/frontend/src/metabase-enterprise/hosting/index.js b/enterprise/frontend/src/metabase-enterprise/hosting/index.js index bdec62d14d1..f60cdf80c7d 100644 --- a/enterprise/frontend/src/metabase-enterprise/hosting/index.js +++ b/enterprise/frontend/src/metabase-enterprise/hosting/index.js @@ -8,17 +8,19 @@ import { hasPremiumFeature } from "metabase-enterprise/settings"; import { SettingsCloudStoreLink } from "./components/SettingsCloudStoreLink"; if (hasPremiumFeature("hosting")) { - PLUGIN_ADMIN_SETTINGS_UPDATES.push(sections => _.omit(sections, ["updates"])); + PLUGIN_ADMIN_SETTINGS_UPDATES.push((sections) => + _.omit(sections, ["updates"]), + ); - PLUGIN_ADMIN_SETTINGS_UPDATES.push(sections => - updateIn(sections, ["general", "settings"], settings => - _.reject(settings, setting => + PLUGIN_ADMIN_SETTINGS_UPDATES.push((sections) => + updateIn(sections, ["general", "settings"], (settings) => + _.reject(settings, (setting) => ["site-url", "redirect-all-requests-to-https"].includes(setting.key), ), ), ); - PLUGIN_ADMIN_SETTINGS_UPDATES.push(sections => ({ + PLUGIN_ADMIN_SETTINGS_UPDATES.push((sections) => ({ ...sections, cloud: { name: t`Cloud`, diff --git a/enterprise/frontend/src/metabase-enterprise/license/components/LicenseAndBillingSettings/LicenseAndBillingSettings.tsx b/enterprise/frontend/src/metabase-enterprise/license/components/LicenseAndBillingSettings/LicenseAndBillingSettings.tsx index 364045fbb2d..d152dd84bec 100644 --- a/enterprise/frontend/src/metabase-enterprise/license/components/LicenseAndBillingSettings/LicenseAndBillingSettings.tsx +++ b/enterprise/frontend/src/metabase-enterprise/license/components/LicenseAndBillingSettings/LicenseAndBillingSettings.tsx @@ -75,7 +75,7 @@ const LicenseAndBillingSettings = ({ is_env_setting, env_name, } = settingValues?.find( - setting => setting.key === "premium-embedding-token", + (setting) => setting.key === "premium-embedding-token", ) ?? {}; const { diff --git a/enterprise/frontend/src/metabase-enterprise/license/index.js b/enterprise/frontend/src/metabase-enterprise/license/index.js index 5129fd08e1c..e6bc91b3bd9 100644 --- a/enterprise/frontend/src/metabase-enterprise/license/index.js +++ b/enterprise/frontend/src/metabase-enterprise/license/index.js @@ -5,8 +5,8 @@ import { PLUGIN_ADMIN_SETTINGS_UPDATES } from "metabase/plugins"; import LicenseAndBillingSettings from "./components/LicenseAndBillingSettings"; -PLUGIN_ADMIN_SETTINGS_UPDATES.push(sections => - updateIn(sections, ["license"], license => { +PLUGIN_ADMIN_SETTINGS_UPDATES.push((sections) => + updateIn(sections, ["license"], (license) => { return { ...license, component: LicenseAndBillingSettings, diff --git a/enterprise/frontend/src/metabase-enterprise/llm_autodescription/LLMSuggestQuestionInfo.tsx b/enterprise/frontend/src/metabase-enterprise/llm_autodescription/LLMSuggestQuestionInfo.tsx index 203d08b8ce5..7e60262f116 100644 --- a/enterprise/frontend/src/metabase-enterprise/llm_autodescription/LLMSuggestQuestionInfo.tsx +++ b/enterprise/frontend/src/metabase-enterprise/llm_autodescription/LLMSuggestQuestionInfo.tsx @@ -22,7 +22,7 @@ export const LLMSuggestQuestionInfo = ({ const questionWithCollectionId: Question = initialQuestion.setCollectionId(collectionId); - const question = useSelector(state => + const question = useSelector((state) => getSubmittableQuestion(state, questionWithCollectionId), ); diff --git a/enterprise/frontend/src/metabase-enterprise/moderation/service.ts b/enterprise/frontend/src/metabase-enterprise/moderation/service.ts index f7016a7e410..b1ea870f9ef 100644 --- a/enterprise/frontend/src/metabase-enterprise/moderation/service.ts +++ b/enterprise/frontend/src/metabase-enterprise/moderation/service.ts @@ -160,7 +160,7 @@ export function getModerationTimelineEvents( reviews: ModerationReview[], currentUser?: User, ) { - return reviews.map(review => { + return reviews.map((review) => { const moderator = review.user; const moderatorDisplayName = getModeratorDisplayName( moderator, diff --git a/enterprise/frontend/src/metabase-enterprise/sandboxes/actions.js b/enterprise/frontend/src/metabase-enterprise/sandboxes/actions.js index cf44a0db255..78ac5341212 100644 --- a/enterprise/frontend/src/metabase-enterprise/sandboxes/actions.js +++ b/enterprise/frontend/src/metabase-enterprise/sandboxes/actions.js @@ -23,7 +23,7 @@ import { GTAPApi } from "metabase/services"; import { getPolicyKey, getPolicyKeyFromParams } from "./utils"; export const FETCH_POLICY = "metabase-enterprise/sandboxes/FETCH_POLICY"; -export const fetchPolicy = withRequestState(params => [ +export const fetchPolicy = withRequestState((params) => [ "plugins", "sandboxesPlugin", "policies", @@ -42,7 +42,7 @@ export const UPDATE_TABLE_SANDBOXING_PERMISSION = "metabase-enterprise/sandboxes/UPDATE_TABLE_SANDBOXING_PERMISSION"; export const updateTableSandboxingPermission = createThunkAction( UPDATE_TABLE_SANDBOXING_PERMISSION, - params => async dispatch => { + (params) => async (dispatch) => { const { groupId, ...entityId } = params; return dispatch( updateDataPermission({ @@ -111,12 +111,12 @@ const groupTableAccessPolicies = handleActions( const tables = database?.tables ?? []; // filter tables if there's a schema referenced in the entity id const entityTables = tables.filter( - table => + (table) => !entityId.schemaName || table.schema_name === entityId.schemaName, ); // delete 0 to N sandboxes present in the state - const policyKeys = entityTables.map(table => + const policyKeys = entityTables.map((table) => getPolicyKeyFromParams({ groupId, tableId: table.id }), ); return _.omit(state, policyKeys); diff --git a/enterprise/frontend/src/metabase-enterprise/sandboxes/components/AttributeMappingEditor/AttributeMappingEditor.tsx b/enterprise/frontend/src/metabase-enterprise/sandboxes/components/AttributeMappingEditor/AttributeMappingEditor.tsx index 0dfa728d5bf..b3dc96733c7 100644 --- a/enterprise/frontend/src/metabase-enterprise/sandboxes/components/AttributeMappingEditor/AttributeMappingEditor.tsx +++ b/enterprise/frontend/src/metabase-enterprise/sandboxes/components/AttributeMappingEditor/AttributeMappingEditor.tsx @@ -121,7 +121,7 @@ const AttributePicker = ({ } disabled={attributesOptions.length === 0} > - {attributesOptions.map(attributesOption => ( + {attributesOptions.map((attributesOption) => ( diff --git a/enterprise/frontend/src/metabase-enterprise/sandboxes/components/EditSandboxingModal/EditSandboxingModal.tsx b/enterprise/frontend/src/metabase-enterprise/sandboxes/components/EditSandboxingModal/EditSandboxingModal.tsx index 444a611084a..0d2c7f0d901 100644 --- a/enterprise/frontend/src/metabase-enterprise/sandboxes/components/EditSandboxingModal/EditSandboxingModal.tsx +++ b/enterprise/frontend/src/metabase-enterprise/sandboxes/components/EditSandboxingModal/EditSandboxingModal.tsx @@ -112,7 +112,7 @@ const EditSandboxingModal = ({ }, [normalizedPolicy]); const remainingAttributesOptions = attributes.filter( - attribute => !(attribute in policy.attribute_remappings), + (attribute) => !(attribute in policy.attribute_remappings), ); const hasAttributesOptions = attributes.length > 0; @@ -153,7 +153,7 @@ const EditSandboxingModal = ({ value: false, }, ]} - onChange={shouldUseSavedQuestion => + onChange={(shouldUseSavedQuestion) => setShouldUseSavedQuestion(!shouldUseSavedQuestion) } vertical @@ -185,7 +185,7 @@ const EditSandboxingModal = ({ ? getQuestionPickerValue(policyCard) : undefined } - onChange={newCard => { + onChange={(newCard) => { setPolicy({ ...policy, card_id: newCard.id }); hideModal(); }} @@ -205,7 +205,7 @@ const EditSandboxingModal = ({ + onChange={(attribute_remappings) => setPolicy({ ...policy, attribute_remappings }) } shouldUseSavedQuestion={shouldUseSavedQuestion} diff --git a/enterprise/frontend/src/metabase-enterprise/sandboxes/components/ParameterTargetWidget.jsx b/enterprise/frontend/src/metabase-enterprise/sandboxes/components/ParameterTargetWidget.jsx index 3a7f76972dd..8f249b61d48 100644 --- a/enterprise/frontend/src/metabase-enterprise/sandboxes/components/ParameterTargetWidget.jsx +++ b/enterprise/frontend/src/metabase-enterprise/sandboxes/components/ParameterTargetWidget.jsx @@ -47,7 +47,7 @@ export default class ParameterTargetWidget extends Component { } > { + onChange={(target) => { onChange(target); this.popover.current.close(); }} diff --git a/enterprise/frontend/src/metabase-enterprise/sandboxes/index.js b/enterprise/frontend/src/metabase-enterprise/sandboxes/index.js index 605fc1f5b8f..050f208e4ea 100644 --- a/enterprise/frontend/src/metabase-enterprise/sandboxes/index.js +++ b/enterprise/frontend/src/metabase-enterprise/sandboxes/index.js @@ -87,9 +87,9 @@ if (hasPremiumFeature("sandboxes")) { PLUGIN_ADMIN_PERMISSIONS_TABLE_FIELDS_POST_ACTION[OPTION_SEGMENTED.value] = getEditSegmentedAccessPostAction; - PLUGIN_DATA_PERMISSIONS.permissionsPayloadExtraSelectors.push(state => { + PLUGIN_DATA_PERMISSIONS.permissionsPayloadExtraSelectors.push((state) => { const sandboxes = getDraftPolicies(state); - const modifiedGroupIds = _.uniq(sandboxes.map(sb => sb.group_id)); + const modifiedGroupIds = _.uniq(sandboxes.map((sb) => sb.group_id)); return [{ sandboxes }, modifiedGroupIds]; }); diff --git a/enterprise/frontend/src/metabase-enterprise/sandboxes/selectors.ts b/enterprise/frontend/src/metabase-enterprise/sandboxes/selectors.ts index bdacee6a98d..d2f38dc2738 100644 --- a/enterprise/frontend/src/metabase-enterprise/sandboxes/selectors.ts +++ b/enterprise/frontend/src/metabase-enterprise/sandboxes/selectors.ts @@ -30,5 +30,5 @@ export const getDraftPolicies = (state: SandboxesState) => { export const hasPolicyChanges = createSelector( getDraftPolicies, - policies => policies != null && policies.length > 0, + (policies) => policies != null && policies.length > 0, ); diff --git a/enterprise/frontend/src/metabase-enterprise/shared/reducer.ts b/enterprise/frontend/src/metabase-enterprise/shared/reducer.ts index 9475048f5da..fc14a2052e5 100644 --- a/enterprise/frontend/src/metabase-enterprise/shared/reducer.ts +++ b/enterprise/frontend/src/metabase-enterprise/shared/reducer.ts @@ -21,7 +21,7 @@ export const shared = createSlice({ initialState, name: "metabase-enterprise/shared", reducers: {}, - extraReducers: builder => { + extraReducers: (builder) => { builder.addCase(fetchUserAttributes.fulfilled, (state, action) => { state.attributes = action.payload; }); diff --git a/enterprise/frontend/src/metabase-enterprise/sharing/components/MutableParametersSection.tsx b/enterprise/frontend/src/metabase-enterprise/sharing/components/MutableParametersSection.tsx index eff4e371c18..e2dd1560317 100644 --- a/enterprise/frontend/src/metabase-enterprise/sharing/components/MutableParametersSection.tsx +++ b/enterprise/frontend/src/metabase-enterprise/sharing/components/MutableParametersSection.tsx @@ -44,9 +44,9 @@ export const MutableParametersSection = ({ ); const setParameterValue = (id: ParameterId, value: any) => { - const parameter = parameters.find(parameter => parameter.id === id); + const parameter = parameters.find((parameter) => parameter.id === id); const filteredParameters = pulseParameters.filter( - parameter => parameter.id !== id, + (parameter) => parameter.id !== id, ); const newParameters = value === PULSE_PARAM_USE_DEFAULT diff --git a/enterprise/frontend/src/metabase-enterprise/snippets/components/CollectionOptionsButton.jsx b/enterprise/frontend/src/metabase-enterprise/snippets/components/CollectionOptionsButton.jsx index 32e6f626882..3a4094e30e8 100644 --- a/enterprise/frontend/src/metabase-enterprise/snippets/components/CollectionOptionsButton.jsx +++ b/enterprise/frontend/src/metabase-enterprise/snippets/components/CollectionOptionsButton.jsx @@ -22,7 +22,7 @@ export default class CollectionOptionsButton extends Component {
e.stopPropagation()} + onClick={(e) => e.stopPropagation()} // cap the large ellipsis so it doesn't increase the row height style={{ height: ICON_SIZE }} > @@ -34,7 +34,7 @@ export default class CollectionOptionsButton extends Component { { + onChange={(item) => { item.onClick(item); closePopover(); }} @@ -58,7 +58,7 @@ export default class CollectionOptionsButton extends Component { }, ]; } - const onEdit = collection => + const onEdit = (collection) => setSidebarState({ modalSnippetCollection: collection }); const onEditCollectionPermissions = () => setSidebarState({ permissionsModalCollectionId: collection.id }); diff --git a/enterprise/frontend/src/metabase-enterprise/snippets/components/SnippetCollectionFormModal.unit.spec.tsx b/enterprise/frontend/src/metabase-enterprise/snippets/components/SnippetCollectionFormModal.unit.spec.tsx index 4de25cdcb6c..2e057ddb905 100644 --- a/enterprise/frontend/src/metabase-enterprise/snippets/components/SnippetCollectionFormModal.unit.spec.tsx +++ b/enterprise/frontend/src/metabase-enterprise/snippets/components/SnippetCollectionFormModal.unit.spec.tsx @@ -32,7 +32,7 @@ async function setup({ folder = {}, onClose = jest.fn() }: SetupOpts = {}) { folder, ); - fetchMock.put(`path:/api/collection/${folder.id}`, async url => { + fetchMock.put(`path:/api/collection/${folder.id}`, async (url) => { return createMockCollection( await fetchMock.lastCall(url)?.request?.json(), ); @@ -52,7 +52,7 @@ async function setup({ folder = {}, onClose = jest.fn() }: SetupOpts = {}) { [TOP_SNIPPETS_FOLDER], ); - fetchMock.post("path:/api/collection", async url => { + fetchMock.post("path:/api/collection", async (url) => { return createMockCollection(await fetchMock.lastCall(url)?.request?.json()); }); diff --git a/enterprise/frontend/src/metabase-enterprise/snippets/index.js b/enterprise/frontend/src/metabase-enterprise/snippets/index.js index 97d1b681239..0bac474f8bb 100644 --- a/enterprise/frontend/src/metabase-enterprise/snippets/index.js +++ b/enterprise/frontend/src/metabase-enterprise/snippets/index.js @@ -16,7 +16,7 @@ import CollectionRow from "./components/CollectionRow"; import SnippetCollectionFormModal from "./components/SnippetCollectionFormModal"; if (hasPremiumFeature("snippet_collections")) { - PLUGIN_SNIPPET_SIDEBAR_PLUS_MENU_OPTIONS.push(snippetSidebar => ({ + PLUGIN_SNIPPET_SIDEBAR_PLUS_MENU_OPTIONS.push((snippetSidebar) => ({ icon: "folder", name: t`New folder`, onClick: () => @@ -30,7 +30,7 @@ if (hasPremiumFeature("snippet_collections")) { })); PLUGIN_SNIPPET_SIDEBAR_MODALS.push( - snippetSidebar => + (snippetSidebar) => snippetSidebar.state.modalSnippetCollection && ( @@ -48,7 +48,7 @@ if (hasPremiumFeature("snippet_collections")) { /> ), - snippetSidebar => + (snippetSidebar) => snippetSidebar.state.permissionsModalCollectionId != null && ( diff --git a/enterprise/frontend/src/metabase-enterprise/tools/ErrorOverview.jsx b/enterprise/frontend/src/metabase-enterprise/tools/ErrorOverview.jsx index 79a99c51d64..c34d7ad9434 100644 --- a/enterprise/frontend/src/metabase-enterprise/tools/ErrorOverview.jsx +++ b/enterprise/frontend/src/metabase-enterprise/tools/ErrorOverview.jsx @@ -11,7 +11,7 @@ import * as Queries from "../audit_app/lib/cards/queries"; import { ErrorMode } from "./mode"; -const getSortOrder = isAscending => (isAscending ? "asc" : "desc"); +const getSortOrder = (isAscending) => (isAscending ? "asc" : "desc"); const CARD_ID_COL = 0; @@ -28,9 +28,9 @@ export default function ErrorOverview(props) { const [rowChecked, setRowChecked] = useState({}); - const handleAllSelectClick = e => { + const handleAllSelectClick = (e) => { const newRowChecked = { ...rowChecked }; - const noRowChecked = Object.values(rowChecked).every(v => !v); + const noRowChecked = Object.values(rowChecked).every((v) => !v); for (const rowIndex of Array(e.rows.length).keys()) { const cardIndex = e.rows[rowIndex][CARD_ID_COL]; if (noRowChecked) { @@ -42,7 +42,7 @@ export default function ErrorOverview(props) { setRowChecked(newRowChecked); }; - const handleRowSelectClick = e => { + const handleRowSelectClick = (e) => { const newRowChecked = { ...rowChecked }; const cardIndex = e.row[CARD_ID_COL]; newRowChecked[cardIndex] = !(rowChecked[cardIndex] || false); @@ -54,7 +54,7 @@ export default function ErrorOverview(props) { await Promise.all( checkedCardIds.map( - async member => await CardApi.query({ cardId: member }), + async (member) => await CardApi.query({ cardId: member }), ), ); setRowChecked({}); @@ -62,9 +62,9 @@ export default function ErrorOverview(props) { reloadRef.current?.(); }; - const handleSortingChange = sorting => setSorting(sorting); + const handleSortingChange = (sorting) => setSorting(sorting); - const handleLoad = result => { + const handleLoad = (result) => { setHasResults(result[0].row_count !== 0); setIsReloading(false); }; @@ -82,7 +82,9 @@ export default function ErrorOverview(props) { { key: "reloadSelected", label: t`Rerun Selected`, - disabled: Object.values(rowChecked).every(isChecked => !isChecked), + disabled: Object.values(rowChecked).every( + (isChecked) => !isChecked, + ), onClick: handleReloadSelected, }, ]} diff --git a/enterprise/frontend/src/metabase-enterprise/troubleshooting/components/QueryValidator.tsx b/enterprise/frontend/src/metabase-enterprise/troubleshooting/components/QueryValidator.tsx index 2a2ecbcc68e..e8851df9ee2 100644 --- a/enterprise/frontend/src/metabase-enterprise/troubleshooting/components/QueryValidator.tsx +++ b/enterprise/frontend/src/metabase-enterprise/troubleshooting/components/QueryValidator.tsx @@ -107,14 +107,14 @@ export const QueryValidator = () => { const processedData: TableRow[] = useMemo( () => - invalidCards?.data.map(card => ({ + invalidCards?.data.map((card) => ({ name: card.name, created_by: card.creator?.common_name || "", collectionTooltip: getCollectionPathAsString(card.collection), collection_path: [ ...(card.collection?.effective_ancestors || []), card.collection, - ].map(c => getCollectionName(c)), + ].map((c) => getCollectionName(c)), error: formatErrorString(card.errors), last_edited_at: card.updated_at, id: card.id, @@ -154,7 +154,7 @@ export const QueryValidator = () => { className={S.table} columns={COLUMNS} rows={processedData} - rowRenderer={row => } + rowRenderer={(row) => } sortColumnName={sortColumn} sortDirection={sortDirection} onSort={(name, direction) => { diff --git a/enterprise/frontend/src/metabase-enterprise/troubleshooting/index.tsx b/enterprise/frontend/src/metabase-enterprise/troubleshooting/index.tsx index bff1b2c6cf4..5f48257c8ea 100644 --- a/enterprise/frontend/src/metabase-enterprise/troubleshooting/index.tsx +++ b/enterprise/frontend/src/metabase-enterprise/troubleshooting/index.tsx @@ -28,8 +28,8 @@ if (hasPremiumFeature("query_reference_validation")) { />, ]; - PLUGIN_ADMIN_SETTINGS_UPDATES.push(sections => - updateIn(sections, ["general", "settings"], settings => [ + PLUGIN_ADMIN_SETTINGS_UPDATES.push((sections) => + updateIn(sections, ["general", "settings"], (settings) => [ ...settings, { key: "query-analysis-enabled", diff --git a/enterprise/frontend/src/metabase-enterprise/troubleshooting/utils.ts b/enterprise/frontend/src/metabase-enterprise/troubleshooting/utils.ts index b7f4deed39e..d1edf9a9840 100644 --- a/enterprise/frontend/src/metabase-enterprise/troubleshooting/utils.ts +++ b/enterprise/frontend/src/metabase-enterprise/troubleshooting/utils.ts @@ -35,13 +35,13 @@ export const formatErrorString = (errors: CardError[]) => { const errorsByType = _.groupBy(errors, "type"); - errorTypes.forEach(errorType => { + errorTypes.forEach((errorType) => { if (errorsByType[errorType]) { const errorDef = ERROR_DICTIONARY[errorType]; messages.push( `${errorDef.entity} ${errorsByType[errorType] - .map(error => error[errorDef.messageProp]) + .map((error) => error[errorDef.messageProp]) .join(", ")} ${errorDef.problem}`, ); } diff --git a/enterprise/frontend/src/metabase-enterprise/upload_management/DeleteConfirmModal.tsx b/enterprise/frontend/src/metabase-enterprise/upload_management/DeleteConfirmModal.tsx index 7aac51dbc3a..8492de15292 100644 --- a/enterprise/frontend/src/metabase-enterprise/upload_management/DeleteConfirmModal.tsx +++ b/enterprise/frontend/src/metabase-enterprise/upload_management/DeleteConfirmModal.tsx @@ -48,7 +48,7 @@ export function DeleteConfirmModal({ `Also send all models and questions based on these tables to the trash`, tables.length, )} - onChange={e => setSendToTrash(e.target.checked)} + onChange={(e) => setSendToTrash(e.target.checked)} /> diff --git a/enterprise/frontend/src/metabase-enterprise/upload_management/UploadManagement.unit.spec.tsx b/enterprise/frontend/src/metabase-enterprise/upload_management/UploadManagement.unit.spec.tsx index 5b115316207..2088d1765ba 100644 --- a/enterprise/frontend/src/metabase-enterprise/upload_management/UploadManagement.unit.spec.tsx +++ b/enterprise/frontend/src/metabase-enterprise/upload_management/UploadManagement.unit.spec.tsx @@ -54,7 +54,7 @@ const setup = async () => { describe("uploadManagementTable", () => { it("should render a table with names", async () => { await setup(); - sampleTables.forEach(table => { + sampleTables.forEach((table) => { expect(screen.getByText(table.name)).toBeInTheDocument(); }); }); @@ -176,7 +176,7 @@ describe("uploadManagementTable", () => { await waitFor(() => expect(screen.queryByText("Delete")).not.toBeInTheDocument(), ); - expect(fetchMock.calls().map(call => call?.[1]?.method)).toEqual([ + expect(fetchMock.calls().map((call) => call?.[1]?.method)).toEqual([ "GET", "DELETE", "DELETE", diff --git a/enterprise/frontend/src/metabase-enterprise/upload_management/UploadManagementTable.tsx b/enterprise/frontend/src/metabase-enterprise/upload_management/UploadManagementTable.tsx index 4e6b5425e8a..86a225376a7 100644 --- a/enterprise/frontend/src/metabase-enterprise/upload_management/UploadManagementTable.tsx +++ b/enterprise/frontend/src/metabase-enterprise/upload_management/UploadManagementTable.tsx @@ -56,7 +56,7 @@ export function UploadManagementTable() { ); const selectedItemIds = useMemo( - () => new Set(selectedItems.map(item => item.id)), + () => new Set(selectedItems.map((item) => item.id)), [selectedItems], ); @@ -65,15 +65,15 @@ export function UploadManagementTable() { - setSelectedItems(prevItems => [...prevItems, newItem]) + onSelect={(newItem) => + setSelectedItems((prevItems) => [...prevItems, newItem]) } - onDeselect={newItem => - setSelectedItems(prevItems => - prevItems.filter(i => i.id !== newItem.id), + onDeselect={(newItem) => + setSelectedItems((prevItems) => + prevItems.filter((i) => i.id !== newItem.id), ) } - onTrash={item => { + onTrash={(item) => { setSelectedItems([item]); setShowDeleteConfirmModal(true); }} @@ -95,14 +95,14 @@ export function UploadManagementTable() { { + onConfirm={async (sendToTrash) => { const result = await Promise.all( - selectedItems.map(table => deleteTable(table, sendToTrash)), + selectedItems.map((table) => deleteTable(table, sendToTrash)), ); setShowDeleteConfirmModal(false); - if (result.some(result => "error" in result)) { + if (result.some((result) => "error" in result)) { const message = ngettext( msgid`Error deleting table`, `Error deleting tables`, @@ -145,7 +145,7 @@ export function UploadManagementTable() { data-testid="upload-tables-table" columns={columns} rows={uploadTables} - rowRenderer={row => renderRow(row)} + rowRenderer={(row) => renderRow(row)} /> ); @@ -172,7 +172,9 @@ const UploadTableRow = ({ (e.target.checked ? onSelect(item) : onDeselect(item))} + onChange={(e) => + e.target.checked ? onSelect(item) : onDeselect(item) + } /> diff --git a/enterprise/frontend/src/metabase-enterprise/user_provisioning/index.ts b/enterprise/frontend/src/metabase-enterprise/user_provisioning/index.ts index ef30edb48ae..b543aee9459 100644 --- a/enterprise/frontend/src/metabase-enterprise/user_provisioning/index.ts +++ b/enterprise/frontend/src/metabase-enterprise/user_provisioning/index.ts @@ -22,7 +22,7 @@ if (hasPremiumFeature("scim")) { to: "/admin/settings/authentication/api-keys", }); - PLUGIN_ADMIN_SETTINGS_UPDATES.push(sections => ({ + PLUGIN_ADMIN_SETTINGS_UPDATES.push((sections) => ({ ...sections, authentication: { ...sections.authentication, diff --git a/enterprise/frontend/src/metabase-enterprise/whitelabel/components/BrandColorSettings/BrandColorSettings.tsx b/enterprise/frontend/src/metabase-enterprise/whitelabel/components/BrandColorSettings/BrandColorSettings.tsx index 396c635191b..dff472c5ea1 100644 --- a/enterprise/frontend/src/metabase-enterprise/whitelabel/components/BrandColorSettings/BrandColorSettings.tsx +++ b/enterprise/frontend/src/metabase-enterprise/whitelabel/components/BrandColorSettings/BrandColorSettings.tsx @@ -74,7 +74,7 @@ const BrandColorTable = ({ - {options.map(option => ( + {options.map((option) => ( ) => { const groups = [ - _.times(8, i => [`accent${i}`]), - _.times(8, i => [`accent${i}`, `accent${i}-dark`]), - _.times(8, i => [`accent${i}`, `accent${i}-light`, `accent${i}-dark`]), + _.times(8, (i) => [`accent${i}`]), + _.times(8, (i) => [`accent${i}`, `accent${i}-dark`]), + _.times(8, (i) => [`accent${i}`, `accent${i}-light`, `accent${i}-dark`]), ]; - return groups.map(group => group.flat().map(name => color(name, palette))); + return groups.map((group) => + group.flat().map((name) => color(name, palette)), + ); }; diff --git a/enterprise/frontend/src/metabase-enterprise/whitelabel/components/ChartColorSample/ChartColorSample.tsx b/enterprise/frontend/src/metabase-enterprise/whitelabel/components/ChartColorSample/ChartColorSample.tsx index 8d273d21232..662aa3453dc 100644 --- a/enterprise/frontend/src/metabase-enterprise/whitelabel/components/ChartColorSample/ChartColorSample.tsx +++ b/enterprise/frontend/src/metabase-enterprise/whitelabel/components/ChartColorSample/ChartColorSample.tsx @@ -22,14 +22,14 @@ const ChartColorSample = ({ colorGroups, }: ChartColorSampleProps): JSX.Element => { const reversedGroups = useMemo( - () => colorGroups.map(group => [...group].reverse()), + () => colorGroups.map((group) => [...group].reverse()), [colorGroups], ); return ( - {_.times(TICK_COUNT, index => ( + {_.times(TICK_COUNT, (index) => ( ))} diff --git a/enterprise/frontend/src/metabase-enterprise/whitelabel/components/ChartColorSettings/ChartColorSettings.tsx b/enterprise/frontend/src/metabase-enterprise/whitelabel/components/ChartColorSettings/ChartColorSettings.tsx index a8057acd646..81f9a10260d 100644 --- a/enterprise/frontend/src/metabase-enterprise/whitelabel/components/ChartColorSettings/ChartColorSettings.tsx +++ b/enterprise/frontend/src/metabase-enterprise/whitelabel/components/ChartColorSettings/ChartColorSettings.tsx @@ -116,7 +116,7 @@ const ChartColorTable = ({ {colorGroups.map((colorGroup, index) => ( - {colorGroup.map(colorName => ( + {colorGroup.map((colorName) => ( { - return _.times(8, i => [`accent${i}`, `accent${i}-light`, `accent${i}-dark`]); + return _.times(8, (i) => [ + `accent${i}`, + `accent${i}-light`, + `accent${i}-dark`, + ]); }; export const getDefaultChartColors = ( @@ -16,7 +20,7 @@ export const hasCustomChartColors = ( values: Record, groups: string[][], ) => { - return _.flatten(groups).some(name => values[name] != null); + return _.flatten(groups).some((name) => values[name] != null); }; export const getAutoChartColors = ( @@ -26,7 +30,7 @@ export const getAutoChartColors = ( ) => { const oldColors = groups .map(([name]) => values[name]) - .map(value => (value ? Color(value) : undefined)); + .map((value) => (value ? Color(value) : undefined)); const fallbackColor = Color(palette["brand"]); const newColors = getAutoColors(oldColors, fallbackColor); @@ -42,7 +46,7 @@ const getAutoColors = ( oldColors: (Color | undefined)[], fallbackColor: Color, ) => { - const oldColor = oldColors.find(color => color != null); + const oldColor = oldColors.find((color) => color != null); const autoColors: Color[] = []; oldColors.forEach((_color, index) => { @@ -56,10 +60,10 @@ const getAutoColors = ( }); const availableColors = autoColors.filter( - newColor => !isSimilarToColors(newColor, oldColors), + (newColor) => !isSimilarToColors(newColor, oldColors), ); - return oldColors.map(color => (color ? color : availableColors.shift())); + return oldColors.map((color) => (color ? color : availableColors.shift())); }; const getNextColor = (color: Color) => { @@ -76,6 +80,6 @@ const isSimilarColor = (newColor: Color, oldColor: Color) => { const isSimilarToColors = (newColor: Color, colors: (Color | undefined)[]) => { return colors.some( - oldColor => oldColor && isSimilarColor(newColor, oldColor), + (oldColor) => oldColor && isSimilarColor(newColor, oldColor), ); }; diff --git a/enterprise/frontend/src/metabase-enterprise/whitelabel/components/ColorSettings/ColorSettings.styled.tsx b/enterprise/frontend/src/metabase-enterprise/whitelabel/components/ColorSettings/ColorSettings.styled.tsx index e0d3b06968f..8e5aabaeb1d 100644 --- a/enterprise/frontend/src/metabase-enterprise/whitelabel/components/ColorSettings/ColorSettings.styled.tsx +++ b/enterprise/frontend/src/metabase-enterprise/whitelabel/components/ColorSettings/ColorSettings.styled.tsx @@ -13,7 +13,7 @@ interface SettingTitleProps { export const SettingTitle = styled.div` color: var(--mb-color-text-medium); font-weight: bold; - margin-bottom: ${props => (props.hasDescription ? "0.5rem" : "1rem")}; + margin-bottom: ${(props) => (props.hasDescription ? "0.5rem" : "1rem")}; `; export const SettingDescription = styled.div` diff --git a/enterprise/frontend/src/metabase-enterprise/whitelabel/components/FontFilesWidget/FontFilesWidget.styled.tsx b/enterprise/frontend/src/metabase-enterprise/whitelabel/components/FontFilesWidget/FontFilesWidget.styled.tsx index e9452b1aeb2..93b46c774ab 100644 --- a/enterprise/frontend/src/metabase-enterprise/whitelabel/components/FontFilesWidget/FontFilesWidget.styled.tsx +++ b/enterprise/frontend/src/metabase-enterprise/whitelabel/components/FontFilesWidget/FontFilesWidget.styled.tsx @@ -67,7 +67,7 @@ export const TableBodyCell = styled.div` color: var(--mb-color-text-medium); padding-top: 1rem; padding-bottom: 1rem; - font-weight: ${props => props.fontWeight}; + font-weight: ${(props) => props.fontWeight}; `; export const TableBodyCellLabel = styled.span` diff --git a/enterprise/frontend/src/metabase-enterprise/whitelabel/components/FontFilesWidget/FontFilesWidget.tsx b/enterprise/frontend/src/metabase-enterprise/whitelabel/components/FontFilesWidget/FontFilesWidget.tsx index 59097c6e7b8..809a64edfb4 100644 --- a/enterprise/frontend/src/metabase-enterprise/whitelabel/components/FontFilesWidget/FontFilesWidget.tsx +++ b/enterprise/frontend/src/metabase-enterprise/whitelabel/components/FontFilesWidget/FontFilesWidget.tsx @@ -58,7 +58,7 @@ const FontFilesTable = ({ - {FONT_OPTIONS.map(option => ( + {FONT_OPTIONS.map((option) => ( => { return _.chain(files) - .indexBy(file => file.fontWeight) - .mapObject(file => file.src) + .indexBy((file) => file.fontWeight) + .mapObject((file) => file.src) .value(); }; export const getFontFiles = (urls: Record): FontFile[] => { - return FONT_OPTIONS.map(option => ({ src: urls[option.fontWeight], option })) + return FONT_OPTIONS.map((option) => ({ + src: urls[option.fontWeight], + option, + })) .filter(({ src }) => Boolean(src)) .map(({ src, option }) => getFontFile(src, option)); }; diff --git a/enterprise/frontend/src/metabase-enterprise/whitelabel/components/FontWidget/FontWidget.tsx b/enterprise/frontend/src/metabase-enterprise/whitelabel/components/FontWidget/FontWidget.tsx index 7a5186d4476..647bffdb0d1 100644 --- a/enterprise/frontend/src/metabase-enterprise/whitelabel/components/FontWidget/FontWidget.tsx +++ b/enterprise/frontend/src/metabase-enterprise/whitelabel/components/FontWidget/FontWidget.tsx @@ -29,7 +29,7 @@ const FontWidget = ({ const options = useMemo( () => [ - ...availableFonts.map(font => ({ label: font, value: font })), + ...availableFonts.map((font) => ({ label: font, value: font })), { label: t`Custom…`, value: CUSTOM }, ], [availableFonts], diff --git a/enterprise/frontend/src/metabase-enterprise/whitelabel/components/HelpLinkSettings/HelpLinkSettings.tsx b/enterprise/frontend/src/metabase-enterprise/whitelabel/components/HelpLinkSettings/HelpLinkSettings.tsx index da265f2f3d3..23fc8abe0b8 100644 --- a/enterprise/frontend/src/metabase-enterprise/whitelabel/components/HelpLinkSettings/HelpLinkSettings.tsx +++ b/enterprise/frontend/src/metabase-enterprise/whitelabel/components/HelpLinkSettings/HelpLinkSettings.tsx @@ -43,7 +43,7 @@ export const HelpLinkSettings = ({ const handleChange = async (value: string) => { if (value === "") { setError(t`This field can't be left empty.`); - } else if (!supportedPrefixes.some(prefix => value.startsWith(prefix))) { + } else if (!supportedPrefixes.some((prefix) => value.startsWith(prefix))) { setError(t`This needs to be an "http://", "https://" or "mailto:" URL.`); } else { setError(""); @@ -83,7 +83,7 @@ export const HelpLinkSettings = ({ onChange={() => setError(null)} aria-label={t`Help link custom destination`} placeholder={t`Enter a URL it should go to`} - onBlurChange={e => handleChange(e.target.value)} + onBlurChange={(e) => handleChange(e.target.value)} /> )} diff --git a/enterprise/frontend/src/metabase-enterprise/whitelabel/components/IllustrationWidget/IllustrationWidget.tsx b/enterprise/frontend/src/metabase-enterprise/whitelabel/components/IllustrationWidget/IllustrationWidget.tsx index d205d893e2e..fa2b4c9b2c1 100644 --- a/enterprise/frontend/src/metabase-enterprise/whitelabel/components/IllustrationWidget/IllustrationWidget.tsx +++ b/enterprise/frontend/src/metabase-enterprise/whitelabel/components/IllustrationWidget/IllustrationWidget.tsx @@ -106,7 +106,7 @@ export function IllustrationWidget({ } const reader = new FileReader(); - reader.onload = async readerEvent => { + reader.onload = async (readerEvent) => { const dataUri = readerEvent.target?.result as string; if (!(await isFileIntact(dataUri))) { setErrorMessage( @@ -211,7 +211,7 @@ export function IllustrationWidget({ } async function isFileIntact(dataUri: string) { - return new Promise(resolve => { + return new Promise((resolve) => { const image = document.createElement("img"); image.src = dataUri; image.onerror = () => resolve(false); diff --git a/enterprise/frontend/src/metabase-enterprise/whitelabel/components/ImageToggle/ImageToggle.tsx b/enterprise/frontend/src/metabase-enterprise/whitelabel/components/ImageToggle/ImageToggle.tsx index 63aa34a8859..bf229a0903f 100644 --- a/enterprise/frontend/src/metabase-enterprise/whitelabel/components/ImageToggle/ImageToggle.tsx +++ b/enterprise/frontend/src/metabase-enterprise/whitelabel/components/ImageToggle/ImageToggle.tsx @@ -34,7 +34,7 @@ export const ImageToggle = ({ id={toggleId} aria-checked={value} checked={value} - onChange={e => onChange(e.target.checked)} + onChange={(e) => onChange(e.target.checked)} /> diff --git a/enterprise/frontend/src/metabase-enterprise/whitelabel/components/ImageUpload/ImageUpload.jsx b/enterprise/frontend/src/metabase-enterprise/whitelabel/components/ImageUpload/ImageUpload.jsx index 75042aae2e8..d4ddee7d014 100644 --- a/enterprise/frontend/src/metabase-enterprise/whitelabel/components/ImageUpload/ImageUpload.jsx +++ b/enterprise/frontend/src/metabase-enterprise/whitelabel/components/ImageUpload/ImageUpload.jsx @@ -32,10 +32,10 @@ export const ImageUpload = ({ id, setting, onChange, ...props }) => { {window.File && window.FileReader ? ( { + onChange={(e) => { if (e.target.files.length > 0) { const reader = new FileReader(); - reader.onload = e => onChange(e.target.result); + reader.onload = (e) => onChange(e.target.result); reader.readAsDataURL(e.target.files[0]); } }} diff --git a/enterprise/frontend/src/metabase-enterprise/whitelabel/components/LandingPageWidget/LandingPageWidget.tsx b/enterprise/frontend/src/metabase-enterprise/whitelabel/components/LandingPageWidget/LandingPageWidget.tsx index d98cacb1db3..d0460297530 100644 --- a/enterprise/frontend/src/metabase-enterprise/whitelabel/components/LandingPageWidget/LandingPageWidget.tsx +++ b/enterprise/frontend/src/metabase-enterprise/whitelabel/components/LandingPageWidget/LandingPageWidget.tsx @@ -53,7 +53,7 @@ export function LandingPageWidget({ onChange, settingValues }: Props) { aria-label={t`Landing page custom destination`} data-testid="landing-page" placeholder="/" - onBlurChange={e => handleChange(e.target.value)} + onBlurChange={(e) => handleChange(e.target.value)} />
); diff --git a/enterprise/frontend/src/metabase-enterprise/whitelabel/components/LandingPageWidget/utils.unit.spec.ts b/enterprise/frontend/src/metabase-enterprise/whitelabel/components/LandingPageWidget/utils.unit.spec.ts index 4b216f41ddf..42f38f74257 100644 --- a/enterprise/frontend/src/metabase-enterprise/whitelabel/components/LandingPageWidget/utils.unit.spec.ts +++ b/enterprise/frontend/src/metabase-enterprise/whitelabel/components/LandingPageWidget/utils.unit.spec.ts @@ -28,7 +28,7 @@ describe("utils", () => { "https://localhost/test", "mailto:user@example.com", "file:///path/to/resource", - ].forEach(input => { + ].forEach((input) => { expect(getRelativeLandingPageUrl(input)).toStrictEqual({ isSameOrigin: false, relativeUrl: "", diff --git a/enterprise/frontend/src/metabase-enterprise/whitelabel/components/LogoIcon.jsx b/enterprise/frontend/src/metabase-enterprise/whitelabel/components/LogoIcon.jsx index 9afdab51d48..9ed7563d3bb 100644 --- a/enterprise/frontend/src/metabase-enterprise/whitelabel/components/LogoIcon.jsx +++ b/enterprise/frontend/src/metabase-enterprise/whitelabel/components/LogoIcon.jsx @@ -8,7 +8,7 @@ import { parseDataUri, removeAllChildren } from "metabase/lib/dom"; import { connect } from "metabase/lib/redux"; import { getLogoUrl } from "metabase-enterprise/settings/selectors"; -const mapStateToProps = state => ({ +const mapStateToProps = (state) => ({ url: getLogoUrl(state), }); @@ -124,7 +124,7 @@ class LogoIcon extends Component { style.height ||= "32px"; return ( (this._container = c)} + ref={(c) => (this._container = c)} className={cx( "Icon", CS.textCentered, diff --git a/enterprise/frontend/src/metabase-enterprise/whitelabel/components/MetabaseLinksToggleDescription.tsx b/enterprise/frontend/src/metabase-enterprise/whitelabel/components/MetabaseLinksToggleDescription.tsx index 8e51a78cd84..29394a7da07 100644 --- a/enterprise/frontend/src/metabase-enterprise/whitelabel/components/MetabaseLinksToggleDescription.tsx +++ b/enterprise/frontend/src/metabase-enterprise/whitelabel/components/MetabaseLinksToggleDescription.tsx @@ -23,7 +23,7 @@ export function MetabaseLinksToggleDescription() { style={{ userSelect: "none", cursor: "pointer" }} onClick={(event: MouseEvent) => { event.preventDefault(); - setOpened(opened => !opened); + setOpened((opened) => !opened); }} > {t`Learn more`} diff --git a/enterprise/frontend/src/metabase-enterprise/whitelabel/components/MetabaseLinksToggleWidget/MetabaseLinksToggleWidget.tsx b/enterprise/frontend/src/metabase-enterprise/whitelabel/components/MetabaseLinksToggleWidget/MetabaseLinksToggleWidget.tsx index 2334c66c403..844b8cd49fa 100644 --- a/enterprise/frontend/src/metabase-enterprise/whitelabel/components/MetabaseLinksToggleWidget/MetabaseLinksToggleWidget.tsx +++ b/enterprise/frontend/src/metabase-enterprise/whitelabel/components/MetabaseLinksToggleWidget/MetabaseLinksToggleWidget.tsx @@ -19,7 +19,7 @@ export function MetabaseLinksToggleWidget({ return ( onChange(e.target.checked)} + onChange={(e) => onChange(e.target.checked)} labelPosition="left" label={t`Show links and references`} size="sm" diff --git a/enterprise/frontend/src/metabase-enterprise/whitelabel/components/SwitchWidget/SwitchWidget.tsx b/enterprise/frontend/src/metabase-enterprise/whitelabel/components/SwitchWidget/SwitchWidget.tsx index ad945c58007..fc4e79e311f 100644 --- a/enterprise/frontend/src/metabase-enterprise/whitelabel/components/SwitchWidget/SwitchWidget.tsx +++ b/enterprise/frontend/src/metabase-enterprise/whitelabel/components/SwitchWidget/SwitchWidget.tsx @@ -19,7 +19,7 @@ export function SwitchWidget({ return ( onChange(e.target.checked)} + onChange={(e) => onChange(e.target.checked)} size="sm" {...props} /> diff --git a/enterprise/frontend/src/metabase-enterprise/whitelabel/index.js b/enterprise/frontend/src/metabase-enterprise/whitelabel/index.js index 49e9cd6c136..4db1c92be37 100644 --- a/enterprise/frontend/src/metabase-enterprise/whitelabel/index.js +++ b/enterprise/frontend/src/metabase-enterprise/whitelabel/index.js @@ -45,7 +45,7 @@ import { updateColors } from "./lib/whitelabel"; if (hasPremiumFeature("whitelabel")) { PLUGIN_LANDING_PAGE.push(() => MetabaseSettings.get("landing-page")); PLUGIN_ADMIN_SETTINGS_UPDATES.push( - sections => ({ + (sections) => ({ ...sections, whitelabel: { name: t`Appearance`, @@ -109,7 +109,7 @@ if (hasPremiumFeature("whitelabel")) { { key: "application-font-files", widget: FontFilesWidget, - getHidden: settings => settings["application-font-files"] == null, + getHidden: (settings) => settings["application-font-files"] == null, }, { key: "loading-message", @@ -284,10 +284,10 @@ if (hasPremiumFeature("whitelabel")) { ], }, }), - sections => { - return updateIn(sections, ["general", "settings"], settings => { + (sections) => { + return updateIn(sections, ["general", "settings"], (settings) => { const customHomepageIndex = settings.findIndex( - setting => setting.key === "custom-homepage-dashboard", + (setting) => setting.key === "custom-homepage-dashboard", ); return [ ...settings.slice(0, customHomepageIndex + 1), diff --git a/frontend/lint/eslint-rules/no-color-literals.js b/frontend/lint/eslint-rules/no-color-literals.js index 839bc9a1465..5b9e57a12a7 100755 --- a/frontend/lint/eslint-rules/no-color-literals.js +++ b/frontend/lint/eslint-rules/no-color-literals.js @@ -30,7 +30,9 @@ module.exports = { } }, TemplateLiteral(node) { - if (node.quasis.filter(q => COLOR_REGEX.test(q.value.raw)).length > 0) { + if ( + node.quasis.filter((q) => COLOR_REGEX.test(q.value.raw)).length > 0 + ) { context.report({ node, message: LINT_MESSAGE }); } }, diff --git a/frontend/lint/eslint-rules/no-direct-helper-import.js b/frontend/lint/eslint-rules/no-direct-helper-import.js index f8a197ab392..d7b232aca92 100644 --- a/frontend/lint/eslint-rules/no-direct-helper-import.js +++ b/frontend/lint/eslint-rules/no-direct-helper-import.js @@ -29,7 +29,7 @@ module.exports = { ImportDeclaration(node) { if (node.source.value === "e2e/support") { const hImportSpecifier = node.specifiers.find( - specifier => + (specifier) => specifier.type === "ImportSpecifier" && specifier.imported.name === "H", ); diff --git a/frontend/lint/eslint-rules/no-literal-metabase-strings.js b/frontend/lint/eslint-rules/no-literal-metabase-strings.js index ef5b2ba07ce..b99de7279e2 100644 --- a/frontend/lint/eslint-rules/no-literal-metabase-strings.js +++ b/frontend/lint/eslint-rules/no-literal-metabase-strings.js @@ -43,7 +43,7 @@ module.exports = { }, TemplateLiteral(node) { const quasis = node.quasis; - quasis.forEach(quasi => { + quasis.forEach((quasi) => { if (LITERAL_METABASE_STRING_REGEX.exec(quasi.value.raw)) { context.report({ node, @@ -69,7 +69,7 @@ module.exports = { /eslint-disable-next-line\s+no-literal-metabase-strings/; const ALLOWED_ESLINT_DISABLE_LINE_REGEX = /eslint-disable-next-line\s+no-literal-metabase-strings -- \w+/; - comments.forEach(comment => { + comments.forEach((comment) => { if (ESLINT_DISABLE_BLOCK_REGEX.exec(comment.value)) { const { start, end } = comment.loc; context.report({ diff --git a/frontend/lint/eslint-rules/no-unconditional-metabase-links-render.js b/frontend/lint/eslint-rules/no-unconditional-metabase-links-render.js index 3f44b835d85..2f1208420e8 100644 --- a/frontend/lint/eslint-rules/no-unconditional-metabase-links-render.js +++ b/frontend/lint/eslint-rules/no-unconditional-metabase-links-render.js @@ -70,13 +70,14 @@ module.exports = { const variables = context.getDeclaredVariables(node); if (isDefault) { return variables.find( - variable => variable.defs[0].node.type === "ImportDefaultSpecifier", + (variable) => + variable.defs[0].node.type === "ImportDefaultSpecifier", ); } // Named import return variables.find( - variable => + (variable) => variable.defs[0].node.type === "ImportSpecifier" && variable.name === named, ); @@ -135,7 +136,7 @@ module.exports = { const hasShowMetabaseLinksDestructured = parentDeclarationNode?.id?.properties?.some( - prop => prop.key.name === "showMetabaseLinks", + (prop) => prop.key.name === "showMetabaseLinks", ); if (!hasShowMetabaseLinksDestructured) { @@ -176,7 +177,7 @@ module.exports = { }, TemplateLiteral(node) { const quasis = node.quasis; - quasis.forEach(quasi => { + quasis.forEach((quasi) => { if ( LITERAL_METABASE_URL_REGEX.exec(quasi.value.raw) && !isGetShowMetabaseLinksSelectorImported @@ -197,7 +198,7 @@ module.exports = { /eslint-disable-next-line\s+no-unconditional-metabase-links-render/; const ALLOWED_ESLINT_DISABLE_LINE_REGEX = /eslint-disable-next-line\s+no-unconditional-metabase-links-render -- \w+/; - comments.forEach(comment => { + comments.forEach((comment) => { if (ESLINT_DISABLE_BLOCK_REGEX.exec(comment.value)) { const { start, end } = comment.loc; context.report({ diff --git a/frontend/lint/eslint-rules/no-unordered-test-helpers.js b/frontend/lint/eslint-rules/no-unordered-test-helpers.js index e0a5348e475..072a02324b3 100644 --- a/frontend/lint/eslint-rules/no-unordered-test-helpers.js +++ b/frontend/lint/eslint-rules/no-unordered-test-helpers.js @@ -42,7 +42,9 @@ module.exports = { if (node.callee.property.name === "restore") { currentScope.hasRestore = true; } else if (node.callee.property.name === "resetTestTable") { - const hasRestoreInHierarchy = stack.some(scope => scope.hasRestore); + const hasRestoreInHierarchy = stack.some( + (scope) => scope.hasRestore, + ); if (!hasRestoreInHierarchy) { context.report({ diff --git a/frontend/lint/eslint-rules/no-unsafe-element-filtering.js b/frontend/lint/eslint-rules/no-unsafe-element-filtering.js index a26aff208be..b4f2c1ae3ba 100644 --- a/frontend/lint/eslint-rules/no-unsafe-element-filtering.js +++ b/frontend/lint/eslint-rules/no-unsafe-element-filtering.js @@ -102,7 +102,7 @@ function isPreviousALengthAssertion(node) { "have.length.lt", "have.length.within", ]; - if (lengthAssertions.some(pattern => assertion === pattern)) { + if (lengthAssertions.some((pattern) => assertion === pattern)) { return true; } } diff --git a/frontend/lint/eslint-rules/no-unscoped-text-selectors.js b/frontend/lint/eslint-rules/no-unscoped-text-selectors.js index cbd201dba79..d21d00eecd2 100644 --- a/frontend/lint/eslint-rules/no-unscoped-text-selectors.js +++ b/frontend/lint/eslint-rules/no-unscoped-text-selectors.js @@ -21,7 +21,7 @@ Valid usage: }; } -const isTestBlock = node => { +const isTestBlock = (node) => { return ["it", "before", "beforeEach"].includes( // when it's a plain it() call, we look at the callee name node?.parent?.parent?.callee?.name ?? @@ -30,11 +30,11 @@ const isTestBlock = node => { ); }; -const hasDirectParentTestBlock = node => { +const hasDirectParentTestBlock = (node) => { return isTestBlock(findNearestBlockStatement(node)); }; -const findNearestBlockStatement = node => { +const findNearestBlockStatement = (node) => { if (!node?.parent) { return null; } @@ -44,7 +44,7 @@ const findNearestBlockStatement = node => { return findNearestBlockStatement(node.parent); }; -const isDirectlyChainedOffOfCy = node => { +const isDirectlyChainedOffOfCy = (node) => { // Check if it's directly chained off cy (cy.contains()) if (node.parent.object?.name === "cy") { return true; @@ -54,15 +54,15 @@ const isDirectlyChainedOffOfCy = node => { return false; }; -const isFindByText = node => { +const isFindByText = (node) => { return node.name === "findByText"; }; -const isContains = node => { +const isContains = (node) => { return node.name === "contains"; }; -const isBadFindByText = node => { +const isBadFindByText = (node) => { if (isFindByText(node) && isDirectlyChainedOffOfCy(node)) { return true; } diff --git a/frontend/lint/tests/no-literal-metabase-strings.unit.spec.js b/frontend/lint/tests/no-literal-metabase-strings.unit.spec.js index 55d890d2910..6a279c46fa6 100644 --- a/frontend/lint/tests/no-literal-metabase-strings.unit.spec.js +++ b/frontend/lint/tests/no-literal-metabase-strings.unit.spec.js @@ -142,7 +142,7 @@ const INVALID_CASES = [ ruleTester.run("no-literal-metabase-strings", noLiteralMetabaseString, { valid: VALID_CASES, - invalid: INVALID_CASES.map(invalidCase => { + invalid: INVALID_CASES.map((invalidCase) => { return { code: invalidCase.code, errors: [ diff --git a/frontend/lint/tests/no-locale-with-intl-functions.unit.spec.js b/frontend/lint/tests/no-locale-with-intl-functions.unit.spec.js index 1e9df2b81a7..42c073f3376 100644 --- a/frontend/lint/tests/no-locale-with-intl-functions.unit.spec.js +++ b/frontend/lint/tests/no-locale-with-intl-functions.unit.spec.js @@ -79,7 +79,7 @@ const INVALID_CASES = [ ruleTester.run("no-locale-with-intl-functions", noLocaleWithIntlFunctions, { valid: VALID_CASES, - invalid: INVALID_CASES.map(invalidCase => { + invalid: INVALID_CASES.map((invalidCase) => { return { code: invalidCase.code, errors: [ diff --git a/frontend/lint/tests/no-unconditional-metabase-links-render.unit.spec.js b/frontend/lint/tests/no-unconditional-metabase-links-render.unit.spec.js index fedce3ded6d..3ecf56b8b7f 100644 --- a/frontend/lint/tests/no-unconditional-metabase-links-render.unit.spec.js +++ b/frontend/lint/tests/no-unconditional-metabase-links-render.unit.spec.js @@ -190,7 +190,7 @@ ruleTester.run( noUnconditionalMetabaseLinksRender, { valid: VALID_CASES, - invalid: INVALID_CASES.map(invalidCase => { + invalid: INVALID_CASES.map((invalidCase) => { return { code: invalidCase.code, errors: [ diff --git a/frontend/lint/tests/no-unordered-test-helpers.unit.spec.js b/frontend/lint/tests/no-unordered-test-helpers.unit.spec.js index 85f6a7e29e7..fc72565f775 100644 --- a/frontend/lint/tests/no-unordered-test-helpers.unit.spec.js +++ b/frontend/lint/tests/no-unordered-test-helpers.unit.spec.js @@ -73,14 +73,14 @@ const invalidCases = [ ]; ruleTester.run("no-unordered-test-helpers", rule, { - valid: blockTypes.flatMap(blockType => - validCases.map(testCase => ({ + valid: blockTypes.flatMap((blockType) => + validCases.map((testCase) => ({ code: blockWrapper(testCase, blockType), })), ), - invalid: blockTypes.flatMap(blockType => - invalidCases.map(testCase => ({ + invalid: blockTypes.flatMap((blockType) => + invalidCases.map((testCase) => ({ code: blockWrapper(testCase, blockType), errors: [orderError], })), diff --git a/frontend/lint/tests/no-unsafe-element-filtering.unit.spec.js b/frontend/lint/tests/no-unsafe-element-filtering.unit.spec.js index a782c329215..8129ef499bd 100644 --- a/frontend/lint/tests/no-unsafe-element-filtering.unit.spec.js +++ b/frontend/lint/tests/no-unsafe-element-filtering.unit.spec.js @@ -44,14 +44,14 @@ const invalidCases = [ ]; ruleTester.run("no-unsafe-element-filtering", rule, { - valid: blockTypes.flatMap(blockType => - validCases.map(testCase => ({ + valid: blockTypes.flatMap((blockType) => + validCases.map((testCase) => ({ code: blockWrapper(testCase, blockType), })), ), - invalid: blockTypes.flatMap(blockType => - invalidCases.map(testCase => ({ + invalid: blockTypes.flatMap((blockType) => + invalidCases.map((testCase) => ({ code: blockWrapper(testCase, blockType), errors: [unsafeError], })), diff --git a/frontend/lint/tests/no-unscoped-text-selectors.unit.spec.js b/frontend/lint/tests/no-unscoped-text-selectors.unit.spec.js index 937b0a521ec..ce4a1cdecc1 100644 --- a/frontend/lint/tests/no-unscoped-text-selectors.unit.spec.js +++ b/frontend/lint/tests/no-unscoped-text-selectors.unit.spec.js @@ -48,14 +48,14 @@ const invalidCases = [ ]; ruleTester.run("no-unscoped-text-selectors", rule, { - valid: blockTypes.flatMap(blockType => - validCases.map(testCase => ({ + valid: blockTypes.flatMap((blockType) => + validCases.map((testCase) => ({ code: blockWrapper(testCase, blockType), })), ), - invalid: blockTypes.flatMap(blockType => - invalidCases.map(testCase => ({ + invalid: blockTypes.flatMap((blockType) => + invalidCases.map((testCase) => ({ code: blockWrapper(testCase, blockType), errors: [scopeError], })), diff --git a/frontend/parse-deps.js b/frontend/parse-deps.js index 091b40be3e2..1b8aeeb8597 100644 --- a/frontend/parse-deps.js +++ b/frontend/parse-deps.js @@ -24,7 +24,7 @@ function files() { } function dependencies() { - const deps = files().map(filename => { + const deps = files().map((filename) => { const contents = fs.readFileSync(filename, "utf-8"); const importList = []; @@ -58,7 +58,7 @@ function dependencies() { } const base = path.dirname(filename) + path.sep; const absoluteImportList = importList - .map(name => { + .map((name) => { const absName = name[0] === "." ? path.normalize(base + name) : name; const parts = absName.split(path.sep); const realPath = ALIAS[parts[0]]; @@ -67,7 +67,7 @@ function dependencies() { return realName; }) .map(getFilePathFromImportPath) - .filter(name => minimatch(name, PATTERN)); + .filter((name) => minimatch(name, PATTERN)); return { source: filename, dependencies: absoluteImportList.sort() }; }); @@ -101,9 +101,9 @@ function getFilePathFromImportPath(name) { function dependents() { const dependents = {}; - dependencies().forEach(dep => { + dependencies().forEach((dep) => { const { source, dependencies } = dep; - dependencies.forEach(d => { + dependencies.forEach((d) => { if (!dependents[d]) { dependents[d] = []; } @@ -117,7 +117,7 @@ function getDependents(sources) { const allDependents = dependents(); const filteredDependents = []; - sources.forEach(name => { + sources.forEach((name) => { const list = allDependents[name]; if (list && Array.isArray(list) && list.length > 0) { filteredDependents.push(...list); @@ -162,7 +162,9 @@ function filterAllDependents() { const name = filteredDependents[i]; const list = allDependents[name]; if (list && Array.isArray(list) && list.length > 0) { - const newAddition = list.filter(e => filteredDependents.indexOf(e) < 0); + const newAddition = list.filter( + (e) => filteredDependents.indexOf(e) < 0, + ); filteredDependents.push(...newAddition); } } @@ -174,7 +176,7 @@ function filterAllDependents() { function countDependents() { const allDependents = dependents(); const sources = Object.keys(allDependents).sort(); - const tally = sources.map(name => { + const tally = sources.map((name) => { return { name, count: allDependents[name].length }; }); console.log(tally.map(({ name, count }) => `${count} ${name}`).join("\n")); @@ -183,12 +185,12 @@ function countDependents() { function countAllDependents() { const allDependents = dependents(); const sources = Object.keys(allDependents).sort(); - const tally = sources.map(name => { + const tally = sources.map((name) => { const list = allDependents[name]; for (let i = 0; i < list.length; ++i) { const deps = allDependents[list[i]]; if (deps && Array.isArray(deps) && deps.length > 1) { - const newAddition = deps.filter(e => list.indexOf(e) < 0); + const newAddition = deps.filter((e) => list.indexOf(e) < 0); list.push(...newAddition); } } @@ -200,10 +202,10 @@ function countAllDependents() { function matrix() { const allDependents = dependents(); const sources = Object.keys(allDependents).sort(); - const width = Math.max(...sources.map(s => s.length)); - const rows = sources.map(name => { + const width = Math.max(...sources.map((s) => s.length)); + const rows = sources.map((name) => { const list = allDependents[name]; - const checks = sources.map(dep => (list.indexOf(dep) < 0 ? " " : "x")); + const checks = sources.map((dep) => (list.indexOf(dep) < 0 ? " " : "x")); return name.padEnd(width) + " | " + checks.join(""); }); console.log(rows.join("\n")); diff --git a/frontend/src/metabase-lib/aggregation.ts b/frontend/src/metabase-lib/aggregation.ts index 6a2b329cd60..f8d8329f88f 100644 --- a/frontend/src/metabase-lib/aggregation.ts +++ b/frontend/src/metabase-lib/aggregation.ts @@ -39,7 +39,7 @@ export function aggregate( export function aggregateByCount(query: Query, stageIndex: number): Query { const operators = availableAggregationOperators(query, stageIndex); - const countOperator = operators.find(operator => { + const countOperator = operators.find((operator) => { const info = displayInfo(query, stageIndex, operator); return info.shortName === "count"; }); diff --git a/frontend/src/metabase-lib/binning.ts b/frontend/src/metabase-lib/binning.ts index 6458e40ee1a..5551a0ed991 100644 --- a/frontend/src/metabase-lib/binning.ts +++ b/frontend/src/metabase-lib/binning.ts @@ -37,7 +37,7 @@ export function withDefaultBinning( ): ColumnMetadata { const buckets = availableBinningStrategies(query, stageIndex, column); const defaultBucket = buckets.find( - bucket => displayInfo(query, stageIndex, bucket).default, + (bucket) => displayInfo(query, stageIndex, bucket).default, ); return defaultBucket ? withBinning(column, defaultBucket) : column; } diff --git a/frontend/src/metabase-lib/breakout.ts b/frontend/src/metabase-lib/breakout.ts index dd22db540ee..b3b776af68b 100644 --- a/frontend/src/metabase-lib/breakout.ts +++ b/frontend/src/metabase-lib/breakout.ts @@ -29,7 +29,7 @@ export function replaceBreakouts( ) { let nextQuery = query; - breakouts(query, stageIndex).forEach(clause => { + breakouts(query, stageIndex).forEach((clause) => { nextQuery = removeClause(nextQuery, stageIndex, clause); }); diff --git a/frontend/src/metabase-lib/comparison.unit.spec.ts b/frontend/src/metabase-lib/comparison.unit.spec.ts index 964912208dc..dfb846c9c00 100644 --- a/frontend/src/metabase-lib/comparison.unit.spec.ts +++ b/frontend/src/metabase-lib/comparison.unit.spec.ts @@ -25,7 +25,7 @@ describe("findColumnIndexesFromLegacyRefs", () => { query, stageIndex, columns, - columns.map(column => Lib.legacyRef(query, stageIndex, column)), + columns.map((column) => Lib.legacyRef(query, stageIndex, column)), ); expect(columnIndexes).toEqual([0, 1]); }); @@ -50,7 +50,7 @@ describe("findColumnIndexesFromLegacyRefs", () => { query, stageIndex, columns, - columns.map(column => Lib.legacyRef(query, stageIndex, column)), + columns.map((column) => Lib.legacyRef(query, stageIndex, column)), ); expect(columnIndexes).toEqual([0, 1]); }); diff --git a/frontend/src/metabase-lib/extractions.ts b/frontend/src/metabase-lib/extractions.ts index 8e0e35c40fa..90e2880a3bc 100644 --- a/frontend/src/metabase-lib/extractions.ts +++ b/frontend/src/metabase-lib/extractions.ts @@ -74,7 +74,7 @@ export function functionsUsedByExtraction( function walk(parts: ExpressionParts): string[] { const res: string[] = [parts.operator]; - parts.args.forEach(arg => { + parts.args.forEach((arg) => { if (isExpressionParts(arg)) { res.push(...walk(arg)); } diff --git a/frontend/src/metabase-lib/filter.ts b/frontend/src/metabase-lib/filter.ts index 2961dcdf51e..602b753380a 100644 --- a/frontend/src/metabase-lib/filter.ts +++ b/frontend/src/metabase-lib/filter.ts @@ -139,7 +139,7 @@ export function specificDateFilterClause({ return ML.specific_date_filter_clause( operator, column, - values.map(value => moment(value)), + values.map((value) => moment(value)), hasTime, ); } @@ -216,7 +216,7 @@ export function timeFilterClause({ return ML.time_filter_clause( operator, column, - values.map(value => moment(value)), + values.map((value) => moment(value)), ); } diff --git a/frontend/src/metabase-lib/join.ts b/frontend/src/metabase-lib/join.ts index 74a247253bb..f8abff1a36e 100644 --- a/frontend/src/metabase-lib/join.ts +++ b/frontend/src/metabase-lib/join.ts @@ -98,7 +98,7 @@ export function joinConditionParts( stageIndex, lhsColumn, rhsColumn, - ).find(op => displayInfo(query, stageIndex, op).shortName === operatorName); + ).find((op) => displayInfo(query, stageIndex, op).shortName === operatorName); if (!operator) { throw new TypeError("Unexpected join condition"); diff --git a/frontend/src/metabase-lib/temporal_bucket.ts b/frontend/src/metabase-lib/temporal_bucket.ts index d457f8f20a1..70deef42b54 100644 --- a/frontend/src/metabase-lib/temporal_bucket.ts +++ b/frontend/src/metabase-lib/temporal_bucket.ts @@ -47,7 +47,7 @@ export function defaultTemporalBucket( ): Bucket | null { const buckets = availableTemporalBuckets(query, stageIndex, column); const defaultBucket = buckets.find( - bucket => displayInfo(query, stageIndex, bucket).default, + (bucket) => displayInfo(query, stageIndex, bucket).default, ); return defaultBucket ?? null; diff --git a/frontend/src/metabase-lib/test-helpers.ts b/frontend/src/metabase-lib/test-helpers.ts index 2451c2829c2..92a203f71f1 100644 --- a/frontend/src/metabase-lib/test-helpers.ts +++ b/frontend/src/metabase-lib/test-helpers.ts @@ -60,7 +60,7 @@ export const columnFinder = tableName: string | undefined | null, columnName: string, ): Lib.ColumnMetadata => { - const column = columns.find(column => { + const column = columns.find((column) => { const displayInfo = Lib.displayInfo(query, 0, column); // for non-table columns - aggregations, custom columns @@ -90,7 +90,7 @@ export const findBinningStrategy = ( } const buckets = Lib.availableBinningStrategies(query, 0, column); const bucket = buckets.find( - bucket => Lib.displayInfo(query, 0, bucket).displayName === bucketName, + (bucket) => Lib.displayInfo(query, 0, bucket).displayName === bucketName, ); if (!bucket) { throw new Error(`Could not find binning strategy ${bucketName}`); @@ -109,7 +109,7 @@ export const findTemporalBucket = ( const buckets = Lib.availableTemporalBuckets(query, 0, column); const bucket = buckets.find( - bucket => Lib.displayInfo(query, 0, bucket).displayName === bucketName, + (bucket) => Lib.displayInfo(query, 0, bucket).displayName === bucketName, ); if (!bucket) { throw new Error(`Could not find temporal bucket ${bucketName}`); @@ -123,7 +123,7 @@ export const findAggregationOperator = ( ) => { const operators = Lib.availableAggregationOperators(query, 0); const operator = operators.find( - operator => + (operator) => Lib.displayInfo(query, 0, operator).shortName === operatorShortName, ); if (!operator) { @@ -135,7 +135,7 @@ export const findAggregationOperator = ( export const findSegment = (query: Lib.Query, segmentName: string) => { const stageIndex = 0; const segment = Lib.availableSegments(query, stageIndex).find( - segment => + (segment) => Lib.displayInfo(query, stageIndex, segment).displayName === segmentName, ); if (!segment) { @@ -276,7 +276,7 @@ export const queryDrillThru = ( clickObject.data, clickObject.dimensions, ); - const drill = drills.find(drill => { + const drill = drills.find((drill) => { const drillInfo = Lib.displayInfo(query, stageIndex, drill); return drillInfo.type === drillType; }); @@ -320,7 +320,7 @@ export const getJoinQueryHelpers = ( ); const defaultStrategy = Lib.availableJoinStrategies(query, stageIndex).find( - strategy => Lib.displayInfo(query, stageIndex, strategy).default, + (strategy) => Lib.displayInfo(query, stageIndex, strategy).default, ); if (!defaultStrategy) { @@ -328,7 +328,7 @@ export const getJoinQueryHelpers = ( } const defaultOperator = Lib.joinConditionOperators(query, stageIndex).find( - operator => Lib.displayInfo(query, stageIndex, operator).default, + (operator) => Lib.displayInfo(query, stageIndex, operator).default, ); if (!defaultOperator) { diff --git a/frontend/src/metabase-lib/v1/DimensionOptions/DimensionOptions.ts b/frontend/src/metabase-lib/v1/DimensionOptions/DimensionOptions.ts index ac0e2da11f0..e052172d9d1 100644 --- a/frontend/src/metabase-lib/v1/DimensionOptions/DimensionOptions.ts +++ b/frontend/src/metabase-lib/v1/DimensionOptions/DimensionOptions.ts @@ -20,7 +20,7 @@ export default class DimensionOptions { all(): TemplateTagDimension[] { const dimensions = this.dimensions; - const fksDimensions = this.fks.map(fk => fk.dimensions).flat(); + const fksDimensions = this.fks.map((fk) => fk.dimensions).flat(); return [...dimensions, ...fksDimensions]; } @@ -33,16 +33,16 @@ export default class DimensionOptions { icon: this.icon || "table", items: [ ...extraItems, - ...this.dimensions.map(dimension => ({ + ...this.dimensions.map((dimension) => ({ dimension, })), ], }; - const sections: DimensionOptionsSection[] = this.fks.map(fk => ({ + const sections: DimensionOptionsSection[] = this.fks.map((fk) => ({ name: fk.name || (fk.field && fk.field.targetObjectName()), icon: fk.icon || "connections", - items: fk.dimensions.map(dimension => ({ + items: fk.dimensions.map((dimension) => ({ dimension, })), })); diff --git a/frontend/src/metabase-lib/v1/Question.ts b/frontend/src/metabase-lib/v1/Question.ts index 1af3fae4ea4..daf17f93b95 100644 --- a/frontend/src/metabase-lib/v1/Question.ts +++ b/frontend/src/metabase-lib/v1/Question.ts @@ -365,7 +365,7 @@ class Question { const table = this.metadata().table(sourceTableId); const hasSinglePk = - table?.fields?.filter(field => field.isPK())?.length === 1; + table?.fields?.filter((field) => field.isPK())?.length === 1; const { isNative } = Lib.queryDisplayInfo(this.query()); return !isNative && !Lib.hasClauses(query, -1) && hasSinglePk; @@ -593,7 +593,7 @@ class Question { setResultMetadataDiff(metadataDiff: Record>) { const metadata = this.getResultMetadata(); - const newMetadata = metadata.map(column => { + const newMetadata = metadata.map((column) => { const columnDiff = metadataDiff[column.name]; return columnDiff ? { ...column, ...columnDiff } : column; }); @@ -632,7 +632,7 @@ class Question { } setParameter(id: ParameterId, parameter: ParameterObject) { - const newParameters = this.parameters().map(oldParameter => + const newParameters = this.parameters().map((oldParameter) => oldParameter.id === id ? parameter : oldParameter, ); @@ -695,7 +695,7 @@ class Question { } isDirtyComparedToWithoutParameters(originalQuestion: Question) { - const [a, b] = [this, originalQuestion].map(q => { + const [a, b] = [this, originalQuestion].map((q) => { return ( q && new Question(q.card(), this.metadata()) diff --git a/frontend/src/metabase-lib/v1/expressions/complete/aggregations.ts b/frontend/src/metabase-lib/v1/expressions/complete/aggregations.ts index fcfbce3eb78..5a026ba40e7 100644 --- a/frontend/src/metabase-lib/v1/expressions/complete/aggregations.ts +++ b/frontend/src/metabase-lib/v1/expressions/complete/aggregations.ts @@ -35,9 +35,9 @@ export function suggestAggregations({ const database = getDatabase(query, metadata); const aggregations = Array.from(AGGREGATION_FUNCTIONS) - .map(name => MBQL_CLAUSES[name]) - .filter(clause => clause && database?.hasFeature(clause.requiresFeature)) - .map(agg => + .map((name) => MBQL_CLAUSES[name]) + .filter((clause) => clause && database?.hasFeature(clause.requiresFeature)) + .map((agg) => expressionClauseCompletion(agg, { type: "aggregation", database, @@ -57,7 +57,7 @@ export function suggestAggregations({ // do not expand template if the next token is a ( const next = tokenAtPos(source, token.end + 1); - const options = matcher(content(source, token)).map(option => ({ + const options = matcher(content(source, token)).map((option) => ({ ...option, apply: next?.type === TOKEN.Operator && next.op === "(" diff --git a/frontend/src/metabase-lib/v1/expressions/complete/aggregations.unit.spec.ts b/frontend/src/metabase-lib/v1/expressions/complete/aggregations.unit.spec.ts index ebe12843986..7668d79a959 100644 --- a/frontend/src/metabase-lib/v1/expressions/complete/aggregations.unit.spec.ts +++ b/frontend/src/metabase-lib/v1/expressions/complete/aggregations.unit.spec.ts @@ -109,7 +109,7 @@ describe("suggestAggregations", () => { const RESULTS_NO_TEMPLATE = { ...RESULTS, - options: RESULTS.options.map(option => ({ + options: RESULTS.options.map((option) => ({ ...option, apply: undefined, })), diff --git a/frontend/src/metabase-lib/v1/expressions/complete/fields.ts b/frontend/src/metabase-lib/v1/expressions/complete/fields.ts index cd2b55f24e4..6e08e7242e0 100644 --- a/frontend/src/metabase-lib/v1/expressions/complete/fields.ts +++ b/frontend/src/metabase-lib/v1/expressions/complete/fields.ts @@ -20,7 +20,7 @@ export function suggestFields({ query, stageIndex, expressionIndex }: Options) { query, stageIndex, expressionIndex, - )?.map(column => { + )?.map((column) => { const displayInfo = Lib.displayInfo(query, stageIndex, column); return { type: "field", diff --git a/frontend/src/metabase-lib/v1/expressions/complete/functions.ts b/frontend/src/metabase-lib/v1/expressions/complete/functions.ts index 921c06b729e..b353d41d2eb 100644 --- a/frontend/src/metabase-lib/v1/expressions/complete/functions.ts +++ b/frontend/src/metabase-lib/v1/expressions/complete/functions.ts @@ -36,15 +36,15 @@ export function suggestFunctions({ const database = getDatabase(query, metadata); const functions = [...EXPRESSION_FUNCTIONS] - .map(name => MBQL_CLAUSES[name]) - .filter(clause => clause && database?.hasFeature(clause.requiresFeature)) + .map((name) => MBQL_CLAUSES[name]) + .filter((clause) => clause && database?.hasFeature(clause.requiresFeature)) .filter(function disableOffsetInFilterExpressions(clause) { const isOffset = clause.name === "offset"; const isFilterExpression = startRule === "boolean"; const isOffsetInFilterExpression = isOffset && isFilterExpression; return !isOffsetInFilterExpression; }) - .map(func => + .map((func) => expressionClauseCompletion(func, { type: "function", database, @@ -68,7 +68,7 @@ export function suggestFunctions({ // do not expand template if the next token is a ( const next = tokenAtPos(source, token.end + 1); - const options = matcher(content(source, token)).map(option => ({ + const options = matcher(content(source, token)).map((option) => ({ ...option, apply: next?.type === TOKEN.Operator && next.op === "(" diff --git a/frontend/src/metabase-lib/v1/expressions/complete/functions.unit.spec.ts b/frontend/src/metabase-lib/v1/expressions/complete/functions.unit.spec.ts index a021a88574a..139944fc195 100644 --- a/frontend/src/metabase-lib/v1/expressions/complete/functions.unit.spec.ts +++ b/frontend/src/metabase-lib/v1/expressions/complete/functions.unit.spec.ts @@ -126,7 +126,7 @@ describe("suggestFunctions", () => { const RESULTS_NO_TEMPLATE = { ...RESULTS, - options: RESULTS.options.map(option => ({ + options: RESULTS.options.map((option) => ({ ...option, apply: undefined, })), @@ -177,7 +177,7 @@ describe("suggestFunctions", () => { const completer = setup({ startRule }); const results = await completer("offse|"); const options = results?.options.filter( - option => option.label === "offset", + (option) => option.label === "offset", ); expect(options).toEqual([]); }); @@ -186,7 +186,7 @@ describe("suggestFunctions", () => { const completer = setup({ startRule }); const results = await completer("cas|"); const options = results?.options.filter( - option => option.label === "case", + (option) => option.label === "case", ); expect(options).toEqual([ { @@ -209,7 +209,7 @@ describe("suggestFunctions", () => { }); const results = await completer("rege|"); expect( - results?.options.find(option => option.label === "regexextract"), + results?.options.find((option) => option.label === "regexextract"), ).toBe(undefined); }); @@ -220,7 +220,7 @@ describe("suggestFunctions", () => { }); const results = await completer("rege|"); expect( - results?.options.find(option => option.label === "regexextract"), + results?.options.find((option) => option.label === "regexextract"), ).toEqual({ label: "regexextract", displayLabel: "regexextract", @@ -269,7 +269,7 @@ describe("suggestFunctions", () => { it("should complete functions whose name starts with the an operator name as a prefix (metabase#55686)", async () => { const completer = setup({ startRule: "expression" }); const results = await completer("not|"); - expect(results?.options.map(result => result.displayLabel)).toEqual([ + expect(results?.options.map((result) => result.displayLabel)).toEqual([ "notIn", "notnull", "notempty", diff --git a/frontend/src/metabase-lib/v1/expressions/complete/metrics.ts b/frontend/src/metabase-lib/v1/expressions/complete/metrics.ts index 0915030dced..499737b0e04 100644 --- a/frontend/src/metabase-lib/v1/expressions/complete/metrics.ts +++ b/frontend/src/metabase-lib/v1/expressions/complete/metrics.ts @@ -13,7 +13,7 @@ export type Options = { }; export function suggestMetrics({ startRule, query, stageIndex }: Options) { - const metrics = Lib.availableMetrics(query, stageIndex)?.map(metric => { + const metrics = Lib.availableMetrics(query, stageIndex)?.map((metric) => { const displayInfo = Lib.displayInfo(query, stageIndex, metric); return { type: "metric", diff --git a/frontend/src/metabase-lib/v1/expressions/complete/segments.ts b/frontend/src/metabase-lib/v1/expressions/complete/segments.ts index 79593093b26..6e2bc32dae6 100644 --- a/frontend/src/metabase-lib/v1/expressions/complete/segments.ts +++ b/frontend/src/metabase-lib/v1/expressions/complete/segments.ts @@ -12,7 +12,7 @@ export type Options = { }; export function suggestSegments({ query, stageIndex }: Options) { - const segments = Lib.availableSegments(query, stageIndex)?.map(segment => { + const segments = Lib.availableSegments(query, stageIndex)?.map((segment) => { const displayInfo = Lib.displayInfo(query, stageIndex, segment); return { type: "segment", diff --git a/frontend/src/metabase-lib/v1/expressions/complete/util.ts b/frontend/src/metabase-lib/v1/expressions/complete/util.ts index 15283d3bbeb..a2ffd1fb724 100644 --- a/frontend/src/metabase-lib/v1/expressions/complete/util.ts +++ b/frontend/src/metabase-lib/v1/expressions/complete/util.ts @@ -55,8 +55,8 @@ const suggestionText = (func: MBQLClauseFunctionConfig) => { function getSnippet(helpText: HelpText) { const args = helpText.args - ?.filter(arg => arg.name !== "…") - ?.map(arg => "${" + arg.name + "}") + ?.filter((arg) => arg.name !== "…") + ?.map((arg) => "${" + arg.name + "}") .join(", "); if (!args || args.length < 1) { @@ -80,9 +80,9 @@ export function fuzzyMatcher(options: Completion[]) { .search(word) // .filter(result => (result.score ?? 0) <= 1) .sort((a, b) => (a.score ?? 0) - (b.score ?? 0)) - .map(result => { + .map((result) => { result.item.matches = - result.matches?.flatMap(match => match.indices) ?? []; + result.matches?.flatMap((match) => match.indices) ?? []; return result.item; }) ); @@ -92,7 +92,9 @@ export function fuzzyMatcher(options: Completion[]) { export function tokenAtPos(source: string, pos: number): Token | null { const { tokens } = tokenize(source); - const idx = tokens.findIndex(token => token.start <= pos && token.end >= pos); + const idx = tokens.findIndex( + (token) => token.start <= pos && token.end >= pos, + ); if (idx === -1) { return null; } diff --git a/frontend/src/metabase-lib/v1/expressions/formatter/formatter.ts b/frontend/src/metabase-lib/v1/expressions/formatter/formatter.ts index 2c9b66cb2cd..917b6fe9bd6 100644 --- a/frontend/src/metabase-lib/v1/expressions/formatter/formatter.ts +++ b/frontend/src/metabase-lib/v1/expressions/formatter/formatter.ts @@ -208,7 +208,7 @@ function formatMetric(path: AstPath, options: FormatOptions): Doc { throw new Error("`query` is a required parameter to format expressions"); } - const metric = Lib.availableMetrics(query, stageIndex).find(metric => { + const metric = Lib.availableMetrics(query, stageIndex).find((metric) => { const [_type, availableMetricId] = Lib.legacyRef(query, stageIndex, metric); return availableMetricId === metricId; }); @@ -229,7 +229,7 @@ function formatSegment(path: AstPath, options: FormatOptions) { } const [, segmentId] = path.node; - const segment = Lib.availableSegments(query, stageIndex).find(segment => { + const segment = Lib.availableSegments(query, stageIndex).find((segment) => { const [_type, availableSegmentId] = Lib.legacyRef( query, stageIndex, diff --git a/frontend/src/metabase-lib/v1/expressions/helper-text-strings.ts b/frontend/src/metabase-lib/v1/expressions/helper-text-strings.ts index fae09392755..2d781c5ccd8 100644 --- a/frontend/src/metabase-lib/v1/expressions/helper-text-strings.ts +++ b/frontend/src/metabase-lib/v1/expressions/helper-text-strings.ts @@ -1388,7 +1388,7 @@ export const getHelpText = ( database: Database, reportTimezone?: string, ): HelpText | undefined => { - const helperTextConfig = HELPER_TEXT_STRINGS.find(h => h.name === name); + const helperTextConfig = HELPER_TEXT_STRINGS.find((h) => h.name === name); if (!helperTextConfig) { return; @@ -1428,5 +1428,5 @@ export const getHelpDocsUrl = ({ docsPage }: HelpText): string => { export const getFunctionByStructure = (structure: string) => HELPER_TEXT_STRINGS.find( - h => h.structure.toLowerCase() === structure.toLowerCase(), + (h) => h.structure.toLowerCase() === structure.toLowerCase(), )?.name; diff --git a/frontend/src/metabase-lib/v1/expressions/helper-text-strings.unit.spec.ts b/frontend/src/metabase-lib/v1/expressions/helper-text-strings.unit.spec.ts index 05b66f1452b..31e3fd708cb 100644 --- a/frontend/src/metabase-lib/v1/expressions/helper-text-strings.unit.spec.ts +++ b/frontend/src/metabase-lib/v1/expressions/helper-text-strings.unit.spec.ts @@ -81,7 +81,7 @@ describe("getHelpText", () => { getHelpText("datetime-diff", database, reportTimezone), ); const unitArg = checkNotNull( - helpText.args?.find(arg => arg.name === "unit"), + helpText.args?.find((arg) => arg.name === "unit"), ); expect(unitArg.description).toContain("second"); expect(unitArg.description).not.toContain("millisecond"); diff --git a/frontend/src/metabase-lib/v1/expressions/identifier.ts b/frontend/src/metabase-lib/v1/expressions/identifier.ts index 11363cf647d..160c886a9a2 100644 --- a/frontend/src/metabase-lib/v1/expressions/identifier.ts +++ b/frontend/src/metabase-lib/v1/expressions/identifier.ts @@ -29,7 +29,7 @@ export function parseMetric( ) { const metrics = Lib.availableMetrics(query, stageIndex); - const metric = metrics.find(metric => { + const metric = metrics.find((metric) => { const displayInfo = Lib.displayInfo(query, stageIndex, metric); return displayInfo.displayName.toLowerCase() === metricName.toLowerCase(); @@ -55,7 +55,7 @@ export function parseSegment( expressionIndex, }: { query: Lib.Query; stageIndex: number; expressionIndex?: number }, ) { - const segment = Lib.availableSegments(query, stageIndex).find(segment => { + const segment = Lib.availableSegments(query, stageIndex).find((segment) => { const displayInfo = Lib.displayInfo(query, stageIndex, segment); return displayInfo.displayName.toLowerCase() === segmentName.toLowerCase(); @@ -69,7 +69,7 @@ export function parseSegment( query, stageIndex, expressionIndex, - ).find(field => { + ).find((field) => { const displayInfo = Lib.displayInfo(query, stageIndex, field); return displayInfo.name.toLowerCase() === segmentName.toLowerCase(); }); @@ -101,7 +101,7 @@ export function parseDimension( }, ) { return getAvailableDimensions(options).find(({ info }) => { - return EDITOR_FK_SYMBOLS.symbols.some(separator => { + return EDITOR_FK_SYMBOLS.symbols.some((separator) => { const displayName = getDisplayNameWithSeparator( info.longDisplayName, separator, @@ -127,7 +127,7 @@ function getAvailableDimensions({ query, stageIndex, expressionIndex, - ).map(dimension => { + ).map((dimension) => { return { dimension, info: Lib.displayInfo(query, stageIndex, dimension), @@ -137,7 +137,7 @@ function getAvailableDimensions({ if (startRule === "aggregation") { return [ ...results, - ...Lib.availableMetrics(query, stageIndex).map(dimension => { + ...Lib.availableMetrics(query, stageIndex).map((dimension) => { return { dimension, info: Lib.displayInfo(query, stageIndex, dimension), diff --git a/frontend/src/metabase-lib/v1/expressions/matchers.ts b/frontend/src/metabase-lib/v1/expressions/matchers.ts index 6150e982bca..49d856a4f2e 100644 --- a/frontend/src/metabase-lib/v1/expressions/matchers.ts +++ b/frontend/src/metabase-lib/v1/expressions/matchers.ts @@ -61,7 +61,7 @@ export function isOperator(expr: unknown): expr is CallExpression { return ( Array.isArray(expr) && OPERATORS.has(expr[0]) && - expr.slice(1).every(arg => isExpression(arg) || isOptionsObject(arg)) + expr.slice(1).every((arg) => isExpression(arg) || isOptionsObject(arg)) ); } @@ -73,7 +73,7 @@ export function isFunction(expr: unknown): expr is CallExpression { return ( Array.isArray(expr) && FUNCTIONS.has(expr[0]) && - expr.slice(1).every(arg => isExpression(arg) || isOptionsObject(arg)) + expr.slice(1).every((arg) => isExpression(arg) || isOptionsObject(arg)) ); } diff --git a/frontend/src/metabase-lib/v1/expressions/passes.ts b/frontend/src/metabase-lib/v1/expressions/passes.ts index 50c13c7c869..0e741afb27f 100644 --- a/frontend/src/metabase-lib/v1/expressions/passes.ts +++ b/frontend/src/metabase-lib/v1/expressions/passes.ts @@ -38,8 +38,8 @@ export function applyPasses( * * ["case", X, Y, Z] becomes ["case", [[X, Y]], { default: Z }] */ -export const adjustCaseOrIf: CompilerPass = tree => - modify(tree, node => { +export const adjustCaseOrIf: CompilerPass = (tree) => + modify(tree, (node) => { if (isCallExpression(node) && isCaseOrIfOperator(node[0])) { const [operator, ...operands] = node; const pairs: [Expression, Expression][] = []; @@ -70,8 +70,8 @@ export const adjustCaseOrIf: CompilerPass = tree => * * ["offset", X, Y] becomes ["offset", {}, X, Y] */ -export const adjustOffset: CompilerPass = tree => - modify(tree, node => { +export const adjustOffset: CompilerPass = (tree) => + modify(tree, (node) => { if (Array.isArray(node)) { const [operator] = node; if (operator === "offset") { @@ -95,8 +95,8 @@ export const adjustOffset: CompilerPass = tree => * ["contains", X, Y, "case-insensitive"] becomes ["contains", X, Y, {"case-sensitive": false}] * ["contains", X, Y] becomes ["contains", X, Y] */ -export const adjustOptions: CompilerPass = tree => - modify(tree, node => { +export const adjustOptions: CompilerPass = (tree) => + modify(tree, (node) => { if (isCallExpression(node)) { const [operator, ...operands] = node; if (operands.length > 0) { @@ -135,8 +135,8 @@ export const adjustOptions: CompilerPass = tree => * so we need to adjust its position here or insert an empty options object if * there is none. */ -export const adjustMultiArgOptions: CompilerPass = tree => - modify(tree, node => { +export const adjustMultiArgOptions: CompilerPass = (tree) => + modify(tree, (node) => { if (isCallExpression(node)) { const [operator, ...args] = node; const clause = MBQL_CLAUSES[operator]; @@ -163,8 +163,8 @@ export const adjustMultiArgOptions: CompilerPass = tree => * * Assumes adjustCaseOrIf has already been run */ -export const adjustBooleans: CompilerPass = tree => - modify(tree, node => { +export const adjustBooleans: CompilerPass = (tree) => + modify(tree, (node) => { if (isCaseOrIf(node)) { const [operator, pairs, options] = node; return [ @@ -210,7 +210,7 @@ function isBooleanField(input: unknown) { return false; } -export const adjustTopLevelLiteral: CompilerPass = tree => { +export const adjustTopLevelLiteral: CompilerPass = (tree) => { if ( isStringLiteral(tree) || isNumberLiteral(tree) || @@ -231,7 +231,7 @@ function modify(node: Expression, transform: Transform): Expression { return withAST( transform([ operator, - ...operands.map(sub => modify(sub as Expression, transform)), + ...operands.map((sub) => modify(sub as Expression, transform)), ]), node, ); diff --git a/frontend/src/metabase-lib/v1/expressions/position.ts b/frontend/src/metabase-lib/v1/expressions/position.ts index 263843c90a4..186188e2d5d 100644 --- a/frontend/src/metabase-lib/v1/expressions/position.ts +++ b/frontend/src/metabase-lib/v1/expressions/position.ts @@ -18,7 +18,9 @@ export function enclosingFunction(doc: string, pos: number) { const args = cursor.node.getChildren("ArgList")?.[0]?.getChildren("Arg") ?? []; - const argIndex = args.findIndex(arg => arg.from <= pos && arg.to >= pos); + const argIndex = args.findIndex( + (arg) => arg.from <= pos && arg.to >= pos, + ); if (value.endsWith(")") && cursor.to === pos) { // do not show help when cursor is placed after closing ) diff --git a/frontend/src/metabase-lib/v1/expressions/pratt/compiler.ts b/frontend/src/metabase-lib/v1/expressions/pratt/compiler.ts index 467dcacb4d1..1eab4eacd69 100644 --- a/frontend/src/metabase-lib/v1/expressions/pratt/compiler.ts +++ b/frontend/src/metabase-lib/v1/expressions/pratt/compiler.ts @@ -138,7 +138,7 @@ function compileFunctionCall(node: Node, opts: Options): Expression { function compileArgList(node: Node, opts: Options): Expression[] { assert(node.type === ARG_LIST, "Invalid Node Type"); - return node.children.map(child => { + return node.children.map((child) => { const func = getCompileFunction(child); if (!func) { throw new CompileError(t`Invalid node type`, { node: child }); diff --git a/frontend/src/metabase-lib/v1/expressions/pratt/parser.ts b/frontend/src/metabase-lib/v1/expressions/pratt/parser.ts index 07f15a44773..528befe12e2 100644 --- a/frontend/src/metabase-lib/v1/expressions/pratt/parser.ts +++ b/frontend/src/metabase-lib/v1/expressions/pratt/parser.ts @@ -47,7 +47,7 @@ export function lexify(expression: string) { const { tokens, errors } = tokenize(expression); if (errors && errors.length > 0) { - errors.forEach(error => { + errors.forEach((error) => { const { pos } = error; if (typeof pos === "number") { diff --git a/frontend/src/metabase-lib/v1/expressions/resolver.js b/frontend/src/metabase-lib/v1/expressions/resolver.js index 1793084a6fa..caacbb8806a 100644 --- a/frontend/src/metabase-lib/v1/expressions/resolver.js +++ b/frontend/src/metabase-lib/v1/expressions/resolver.js @@ -157,7 +157,7 @@ export function resolve({ if (operandType) { return [ op, - ...operands.map(operand => + ...operands.map((operand) => resolve({ expression: operand, type: operandType, fn, database }), ), ]; @@ -190,7 +190,7 @@ export function resolve({ } } if (multiple) { - const argCount = operands.filter(arg => !isOptionsObject(arg)).length; + const argCount = operands.filter((arg) => !isOptionsObject(arg)).length; const minArgCount = args.length; if (argCount < minArgCount) { diff --git a/frontend/src/metabase-lib/v1/expressions/resolver.unit.spec.ts b/frontend/src/metabase-lib/v1/expressions/resolver.unit.spec.ts index 83c1c142455..e45712bfb7e 100644 --- a/frontend/src/metabase-lib/v1/expressions/resolver.unit.spec.ts +++ b/frontend/src/metabase-lib/v1/expressions/resolver.unit.spec.ts @@ -177,7 +177,7 @@ describe("resolve", () => { it.each(["in", "not-in"])( "should reject multi-arg function calls without options when there is not enough arguments", - tag => { + (tag) => { expect(() => expr([tag])).toThrow(); expect(() => expr([tag, A])).toThrow(); expect(() => expr([tag, A, B])).not.toThrow(); @@ -187,7 +187,7 @@ describe("resolve", () => { it.each(["contains", "does-not-contain", "starts-with", "ends-with"])( "should reject multi-arg function calls with options when there is not enough arguments", - tag => { + (tag) => { const options: CallOptions = { "case-sensitive": true }; expect(() => expr([tag])).toThrow(); expect(() => expr([tag, A])).toThrow(); diff --git a/frontend/src/metabase-lib/v1/expressions/test/generator.ts b/frontend/src/metabase-lib/v1/expressions/test/generator.ts index 23695b12643..be46eb7c4be 100644 --- a/frontend/src/metabase-lib/v1/expressions/test/generator.ts +++ b/frontend/src/metabase-lib/v1/expressions/test/generator.ts @@ -78,7 +78,7 @@ export function generateExpression( const randomizeCase = (str: string) => str .split("") - .map(ch => (randomInt(10) < 3 ? ch.toUpperCase() : ch)) + .map((ch) => (randomInt(10) < 3 ? ch.toUpperCase() : ch)) .join(""); const format = (node: Node): string => { diff --git a/frontend/src/metabase-lib/v1/expressions/tokenizer/lezer.js b/frontend/src/metabase-lib/v1/expressions/tokenizer/lezer.js index e7b6efa3d2f..1972c4be399 100644 --- a/frontend/src/metabase-lib/v1/expressions/tokenizer/lezer.js +++ b/frontend/src/metabase-lib/v1/expressions/tokenizer/lezer.js @@ -90,6 +90,6 @@ export const parser = LRParser.deserialize({ "Hv~R!TOX$bXY&hYZ)dZ^&h^p$bpq&hqr*Zrs+ysw$bwx,dxy,}yz-sz{.i{|/_|}0T}!O0y!O!P1o!P!Q6X!Q!R6}!R![8u![!^$b!^!_@s!_!`Be!`!aCZ!a!c$b!c!}D{!}#O$b#O#PFa#P#R$b#R#SD{#S#T$b#T#oD{#o#y$b#y#z&h#z$f$b$f$g&h$g#BY$b#BY#BZ&h#BZ$IS$b$IS$I_&h$I_$I|$b$I|$JO&h$JO$JT$b$JT$JU&h$JU$KV$b$KV$KW&h$KW&FU$b&FU&FV&h&FV;'S$b;'S;=`&b<%lO$bU$iXyQ|SOY$bZr$brs%Usw$bwx%sx#O$b#P;'S$b;'S;=`&b<%lO$bS%ZU|SOY%UZw%Ux#O%U#P;'S%U;'S;=`%m<%lO%US%pP;=`<%l%UQ%xUyQOY%sZr%ss#O%s#P;'S%s;'S;=`&[<%lO%sQ&_P;=`<%l%sU&eP;=`<%l$bV&qnvPyQ|SOX$bXY&hYZ(oZ^&h^p$bpq&hqr$brs%Usw$bwx%sx#O$b#P#y$b#y#z&h#z$f$b$f$g&h$g#BY$b#BY#BZ&h#BZ$IS$b$IS$I_&h$I_$I|$b$I|$JO&h$JO$JT$b$JT$JU&h$JU$KV$b$KV$KW&h$KW&FU$b&FU&FV&h&FV;'S$b;'S;=`&b<%lO$bP(tYvPX^(opq(o#y#z(o$f$g(o#BY#BZ(o$IS$I_(o$I|$JO(o$JT$JU(o$KV$KW(o&FU&FV(oV)kYzUvPX^(opq(o#y#z(o$f$g(o#BY#BZ(o$IS$I_(o$I|$JO(o$JT$JU(o$KV$KW(o&FU&FV(oV*bZyQ|SOY$bZr$brs%Usw$bwx%sx!_$b!_!`+T!`#O$b#P;'S$b;'S;=`&b<%lO$bV+^XfPyQ|SOY$bZr$brs%Usw$bwx%sx#O$b#P;'S$b;'S;=`&b<%lO$bV,QUxR|SOY%UZw%Ux#O%U#P;'S%U;'S;=`%m<%lO%UV,kU{TyQOY%sZr%ss#O%s#P;'S%s;'S;=`&[<%lO%sV-WXhPyQ|SOY$bZr$brs%Usw$bwx%sx#O$b#P;'S$b;'S;=`&b<%lO$bV-|XiPyQ|SOY$bZr$brs%Usw$bwx%sx#O$b#P;'S$b;'S;=`&b<%lO$bV.rX]PyQ|SOY$bZr$brs%Usw$bwx%sx#O$b#P;'S$b;'S;=`&b<%lO$bV/hXZPyQ|SOY$bZr$brs%Usw$bwx%sx#O$b#P;'S$b;'S;=`&b<%lO$bV0^XmPyQ|SOY$bZr$brs%Usw$bwx%sx#O$b#P;'S$b;'S;=`&b<%lO$bV1SX[PyQ|SOY$bZr$brs%Usw$bwx%sx#O$b#P;'S$b;'S;=`&b<%lO$bV1vZyQ|SOY$bZr$brs%Usw$bwx%sx!Q$b!Q![2i![#O$b#P;'S$b;'S;=`&b<%lO$bV2raRPyQ|SOY$bZr$brs%Usw$bwx%sx!Q$b!Q![2i![!g$b!g!h3w!h#O$b#P#R$b#R#S2i#S#X$b#X#Y3w#Y;'S$b;'S;=`&b<%lO$bV4QaRPyQ|SOY$bZr$brs%Usw$bwx%sx{$b{|5V|}$b}!O5V!O!Q$b!Q![5V![#O$b#P#R$b#R#S5V#S;'S$b;'S;=`&b<%lO$bV5`]RPyQ|SOY$bZr$brs%Usw$bwx%sx!Q$b!Q![5V![#O$b#P#R$b#R#S5V#S;'S$b;'S;=`&b<%lO$bV6bX^PyQ|SOY$bZr$brs%Usw$bwx%sx#O$b#P;'S$b;'S;=`&b<%lO$bV7WiRPyQ|SOY$bZr$brs%Usw$bwx%sx!O$b!O!P2i!P!Q$b!Q![8u![!g$b!g!h3w!h#O$b#P#R$b#R#S8u#S#U$b#U#V:Z#V#X$b#X#Y3w#Y#c$b#c#d=_#d#l$b#l#m?g#m;'S$b;'S;=`&b<%lO$bV9OcRPyQ|SOY$bZr$brs%Usw$bwx%sx!O$b!O!P2i!P!Q$b!Q![8u![!g$b!g!h3w!h#O$b#P#R$b#R#S8u#S#X$b#X#Y3w#Y;'S$b;'S;=`&b<%lO$bV:b^yQ|SOY$bZr$brs%Usw$bwx%sx!Q$b!Q!R;^!R!S;^!S#O$b#P#R$b#R#S;^#S;'S$b;'S;=`&b<%lO$bV;g`RPyQ|SOY$bZr$brs%Usw$bwx%sx!Q$b!Q!R;^!R!S;^!S#O$b#P#R$b#R#S;^#S#b$b#b#c_!Y#O$b#P#R$b#R#S>_#S;'S$b;'S;=`&b<%lO$bV>h_RPyQ|SOY$bZr$brs%Usw$bwx%sx!Q$b!Q!Y>_!Y#O$b#P#R$b#R#S>_#S#b$b#b#c spec_Identifier[value] || -1 }], + specialized: [{ term: 8, get: (value) => spec_Identifier[value] || -1 }], tokenPrec: 0, }); diff --git a/frontend/src/metabase-lib/v1/expressions/tokenizer/tokenize.ts b/frontend/src/metabase-lib/v1/expressions/tokenizer/tokenize.ts index 465abc8daed..456c5e6c3c5 100644 --- a/frontend/src/metabase-lib/v1/expressions/tokenizer/tokenize.ts +++ b/frontend/src/metabase-lib/v1/expressions/tokenizer/tokenize.ts @@ -95,7 +95,7 @@ export function tokenize(expression: string) { // remove quotes .slice(node.from + 1, node.to - 1) // expand escape sequences - .replace(/\\./g, match => { + .replace(/\\./g, (match) => { const ch = match[1]; return escapes[ch as keyof typeof escapes] ?? ch; }), diff --git a/frontend/src/metabase-lib/v1/expressions/tokenizer/tokenize.unit.spec.ts b/frontend/src/metabase-lib/v1/expressions/tokenizer/tokenize.unit.spec.ts index 0a4bbd1cabf..e26332c11a3 100644 --- a/frontend/src/metabase-lib/v1/expressions/tokenizer/tokenize.unit.spec.ts +++ b/frontend/src/metabase-lib/v1/expressions/tokenizer/tokenize.unit.spec.ts @@ -809,7 +809,7 @@ describe("tokenizer", () => { }); describe("garbage", () => { - const types = (expr: string) => tokenize(expr).tokens.map(t => t.type); + const types = (expr: string) => tokenize(expr).tokens.map((t) => t.type); const errors = (expr: string) => tokenize(expr).errors; it("should ignore garbage", () => { diff --git a/frontend/src/metabase-lib/v1/expressions/tokenizer/tokens.ts b/frontend/src/metabase-lib/v1/expressions/tokenizer/tokens.ts index a010522f5f8..6695655ab54 100644 --- a/frontend/src/metabase-lib/v1/expressions/tokenizer/tokens.ts +++ b/frontend/src/metabase-lib/v1/expressions/tokenizer/tokens.ts @@ -33,7 +33,7 @@ function isOperator(char: number) { * * This is hard to express in the grammar, so we use this tokenizer to match them. */ -export const reference = new ExternalTokenizer(input => { +export const reference = new ExternalTokenizer((input) => { const current = input.next; if (current !== OPEN_BRACKET) { diff --git a/frontend/src/metabase-lib/v1/expressions/typeinferencer.unit.spec.ts b/frontend/src/metabase-lib/v1/expressions/typeinferencer.unit.spec.ts index da6bfdebf35..fb57ca47c4f 100644 --- a/frontend/src/metabase-lib/v1/expressions/typeinferencer.unit.spec.ts +++ b/frontend/src/metabase-lib/v1/expressions/typeinferencer.unit.spec.ts @@ -165,7 +165,7 @@ describe("metabase-lib/v1/expressions/typeinferencer", () => { "minute", "second", ]; - ops.forEach(op => { + ops.forEach((op) => { expect(type(`${op}([Created At])`)).toEqual("number"); }); }); diff --git a/frontend/src/metabase-lib/v1/metadata/Database.ts b/frontend/src/metabase-lib/v1/metadata/Database.ts index 8faca6ffbf6..c6c1dfd030a 100644 --- a/frontend/src/metabase-lib/v1/metadata/Database.ts +++ b/frontend/src/metabase-lib/v1/metadata/Database.ts @@ -41,7 +41,7 @@ class Database { schemaNames() { return this.getSchemas() - .map(s => s.name) + .map((s) => s.name) .sort((a, b) => a.localeCompare(b)); } @@ -58,7 +58,9 @@ class Database { } tablesLookup() { - return Object.fromEntries(this.getTables().map(table => [table.id, table])); + return Object.fromEntries( + this.getTables().map((table) => [table.id, table]), + ); } // @deprecated: use tablesLookup @@ -137,7 +139,7 @@ class Database { } savedQuestionsDatabase() { - return this.metadata?.databasesList().find(db => db.is_saved_questions); + return this.metadata?.databasesList().find((db) => db.is_saved_questions); } } diff --git a/frontend/src/metabase-lib/v1/metadata/Database.unit.spec.ts b/frontend/src/metabase-lib/v1/metadata/Database.unit.spec.ts index 76270c5c5d7..c9502a1790c 100644 --- a/frontend/src/metabase-lib/v1/metadata/Database.unit.spec.ts +++ b/frontend/src/metabase-lib/v1/metadata/Database.unit.spec.ts @@ -139,7 +139,7 @@ describe("Database", () => { it.each(["left-join", "right-join", "inner-join", "full-join"] as const)( "should return true for 'join' for %s", - feature => { + (feature) => { const database = setup({ database: createMockDatabase({ features: [feature], diff --git a/frontend/src/metabase-lib/v1/metadata/Metadata.ts b/frontend/src/metabase-lib/v1/metadata/Metadata.ts index 1968e941793..e8ca9732917 100644 --- a/frontend/src/metabase-lib/v1/metadata/Metadata.ts +++ b/frontend/src/metabase-lib/v1/metadata/Metadata.ts @@ -57,8 +57,8 @@ class Metadata { databasesList({ savedQuestions = true } = {}): Database[] { return _.chain(this.databases) .values() - .filter(db => savedQuestions || !db.is_saved_questions) - .sortBy(db => db.name) + .filter((db) => savedQuestions || !db.is_saved_questions) + .sortBy((db) => db.name) .value(); } diff --git a/frontend/src/metabase-lib/v1/metadata/Table.ts b/frontend/src/metabase-lib/v1/metadata/Table.ts index d4e9f2f9484..fbbfa5528cf 100644 --- a/frontend/src/metabase-lib/v1/metadata/Table.ts +++ b/frontend/src/metabase-lib/v1/metadata/Table.ts @@ -87,12 +87,14 @@ class Table { } dateFields() { - return this.getFields().filter(field => field.isDate()); + return this.getFields().filter((field) => field.isDate()); } // FIELDS fieldsLookup() { - return Object.fromEntries(this.getFields().map(field => [field.id, field])); + return Object.fromEntries( + this.getFields().map((field) => [field.id, field]), + ); } // @deprecated: use fieldsLookup @@ -107,8 +109,8 @@ class Table { connectedTables(): Table[] { const fks = this.fks || []; return fks - .map(fk => fk.origin?.table) - .filter(table => table != null) as Table[]; + .map((fk) => fk.origin?.table) + .filter((table) => table != null) as Table[]; } foreignTables(): Table[] { @@ -117,8 +119,8 @@ class Table { return []; } return fields - .filter(field => field.isFK() && field.fk_target_field_id) - .map(field => this.metadata?.field(field.fk_target_field_id)?.table) + .filter((field) => field.isFK() && field.fk_target_field_id) + .map((field) => this.metadata?.field(field.fk_target_field_id)?.table) .filter(Boolean) as Table[]; } diff --git a/frontend/src/metabase-lib/v1/metadata/utils/models.ts b/frontend/src/metabase-lib/v1/metadata/utils/models.ts index 1a39614a7fb..92db31f3814 100644 --- a/frontend/src/metabase-lib/v1/metadata/utils/models.ts +++ b/frontend/src/metabase-lib/v1/metadata/utils/models.ts @@ -135,7 +135,7 @@ export function checkCanRefreshModelCache( export function getModelCacheSchemaName(databaseId: number, siteUUID: string) { const uuidParts = siteUUID.split("-"); - const firstLetters = uuidParts.map(part => part.charAt(0)).join(""); + const firstLetters = uuidParts.map((part) => part.charAt(0)).join(""); return `metabase_cache_${firstLetters}_${databaseId}`; } @@ -154,6 +154,6 @@ export function getSortedModelFields( } return findColumnIndexesForColumnSettings(columns, columnSettings) - .filter(columnIndex => columnIndex >= 0) - .map(columnIndex => columns[columnIndex]); + .filter((columnIndex) => columnIndex >= 0) + .map((columnIndex) => columns[columnIndex]); } diff --git a/frontend/src/metabase-lib/v1/metadata/utils/models.unit.spec.js b/frontend/src/metabase-lib/v1/metadata/utils/models.unit.spec.js index 6ad6740f2c2..abe280f5924 100644 --- a/frontend/src/metabase-lib/v1/metadata/utils/models.unit.spec.js +++ b/frontend/src/metabase-lib/v1/metadata/utils/models.unit.spec.js @@ -160,7 +160,7 @@ describe("data model utils", () => { expect(checkCanBeModel(question)).toBe(true); }); - UNSUPPORTED_TEMPLATE_TAG_TYPES.forEach(tagType => { + UNSUPPORTED_TEMPLATE_TAG_TYPES.forEach((tagType) => { it(`returns false when '${tagType}' variables are used`, () => { const card = createSavedNativeCard({ tags: { @@ -284,7 +284,7 @@ describe("data model utils", () => { }; const states = Object.keys(testCases); - states.forEach(state => { + states.forEach((state) => { const canRefresh = testCases[state]; it(`returns '${canRefresh}' for '${state}' caching state`, () => { diff --git a/frontend/src/metabase-lib/v1/metadata/utils/saved-questions.unit.spec.js b/frontend/src/metabase-lib/v1/metadata/utils/saved-questions.unit.spec.js index bee5d159fd8..090a84ec842 100644 --- a/frontend/src/metabase-lib/v1/metadata/utils/saved-questions.unit.spec.js +++ b/frontend/src/metabase-lib/v1/metadata/utils/saved-questions.unit.spec.js @@ -110,7 +110,7 @@ describe("saved question helpers", () => { [ { tableId: "card__1", cardId: 1 }, { tableId: "card__234", cardId: 234 }, - ].forEach(testCase => { + ].forEach((testCase) => { const { tableId, cardId } = testCase; it(`should extract ID from virtual ID (${tableId})`, () => { @@ -124,7 +124,7 @@ describe("saved question helpers", () => { { id: 123 }, { id: true }, { id: { foo: "bar" } }, - ].forEach(testCase => { + ].forEach((testCase) => { const { id } = testCase; it(`should handle non string input (${id})`, () => { @@ -132,7 +132,7 @@ describe("saved question helpers", () => { }); }); - ["card__", "card__test"].forEach(id => { + ["card__", "card__test"].forEach((id) => { it(`should handle invalid ID ${id}`, () => { expect(getQuestionIdFromVirtualTableId(id)).toBe(null); }); diff --git a/frontend/src/metabase-lib/v1/metadata/utils/schema.unit.spec.js b/frontend/src/metabase-lib/v1/metadata/utils/schema.unit.spec.js index 6bf9a10cce6..e0447c36544 100644 --- a/frontend/src/metabase-lib/v1/metadata/utils/schema.unit.spec.js +++ b/frontend/src/metabase-lib/v1/metadata/utils/schema.unit.spec.js @@ -12,7 +12,7 @@ const SCHEMA_TEST_CASES = [ ]; describe("generateSchemaId", () => { - SCHEMA_TEST_CASES.forEach(testCase => { + SCHEMA_TEST_CASES.forEach((testCase) => { const { dbId, schemaName, schema } = testCase; it(`returns "${schema}" for "${dbId}" DB and ${schemaName} schema`, () => { @@ -31,7 +31,7 @@ describe("generateSchemaId", () => { }); describe("parseSchemaId", () => { - SCHEMA_TEST_CASES.forEach(testCase => { + SCHEMA_TEST_CASES.forEach((testCase) => { const { schema, dbId, schemaName } = testCase; const expectedDatabaseId = dbId; @@ -79,7 +79,7 @@ describe("parseSchemaId", () => { }); describe("getSchemaName", () => { - SCHEMA_TEST_CASES.forEach(testCase => { + SCHEMA_TEST_CASES.forEach((testCase) => { const { schema, schemaName } = testCase; const expectedSchemaName = schemaName ? String(schemaName) : ""; diff --git a/frontend/src/metabase-lib/v1/operators/constants.js b/frontend/src/metabase-lib/v1/operators/constants.js index 38361691e67..d2f5d380345 100644 --- a/frontend/src/metabase-lib/v1/operators/constants.js +++ b/frontend/src/metabase-lib/v1/operators/constants.js @@ -81,8 +81,8 @@ function equivalentArgument(field, table) { function longitudeFieldSelectArgument(field, table) { const values = table.fields - .filter(field => isLongitude(field)) - .map(field => ({ + .filter((field) => isLongitude(field)) + .map((field) => ({ key: field.id, name: field.display_name, })); diff --git a/frontend/src/metabase-lib/v1/parameters/utils/cards.ts b/frontend/src/metabase-lib/v1/parameters/utils/cards.ts index 4ed95f4005a..058f1732002 100644 --- a/frontend/src/metabase-lib/v1/parameters/utils/cards.ts +++ b/frontend/src/metabase-lib/v1/parameters/utils/cards.ts @@ -30,7 +30,7 @@ export function getCardUiParameters( }); const question = new Question(card, metadata); - return valuePopulatedParameters.map(parameter => { + return valuePopulatedParameters.map((parameter) => { const target: ParameterTarget | undefined = ( parameter as ParameterWithTarget ).target; diff --git a/frontend/src/metabase-lib/v1/parameters/utils/click-behavior.ts b/frontend/src/metabase-lib/v1/parameters/utils/click-behavior.ts index 9319c958680..569c45101f6 100644 --- a/frontend/src/metabase-lib/v1/parameters/utils/click-behavior.ts +++ b/frontend/src/metabase-lib/v1/parameters/utils/click-behavior.ts @@ -75,13 +75,13 @@ export function getDataFromClicked({ }): ValueAndColumnForColumnNameDate { const column = [ ...dimensions, - ...data.map(d => ({ + ...data.map((d) => ({ column: d.col, // When the data is changed to a display value for use in tooltips, we can set clickBehaviorValue to the raw value for filtering. value: d.clickBehaviorValue || d.value, })), ] - .filter(d => d.column != null) + .filter((d) => d.column != null) .reduce( (acc, { column, value }) => { if (!column) { @@ -110,7 +110,7 @@ export function getDataFromClicked({ ]), ); - const parameterBySlug = _.mapObject(parameterValuesBySlug, value => ({ + const parameterBySlug = _.mapObject(parameterValuesBySlug, (value) => ({ value, })); @@ -171,7 +171,7 @@ function getTargetsForStructuredQuestion(question: Question): Target[] { targetColumn, ); }, - parameter: parameter => + parameter: (parameter) => columnFilterForParameter(query, stageIndex, parameter)(targetColumn), userAttribute: () => Lib.isString(targetColumn) || @@ -197,7 +197,7 @@ function getTargetsForDimensionOptions( return legacyNativeQuery .dimensionOptions() .all() - .map(templateTagDimension => { + .map((templateTagDimension) => { const { name, id } = ( templateTagDimension as unknown as TemplateTagDimension ).tag(); @@ -208,7 +208,7 @@ function getTargetsForDimensionOptions( const parentType = [TYPE.Temporal, TYPE.Number, TYPE.Text].find( - t => typeof base_type === "string" && isa(base_type, t), + (t) => typeof base_type === "string" && isa(base_type, t), ) || base_type; return { @@ -222,7 +222,7 @@ function getTargetsForDimensionOptions( parentType && isa(column.base_type, parentType), ), - parameter: parameter => + parameter: (parameter) => dimensionFilterForParameter(parameter)(templateTagDimension), userAttribute: () => parentType === TYPE.Text, }, @@ -231,7 +231,7 @@ function getTargetsForDimensionOptions( } function getTargetsForVariables(legacyNativeQuery: NativeQuery): Target[] { - return legacyNativeQuery.variables().map(templateTagVariable => { + return legacyNativeQuery.variables().map((templateTagVariable) => { const { name, id, type } = checkNotNull(templateTagVariable.tag()); const target: ClickBehaviorTarget = { type: "variable", id: name }; const parentType = type @@ -254,7 +254,7 @@ function getTargetsForVariables(legacyNativeQuery: NativeQuery): Target[] { Boolean( column.base_type && parentType && isa(column.base_type, parentType), ), - parameter: parameter => + parameter: (parameter) => variableFilterForParameter(parameter)(templateTagVariable), userAttribute: () => parentType === TYPE.Text, }, @@ -270,7 +270,7 @@ export function getTargetsForDashboard( return []; } - return dashboard.parameters.map(parameter => { + return dashboard.parameters.map((parameter) => { const { type, id, name } = parameter; const filter = baseTypeFilterForParameterType(type); return { @@ -280,7 +280,7 @@ export function getTargetsForDashboard( sourceFilters: { column: (c: DatasetColumn) => notRelativeDateOrRange(parameter) && filter(c.base_type), - parameter: sourceParam => { + parameter: (sourceParam) => { // parameter IDs are generated client-side, so they might not be unique // if dashboard is a clone, it will have identical parameter IDs to the original const isSameParameter = @@ -311,7 +311,7 @@ function baseTypeFilterForParameterType(parameterType: string) { if (typeof baseType === "undefined") { return false; } - return allowedTypes.some(allowedType => isa(baseType, allowedType)); + return allowedTypes.some((allowedType) => isa(baseType, allowedType)); }; } @@ -356,7 +356,9 @@ export function canSaveClickBehavior( clickBehavior.linkType === "dashboard" ) { const tabs = targetDashboard?.tabs || []; - const dashboardTabExists = tabs.some(tab => tab.id === clickBehavior.tabId); + const dashboardTabExists = tabs.some( + (tab) => tab.id === clickBehavior.tabId, + ); if (tabs.length > 1 && !dashboardTabExists) { // If the target dashboard tab has been deleted, and there are other tabs @@ -479,7 +481,7 @@ function getParameter( ): Parameter | undefined { if (clickBehavior.type === "crossfilter") { const parameters = extraData.parameters ?? []; - return parameters.find(parameter => parameter.id === target.id); + return parameters.find((parameter) => parameter.id === target.id); } if ( @@ -493,7 +495,7 @@ function getParameter( extraData.dashboard?.id === dashboardId ? (extraData.parameters ?? []) : (extraData.dashboards?.[dashboardId]?.parameters ?? []); - return parameters.find(parameter => parameter.id === target.id); + return parameters.find((parameter) => parameter.id === target.id); } return undefined; diff --git a/frontend/src/metabase-lib/v1/parameters/utils/click-behavior.unit.spec.ts b/frontend/src/metabase-lib/v1/parameters/utils/click-behavior.unit.spec.ts index 5ffc3a10e36..c5e52cc6c92 100644 --- a/frontend/src/metabase-lib/v1/parameters/utils/click-behavior.unit.spec.ts +++ b/frontend/src/metabase-lib/v1/parameters/utils/click-behavior.unit.spec.ts @@ -220,7 +220,7 @@ describe("metabase/lib/click-behavior", () => { "type/Enum", "type/Text", "type/TextLike", - ].map(base_type => createMockColumn({ base_type })), + ].map((base_type) => createMockColumn({ base_type })), parameter: [ "id", "category", @@ -231,7 +231,7 @@ describe("metabase/lib/click-behavior", () => { "date/all-options", "date/month-year", "temporal-unit", - ].map(type => createMockParameter({ type })), + ].map((type) => createMockParameter({ type })), userAttribute: ["attr"], }; @@ -317,7 +317,7 @@ describe("metabase/lib/click-behavior", () => { ); const filteredSources = { - column: sources.column.filter(column => + column: sources.column.filter((column) => sourceFilters.column(column, question), ), parameter: sources.parameter.filter(sourceFilters.parameter), @@ -394,7 +394,7 @@ describe("metabase/lib/click-behavior", () => { const [{ sourceFilters }] = getTargetsForQuestion(question); const filteredSources = { - column: sources.column.filter(column => + column: sources.column.filter((column) => sourceFilters.column(column, question), ), parameter: sources.parameter.filter(sourceFilters.parameter), @@ -483,7 +483,7 @@ describe("metabase/lib/click-behavior", () => { const [{ sourceFilters }] = getTargetsForQuestion(question); const filteredSources = { - column: sources.column.filter(column => + column: sources.column.filter((column) => sourceFilters.column(column, question), ), parameter: sources.parameter.filter(sourceFilters.parameter), diff --git a/frontend/src/metabase-lib/v1/parameters/utils/filters.ts b/frontend/src/metabase-lib/v1/parameters/utils/filters.ts index 65fc27decc3..6eead966ed5 100644 --- a/frontend/src/metabase-lib/v1/parameters/utils/filters.ts +++ b/frontend/src/metabase-lib/v1/parameters/utils/filters.ts @@ -16,17 +16,17 @@ export function fieldFilterForParameter( const type = getParameterType(parameter); switch (type) { case "date": - return field => field.isDate(); + return (field) => field.isDate(); case "id": - return field => field.isID(); + return (field) => field.isID(); case "category": - return field => field.isCategory(); + return (field) => field.isCategory(); case "location": - return field => field.isLocation(); + return (field) => field.isLocation(); case "number": - return field => field.isNumber() && !field.isCoordinate(); + return (field) => field.isNumber() && !field.isCoordinate(); case "string": - return field => field.isString() && !field.isLocation(); + return (field) => field.isString() && !field.isLocation(); } return () => false; @@ -41,25 +41,25 @@ export function columnFilterForParameter( switch (type) { case "date": - return column => Lib.isTemporal(column); + return (column) => Lib.isTemporal(column); case "id": - return column => Lib.isPrimaryKey(column) || Lib.isForeignKey(column); + return (column) => Lib.isPrimaryKey(column) || Lib.isForeignKey(column); case "category": - return column => Lib.isCategory(column) || Lib.isBoolean(column); + return (column) => Lib.isCategory(column) || Lib.isBoolean(column); case "location": - return column => Lib.isLocation(column); + return (column) => Lib.isLocation(column); case "number": - return column => + return (column) => Lib.isNumeric(column) && !Lib.isPrimaryKey(column) && !Lib.isForeignKey(column) && !Lib.isLocation(column); case "string": - return column => + return (column) => (Lib.isStringOrStringLike(column) || Lib.isCategory(column)) && !Lib.isLocation(column); case "temporal-unit": - return column => Lib.isTemporalBucketable(query, stageIndex, column); + return (column) => Lib.isTemporalBucketable(query, stageIndex, column); } return () => false; @@ -96,17 +96,17 @@ function tagFilterForParameter( switch (type) { case "date": - return tag => subtype === "single" && tag.type === "date"; + return (tag) => subtype === "single" && tag.type === "date"; case "location": - return tag => tag.type === "number" || tag.type === "text"; + return (tag) => tag.type === "number" || tag.type === "text"; case "id": - return tag => tag.type === "number" || tag.type === "text"; + return (tag) => tag.type === "number" || tag.type === "text"; case "category": - return tag => tag.type === "number" || tag.type === "text"; + return (tag) => tag.type === "number" || tag.type === "text"; case "number": - return tag => tag.type === "number"; + return (tag) => tag.type === "number"; case "string": - return tag => tag.type === "text"; + return (tag) => tag.type === "text"; } return () => false; } diff --git a/frontend/src/metabase-lib/v1/parameters/utils/operators.ts b/frontend/src/metabase-lib/v1/parameters/utils/operators.ts index fdc793e4c58..8497a7946c5 100644 --- a/frontend/src/metabase-lib/v1/parameters/utils/operators.ts +++ b/frontend/src/metabase-lib/v1/parameters/utils/operators.ts @@ -74,7 +74,7 @@ export function buildTypedOperatorOptions( sectionId: ParameterSectionId, sectionName: string, ): ParameterMappingOptions[] { - return PARAMETER_OPERATOR_TYPES[operatorType].map(operatorOption => { + return PARAMETER_OPERATOR_TYPES[operatorType].map((operatorOption) => { return { ...operatorOption, sectionId, diff --git a/frontend/src/metabase-lib/v1/parameters/utils/parameter-fields.ts b/frontend/src/metabase-lib/v1/parameters/utils/parameter-fields.ts index a8bca4f45d5..07ce50d9e9a 100644 --- a/frontend/src/metabase-lib/v1/parameters/utils/parameter-fields.ts +++ b/frontend/src/metabase-lib/v1/parameters/utils/parameter-fields.ts @@ -23,5 +23,5 @@ export const getFields = (parameter: UiParameter): Field[] => { }; export const getNonVirtualFields = (parameter: UiParameter) => { - return getFields(parameter).filter(field => !field.isVirtual()); + return getFields(parameter).filter((field) => !field.isVirtual()); }; diff --git a/frontend/src/metabase-lib/v1/parameters/utils/parameter-parsing.ts b/frontend/src/metabase-lib/v1/parameters/utils/parameter-parsing.ts index 0caab51fa66..f0c78765db8 100644 --- a/frontend/src/metabase-lib/v1/parameters/utils/parameter-parsing.ts +++ b/frontend/src/metabase-lib/v1/parameters/utils/parameter-parsing.ts @@ -44,7 +44,7 @@ export function parseParameterValue(value: any, parameter: Parameter) { const type = getParameterType(parameter); if (type === "temporal-unit") { const availableUnits = Lib.availableTemporalUnits(); - return availableUnits.some(unit => unit === value) ? value : null; + return availableUnits.some((unit) => unit === value) ? value : null; } const coercedValue = @@ -68,14 +68,14 @@ function parseParameterValueForNumber(value: ParameterValueOrArray) { // https://github.com/metabase/metabase/issues/25374#issuecomment-1272520560 if (typeof value === "string") { // something like "1,2,3", "1, 2, 3", ",,,1,2, 3" - const splitValues = value.split(",").filter(item => item.trim() !== ""); + const splitValues = value.split(",").filter((item) => item.trim() !== ""); if (splitValues.length === 0) { return null; } if (splitValues.length > 1) { - const numbers = splitValues.map(number => parseFloat(number)); - if (numbers.every(number => !isNaN(number))) { + const numbers = splitValues.map((number) => parseFloat(number)); + if (numbers.every((number) => !isNaN(number))) { return numbers.join(","); } @@ -91,15 +91,15 @@ function parseParameterValueForFields( fields: Field[], ): ParameterValueOrArray { // unix dates fields are numeric but query params shouldn't be parsed as numbers - if (fields.every(f => f.isNumeric() && !f.isDate())) { + if (fields.every((f) => f.isNumeric() && !f.isDate())) { return normalizeNumberParameterValue(value); } - if (fields.every(f => f.isBoolean())) { + if (fields.every((f) => f.isBoolean())) { return deserializeBooleanParameterValue(value); } - if (fields.every(f => f.isString() || f.isStringLike())) { + if (fields.every((f) => f.isString() || f.isStringLike())) { return deserializeStringParameterValue(value); } @@ -129,7 +129,7 @@ export function getParameterValuesByIdFromQueryParams( lastUsedParametersValues?: Record, ) { return Object.fromEntries( - parameters.map(parameter => [ + parameters.map((parameter) => [ parameter.id, getParameterValueFromQueryParams( parameter, diff --git a/frontend/src/metabase-lib/v1/parameters/utils/parameter-parsing.unit.spec.js b/frontend/src/metabase-lib/v1/parameters/utils/parameter-parsing.unit.spec.js index aa84ea832c6..c9ea0cf725d 100644 --- a/frontend/src/metabase-lib/v1/parameters/utils/parameter-parsing.unit.spec.js +++ b/frontend/src/metabase-lib/v1/parameters/utils/parameter-parsing.unit.spec.js @@ -370,7 +370,7 @@ describe("parameters/utils/parameter-values", () => { type: "number/=", }; - const runGetParameterValueFromQueryParams = value => + const runGetParameterValueFromQueryParams = (value) => getParameterValueFromQueryParams(numberParameter, { [numberParameter.slug]: value, }); diff --git a/frontend/src/metabase-lib/v1/parameters/utils/parameter-source.ts b/frontend/src/metabase-lib/v1/parameters/utils/parameter-source.ts index b0b1d5252c0..134c8157f8a 100644 --- a/frontend/src/metabase-lib/v1/parameters/utils/parameter-source.ts +++ b/frontend/src/metabase-lib/v1/parameters/utils/parameter-source.ts @@ -94,8 +94,8 @@ export const canListParameterValues = (parameter: Parameter) => { export const canListFieldValues = (fields: Field[]) => { const hasFields = fields.length > 0; const hasFieldValues = fields - .filter(field => !field.isVirtual()) - .every(field => field.has_field_values === "list"); + .filter((field) => !field.isVirtual()) + .every((field) => field.has_field_values === "list"); return hasFields && hasFieldValues; }; @@ -124,11 +124,11 @@ export const canSearchFieldValues = ( disablePKRemapping = false, ) => { const hasFields = fields.length > 0; - const canSearch = fields.every(field => + const canSearch = fields.every((field) => field.searchField(disablePKRemapping), ); const hasFieldValues = fields.some( - field => + (field) => field.has_field_values === "search" || (field.has_field_values === "list" && field.has_more_values === true), ); diff --git a/frontend/src/metabase-lib/v1/parameters/utils/parameter-source.unit.spec.ts b/frontend/src/metabase-lib/v1/parameters/utils/parameter-source.unit.spec.ts index 73ff91564d8..6dcba8b2c87 100644 --- a/frontend/src/metabase-lib/v1/parameters/utils/parameter-source.unit.spec.ts +++ b/frontend/src/metabase-lib/v1/parameters/utils/parameter-source.unit.spec.ts @@ -32,7 +32,7 @@ const searchField2 = metadata.field(SEARCH_FIELD_2_ID) as Field; const noValuesField = metadata.field(NO_VALUES_FIELD_ID) as Field; describe("getQueryType", () => { - describe.each(["string", "location"])("parameter type %s", type => { + describe.each(["string", "location"])("parameter type %s", (type) => { it.each([ ["=", "list"], ["!=", "list"], @@ -51,7 +51,7 @@ describe("getQueryType", () => { ); }); - describe.each(["number"])("parameter type %s", type => { + describe.each(["number"])("parameter type %s", (type) => { it.each([ ["=", "list"], ["!=", "list"], @@ -202,7 +202,7 @@ describe("canSearchParameterValues", () => { "does-not-contain", "starts-with", "ends-with", - ])("should allow to search for %s string operator", operator => { + ])("should allow to search for %s string operator", (operator) => { const parameter = createMockUiParameter({ type: `string/${operator}`, fields: [searchField], @@ -214,7 +214,7 @@ describe("canSearchParameterValues", () => { it.each(["=", "!="])( "should allow to search for %s numeric operator", - operator => { + (operator) => { const parameter = createMockUiParameter({ type: `number/${operator}`, fields: [searchField], @@ -226,7 +226,7 @@ describe("canSearchParameterValues", () => { it.each([">", "<", ">=", "<=", "between"])( "should not allow to search for %s numeric operator", - operator => { + (operator) => { const parameter = createMockUiParameter({ type: `number/${operator}`, fields: [searchField], diff --git a/frontend/src/metabase-lib/v1/parameters/utils/parameter-values.js b/frontend/src/metabase-lib/v1/parameters/utils/parameter-values.js index 40bed4d8ceb..d5ab547146a 100644 --- a/frontend/src/metabase-lib/v1/parameters/utils/parameter-values.js +++ b/frontend/src/metabase-lib/v1/parameters/utils/parameter-values.js @@ -45,7 +45,7 @@ export function getValuePopulatedParameters({ return []; } - return parameters.map(parameter => ({ + return parameters.map((parameter) => ({ ...parameter, value: getParameterValue({ parameter, @@ -59,7 +59,7 @@ export function getDefaultValuePopulatedParameters( parameters, parameterValues, ) { - return parameters.map(parameter => { + return parameters.map((parameter) => { const value = parameterValues?.[parameter.id]; return { ...parameter, @@ -98,7 +98,7 @@ export function normalizeParameter(parameter) { export function normalizeParameters(parameters) { return parameters - .filter(parameter => _.has(parameter, "value")) + .filter((parameter) => _.has(parameter, "value")) .map(({ id, type, value, target, options }) => ({ id, type, @@ -148,7 +148,7 @@ export function getParameterValuesBySlug(parameters, parameterValuesById) { parameterValuesById = parameterValuesById ?? {}; return Object.fromEntries( - parameters.map(parameter => [ + parameters.map((parameter) => [ parameter.slug, parameter.value ?? parameterValuesById[parameter.id] ?? null, ]), diff --git a/frontend/src/metabase-lib/v1/parameters/utils/targets.ts b/frontend/src/metabase-lib/v1/parameters/utils/targets.ts index decb1a96e07..32c245ec19c 100644 --- a/frontend/src/metabase-lib/v1/parameters/utils/targets.ts +++ b/frontend/src/metabase-lib/v1/parameters/utils/targets.ts @@ -97,7 +97,7 @@ function getParameterTargetFieldFromFieldRef( if (typeof fieldIdOrName === "number") { // performance optimization: // we can match by id directly without finding this column via query - return fields.find(field => field.id === fieldIdOrName); + return fields.find((field) => field.id === fieldIdOrName); } const { query, columns } = getParameterColumns(question, parameter); @@ -106,7 +106,7 @@ function getParameterTargetFieldFromFieldRef( // query and metadata are not available: 1) no data permissions 2) embedding // there is no way to find the correct field so pick the first one matching by name return fields.find( - field => typeof field.id === "number" && field.name === fieldIdOrName, + (field) => typeof field.id === "number" && field.name === fieldIdOrName, ); } @@ -114,7 +114,7 @@ function getParameterTargetFieldFromFieldRef( for (const stageIndex of stageIndexes) { const stageColumns = columns - .filter(column => column.stageIndex === stageIndex) + .filter((column) => column.stageIndex === stageIndex) .map(({ column }) => column); const [columnIndex] = Lib.findColumnIndexesFromLegacyRefs( @@ -135,7 +135,7 @@ function getParameterTargetFieldFromFieldRef( // do not use `metadata.field(id)` because it only works for fields loaded // with the original table, not coming from model metadata - return fields.find(field => field.id === fieldValuesInfo.fieldId); + return fields.find((field) => field.id === fieldValuesInfo.fieldId); } } @@ -206,12 +206,12 @@ export function getParameterColumns(question: Question, parameter?: Parameter) { } function getTemporalColumns(query: Lib.Query, stageIndex: number) { - const columns = Lib.breakouts(query, stageIndex).map(breakout => { + const columns = Lib.breakouts(query, stageIndex).map((breakout) => { return Lib.breakoutColumn(query, stageIndex, breakout); }); const [group] = Lib.groupColumns(columns); - return columns.map(column => ({ + return columns.map((column) => ({ stageIndex, column, group, @@ -219,14 +219,14 @@ function getTemporalColumns(query: Lib.Query, stageIndex: number) { } function getFilterableColumns(query: Lib.Query) { - return Lib.stageIndexes(query).flatMap(stageIndex => { + return Lib.stageIndexes(query).flatMap((stageIndex) => { const columns = Lib.filterableColumns(query, stageIndex); const groups = Lib.groupColumns(columns); - return groups.flatMap(group => { + return groups.flatMap((group) => { const columns = Lib.getColumnsFromColumnGroup(group); - return columns.map(column => ({ + return columns.map((column) => ({ stageIndex, column, group, diff --git a/frontend/src/metabase-lib/v1/parameters/utils/targets.unit.spec.ts b/frontend/src/metabase-lib/v1/parameters/utils/targets.unit.spec.ts index 0b5d5828970..67dcc978c2b 100644 --- a/frontend/src/metabase-lib/v1/parameters/utils/targets.unit.spec.ts +++ b/frontend/src/metabase-lib/v1/parameters/utils/targets.unit.spec.ts @@ -733,7 +733,7 @@ function withColumnsStage( stageIndex: number, columns: (string | undefined)[][], ) { - return columns.map(column => withColumnStage(stageIndex, column)); + return columns.map((column) => withColumnStage(stageIndex, column)); } function withColumnStage(stageIndex: number, column: (string | undefined)[]) { diff --git a/frontend/src/metabase-lib/v1/parameters/utils/template-tag-options.ts b/frontend/src/metabase-lib/v1/parameters/utils/template-tag-options.ts index 5c86db32f90..fc074d41b3b 100644 --- a/frontend/src/metabase-lib/v1/parameters/utils/template-tag-options.ts +++ b/frontend/src/metabase-lib/v1/parameters/utils/template-tag-options.ts @@ -22,7 +22,7 @@ export function getParameterOptions() { return [ ID_OPTION, ...OPTIONS_WITH_OPERATOR_SUBTYPES.map(({ type, typeName }) => - PARAMETER_OPERATOR_TYPES[type].map(option => ({ + PARAMETER_OPERATOR_TYPES[type].map((option) => ({ ...option, combinedName: getOperatorDisplayName(option, type, typeName), })), @@ -33,10 +33,10 @@ export function getParameterOptions() { export function getParameterOptionsForField(field: Field) { return getParameterOptions() - .filter(option => + .filter((option) => fieldFilterForParameter(createMockParameter(option))(field), ) - .map(option => { + .map((option) => { return { ...option, name: "combinedName" in option ? option.combinedName : option.name, @@ -58,7 +58,7 @@ export function getDefaultParameterWidgetType(tag: TemplateTag, field: Field) { if ( widgetType != null && widgetType !== "none" && - options.some(option => option.type === widgetType) + options.some((option) => option.type === widgetType) ) { return widgetType; } @@ -67,7 +67,7 @@ export function getDefaultParameterWidgetType(tag: TemplateTag, field: Field) { if ( distinctCount != null && distinctCount > 20 && - options.some(option => option.type === "string/contains") + options.some((option) => option.type === "string/contains") ) { return "string/contains"; } diff --git a/frontend/src/metabase-lib/v1/parameters/utils/template-tag-options.unit.spec.js b/frontend/src/metabase-lib/v1/parameters/utils/template-tag-options.unit.spec.js index 29ac700b755..d6df5bcb748 100644 --- a/frontend/src/metabase-lib/v1/parameters/utils/template-tag-options.unit.spec.js +++ b/frontend/src/metabase-lib/v1/parameters/utils/template-tag-options.unit.spec.js @@ -18,7 +18,7 @@ describe("parameters/utils/template-tag-options", () => { ); expect(expectedOptionTypes.length).toEqual(options.size); - expect(expectedOptionTypes.every(option => options.has(option))).toBe( + expect(expectedOptionTypes.every((option) => options.has(option))).toBe( true, ); }); @@ -61,7 +61,7 @@ describe("parameters/utils/template-tag-options", () => { const availableOptions = getParameterOptionsForField(dateField); expect( availableOptions.length > 0 && - availableOptions.every(option => option.type.startsWith("date")), + availableOptions.every((option) => option.type.startsWith("date")), ).toBe(true); }); @@ -73,7 +73,7 @@ describe("parameters/utils/template-tag-options", () => { const availableOptions = getParameterOptionsForField(idField); expect( availableOptions.length > 0 && - availableOptions.every(option => option.type.startsWith("id")), + availableOptions.every((option) => option.type.startsWith("id")), ).toBe(true); }); @@ -82,7 +82,7 @@ describe("parameters/utils/template-tag-options", () => { const availableOptions = getParameterOptionsForField(locationField); expect( availableOptions.length > 0 && - availableOptions.every(option => option.type.startsWith("string")), + availableOptions.every((option) => option.type.startsWith("string")), ).toBe(true); }); }); diff --git a/frontend/src/metabase-lib/v1/parameters/utils/template-tags.ts b/frontend/src/metabase-lib/v1/parameters/utils/template-tags.ts index f87d6bd39cd..e415d6d4faa 100644 --- a/frontend/src/metabase-lib/v1/parameters/utils/template-tags.ts +++ b/frontend/src/metabase-lib/v1/parameters/utils/template-tags.ts @@ -64,14 +64,14 @@ export function getTemplateTagParameters( return tags .filter( - tag => + (tag) => tag.type != null && tag.type !== "card" && tag.type !== "snippet" && ((tag["widget-type"] && tag["widget-type"] !== "none") || tag.type !== "dimension"), ) - .map(tag => getTemplateTagParameter(tag, parametersById[tag.id])); + .map((tag) => getTemplateTagParameter(tag, parametersById[tag.id])); } export function getTemplateTags(card: Card): TemplateTag[] { @@ -116,7 +116,7 @@ export function remapParameterValuesToTemplateTags( } = {}; const templateTagParametersByName = _.indexBy(templateTags, "name"); - dashboardParameters.forEach(dashboardParameter => { + dashboardParameters.forEach((dashboardParameter) => { const { target } = dashboardParameter; const tag = getTemplateTagFromTarget(target); diff --git a/frontend/src/metabase-lib/v1/queries/NativeQuery.ts b/frontend/src/metabase-lib/v1/queries/NativeQuery.ts index 6d72c4b1e75..447a7b99984 100644 --- a/frontend/src/metabase-lib/v1/queries/NativeQuery.ts +++ b/frontend/src/metabase-lib/v1/queries/NativeQuery.ts @@ -66,9 +66,9 @@ export function updateCardTemplateTagNames( const tags = query .templateTags() // only tags for cards - .filter(tag => tag.type === "card") + .filter((tag) => tag.type === "card") // only tags for given cards - .filter(tag => cardById[tag["card-id"]]); + .filter((tag) => cardById[tag["card-id"]]); // reduce over each tag, updating query text with the new tag name return tags.reduce((query, tag) => { const card = cardById[tag["card-id"]]; @@ -243,10 +243,10 @@ export default class NativeQuery { updateIn( this._datasetQuery, ["native", "template-tags"], - templateTags => { + (templateTags) => { const entries = Array.from(Object.entries(templateTags)); - const oldIndex = _.findIndex(entries, entry => entry[1].id === id); + const oldIndex = _.findIndex(entries, (entry) => entry[1].id === id); entries.splice(newIndex, 0, entries.splice(oldIndex, 1)[0]); return _.object(entries); @@ -276,7 +276,7 @@ export default class NativeQuery { } variableTemplateTags(): TemplateTag[] { - return this.templateTags().filter(t => + return this.templateTags().filter((t) => ["dimension", "text", "number", "date"].includes(t.type), ); } @@ -286,18 +286,18 @@ export default class NativeQuery { } hasSnippets() { - return this.templateTags().some(t => t.type === "snippet"); + return this.templateTags().some((t) => t.type === "snippet"); } referencedQuestionIds(): number[] { return this.templateTags() - .filter(tag => tag.type === "card") - .map(tag => tag["card-id"]); + .filter((tag) => tag.type === "card") + .map((tag) => tag["card-id"]); } private _validateTemplateTags() { return this.templateTags() - .map(tag => { + .map((tag) => { if (!tag["display-name"]) { return new ValidationError(t`Missing widget label: ${tag.name}`); } @@ -348,9 +348,9 @@ export default class NativeQuery { operatorFilter = _.identity, ): DimensionOptions { const dimensions = this.templateTags() - .filter(tag => tag.type === "dimension" && operatorFilter(tag)) - .map(tag => new TemplateTagDimension(tag.name, this.metadata(), this)) - .filter(dimension => dimensionFilter(dimension)); + .filter((tag) => tag.type === "dimension" && operatorFilter(tag)) + .map((tag) => new TemplateTagDimension(tag.name, this.metadata(), this)) + .filter((dimension) => dimensionFilter(dimension)); return new DimensionOptions({ dimensions: dimensions, count: dimensions.length, @@ -361,15 +361,15 @@ export default class NativeQuery { variableFilter: VariableFilter = () => true, ): TemplateTagVariable[] { return this.templateTags() - .filter(tag => tag.type !== "dimension") - .map(tag => new TemplateTagVariable([tag.name], this.metadata(), this)) + .filter((tag) => tag.type !== "dimension") + .map((tag) => new TemplateTagVariable([tag.name], this.metadata(), this)) .filter(variableFilter); } updateSnippetsWithIds(snippets): NativeQuery { const tagsBySnippetName = _.chain(this.templateTags()) - .filter(tag => tag.type === "snippet" && tag["snippet-id"] == null) - .groupBy(tag => tag["snippet-name"]) + .filter((tag) => tag.type === "snippet" && tag["snippet-id"] == null) + .groupBy((tag) => tag["snippet-name"]) .value(); if (Object.keys(tagsBySnippetName).length === 0) { @@ -393,8 +393,8 @@ export default class NativeQuery { updateSnippetNames(snippets): NativeQuery { const tagsBySnippetId = _.chain(this.templateTags()) - .filter(tag => tag.type === "snippet") - .groupBy(tag => tag["snippet-id"]) + .filter((tag) => tag.type === "snippet") + .groupBy((tag) => tag["snippet-id"]) .value(); if (Object.keys(tagsBySnippetId).length === 0) { diff --git a/frontend/src/metabase-lib/v1/queries/drills/dashboard-click-drill.js b/frontend/src/metabase-lib/v1/queries/drills/dashboard-click-drill.js index 658feda8ff5..12df9227ba4 100644 --- a/frontend/src/metabase-lib/v1/queries/drills/dashboard-click-drill.js +++ b/frontend/src/metabase-lib/v1/queries/drills/dashboard-click-drill.js @@ -84,7 +84,7 @@ export function getDashboardDrillUrl(clicked) { const targetDashboard = extraData.dashboards[targetId]; const targetDefaultParameters = Object.fromEntries( - targetDashboard.parameters.map(parameter => [ + targetDashboard.parameters.map((parameter) => [ parameter.slug, parameter.default ?? "", ]), @@ -216,7 +216,7 @@ function getParameterValuesBySlug( function getTypeForSource(source, data, extraData) { if (source.type === "parameter") { const parameters = getIn(extraData, ["dashboard", "parameters"]) || []; - const { type = "text" } = parameters.find(p => p.id === source.id) || {}; + const { type = "text" } = parameters.find((p) => p.id === source.id) || {}; return type; } diff --git a/frontend/src/metabase-lib/v1/queries/utils/card.js b/frontend/src/metabase-lib/v1/queries/utils/card.js index 393ac3c72c3..dea7208dbe7 100644 --- a/frontend/src/metabase-lib/v1/queries/utils/card.js +++ b/frontend/src/metabase-lib/v1/queries/utils/card.js @@ -18,8 +18,8 @@ function cardVisualizationIsEquivalent(cardA, cardB) { } export function cardQueryIsEquivalent(cardA, cardB) { - cardA = updateIn(cardA, ["dataset_query", "parameters"], p => p || []); - cardB = updateIn(cardB, ["dataset_query", "parameters"], p => p || []); + cardA = updateIn(cardA, ["dataset_query", "parameters"], (p) => p || []); + cardB = updateIn(cardB, ["dataset_query", "parameters"], (p) => p || []); return Lib.areLegacyQueriesEqual( _.pick(cardA, "dataset_query"), _.pick(cardB, "dataset_query"), diff --git a/frontend/src/metabase-lib/v1/queries/utils/dataset.ts b/frontend/src/metabase-lib/v1/queries/utils/dataset.ts index 5a06108edbf..9160fa6fdfa 100644 --- a/frontend/src/metabase-lib/v1/queries/utils/dataset.ts +++ b/frontend/src/metabase-lib/v1/queries/utils/dataset.ts @@ -13,7 +13,7 @@ export function findColumnIndexesForColumnSettings( columns.map((column, index) => [column.name, index]), ); return columnSettings.map( - columnSetting => columnIndexByKey.get(columnSetting.name) ?? -1, + (columnSetting) => columnIndexByKey.get(columnSetting.name) ?? -1, ); } @@ -24,5 +24,7 @@ export function findColumnSettingIndexesForColumns( const columnSettingIndexByKey = new Map( columnSettings.map((columnSetting, index) => [columnSetting.name, index]), ); - return columns.map(column => columnSettingIndexByKey.get(column.name) ?? -1); + return columns.map( + (column) => columnSettingIndexByKey.get(column.name) ?? -1, + ); } diff --git a/frontend/src/metabase-lib/v1/queries/utils/field.js b/frontend/src/metabase-lib/v1/queries/utils/field.js index e57f8930782..91d5fdce347 100644 --- a/frontend/src/metabase-lib/v1/queries/utils/field.js +++ b/frontend/src/metabase-lib/v1/queries/utils/field.js @@ -9,7 +9,7 @@ export function getFieldValues(field) { return values; } else { // console.warn("deprecated field values array!", values); - return values.map(value => [value]); + return values.map((value) => [value]); } } else if (values && Array.isArray(values.values)) { // console.warn("deprecated field values object!", values); diff --git a/frontend/src/metabase-lib/v1/queries/utils/pivot.ts b/frontend/src/metabase-lib/v1/queries/utils/pivot.ts index ffd388c0294..acbdf738c0c 100644 --- a/frontend/src/metabase-lib/v1/queries/utils/pivot.ts +++ b/frontend/src/metabase-lib/v1/queries/utils/pivot.ts @@ -23,9 +23,9 @@ export function isColumnNameColumnSplitSetting( ): setting is ColumnNameColumnSplitSetting { const { rows = [], columns = [], values = [] } = setting; return ( - rows.every(value => typeof value === "string") && - columns.every(value => typeof value === "string") && - values.every(value => typeof value === "string") + rows.every((value) => typeof value === "string") && + columns.every((value) => typeof value === "string") && + values.every((value) => typeof value === "string") ); } @@ -33,7 +33,7 @@ export function isColumnNameCollapsedRowsSetting( setting: PivotTableCollapsedRowsSetting, ): setting is ColumnNameCollapsedRowsSetting { const { rows = [] } = setting; - return rows.every(value => typeof value === "string"); + return rows.every((value) => typeof value === "string"); } function getColumnNamePivotOptions( @@ -43,14 +43,14 @@ function getColumnNamePivotOptions( ): PivotOptions { const returnedColumns = Lib.returnedColumns(query, stageIndex); const breakoutColumnNames = returnedColumns - .map(column => Lib.displayInfo(query, stageIndex, column)) - .filter(columnInfo => columnInfo.isBreakout) - .map(columnInfo => columnInfo.name); + .map((column) => Lib.displayInfo(query, stageIndex, column)) + .filter((columnInfo) => columnInfo.isBreakout) + .map((columnInfo) => columnInfo.name); - const { rows, columns } = _.mapObject(setting, columnNames => { + const { rows, columns } = _.mapObject(setting, (columnNames) => { return columnNames - .map(columnName => breakoutColumnNames.indexOf(columnName)) - .filter(columnIndex => columnIndex >= 0); + .map((columnName) => breakoutColumnNames.indexOf(columnName)) + .filter((columnIndex) => columnIndex >= 0); }); return { pivot_rows: rows ?? [], pivot_cols: columns ?? [] }; @@ -63,10 +63,10 @@ function getFieldRefPivotOptions( ): PivotOptions { const returnedColumns = Lib.returnedColumns(query, stageIndex); const breakoutColumns = returnedColumns.filter( - column => Lib.displayInfo(query, stageIndex, column).isBreakout, + (column) => Lib.displayInfo(query, stageIndex, column).isBreakout, ); - const { rows, columns } = _.mapObject(setting, fieldRefs => { + const { rows, columns } = _.mapObject(setting, (fieldRefs) => { if (breakoutColumns.length === 0) { return []; } @@ -78,7 +78,7 @@ function getFieldRefPivotOptions( breakoutColumns, nonEmptyFieldRefs, ); - return breakoutIndexes.filter(breakoutIndex => breakoutIndex >= 0); + return breakoutIndexes.filter((breakoutIndex) => breakoutIndex >= 0); }); return { pivot_rows: rows ?? [], pivot_cols: columns ?? [] }; @@ -102,11 +102,11 @@ function migratePivotSetting( fieldRefs: (FieldReference | null)[] = [], ): string[] { const columnNameByFieldRef = Object.fromEntries( - columns.map(column => [JSON.stringify(column.field_ref), column.name]), + columns.map((column) => [JSON.stringify(column.field_ref), column.name]), ); return fieldRefs - .map(fieldRef => columnNameByFieldRef[JSON.stringify(fieldRef)]) + .map((fieldRef) => columnNameByFieldRef[JSON.stringify(fieldRef)]) .filter(isNotNull); } diff --git a/frontend/src/metabase-lib/v1/references.ts b/frontend/src/metabase-lib/v1/references.ts index 2c392b7f487..8e6112a71ee 100644 --- a/frontend/src/metabase-lib/v1/references.ts +++ b/frontend/src/metabase-lib/v1/references.ts @@ -46,7 +46,7 @@ export const isValidDimensionReference = ( isExpressionReference, isAggregationReference, isTemplateTagReference, - ].some(predicate => predicate(mbql)); + ].some((predicate) => predicate(mbql)); }; export const normalizeReferenceOptions = ( @@ -57,11 +57,11 @@ export const normalizeReferenceOptions = ( } // recursively normalize maps inside options. - options = _.mapObject(options, val => + options = _.mapObject(options, (val) => typeof val === "object" ? normalizeReferenceOptions(val) : val, ); // remove null/undefined options from map. - options = _.omit(options, value => value == null); + options = _.omit(options, (value) => value == null); return _.isEmpty(options) ? null : options; }; diff --git a/frontend/src/metabase-lib/v1/references.unit.spec.ts b/frontend/src/metabase-lib/v1/references.unit.spec.ts index c43cfb0b50f..f09b29b038b 100644 --- a/frontend/src/metabase-lib/v1/references.unit.spec.ts +++ b/frontend/src/metabase-lib/v1/references.unit.spec.ts @@ -15,7 +15,9 @@ describe("reference predicates", () => { ["field", "column_name", {}], ]; - validReferences.forEach(ref => expect(isFieldReference(ref)).toBe(true)); + validReferences.forEach((ref) => + expect(isFieldReference(ref)).toBe(true), + ); }); it("returns false for invalid field references", () => { @@ -27,7 +29,7 @@ describe("reference predicates", () => { ["field", "column_name", null, { "source-field": true }], ]; - invalidReferences.forEach(ref => + invalidReferences.forEach((ref) => expect(isFieldReference(ref)).toBe(false), ); }); @@ -41,7 +43,7 @@ describe("reference predicates", () => { ["aggregation", "column_name", { "base-type": "number" }], ]; - validReferences.forEach(ref => + validReferences.forEach((ref) => expect(isAggregationReference(ref)).toBe(true), ); }); @@ -49,7 +51,7 @@ describe("reference predicates", () => { it("returns false for invalid aggregation references", () => { const invalidReferences = [null, 123, "aggregation", ["field", 123]]; - invalidReferences.forEach(ref => + invalidReferences.forEach((ref) => expect(isAggregationReference(ref)).toBe(false), ); }); @@ -63,7 +65,7 @@ describe("reference predicates", () => { ["expression", "column_name", { "base-type": "number" }], ]; - validReferences.forEach(ref => + validReferences.forEach((ref) => expect(isExpressionReference(ref)).toBe(true), ); }); @@ -77,7 +79,7 @@ describe("reference predicates", () => { ["field", 123], ]; - invalidReferences.forEach(ref => + invalidReferences.forEach((ref) => expect(isExpressionReference(ref)).toBe(false), ); }); @@ -87,7 +89,7 @@ describe("reference predicates", () => { it("returns true for valid template tag references", () => { const validReferences = [["template-tag", "tag name"]]; - validReferences.forEach(ref => + validReferences.forEach((ref) => expect(isTemplateTagReference(ref)).toBe(true), ); }); @@ -95,7 +97,7 @@ describe("reference predicates", () => { it("returns false for invalid template tag references", () => { const invalidReferences = [null, "tag", ["templateTag", 123]]; - invalidReferences.forEach(ref => + invalidReferences.forEach((ref) => expect(isTemplateTagReference(ref)).toBe(false), ); }); diff --git a/frontend/src/metabase-lib/v1/types/utils/isa.js b/frontend/src/metabase-lib/v1/types/utils/isa.js index 4cf9b514d6c..008a315fa88 100644 --- a/frontend/src/metabase-lib/v1/types/utils/isa.js +++ b/frontend/src/metabase-lib/v1/types/utils/isa.js @@ -110,23 +110,23 @@ export const isSummable = isFieldType.bind(null, SUMMABLE); export const isCategory = isFieldType.bind(null, CATEGORY); export const isLocation = isFieldType.bind(null, LOCATION); -const hasNonMetricName = col => { +const hasNonMetricName = (col) => { const name = col.name.toLowerCase(); return name === "id" || name.endsWith("_id") || name.endsWith("-id"); }; -export const isDimension = col => col && col.source !== "aggregation"; -export const isMetric = col => +export const isDimension = (col) => col && col.source !== "aggregation"; +export const isMetric = (col) => col && col.source !== "breakout" && isSummable(col) && !hasNonMetricName(col); -export const isFK = field => field && isTypeFK(field.semantic_type); -export const isPK = field => field && isTypePK(field.semantic_type); -export const isEntityName = field => +export const isFK = (field) => field && isTypeFK(field.semantic_type); +export const isPK = (field) => field && isTypePK(field.semantic_type); +export const isEntityName = (field) => field && isa(field.semantic_type, TYPE.Name); -export const isAny = col => true; +export const isAny = (col) => true; -export const isNumericBaseType = field => { +export const isNumericBaseType = (field) => { if (!field) { return false; } @@ -137,7 +137,7 @@ export const isNumericBaseType = field => { } }; -export const isDateWithoutTime = field => { +export const isDateWithoutTime = (field) => { if (!field) { return false; } @@ -149,14 +149,14 @@ export const isDateWithoutTime = field => { }; // ZipCode, ID, etc derive from Number but should not be formatted as numbers -export const isNumber = field => +export const isNumber = (field) => field && isNumericBaseType(field) && (field.semantic_type == null || isa(field.semantic_type, TYPE.Number) || isa(field.semantic_type, TYPE.Category)); -export const isTime = field => { +export const isTime = (field) => { if (!field) { return false; } @@ -167,29 +167,29 @@ export const isTime = field => { } }; -export const isState = field => field && isa(field.semantic_type, TYPE.State); -export const isCountry = field => +export const isState = (field) => field && isa(field.semantic_type, TYPE.State); +export const isCountry = (field) => field && isa(field.semantic_type, TYPE.Country); -export const isCoordinate = field => +export const isCoordinate = (field) => field && isa(field.semantic_type, TYPE.Coordinate); -export const isLatitude = field => +export const isLatitude = (field) => field && isa(field.semantic_type, TYPE.Latitude); -export const isLongitude = field => +export const isLongitude = (field) => field && isa(field.semantic_type, TYPE.Longitude); -export const isCurrency = field => +export const isCurrency = (field) => field && isa(field.semantic_type, TYPE.Currency); -export const isPercentage = field => +export const isPercentage = (field) => field && isa(field.semantic_type, TYPE.Percentage); -export const isID = field => isFK(field) || isPK(field); +export const isID = (field) => isFK(field) || isPK(field); -export const isURL = field => field && isa(field.semantic_type, TYPE.URL); -export const isEmail = field => field && isa(field.semantic_type, TYPE.Email); -export const isAvatarURL = field => +export const isURL = (field) => field && isa(field.semantic_type, TYPE.URL); +export const isEmail = (field) => field && isa(field.semantic_type, TYPE.Email); +export const isAvatarURL = (field) => field && isa(field.semantic_type, TYPE.AvatarURL); -export const isImageURL = field => +export const isImageURL = (field) => field && isa(field.semantic_type, TYPE.ImageURL); export function hasLatitudeAndLongitudeColumns(cols) { @@ -206,7 +206,7 @@ export function hasLatitudeAndLongitudeColumns(cols) { return hasLatitude && hasLongitude; } -export const getIsPKFromTablePredicate = tableId => column => { +export const getIsPKFromTablePredicate = (tableId) => (column) => { const isPrimaryKey = isPK(column); // FIXME: columns of nested questions at this moment miss table_id value diff --git a/frontend/src/metabase-lib/v1/types/utils/isa.unit.spec.js b/frontend/src/metabase-lib/v1/types/utils/isa.unit.spec.js index a494c7cba39..58b47e5f41b 100644 --- a/frontend/src/metabase-lib/v1/types/utils/isa.unit.spec.js +++ b/frontend/src/metabase-lib/v1/types/utils/isa.unit.spec.js @@ -40,7 +40,7 @@ describe("isa", () => { createMockColumn({ base_type: TYPE.Integer }), createMockColumn({ base_type: TYPE.BigInteger }), createMockColumn({ base_type: TYPE.BigInteger, name: "solid" }), - ])("should should return true for numeric columns", column => { + ])("should should return true for numeric columns", (column) => { expect(isMetric(column)).toBe(true); }); @@ -52,7 +52,7 @@ describe("isa", () => { createMockColumn({ base_type: TYPE.BigInteger, name: "orders-id" }), ])( "should should return false for breakout, ID, non-summable columns", - column => { + (column) => { expect(isMetric(column)).toBe(false); }, ); diff --git a/frontend/src/metabase-lib/v1/utils/memoize-class.ts b/frontend/src/metabase-lib/v1/utils/memoize-class.ts index 8f62da1dff6..3c4b41e32d7 100644 --- a/frontend/src/metabase-lib/v1/utils/memoize-class.ts +++ b/frontend/src/metabase-lib/v1/utils/memoize-class.ts @@ -34,7 +34,7 @@ export function memoizeClass( return (Class: Constructor): Constructor => { const descriptors = Object.getOwnPropertyDescriptors(Class.prototype); - keys.forEach(key => { + keys.forEach((key) => { // Is targeted method present in Class? if (!(key in descriptors)) { throw new TypeError(`${key} is not a member of class`); diff --git a/frontend/src/metabase-lib/viz/display.ts b/frontend/src/metabase-lib/viz/display.ts index 6e49f141ba4..27bf37ec92f 100644 --- a/frontend/src/metabase-lib/viz/display.ts +++ b/frontend/src/metabase-lib/viz/display.ts @@ -134,7 +134,7 @@ const getBreakoutsWithColumns = ( stageIndex: number, breakouts: Lib.BreakoutClause[], ) => { - return breakouts.map(breakout => { + return breakouts.map((breakout) => { const column = Lib.breakoutColumn(query, stageIndex, breakout); return { breakout, column }; }); diff --git a/frontend/src/metabase-types/api/mocks/search.ts b/frontend/src/metabase-types/api/mocks/search.ts index d0a3d590538..503a61f5394 100644 --- a/frontend/src/metabase-types/api/mocks/search.ts +++ b/frontend/src/metabase-types/api/mocks/search.ts @@ -54,7 +54,7 @@ export const createMockSearchResults = ({ items?: SearchResult[]; options?: Partial; } = {}): SearchResponse => { - const uniqueModels = _.uniq(items.map(item => item.model)); + const uniqueModels = _.uniq(items.map((item) => item.model)); return { available_models: uniqueModels, diff --git a/frontend/src/metabase-types/api/mocks/series.ts b/frontend/src/metabase-types/api/mocks/series.ts index 3aa10a31aae..5998fa7c731 100644 --- a/frontend/src/metabase-types/api/mocks/series.ts +++ b/frontend/src/metabase-types/api/mocks/series.ts @@ -16,5 +16,5 @@ export const createMockSingleSeries = ( }; export const createMockSeries = (opts: { name: string }[]): Series => { - return opts.map(opt => createMockSingleSeries({ name: opt.name })); + return opts.map((opt) => createMockSingleSeries({ name: opt.name })); }; diff --git a/frontend/src/metabase/App.styled.tsx b/frontend/src/metabase/App.styled.tsx index c898790f348..6b956f8e662 100644 --- a/frontend/src/metabase/App.styled.tsx +++ b/frontend/src/metabase/App.styled.tsx @@ -14,10 +14,10 @@ export const AppContentContainer = styled.div<{ }>` flex-grow: 1; display: flex; - flex-direction: ${props => (props.isAdminApp ? "column" : "row")}; + flex-direction: ${(props) => (props.isAdminApp ? "column" : "row")}; position: relative; overflow: hidden; - background-color: ${props => + background-color: ${(props) => props.isAdminApp ? "var(--mb-color-bg-white)" : color("content")}; @media print { diff --git a/frontend/src/metabase/account/app/components/AccountHeader/AccountHeader.tsx b/frontend/src/metabase/account/app/components/AccountHeader/AccountHeader.tsx index 96f2d342ba2..af1a1d54481 100644 --- a/frontend/src/metabase/account/app/components/AccountHeader/AccountHeader.tsx +++ b/frontend/src/metabase/account/app/components/AccountHeader/AccountHeader.tsx @@ -27,7 +27,7 @@ export const AccountHeader = ({ onChangeLocation, }: AccountHeaderProps) => { const hasPasswordChange = useMemo( - () => PLUGIN_IS_PASSWORD_USER.every(predicate => predicate(user)), + () => PLUGIN_IS_PASSWORD_USER.every((predicate) => predicate(user)), [user], ); diff --git a/frontend/src/metabase/account/app/components/AccountHeader/AccountHeader.unit.spec.tsx b/frontend/src/metabase/account/app/components/AccountHeader/AccountHeader.unit.spec.tsx index fb9ba06a7f4..6276eb263fb 100644 --- a/frontend/src/metabase/account/app/components/AccountHeader/AccountHeader.unit.spec.tsx +++ b/frontend/src/metabase/account/app/components/AccountHeader/AccountHeader.unit.spec.tsx @@ -41,7 +41,7 @@ describe("AccountHeader", () => { it("should show the password tab if it is enabled by a plugin", () => { const user = getUser(); - PLUGIN_IS_PASSWORD_USER.push(user => user.google_auth); + PLUGIN_IS_PASSWORD_USER.push((user) => user.google_auth); render(); @@ -50,7 +50,7 @@ describe("AccountHeader", () => { it("should hide the password tab if it is disabled by a plugin", () => { const user = getUser(); - PLUGIN_IS_PASSWORD_USER.push(user => !user.google_auth); + PLUGIN_IS_PASSWORD_USER.push((user) => !user.google_auth); render(); diff --git a/frontend/src/metabase/account/login-history/components/LoginHistory/LoginHistory.jsx b/frontend/src/metabase/account/login-history/components/LoginHistory/LoginHistory.jsx index 0a63fed6c8b..139062bc032 100644 --- a/frontend/src/metabase/account/login-history/components/LoginHistory/LoginHistory.jsx +++ b/frontend/src/metabase/account/login-history/components/LoginHistory/LoginHistory.jsx @@ -45,15 +45,15 @@ const LoginHistoryGroup = ({ items, date }) => (
- {items.map(item => ( + {items.map((item) => ( ))}
); -const formatItems = items => - items.map(item => { +const formatItems = (items) => + items.map((item) => { const parsedTimestamp = moment.parseZone(item.timestamp); return { ...item, @@ -66,7 +66,7 @@ const formatItems = items => function LoginHistoryList({ loginHistory }) { const items = formatItems(loginHistory); - const groups = _.groupBy(items, item => item.date); + const groups = _.groupBy(items, (item) => item.date); if (!items || !items.length) { return ( diff --git a/frontend/src/metabase/account/notifications/components/ArchiveModal/ArchiveModal.jsx b/frontend/src/metabase/account/notifications/components/ArchiveModal/ArchiveModal.jsx index a2458ee690e..0ad95b22ee1 100644 --- a/frontend/src/metabase/account/notifications/components/ArchiveModal/ArchiveModal.jsx +++ b/frontend/src/metabase/account/notifications/components/ArchiveModal/ArchiveModal.jsx @@ -97,7 +97,7 @@ const getSubmitMessage = (type, hasUnsubscribed) => { } }; -const getCancelMessage = hasUnsubscribed => { +const getCancelMessage = (hasUnsubscribed) => { return hasUnsubscribed ? t`Keep it around` : t`I changed my mind`; }; @@ -122,7 +122,7 @@ const getDateMessage = (item, type) => { } }; -const getRecipientsMessage = item => { +const getRecipientsMessage = (item) => { return t`It’s currently being sent to ${formatChannelRecipients(item)}.`; }; diff --git a/frontend/src/metabase/account/notifications/components/NotificationList/NotificationList.tsx b/frontend/src/metabase/account/notifications/components/NotificationList/NotificationList.tsx index 25614c9beef..79e7ed323ba 100644 --- a/frontend/src/metabase/account/notifications/components/NotificationList/NotificationList.tsx +++ b/frontend/src/metabase/account/notifications/components/NotificationList/NotificationList.tsx @@ -49,7 +49,7 @@ export const NotificationList = ({ {t`Not seeing one here?`} - {listItems.map(listItem => + {listItems.map((listItem) => listItem.type === "pulse" ? ( { return user != null && user.id === item.creator?.id; }; -const getUnsubscribeMessage = type => { +const getUnsubscribeMessage = (type) => { switch (type) { case "alert": return t`You’ll stop receiving this alert from now on. `; diff --git a/frontend/src/metabase/account/notifications/containers/NotificationsApp/NotificationsApp.tsx b/frontend/src/metabase/account/notifications/containers/NotificationsApp/NotificationsApp.tsx index f00d47ee940..14302ac1428 100644 --- a/frontend/src/metabase/account/notifications/containers/NotificationsApp/NotificationsApp.tsx +++ b/frontend/src/metabase/account/notifications/containers/NotificationsApp/NotificationsApp.tsx @@ -44,11 +44,11 @@ const NotificationsAppInner = ({ const items = useMemo(() => { const combinedItems: NotificationListItem[] = [ - ...questionNotifications.map(alert => ({ + ...questionNotifications.map((alert) => ({ item: alert, type: "question-notification" as const, })), - ...pulses.map(pulse => ({ + ...pulses.map((pulse) => ({ item: pulse, type: "pulse" as const, })), diff --git a/frontend/src/metabase/account/profile/selectors.ts b/frontend/src/metabase/account/profile/selectors.ts index ae0833d7d64..598a3166685 100644 --- a/frontend/src/metabase/account/profile/selectors.ts +++ b/frontend/src/metabase/account/profile/selectors.ts @@ -4,13 +4,13 @@ import { PLUGIN_IS_PASSWORD_USER } from "metabase/plugins"; import { getSettings } from "metabase/selectors/settings"; import { getUser } from "metabase/selectors/user"; -export const getIsSsoUser = createSelector(getUser, user => { +export const getIsSsoUser = createSelector(getUser, (user) => { if (!user) { return false; } - return !PLUGIN_IS_PASSWORD_USER.every(predicate => predicate(user)); + return !PLUGIN_IS_PASSWORD_USER.every((predicate) => predicate(user)); }); -export const getLocales = createSelector([getSettings], settings => { +export const getLocales = createSelector([getSettings], (settings) => { return settings["available-locales"]; }); diff --git a/frontend/src/metabase/actions/components/ActionForm/ActionForm.tsx b/frontend/src/metabase/actions/components/ActionForm/ActionForm.tsx index 392ed2cefc0..9eee1370c33 100644 --- a/frontend/src/metabase/actions/components/ActionForm/ActionForm.tsx +++ b/frontend/src/metabase/actions/components/ActionForm/ActionForm.tsx @@ -54,7 +54,7 @@ function ActionForm({ }); const editableFields = useMemo( - () => form.fields.filter(field => !hiddenFields.includes(field.name)), + () => form.fields.filter((field) => !hiddenFields.includes(field.name)), [form, hiddenFields], ); @@ -82,7 +82,7 @@ function ActionForm({ enableReinitialize > - {editableFields.map(field => ( + {editableFields.map((field) => ( ))} diff --git a/frontend/src/metabase/actions/components/ActionForm/ActionForm.unit.spec.tsx b/frontend/src/metabase/actions/components/ActionForm/ActionForm.unit.spec.tsx index 8bba44cacb9..4f337f41da8 100644 --- a/frontend/src/metabase/actions/components/ActionForm/ActionForm.unit.spec.tsx +++ b/frontend/src/metabase/actions/components/ActionForm/ActionForm.unit.spec.tsx @@ -580,7 +580,7 @@ describe("Actions > ActionForm", () => { // this may not be the final desired behavior, but it's what we have for now describe("Null Handling", () => { const inputTypes = ["string", "number", "text", "date", "datetime", "time"]; - inputTypes.forEach(inputType => { + inputTypes.forEach((inputType) => { it(`casts empty optional ${inputType} field to null`, async () => { const { action, onSubmit } = setup({ initialValues: { "abc-123": 1 }, diff --git a/frontend/src/metabase/actions/components/ActionViz/ActionDashcardSettings.tsx b/frontend/src/metabase/actions/components/ActionViz/ActionDashcardSettings.tsx index b76eb513b9a..ea529ae94f9 100644 --- a/frontend/src/metabase/actions/components/ActionViz/ActionDashcardSettings.tsx +++ b/frontend/src/metabase/actions/components/ActionViz/ActionDashcardSettings.tsx @@ -62,7 +62,7 @@ export function ActionDashcardSettings({ const currentMappings = useMemo( () => Object.fromEntries( - dashcard.parameter_mappings?.map(mapping => [ + dashcard.parameter_mappings?.map((mapping) => [ getTargetKey(mapping), mapping.parameter_id, ]) ?? [], @@ -72,7 +72,7 @@ export function ActionDashcardSettings({ const isFormInvalid = action != null && - action.parameters?.some(actionParameter => { + action.parameters?.some((actionParameter) => { const isHidden = isParameterHidden(action, actionParameter); const isRequired = isParameterRequired(action, actionParameter); const isParameterMapped = diff --git a/frontend/src/metabase/actions/components/ActionViz/ActionDashcardSettings.unit.spec.tsx b/frontend/src/metabase/actions/components/ActionViz/ActionDashcardSettings.unit.spec.tsx index eb4baae49d3..9325e233237 100644 --- a/frontend/src/metabase/actions/components/ActionViz/ActionDashcardSettings.unit.spec.tsx +++ b/frontend/src/metabase/actions/components/ActionViz/ActionDashcardSettings.unit.spec.tsx @@ -86,7 +86,7 @@ const setup = ( React.ComponentProps >, ) => { - const searchItems = models.map(model => + const searchItems = models.map((model) => createMockCollectionItem({ ...model, model: "dataset" }), ); const closeSpy = jest.fn(); @@ -554,7 +554,7 @@ function dashcardFactory({ ...actionDashcardWithAction, action: action, parameter_mappings: mapped - ? action.parameters.map(parameter => ({ + ? action.parameters.map((parameter) => ({ parameter_id: dashboardParameter.id, target: parameter.target, })) diff --git a/frontend/src/metabase/actions/components/ActionViz/ActionParameterMapping.styled.tsx b/frontend/src/metabase/actions/components/ActionViz/ActionParameterMapping.styled.tsx index 9b475a2849d..f1d89e3b9c1 100644 --- a/frontend/src/metabase/actions/components/ActionViz/ActionParameterMapping.styled.tsx +++ b/frontend/src/metabase/actions/components/ActionViz/ActionParameterMapping.styled.tsx @@ -13,7 +13,7 @@ interface ParameterFormLabelProps { } export const ParameterFormLabel = styled.label` - color: ${props => (props.error ? color("error") : color("text-medium"))}; + color: ${(props) => (props.error ? color("error") : color("text-medium"))}; font-size: 0.75rem; display: flex; gap: ${space(1)}; diff --git a/frontend/src/metabase/actions/components/ActionViz/ActionParameterMapping.tsx b/frontend/src/metabase/actions/components/ActionViz/ActionParameterMapping.tsx index 67bd88e4945..d241f37e443 100644 --- a/frontend/src/metabase/actions/components/ActionViz/ActionParameterMapping.tsx +++ b/frontend/src/metabase/actions/components/ActionViz/ActionParameterMapping.tsx @@ -158,7 +158,7 @@ export const ActionParameterMappingItem = ({ hasDefaultValue, defaultValue, }), - ...dashboardParameters.map(dashboardParam => ({ + ...dashboardParameters.map((dashboardParam) => ({ key: dashboardParam.id, name: dashboardParam.name, value: dashboardParam.id, diff --git a/frontend/src/metabase/actions/components/ActionViz/utils.ts b/frontend/src/metabase/actions/components/ActionViz/utils.ts index 983930b74ac..d827c8476ab 100644 --- a/frontend/src/metabase/actions/components/ActionViz/utils.ts +++ b/frontend/src/metabase/actions/components/ActionViz/utils.ts @@ -32,7 +32,7 @@ function prepareParameter( mapping; const parameterValue = parameterValues[sourceParameterId]; - const actionParameter = action.parameters.find(parameter => + const actionParameter = action.parameters.find((parameter) => _.isEqual(parameter.target, actionParameterTarget), ); @@ -59,7 +59,7 @@ export function getDashcardParamValues( return Object.fromEntries( parameter_mappings - ?.map(mapping => prepareParameter(mapping, action, parameterValues)) + ?.map((mapping) => prepareParameter(mapping, action, parameterValues)) ?.filter(isNotNull), ); } @@ -76,7 +76,7 @@ export function getNotProvidedActionParameters( dashboardParamValues: ParametersForActionExecution, ) { // return any action parameters that don't have mapped values - return (action.parameters ?? []).filter(parameter => { + return (action.parameters ?? []).filter((parameter) => { if ("default" in parameter) { return false; } @@ -89,7 +89,7 @@ export function getMappedActionParameters( dashboardParamValues: ParametersForActionExecution, ) { const parameters = action.parameters ?? []; - return parameters.filter(parameter => { + return parameters.filter((parameter) => { return isMappedParameter(parameter, dashboardParamValues); }); } diff --git a/frontend/src/metabase/actions/containers/ActionCreator/ActionContext/QueryActionContextProvider/utils.ts b/frontend/src/metabase/actions/containers/ActionCreator/ActionContext/QueryActionContextProvider/utils.ts index 608512c669e..a91cec76f04 100644 --- a/frontend/src/metabase/actions/containers/ActionCreator/ActionContext/QueryActionContextProvider/utils.ts +++ b/frontend/src/metabase/actions/containers/ActionCreator/ActionContext/QueryActionContextProvider/utils.ts @@ -74,7 +74,7 @@ export const setParameterTypesFromFieldSettings = ( parameters: Parameter[], ): Parameter[] => { const fields = settings.fields || {}; - return parameters.map(parameter => { + return parameters.map((parameter) => { const field = fields[parameter.id]; return { ...parameter, diff --git a/frontend/src/metabase/actions/containers/ActionCreator/ActionContext/QueryActionContextProvider/utils.unit.spec.ts b/frontend/src/metabase/actions/containers/ActionCreator/ActionContext/QueryActionContextProvider/utils.unit.spec.ts index 336abfaf65b..fa21459b318 100644 --- a/frontend/src/metabase/actions/containers/ActionCreator/ActionContext/QueryActionContextProvider/utils.unit.spec.ts +++ b/frontend/src/metabase/actions/containers/ActionCreator/ActionContext/QueryActionContextProvider/utils.unit.spec.ts @@ -76,7 +76,7 @@ describe("actions > containers > ActionCreator > QueryActionContextProvider > ut parameters, ); - newParams.forEach(param => expect(param.type).toEqual("string/=")); + newParams.forEach((param) => expect(param.type).toEqual("string/=")); }); it("should set number parameter types", () => { @@ -100,7 +100,7 @@ describe("actions > containers > ActionCreator > QueryActionContextProvider > ut parameters, ); - newParams.forEach(param => expect(param.type).toEqual("number/=")); + newParams.forEach((param) => expect(param.type).toEqual("number/=")); }); it("should set date parameter types", () => { @@ -124,7 +124,7 @@ describe("actions > containers > ActionCreator > QueryActionContextProvider > ut parameters, ); - newParams.forEach(param => expect(param.type).toEqual("date/single")); + newParams.forEach((param) => expect(param.type).toEqual("date/single")); }); }); diff --git a/frontend/src/metabase/actions/containers/ActionCreator/ActionCreatorView.tsx b/frontend/src/metabase/actions/containers/ActionCreator/ActionCreatorView.tsx index 547bf5ec391..75637a868de 100644 --- a/frontend/src/metabase/actions/containers/ActionCreator/ActionCreatorView.tsx +++ b/frontend/src/metabase/actions/containers/ActionCreator/ActionCreatorView.tsx @@ -62,7 +62,7 @@ export default function ActionCreatorView({ useState(DEFAULT_SIDE_VIEW); const toggleDataRef = useCallback(() => { - setActiveSideView(activeSideView => { + setActiveSideView((activeSideView) => { if (activeSideView !== "dataReference") { return "dataReference"; } @@ -72,7 +72,7 @@ export default function ActionCreatorView({ }, []); const toggleActionSettings = useCallback(() => { - setActiveSideView(activeSideView => { + setActiveSideView((activeSideView) => { if (activeSideView !== "actionSettings") { return "actionSettings"; } @@ -94,7 +94,7 @@ export default function ActionCreatorView({ name={action.name ?? t`New Action`} canRename={canRename} isEditable={isEditable} - onChangeName={name => onChangeAction({ name })} + onChangeName={(name) => onChangeAction({ name })} actionButtons={[ + const docsLink = useSelector((state) => getDocsUrl(state, { page: "actions/custom" }), ); const showMetabaseLinks = useSelector(getShowMetabaseLinks); diff --git a/frontend/src/metabase/actions/containers/ActionCreator/FormCreator/FieldSettingsPopover.tsx b/frontend/src/metabase/actions/containers/ActionCreator/FormCreator/FieldSettingsPopover.tsx index de7a5479e0e..5834d49bb6f 100644 --- a/frontend/src/metabase/actions/containers/ActionCreator/FormCreator/FieldSettingsPopover.tsx +++ b/frontend/src/metabase/actions/containers/ActionCreator/FormCreator/FieldSettingsPopover.tsx @@ -155,7 +155,7 @@ function PlaceholderInput({ id={id} fullWidth value={value} - onChange={e => onChange(e.target.value)} + onChange={(e) => onChange(e.target.value)} data-testid="placeholder-input" />
diff --git a/frontend/src/metabase/actions/containers/ActionCreator/FormCreator/FormCreator.tsx b/frontend/src/metabase/actions/containers/ActionCreator/FormCreator/FormCreator.tsx index 46ee6437776..49134b85060 100644 --- a/frontend/src/metabase/actions/containers/ActionCreator/FormCreator/FormCreator.tsx +++ b/frontend/src/metabase/actions/containers/ActionCreator/FormCreator/FormCreator.tsx @@ -153,7 +153,7 @@ export function FormCreator({ const fieldSettings = formSettings.fields || {}; - const showWarning = form.fields.some(field => { + const showWarning = form.fields.some((field) => { const settings = fieldSettings[field.name]; if (!settings) { @@ -162,7 +162,7 @@ export function FormCreator({ if (actionType === "implicit") { const parameter = parameters.find( - parameter => parameter.id === settings.id, + (parameter) => parameter.id === settings.id, ); return parameter?.required && settings.hidden; diff --git a/frontend/src/metabase/actions/containers/ActionCreator/FormCreator/FormFieldEditor/FormFieldEditor.styled.tsx b/frontend/src/metabase/actions/containers/ActionCreator/FormCreator/FormFieldEditor/FormFieldEditor.styled.tsx index 3d09c64822e..ad44aed7892 100644 --- a/frontend/src/metabase/actions/containers/ActionCreator/FormCreator/FormFieldEditor/FormFieldEditor.styled.tsx +++ b/frontend/src/metabase/actions/containers/ActionCreator/FormCreator/FormFieldEditor/FormFieldEditor.styled.tsx @@ -39,7 +39,7 @@ export const EditorContainer = styled(ContentContainer)` export const Column = styled.div<{ full?: boolean }>` display: flex; flex-direction: column; - flex: ${props => (props.full ? 1 : "unset")}; + flex: ${(props) => (props.full ? 1 : "unset")}; min-width: ${DRAG_HANDLE_SIZE}px; `; diff --git a/frontend/src/metabase/actions/containers/ActionCreator/FormCreator/FormFieldEditor/FormFieldEditor.tsx b/frontend/src/metabase/actions/containers/ActionCreator/FormCreator/FormFieldEditor/FormFieldEditor.tsx index 11354582c54..d5116ab3f5f 100644 --- a/frontend/src/metabase/actions/containers/ActionCreator/FormCreator/FormFieldEditor/FormFieldEditor.tsx +++ b/frontend/src/metabase/actions/containers/ActionCreator/FormCreator/FormFieldEditor/FormFieldEditor.tsx @@ -53,7 +53,7 @@ function cleanFieldValue( function cleanOptionValues(values: FieldValueOptions, fieldType: FieldType) { return values - .map(value => cleanFieldValue(value, fieldType)) + .map((value) => cleanFieldValue(value, fieldType)) .filter(isNotNull); } @@ -71,7 +71,7 @@ function FormFieldEditor({ const { inputType, valueOptions } = fieldSettings; const inputTypesForNextFieldType = inputTypeOptions[nextFieldType].map( - option => option.value, + (option) => option.value, ); // Allows to preserve dropdown/radio input types across number/string field types diff --git a/frontend/src/metabase/actions/containers/ActionCreator/FormCreator/FormFieldEditor/FormFieldEditor.unit.spec.tsx b/frontend/src/metabase/actions/containers/ActionCreator/FormCreator/FormFieldEditor/FormFieldEditor.unit.spec.tsx index 343b7216003..e076a1cf5cb 100644 --- a/frontend/src/metabase/actions/containers/ActionCreator/FormCreator/FormFieldEditor/FormFieldEditor.unit.spec.tsx +++ b/frontend/src/metabase/actions/containers/ActionCreator/FormCreator/FormFieldEditor/FormFieldEditor.unit.spec.tsx @@ -35,7 +35,7 @@ function setup({ field={field} fieldSettings={fieldSettings} isEditable={isEditable} - onChange={nextFieldSettings => { + onChange={(nextFieldSettings) => { onChange(nextFieldSettings); setFieldSettings(nextFieldSettings); }} diff --git a/frontend/src/metabase/actions/containers/ActionCreator/FormCreator/OptionEditor.styled.tsx b/frontend/src/metabase/actions/containers/ActionCreator/FormCreator/OptionEditor.styled.tsx index 52fb7b6ed1e..d7389c0b71f 100644 --- a/frontend/src/metabase/actions/containers/ActionCreator/FormCreator/OptionEditor.styled.tsx +++ b/frontend/src/metabase/actions/containers/ActionCreator/FormCreator/OptionEditor.styled.tsx @@ -16,7 +16,7 @@ export const AddMorePrompt = styled.div<{ isVisible: boolean }>` height: 1.25rem; color: var(--mb-color-text-light); transition: opacity 0.2s ease-in-out; - opacity: ${props => (props.isVisible ? 1 : 0)}; + opacity: ${(props) => (props.isVisible ? 1 : 0)}; `; export const ErrorMessage = styled.div` diff --git a/frontend/src/metabase/actions/containers/ActionCreator/FormCreator/OptionEditor.tsx b/frontend/src/metabase/actions/containers/ActionCreator/FormCreator/OptionEditor.tsx index ff6ec4def42..503bf6d8ecc 100644 --- a/frontend/src/metabase/actions/containers/ActionCreator/FormCreator/OptionEditor.tsx +++ b/frontend/src/metabase/actions/containers/ActionCreator/FormCreator/OptionEditor.tsx @@ -19,7 +19,7 @@ export const textToOptions = (text: string): FieldValueOptions => { const options = text .trim() .split("\n") - .map(option => option.trim()) + .map((option) => option.trim()) .filter(Boolean); const uniqueOptions = [...new Set(options)]; @@ -31,7 +31,7 @@ function transformOptionsIfNeeded( fieldType: FieldType, ) { if (fieldType === "number") { - return options.map(option => Number(option)); + return options.map((option) => Number(option)); } return options; @@ -42,7 +42,7 @@ function getValidationError(options: FieldValueOptions, fieldType: FieldType) { return; } - const isValid = options.every(option => !Number.isNaN(option)); + const isValid = options.every((option) => !Number.isNaN(option)); return isValid ? undefined : t`Invalid number format`; } diff --git a/frontend/src/metabase/actions/containers/ActionCreator/InlineActionSettings.tsx b/frontend/src/metabase/actions/containers/ActionCreator/InlineActionSettings.tsx index 0d250962a6b..dd30ad2d861 100644 --- a/frontend/src/metabase/actions/containers/ActionCreator/InlineActionSettings.tsx +++ b/frontend/src/metabase/actions/containers/ActionCreator/InlineActionSettings.tsx @@ -96,7 +96,7 @@ const InlineActionSettings = ({ useDisclosure(false); const hasSharingPermission = isAdmin && isPublicSharingEnabled; - const handleTogglePublic: ChangeEventHandler = event => { + const handleTogglePublic: ChangeEventHandler = (event) => { const isPublic = event.target.checked; if (isPublic) { diff --git a/frontend/src/metabase/actions/containers/ActionCreator/utils.ts b/frontend/src/metabase/actions/containers/ActionCreator/utils.ts index 02759ea04b2..96cd61ca004 100644 --- a/frontend/src/metabase/actions/containers/ActionCreator/utils.ts +++ b/frontend/src/metabase/actions/containers/ActionCreator/utils.ts @@ -7,7 +7,7 @@ export const syncFieldsWithParameters = ( settings: ActionFormSettings, parameters: Parameter[], ): ActionFormSettings => { - const parameterIds = parameters.map(parameter => parameter.id); + const parameterIds = parameters.map((parameter) => parameter.id); const fieldIds = Object.keys(settings.fields || {}); const addedIds = _.difference(parameterIds, fieldIds); const removedIds = _.difference(fieldIds, parameterIds); @@ -21,7 +21,7 @@ export const syncFieldsWithParameters = ( fields: { ..._.omit(settings.fields, removedIds), ...Object.fromEntries( - addedIds.map(id => [id, getDefaultFieldSettings({ id })]), + addedIds.map((id) => [id, getDefaultFieldSettings({ id })]), ), }, }; diff --git a/frontend/src/metabase/actions/containers/ActionCreatorModal/ActionCreatorModal.unit.spec.tsx b/frontend/src/metabase/actions/containers/ActionCreatorModal/ActionCreatorModal.unit.spec.tsx index ef44ccae4b5..11df0674ca7 100644 --- a/frontend/src/metabase/actions/containers/ActionCreatorModal/ActionCreatorModal.unit.spec.tsx +++ b/frontend/src/metabase/actions/containers/ActionCreatorModal/ActionCreatorModal.unit.spec.tsx @@ -56,7 +56,7 @@ async function setup({ <> ( + component={(routeProps) => ( history?.push(`/model/${MODEL.id}/detail/actions`)} diff --git a/frontend/src/metabase/actions/containers/ActionParametersInputForm/ActionParametersInputForm.tsx b/frontend/src/metabase/actions/containers/ActionParametersInputForm/ActionParametersInputForm.tsx index b42c68093a9..19018626ee9 100644 --- a/frontend/src/metabase/actions/containers/ActionParametersInputForm/ActionParametersInputForm.tsx +++ b/frontend/src/metabase/actions/containers/ActionParametersInputForm/ActionParametersInputForm.tsx @@ -32,11 +32,11 @@ function ActionParametersInputForm({ const hiddenFieldIds = Object.values( action.visualization_settings?.fields ?? {}, ) - .filter(field => field.hidden) - .map(field => field.id); + .filter((field) => field.hidden) + .map((field) => field.id); return mappedParameters - .map(parameter => parameter.id) + .map((parameter) => parameter.id) .concat(hiddenFieldIds); }, [mappedParameters, action.visualization_settings?.fields]); diff --git a/frontend/src/metabase/actions/containers/ActionPicker/ActionPicker.tsx b/frontend/src/metabase/actions/containers/ActionPicker/ActionPicker.tsx index 753e44bc0d4..4e7e3bdedcc 100644 --- a/frontend/src/metabase/actions/containers/ActionPicker/ActionPicker.tsx +++ b/frontend/src/metabase/actions/containers/ActionPicker/ActionPicker.tsx @@ -43,7 +43,7 @@ export function ActionPicker({ return (
- {sortedModels.map(model => ( + {sortedModels.map((model) => ( {actions.length ? ( - {actions.map(action => ( + {actions.map((action) => ( { + fieldValues.forEach((fieldValue) => { const singleFieldSettings = generatedFieldSettings[fieldValue.id]; // this is the only field we sync with BE singleFieldSettings.hidden = fieldValue.hidden; diff --git a/frontend/src/metabase/actions/hooks/use-action-form/utils.unit.spec.ts b/frontend/src/metabase/actions/hooks/use-action-form/utils.unit.spec.ts index 3d67bd72c3e..f1c554cabf1 100644 --- a/frontend/src/metabase/actions/hooks/use-action-form/utils.unit.spec.ts +++ b/frontend/src/metabase/actions/hooks/use-action-form/utils.unit.spec.ts @@ -128,7 +128,7 @@ describe("actions > containers > ActionParametersInputForm > utils", () => { const timezones = ["-02:00", "-07:00", "+01:00", "+09:00"]; - timezones.forEach(offset => { + timezones.forEach((offset) => { describe(`with timezone ${offset}`, () => { it("formats dates", () => { const result = formatInitialValue( diff --git a/frontend/src/metabase/actions/utils.ts b/frontend/src/metabase/actions/utils.ts index 59e8666a194..be06c74edb5 100644 --- a/frontend/src/metabase/actions/utils.ts +++ b/frontend/src/metabase/actions/utils.ts @@ -45,7 +45,7 @@ const fieldPropsTypeMap: FieldPropTypeMap = { const getOptionsFromArray = ( options: (number | string)[], -): ActionFormOption[] => options.map(o => ({ name: o, value: o })); +): ActionFormOption[] => options.map((o) => ({ name: o, value: o })); function getSampleOptions(fieldType: FieldType) { return fieldType === "number" @@ -253,7 +253,7 @@ export const getForm = ( ); return { fields: sortedParams - .map(param => getFormField(param, fieldSettings[param.id] ?? {})) + .map((param) => getFormField(param, fieldSettings[param.id] ?? {})) .filter(Boolean) as ActionFormFieldProps[], }; }; @@ -289,11 +289,11 @@ export const getFormValidationSchema = ( fieldSettings: FieldSettingsMap = {}, ) => { const schema = Object.values(fieldSettings) - .filter(fieldSetting => + .filter((fieldSetting) => // only validate fields that are present in the form - parameters.find(parameter => parameter.id === fieldSetting.id), + parameters.find((parameter) => parameter.id === fieldSetting.id), ) - .map(fieldSetting => { + .map((fieldSetting) => { let yupType = getFieldValidationType(fieldSetting); if (fieldSetting.required) { diff --git a/frontend/src/metabase/admin/app/components/DeprecationNotice/DeprecationNotice.stories.tsx b/frontend/src/metabase/admin/app/components/DeprecationNotice/DeprecationNotice.stories.tsx index 2675bdfea7d..57f8ce50735 100644 --- a/frontend/src/metabase/admin/app/components/DeprecationNotice/DeprecationNotice.stories.tsx +++ b/frontend/src/metabase/admin/app/components/DeprecationNotice/DeprecationNotice.stories.tsx @@ -13,7 +13,7 @@ export default { }; export const Default: StoryObj = { - render: args => { + render: (args) => { return ; }, diff --git a/frontend/src/metabase/admin/app/components/SettingsCommandPaletteActions.tsx b/frontend/src/metabase/admin/app/components/SettingsCommandPaletteActions.tsx index c7f03680ccb..3252959e88a 100644 --- a/frontend/src/metabase/admin/app/components/SettingsCommandPaletteActions.tsx +++ b/frontend/src/metabase/admin/app/components/SettingsCommandPaletteActions.tsx @@ -25,11 +25,11 @@ export const SettingsCommandPaletteActions = () => { dispatch(initializeSettings()); }); - const sections = useSelector>(state => + const sections = useSelector>((state) => getSections(state), ); - const { search: query } = useKBar(state => ({ search: state.searchQuery })); + const { search: query } = useKBar((state) => ({ search: state.searchQuery })); const hasQuery = query.length > 0; const adminSettingsActions = useMemo(() => { @@ -39,8 +39,8 @@ export const SettingsCommandPaletteActions = () => { const acc: Action[] = [ ...memo, ...settings - .filter(s => s.display_name) - .map(s => ({ + .filter((s) => s.display_name) + .map((s) => ({ name: s.display_name || "", section: "admin", id: `admin-setting-${s.key}`, diff --git a/frontend/src/metabase/admin/app/reducers.ts b/frontend/src/metabase/admin/app/reducers.ts index f15f10fc8b9..6cecb399eea 100644 --- a/frontend/src/metabase/admin/app/reducers.ts +++ b/frontend/src/metabase/admin/app/reducers.ts @@ -61,13 +61,13 @@ export const getAdminPaths: () => AdminPath[] = () => { return items; }; -const paths = createReducer(getAdminPaths(), builder => { +const paths = createReducer(getAdminPaths(), (builder) => { builder.addCase(refreshCurrentUser.fulfilled, (state, { payload: user }) => { if (user?.is_superuser) { return state; } - const allowedPaths = PLUGIN_ADMIN_ALLOWED_PATH_GETTERS.map(getter => { + const allowedPaths = PLUGIN_ADMIN_ALLOWED_PATH_GETTERS.map((getter) => { return getter(user); }) .flat() @@ -77,14 +77,14 @@ const paths = createReducer(getAdminPaths(), builder => { }, new Set()); return state - .filter(path => (allowedPaths.has(path.key) ? path : null)) + .filter((path) => (allowedPaths.has(path.key) ? path : null)) .filter(isNotNull); }); }); const isNoticeEnabled = createReducer( Settings.deprecationNoticeEnabled(), - builder => { + (builder) => { builder.addCase(disableNotice.fulfilled, () => false); }, ); diff --git a/frontend/src/metabase/admin/app/selectors.ts b/frontend/src/metabase/admin/app/selectors.ts index 27060f72b2e..bbc5bb096dc 100644 --- a/frontend/src/metabase/admin/app/selectors.ts +++ b/frontend/src/metabase/admin/app/selectors.ts @@ -20,7 +20,7 @@ export const hasDeprecatedDatabase = (state: State, props: Props): boolean => { const engines = getEngines(state); return ( props.databases?.some( - d => !d.is_sample && d.engine && isDeprecatedEngine(engines, d.engine), + (d) => !d.is_sample && d.engine && isDeprecatedEngine(engines, d.engine), ) ?? false ); }; diff --git a/frontend/src/metabase/admin/databases/components/DatabaseConnectionInfoSection/DatabaseConnectionInfoSection.tsx b/frontend/src/metabase/admin/databases/components/DatabaseConnectionInfoSection/DatabaseConnectionInfoSection.tsx index be0f2457d9a..55e1ea20327 100644 --- a/frontend/src/metabase/admin/databases/components/DatabaseConnectionInfoSection/DatabaseConnectionInfoSection.tsx +++ b/frontend/src/metabase/admin/databases/components/DatabaseConnectionInfoSection/DatabaseConnectionInfoSection.tsx @@ -67,7 +67,7 @@ export const DatabaseConnectionInfoSection = ({ ) .with( { currentData: { status: "error" } }, - q => ({ message: q.currentData.message, color: "danger" }) as const, + (q) => ({ message: q.currentData.message, color: "danger" }) as const, ) .with( { isError: true }, diff --git a/frontend/src/metabase/admin/databases/components/DatabaseConnectionInfoSection/DatabaseConnectionInfoSection.unit.spec.tsx b/frontend/src/metabase/admin/databases/components/DatabaseConnectionInfoSection/DatabaseConnectionInfoSection.unit.spec.tsx index fa10efe1c5b..92dfb489233 100644 --- a/frontend/src/metabase/admin/databases/components/DatabaseConnectionInfoSection/DatabaseConnectionInfoSection.unit.spec.tsx +++ b/frontend/src/metabase/admin/databases/components/DatabaseConnectionInfoSection/DatabaseConnectionInfoSection.unit.spec.tsx @@ -74,7 +74,7 @@ describe("DatabaseConnectionInfoSection", () => { it("should show error message if healthcheck returns errors", async () => { setup({ - mockEndpointsCb: database => { + mockEndpointsCb: (database) => { fetchMock.get( `path:/api/database/${database.id}/healthcheck`, { body: { status: "error", message: "Test failure" } }, @@ -87,7 +87,7 @@ describe("DatabaseConnectionInfoSection", () => { it("should show error message if healthcheck HTTP request fails", async () => { setup({ - mockEndpointsCb: database => { + mockEndpointsCb: (database) => { fetchMock.get( `path:/api/database/${database.id}/healthcheck`, { status: 500 }, @@ -136,7 +136,7 @@ describe("DatabaseConnectionInfoSection", () => { ).not.toBeInTheDocument(); }); - NOT_SYNCED_DB_STATUSES.forEach(initial_sync_status => { + NOT_SYNCED_DB_STATUSES.forEach((initial_sync_status) => { it(`is shown for a database with "${initial_sync_status}" sync status`, () => { setup({ database: createMockDatabase({ initial_sync_status }) }); diff --git a/frontend/src/metabase/admin/databases/components/DatabaseDangerZoneSection/DatabaseDangerZoneSection.tsx b/frontend/src/metabase/admin/databases/components/DatabaseDangerZoneSection/DatabaseDangerZoneSection.tsx index 17610305500..dc0236fbc6a 100644 --- a/frontend/src/metabase/admin/databases/components/DatabaseDangerZoneSection/DatabaseDangerZoneSection.tsx +++ b/frontend/src/metabase/admin/databases/components/DatabaseDangerZoneSection/DatabaseDangerZoneSection.tsx @@ -42,7 +42,7 @@ export const DatabaseDangerZoneSection = ({ const hasCompletedSync = isSyncCompleted(database); const shouldHideSection = database.is_attached_dwh || - [hasCompletedSync, isAdmin].every(bool => bool === false); + [hasCompletedSync, isAdmin].every((bool) => bool === false); if (shouldHideSection) { return null; diff --git a/frontend/src/metabase/admin/databases/components/DatabaseDangerZoneSection/DatabaseDangerZoneSection.unit.spec.tsx b/frontend/src/metabase/admin/databases/components/DatabaseDangerZoneSection/DatabaseDangerZoneSection.unit.spec.tsx index b1c02d16136..b33415b511b 100644 --- a/frontend/src/metabase/admin/databases/components/DatabaseDangerZoneSection/DatabaseDangerZoneSection.unit.spec.tsx +++ b/frontend/src/metabase/admin/databases/components/DatabaseDangerZoneSection/DatabaseDangerZoneSection.unit.spec.tsx @@ -93,7 +93,7 @@ describe("DatabaseDangerZoneSection", () => { ).toBe(false); }); - NOT_SYNCED_DB_STATUSES.forEach(initial_sync_status => { + NOT_SYNCED_DB_STATUSES.forEach((initial_sync_status) => { it(`is hidden for databases with "${initial_sync_status}" sync status`, () => { setup({ database: createMockDatabase({ initial_sync_status }), diff --git a/frontend/src/metabase/admin/databases/components/DatabaseEditConnectionForm.tsx b/frontend/src/metabase/admin/databases/components/DatabaseEditConnectionForm.tsx index b29a0ea2381..7ee2c9ec354 100644 --- a/frontend/src/metabase/admin/databases/components/DatabaseEditConnectionForm.tsx +++ b/frontend/src/metabase/admin/databases/components/DatabaseEditConnectionForm.tsx @@ -89,7 +89,7 @@ export type DatabaseEditErrorType = { const getSubmitError = (error: DatabaseEditErrorType) => { if (_.isObject(error?.data?.errors)) { - return updateIn(error, ["data", "errors"], errors => ({ + return updateIn(error, ["data", "errors"], (errors) => ({ details: errors, })); } diff --git a/frontend/src/metabase/admin/databases/components/DatabaseList/DatabaseList.jsx b/frontend/src/metabase/admin/databases/components/DatabaseList/DatabaseList.jsx index 8b75327e122..4eb3957c26d 100644 --- a/frontend/src/metabase/admin/databases/components/DatabaseList/DatabaseList.jsx +++ b/frontend/src/metabase/admin/databases/components/DatabaseList/DatabaseList.jsx @@ -27,7 +27,7 @@ export default class DatabaseList extends Component { constructor(props) { super(props); - props.databases.map(database => { + props.databases.map((database) => { this["deleteDatabaseModal_" + database.id] = createRef(); }); @@ -91,7 +91,7 @@ export default class DatabaseList extends Component { {databases ? ( [ - databases.map(database => { + databases.map((database) => { const isDeleting = this.props.deletes.indexOf(database.id) !== -1; return ( diff --git a/frontend/src/metabase/admin/databases/components/DatabaseModelFeaturesSection/DatabaseModelFeaturesSection.tsx b/frontend/src/metabase/admin/databases/components/DatabaseModelFeaturesSection/DatabaseModelFeaturesSection.tsx index 2a40f5a8db3..e1eb6e2be63 100644 --- a/frontend/src/metabase/admin/databases/components/DatabaseModelFeaturesSection/DatabaseModelFeaturesSection.tsx +++ b/frontend/src/metabase/admin/databases/components/DatabaseModelFeaturesSection/DatabaseModelFeaturesSection.tsx @@ -28,7 +28,9 @@ export const DatabaseModelFeaturesSection = ({ showModelCachingSection: isModelPersistenceEnabled && database.supportsPersistence(), }; - const hasNoContent = Object.values(contentVisibility).every(x => x === false); + const hasNoContent = Object.values(contentVisibility).every( + (x) => x === false, + ); const handleToggleModelActionsEnabled = useCallback( (nextValue: boolean) => diff --git a/frontend/src/metabase/admin/databases/components/DeleteDatabaseModel/DeleteDatabaseModal.styled.tsx b/frontend/src/metabase/admin/databases/components/DeleteDatabaseModel/DeleteDatabaseModal.styled.tsx index bba0c8f16b6..5b0467fe39c 100644 --- a/frontend/src/metabase/admin/databases/components/DeleteDatabaseModel/DeleteDatabaseModal.styled.tsx +++ b/frontend/src/metabase/admin/databases/components/DeleteDatabaseModel/DeleteDatabaseModal.styled.tsx @@ -22,8 +22,8 @@ interface DeleteDatabaseModalSectionProps { } export const DeleteDatabaseModalSection = styled.div` - height: ${props => (props.isHidden ? 0 : "unset")}; - opacity: ${props => (props.isHidden ? 0 : 1)}; + height: ${(props) => (props.isHidden ? 0 : "unset")}; + opacity: ${(props) => (props.isHidden ? 0 : 1)}; padding: 0.125rem; transition: all 350ms, diff --git a/frontend/src/metabase/admin/databases/components/DeleteDatabaseModel/DeleteDatabaseModal.tsx b/frontend/src/metabase/admin/databases/components/DeleteDatabaseModel/DeleteDatabaseModal.tsx index 8dc85de7b9e..c6617685072 100644 --- a/frontend/src/metabase/admin/databases/components/DeleteDatabaseModel/DeleteDatabaseModal.tsx +++ b/frontend/src/metabase/admin/databases/components/DeleteDatabaseModel/DeleteDatabaseModal.tsx @@ -23,7 +23,7 @@ import { } from "./DeleteDatabaseModal.styled"; const entityTypesCount = (usageInfo: DatabaseUsageInfo) => { - return Object.values(usageInfo).filter(value => value > 0).length; + return Object.values(usageInfo).filter((value) => value > 0).length; }; const hasContentInDatabase = (usageInfo: DatabaseUsageInfo) => { @@ -77,7 +77,7 @@ const DeleteDatabaseModal = ({ } }; - const handleEditConnectionDetailsClick: MouseEventHandler = e => { + const handleEditConnectionDetailsClick: MouseEventHandler = (e) => { e.preventDefault(); onClose(); }; @@ -157,7 +157,7 @@ const DeleteDatabaseModal = ({ autoFocus placeholder={t`Are you completely sure?`} value={databaseNameConfirmation} - onChange={e => setDatabaseNameConfirmation(e.target.value)} + onChange={(e) => setDatabaseNameConfirmation(e.target.value)} /> diff --git a/frontend/src/metabase/admin/databases/containers/DatabaseConnectionModal.unit.spec.tsx b/frontend/src/metabase/admin/databases/containers/DatabaseConnectionModal.unit.spec.tsx index b84b51e6348..cb7e85453be 100644 --- a/frontend/src/metabase/admin/databases/containers/DatabaseConnectionModal.unit.spec.tsx +++ b/frontend/src/metabase/admin/databases/containers/DatabaseConnectionModal.unit.spec.tsx @@ -201,7 +201,7 @@ describe("DatabaseConnectionModal", () => { // need to add an id to the mocked db result so redirect can go the the correct location fetchMock.post( "path:/api/database", - async url => { + async (url) => { const lastCall = fetchMock.lastCall(url); return { ...(await lastCall?.request?.json()), id: 1 }; }, diff --git a/frontend/src/metabase/admin/databases/containers/DatabaseListApp.jsx b/frontend/src/metabase/admin/databases/containers/DatabaseListApp.jsx index 08d962b9343..89a69d5f004 100644 --- a/frontend/src/metabase/admin/databases/containers/DatabaseListApp.jsx +++ b/frontend/src/metabase/admin/databases/containers/DatabaseListApp.jsx @@ -25,14 +25,14 @@ import { const RELOAD_INTERVAL = 2000; const getReloadInterval = (_state, _props, databases = []) => { - return databases.some(d => isSyncInProgress(d)) ? RELOAD_INTERVAL : 0; + return databases.some((d) => isSyncInProgress(d)) ? RELOAD_INTERVAL : 0; }; const query = { ...PLUGIN_FEATURE_LEVEL_PERMISSIONS.databaseDetailsQueryProps, }; -const mapStateToProps = state => ({ +const mapStateToProps = (state) => ({ isAdmin: getUserIsAdmin(state), hasSampleDatabase: Database.selectors.getHasSampleDatabase(state, { entityQuery: query, diff --git a/frontend/src/metabase/admin/databases/database.js b/frontend/src/metabase/admin/databases/database.js index fd02d948b83..1b851b16699 100644 --- a/frontend/src/metabase/admin/databases/database.js +++ b/frontend/src/metabase/admin/databases/database.js @@ -60,7 +60,7 @@ export const selectEngine = createAction(SELECT_ENGINE); // Migrates old "Enable in-depth database analysis" option to new "Choose when syncs and scans happen" option // Migration is run as a separate action because that makes it easy to track in tests -const migrateDatabaseToNewSchedulingSettings = database => { +const migrateDatabaseToNewSchedulingSettings = (database) => { return async function (dispatch, getState) { if ( database.details && @@ -274,9 +274,9 @@ const deletes = handleActions( [DELETE_DATABASE_STARTED]: (state, { payload: { databaseId } }) => state.concat([databaseId]), [DELETE_DATABASE_FAILED]: (state, { payload: { databaseId, error } }) => - state.filter(dbId => dbId !== databaseId), + state.filter((dbId) => dbId !== databaseId), [DELETE_DATABASE]: (state, { payload: { databaseId } }) => - state.filter(dbId => dbId !== databaseId), + state.filter((dbId) => dbId !== databaseId), }, [], ); @@ -291,7 +291,7 @@ const deletionError = handleActions( const sampleDatabase = handleActions( { [ADDING_SAMPLE_DATABASE]: () => ({ loading: true }), - [ADD_SAMPLE_DATABASE]: state => ({ ...state, loading: false }), + [ADD_SAMPLE_DATABASE]: (state) => ({ ...state, loading: false }), [ADD_SAMPLE_DATABASE_FAILED]: (state, { payload: { error } }) => ({ error, }), diff --git a/frontend/src/metabase/admin/databases/selectors.js b/frontend/src/metabase/admin/databases/selectors.js index 3d1a502fd6d..cf47c077cd9 100644 --- a/frontend/src/metabase/admin/databases/selectors.js +++ b/frontend/src/metabase/admin/databases/selectors.js @@ -1,20 +1,20 @@ // Database Edit -export const getEditingDatabase = state => +export const getEditingDatabase = (state) => state.admin.databases.editingDatabase; // Database List -export const getDeletes = state => state.admin.databases.deletes; -export const getDeletionError = state => state.admin.databases.deletionError; +export const getDeletes = (state) => state.admin.databases.deletes; +export const getDeletionError = (state) => state.admin.databases.deletionError; -export const getIsAddingSampleDatabase = state => +export const getIsAddingSampleDatabase = (state) => state.admin.databases.sampleDatabase.loading; -export const getAddSampleDatabaseError = state => +export const getAddSampleDatabaseError = (state) => state.admin.databases.sampleDatabase.error; -export const getInitializeError = state => +export const getInitializeError = (state) => state.admin.databases.initializeError; // Deprecation notice -export const isDeprecationNoticeEnabled = state => +export const isDeprecationNoticeEnabled = (state) => state.admin.databases.isDeprecationNoticeEnabled; diff --git a/frontend/src/metabase/admin/datamodel/components/FormInput/FormInput.styled.tsx b/frontend/src/metabase/admin/datamodel/components/FormInput/FormInput.styled.tsx index 4014953b2a7..4bc32e80aab 100644 --- a/frontend/src/metabase/admin/datamodel/components/FormInput/FormInput.styled.tsx +++ b/frontend/src/metabase/admin/datamodel/components/FormInput/FormInput.styled.tsx @@ -12,6 +12,6 @@ export const FormInputRoot = styled.input` width: 100%; &:not(:focus) { - border-color: ${props => props.touched && props.error && color("error")}; + border-color: ${(props) => props.touched && props.error && color("error")}; } `; diff --git a/frontend/src/metabase/admin/datamodel/components/FormTextArea/FormTextArea.styled.tsx b/frontend/src/metabase/admin/datamodel/components/FormTextArea/FormTextArea.styled.tsx index b534ac22603..cffb60f4439 100644 --- a/frontend/src/metabase/admin/datamodel/components/FormTextArea/FormTextArea.styled.tsx +++ b/frontend/src/metabase/admin/datamodel/components/FormTextArea/FormTextArea.styled.tsx @@ -12,6 +12,6 @@ export const FormTextAreaRoot = styled.textarea` width: 100%; &:not(:focus) { - border-color: ${props => props.touched && props.error && color("error")}; + border-color: ${(props) => props.touched && props.error && color("error")}; } `; diff --git a/frontend/src/metabase/admin/datamodel/components/SegmentForm/SegmentForm.tsx b/frontend/src/metabase/admin/datamodel/components/SegmentForm/SegmentForm.tsx index a5b70974b36..7fc8e063f0b 100644 --- a/frontend/src/metabase/admin/datamodel/components/SegmentForm/SegmentForm.tsx +++ b/frontend/src/metabase/admin/datamodel/components/SegmentForm/SegmentForm.tsx @@ -51,7 +51,7 @@ const SegmentForm = ({ useFormik({ initialValues: segment ?? {}, isInitialValid: false, - validate: values => getFormErrors(values, metadata), + validate: (values) => getFormErrors(values, metadata), onSubmit, }); diff --git a/frontend/src/metabase/admin/datamodel/components/SegmentRetireModal.jsx b/frontend/src/metabase/admin/datamodel/components/SegmentRetireModal.jsx index b035ee3985b..224c0d43b55 100644 --- a/frontend/src/metabase/admin/datamodel/components/SegmentRetireModal.jsx +++ b/frontend/src/metabase/admin/datamodel/components/SegmentRetireModal.jsx @@ -48,7 +48,7 @@ export default class SegmentRetireModal extends Component { ref={this.revisionMessage} className={cx(CS.input, CS.full)} placeholder={t`This will show up in the activity feed and in an email that will be sent to anyone on your team who created something that uses this segment.`} - onChange={e => this.setState({ valid: !!e.target.value })} + onChange={(e) => this.setState({ valid: !!e.target.value })} />
diff --git a/frontend/src/metabase/admin/datamodel/components/revisions/Revision.jsx b/frontend/src/metabase/admin/datamodel/components/revisions/Revision.jsx index 16b1856c688..9bde0d7f257 100644 --- a/frontend/src/metabase/admin/datamodel/components/revisions/Revision.jsx +++ b/frontend/src/metabase/admin/datamodel/components/revisions/Revision.jsx @@ -61,7 +61,7 @@ export default class Revision extends Component { if (revision.is_creation) { // these are included in the message = revision.diff.description.after; - diffKeys = diffKeys.filter(k => k !== "name" && k !== "description"); + diffKeys = diffKeys.filter((k) => k !== "name" && k !== "description"); } return ( @@ -85,7 +85,7 @@ export default class Revision extends Component {
{message &&

"{message}"

} - {diffKeys.map(key => ( + {diffKeys.map((key) => ( r.user.id), + revisions.map((r) => r.user.id), user.id, ); } @@ -51,7 +51,7 @@ export default class RevisionHistory extends Component { {t`Revision History for`} "{segment.name}"
    - {revisions.map(revision => ( + {revisions.map((revision) => ( ({ +const mapStateToProps = (state) => ({ isAdmin: getUserIsAdmin(state), }); const mapDispatchToProps = { - onChangeTab: tab => push(`/admin/datamodel/${tab}`), + onChangeTab: (tab) => push(`/admin/datamodel/${tab}`), }; const TAB = { diff --git a/frontend/src/metabase/admin/datamodel/containers/SegmentApp.jsx b/frontend/src/metabase/admin/datamodel/containers/SegmentApp.jsx index 9c179c949be..ad795591006 100644 --- a/frontend/src/metabase/admin/datamodel/containers/SegmentApp.jsx +++ b/frontend/src/metabase/admin/datamodel/containers/SegmentApp.jsx @@ -34,7 +34,7 @@ const UpdateSegmentFormInner = ({ const [isDirty, setIsDirty] = useState(false); const handleSubmit = useCallback( - async segment => { + async (segment) => { setIsDirty(false); try { @@ -86,7 +86,7 @@ const CreateSegmentForm = ({ const [, scheduleCallback] = useCallbackEffect(); const handleSubmit = useCallback( - segment => { + (segment) => { setIsDirty(false); scheduleCallback(async () => { @@ -113,7 +113,7 @@ const CreateSegmentForm = ({ ); }; -const SegmentApp = props => { +const SegmentApp = (props) => { if (props.params.id) { return ; } diff --git a/frontend/src/metabase/admin/datamodel/containers/SegmentListApp.jsx b/frontend/src/metabase/admin/datamodel/containers/SegmentListApp.jsx index c42a0a7914d..c5e6517cadb 100644 --- a/frontend/src/metabase/admin/datamodel/containers/SegmentListApp.jsx +++ b/frontend/src/metabase/admin/datamodel/containers/SegmentListApp.jsx @@ -34,7 +34,7 @@ class SegmentListAppInner extends Component { - {segments.map(segment => ( + {segments.map((segment) => ( setArchived(segment, true)} diff --git a/frontend/src/metabase/admin/datamodel/datamodel.js b/frontend/src/metabase/admin/datamodel/datamodel.js index 8e0ee549bb4..21a57663220 100644 --- a/frontend/src/metabase/admin/datamodel/datamodel.js +++ b/frontend/src/metabase/admin/datamodel/datamodel.js @@ -11,7 +11,7 @@ export const UPDATE_PREVIEW_SUMMARY = export const updatePreviewSummary = createAction( UPDATE_PREVIEW_SUMMARY, - async query => { + async (query) => { const result = await MetabaseApi.dataset(query); return result.data.rows[0][0]; }, @@ -23,7 +23,7 @@ export const FETCH_REVISIONS = "metabase/admin/datamodel/FETCH_REVISIONS"; export const fetchSegmentRevisions = createThunkAction( FETCH_REVISIONS, - id => async () => RevisionsApi.get({ entity: "segment", id }), + (id) => async () => RevisionsApi.get({ entity: "segment", id }), ); // reducers diff --git a/frontend/src/metabase/admin/datamodel/hoc/FilteredToUrlTable.jsx b/frontend/src/metabase/admin/datamodel/hoc/FilteredToUrlTable.jsx index 1d0260dc9de..30eadc1cd1f 100644 --- a/frontend/src/metabase/admin/datamodel/hoc/FilteredToUrlTable.jsx +++ b/frontend/src/metabase/admin/datamodel/hoc/FilteredToUrlTable.jsx @@ -14,7 +14,7 @@ import { Icon } from "metabase/ui"; /** * @deprecated HOCs are deprecated */ -const FilteredToUrlTable = propName => ComposedComponent => +const FilteredToUrlTable = (propName) => (ComposedComponent) => connect(null, { push })( class FilteredToUrlTable extends Component { constructor(props) { @@ -23,7 +23,7 @@ const FilteredToUrlTable = propName => ComposedComponent => this.state = { tableId: table != null ? parseInt(table) : null }; } - setTableId = tableId => { + setTableId = (tableId) => { this.setState({ tableId }); this.props.push({ ...this.props.location, @@ -38,7 +38,7 @@ const FilteredToUrlTable = propName => ComposedComponent => [propName]: tableId == null ? items - : items.filter(item => item.table_id === tableId), + : items.filter((item) => item.table_id === tableId), tableSelector: ( ), @@ -79,7 +79,7 @@ class TableSelectorInner extends Component { { + onClick={(e) => { if (table) { e.stopPropagation(); setTableId(null); diff --git a/frontend/src/metabase/admin/datamodel/metadata/components/FieldGeneralSettings/FieldGeneralSettings.tsx b/frontend/src/metabase/admin/datamodel/metadata/components/FieldGeneralSettings/FieldGeneralSettings.tsx index 0c005333aaf..5bbf4eef064 100644 --- a/frontend/src/metabase/admin/datamodel/metadata/components/FieldGeneralSettings/FieldGeneralSettings.tsx +++ b/frontend/src/metabase/admin/datamodel/metadata/components/FieldGeneralSettings/FieldGeneralSettings.tsx @@ -224,7 +224,7 @@ const FieldCoercionStrategySection = ({ }: FieldCoercionStrategySectionProps) => { const options = useMemo( () => [ - ...field.coercionStrategyOptions().map(value => ({ + ...field.coercionStrategyOptions().map((value) => ({ name: humanizeCoercionStrategy(value), value, })), diff --git a/frontend/src/metabase/admin/datamodel/metadata/components/FieldRemappingSettings/FieldRemappingSettings.jsx b/frontend/src/metabase/admin/datamodel/metadata/components/FieldRemappingSettings/FieldRemappingSettings.jsx index 49ff9c87f15..4faf42f59db 100644 --- a/frontend/src/metabase/admin/datamodel/metadata/components/FieldRemappingSettings/FieldRemappingSettings.jsx +++ b/frontend/src/metabase/admin/datamodel/metadata/components/FieldRemappingSettings/FieldRemappingSettings.jsx @@ -41,7 +41,7 @@ class FieldRemappingSettings extends Component { this.fkPopover = createRef(); } - getMappingTypeForField = field => { + getMappingTypeForField = (field) => { if (this.state.isChoosingInitialFkTarget) { return MAP_OPTIONS.foreign; } @@ -74,7 +74,7 @@ class FieldRemappingSettings extends Component { return ( remapping.size > 0 && [...remapping.keys()].every( - key => typeof key === "number" || key === null, + (key) => typeof key === "number" || key === null, ) ); }; @@ -97,7 +97,7 @@ class FieldRemappingSettings extends Component { getFKTargetTableEntityNameOrNull = () => { const fkTargetFields = this.getForeignKeyTargetFields(); - const nameField = fkTargetFields.find(field => isEntityName(field)); + const nameField = fkTargetFields.find((field) => isEntityName(field)); return nameField ? nameField.id : null; }; @@ -151,7 +151,7 @@ class FieldRemappingSettings extends Component { } }; - onForeignKeyFieldChange = async fkFieldId => { + onForeignKeyFieldChange = async (fkFieldId) => { const { field, updateFieldDimension } = this.props; this.clearEditingStates(); @@ -167,7 +167,7 @@ class FieldRemappingSettings extends Component { this.fkPopover.current?.close(); }; - onUpdateRemappings = remappings => { + onUpdateRemappings = (remappings) => { const { field, updateFieldValues } = this.props; return updateFieldValues({ id: field.id }, Array.from(remappings)); }; @@ -199,7 +199,7 @@ class FieldRemappingSettings extends Component { value={mappingType} onChange={this.handleChangeMappingType} options={this.getAvailableMappingTypes()} - optionValueFn={o => o} + optionValueFn={(o) => o} className={CS.inlineBlock} /> {mappingType === MAP_OPTIONS.foreign && ( @@ -325,7 +325,7 @@ class ValueRemappings extends Component { customValuesAreNonEmpty = () => { return Array.from(this.state.editingRemappings.values()).every( - value => value !== "", + (value) => value !== "", ); }; @@ -352,7 +352,7 @@ class ValueRemappings extends Component { + setMapping={(newMapped) => this.onSetRemapping(original, newMapped) } /> @@ -374,7 +374,7 @@ class ValueRemappings extends Component { } class FieldValueMapping extends Component { - onInputChange = e => { + onInputChange = (e) => { this.props.setMapping(e.target.value); }; diff --git a/frontend/src/metabase/admin/datamodel/metadata/components/FieldRemappingSettings/FieldRemappingSettings.styled.tsx b/frontend/src/metabase/admin/datamodel/metadata/components/FieldRemappingSettings/FieldRemappingSettings.styled.tsx index 96cd3945df9..aba6d147d02 100644 --- a/frontend/src/metabase/admin/datamodel/metadata/components/FieldRemappingSettings/FieldRemappingSettings.styled.tsx +++ b/frontend/src/metabase/admin/datamodel/metadata/components/FieldRemappingSettings/FieldRemappingSettings.styled.tsx @@ -21,7 +21,7 @@ interface FieldSelectButtonProps { } export const FieldSelectButton = styled(SelectButton)` - border-color: ${props => + border-color: ${(props) => props.hasError ? color("error") : alpha("accent2", 0.2)}; `; diff --git a/frontend/src/metabase/admin/datamodel/metadata/components/FieldVisibilityPicker/FieldVisibilityPicker.tsx b/frontend/src/metabase/admin/datamodel/metadata/components/FieldVisibilityPicker/FieldVisibilityPicker.tsx index 135dfd28e14..11522a9d7dc 100644 --- a/frontend/src/metabase/admin/datamodel/metadata/components/FieldVisibilityPicker/FieldVisibilityPicker.tsx +++ b/frontend/src/metabase/admin/datamodel/metadata/components/FieldVisibilityPicker/FieldVisibilityPicker.tsx @@ -42,9 +42,9 @@ export const FieldVisibilityPicker = ({ data={DATA} fw="bold" placeholder={t`Select a field visibility`} - renderOption={item => { + renderOption={(item) => { const selected = item.option.value === value; - const option = DATA.find(option => option.value === value); + const option = DATA.find((option) => option.value === value); return ( @@ -71,7 +71,7 @@ export const FieldVisibilityPicker = ({ }; function getData() { - return FIELD_VISIBILITY_TYPES.map(type => ({ + return FIELD_VISIBILITY_TYPES.map((type) => ({ description: type.description, label: type.name, value: type.id, diff --git a/frontend/src/metabase/admin/datamodel/metadata/components/MetadataFieldSettings/MetadataFieldSettings.tsx b/frontend/src/metabase/admin/datamodel/metadata/components/MetadataFieldSettings/MetadataFieldSettings.tsx index e5c05d39006..bdf0de0be0c 100644 --- a/frontend/src/metabase/admin/datamodel/metadata/components/MetadataFieldSettings/MetadataFieldSettings.tsx +++ b/frontend/src/metabase/admin/datamodel/metadata/components/MetadataFieldSettings/MetadataFieldSettings.tsx @@ -90,7 +90,7 @@ const MetadataFieldSettings = ({ loading = true, params: { schemaId, section }, }: MetadataFieldSettingsProps) => { - const schema = schemas.find(schema => schema.id === schemaId); + const schema = schemas.find((schema) => schema.id === schemaId); if (!schema || (!fetched && loading)) { return ; } diff --git a/frontend/src/metabase/admin/datamodel/metadata/components/MetadataSchemaList/MetadataSchemaList.tsx b/frontend/src/metabase/admin/datamodel/metadata/components/MetadataSchemaList/MetadataSchemaList.tsx index 3292504bb47..c7e7b731965 100644 --- a/frontend/src/metabase/admin/datamodel/metadata/components/MetadataSchemaList/MetadataSchemaList.tsx +++ b/frontend/src/metabase/admin/datamodel/metadata/components/MetadataSchemaList/MetadataSchemaList.tsx @@ -57,8 +57,10 @@ const MetadataSchemaList = ({ const searchValue = searchText.toLowerCase(); return _.chain(allSchemas) - .filter(schema => (schema.name ?? "").toLowerCase().includes(searchValue)) - .sortBy(schema => schema.name ?? "") + .filter((schema) => + (schema.name ?? "").toLowerCase().includes(searchValue), + ) + .sortBy((schema) => schema.name ?? "") .value(); }, [allSchemas, searchText]); @@ -86,7 +88,7 @@ const MetadataSchemaList = ({ type="text" placeholder={t`Find a schema`} value={searchText} - onChange={e => setSearchText(e.target.value)} + onChange={(e) => setSearchText(e.target.value)} />
    @@ -97,7 +99,7 @@ const MetadataSchemaList = ({ schemas.length, )} - {schemas.map(schema => ( + {schemas.map((schema) => ( ` margin: 0 0.5rem; font-weight: bold; cursor: pointer; - color: ${props => (props.isChecked ? color("brand") : color("text-dark"))}; + color: ${(props) => (props.isChecked ? color("brand") : color("text-dark"))}; &:hover { color: var(--mb-color-brand); diff --git a/frontend/src/metabase/admin/datamodel/metadata/components/MetadataTableColumnList/MetadataTableColumnList.tsx b/frontend/src/metabase/admin/datamodel/metadata/components/MetadataTableColumnList/MetadataTableColumnList.tsx index e25aaab5593..bcd10dd663a 100644 --- a/frontend/src/metabase/admin/datamodel/metadata/components/MetadataTableColumnList/MetadataTableColumnList.tsx +++ b/frontend/src/metabase/admin/datamodel/metadata/components/MetadataTableColumnList/MetadataTableColumnList.tsx @@ -70,7 +70,7 @@ const MetadataTableColumnList = ({ }); const sortedFields = useMemo( - () => _.sortBy(fields, field => field.position), + () => _.sortBy(fields, (field) => field.position), [fields], ); diff --git a/frontend/src/metabase/admin/datamodel/metadata/components/MetadataTableList/MetadataTableList.styled.tsx b/frontend/src/metabase/admin/datamodel/metadata/components/MetadataTableList/MetadataTableList.styled.tsx index 48bbf773741..ed1883557ca 100644 --- a/frontend/src/metabase/admin/datamodel/metadata/components/MetadataTableList/MetadataTableList.styled.tsx +++ b/frontend/src/metabase/admin/datamodel/metadata/components/MetadataTableList/MetadataTableList.styled.tsx @@ -26,9 +26,9 @@ export const BackIconContainer = styled.span` export const HideIconButton = styled(IconButtonWrapper)` float: right; - cursor: ${props => props.disabled && "not-allowed"}; + cursor: ${(props) => props.disabled && "not-allowed"}; &:hover { - color: ${props => !props.disabled && color("brand")}; + color: ${(props) => !props.disabled && color("brand")}; } `; diff --git a/frontend/src/metabase/admin/datamodel/metadata/components/MetadataTableList/MetadataTableList.tsx b/frontend/src/metabase/admin/datamodel/metadata/components/MetadataTableList/MetadataTableList.tsx index 2b0ac0c5bf3..a701b8963d6 100644 --- a/frontend/src/metabase/admin/datamodel/metadata/components/MetadataTableList/MetadataTableList.tsx +++ b/frontend/src/metabase/admin/datamodel/metadata/components/MetadataTableList/MetadataTableList.tsx @@ -59,14 +59,14 @@ interface DispatchProps { type MetadataTableListProps = OwnProps & TableLoaderProps & DispatchProps; const mapDispatchToProps = (dispatch: Dispatch): DispatchProps => ({ - onSelectDatabase: databaseId => + onSelectDatabase: (databaseId) => dispatch(push(Urls.dataModelDatabase(databaseId))), onSelectTable: (databaseId, schemaId, tableId) => dispatch(push(Urls.dataModelTable(databaseId, schemaId, tableId))), onUpdateTableVisibility: async (tables, visibility) => dispatch( Tables.actions.bulkUpdate({ - ids: tables.map(table => table.id), + ids: tables.map((table) => table.id), visibility_type: visibility, }), ), @@ -88,9 +88,11 @@ const MetadataTableList = ({ const searchValue = searchText.toLowerCase(); return _.chain(allTables) - .filter(table => table.displayName().toLowerCase().includes(searchValue)) - .sortBy(table => table.displayName()) - .partition(table => table.visibility_type != null) + .filter((table) => + table.displayName().toLowerCase().includes(searchValue), + ) + .sortBy((table) => table.displayName()) + .partition((table) => table.visibility_type != null) .value(); }, [allTables, searchText]); @@ -125,7 +127,7 @@ const MetadataTableList = ({ onUpdateTableVisibility={onUpdateTableVisibility} /> )} - {visibleTables.map(table => ( + {visibleTables.map((table) => ( )} - {hiddenTables.map(table => ( + {hiddenTables.map((table) => ( { - return tables.some(t => isSyncInProgress(t)) ? RELOAD_INTERVAL : 0; + return tables.some((t) => isSyncInProgress(t)) ? RELOAD_INTERVAL : 0; }; // eslint-disable-next-line import/no-default-export -- deprecated usage diff --git a/frontend/src/metabase/admin/datamodel/metadata/components/MetadataTableSchema/MetadataTableSchema.tsx b/frontend/src/metabase/admin/datamodel/metadata/components/MetadataTableSchema/MetadataTableSchema.tsx index 15dbaf644c4..c4c9f007a5a 100644 --- a/frontend/src/metabase/admin/datamodel/metadata/components/MetadataTableSchema/MetadataTableSchema.tsx +++ b/frontend/src/metabase/admin/datamodel/metadata/components/MetadataTableSchema/MetadataTableSchema.tsx @@ -19,11 +19,11 @@ interface MetadataTableSchemaProps { const MetadataTableSchema = ({ table }: MetadataTableSchemaProps) => { const rootFields = useMemo(() => { - return table.fields?.filter(field => field.nfc_path === null) ?? []; + return table.fields?.filter((field) => field.nfc_path === null) ?? []; }, [table]); const fieldByParent = useMemo(() => { - return _.groupBy(table.fields ?? [], field => field.nfc_path?.[0] ?? ""); + return _.groupBy(table.fields ?? [], (field) => field.nfc_path?.[0] ?? ""); }, [table]); return ( diff --git a/frontend/src/metabase/admin/datamodel/metadata/components/MetadataTableSettings/MetadataTableSettings.tsx b/frontend/src/metabase/admin/datamodel/metadata/components/MetadataTableSettings/MetadataTableSettings.tsx index f315bf78ffa..b17d2760f5b 100644 --- a/frontend/src/metabase/admin/datamodel/metadata/components/MetadataTableSettings/MetadataTableSettings.tsx +++ b/frontend/src/metabase/admin/datamodel/metadata/components/MetadataTableSettings/MetadataTableSettings.tsx @@ -57,7 +57,7 @@ const MetadataTableSettings = ({ table, params: { schemaId }, }: MetadataTableSettingsProps) => { - const schema = schemas.find(schema => schema.id === schemaId); + const schema = schemas.find((schema) => schema.id === schemaId); const [rescanTableFieldValues] = useRescanTableFieldValuesMutation(); const [discardTableFieldValues] = useDiscardTableFieldValuesMutation(); diff --git a/frontend/src/metabase/admin/datamodel/selectors.js b/frontend/src/metabase/admin/datamodel/selectors.js index 2b96d611fee..41880bc6187 100644 --- a/frontend/src/metabase/admin/datamodel/selectors.js +++ b/frontend/src/metabase/admin/datamodel/selectors.js @@ -1,3 +1,4 @@ -export const getPreviewSummary = state => state.admin.datamodel.previewSummary; -export const getRevisions = state => state.admin.datamodel.revisions; -export const getCurrentUser = state => state.currentUser; +export const getPreviewSummary = (state) => + state.admin.datamodel.previewSummary; +export const getRevisions = (state) => state.admin.datamodel.revisions; +export const getCurrentUser = (state) => state.currentUser; diff --git a/frontend/src/metabase/admin/people/components/AddMemberRow.jsx b/frontend/src/metabase/admin/people/components/AddMemberRow.jsx index cd0aa06269e..0e2bdaa7067 100644 --- a/frontend/src/metabase/admin/people/components/AddMemberRow.jsx +++ b/frontend/src/metabase/admin/people/components/AddMemberRow.jsx @@ -25,13 +25,13 @@ export default function AddMemberRow({ users, excludeIds, onCancel, onDone }) { const [text, setText] = useState(""); const [selectedUsersById, setSelectedUsersById] = useState(new Map()); - const handleRemoveUser = user => { + const handleRemoveUser = (user) => { const newSelectedUsersById = new Map(selectedUsersById); newSelectedUsersById.delete(user.id); setSelectedUsersById(newSelectedUsersById); }; - const handleAddUser = user => { + const handleAddUser = (user) => { const newSelectedUsersById = new Map(selectedUsersById); newSelectedUsersById.set(user.id, user); setSelectedUsersById(newSelectedUsersById); @@ -45,7 +45,7 @@ export default function AddMemberRow({ users, excludeIds, onCancel, onDone }) { const availableToSelectUsers = useMemo( () => users.filter( - user => !selectedUsersById.has(user.id) && !excludeIds.has(user.id), + (user) => !selectedUsersById.has(user.id) && !excludeIds.has(user.id), ), [selectedUsersById, excludeIds, users], ); @@ -58,11 +58,11 @@ export default function AddMemberRow({ users, excludeIds, onCancel, onDone }) { value={text} isValid={selectedUsersById.size > 0} placeholder={t`Julie McMemberson`} - onChange={e => setText(e.target.value)} + onChange={(e) => setText(e.target.value)} onDone={handleDone} onCancel={onCancel} > - {Array.from(selectedUsersById.values()).map(user => ( + {Array.from(selectedUsersById.values()).map((user) => (
    ` padding: 0.5rem 1rem; cursor: pointer; - background-color: ${props => props.isSelected && "var(--mb-color-brand)"}; + background-color: ${(props) => props.isSelected && "var(--mb-color-brand)"}; `; diff --git a/frontend/src/metabase/admin/people/components/GroupDetail.jsx b/frontend/src/metabase/admin/people/components/GroupDetail.jsx index 916f1d5c63b..a3ac1a7d633 100644 --- a/frontend/src/metabase/admin/people/components/GroupDetail.jsx +++ b/frontend/src/metabase/admin/people/components/GroupDetail.jsx @@ -93,17 +93,17 @@ const GroupDetail = ({ loadMemberships(); }, [loadMemberships]); - const alert = alertMessage => setAlertMessage(alertMessage); + const alert = (alertMessage) => setAlertMessage(alertMessage); const onAddUsersClicked = () => setAddUserVisible(true); const onAddUserCanceled = () => setAddUserVisible(false); - const onAddUserDone = async userIds => { + const onAddUserDone = async (userIds) => { setAddUserVisible(false); try { await Promise.all( - userIds.map(async userId => { + userIds.map(async (userId) => { await createMembership({ groupId: group.id, userId, @@ -115,7 +115,7 @@ const GroupDetail = ({ } }; - const handleChange = async membership => { + const handleChange = async (membership) => { const confirmation = PLUGIN_GROUP_MANAGERS.getChangeMembershipConfirmation( currentUser, membership, @@ -135,7 +135,7 @@ const GroupDetail = ({ }); }; - const handleRemove = async membershipId => { + const handleRemove = async (membershipId) => { const confirmation = PLUGIN_GROUP_MANAGERS.getRemoveMembershipConfirmation( currentUser, membershipsByUser[currentUser.id], diff --git a/frontend/src/metabase/admin/people/components/GroupMembersTable/GroupMembersTable.tsx b/frontend/src/metabase/admin/people/components/GroupMembersTable/GroupMembersTable.tsx index 1ee48959f04..6f2c752c5e5 100644 --- a/frontend/src/metabase/admin/people/components/GroupMembersTable/GroupMembersTable.tsx +++ b/frontend/src/metabase/admin/people/components/GroupMembersTable/GroupMembersTable.tsx @@ -62,7 +62,7 @@ function GroupMembersTable({ }: GroupMembersTableProps) { const { isLoading, data: apiKeys } = useListApiKeysQuery(); const groupApiKeys = useMemo(() => { - return apiKeys?.filter(apiKey => apiKey.group.id === group.id) ?? []; + return apiKeys?.filter((apiKey) => apiKey.group.id === group.id) ?? []; }, [apiKeys, group.id]); // you can't remove people from Default and you can't remove the last user from Admin @@ -72,11 +72,12 @@ function GroupMembersTable({ const hasMembers = group.members.length > 0; - const handleAddUser: GroupMembersTableProps["onAddUserDone"] = - async userIds => { - await onAddUserDone(userIds); - reload(); - }; + const handleAddUser: GroupMembersTableProps["onAddUserDone"] = async ( + userIds, + ) => { + await onAddUserDone(userIds); + reload(); + }; const handleRemoveUser = async (membershipId: number) => { await onMembershipRemove(membershipId); @@ -90,7 +91,7 @@ function GroupMembersTable({ ].filter(isNotNull); const alreadyMembersIds = useMemo( - () => new Set(groupMemberships.map(membership => membership.user_id)), + () => new Set(groupMemberships.map((membership) => membership.user_id)), [groupMemberships], ); @@ -177,7 +178,7 @@ const UserRow = ({ memberships = [], }: UserRowProps) => { const groupMembership = memberships.find( - membership => membership.group_id === group.id, + (membership) => membership.group_id === group.id, ); if (!groupMembership) { diff --git a/frontend/src/metabase/admin/people/components/GroupSummary.jsx b/frontend/src/metabase/admin/people/components/GroupSummary.jsx index a005e889ea4..532bda38663 100644 --- a/frontend/src/metabase/admin/people/components/GroupSummary.jsx +++ b/frontend/src/metabase/admin/people/components/GroupSummary.jsx @@ -9,7 +9,7 @@ import { AdminGroupLabel } from "./GroupSummary.styled"; const GroupSummary = ({ groups, selectedGroupIds }) => { const adminGroup = groups.find(isAdminGroup); const otherGroups = groups.filter( - g => + (g) => selectedGroupIds.includes(g.id) && !isAdminGroup(g) && !isDefaultGroup(g), ); if (adminGroup && selectedGroupIds.includes(adminGroup.id)) { @@ -19,7 +19,7 @@ const GroupSummary = ({ groups, selectedGroupIds }) => { {otherGroups.length > 0 && " " + t`and` + " "} {otherGroups.length > 0 && ( - {(n => ngettext(msgid`${n} other group`, `${n} other groups`, n))( + {((n) => ngettext(msgid`${n} other group`, `${n} other groups`, n))( otherGroups.length, )} @@ -31,7 +31,7 @@ const GroupSummary = ({ groups, selectedGroupIds }) => { } else if (otherGroups.length > 1) { return ( - {(n => ngettext(msgid`${n} other group`, `${n} other groups`, n))( + {((n) => ngettext(msgid`${n} other group`, `${n} other groups`, n))( otherGroups.length, )} diff --git a/frontend/src/metabase/admin/people/components/GroupsListing.jsx b/frontend/src/metabase/admin/people/components/GroupsListing.jsx index 6451c9d5bb9..b070b5869eb 100644 --- a/frontend/src/metabase/admin/people/components/GroupsListing.jsx +++ b/frontend/src/metabase/admin/people/components/GroupsListing.jsx @@ -41,8 +41,8 @@ function AddGroupRow({ text, onCancelClicked, onCreateClicked, onTextChange }) { value={text} isValid={textIsValid} placeholder={t`Something like "Marketing"`} - onChange={e => onTextChange(e.target.value)} - onKeyDown={e => { + onChange={(e) => onTextChange(e.target.value)} + onKeyDown={(e) => { if (e.keyCode === KEYCODE_ENTER) { onCreateClicked(); } @@ -159,7 +159,7 @@ function EditingGroupRow({ type="text" autoFocus={true} value={group.name} - onChange={e => onTextChange(e.target.value)} + onChange={(e) => onTextChange(e.target.value)} /> @@ -301,7 +301,7 @@ function GroupsTable({ apiKeys={ isDefaultGroup(group) ? (apiKeys ?? []) - : (apiKeys?.filter(apiKey => apiKey.group.id === group.id) ?? + : (apiKeys?.filter((apiKey) => apiKey.group.id === group.id) ?? []) } groupBeingEdited={groupBeingEdited} diff --git a/frontend/src/metabase/admin/people/components/MembershipSelect/MembershipSelect.styled.tsx b/frontend/src/metabase/admin/people/components/MembershipSelect/MembershipSelect.styled.tsx index 59d61180b93..56cb7449064 100644 --- a/frontend/src/metabase/admin/people/components/MembershipSelect/MembershipSelect.styled.tsx +++ b/frontend/src/metabase/admin/people/components/MembershipSelect/MembershipSelect.styled.tsx @@ -17,13 +17,13 @@ export const MembershipSelectItem = styled.li` display: flex; align-items: center; justify-content: space-between; - cursor: ${props => (props.isDisabled ? "unset" : "pointer")}; + cursor: ${(props) => (props.isDisabled ? "unset" : "pointer")}; padding: 0.5rem 1.5rem; background-color: var(--mb-color-bg-white); color: var(--mb-color-text-medium); font-weight: 700; - ${props => + ${(props) => !props.isDisabled && css` &:hover { diff --git a/frontend/src/metabase/admin/people/components/MembershipSelect/MembershipSelect.tsx b/frontend/src/metabase/admin/people/components/MembershipSelect/MembershipSelect.tsx index 9733ec27c69..013cd34522e 100644 --- a/frontend/src/metabase/admin/people/components/MembershipSelect/MembershipSelect.tsx +++ b/frontend/src/metabase/admin/people/components/MembershipSelect/MembershipSelect.tsx @@ -28,7 +28,7 @@ const getGroupSections = (groups: GroupListQuery[]) => { const adminGroup = groups.find(isAdminGroup); const pinnedGroups = [defaultGroup, adminGroup].filter(isNotNull); const regularGroups = groups.filter( - group => !isAdminGroup(group) && !isDefaultGroup(group), + (group) => !isAdminGroup(group) && !isDefaultGroup(group), ); if (pinnedGroups.length > 0) { @@ -109,7 +109,7 @@ export const MembershipSelect = ({ {section.header && ( {section.header} )} - {section.groups.map(group => { + {section.groups.map((group) => { const isDisabled = (isAdminGroup(group) && isCurrentUser) || isDefaultGroup(group); const isMember = memberships.has(group.id); diff --git a/frontend/src/metabase/admin/people/components/NudgeToPro.tsx b/frontend/src/metabase/admin/people/components/NudgeToPro.tsx index 015c01ba8b8..c4f1cab4892 100644 --- a/frontend/src/metabase/admin/people/components/NudgeToPro.tsx +++ b/frontend/src/metabase/admin/people/components/NudgeToPro.tsx @@ -8,7 +8,7 @@ import { Icon } from "metabase/ui"; import { Description, NudgeCard, ProLink, Subtitle } from "./NudgeToPro.styled"; export const NudgeToPro = () => { - const upgradeUrl = useSelector(state => + const upgradeUrl = useSelector((state) => getUpgradeUrl(state, { utm_content: "people" }), ); return ( diff --git a/frontend/src/metabase/admin/people/components/PeopleList.jsx b/frontend/src/metabase/admin/people/components/PeopleList.jsx index 2b04c9dabbb..1bda1266dee 100644 --- a/frontend/src/metabase/admin/people/components/PeopleList.jsx +++ b/frontend/src/metabase/admin/people/components/PeopleList.jsx @@ -27,7 +27,7 @@ import { getMembershipsByUser } from "../selectors"; import PeopleListRow from "./PeopleListRow"; -const mapStateToProps = state => ({ +const mapStateToProps = (state) => ({ currentUser: getUser(state), isAdmin: getUserIsAdmin(state), groups: Group.selectors.getList(state), @@ -85,8 +85,8 @@ const PeopleList = ({ } const areSameUsers = _.isEqual( - prevUsers.map(u => u.id), - users.map(u => u.id), + prevUsers.map((u) => u.id), + users.map((u) => u.id), ); if (!areSameUsers) { @@ -94,8 +94,8 @@ const PeopleList = ({ } const isActivityChanged = !_.isEqual( - prevUsers.map(u => u.is_active), - users.map(u => u.is_active), + prevUsers.map((u) => u.is_active), + users.map((u) => u.is_active), ); if (isActivityChanged) { @@ -107,13 +107,13 @@ const PeopleList = ({ const { page, pageSize, status } = query; - const isCurrentUser = u => currentUser?.id === u.id; + const isCurrentUser = (u) => currentUser?.id === u.id; const showDeactivated = status === USER_STATUS.deactivated; const hasUsers = users.length > 0; const handleChange = async (groupId, membershipData, userId) => { const membership = membershipsByUser[userId].find( - membership => membership.group_id === groupId, + (membership) => membership.group_id === groupId, ); const updatedMembership = { ...membership, @@ -146,7 +146,7 @@ const PeopleList = ({ const handleRemove = async (groupId, userId) => { const membershipId = membershipsByUser[userId].find( - membership => membership.group_id === groupId, + (membership) => membership.group_id === groupId, ).membership_id; const confirmation = PLUGIN_GROUP_MANAGERS.getRemoveMembershipConfirmation( @@ -205,7 +205,7 @@ const PeopleList = ({ {hasUsers && - users.map(user => ( + users.map((user) => ( handleAdd(groupId, user.id)} - onRemove={groupId => handleRemove(groupId, user.id)} + onAdd={(groupId) => handleAdd(groupId, user.id)} + onRemove={(groupId) => handleRemove(groupId, user.id)} onChange={(groupId, membershipData) => handleChange(groupId, membershipData, user.id) } diff --git a/frontend/src/metabase/admin/people/components/PeopleListRow.jsx b/frontend/src/metabase/admin/people/components/PeopleListRow.jsx index abf20982704..462cf51ed7d 100644 --- a/frontend/src/metabase/admin/people/components/PeopleListRow.jsx +++ b/frontend/src/metabase/admin/people/components/PeopleListRow.jsx @@ -43,7 +43,7 @@ const PeopleListRow = ({ const isLoadingGroups = !groups; - const isPasswordLoginEnabled = useSelector(state => + const isPasswordLoginEnabled = useSelector((state) => getSetting(state, enablePasswordLoginKey), ); @@ -117,7 +117,7 @@ const PeopleListRow = ({ title: t`Reset password`, link: Urls.resetPassword(user.id), }, - ...PLUGIN_ADMIN_USER_MENU_ITEMS.flatMap(getItems => + ...PLUGIN_ADMIN_USER_MENU_ITEMS.flatMap((getItems) => getItems(user), ), !isCurrentUser && { diff --git a/frontend/src/metabase/admin/people/components/SearchInput.jsx b/frontend/src/metabase/admin/people/components/SearchInput.jsx index 8a305fa4fcc..f813336a9e1 100644 --- a/frontend/src/metabase/admin/people/components/SearchInput.jsx +++ b/frontend/src/metabase/admin/people/components/SearchInput.jsx @@ -4,7 +4,7 @@ import styled from "@emotion/styled"; import Input from "metabase/core/components/Input"; import { Icon } from "metabase/ui"; -const SearchInput = styled(props => ( +const SearchInput = styled((props) => ( } diff --git a/frontend/src/metabase/admin/people/containers/PeopleListingApp.jsx b/frontend/src/metabase/admin/people/containers/PeopleListingApp.jsx index 331bedab776..f8b792aa28a 100644 --- a/frontend/src/metabase/admin/people/containers/PeopleListingApp.jsx +++ b/frontend/src/metabase/admin/people/containers/PeopleListingApp.jsx @@ -27,7 +27,7 @@ function PeopleListingApp({ children, isAdmin }) { handlePreviousPage, } = usePeopleQuery(PAGE_SIZE); - const handleSearchChange = e => { + const handleSearchChange = (e) => { updateSearchInputValue(e.target.value); }; @@ -76,6 +76,6 @@ PeopleListingApp.propTypes = { isAdmin: PropTypes.bool, }; -export default connect(state => ({ +export default connect((state) => ({ isAdmin: getUserIsAdmin(state), }))(PeopleListingApp); diff --git a/frontend/src/metabase/admin/people/containers/UserSuccessModal.jsx b/frontend/src/metabase/admin/people/containers/UserSuccessModal.jsx index f4239654746..17b8e13b2c1 100644 --- a/frontend/src/metabase/admin/people/containers/UserSuccessModal.jsx +++ b/frontend/src/metabase/admin/people/containers/UserSuccessModal.jsx @@ -23,11 +23,11 @@ export function UserSuccessModal({ params }) { const userId = parseInt(params.userId); const { data: user, isLoading, error } = useGetUserQuery(userId); - const temporaryPassword = useSelector(state => + const temporaryPassword = useSelector((state) => getUserTemporaryPassword(state, { userId }), ); const hasSsoEnabled = useSelector(isSsoEnabled); - const hasPasswordLoginEnabled = useSelector(state => + const hasPasswordLoginEnabled = useSelector((state) => getSetting(state, "enable-password-login"), ); const dispatch = useDispatch(); diff --git a/frontend/src/metabase/admin/people/hooks/use-people-query.js b/frontend/src/metabase/admin/people/hooks/use-people-query.js index 1ddec2a8e66..dbfcb8b3cfd 100644 --- a/frontend/src/metabase/admin/people/hooks/use-people-query.js +++ b/frontend/src/metabase/admin/people/hooks/use-people-query.js @@ -11,7 +11,7 @@ const MIN_SEARCH_LENGTH = 2; // it is not the best place to store pagination state since we might want to // change it from the ancestors, for instance, when we change list filter props. // If users change any filters, we should reset the page state. -export const usePeopleQuery = pageSize => { +export const usePeopleQuery = (pageSize) => { const { handleNextPage, handlePreviousPage, setPage, page } = usePagination(); const [status, setStatus] = useState(USER_STATUS.active); @@ -31,7 +31,7 @@ export const usePeopleQuery = pageSize => { return () => clearTimeout(timerId); }, [searchInputValue, setPage]); - const updateStatus = status => { + const updateStatus = (status) => { setPage(0); setStatus(status); }; diff --git a/frontend/src/metabase/admin/people/people.js b/frontend/src/metabase/admin/people/people.js index e3d5bcacd6b..c0c5f5caba4 100644 --- a/frontend/src/metabase/admin/people/people.js +++ b/frontend/src/metabase/admin/people/people.js @@ -26,7 +26,7 @@ export const loadMemberships = createAction(LOAD_MEMBERSHIPS, async () => _.chain(await PermissionsApi.memberships()) .values() .flatten() - .map(m => [m.membership_id, m]) + .map((m) => [m.membership_id, m]) .object() .value(), ); @@ -48,7 +48,7 @@ export const createMembership = createAction( ); export const deleteMembership = createThunkAction( DELETE_MEMBERSHIP, - membershipId => async (_dispatch, getState) => { + (membershipId) => async (_dispatch, getState) => { const memberships = getMemberships(getState()); const membership = memberships[membershipId]; await PermissionsApi.deleteMembership({ id: membershipId }); @@ -59,7 +59,7 @@ export const deleteMembership = createThunkAction( export const updateMembership = createAction( UPDATE_MEMBERSHIP, - async membership => { + async (membership) => { await PermissionsApi.updateMembership({ ...membership, id: membership.membership_id, diff --git a/frontend/src/metabase/admin/people/selectors.js b/frontend/src/metabase/admin/people/selectors.js index 896598ca5c8..c7a7b1535b5 100644 --- a/frontend/src/metabase/admin/people/selectors.js +++ b/frontend/src/metabase/admin/people/selectors.js @@ -5,22 +5,22 @@ import { hasAnySsoFeature } from "metabase/common/utils/plan"; import { getSetting } from "metabase/selectors/settings"; import { getUserIsAdmin } from "metabase/selectors/user"; -export const getMemberships = state => state.admin.people.memberships; +export const getMemberships = (state) => state.admin.people.memberships; export const getMembershipsList = createSelector( [getMemberships], - memberships => Object.values(memberships) || [], + (memberships) => Object.values(memberships) || [], ); export const getGroupMemberships = createSelector( [getMembershipsList, (_state, props) => props.group.id], (membershipsList, groupId) => - membershipsList.filter(membership => membership.group_id === groupId), + membershipsList.filter((membership) => membership.group_id === groupId), ); export const getMembershipsByUser = createSelector( [getMembershipsList], - membershipsList => + (membershipsList) => membershipsList?.reduce((acc, membership) => { acc[membership.user_id] ??= []; acc[membership.user_id].push(membership); @@ -32,9 +32,9 @@ export const getUserTemporaryPassword = (state, props) => state.admin.people.temporaryPasswords[props.userId]; export const shouldNudgeToPro = createSelector( - state => getSetting(state, "token-features"), - state => getUserIsAdmin(state), - state => getSetting(state, "active-users-count"), + (state) => getSetting(state, "token-features"), + (state) => getUserIsAdmin(state), + (state) => getSetting(state, "active-users-count"), (tokenFeatures, isAdmin, numActiveUsers) => { return ( !hasAnySsoFeature(tokenFeatures) && diff --git a/frontend/src/metabase/admin/performance/components/PerformanceApp.tsx b/frontend/src/metabase/admin/performance/components/PerformanceApp.tsx index 005a1aa680b..19ce65107b0 100644 --- a/frontend/src/metabase/admin/performance/components/PerformanceApp.tsx +++ b/frontend/src/metabase/admin/performance/components/PerformanceApp.tsx @@ -50,7 +50,7 @@ export const PerformanceApp = ({ return ( { + onChange={(value) => { if (isValidTabId(value)) { dispatch( push( diff --git a/frontend/src/metabase/admin/performance/components/StrategyEditorForDatabases.styled.tsx b/frontend/src/metabase/admin/performance/components/StrategyEditorForDatabases.styled.tsx index cac53fde6e0..d4686c051e8 100644 --- a/frontend/src/metabase/admin/performance/components/StrategyEditorForDatabases.styled.tsx +++ b/frontend/src/metabase/admin/performance/components/StrategyEditorForDatabases.styled.tsx @@ -8,7 +8,7 @@ export const Panel = styled.section<{ hasLeftBorder?: boolean }>` background-color: var(--mb-color-bg-white); height: 100%; - ${props => + ${(props) => props.hasLeftBorder && css` border-left: 1px solid var(--mb-color-border); @@ -19,9 +19,9 @@ export const RoundedBox = styled.div<{ twoColumns?: boolean }>` margin-bottom: 1rem; width: 100%; display: grid; - grid-template-columns: minmax(5rem, 30rem) ${props => + grid-template-columns: minmax(5rem, 30rem) ${(props) => props.twoColumns ? "minmax(5rem, auto)" : ""}; - max-width: ${props => (props.twoColumns ? "100%" : "30rem")}; + max-width: ${(props) => (props.twoColumns ? "100%" : "30rem")}; overflow: hidden; border-radius: 1rem; border: 2px solid var(--mb-color-border); diff --git a/frontend/src/metabase/admin/performance/components/StrategyEditorForDatabases.tsx b/frontend/src/metabase/admin/performance/components/StrategyEditorForDatabases.tsx index 87329bedc31..0e810dda8e8 100644 --- a/frontend/src/metabase/admin/performance/components/StrategyEditorForDatabases.tsx +++ b/frontend/src/metabase/admin/performance/components/StrategyEditorForDatabases.tsx @@ -94,7 +94,7 @@ const StrategyEditorForDatabases_Base = ({ } }, [canOverrideRootStrategy, targetId]); - const targetDatabase = databases.find(db => db.id === targetId); + const targetDatabase = databases.find((db) => db.id === targetId); const shouldAllowInvalidation = useMemo(() => { if ( diff --git a/frontend/src/metabase/admin/performance/components/StrategyForm.tsx b/frontend/src/metabase/admin/performance/components/StrategyForm.tsx index fbf249a03a0..4e15231ab65 100644 --- a/frontend/src/metabase/admin/performance/components/StrategyForm.tsx +++ b/frontend/src/metabase/admin/performance/components/StrategyForm.tsx @@ -132,7 +132,7 @@ export const StrategyForm = ({ const isFormDirty = (values: CacheStrategy, initialValues: CacheStrategy) => { const fieldNames = [...Object.keys(values), ...Object.keys(initialValues)]; const defaultValues = _.object( - _.map(fieldNames, fieldName => [ + _.map(fieldNames, (fieldName) => [ fieldName, getDefaultValueForField(values.type, fieldName), ]), @@ -389,7 +389,7 @@ const ScheduleStrategyFormFields = () => { const { values, setFieldValue } = useFormikContext(); const { schedule: scheduleInCronFormat } = values; const initialSchedule = cronToScheduleSettings(scheduleInCronFormat); - const timezone = useSelector(state => + const timezone = useSelector((state) => getSetting(state, "report-timezone-short"), ); const onScheduleChange = useCallback( diff --git a/frontend/src/metabase/admin/performance/constants/complex.ts b/frontend/src/metabase/admin/performance/constants/complex.ts index e1434f21faa..d32d548ab5c 100644 --- a/frontend/src/metabase/admin/performance/constants/complex.ts +++ b/frontend/src/metabase/admin/performance/constants/complex.ts @@ -117,4 +117,4 @@ export const getPerformanceTabMetadata = () => ] as (AdminPath & { tabId: string })[]; export const getPerformanceAdminPaths = (metadata: AdminPath[]) => - metadata.map(tab => ({ ...tab, name: `${t`Performance`} - ${tab.name}` })); + metadata.map((tab) => ({ ...tab, name: `${t`Performance`} - ${tab.name}` })); diff --git a/frontend/src/metabase/admin/performance/hooks/useCacheConfigs.tsx b/frontend/src/metabase/admin/performance/hooks/useCacheConfigs.tsx index 976efe3e40a..c127b1bf753 100644 --- a/frontend/src/metabase/admin/performance/hooks/useCacheConfigs.tsx +++ b/frontend/src/metabase/admin/performance/hooks/useCacheConfigs.tsx @@ -23,7 +23,7 @@ export const useCacheConfigs = ({ }) => { const configsApiResult = useAsync(async () => { const configsForEachModel = await Promise.all( - configurableModels.map(model => + configurableModels.map((model) => CacheConfigApi.list({ model, id }).then( (response: CacheConfigAPIResponse) => response.data, ), @@ -39,7 +39,7 @@ export const useCacheConfigs = ({ const [configs, setConfigs] = useState([]); const rootStrategyOverriddenOnce = configs.some( - config => config.model_id !== rootId, + (config) => config.model_id !== rootId, ); const [rootStrategyRecentlyOverridden] = useRecentlyTrue( diff --git a/frontend/src/metabase/admin/performance/hooks/useConfirmOnRouteLeave.tsx b/frontend/src/metabase/admin/performance/hooks/useConfirmOnRouteLeave.tsx index c26b38dacd6..4c658462fc3 100644 --- a/frontend/src/metabase/admin/performance/hooks/useConfirmOnRouteLeave.tsx +++ b/frontend/src/metabase/admin/performance/hooks/useConfirmOnRouteLeave.tsx @@ -23,7 +23,7 @@ export const useConfirmOnRouteLeave = ({ if (!route || !router) { return; } - const removeLeaveHook = router.setRouteLeaveHook(route, location => { + const removeLeaveHook = router.setRouteLeaveHook(route, (location) => { if (shouldConfirm && !isConfirmed) { confirm(() => { setIsConfirmed(true); diff --git a/frontend/src/metabase/admin/performance/hooks/useSaveStrategy.tsx b/frontend/src/metabase/admin/performance/hooks/useSaveStrategy.tsx index 16b7e1629de..6ac68806355 100644 --- a/frontend/src/metabase/admin/performance/hooks/useSaveStrategy.tsx +++ b/frontend/src/metabase/admin/performance/hooks/useSaveStrategy.tsx @@ -38,7 +38,7 @@ export const useSaveStrategy = ( }; const otherConfigs = configs.filter( - config => config.model_id !== targetId, + (config) => config.model_id !== targetId, ); const shouldDeleteStrategy = values.type === "inherit" || diff --git a/frontend/src/metabase/admin/performance/utils.tsx b/frontend/src/metabase/admin/performance/utils.tsx index ff0902bbba9..f32f299df50 100644 --- a/frontend/src/metabase/admin/performance/utils.tsx +++ b/frontend/src/metabase/admin/performance/utils.tsx @@ -33,7 +33,7 @@ export const cronUnitToNumber = (unit: string) => const dayToCron = (day: ScheduleSettings["schedule_day"]) => { const { weekdays } = getScheduleStrings(); - const index = weekdays.findIndex(o => o.value === day); + const index = weekdays.findIndex((o) => o.value === day); if (index === -1) { throw new Error(`Invalid day: ${day}`); } @@ -215,7 +215,7 @@ export const isErrorWithMessage = (error: unknown): error is ErrorWithMessage => typeof (error as { data: { message: any } }).data.message === "string"; const delay = (milliseconds: number) => - new Promise(resolve => setTimeout(resolve, milliseconds)); + new Promise((resolve) => setTimeout(resolve, milliseconds)); /** To prevent UI jumpiness, ensure a minimum delay before continuing. * An example of jumpiness: clicking a save button results in @@ -258,12 +258,12 @@ export const getShortStrategyLabel = ( const mainLabel = getLabelString(type.shortLabel ?? type.label, model); /** Part of the label shown after the colon */ const subLabel = match(strategy) - .with({ type: "schedule" }, strategy => + .with({ type: "schedule" }, (strategy) => getFrequencyFromCron(strategy.schedule), ) .with( { type: "duration" }, - strategy => + (strategy) => c( "{0} is a number. Indicates a number of hours (the length of a cache)", ).t`${strategy.duration}h`, diff --git a/frontend/src/metabase/admin/permissions/components/CollectionPermissionsModal/CollectionPermissionsModal.jsx b/frontend/src/metabase/admin/permissions/components/CollectionPermissionsModal/CollectionPermissionsModal.jsx index 12f4382d640..7f49c4abbb7 100644 --- a/frontend/src/metabase/admin/permissions/components/CollectionPermissionsModal/CollectionPermissionsModal.jsx +++ b/frontend/src/metabase/admin/permissions/components/CollectionPermissionsModal/CollectionPermissionsModal.jsx @@ -29,7 +29,7 @@ import { PermissionsTable } from "../PermissionsTable"; import { PermissionTableContainer } from "./CollectionPermissionsModal.styled"; -const getDefaultTitle = namespace => +const getDefaultTitle = (namespace) => namespace === "snippets" ? t`Permissions for this folder` : t`Permissions for this collection`; diff --git a/frontend/src/metabase/admin/permissions/components/DataPermissionsHelp/DataPermissionsHelp.tsx b/frontend/src/metabase/admin/permissions/components/DataPermissionsHelp/DataPermissionsHelp.tsx index 26cc8cfbb38..559393d6c9b 100644 --- a/frontend/src/metabase/admin/permissions/components/DataPermissionsHelp/DataPermissionsHelp.tsx +++ b/frontend/src/metabase/admin/permissions/components/DataPermissionsHelp/DataPermissionsHelp.tsx @@ -23,10 +23,10 @@ import { hasPermissionValueInGraph } from "../../utils/graph/data-permissions"; export const DataPermissionsHelp = () => { const isAdvancedPermissionsFeatureEnabled = useSelector( - state => getSetting(state, "token-features").advanced_permissions, + (state) => getSetting(state, "token-features").advanced_permissions, ); - const shouldShowLegacyNoSelfServiceInfo = useSelector(state => + const shouldShowLegacyNoSelfServiceInfo = useSelector((state) => hasPermissionValueInGraph( state.admin.permissions.originalDataPermissions, DataPermissionValue.LEGACY_NO_SELF_SERVICE, diff --git a/frontend/src/metabase/admin/permissions/components/DataPermissionsHelp/DataPermissionsHelp.unit.spec.tsx b/frontend/src/metabase/admin/permissions/components/DataPermissionsHelp/DataPermissionsHelp.unit.spec.tsx index 7df1e05cb2e..09a948d2a2d 100644 --- a/frontend/src/metabase/admin/permissions/components/DataPermissionsHelp/DataPermissionsHelp.unit.spec.tsx +++ b/frontend/src/metabase/admin/permissions/components/DataPermissionsHelp/DataPermissionsHelp.unit.spec.tsx @@ -29,11 +29,11 @@ describe("DataPermissionsHelp", () => { screen .queryAllByText("Only available in certain Metabase plans.") - .every(element => { + .every((element) => { expect(element).toBeInTheDocument(); }); - screen.getAllByText("Upgrade to Pro").every(link => { + screen.getAllByText("Upgrade to Pro").every((link) => { expect(link).toHaveAttribute( "href", "https://www.metabase.com/upgrade?utm_source=product&utm_medium=upsell&utm_content=admin_permissions&source_plan=oss", diff --git a/frontend/src/metabase/admin/permissions/components/FilterableTree/FilterableTree.styled.tsx b/frontend/src/metabase/admin/permissions/components/FilterableTree/FilterableTree.styled.tsx index a71024a3f5d..4c9e6bc7ba4 100644 --- a/frontend/src/metabase/admin/permissions/components/FilterableTree/FilterableTree.styled.tsx +++ b/frontend/src/metabase/admin/permissions/components/FilterableTree/FilterableTree.styled.tsx @@ -29,12 +29,13 @@ export const EmptyStateContainer = styled.div` `; export const AdminTreeNode = styled(Tree.Node)` - color: ${props => + color: ${(props) => props.isSelected ? color("text-white") : color("text-medium")}; - background-color: ${props => (props.isSelected ? color("filter") : "unset")}; + background-color: ${(props) => + props.isSelected ? color("filter") : "unset"}; &:hover { - background-color: ${props => + background-color: ${(props) => props.isSelected ? color("filter") : lighten(color("filter"), 0.6)}; } `; diff --git a/frontend/src/metabase/admin/permissions/components/FilterableTree/FilterableTree.tsx b/frontend/src/metabase/admin/permissions/components/FilterableTree/FilterableTree.tsx index af2742c74bc..f464ac2c864 100644 --- a/frontend/src/metabase/admin/permissions/components/FilterableTree/FilterableTree.tsx +++ b/frontend/src/metabase/admin/permissions/components/FilterableTree/FilterableTree.tsx @@ -51,7 +51,7 @@ export const FilterableTree = ({ return searchItems(itemGroups.flat(), trimmedFilter); }, [itemGroups, debouncedFilter]); - const handleFilterChange: InputProps["onChange"] = e => + const handleFilterChange: InputProps["onChange"] = (e) => setFilter(e.target.value); return ( diff --git a/frontend/src/metabase/admin/permissions/components/FilterableTree/utils.ts b/frontend/src/metabase/admin/permissions/components/FilterableTree/utils.ts index 54c5aa0b13a..9da2dc193bc 100644 --- a/frontend/src/metabase/admin/permissions/components/FilterableTree/utils.ts +++ b/frontend/src/metabase/admin/permissions/components/FilterableTree/utils.ts @@ -1,10 +1,10 @@ export const searchItems = (items: any[], filter: string) => { - const matchingItems = items.filter(item => + const matchingItems = items.filter((item) => item.name.toLowerCase().includes(filter), ); const children = items - .map(c => c.children) + .map((c) => c.children) .filter(Boolean) .flat(); diff --git a/frontend/src/metabase/admin/permissions/components/LegacyPermissionsModal/LegacyPermissionsModal.tsx b/frontend/src/metabase/admin/permissions/components/LegacyPermissionsModal/LegacyPermissionsModal.tsx index f3525e5badb..37af10d6933 100644 --- a/frontend/src/metabase/admin/permissions/components/LegacyPermissionsModal/LegacyPermissionsModal.tsx +++ b/frontend/src/metabase/admin/permissions/components/LegacyPermissionsModal/LegacyPermissionsModal.tsx @@ -16,7 +16,7 @@ export const LegacyPermissionsModal = ({ //Used to animate the modal const { open: showModal } = useModalOpen(); - const docsUrl = useSelector(state => + const docsUrl = useSelector((state) => getDocsUrl(state, { page: "permissions/no-self-service-deprecation" }), ); return ( diff --git a/frontend/src/metabase/admin/permissions/components/PermissionHelpDescription/PermissionHelpDescription.styled.tsx b/frontend/src/metabase/admin/permissions/components/PermissionHelpDescription/PermissionHelpDescription.styled.tsx index 1019f590c7a..4469ee93611 100644 --- a/frontend/src/metabase/admin/permissions/components/PermissionHelpDescription/PermissionHelpDescription.styled.tsx +++ b/frontend/src/metabase/admin/permissions/components/PermissionHelpDescription/PermissionHelpDescription.styled.tsx @@ -16,5 +16,5 @@ export const PermissionIconContainer = styled.div` border-radius: 0.25rem; margin-right: 0.375rem; color: var(--mb-color-text-white); - background-color: ${props => color(props.color)}; + background-color: ${(props) => color(props.color)}; `; diff --git a/frontend/src/metabase/admin/permissions/components/PermissionHelpDescription/PermissionHelpDescription.tsx b/frontend/src/metabase/admin/permissions/components/PermissionHelpDescription/PermissionHelpDescription.tsx index a4c2cbfa6b1..2438e56f550 100644 --- a/frontend/src/metabase/admin/permissions/components/PermissionHelpDescription/PermissionHelpDescription.tsx +++ b/frontend/src/metabase/admin/permissions/components/PermissionHelpDescription/PermissionHelpDescription.tsx @@ -25,7 +25,7 @@ export const PermissionHelpDescription = ({ iconColor, hasUpgradeNotice, }: PermissionHelpDescriptionProps) => { - const upgradeUrl = useSelector(state => + const upgradeUrl = useSelector((state) => getUpgradeUrl(state, { utm_content: "admin_permissions" }), ); diff --git a/frontend/src/metabase/admin/permissions/components/PermissionsConfirm.jsx b/frontend/src/metabase/admin/permissions/components/PermissionsConfirm.jsx index 23f457bdbe6..d5a0c79d507 100644 --- a/frontend/src/metabase/admin/permissions/components/PermissionsConfirm.jsx +++ b/frontend/src/metabase/admin/permissions/components/PermissionsConfirm.jsx @@ -30,7 +30,7 @@ const TableAccessChange = ({ tables, verb, colorClassName }) => { {" " + - (n => ngettext(msgid`${n} table`, `${n} tables`, n))( + ((n) => ngettext(msgid`${n} table`, `${n} tables`, n))( tableEntries.length, )} diff --git a/frontend/src/metabase/admin/permissions/components/PermissionsEditor/PermissionsEditorContent.jsx b/frontend/src/metabase/admin/permissions/components/PermissionsEditor/PermissionsEditorContent.jsx index fa42af6b2dd..c05d5614e37 100644 --- a/frontend/src/metabase/admin/permissions/components/PermissionsEditor/PermissionsEditorContent.jsx +++ b/frontend/src/metabase/admin/permissions/components/PermissionsEditor/PermissionsEditorContent.jsx @@ -58,12 +58,12 @@ export function PermissionsEditorContent({ return null; } - return entities.filter(entity => + return entities.filter((entity) => entity.name.toLowerCase().includes(trimmedFilter), ); }, [entities, debouncedFilter]); - const handleFilterChange = e => setFilter(e.target.value); + const handleFilterChange = (e) => setFilter(e.target.value); return ( diff --git a/frontend/src/metabase/admin/permissions/components/PermissionsEditor/PermissionsEditorEmptyState.jsx b/frontend/src/metabase/admin/permissions/components/PermissionsEditor/PermissionsEditorEmptyState.jsx index 56ab9972360..c9474da1868 100644 --- a/frontend/src/metabase/admin/permissions/components/PermissionsEditor/PermissionsEditorEmptyState.jsx +++ b/frontend/src/metabase/admin/permissions/components/PermissionsEditor/PermissionsEditorEmptyState.jsx @@ -9,7 +9,7 @@ const propTypes = { message: PropTypes.string.isRequired, }; -export const PermissionsEditorEmptyState = props => ( +export const PermissionsEditorEmptyState = (props) => ( diff --git a/frontend/src/metabase/admin/permissions/components/PermissionsEditor/PermissionsEditorSplitPermsMessage.tsx b/frontend/src/metabase/admin/permissions/components/PermissionsEditor/PermissionsEditorSplitPermsMessage.tsx index 92587dff314..edb83ed6e59 100644 --- a/frontend/src/metabase/admin/permissions/components/PermissionsEditor/PermissionsEditorSplitPermsMessage.tsx +++ b/frontend/src/metabase/admin/permissions/components/PermissionsEditor/PermissionsEditorSplitPermsMessage.tsx @@ -9,7 +9,7 @@ import { Alert, Anchor, Box, Icon, Text } from "metabase/ui"; export const PermissionsEditorSplitPermsMessage = () => { const dispatch = useDispatch(); - const docsUrl = useSelector(state => + const docsUrl = useSelector((state) => getDocsUrl(state, { page: "permissions/no-self-service-deprecation" }), ); diff --git a/frontend/src/metabase/admin/permissions/components/PermissionsPageLayout/PermissionsPageLayout.tsx b/frontend/src/metabase/admin/permissions/components/PermissionsPageLayout/PermissionsPageLayout.tsx index 744b3511350..1f6be897a61 100644 --- a/frontend/src/metabase/admin/permissions/components/PermissionsPageLayout/PermissionsPageLayout.tsx +++ b/frontend/src/metabase/admin/permissions/components/PermissionsPageLayout/PermissionsPageLayout.tsx @@ -83,7 +83,7 @@ export function PermissionsPageLayout({ const [showSplitPermsModal, { turnOff: disableSplitPermsModal }] = useToggle(_showSplitPermsModal); - const saveError = useSelector(state => state.admin.permissions.saveError); + const saveError = useSelector((state) => state.admin.permissions.saveError); const showRefreshModal = useSelector(showRevisionChangedModal); const isHelpReferenceOpen = useSelector(getIsHelpReferenceOpen); diff --git a/frontend/src/metabase/admin/permissions/components/PermissionsSelect/PermissionsSelect.jsx b/frontend/src/metabase/admin/permissions/components/PermissionsSelect/PermissionsSelect.jsx index c691ea7b02e..456f37d63d0 100644 --- a/frontend/src/metabase/admin/permissions/components/PermissionsSelect/PermissionsSelect.jsx +++ b/frontend/src/metabase/admin/permissions/components/PermissionsSelect/PermissionsSelect.jsx @@ -50,10 +50,10 @@ export const PermissionsSelect = memo(function PermissionsSelect({ isHighlighted, }) { const [toggleState, setToggleState] = useState(false); - const selectedOption = options.find(option => option.value === value); + const selectedOption = options.find((option) => option.value === value); const selectableOptions = hasChildren ? options - : options.filter(option => option !== selectedOption); + : options.filter((option) => option !== selectedOption); const selectedOptionValue = ( ( - {selectableOptions.map(option => ( + {selectableOptions.map((option) => ( ` display: flex; align-items: center; min-width: 180px; - cursor: ${props => (props.isDisabled ? "default" : "pointer")}; + cursor: ${(props) => (props.isDisabled ? "default" : "pointer")}; `; export const SelectedOption = styled(PermissionsSelectOption)` @@ -73,6 +73,6 @@ export const WarningIcon = styled( export const DisabledPermissionOption = styled(PermissionsSelectOption)<{ isHighlighted: boolean; }>` - color: ${props => + color: ${(props) => props.isHighlighted ? color("text-medium") : color("text-light")}; `; diff --git a/frontend/src/metabase/admin/permissions/components/PermissionsSelect/PermissionsSelectOption.styled.tsx b/frontend/src/metabase/admin/permissions/components/PermissionsSelect/PermissionsSelectOption.styled.tsx index 13f4e539add..3f891955fc1 100644 --- a/frontend/src/metabase/admin/permissions/components/PermissionsSelect/PermissionsSelectOption.styled.tsx +++ b/frontend/src/metabase/admin/permissions/components/PermissionsSelect/PermissionsSelectOption.styled.tsx @@ -17,7 +17,7 @@ export const IconContainer = styled.div<{ color: string }>` width: 20px; height: 20px; color: var(--mb-color-text-white); - background-color: ${props => color(props.color)}; + background-color: ${(props) => color(props.color)}; flex-shrink: 0; `; diff --git a/frontend/src/metabase/admin/permissions/components/PermissionsTable/PermissionsTable.jsx b/frontend/src/metabase/admin/permissions/components/PermissionsTable/PermissionsTable.jsx index e5c7e1d06d5..bfe59e002e2 100644 --- a/frontend/src/metabase/admin/permissions/components/PermissionsTable/PermissionsTable.jsx +++ b/frontend/src/metabase/admin/permissions/components/PermissionsTable/PermissionsTable.jsx @@ -63,7 +63,7 @@ export function PermissionsTable({ }; const handleConfirm = () => { - setConfirmations(prev => prev.slice(1)); + setConfirmations((prev) => prev.slice(1)); if (confirmations.length === 1) { confirmActionRef.current(); confirmActionRef.current = null; @@ -99,7 +99,7 @@ export function PermissionsTable({ - {entities.map(entity => { + {entities.map((entity) => { const entityName = ( {entity.name} @@ -132,7 +132,7 @@ export function PermissionsTable({ onChange={(value, toggleState) => handleChange(value, toggleState, entity, permission) } - onAction={actionCreator => + onAction={(actionCreator) => onAction(actionCreator, entity) } colorScheme={colorScheme} diff --git a/frontend/src/metabase/admin/permissions/pages/CollectionPermissionsPage/tests/common.unit.spec.tsx b/frontend/src/metabase/admin/permissions/pages/CollectionPermissionsPage/tests/common.unit.spec.tsx index 244d01812bf..3b81a84a8b6 100644 --- a/frontend/src/metabase/admin/permissions/pages/CollectionPermissionsPage/tests/common.unit.spec.tsx +++ b/frontend/src/metabase/admin/permissions/pages/CollectionPermissionsPage/tests/common.unit.spec.tsx @@ -119,7 +119,7 @@ describe("Admin > CollectionPermissionsPage", () => { // should also change permissions on nested one from no access to curate const otherUsersRow = await screen .findAllByRole("row") - .then(rows => rows[3]); + .then((rows) => rows[3]); expect(within(otherUsersRow).getByText("Other Users")).toBeVisible(); await userEvent.click(within(otherUsersRow).getByText("View")); diff --git a/frontend/src/metabase/admin/permissions/pages/CollectionPermissionsPage/tests/enterprise.unit.spec.tsx b/frontend/src/metabase/admin/permissions/pages/CollectionPermissionsPage/tests/enterprise.unit.spec.tsx index 36cb11d8d3f..03f69ad26d1 100644 --- a/frontend/src/metabase/admin/permissions/pages/CollectionPermissionsPage/tests/enterprise.unit.spec.tsx +++ b/frontend/src/metabase/admin/permissions/pages/CollectionPermissionsPage/tests/enterprise.unit.spec.tsx @@ -44,7 +44,7 @@ describe("Admin > CollectionPermissionsPage (enterprise)", () => { expect(await screen.findAllByText("View")).toHaveLength(3); await userEvent.click( - await screen.findAllByText("View").then(dropdowns => dropdowns[2]), + await screen.findAllByText("View").then((dropdowns) => dropdowns[2]), ); expect(await screen.findByText("No access")).toBeInTheDocument(); @@ -63,7 +63,7 @@ describe("Admin > CollectionPermissionsPage (enterprise)", () => { expect(await screen.findAllByText("View")).toHaveLength(3); await userEvent.hover( - await screen.findAllByText("View").then(dropdowns => dropdowns[1]), + await screen.findAllByText("View").then((dropdowns) => dropdowns[1]), ); expect( @@ -81,7 +81,7 @@ describe("Admin > CollectionPermissionsPage (enterprise)", () => { // change all users users view to no access await userEvent.click( - await screen.findAllByText("View").then(dropdowns => dropdowns[0]), + await screen.findAllByText("View").then((dropdowns) => dropdowns[0]), ); await userEvent.click(await screen.findByText("No access")); diff --git a/frontend/src/metabase/admin/permissions/pages/DataPermissionsPage/DataPermissionsPage.tsx b/frontend/src/metabase/admin/permissions/pages/DataPermissionsPage/DataPermissionsPage.tsx index e28766e3e13..d0b023de54d 100644 --- a/frontend/src/metabase/admin/permissions/pages/DataPermissionsPage/DataPermissionsPage.tsx +++ b/frontend/src/metabase/admin/permissions/pages/DataPermissionsPage/DataPermissionsPage.tsx @@ -41,8 +41,8 @@ function DataPermissionsPage({ groups, }: DataPermissionsPageProps) { const isDirty = useSelector(getIsDirty); - const diff = useSelector(state => getDiff(state, { databases, groups })); - const showSplitPermsModal = useSelector(state => + const diff = useSelector((state) => getDiff(state, { databases, groups })); + const showSplitPermsModal = useSelector((state) => getSetting(state, "show-updated-permission-modal"), ); diff --git a/frontend/src/metabase/admin/permissions/pages/DatabasePermissionsPage/DatabasesPermissionsPage.jsx b/frontend/src/metabase/admin/permissions/pages/DatabasePermissionsPage/DatabasesPermissionsPage.jsx index 6c3b9d47784..99ddbef78fc 100644 --- a/frontend/src/metabase/admin/permissions/pages/DatabasePermissionsPage/DatabasesPermissionsPage.jsx +++ b/frontend/src/metabase/admin/permissions/pages/DatabasePermissionsPage/DatabasesPermissionsPage.jsx @@ -34,14 +34,14 @@ import { getDatabaseFocusPermissionsUrl, } from "../../utils/urls"; -const mapDispatchToProps = dispatch => ({ +const mapDispatchToProps = (dispatch) => ({ dispatch, ...bindActionCreators( { updateDataPermission, - switchView: entityType => push(`/admin/permissions/data/${entityType}`), + switchView: (entityType) => push(`/admin/permissions/data/${entityType}`), navigateToDatabaseList: () => push(DATABASES_BASE_PATH), - navigateToItem: item => + navigateToItem: (item) => push(getDatabaseFocusPermissionsUrl(item.entityId)), }, dispatch, @@ -84,11 +84,11 @@ function DatabasesPermissionsPage({ sidebarError, }) { const dispatch = useDispatch(); - const permissionEditor = useSelector(state => + const permissionEditor = useSelector((state) => getGroupsDataPermissionEditor(state, { params }), ); - const showSplitPermsMessage = useSelector(state => + const showSplitPermsMessage = useSelector((state) => getSetting(state, "show-updated-permission-banner"), ); @@ -105,7 +105,7 @@ function DatabasesPermissionsPage({ }, [params.databaseId]); const handleEntityChange = useCallback( - entityType => { + (entityType) => { switchView(entityType); }, [switchView], @@ -128,7 +128,7 @@ function DatabasesPermissionsPage({ dispatch(action.actionCreator(item.entityId, item.id, "database")); }; - const handleBreadcrumbsItemSelect = item => dispatch(push(item.url)); + const handleBreadcrumbsItemSelect = (item) => dispatch(push(item.url)); const showLegacyNoSelfServiceWarning = PLUGIN_ADVANCED_PERMISSIONS.shouldShowViewDataColumn && diff --git a/frontend/src/metabase/admin/permissions/pages/GroupDataPermissionsPage/GroupsPermissionsPage.jsx b/frontend/src/metabase/admin/permissions/pages/GroupDataPermissionsPage/GroupsPermissionsPage.jsx index 4737f8669cf..8385c85529b 100644 --- a/frontend/src/metabase/admin/permissions/pages/GroupDataPermissionsPage/GroupsPermissionsPage.jsx +++ b/frontend/src/metabase/admin/permissions/pages/GroupDataPermissionsPage/GroupsPermissionsPage.jsx @@ -34,13 +34,14 @@ import { getGroupFocusPermissionsUrl, } from "../../utils/urls"; -const mapDispatchToProps = dispatch => ({ +const mapDispatchToProps = (dispatch) => ({ dispatch, ...bindActionCreators( { updateDataPermission, - switchView: entityType => push(`/admin/permissions/data/${entityType}/`), - navigateToItem: item => push(`${GROUPS_BASE_PATH}/${item.id}`), + switchView: (entityType) => + push(`/admin/permissions/data/${entityType}/`), + navigateToItem: (item) => push(`${GROUPS_BASE_PATH}/${item.id}`), navigateToTableItem: (item, { groupId }) => { return push(getGroupFocusPermissionsUrl(groupId, item.entityId)); }, @@ -99,29 +100,29 @@ function GroupsPermissionsPage({ } }, [params.groupId]); - const permissionEditor = useSelector(state => + const permissionEditor = useSelector((state) => getDatabasesPermissionEditor(state, { params }), ); - const showSplitPermsMessage = useSelector(state => + const showSplitPermsMessage = useSelector((state) => getSetting(state, "show-updated-permission-banner"), ); const handleEntityChange = useCallback( - entityType => { + (entityType) => { switchView(entityType); }, [switchView], ); const handleSidebarItemSelect = useCallback( - item => { + (item) => { navigateToItem(item, params); }, [navigateToItem, params], ); const handleTableItemSelect = useCallback( - item => { + (item) => { navigateToTableItem(item, params); }, [navigateToTableItem, params], @@ -144,7 +145,7 @@ function GroupsPermissionsPage({ dispatch(action.actionCreator(item.entityId, params.groupId, "group")); }; - const handleBreadcrumbsItemSelect = item => dispatch(push(item.url)); + const handleBreadcrumbsItemSelect = (item) => dispatch(push(item.url)); const showEmptyState = !permissionEditor && !isEditorLoading && !editorError; const showLegacyNoSelfServiceWarning = diff --git a/frontend/src/metabase/admin/permissions/permissions.js b/frontend/src/metabase/admin/permissions/permissions.js index 6c3f37afbf0..b25311dc4b2 100644 --- a/frontend/src/metabase/admin/permissions/permissions.js +++ b/frontend/src/metabase/admin/permissions/permissions.js @@ -38,7 +38,7 @@ const INITIALIZE_DATA_PERMISSIONS = "metabase/admin/permissions/INITIALIZE_DATA_PERMISSIONS"; export const initializeDataPermissions = createThunkAction( INITIALIZE_DATA_PERMISSIONS, - () => async dispatch => { + () => async (dispatch) => { await Promise.all([ dispatch(loadDataPermissions()), dispatch(Group.actions.fetchList()), @@ -76,7 +76,7 @@ const INITIALIZE_COLLECTION_PERMISSIONS = "metabase/admin/permissions/INITIALIZE_COLLECTION_PERMISSIONS"; export const initializeCollectionPermissions = createThunkAction( INITIALIZE_COLLECTION_PERMISSIONS, - namespace => async dispatch => { + (namespace) => async (dispatch) => { await Promise.all([ dispatch(loadCollectionPermissions(namespace)), dispatch(Group.actions.fetchList()), @@ -88,7 +88,7 @@ const LOAD_COLLECTION_PERMISSIONS = "metabase/admin/permissions/LOAD_COLLECTION_PERMISSIONS"; export const loadCollectionPermissions = createThunkAction( LOAD_COLLECTION_PERMISSIONS, - namespace => async () => { + (namespace) => async () => { const params = namespace != null ? { namespace } : {}; return CollectionsApi.graph(params); }, @@ -98,7 +98,7 @@ export const LIMIT_DATABASE_PERMISSION = "metabase/admin/permissions/LIMIT_DATABASE_PERMISSION"; export const limitDatabasePermission = createThunkAction( LIMIT_DATABASE_PERMISSION, - (groupId, entityId, accessPermissionValue) => dispatch => { + (groupId, entityId, accessPermissionValue) => (dispatch) => { const newValue = PLUGIN_ADVANCED_PERMISSIONS.getDatabaseLimitedAccessPermission( accessPermissionValue, @@ -126,7 +126,7 @@ export const NAVIGATE_TO_GRANULAR_PERMISSIONS = "metabase/admin/permissions/NAVIGATE_TO_GRANULAR_PERMISSIONS"; export const navigateToGranularPermissions = createThunkAction( NAVIGATE_TO_GRANULAR_PERMISSIONS, - (groupId, entityId) => dispatch => { + (groupId, entityId) => (dispatch) => { dispatch(push(getGroupFocusPermissionsUrl(groupId, entityId))); }, ); @@ -223,7 +223,7 @@ const SAVE_COLLECTION_PERMISSIONS = "metabase/admin/permissions/data/SAVE_COLLECTION_PERMISSIONS"; export const saveCollectionPermissions = createThunkAction( SAVE_COLLECTION_PERMISSIONS, - namespace => async (_dispatch, getState) => { + (namespace) => async (_dispatch, getState) => { const { originalCollectionPermissions, collectionPermissions, @@ -252,7 +252,7 @@ const CLEAR_SAVE_ERROR = "metabase/admin/permissions/CLEAR_SAVE_ERROR"; export const clearSaveError = createAction(CLEAR_SAVE_ERROR); const savePermission = { - next: _state => null, + next: (_state) => null, throw: (_state, { payload }) => { return ( (payload && typeof payload.data === "string" @@ -266,11 +266,11 @@ const saveError = handleActions( { [SAVE_DATA_PERMISSIONS]: savePermission, [LOAD_DATA_PERMISSIONS]: { - next: state => null, + next: (state) => null, }, [SAVE_COLLECTION_PERMISSIONS]: savePermission, [LOAD_COLLECTION_PERMISSIONS]: { - next: state => null, + next: (state) => null, }, [CLEAR_SAVE_ERROR]: { next: () => null }, }, @@ -279,7 +279,7 @@ const saveError = handleActions( function getDecendentCollections(collection) { const subCollections = collection.children.filter( - collection => !collection.is_personal, + (collection) => !collection.is_personal, ); return subCollections.concat(...subCollections.map(getDecendentCollections)); } @@ -489,7 +489,7 @@ export const toggleHelpReference = createAction(TOGGLE_HELP_REFERENCE); export const isHelpReferenceOpen = handleActions( { [toggleHelpReference]: { - next: state => !state, + next: (state) => !state, }, }, false, diff --git a/frontend/src/metabase/admin/permissions/selectors/collection-permissions.ts b/frontend/src/metabase/admin/permissions/selectors/collection-permissions.ts index 55a44a2e6c6..8e326084204 100644 --- a/frontend/src/metabase/admin/permissions/selectors/collection-permissions.ts +++ b/frontend/src/metabase/admin/permissions/selectors/collection-permissions.ts @@ -86,7 +86,7 @@ const getCollections = (state: State) => }) ?? [] ).filter(nonPersonalOrArchivedCollection); -const getCollectionsTree = createSelector([getCollections], collections => { +const getCollectionsTree = createSelector([getCollections], (collections) => { return [getRootCollectionTreeItem(), ...buildCollectionTree(collections)]; }); @@ -140,7 +140,7 @@ const findCollection = ( } const collection = collections.find( - collection => collection.id === collectionId, + (collection) => collection.id === collectionId, ); if (collection) { @@ -148,7 +148,7 @@ const findCollection = ( } return findCollection( - collections.map(collection => collection.children ?? []).flat(), + collections.map((collection) => collection.children ?? []).flat(), collectionId, ); }; @@ -317,7 +317,7 @@ function getPermissionsSet( permissions: CollectionPermissions, groupId: number, ) { - const perms = collections.map(collection => + const perms = collections.map((collection) => getCollectionPermission(permissions, groupId, collection.id), ); return new Set(perms); diff --git a/frontend/src/metabase/admin/permissions/selectors/confirmations.tsx b/frontend/src/metabase/admin/permissions/selectors/confirmations.tsx index 668f39900a7..5e065305fcf 100644 --- a/frontend/src/metabase/admin/permissions/selectors/confirmations.tsx +++ b/frontend/src/metabase/admin/permissions/selectors/confirmations.tsx @@ -290,7 +290,7 @@ export function getRevokingAccessToAllTablesWarningModal( ) !== DataPermissionValue.NO ) { // allTableEntityIds contains tables from all schemas - const allTableEntityIds = database.getTables().map(table => ({ + const allTableEntityIds = database.getTables().map((table) => ({ databaseId: table.db_id, schemaName: table.schema_name || "", tableId: table.id as ConcreteTableId, @@ -299,7 +299,7 @@ export function getRevokingAccessToAllTablesWarningModal( // Show the warning only if user tries to revoke access to the very last table of all schemas const afterChangesNoAccessToAnyTable = _.every( allTableEntityIds, - id => + (id) => getFieldsPermission( permissions, groupId, diff --git a/frontend/src/metabase/admin/permissions/selectors/data-permissions/data-sidebar.ts b/frontend/src/metabase/admin/permissions/selectors/data-permissions/data-sidebar.ts index 0843c5da4d4..f9240382ae3 100644 --- a/frontend/src/metabase/admin/permissions/selectors/data-permissions/data-sidebar.ts +++ b/frontend/src/metabase/admin/permissions/selectors/data-permissions/data-sidebar.ts @@ -53,8 +53,8 @@ const getTableId = (id: string | number) => `table:${id}`; const getDatabasesSidebar = (metadata: Metadata): DataSidebarProps => { const entities = metadata .databasesList({ savedQuestions: false }) - .filter(db => !PLUGIN_AUDIT.isAuditDb(db as DatabaseType)) - .map(database => ({ + .filter((db) => !PLUGIN_AUDIT.isAuditDb(db as DatabaseType)) + .map((database) => ({ id: database.id, name: database.name, entityId: getDatabaseEntityId(database), @@ -84,7 +84,7 @@ const getTablesSidebar = ( let entities = database .getSchemas() .sort((a, b) => a.name.localeCompare(b.name)) - .map(schema => { + .map((schema) => { return { id: getSchemaId(schema.name), name: schema.name, @@ -93,7 +93,7 @@ const getTablesSidebar = ( children: schema .getTables() .sort((a, b) => a.displayName().localeCompare(b.displayName())) - .map(table => ({ + .map((table) => ({ id: getTableId(table.id), entityId: getTableEntityId(table), name: table.displayName(), diff --git a/frontend/src/metabase/admin/permissions/selectors/data-permissions/diff.ts b/frontend/src/metabase/admin/permissions/selectors/data-permissions/diff.ts index ffe97230f0b..76a4c98900b 100644 --- a/frontend/src/metabase/admin/permissions/selectors/data-permissions/diff.ts +++ b/frontend/src/metabase/admin/permissions/selectors/data-permissions/diff.ts @@ -13,7 +13,7 @@ export const getIsDirty = createSelector( (state: State) => state, (permissions, originalPermissions, state) => !_.isEqual(permissions, originalPermissions) || - PLUGIN_DATA_PERMISSIONS.hasChanges.some(hasChanges => hasChanges(state)), + PLUGIN_DATA_PERMISSIONS.hasChanges.some((hasChanges) => hasChanges(state)), ); interface DiffProps { diff --git a/frontend/src/metabase/admin/permissions/selectors/data-permissions/fields.ts b/frontend/src/metabase/admin/permissions/selectors/data-permissions/fields.ts index ce583048a80..a8e372f1fae 100644 --- a/frontend/src/metabase/admin/permissions/selectors/data-permissions/fields.ts +++ b/frontend/src/metabase/admin/permissions/selectors/data-permissions/fields.ts @@ -99,7 +99,7 @@ const buildAccessPermission = ( groupId, undefined, ), - ...PLUGIN_ADMIN_PERMISSIONS_TABLE_FIELDS_CONFIRMATIONS.map(confirmation => + ...PLUGIN_ADMIN_PERMISSIONS_TABLE_FIELDS_CONFIRMATIONS.map((confirmation) => confirmation(permissions, groupId, entityId, newValue), ), getRevokingAccessToAllTablesWarningModal( diff --git a/frontend/src/metabase/admin/permissions/selectors/data-permissions/group-sidebar.ts b/frontend/src/metabase/admin/permissions/selectors/data-permissions/group-sidebar.ts index d7b183ae22f..ac32fbcb310 100644 --- a/frontend/src/metabase/admin/permissions/selectors/data-permissions/group-sidebar.ts +++ b/frontend/src/metabase/admin/permissions/selectors/data-permissions/group-sidebar.ts @@ -29,13 +29,13 @@ export const getGroupsSidebar = createSelector( const [pinnedGroups, unpinnedGroups] = groups; - const pinnedGroupItems = pinnedGroups.map(group => ({ + const pinnedGroupItems = pinnedGroups.map((group) => ({ ...group, name: getGroupNameLocalized(group), icon: "bolt", })); - const unpinnedGroupItems = unpinnedGroups.map(group => ({ + const unpinnedGroupItems = unpinnedGroups.map((group) => ({ ...group, name: getGroupNameLocalized(group), icon: "group", diff --git a/frontend/src/metabase/admin/permissions/selectors/data-permissions/group-sidebar.unit.spec.ts b/frontend/src/metabase/admin/permissions/selectors/data-permissions/group-sidebar.unit.spec.ts index 8c511b9bcb7..2879a391808 100644 --- a/frontend/src/metabase/admin/permissions/selectors/data-permissions/group-sidebar.unit.spec.ts +++ b/frontend/src/metabase/admin/permissions/selectors/data-permissions/group-sidebar.unit.spec.ts @@ -64,7 +64,7 @@ describe("getGroupsDataPermissionEditor", () => { })?.entities; expect(entities).toHaveLength(3); - expect(entities?.map(entity => entity.name)).toEqual([ + expect(entities?.map((entity) => entity.name)).toEqual([ "All Users", "Group starting with full access", "Group starting with no access at all", diff --git a/frontend/src/metabase/admin/permissions/selectors/data-permissions/permission-editor.ts b/frontend/src/metabase/admin/permissions/selectors/data-permissions/permission-editor.ts index 32bae367ee6..3d9c3901283 100644 --- a/frontend/src/metabase/admin/permissions/selectors/data-permissions/permission-editor.ts +++ b/frontend/src/metabase/admin/permissions/selectors/data-permissions/permission-editor.ts @@ -143,7 +143,7 @@ const getGroup = (state: State, props: { params: RawGroupRouteParams }) => { const hasViewDataOptions = (entities: any[]) => { return entities.some( - entity => + (entity) => entity.permissions?.findIndex( (permissionSectionConfig: any) => permissionSectionConfig.permission === DataPermission.VIEW_DATA, @@ -206,7 +206,7 @@ export const getDatabasesPermissionEditor = createSelector( entities = schema .getTables() .sort((a, b) => a.display_name.localeCompare(b.display_name)) - .map(table => { + .map((table) => { const entityId = getTableEntityId(table); return { id: table.id, @@ -228,7 +228,7 @@ export const getDatabasesPermissionEditor = createSelector( ?.database(databaseId) ?.getSchemas() .sort((a, b) => a.name.localeCompare(b.name)) - .map(schema => { + .map((schema) => { const entityId = getSchemaEntityId(schema); return { id: schema.id, @@ -254,8 +254,8 @@ export const getDatabasesPermissionEditor = createSelector( permissionSubject = "schemas"; entities = metadata .databasesList({ savedQuestions: false }) - .filter(db => !PLUGIN_AUDIT.isAuditDb(db as Database)) - .map(database => { + .filter((db) => !PLUGIN_AUDIT.isAuditDb(db as Database)) + .map((database) => { const entityId = getDatabaseEntityId(database); return { id: database.id, @@ -373,7 +373,7 @@ export const getGroupsDataPermissionEditor: GetGroupsDataPermissionEditorSelecto const permissionSubject = tableId != null ? "fields" : schemaName != null ? "tables" : "schemas"; - const entities = sortedGroups.map(group => { + const entities = sortedGroups.map((group) => { const isAdmin = isAdminGroup(group); let groupPermissions; diff --git a/frontend/src/metabase/admin/permissions/utils/graph/data-permissions/has.ts b/frontend/src/metabase/admin/permissions/utils/graph/data-permissions/has.ts index 3e45346c227..6601c58fd20 100644 --- a/frontend/src/metabase/admin/permissions/utils/graph/data-permissions/has.ts +++ b/frontend/src/metabase/admin/permissions/utils/graph/data-permissions/has.ts @@ -47,7 +47,7 @@ export function hasPermissionValueInSubgraph( ); if (schemasToSearch) { - const hasSchemaWithMatchingPermission = schemasToSearch.some(schema => { + const hasSchemaWithMatchingPermission = schemasToSearch.some((schema) => { const currVal = getTablesPermission( permissions, groupId, @@ -62,8 +62,8 @@ export function hasPermissionValueInSubgraph( } } - return schemasToSearch.some(schema => { - return schema.getTables().some(table => { + return schemasToSearch.some((schema) => { + return schema.getTables().some((table) => { return ( value === getFieldsPermission( @@ -128,7 +128,7 @@ export function hasPermissionValueInEntityGraphs( permission: DataPermission, permissionValue: DataPermissionValue, ): boolean { - return entityIds.some(entityId => { + return entityIds.some((entityId) => { // try to get the raw section of the graph so we can crawl it's children if it has them const permissionPortion = getRawPermissionsGraphValue( permissions, diff --git a/frontend/src/metabase/admin/permissions/utils/graph/data-permissions/has.unit.spec.ts b/frontend/src/metabase/admin/permissions/utils/graph/data-permissions/has.unit.spec.ts index 8f163c3542b..8679a5f6926 100644 --- a/frontend/src/metabase/admin/permissions/utils/graph/data-permissions/has.unit.spec.ts +++ b/frontend/src/metabase/admin/permissions/utils/graph/data-permissions/has.unit.spec.ts @@ -15,7 +15,8 @@ describe("data permissions", () => { const schemas = [{ name: "", getTables: () => [{ id: 1 }, { id: 2 }] }]; const database = { schemas, - schema: (name: string) => schemas.find(schema => schema.name === name), + schema: (name: string) => + schemas.find((schema) => schema.name === name), }; const testPermissions: GroupsPermissions = { @@ -77,7 +78,8 @@ describe("data permissions", () => { ]; const database = { schemas, - schema: (name: string) => schemas.find(schema => schema.name === name), + schema: (name: string) => + schemas.find((schema) => schema.name === name), }; const testPermissions: GroupsPermissions = { @@ -112,7 +114,8 @@ describe("data permissions", () => { ]; const database = { schemas, - schema: (name: string) => schemas.find(schema => schema.name === name), + schema: (name: string) => + schemas.find((schema) => schema.name === name), }; const testPermissions: GroupsPermissions = { @@ -178,7 +181,8 @@ describe("data permissions", () => { ]; const database = { schemas, - schema: (name: string) => schemas.find(schema => schema.name === name), + schema: (name: string) => + schemas.find((schema) => schema.name === name), }; const testPermissions: GroupsPermissions = { diff --git a/frontend/src/metabase/admin/permissions/utils/graph/data-permissions/update.ts b/frontend/src/metabase/admin/permissions/utils/graph/data-permissions/update.ts index a1472eb8249..a8ac5d0ded7 100644 --- a/frontend/src/metabase/admin/permissions/utils/graph/data-permissions/update.ts +++ b/frontend/src/metabase/admin/permissions/utils/graph/data-permissions/update.ts @@ -235,7 +235,7 @@ export function restrictCreateQueriesPermissionsIfNeeded( if (shouldRestrictNative) { const schemaNames = (database && database.schemaNames()) ?? [null]; - schemaNames.forEach(schemaName => { + schemaNames.forEach((schemaName) => { permissions = updateTablesPermission( permissions, groupId, @@ -275,12 +275,12 @@ function inferEntityPermissionValueFromChildTables( permission: DataPermission, ): DataPermissionValue { const entityIdsForDescendantTables = _.chain(database.tables) - .filter(t => _.isMatch(t, entityIdToMetadataTableFields(entityId))) + .filter((t) => _.isMatch(t, entityIdToMetadataTableFields(entityId))) .map(metadataTableToTableEntityId) .value(); const entityIdsByPermValue = _.chain(entityIdsForDescendantTables) - .map(id => getFieldsPermission(permissions, groupId, id, permission)) + .map((id) => getFieldsPermission(permissions, groupId, id, permission)) .groupBy(_.identity) .value(); diff --git a/frontend/src/metabase/admin/permissions/utils/graph/partial-updates.ts b/frontend/src/metabase/admin/permissions/utils/graph/partial-updates.ts index b136edfe784..96b854b4167 100644 --- a/frontend/src/metabase/admin/permissions/utils/graph/partial-updates.ts +++ b/frontend/src/metabase/admin/permissions/utils/graph/partial-updates.ts @@ -16,7 +16,7 @@ export function getModifiedGroupsPermissionsGraphParts( allGroupIds: string[], externallyModifiedGroupIds: string[], ) { - const dataPermissionsModifiedGroupIds = allGroupIds.filter(groupId => { + const dataPermissionsModifiedGroupIds = allGroupIds.filter((groupId) => { return !_.isEqual( dataPermissions[groupId], originalDataPermissions[groupId], @@ -47,7 +47,7 @@ export function mergeGroupsPermissionsUpdates( ...Object.keys(newDataPermissions), ]); - const latestPermissionsEntries = allGroupIds.map(groupId => { + const latestPermissionsEntries = allGroupIds.map((groupId) => { // values can be omitted from the graph to save space or to indicate that the group has default permissions for all entities // this means we need to determine the value if we need to use the value currently in memory or default to an empty object // which is the FE definition of completely default permissions for all entities @@ -66,7 +66,7 @@ export function getModifiedCollectionPermissionsGraphParts( collectionPermissions: CollectionPermissions, ) { const groupIds = Object.keys(collectionPermissions); - const modifiedGroupIds = groupIds.filter(groupId => { + const modifiedGroupIds = groupIds.filter((groupId) => { const originalPerms = originalCollectionPermissions[groupId]; const currPerms = collectionPermissions[groupId]; return !_.isEqual(currPerms, originalPerms); diff --git a/frontend/src/metabase/admin/permissions/utils/urls.js b/frontend/src/metabase/admin/permissions/utils/urls.js index 6df983d5e6d..32b4ca4c0e8 100644 --- a/frontend/src/metabase/admin/permissions/utils/urls.js +++ b/frontend/src/metabase/admin/permissions/utils/urls.js @@ -7,7 +7,7 @@ import { export const DATABASES_BASE_PATH = `/admin/permissions/data/database`; export const GROUPS_BASE_PATH = `/admin/permissions/data/group`; -export const getDatabaseFocusPermissionsUrl = entityId => { +export const getDatabaseFocusPermissionsUrl = (entityId) => { if (entityId == null) { return DATABASES_BASE_PATH; } diff --git a/frontend/src/metabase/admin/routes.jsx b/frontend/src/metabase/admin/routes.jsx index 2f4578b7628..6998bfe7f61 100644 --- a/frontend/src/metabase/admin/routes.jsx +++ b/frontend/src/metabase/admin/routes.jsx @@ -153,7 +153,7 @@ const getRoutes = (store, CanAccessSettings, IsAdmin) => ( {PLUGIN_CACHING.getTabMetadata().map(({ name, key, tabId }) => ( ( + component={(routeProps) => ( )} title={name} @@ -185,7 +185,7 @@ const getRoutes = (store, CanAccessSettings, IsAdmin) => ( {/* PLUGINS */} - {PLUGIN_ADMIN_ROUTES.map(getRoutes => getRoutes(store))} + {PLUGIN_ADMIN_ROUTES.map((getRoutes) => getRoutes(store))} diff --git a/frontend/src/metabase/admin/settings/app/components/SettingsEditor/SettingsEditor.jsx b/frontend/src/metabase/admin/settings/app/components/SettingsEditor/SettingsEditor.jsx index 9595ca0a560..31afba196f1 100644 --- a/frontend/src/metabase/admin/settings/app/components/SettingsEditor/SettingsEditor.jsx +++ b/frontend/src/metabase/admin/settings/app/components/SettingsEditor/SettingsEditor.jsx @@ -51,7 +51,7 @@ const mapStateToProps = (state, props) => { }; }; -const mapDispatchToProps = dispatch => ({ +const mapDispatchToProps = (dispatch) => ({ ...bindActionCreators( { initializeSettings, diff --git a/frontend/src/metabase/admin/settings/app/components/SettingsEditor/SettingsSection.tsx b/frontend/src/metabase/admin/settings/app/components/SettingsEditor/SettingsSection.tsx index 40b0b0c3b44..27465419781 100644 --- a/frontend/src/metabase/admin/settings/app/components/SettingsEditor/SettingsSection.tsx +++ b/frontend/src/metabase/admin/settings/app/components/SettingsEditor/SettingsSection.tsx @@ -39,11 +39,11 @@ export function SettingsSection({ const dispatch = useDispatch(); if (tabs) { - const activeTab = tabs.find(tab => tab.isActive); + const activeTab = tabs.find((tab) => tab.isActive); return ( - {tabs.map(tab => { + {tabs.map((tab) => { return ( {tabs.map((tab, index) => { const isFirstTab = index === 0; - const tabSettingElements = settingElements.filter(settingElement => + const tabSettingElements = settingElements.filter((settingElement) => settingElement.tab ? settingElement.tab === tab.key : isFirstTab, ); diff --git a/frontend/src/metabase/admin/settings/auth/components/AuthCard/AuthCard.styled.tsx b/frontend/src/metabase/admin/settings/auth/components/AuthCard/AuthCard.styled.tsx index 34878620571..705205de0cc 100644 --- a/frontend/src/metabase/admin/settings/auth/components/AuthCard/AuthCard.styled.tsx +++ b/frontend/src/metabase/admin/settings/auth/components/AuthCard/AuthCard.styled.tsx @@ -37,8 +37,8 @@ interface CardBadgeProps { } export const CardBadge = styled.div` - color: ${props => (props.isEnabled ? color("brand") : color("danger"))}; - background-color: ${props => + color: ${(props) => (props.isEnabled ? color("brand") : color("danger"))}; + background-color: ${(props) => props.isEnabled ? "var(--mb-color-brand-lighter)" : "var(--mb-color-bg-light)"}; diff --git a/frontend/src/metabase/admin/settings/components/ApiKeys/ManageApiKeys.tsx b/frontend/src/metabase/admin/settings/components/ApiKeys/ManageApiKeys.tsx index 825349d2d95..8fde1a57b48 100644 --- a/frontend/src/metabase/admin/settings/components/ApiKeys/ManageApiKeys.tsx +++ b/frontend/src/metabase/admin/settings/components/ApiKeys/ManageApiKeys.tsx @@ -80,7 +80,7 @@ function ApiKeysTable({ data-testid="api-keys-table" columns={columns} rows={flatApiKeys} - rowRenderer={row => ( + rowRenderer={(row) => ( { return ( - {_.sortBy(PLUGIN_ADMIN_SETTINGS_AUTH_TABS, "order").map(tab => { + {_.sortBy(PLUGIN_ADMIN_SETTINGS_AUTH_TABS, "order").map((tab) => { return ( alpha(props.color, 0.15)}; - color: ${props => props.color}; + background: ${(props) => alpha(props.color, 0.15)}; + color: ${(props) => props.color}; `; diff --git a/frontend/src/metabase/admin/settings/components/Email/BccToggleWidget.tsx b/frontend/src/metabase/admin/settings/components/Email/BccToggleWidget.tsx index 257d9560f81..c068b1f15cb 100644 --- a/frontend/src/metabase/admin/settings/components/Email/BccToggleWidget.tsx +++ b/frontend/src/metabase/admin/settings/components/Email/BccToggleWidget.tsx @@ -22,7 +22,7 @@ export function BccToggleWidget({ onChange, setting }: BccToggleWidgetProps) { onChange(value === "true")} + onChange={(value) => onChange(value === "true")} > {setting.options.map(({ value, name }) => ( diff --git a/frontend/src/metabase/admin/settings/components/Email/SMTPConnectionForm.tsx b/frontend/src/metabase/admin/settings/components/Email/SMTPConnectionForm.tsx index cd04500f477..25f9cc50436 100644 --- a/frontend/src/metabase/admin/settings/components/Email/SMTPConnectionForm.tsx +++ b/frontend/src/metabase/admin/settings/components/Email/SMTPConnectionForm.tsx @@ -143,7 +143,7 @@ export const SMTPConnectionForm = ({ }, [dispatch, isHosted]); const allSetByEnvVars = useMemo(() => { - return elements.every(element => element.is_env_setting); + return elements.every((element) => element.is_env_setting); }, [elements]); return ( diff --git a/frontend/src/metabase/admin/settings/components/Email/SMTPConnectionForm.unit.spec.tsx b/frontend/src/metabase/admin/settings/components/Email/SMTPConnectionForm.unit.spec.tsx index 5a588b1c8b8..f0362002f73 100644 --- a/frontend/src/metabase/admin/settings/components/Email/SMTPConnectionForm.unit.spec.tsx +++ b/frontend/src/metabase/admin/settings/components/Email/SMTPConnectionForm.unit.spec.tsx @@ -375,7 +375,7 @@ describe("SMTP connection form", () => { }); it("should enable test email button when all fields are set by environment variables (metabase#45445)", async () => { - const elements = defaultElements.map(el => ({ + const elements = defaultElements.map((el) => ({ ...el, is_env_setting: true, })); diff --git a/frontend/src/metabase/admin/settings/components/Email/SettingsEmailForm.tsx b/frontend/src/metabase/admin/settings/components/Email/SettingsEmailForm.tsx index 6336d005026..3e53f1ec119 100644 --- a/frontend/src/metabase/admin/settings/components/Email/SettingsEmailForm.tsx +++ b/frontend/src/metabase/admin/settings/components/Email/SettingsEmailForm.tsx @@ -42,7 +42,7 @@ export function SettingsEmailForm({ }, [dispatch, isHosted, isEmailConfigured]); const settingElements = elements.filter( - setting => !setting.getHidden?.(settingValues, derivedSettingValues), + (setting) => !setting.getHidden?.(settingValues, derivedSettingValues), ); return ( diff --git a/frontend/src/metabase/admin/settings/components/EmbeddingSettings/EmbeddingSdkLegaleseModal/EmbeddingSdkLegaleseModal.unit.spec.tsx b/frontend/src/metabase/admin/settings/components/EmbeddingSettings/EmbeddingSdkLegaleseModal/EmbeddingSdkLegaleseModal.unit.spec.tsx index 0ef2ac47a46..707d69f3784 100644 --- a/frontend/src/metabase/admin/settings/components/EmbeddingSettings/EmbeddingSdkLegaleseModal/EmbeddingSdkLegaleseModal.unit.spec.tsx +++ b/frontend/src/metabase/admin/settings/components/EmbeddingSettings/EmbeddingSdkLegaleseModal/EmbeddingSdkLegaleseModal.unit.spec.tsx @@ -11,7 +11,7 @@ const setup = () => { const updateSetting = jest .fn() .mockImplementation( - () => new Promise(resolve => setTimeout(resolve, MOCK_TIMEOUT)), + () => new Promise((resolve) => setTimeout(resolve, MOCK_TIMEOUT)), ); renderWithProviders( + const upgradeUrl = useSelector((state) => getUpgradeUrl(state, { utm_campaign: "embedding-sdk", utm_content: "embedding-sdk-admin", diff --git a/frontend/src/metabase/admin/settings/components/LicenseInput/LicenseInput.tsx b/frontend/src/metabase/admin/settings/components/LicenseInput/LicenseInput.tsx index 5be8f77c234..0bb7fa241ab 100644 --- a/frontend/src/metabase/admin/settings/components/LicenseInput/LicenseInput.tsx +++ b/frontend/src/metabase/admin/settings/components/LicenseInput/LicenseInput.tsx @@ -32,7 +32,7 @@ export const LicenseInput = ({ }: LicenseInputProps) => { const [value, setValue] = useState(token ?? ""); - const handleChange: InputProps["onChange"] = e => setValue(e.target.value); + const handleChange: InputProps["onChange"] = (e) => setValue(e.target.value); const handleActivate = () => { onUpdate(value); diff --git a/frontend/src/metabase/admin/settings/components/SettingsLdapForm.tsx b/frontend/src/metabase/admin/settings/components/SettingsLdapForm.tsx index 0fe6a6e6bd9..46564a3e36e 100644 --- a/frontend/src/metabase/admin/settings/components/SettingsLdapForm.tsx +++ b/frontend/src/metabase/admin/settings/components/SettingsLdapForm.tsx @@ -27,14 +27,14 @@ import type { SettingKey, Settings } from "metabase-types/api"; const testParentheses: TestConfig = { name: "test-parentheses", message: "Check your parentheses", - test: value => + test: (value) => (value?.match(/\(/g) || []).length === (value?.match(/\)/g) || []).length, }; const testPort: TestConfig = { name: "test-port", message: "That's not a valid port number", - test: value => Boolean((value || "").trim().match(/^\d*$/)), + test: (value) => Boolean((value || "").trim().match(/^\d*$/)), }; const LDAP_SCHEMA = Yup.object({ @@ -74,7 +74,7 @@ export const SettingsLdapFormView = ({ }, [elements]); const fields = useMemo(() => { - return _.mapObject(settings, setting => ({ + return _.mapObject(settings, (setting) => ({ name: setting.key, label: setting.display_name, description: setting.description, @@ -231,7 +231,7 @@ const getAttributeValues = ( defaultableAttrs: Set, ): LdapFormValues => { const attributeValues = Object.fromEntries( - ldapAttributes.map(key => [ + ldapAttributes.map((key) => [ key, defaultableAttrs.has(key) ? (values[key] ?? settings[key]?.default) diff --git a/frontend/src/metabase/admin/settings/components/SettingsLicense/SettingsLicense.styled.tsx b/frontend/src/metabase/admin/settings/components/SettingsLicense/SettingsLicense.styled.tsx index 3b55122b580..f70c64b06dd 100644 --- a/frontend/src/metabase/admin/settings/components/SettingsLicense/SettingsLicense.styled.tsx +++ b/frontend/src/metabase/admin/settings/components/SettingsLicense/SettingsLicense.styled.tsx @@ -32,7 +32,7 @@ export const ExplorePaidPlansContainer = styled.div props.justifyContent ?? "space-between"}; + justify-content: ${(props) => props.justifyContent ?? "space-between"}; border-bottom: 1px solid var(--mb-color-border); `; diff --git a/frontend/src/metabase/admin/settings/components/SettingsSetting.jsx b/frontend/src/metabase/admin/settings/components/SettingsSetting.jsx index 6fb03cffc1e..10a10c530bb 100644 --- a/frontend/src/metabase/admin/settings/components/SettingsSetting.jsx +++ b/frontend/src/metabase/admin/settings/components/SettingsSetting.jsx @@ -36,7 +36,7 @@ const SETTING_WIDGET_MAP = { hidden: () => null, }; -export const SettingsSetting = props => { +export const SettingsSetting = (props) => { const [fancyStyle, setFancyStyle] = useState({}); const thisRef = useRef(); diff --git a/frontend/src/metabase/admin/settings/components/UploadSettings/UploadSetting.styled.tsx b/frontend/src/metabase/admin/settings/components/UploadSettings/UploadSetting.styled.tsx index eee6d212607..1e272306cb0 100644 --- a/frontend/src/metabase/admin/settings/components/UploadSettings/UploadSetting.styled.tsx +++ b/frontend/src/metabase/admin/settings/components/UploadSettings/UploadSetting.styled.tsx @@ -12,7 +12,7 @@ export const SectionTitle = styled.h3` export const ColorText = styled.div<{ color: string }>` margin-top: 1rem; - color: ${props => color(props.color)}; + color: ${(props) => color(props.color)}; `; export const PaddedForm = styled.form` diff --git a/frontend/src/metabase/admin/settings/components/UploadSettings/UploadSettings.unit.spec.tsx b/frontend/src/metabase/admin/settings/components/UploadSettings/UploadSettings.unit.spec.tsx index 319c0990b61..3045f1706b5 100644 --- a/frontend/src/metabase/admin/settings/components/UploadSettings/UploadSettings.unit.spec.tsx +++ b/frontend/src/metabase/admin/settings/components/UploadSettings/UploadSettings.unit.spec.tsx @@ -74,7 +74,7 @@ function setup({ }); const metadata = getMetadata(state); - databases.forEach(db => { + databases.forEach((db) => { setupSchemaEndpoints(db); }); @@ -509,7 +509,7 @@ describe("Admin > Settings > UploadSetting", () => { }, }); updateSpy.mockImplementation( - () => new Promise(resolve => setTimeout(resolve, 500)), + () => new Promise((resolve) => setTimeout(resolve, 500)), ); const prefixInput = await screen.findByPlaceholderText("upload_"); @@ -537,7 +537,7 @@ describe("Admin > Settings > UploadSetting", () => { }, }); updateSpy.mockImplementation( - () => new Promise(resolve => setTimeout(resolve, 500)), + () => new Promise((resolve) => setTimeout(resolve, 500)), ); const prefixInput = await screen.findByPlaceholderText("upload_"); diff --git a/frontend/src/metabase/admin/settings/components/UploadSettings/UploadSettingsForm.tsx b/frontend/src/metabase/admin/settings/components/UploadSettings/UploadSettingsForm.tsx index b00644f2684..b1a33563ac8 100644 --- a/frontend/src/metabase/admin/settings/components/UploadSettings/UploadSettingsForm.tsx +++ b/frontend/src/metabase/admin/settings/components/UploadSettings/UploadSettingsForm.tsx @@ -159,7 +159,7 @@ export function UploadSettingsFormView({ const hasValidDatabases = databaseOptions.length > 0; const isH2db = Boolean( - dbId && databases.find(db => db.id === dbId)?.engine === "h2", + dbId && databases.find((db) => db.id === dbId)?.engine === "h2", ); const { @@ -227,7 +227,7 @@ export function UploadSettingsFormView({ { + onChange={(e) => { resetButtons(); setTablePrefix(e.target.value); }} diff --git a/frontend/src/metabase/admin/settings/components/UploadSettings/utils.ts b/frontend/src/metabase/admin/settings/components/UploadSettings/utils.ts index 3901048d0ec..a8068f08343 100644 --- a/frontend/src/metabase/admin/settings/components/UploadSettings/utils.ts +++ b/frontend/src/metabase/admin/settings/components/UploadSettings/utils.ts @@ -2,10 +2,10 @@ import type Database from "metabase-lib/v1/metadata/Database"; import type { SchemaName } from "metabase-types/api"; export const getDatabaseOptions = (databases: Database[]) => - databases.map(db => ({ name: db.name, value: db.id })); + databases.map((db) => ({ name: db.name, value: db.id })); export const getSchemaOptions = (schemas: SchemaName[]) => - schemas.map(schema => ({ name: schema, value: schema })); + schemas.map((schema) => ({ name: schema, value: schema })); export const dbHasSchema = (databases: Database[], dbId: number): boolean => !!databases diff --git a/frontend/src/metabase/admin/settings/components/UploadSettings/utils.unit.spec.ts b/frontend/src/metabase/admin/settings/components/UploadSettings/utils.unit.spec.ts index 684c09d9bab..3f77ea3e93d 100644 --- a/frontend/src/metabase/admin/settings/components/UploadSettings/utils.unit.spec.ts +++ b/frontend/src/metabase/admin/settings/components/UploadSettings/utils.unit.spec.ts @@ -60,7 +60,7 @@ describe("Admin > UploadSettings > utils", () => { describe("getSchemaOptions", () => { it("should return an array of schema", () => { - expect(getSchemaOptions(schemas.map(schema => schema.name))).toEqual([ + expect(getSchemaOptions(schemas.map((schema) => schema.name))).toEqual([ { name: "schema1", value: "schema1" }, { name: "schema2", value: "schema2" }, { name: "schema3", value: "schema3" }, diff --git a/frontend/src/metabase/admin/settings/components/widgets/AdminSettingInput.tsx b/frontend/src/metabase/admin/settings/components/widgets/AdminSettingInput.tsx index 562efcca537..52cce5a6290 100644 --- a/frontend/src/metabase/admin/settings/components/widgets/AdminSettingInput.tsx +++ b/frontend/src/metabase/admin/settings/components/widgets/AdminSettingInput.tsx @@ -75,7 +75,7 @@ export function AdminSettingInput({ if (newValue === initialValue) { return; } - updateSetting({ key: name, value: newValue }).then(response => { + updateSetting({ key: name, value: newValue }).then((response) => { if (response?.error) { const message = (response.error as GenericErrorResponse)?.message || @@ -151,7 +151,7 @@ export function BasicAdminSettingInput({ handleChange(e.target.checked)} + onChange={(e) => handleChange(e.target.checked)} label={localValue ? t`Enabled` : t`Disabled`} /> ); @@ -168,7 +168,7 @@ export function BasicAdminSettingInput({