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
b8431c0a
Unverified
Commit
b8431c0a
authored
7 years ago
by
Kyle Doherty
Browse files
Options
Downloads
Patches
Plain Diff
use better identifier and add doc link
parent
6dde9781
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
frontend/src/metabase/query_builder/components/DataSelector.jsx
+11
-15
11 additions, 15 deletions
...nd/src/metabase/query_builder/components/DataSelector.jsx
with
11 additions
and
15 deletions
frontend/src/metabase/query_builder/components/DataSelector.jsx
+
11
−
15
View file @
b8431c0a
...
...
@@ -170,17 +170,13 @@ export default class DataSelector extends Component {
}
renderDatabaseSchemaPicker
()
{
const
{
selectedSchema
}
=
this
.
state
;
// for nested queries we want to present some different styling so we need
// a way to identify this "database"
// for now we use it's unique ID that the backend specifies
// TODO (@kdoh) - have a nice heart to heart with whoever chose this value
const
savedQuestionId
=
-
1337
const
{
databases
,
selectedSchema
}
=
this
.
state
;
let
sections
=
this
.
state
.
databases
let
sections
=
databases
.
filter
(
database
=>
database
.
id
!==
savedQuestionId
// filter out the saved questions "db" so we can present it
// differently
!
database
.
is_saved_questions
)
.
map
(
database
=>
({
name
:
database
.
name
,
...
...
@@ -189,13 +185,13 @@ export default class DataSelector extends Component {
// do the opposite of what we just did and get a reference to the saved question "db"
// there will only ever be one of these hence [0]
const
savedQuestionSection
=
this
.
state
.
databases
.
filter
(
db
=>
db
.
i
d
===
saved
Q
uestion
Id
)[
0
]
const
savedQuestionSection
=
databases
.
filter
(
db
=>
db
.
i
s_
saved
_q
uestion
s
)[
0
]
// some of the change functions need the index in the databases array
const
savedQuestionSectionIndex
=
this
.
state
.
databases
.
indexOf
(
savedQuestionSection
)
const
savedQuestionSectionIndex
=
databases
.
indexOf
(
savedQuestionSection
)
let
openSection
=
selectedSchema
&&
_
.
findIndex
(
this
.
state
.
databases
,
(
db
)
=>
_
.
find
(
db
.
schemas
,
selectedSchema
));
if
(
openSection
>=
0
&&
this
.
state
.
databases
[
openSection
]
&&
this
.
state
.
databases
[
openSection
].
schemas
.
length
===
1
)
{
let
openSection
=
selectedSchema
&&
_
.
findIndex
(
databases
,
(
db
)
=>
_
.
find
(
db
.
schemas
,
selectedSchema
));
if
(
openSection
>=
0
&&
databases
[
openSection
]
&&
databases
[
openSection
].
schemas
.
length
===
1
)
{
openSection
=
-
1
;
}
...
...
@@ -271,7 +267,7 @@ export default class DataSelector extends Component {
renderTablePicker
()
{
const
schema
=
this
.
state
.
selectedSchema
;
const
isSavedQuestionList
=
schema
.
database
.
i
d
===
-
1337
const
isSavedQuestionList
=
schema
.
database
.
i
s_saved_questions
;
const
hasMultipleDatabases
=
this
.
props
.
databases
.
length
>
1
;
const
hasMultipleSchemas
=
schema
&&
schema
.
database
&&
_
.
uniq
(
schema
.
database
.
tables
,
(
t
)
=>
t
.
schema
).
length
>
1
;
...
...
@@ -330,7 +326,7 @@ export default class DataSelector extends Component {
{
isSavedQuestionList
&&
(
<
div
className
=
"bg-slate-extra-light p2 text-centered"
>
Is a question missing?
<
a
href
=
""
className
=
"block link"
>
Learn more about nested queries
</
a
>
<
a
href
=
"
http://metabase.com/docs/users-guide/04-asking-questions.md#source-data
"
className
=
"block link"
>
Learn more about nested queries
</
a
>
</
div
>
)
}
</
div
>
...
...
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