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
cdba2a43
Commit
cdba2a43
authored
8 years ago
by
Cam Saül
Committed by
GitHub
8 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #2781 from metabase/fix-object-detail-for-pk-field
Fix object detail for PK field
parents
69cd19e0
24ba5ca0
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/lib/query_time.js
+8
-8
8 additions, 8 deletions
frontend/src/metabase/lib/query_time.js
frontend/src/metabase/query_builder/selectors.js
+4
-3
4 additions, 3 deletions
frontend/src/metabase/query_builder/selectors.js
with
12 additions
and
11 deletions
frontend/src/metabase/lib/query_time.js
+
8
−
8
View file @
cdba2a43
...
...
@@ -153,7 +153,7 @@ export function parseFieldBucketing(field, defaultUnit = null) {
if
(
Array
.
isArray
(
field
))
{
if
(
field
[
0
]
===
"
datetime_field
"
)
{
return
field
[
3
];
}
if
(
field
[
0
]
===
"
fk->
"
)
{
}
if
(
field
[
0
]
===
"
fk->
"
||
field
[
0
]
===
"
field-id
"
)
{
return
defaultUnit
;
}
else
{
console
.
warn
(
"
Unknown field format
"
,
field
);
...
...
@@ -163,15 +163,15 @@ export function parseFieldBucketing(field, defaultUnit = null) {
}
export
function
parseFieldTarget
(
field
)
{
if
(
Number
.
isInteger
(
field
))
return
field
;
if
(
Array
.
isArray
(
field
))
{
if
(
field
[
0
]
===
"
datetime_field
"
)
{
return
field
[
1
];
}
if
(
field
[
0
]
===
"
fk->
"
)
{
return
field
;
}
else
{
console
.
warn
(
"
Unknown field format
"
,
field
);
}
if
(
field
[
0
]
===
"
field-id
"
)
return
field
[
1
];
if
(
field
[
0
]
===
"
fk->
"
)
return
field
[
1
];
if
(
field
[
0
]
===
"
datetime_field
"
)
return
parseFieldTarget
(
field
[
1
]);
}
console
.
warn
(
"
Unknown field format
"
,
field
);
return
field
;
}
...
...
This diff is collapsed.
Click to expand it.
frontend/src/metabase/query_builder/selectors.js
+
4
−
3
View file @
cdba2a43
...
...
@@ -5,6 +5,7 @@ import _ from "underscore";
import
{
isCardDirty
}
from
"
metabase/lib/card
"
;
import
*
as
DataGrid
from
"
metabase/lib/data_grid
"
;
import
Query
from
"
metabase/lib/query
"
;
import
{
parseFieldTarget
}
from
"
metabase/lib/query_time
"
;
export
const
uiControls
=
state
=>
state
.
uiControls
;
...
...
@@ -32,7 +33,7 @@ export const tables = createSelector(
return
db
.
tables
;
}
}
return
[];
}
);
...
...
@@ -49,7 +50,7 @@ export const isObjectDetail = createSelector(
let
response
=
false
;
// NOTE: we specifically use only the query result here because we don't want the state of the
// NOTE: we specifically use only the query result here because we don't want the state of the
// visualization being shown (Object Details) to change as the query/card changes.
// "rows" type query w/ an '=' filter against the PK column
...
...
@@ -79,7 +80,7 @@ export const isObjectDetail = createSelector(
if
(
Array
.
isArray
(
filter
)
&&
filter
.
length
===
3
&&
filter
[
0
]
===
"
=
"
&&
filter
[
1
]
===
pkField
&&
parseFieldTarget
(
filter
[
1
]
)
===
pkField
&&
filter
[
2
]
!==
null
)
{
// well, all of our conditions have passed so we have an object detail query here
response
=
true
;
...
...
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