Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Metabase
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Engineering Digital Service
Metabase
Commits
9614786f
Unverified
Commit
9614786f
authored
1 year ago
by
Alexander Polyankin
Committed by
GitHub
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
Fix navigating back to a dashboard with text cards (#31035)
parent
28b1789c
Loading
Loading
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
e2e/test/scenarios/dashboard/dashboard-drill.cy.spec.js
+47
-3
47 additions, 3 deletions
e2e/test/scenarios/dashboard/dashboard-drill.cy.spec.js
frontend/src/metabase/dashboard/actions/data-fetching.js
+12
-9
12 additions, 9 deletions
frontend/src/metabase/dashboard/actions/data-fetching.js
with
59 additions
and
12 deletions
e2e/test/scenarios/dashboard/dashboard-drill.cy.spec.js
+
47
−
3
View file @
9614786f
...
...
@@ -1053,6 +1053,7 @@ describe("scenarios > dashboard > dashboard drill", () => {
});
it
(
"
should preserve query results when navigating between the dashboard and the query builder
"
,
()
=>
{
addTextCardToDashboard
(
1
);
visitDashboard
(
1
);
cy
.
wait
(
"
@dashboard
"
);
cy
.
wait
(
"
@dashcardQuery
"
);
...
...
@@ -1067,12 +1068,17 @@ describe("scenarios > dashboard > dashboard drill", () => {
cy
.
findByLabelText
(
"
Back to Orders in a dashboard
"
).
click
();
});
getDashboardCard
().
within
(()
=>
{
getDashboardCard
(
0
).
within
(()
=>
{
cy
.
findByText
(
"
101.04
"
).
should
(
"
be.visible
"
);
// cached data
cy
.
get
(
"
@dashboard.all
"
).
should
(
"
have.length
"
,
1
);
cy
.
get
(
"
@dashcardQuery.all
"
).
should
(
"
have.length
"
,
1
);
});
getDashboardCard
(
1
).
within
(()
=>
{
cy
.
findByText
(
"
Text card
"
).
should
(
"
be.visible
"
);
// cached data
});
cy
.
get
(
"
@dashboard.all
"
).
should
(
"
have.length
"
,
1
);
cy
.
get
(
"
@dashcardQuery.all
"
).
should
(
"
have.length
"
,
1
);
appBar
().
within
(()
=>
{
cy
.
findByText
(
"
Our analytics
"
).
click
();
});
...
...
@@ -1211,3 +1217,41 @@ function drillThroughCardTitle(title) {
function
testPairedTooltipValues
(
val1
,
val2
)
{
cy
.
contains
(
val1
).
closest
(
"
td
"
).
siblings
(
"
td
"
).
findByText
(
val2
);
}
function
addTextCardToDashboard
(
dashboardId
)
{
cy
.
request
(
"
PUT
"
,
`/api/dashboard/
${
dashboardId
}
/cards`
,
{
cards
:
[
{
id
:
1
,
card_id
:
1
,
dashboard_id
:
dashboardId
,
row
:
0
,
col
:
0
,
size_x
:
8
,
size_y
:
8
,
visualization_settings
:
{},
},
{
id
:
-
1
,
card_id
:
null
,
dashboard_id
:
dashboardId
,
series
:
[],
col
:
8
,
row
:
0
,
size_x
:
4
,
size_y
:
4
,
parameter_mappings
:
[],
visualization_settings
:
{
virtual_card
:
{
name
:
null
,
display
:
"
text
"
,
visualization_settings
:
{},
dataset_query
:
{},
archived
:
false
,
},
text
:
"
Text card
"
,
},
},
],
});
}
This diff is collapsed.
Click to expand it.
frontend/src/metabase/dashboard/actions/data-fetching.js
+
12
−
9
View file @
9614786f
...
...
@@ -200,15 +200,18 @@ export const fetchDashboard = createThunkAction(
await
dispatch
(
loadMetadataForDashboard
(
result
.
ordered_cards
));
}
// copy over any virtual cards from the dashcard to the underlying card/question
result
.
ordered_cards
.
forEach
(
card
=>
{
if
(
card
.
visualization_settings
.
virtual_card
)
{
card
.
card
=
Object
.
assign
(
card
.
card
||
{},
card
.
visualization_settings
.
virtual_card
,
);
}
});
const
isUsingCachedResults
=
entities
!=
null
;
if
(
!
isUsingCachedResults
)
{
// copy over any virtual cards from the dashcard to the underlying card/question
result
.
ordered_cards
.
forEach
(
card
=>
{
if
(
card
.
visualization_settings
.
virtual_card
)
{
card
.
card
=
Object
.
assign
(
card
.
card
||
{},
card
.
visualization_settings
.
virtual_card
,
);
}
});
}
if
(
result
.
param_values
)
{
dispatch
(
addParamValues
(
result
.
param_values
));
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment