From c62cb1a337fbff9a3184b25f84c9346390c25797 Mon Sep 17 00:00:00 2001 From: Nikita Vorobev Date: Sun, 31 Mar 2024 16:38:34 +0100 Subject: [PATCH 1/4] fix: allow choose another dashboard template after pressing back --- frontend/src/scenes/dashboard/newDashboardLogic.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/frontend/src/scenes/dashboard/newDashboardLogic.ts b/frontend/src/scenes/dashboard/newDashboardLogic.ts index d63a829f5b0f6..264c4b5af135d 100644 --- a/frontend/src/scenes/dashboard/newDashboardLogic.ts +++ b/frontend/src/scenes/dashboard/newDashboardLogic.ts @@ -89,6 +89,7 @@ export const newDashboardLogic = kea([ hideNewDashboardModal: () => false, submitNewDashboardSuccess: () => false, submitNewDashboardFailure: () => false, + clearActiveDashboardTemplate: () => false, }, ], newDashboardModalVisible: [ From 4a8a991290769377100b3dda1a8410261a5ac984 Mon Sep 17 00:00:00 2001 From: Nikita Vorobev Date: Mon, 1 Apr 2024 13:38:52 +0100 Subject: [PATCH 2/4] add an e2e test --- cypress/e2e/dashboard.cy.ts | 34 +++++++++++++++++++ .../scenes/dashboard/NewDashboardModal.tsx | 1 + 2 files changed, 35 insertions(+) diff --git a/cypress/e2e/dashboard.cy.ts b/cypress/e2e/dashboard.cy.ts index ed3a92a465e04..ebcb5293c4ce0 100644 --- a/cypress/e2e/dashboard.cy.ts +++ b/cypress/e2e/dashboard.cy.ts @@ -100,6 +100,40 @@ describe('Dashboard', () => { cy.get('[data-attr^="breadcrumb-Dashboard:"]').should('have.text', TEST_DASHBOARD_NAME + 'UnnamedCancelSave') }) + const assertVariableConfigurationScreenIsShown = (): void => { + cy.get('[data-attr="new-dashboard-chooser"]').contains('Unique variable name').should('exist') + } + + it('Allow reselecting a dashboard after pressing back', () => { + cy.intercept('GET', /\/api\/projects\/\d+\/dashboard_templates/, (req) => { + req.reply((response) => { + response.body.results[0].variables = [ + { + id: 'id', + name: 'Unique variable name', + type: 'event', + default: {}, + required: true, + description: 'description', + }, + ] + return response + }) + }) + + // Request templates again. + cy.clickNavMenu('dashboards') + + cy.get('[data-attr="new-dashboard"]').click() + cy.get('[data-attr="create-dashboard-from-template"]').click() + assertVariableConfigurationScreenIsShown() + + cy.contains('.LemonButton', 'Back').click() + + cy.get('[data-attr="create-dashboard-from-template"]').click() + assertVariableConfigurationScreenIsShown() + }) + it('Click on a dashboard item dropdown and view graph', () => { cy.get('[data-attr=dashboard-name]').contains('Web Analytics').click() cy.get('.InsightCard [data-attr=more-button]').first().click() diff --git a/frontend/src/scenes/dashboard/NewDashboardModal.tsx b/frontend/src/scenes/dashboard/NewDashboardModal.tsx index 6c20019690db9..2d58b0cbe653d 100644 --- a/frontend/src/scenes/dashboard/NewDashboardModal.tsx +++ b/frontend/src/scenes/dashboard/NewDashboardModal.tsx @@ -34,6 +34,7 @@ export function NewDashboardModal(): JSX.Element { onClose={hideNewDashboardModal} isOpen={newDashboardModalVisible} title={activeDashboardTemplate ? 'Choose your events' : 'Create a dashboard'} + data-attr="new-dashboard-chooser" description={ activeDashboardTemplate ? (

From 0e4bb599c64c99bb6ca19e9565a839201faecebc Mon Sep 17 00:00:00 2001 From: Nikita Vorobev Date: Mon, 1 Apr 2024 13:47:42 +0100 Subject: [PATCH 3/4] renaming --- cypress/e2e/dashboard.cy.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cypress/e2e/dashboard.cy.ts b/cypress/e2e/dashboard.cy.ts index ebcb5293c4ce0..959aa5118fb80 100644 --- a/cypress/e2e/dashboard.cy.ts +++ b/cypress/e2e/dashboard.cy.ts @@ -100,7 +100,7 @@ describe('Dashboard', () => { cy.get('[data-attr^="breadcrumb-Dashboard:"]').should('have.text', TEST_DASHBOARD_NAME + 'UnnamedCancelSave') }) - const assertVariableConfigurationScreenIsShown = (): void => { + const assertVariablesConfigurationScreenIsShown = (): void => { cy.get('[data-attr="new-dashboard-chooser"]').contains('Unique variable name').should('exist') } @@ -126,12 +126,12 @@ describe('Dashboard', () => { cy.get('[data-attr="new-dashboard"]').click() cy.get('[data-attr="create-dashboard-from-template"]').click() - assertVariableConfigurationScreenIsShown() + assertVariablesConfigurationScreenIsShown() cy.contains('.LemonButton', 'Back').click() cy.get('[data-attr="create-dashboard-from-template"]').click() - assertVariableConfigurationScreenIsShown() + assertVariablesConfigurationScreenIsShown() }) it('Click on a dashboard item dropdown and view graph', () => { From 6d8089cef20980baf54e5b0413c5e9f46790ce4d Mon Sep 17 00:00:00 2001 From: Michael Matloka Date: Thu, 18 Apr 2024 00:29:05 +0200 Subject: [PATCH 4/4] Don't report back to PostHog on forks --- .github/workflows/ci-backend.yml | 1 + .github/workflows/ci-e2e.yml | 1 + .github/workflows/report-pr-age.yml | 1 + 3 files changed, 3 insertions(+) diff --git a/.github/workflows/ci-backend.yml b/.github/workflows/ci-backend.yml index 40a3c59e023c8..46efb8623edda 100644 --- a/.github/workflows/ci-backend.yml +++ b/.github/workflows/ci-backend.yml @@ -406,6 +406,7 @@ jobs: echo running_time_run_id=${run_id} >> $GITHUB_ENV echo running_time_run_started_at=${run_started_at} >> $GITHUB_ENV - name: Capture running time to PostHog + if: github.repository == 'PostHog/posthog' uses: PostHog/posthog-github-action@v0.1 with: posthog-token: ${{secrets.POSTHOG_API_TOKEN}} diff --git a/.github/workflows/ci-e2e.yml b/.github/workflows/ci-e2e.yml index 9322c51df37c5..7e992b04c6278 100644 --- a/.github/workflows/ci-e2e.yml +++ b/.github/workflows/ci-e2e.yml @@ -306,6 +306,7 @@ jobs: echo running_time_run_id=${run_id} >> $GITHUB_ENV echo running_time_run_started_at=${run_started_at} >> $GITHUB_ENV - name: Capture running time to PostHog + if: github.repository == 'PostHog/posthog' uses: PostHog/posthog-github-action@v0.1 with: posthog-token: ${{secrets.POSTHOG_API_TOKEN}} diff --git a/.github/workflows/report-pr-age.yml b/.github/workflows/report-pr-age.yml index 1e20ccfc8b687..4bee112c25ba2 100644 --- a/.github/workflows/report-pr-age.yml +++ b/.github/workflows/report-pr-age.yml @@ -23,6 +23,7 @@ jobs: echo is_revert=false >> $GITHUB_ENV fi - name: Capture PR age to PostHog + if: github.repository == 'PostHog/posthog' uses: PostHog/posthog-github-action@v0.1 with: posthog-token: ${{secrets.POSTHOG_API_TOKEN}}