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
cd6cec65
Unverified
Commit
cd6cec65
authored
5 years ago
by
Paul Rosenzweig
Committed by
GitHub
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
preload databases and tables in QB init (#12063)
parent
63916fa4
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
frontend/src/metabase/query_builder/actions.js
+5
-0
5 additions, 0 deletions
frontend/src/metabase/query_builder/actions.js
frontend/test/metabase/scenarios/question/query_builder_loading.cy.spec.js
+5
-7
5 additions, 7 deletions
...abase/scenarios/question/query_builder_loading.cy.spec.js
with
10 additions
and
7 deletions
frontend/src/metabase/query_builder/actions.js
+
5
−
0
View file @
cd6cec65
...
...
@@ -60,6 +60,7 @@ import { getCardAfterVisualizationClick } from "metabase/visualizations/lib/util
import
{
getPersistableDefaultSettingsForSeries
}
from
"
metabase/visualizations/lib/settings/visualization
"
;
import
Questions
from
"
metabase/entities/questions
"
;
import
Databases
from
"
metabase/entities/databases
"
;
import
{
getMetadata
}
from
"
metabase/selectors/metadata
"
;
import
{
setRequestUnloaded
}
from
"
metabase/redux/requests
"
;
...
...
@@ -298,6 +299,10 @@ export const initializeQB = (location, params) => {
dispatch
(
resetQB
());
dispatch
(
cancelQuery
());
// preload metadata that's used in DataSelector
dispatch
(
Databases
.
actions
.
fetchList
({
include
:
"
tables
"
}));
dispatch
(
Databases
.
actions
.
fetchList
({
saved
:
true
}));
const
{
currentUser
}
=
getState
();
let
card
,
originalCard
;
...
...
This diff is collapsed.
Click to expand it.
frontend/test/metabase/scenarios/question/query_builder_loading.cy.spec.js
+
5
−
7
View file @
cd6cec65
...
...
@@ -27,15 +27,14 @@ describe("query builder loading behavior", () => {
});
it
(
"
should incrementally load data if not preloaded
"
,
()
=>
{
// we visit the new question page but refresh after starting a simple
// question to wipe out the preloaded data.
cy
.
server
();
// stub out the preload call to fetch all tables
cy
.
route
({
url
:
"
/api/database?include=tables
"
,
response
:
[]
});
// let the other preload happen since it matches the actual call from the component
cy
.
route
({
url
:
"
/api/database?saved=true
"
}).
as
(
"
fetch1
"
);
cy
.
visit
(
"
/question/new
"
);
cy
.
contains
(
"
Simple question
"
).
click
();
cy
.
server
();
cy
.
reload
();
cy
.
route
({
url
:
"
/api/database?include=tables
"
}).
as
(
"
preload
"
);
cy
.
route
({
url
:
"
/api/database?saved=true
"
}).
as
(
"
fetch1
"
);
cy
.
route
({
url
:
"
/api/database/1/schemas
"
}).
as
(
"
fetch2
"
);
cy
.
route
({
url
:
"
/api/database/1/schema/PUBLIC
"
}).
as
(
"
fetch3
"
);
...
...
@@ -47,6 +46,5 @@ describe("query builder loading behavior", () => {
cy
.
get
(
"
@fetch1
"
).
should
(
"
exist
"
);
cy
.
get
(
"
@fetch2
"
).
should
(
"
exist
"
);
cy
.
get
(
"
@fetch3
"
).
should
(
"
exist
"
);
cy
.
get
(
"
@preload
"
).
should
(
"
not.exist
"
);
});
});
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