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
33c29708
Unverified
Commit
33c29708
authored
5 years ago
by
Paul Rosenzweig
Committed by
GitHub
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Add message with link to docs for fields without any filter widgets (#10340)
parent
50718f76
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
frontend/src/metabase/query_builder/components/template_tags/TagEditorParam.jsx
+39
-23
39 additions, 23 deletions
...query_builder/components/template_tags/TagEditorParam.jsx
with
39 additions
and
23 deletions
frontend/src/metabase/query_builder/components/template_tags/TagEditorParam.jsx
+
39
−
23
View file @
33c29708
...
...
@@ -2,6 +2,7 @@ import React, { Component } from "react";
import
{
t
}
from
"
ttag
"
;
import
_
from
"
underscore
"
;
import
{
connect
}
from
"
react-redux
"
;
import
{
Link
}
from
"
react-router
"
;
import
Toggle
from
"
metabase/components/Toggle.jsx
"
;
import
InputBlurChange
from
"
metabase/components/InputBlurChange.jsx
"
;
...
...
@@ -17,6 +18,7 @@ import { fetchField } from "metabase/redux/metadata";
import
{
getMetadata
}
from
"
metabase/selectors/metadata
"
;
import
{
SchemaTableAndFieldDataSelector
}
from
"
metabase/query_builder/components/DataSelector
"
;
import
Metadata
from
"
metabase-lib/lib/metadata/Metadata
"
;
import
MetabaseSettings
from
"
metabase/lib/settings
"
;
import
type
{
FieldId
}
from
"
metabase/meta/types/Field
"
;
type
Props
=
{
...
...
@@ -106,7 +108,7 @@ export default class TagEditorParam extends Component {
render
()
{
const
{
tag
,
database
,
databases
,
metadata
}
=
this
.
props
;
let
widgetOptions
,
let
widgetOptions
=
[]
,
table
,
fieldMetadataLoaded
=
false
;
if
(
tag
.
type
===
"
dimension
"
&&
Array
.
isArray
(
tag
.
dimension
))
{
...
...
@@ -122,6 +124,7 @@ export default class TagEditorParam extends Component {
const
isDimension
=
tag
.
type
===
"
dimension
"
;
const
hasSelectedDimensionField
=
isDimension
&&
Array
.
isArray
(
tag
.
dimension
);
const
hasWidgetOptions
=
widgetOptions
&&
widgetOptions
.
length
>
0
;
return
(
<
div
className
=
"pb2 mb2 border-bottom border-dark"
>
<
h3
className
=
"pb2"
>
{
tag
.
name
}
</
h3
>
...
...
@@ -176,28 +179,41 @@ export default class TagEditorParam extends Component {
</
div
>
)
}
{
widgetOptions
&&
widgetOptions
.
length
>
0
&&
(
<
div
className
=
"pb1"
>
<
h5
className
=
"pb1 text-normal"
>
{
t
`Filter widget type`
}
</
h5
>
<
Select
className
=
"border-medium bg-white block"
value
=
{
tag
[
"
widget-type
"
]
}
onChange
=
{
e
=>
this
.
setParameterAttribute
(
"
widget-type
"
,
e
.
target
.
value
)
}
isInitiallyOpen
=
{
!
tag
[
"
widget-type
"
]
}
placeholder
=
{
t
`Select…`
}
>
{
[{
name
:
"
None
"
,
type
:
undefined
}]
.
concat
(
widgetOptions
)
.
map
(
widgetOption
=>
(
<
Option
key
=
{
widgetOption
.
type
}
value
=
{
widgetOption
.
type
}
>
{
widgetOption
.
name
}
</
Option
>
))
}
</
Select
>
</
div
>
)
}
<
div
className
=
"pb1"
>
<
h5
className
=
"pb1 text-normal"
>
{
t
`Filter widget type`
}
</
h5
>
<
Select
className
=
"border-med bg-white block"
value
=
{
tag
[
"
widget-type
"
]
}
onChange
=
{
e
=>
this
.
setParameterAttribute
(
"
widget-type
"
,
e
.
target
.
value
)
}
isInitiallyOpen
=
{
!
tag
[
"
widget-type
"
]
&&
hasWidgetOptions
}
placeholder
=
{
t
`Select…`
}
>
{
[{
name
:
"
None
"
,
type
:
undefined
}]
.
concat
(
widgetOptions
)
.
map
(
widgetOption
=>
(
<
Option
key
=
{
widgetOption
.
type
}
value
=
{
widgetOption
.
type
}
>
{
widgetOption
.
name
}
</
Option
>
))
}
</
Select
>
{
hasSelectedDimensionField
&&
!
hasWidgetOptions
&&
(
<
p
className
=
"pb1"
>
{
t
`There aren't any filter widgets for this type of field yet.`
}{
"
"
}
<
Link
to
=
{
MetabaseSettings
.
docsUrl
(
"
users-guide/13-sql-parameters
"
,
"
the-field-filter-variable-type
"
,
)
}
target
=
"_blank"
className
=
"link"
>
{
t
`Learn more`
}
</
Link
>
</
p
>
)
}
</
div
>
<
div
className
=
"flex align-center pb1"
>
<
h5
className
=
"text-normal mr1"
>
{
t
`Required?`
}
</
h5
>
...
...
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