From 811423a36cc28ea6623ffbf7779bd9fdde780e7a Mon Sep 17 00:00:00 2001 From: Filip Date: Fri, 22 Nov 2024 14:33:00 -0800 Subject: [PATCH] feat: new dashboard tile header (#1802) * feat: new dashboard tile header - introduce a header to dashboard tiles - render title and kebab menu for tile actions in this header - behind FF no need for major version upgrade * fix: component test * fix: tighten up gap in topn table * fix: show description in header in stead of kebab menu for golden signals and topn table * fix: one more style tweak * fix: style * fix: component test * fix: address comments * fix: component test * fix: address comments * fix: tweak styles * fix: comment --- .../src/components/AnalyticsChart.cy.ts | 63 +----- .../src/components/AnalyticsChart.vue | 163 +--------------- .../src/components/TopNTable.vue | 3 +- .../src/components/MetricCardContainer.vue | 2 +- .../sandbox/pages/RendererDemo.vue | 1 - .../sandbox/sandbox-query-provider.ts | 2 +- .../components/BaseAnalyticsChartRenderer.vue | 13 +- .../src/components/DashboardRenderer.cy.ts | 6 +- .../src/components/DashboardRenderer.vue | 7 +- .../src/components/DashboardTile.vue | 181 +++++++++++++++++- .../src/components/GoldenSignalsRenderer.vue | 14 +- .../src/components/QueryDataProvider.vue | 15 +- .../src/components/TopNTableRenderer.vue | 7 +- .../src/composables/index.ts | 2 + .../composables/useEvauluateFeatureFlag.ts | 19 ++ .../dashboard-renderer/src/locales/en.json | 7 +- 16 files changed, 266 insertions(+), 239 deletions(-) create mode 100644 packages/analytics/dashboard-renderer/src/composables/useEvauluateFeatureFlag.ts diff --git a/packages/analytics/analytics-chart/src/components/AnalyticsChart.cy.ts b/packages/analytics/analytics-chart/src/components/AnalyticsChart.cy.ts index 9cf34dff62..9c31074d7f 100644 --- a/packages/analytics/analytics-chart/src/components/AnalyticsChart.cy.ts +++ b/packages/analytics/analytics-chart/src/components/AnalyticsChart.cy.ts @@ -23,7 +23,7 @@ describe('', () => { beforeEach(() => { cy.viewport(1280, 800) cy.stub(composables, 'useEvaluateFeatureFlag').returns({ - evaluateFeatureFlag: () => true, + evaluateFeatureFlag: () => false, }) }) @@ -254,52 +254,6 @@ describe('', () => { chartTitle: 'Requests', }, }) - - cy.getTestId('chart-action-menu').should('not.exist') - }) - - it('renders the kebab menu with only the "Jump to Explore" link if no data is provided', () => { - cy.mount(AnalyticsChart, { - props: { - allowCsvExport: true, - goToExplore: 'https://cloud.konghq.tech/us/analytics/explorer', - chartData: emptyExploreResult, - chartOptions: { - type: 'timeseries_line', - }, - chartTitle: 'Requests', - }, - }) - - cy.getTestId('chart-action-menu').should('exist') - - // eslint-disable-next-line cypress/unsafe-to-chain-command - cy.getTestId('chart-action-menu').click().then(() => { - cy.getTestId('chart-jump-to-explore').should('exist') - cy.getTestId('csv-export-button').should('not.exist') - }) - }) - - it('does not render an "Export" link in the kebab actions if chart data is present but prop is set to `false`', () => { - cy.mount(AnalyticsChart, { - props: { - allowCsvExport: false, - goToExplore: 'https://cloud.konghq.tech/us/analytics/explorer', - chartData: exploreResult, - chartOptions: { - type: 'timeseries_line', - }, - chartTitle: 'Requests', - }, - }) - - cy.getTestId('chart-action-menu').should('exist') - - // eslint-disable-next-line cypress/unsafe-to-chain-command - cy.getTestId('chart-action-menu').click().then(() => { - cy.getTestId('chart-jump-to-explore').should('exist') - cy.getTestId('csv-export-modal').should('not.exist') - }) }) it('Renders an "Export" button, and tabulated data in the modal preview', () => { @@ -314,19 +268,10 @@ describe('', () => { }, }) - cy.getTestId('chart-action-menu').should('exist') - cy.get('.chart-header').trigger('mouseenter') - cy.getTestId('kebab-action-menu').should('be.visible') - - // eslint-disable-next-line cypress/unsafe-to-chain-command - cy.getTestId('kebab-action-menu').click().then(() => { - cy.getTestId('chart-jump-to-explore').should('not.exist') - - cy.getTestId('csv-export-button').click() - cy.getTestId('csv-export-modal').should('exist') - cy.get('.modal-content .vitals-table').should('exist') - }) + cy.getTestId('csv-export-button').click() + cy.getTestId('csv-export-modal').should('exist') + cy.get('.modal-content .vitals-table').should('exist') }) it('multi dimension bar charts have "tooltipContext"', () => { diff --git a/packages/analytics/analytics-chart/src/components/AnalyticsChart.vue b/packages/analytics/analytics-chart/src/components/AnalyticsChart.vue index b7ee3dbe52..676737b54b 100644 --- a/packages/analytics/analytics-chart/src/components/AnalyticsChart.vue +++ b/packages/analytics/analytics-chart/src/components/AnalyticsChart.vue @@ -1,11 +1,9 @@