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
b70f91ef
Commit
b70f91ef
authored
9 years ago
by
Tom Robinson
Browse files
Options
Downloads
Patches
Plain Diff
Bring direct manipulation prototype up to date
parent
22d7f87f
No related branches found
Branches containing commit
No related tags found
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
+6
-2
6 additions, 2 deletions
resources/frontend_client/app/card/card.controllers.js
resources/frontend_client/app/query_builder/visualization_table.react.js
+54
-3
54 additions, 3 deletions
...end_client/app/query_builder/visualization_table.react.js
with
60 additions
and
5 deletions
resources/frontend_client/app/card/card.controllers.js
+
6
−
2
View file @
b70f91ef
...
...
@@ -279,7 +279,7 @@ CardControllers.controller('CardDetail', [
return
false
;
}
},
cellClickedFn
:
function
(
rowIndex
,
columnIndex
)
{
cellClickedFn
:
function
(
rowIndex
,
columnIndex
,
filter
)
{
if
(
!
queryResult
)
return
false
;
// lookup the coldef and cell value of the cell we are taking action on
...
...
@@ -310,7 +310,11 @@ CardControllers.controller('CardDetail', [
// run it
runQuery
(
card
.
dataset_query
);
}
}
else
{
Query
.
addFilter
(
card
.
dataset_query
.
query
);
Query
.
updateFilter
(
card
.
dataset_query
.
query
,
card
.
dataset_query
.
query
.
filter
.
length
-
1
,
[
filter
,
coldef
.
id
,
value
]);
runQuery
(
card
.
dataset_query
);
}
},
followForeignKeyFn
:
function
(
fk
)
{
if
(
!
queryResult
||
!
fk
)
return
false
;
...
...
This diff is collapsed.
Click to expand it.
resources/frontend_client/app/query_builder/visualization_table.react.js
+
54
−
3
View file @
b70f91ef
...
...
@@ -3,6 +3,7 @@
import
FixedDataTable
from
'
fixed-data-table
'
;
import
Icon
from
'
./icon.react
'
;
import
Popover
from
'
./popover.react
'
;
var
cx
=
React
.
addons
.
classSet
;
var
Table
=
FixedDataTable
.
Table
;
...
...
@@ -34,7 +35,8 @@ export default React.createClass({
width
:
0
,
height
:
0
,
columnWidths
:
[],
colDefs
:
null
colDefs
:
null
,
popover
:
null
};
},
...
...
@@ -125,8 +127,32 @@ export default React.createClass({
this
.
props
.
cellClickedFn
(
rowIndex
,
columnIndex
);
},
popoverFilterClicked
:
function
(
rowIndex
,
columnIndex
,
operator
)
{
this
.
props
.
cellClickedFn
(
rowIndex
,
columnIndex
,
operator
);
this
.
setState
({
popover
:
null
});
},
rowGetter
:
function
(
rowIndex
)
{
return
this
.
props
.
data
.
rows
[
rowIndex
];
var
row
=
{
hasPopover
:
this
.
state
.
popover
&&
this
.
state
.
popover
.
rowIndex
===
rowIndex
||
false
};
for
(
var
i
=
0
;
i
<
this
.
props
.
data
.
rows
[
rowIndex
].
length
;
i
++
)
{
row
[
i
]
=
this
.
props
.
data
.
rows
[
rowIndex
][
i
];
}
return
row
;
},
showPopover
:
function
(
rowIndex
,
cellDataKey
)
{
this
.
setState
({
popover
:
{
rowIndex
:
rowIndex
,
cellDataKey
:
cellDataKey
}
});
},
handleClickOutside
:
function
()
{
this
.
setState
({
popover
:
null
});
},
cellRenderer
:
function
(
cellData
,
cellDataKey
,
rowData
,
rowIndex
,
columnData
,
width
)
{
...
...
@@ -137,7 +163,32 @@ export default React.createClass({
if
(
this
.
props
.
cellIsClickableFn
(
rowIndex
,
cellDataKey
))
{
return
(
<
a
key
=
{
key
}
className
=
"
link
"
href
=
"
#
"
onClick
=
{
this
.
cellClicked
.
bind
(
null
,
rowIndex
,
cellDataKey
)}
>
{
cellData
}
<
/a>
)
;
}
else
{
return
(
<
div
key
=
{
key
}
>
{
cellData
}
<
/div>
)
;
var
popover
=
null
;
if
(
this
.
state
.
popover
&&
this
.
state
.
popover
.
rowIndex
===
rowIndex
&&
this
.
state
.
popover
.
cellDataKey
===
cellDataKey
)
{
var
tetherOptions
=
{
targetAttachment
:
"
middle center
"
,
attachment
:
"
middle center
"
};
var
operators
=
[
"
<
"
,
"
=
"
,
"
≠
"
,
"
>
"
].
map
(
function
(
operator
)
{
return
(
<
li
key
=
{
operator
}
className
=
"
p2 text-brand-hover
"
onClick
=
{
this
.
popoverFilterClicked
.
bind
(
null
,
rowIndex
,
cellDataKey
,
operator
)}
>
{
operator
}
<
/li>
)
;
},
this
);
popover
=
(
<
Popover
tetherOptions
=
{
tetherOptions
}
handleClickOutside
=
{
this
.
handleClickOutside
}
>
<
div
className
=
"
bg-white bordered shadowed p1
"
>
<
ul
className
=
"
h1 flex align-center
"
>
{
operators
}
<
/ul
>
<
/div
>
<
/Popover
>
);
}
return
(
<
div
key
=
{
key
}
>
<
div
onClick
=
{
this
.
showPopover
.
bind
(
null
,
rowIndex
,
cellDataKey
)}
>
{
cellData
}
<
/div
>
{
popover
}
<
/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