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
af0085b2
Unverified
Commit
af0085b2
authored
7 years ago
by
Tom Robinson
Browse files
Options
Downloads
Patches
Plain Diff
Fix clicking dashcard titles, and don't show lineage if cards are identical
parent
9513f7e6
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/meta/Card.js
+13
-1
13 additions, 1 deletion
frontend/src/metabase/meta/Card.js
frontend/src/metabase/query_builder/actions.js
+8
-3
8 additions, 3 deletions
frontend/src/metabase/query_builder/actions.js
with
21 additions
and
4 deletions
frontend/src/metabase/meta/Card.js
+
13
−
1
View file @
af0085b2
...
...
@@ -59,6 +59,14 @@ export function canRun(card: Card): bool {
}
}
export
function
cardIsEquivalent
(
cardA
:
Card
,
cardB
:
Card
):
boolean
{
cardA
=
updateIn
(
cardA
,
[
"
dataset_query
"
,
"
parameters
"
],
parameters
=>
parameters
||
[]);
cardB
=
updateIn
(
cardB
,
[
"
dataset_query
"
,
"
parameters
"
],
parameters
=>
parameters
||
[]);
cardA
=
_
.
pick
(
cardA
,
"
dataset_query
"
,
"
display
"
,
"
visualization_settings
"
);
cardB
=
_
.
pick
(
cardB
,
"
dataset_query
"
,
"
display
"
,
"
visualization_settings
"
);
return
_
.
isEqual
(
cardA
,
cardB
);
}
export
function
getQuery
(
card
:
Card
):
?
StructuredQuery
{
if
(
card
.
dataset_query
.
type
===
"
query
"
)
{
return
card
.
dataset_query
.
query
;
...
...
@@ -76,7 +84,7 @@ export function getTableMetadata(card: Card, metadata: Metadata): ?TableMetadata
}
export
function
getTemplateTags
(
card
:
?
Card
):
Array
<
TemplateTag
>
{
return
card
&&
card
.
dataset_query
.
type
===
"
native
"
&&
card
.
dataset_query
.
native
.
template_tags
?
return
card
&&
card
.
dataset_query
&&
card
.
dataset_query
.
type
===
"
native
"
&&
card
.
dataset_query
.
native
.
template_tags
?
Object
.
values
(
card
.
dataset_query
.
native
.
template_tags
)
:
[];
}
...
...
@@ -152,6 +160,10 @@ export function questionUrlWithParameters(
parameterValues
:
ParameterValues
=
{},
parameterMappings
:
ParameterMapping
[]
=
[]
):
DatasetQuery
{
if
(
!
card
.
dataset_query
)
{
return
Urls
.
question
(
card
.
id
);
}
card
=
Utils
.
copy
(
card
);
const
cardParameters
=
getParameters
(
card
);
...
...
This diff is collapsed.
Click to expand it.
frontend/src/metabase/query_builder/actions.js
+
8
−
3
View file @
af0085b2
...
...
@@ -17,7 +17,7 @@ import { isPK, isFK } from "metabase/lib/types";
import
Utils
from
"
metabase/lib/utils
"
;
import
{
getEngineNativeType
,
formatJsonQuery
}
from
"
metabase/lib/engine
"
;
import
{
defer
}
from
"
metabase/lib/promise
"
;
import
{
applyParameters
}
from
"
metabase/meta/Card
"
;
import
{
applyParameters
,
cardIsEquivalent
}
from
"
metabase/meta/Card
"
;
import
{
getParameters
,
getTableMetadata
,
getNativeDatabases
}
from
"
./selectors
"
;
import
{
getDatabases
,
getTables
,
getDatabasesList
}
from
"
metabase/selectors/metadata
"
;
...
...
@@ -171,8 +171,13 @@ export const initializeQB = createThunkAction(INITIALIZE_QB, (location, params)
}
else
if
(
card
.
id
)
{
// deserialized card contains the card id, so just populate originalCard
originalCard
=
await
loadCard
(
card
.
id
);
// strip the card id from the deserialized card so that we have a correct url and show lineage correctly
card
=
_
.
omit
(
card
,
"
id
"
);
// if the cards are equal then show the original
if
(
cardIsEquivalent
(
card
,
originalCard
))
{
card
=
Utils
.
copy
(
originalCard
);
}
else
{
// strip the card id from the deserialized card so that we have a correct url and show lineage correctly
card
=
_
.
omit
(
card
,
"
id
"
);
}
}
MetabaseAnalytics
.
trackEvent
(
"
QueryBuilder
"
,
"
Query Loaded
"
,
card
.
dataset_query
.
type
);
...
...
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