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
e8a68451
Commit
e8a68451
authored
10 years ago
by
Kyle Doherty
Browse files
Options
Downloads
Patches
Plain Diff
single filter working
parent
0c825fea
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
resources/frontend_client/app/card/card.controllers.js
+7
-8
7 additions, 8 deletions
resources/frontend_client/app/card/card.controllers.js
resources/frontend_client/app/react/query_builder.js
+31
-29
31 additions, 29 deletions
resources/frontend_client/app/react/query_builder.js
with
38 additions
and
37 deletions
resources/frontend_client/app/card/card.controllers.js
+
7
−
8
View file @
e8a68451
...
...
@@ -1381,12 +1381,9 @@ CardControllers.controller('CardDetailNew', [
$scope
.
model
.
card
.
dataset_query
.
query
.
aggregation
[
1
]
=
target
;
$scope
.
model
.
inform
();
},
updateFilter
:
function
(
value
,
filterIndex
,
listIndex
)
{
var
filters
=
$scope
.
model
.
card
.
dataset_query
.
query
.
filter
,
filterListIndex
=
listIndex
||
0
;
updateFilter
:
function
(
value
,
index
,
filterListIndex
)
{
var
filters
=
$scope
.
model
.
card
.
dataset_query
.
query
.
filter
console
.
log
(
filters
)
console
.
log
(
arguments
)
// check to see if we need to add another item for
/*
scope.addFilter = function() {
...
...
@@ -1418,8 +1415,12 @@ CardControllers.controller('CardDetailNew', [
return result;
};
*/
if
(
filterListIndex
)
{
filters
[
filterListIndex
][
index
]
=
value
}
else
{
filters
[
index
]
=
value
}
filters
[
filterListIndex
][
filterIndex
]
=
value
;
$scope
.
model
.
inform
();
},
removeFilter
:
function
(
index
)
{
...
...
@@ -1435,7 +1436,6 @@ CardControllers.controller('CardDetailNew', [
$scope
.
model
.
card
.
dataset_query
.
query
.
filter
=
[];
$scope
.
model
.
card
.
dataset_query
.
query
.
filter
.
push
(
'
AND
'
);
$scope
.
model
.
card
.
dataset_query
.
query
.
filter
.
push
(
newFilters
);
debugger
$scope
.
model
.
inform
();
}
else
if
(
filter
[
0
]
==
'
AND
'
){
pushFilterTemplate
(
filterLength
)
...
...
@@ -1446,7 +1446,6 @@ CardControllers.controller('CardDetailNew', [
}
function
pushFilterTemplate
(
index
)
{
console
.
log
(
'
index
'
,
index
)
if
(
index
)
{
filter
[
index
]
=
[
null
,
null
,
null
]
}
else
{
...
...
This diff is collapsed.
Click to expand it.
resources/frontend_client/app/react/query_builder.js
+
31
−
29
View file @
e8a68451
...
...
@@ -599,13 +599,36 @@ var FilterWidget = React.createClass({
// we always know the index will 2 for the value of a filter
this
.
props
.
updateFilter
(
value
,
2
,
index
)
},
_operatorList
:
function
(
open
)
{
return
(
<
div
className
=
"
FilterSection
"
>
<
SelectionModule
placeholder
=
"
...
"
items
=
{
this
.
props
.
operatorList
}
display
=
'
verbose_name
'
selectedValue
=
{
this
.
props
.
operator
}
selectedKey
=
'
name
'
index
=
{
0
}
isInitiallyOpen
=
{
open
}
parentIndex
=
{
this
.
props
.
index
}
action
=
{
this
.
props
.
updateFilter
}
/
>
<
/div
>
)
},
render
:
function
()
{
console
.
log
(
'
filter widget props
'
,
this
.
props
)
var
fieldListOpen
=
true
,
operatorList
,
operatorList
Html
,
canShowOperatorList
=
false
,
operatorListOpen
=
true
,
valueHtml
var
style
=
{
fill
:
'
#ddd
'
}
if
(
this
.
props
.
field
!=
null
)
{
fieldListOpen
=
false
,
canShowOperatorList
=
true
...
...
@@ -616,25 +639,7 @@ var FilterWidget = React.createClass({
}
if
(
canShowOperatorList
)
{
operatorList
=
(
<
div
className
=
"
FilterSection
"
>
<
SelectionModule
placeholder
=
"
...
"
items
=
{
this
.
props
.
operatorList
}
display
=
'
verbose_name
'
selectedValue
=
{
this
.
props
.
operator
}
selectedKey
=
'
name
'
index
=
{
0
}
isInitiallyOpen
=
{
operatorListOpen
}
parentIndex
=
{
this
.
props
.
index
}
action
=
{
this
.
props
.
updateFilter
}
/
>
<
/div
>
)
}
var
style
=
{
fill
:
'
#ddd
'
operatorListHtml
=
this
.
_operatorList
(
operatorListOpen
)
}
if
(
this
.
props
.
valueFields
)
{
...
...
@@ -715,7 +720,7 @@ var FilterWidget = React.createClass({
action
=
{
this
.
props
.
updateFilter
}
/
>
<
/div
>
{
operatorList
}
{
operatorList
Html
}
<
div
className
=
"
FilterSection
"
>
{
valueHtml
}
<
/div
>
...
...
@@ -770,9 +775,8 @@ var QueryBuilder = React.createClass({
value
=
filter
[
2
],
operatorList
=
[],
valueFields
var
filterFieldList
=
this
.
_getFilterFields
()
valueFields
,
filterFieldList
=
this
.
_getFilterFields
()
// extract the real info
for
(
var
fieldItem
in
filterFieldList
)
{
...
...
@@ -793,8 +797,6 @@ var QueryBuilder = React.createClass({
}
}
debugger
;
return
(
<
FilterWidget
placeholder
=
"
Item
"
...
...
@@ -820,15 +822,15 @@ var QueryBuilder = React.createClass({
var
filters
=
this
.
props
.
model
.
card
.
dataset_query
.
query
.
filter
// if we have filters...
if
(
filters
.
length
!=
0
)
{
// if we have multiple filters, map through and return a filter widget
// and if we have multiple filters, map through and return a filter widget
if
(
filters
[
0
]
==
'
AND
'
)
{
filterList
=
this
.
props
.
model
.
card
.
dataset_query
.
query
.
filter
.
map
(
function
(
filter
,
index
)
{
this
.
_getFilterWidget
(
filter
,
index
)
}.
bind
(
this
))
}
else
{
this
.
_getFilterWidget
(
filters
)
filterList
=
this
.
_getFilterWidget
(
filters
)
}
}
...
...
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