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
a6f32306
Unverified
Commit
a6f32306
authored
7 years ago
by
Kyle Doherty
Browse files
Options
Downloads
Patches
Plain Diff
consolidate instrumentation logic, fix props validation
parent
464e806b
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/pulse/components/PulseCardPreview.jsx
+3
-3
3 additions, 3 deletions
frontend/src/metabase/pulse/components/PulseCardPreview.jsx
frontend/src/metabase/pulse/components/PulseEditCards.jsx
+15
-8
15 additions, 8 deletions
frontend/src/metabase/pulse/components/PulseEditCards.jsx
with
18 additions
and
11 deletions
frontend/src/metabase/pulse/components/PulseCardPreview.jsx
+
3
−
3
View file @
a6f32306
...
...
@@ -6,7 +6,6 @@ import PropTypes from "prop-types";
import
Icon
from
"
metabase/components/Icon.jsx
"
;
import
LoadingSpinner
from
"
metabase/components/LoadingSpinner.jsx
"
;
import
Tooltip
from
"
metabase/components/Tooltip.jsx
"
;
import
MetabaseAnalytics
from
"
metabase/lib/analytics
"
;
import
{
t
}
from
"
c-3po
"
;
import
cx
from
"
classnames
"
;
...
...
@@ -23,6 +22,7 @@ export default class PulseCardPreview extends Component {
onRemove
:
PropTypes
.
func
.
isRequired
,
fetchPulseCardPreview
:
PropTypes
.
func
.
isRequired
,
attachmentsEnabled
:
PropTypes
.
bool
,
trackPulseEvent
:
PropTypes
.
func
.
isRequired
};
componentWillMount
()
{
...
...
@@ -48,11 +48,11 @@ export default class PulseCardPreview extends Component {
if
(
this
.
hasAttachment
())
{
onChange
({
...
card
,
include_csv
:
false
,
include_xls
:
false
})
MetabaseAnalytics
.
trackEvent
((
this
.
props
.
pulseId
)
?
"
PulseEdit
"
:
"
PulseCreate
"
,
"
RemoveAttachment
"
)
;
this
.
props
.
trackPulseEvent
(
"
RemoveAttachment
"
)
}
else
{
onChange
({
...
card
,
include_csv
:
true
})
MetabaseAnalytics
.
trackEvent
((
this
.
props
.
pulseId
)
?
"
PulseEdit
"
:
"
PulseCreate
"
,
"
AddAttachment
"
,
'
csv
'
)
;
this
.
props
.
trackPulseEvent
(
"
AddAttachment
"
,
'
csv
'
)
}
}
...
...
This diff is collapsed.
Click to expand it.
frontend/src/metabase/pulse/components/PulseEditCards.jsx
+
15
−
8
View file @
a6f32306
...
...
@@ -38,10 +38,17 @@ export default class PulseEditCards extends Component {
});
}
trackPulseEvent
=
(
eventName
:
string
,
eventValue
:
string
)
=>
{
MetabaseAnalytics
.
trackEvent
(
(
this
.
props
.
pulseId
)
?
"
PulseEdit
"
:
"
PulseCreate
"
,
eventName
,
eventValue
);
}
addCard
(
index
,
cardId
)
{
this
.
setCard
(
index
,
{
id
:
cardId
})
MetabaseAnalytics
.
trackEvent
((
this
.
props
.
pulseId
)
?
"
PulseEdit
"
:
"
PulseCreate
"
,
"
AddCard
"
,
index
);
this
.
trackPulseEvent
(
"
AddCard
"
,
index
);
}
removeCard
(
index
)
{
...
...
@@ -51,7 +58,7 @@ export default class PulseEditCards extends Component {
cards
:
[...
pulse
.
cards
.
slice
(
0
,
index
),
...
pulse
.
cards
.
slice
(
index
+
1
)]
});
MetabaseAnalytics
.
trackEvent
((
this
.
props
.
pulseId
)
?
"
PulseEdit
"
:
"
PulseCreate
"
,
"
R
e
moveCard
"
,
index
);
this
.
trackPulseEvent
(
"
RmoveCard
"
,
index
);
}
getNotices
(
card
,
cardPreview
,
index
)
{
...
...
@@ -61,7 +68,7 @@ export default class PulseEditCards extends Component {
if
(
hasAttachment
)
{
notices
.
push
({
head
:
t
`Attachment`
,
body
:
<
AttachmentWidget
card
=
{
card
}
onChange
=
{
(
card
)
=>
this
.
setCard
(
index
,
card
)
}
index
=
{
index
}
pulseId
=
{
this
.
props
.
pulseId
}
/>
body
:
<
AttachmentWidget
card
=
{
card
}
onChange
=
{
(
card
)
=>
this
.
setCard
(
index
,
card
)
}
trackPulseEvent
=
{
this
.
trackPulseEvent
}
/>
});
}
if
(
cardPreview
)
{
...
...
@@ -128,13 +135,13 @@ export default class PulseEditCards extends Component {
<
span
className
=
"h3 text-bold mr1 mt2"
>
{
index
+
1
}
.
</
span
>
{
card
?
<
PulseCardPreview
pulseId
=
{
this
.
props
.
pulseId
}
card
=
{
card
}
cardPreview
=
{
cardPreviews
[
card
.
id
]
}
onChange
=
{
this
.
setCard
.
bind
(
this
,
index
)
}
onRemove
=
{
this
.
removeCard
.
bind
(
this
,
index
)
}
fetchPulseCardPreview
=
{
this
.
props
.
fetchPulseCardPreview
}
attachmentsEnabled
=
{
this
.
props
.
attachmentsEnabled
}
trackPulseEvent
=
{
this
.
trackPulseEvent
}
/>
:
<
CardPicker
...
...
@@ -156,7 +163,7 @@ export default class PulseEditCards extends Component {
const
ATTACHMENT_TYPES
=
[
"
csv
"
,
"
xls
"
];
const
AttachmentWidget
=
({
card
,
onChange
,
pulseId
})
=>
const
AttachmentWidget
=
({
card
,
onChange
,
trackPulseEvent
})
=>
<
div
>
{
ATTACHMENT_TYPES
.
map
(
type
=>
<
span
...
...
@@ -168,7 +175,7 @@ const AttachmentWidget = ({ card, onChange, pulseId }) =>
newCard
[
"
include_
"
+
attachmentType
]
=
type
===
attachmentType
;
}
MetabaseAnalytics
.
trackEvent
((
pulseId
)
?
"
PulseEdit
"
:
"
PulseCreate
"
,
"
AttachmentTypeChanged
"
,
type
);
trackPulseEvent
(
"
AttachmentTypeChanged
"
,
type
);
onChange
(
newCard
)
}
}
>
...
...
@@ -180,5 +187,5 @@ const AttachmentWidget = ({ card, onChange, pulseId }) =>
AttachmentWidget
.
propTypes
=
{
card
:
PropTypes
.
object
.
isRequired
,
onChange
:
PropTypes
.
func
.
isRequired
,
pulseId
:
PropTypes
.
number
trackPulseEvent
:
PropTypes
.
func
.
isRequired
}
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