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
56469a29
Unverified
Commit
56469a29
authored
11 months ago
by
Alexander Polyankin
Committed by
GitHub
11 months ago
Browse files
Options
Downloads
Patches
Plain Diff
Fix loading metadata for models (#41074)
parent
c8bbe471
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/containers/test-utils.tsx
+2
-0
2 additions, 0 deletions
...tend/src/metabase/query_builder/containers/test-utils.tsx
frontend/src/metabase/questions/actions.ts
+9
-3
9 additions, 3 deletions
frontend/src/metabase/questions/actions.ts
with
11 additions
and
3 deletions
frontend/src/metabase/query_builder/containers/test-utils.tsx
+
2
−
0
View file @
56469a29
...
...
@@ -285,6 +285,8 @@ export const setup = async ({
},
);
await
waitForLoadingRequests
(
getState
);
await
waitForLoaderToBeRemoved
();
await
waitForLoadingRequests
(
getState
);
return
{
...
...
This diff is collapsed.
Click to expand it.
frontend/src/metabase/questions/actions.ts
+
9
−
3
View file @
56469a29
...
...
@@ -2,6 +2,7 @@ import { loadMetadataForDependentItems } from "metabase/redux/metadata";
import
{
getMetadata
}
from
"
metabase/selectors/metadata
"
;
import
*
as
Lib
from
"
metabase-lib
"
;
import
Question
from
"
metabase-lib/v1/Question
"
;
import
{
getQuestionVirtualTableId
}
from
"
metabase-lib/v1/metadata/utils/saved-questions
"
;
import
type
{
Card
}
from
"
metabase-types/api
"
;
import
type
{
Dispatch
,
GetState
}
from
"
metabase-types/store
"
;
...
...
@@ -13,11 +14,16 @@ export const loadMetadataForCard =
(
card
:
Card
,
options
?:
LoadMetadataOptions
)
=>
async
(
dispatch
:
Dispatch
,
getState
:
GetState
)
=>
{
const
question
=
new
Question
(
card
,
getMetadata
(
getState
()));
const
dependencies
=
Lib
.
dependentMetadata
(
question
.
query
());
const
loadAdhocMetadata
=
question
.
isSaved
()
&&
question
.
type
()
!==
"
question
"
;
const
dependencies
=
[...
Lib
.
dependentMetadata
(
question
.
query
())];
if
(
loadAdhocMetadata
)
{
const
tableId
=
getQuestionVirtualTableId
(
question
.
id
());
dependencies
.
push
({
id
:
tableId
,
type
:
"
table
"
});
}
await
dispatch
(
loadMetadataForDependentItems
(
dependencies
,
options
));
// metadata for an ad-hoc question based on this question
if
(
question
.
isSaved
()
&&
question
.
type
()
!==
"
question
"
)
{
if
(
loadAdhocMetadata
)
{
const
questionWithMetadata
=
new
Question
(
card
,
getMetadata
(
getState
()));
const
adhocQuestion
=
questionWithMetadata
.
composeQuestionAdhoc
();
const
adhocDependencies
=
Lib
.
dependentMetadata
(
adhocQuestion
.
query
());
...
...
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