DashList: Update variables in links when they change (#77787)

* user essentials mob! 🔱

lastFile:public/app/plugins/panel/dashlist/DashList.tsx

* DashList: Update variables in URL when they change

Co-authored-by: eledobleefe <laura.fernandez@grafana.com>
Co-authored-by: Joao Silva <joao.silva@grafana.com>
Co-authored-by: Ashley Harrison <ashley.harrison@grafana.com>

* add e2e test to check dashlist variables are always correctly passed

* add comment with link to issue

---------

Co-authored-by: Joao Silva <joao.silva@grafana.com>
Co-authored-by: eledobleefe <laura.fernandez@grafana.com>
Co-authored-by: Ashley Harrison <ashley.harrison@grafana.com>
Co-authored-by: joshhunt <josh@trtr.co>
This commit is contained in:
Josh Hunt
2023-11-08 14:04:30 +01:00
committed by GitHub
co-authored by eledobleefe Joao Silva Ashley Harrison joshhunt
parent e24fe96d90
commit 3e57eacc15
4 changed files with 215 additions and 2 deletions
+37
View File
@@ -0,0 +1,37 @@
import { e2e } from '../utils';
const PAGE_UNDER_TEST = 'a6801696-cc53-4196-b1f9-2403e3909185/panel-tests-dashlist-variables';
describe('DashList panel', () => {
beforeEach(() => {
e2e.flows.login(Cypress.env('USERNAME'), Cypress.env('PASSWORD'));
});
// this is to prevent the fix for https://github.com/grafana/grafana/issues/76800 from regressing
it('should pass current variable values correctly when `Include current template variable values` is set', () => {
e2e.flows.openDashboard({ uid: PAGE_UNDER_TEST });
// check the initial value of the urls contain the variable value correctly
e2e.components.Panels.Panel.title('Dashboard list panel')
.should('be.visible')
.within(() => {
cy.get('a').each(($el) => {
cy.wrap($el).should('have.attr', 'href').and('contain', 'var-query0=a');
});
});
// update variable to b
e2e.pages.Dashboard.SubMenu.submenuItemLabels('query0').click();
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('b').click();
// blur the dropdown
cy.get('body').click();
// check the urls are updated with the new variable value
e2e.components.Panels.Panel.title('Dashboard list panel')
.should('be.visible')
.within(() => {
cy.get('a').each(($el) => {
cy.wrap($el).should('have.attr', 'href').and('contain', 'var-query0=b');
});
});
});
});