Skip to content

Commit e56eb3e

Browse files
authored
Merge pull request #88 from back4app/analytics-report-event
Analytics report event
2 parents 9e3c095 + 5be7ae2 commit e56eb3e

File tree

8 files changed

+61
-10
lines changed

8 files changed

+61
-10
lines changed

src/components/ChromeDropdown/ChromeDropdown.react.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export default class ChromeDropdown extends React.Component {
1616
constructor() {
1717
super();
1818

19-
this.state = {
19+
this.state = {
2020
open: false,
2121
selected: false,
2222
};
@@ -44,7 +44,7 @@ export default class ChromeDropdown extends React.Component {
4444

4545
select(value, e) {
4646
e.stopPropagation();
47-
this.setState({
47+
this.setState({
4848
open: false,
4949
selected: true,
5050
}, () => {
@@ -56,6 +56,9 @@ export default class ChromeDropdown extends React.Component {
5656
let widthStyle = { width: this.props.width || 140 };
5757
let styles = this.styles;
5858
let color = this.props.color || 'purple';
59+
let isMultipleOptions = this.props.options.length > 1
60+
61+
let labelDivStyle = isMultipleOptions ? [styles.current, styles[color]] : [ styles.withoutArrow, styles.disabled, styles[color]]
5962

6063
let label = this.props.value;
6164
if (this.keyValueMap) {
@@ -66,7 +69,12 @@ export default class ChromeDropdown extends React.Component {
6669
label = this.props.placeholder;
6770
}
6871
let content = (
69-
<div className={[styles.current, styles[color]].join(' ')} onClick={() => this.setState({ open: true })}>
72+
<div
73+
className={labelDivStyle.join(' ')}
74+
onClick={() => {
75+
if (isMultipleOptions) this.setState({ open: true })
76+
}
77+
}>
7078
<div>{label}</div>
7179
</div>
7280
);

src/components/ChromeDropdown/ChromeDropdown.scss

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* the root directory of this source tree.
77
*/
88
@import 'stylesheets/globals.scss';
9-
9+
1010
.dropdown {
1111
display: inline-block;
1212
vertical-align: top;
@@ -47,6 +47,21 @@
4747
}
4848
}
4949

50+
51+
.withoutArrow {
52+
position: relative;
53+
height: 30px;
54+
line-height: 30px;
55+
padding: 0 30px 0 10px;
56+
background: $darkBlue;
57+
border-radius: 5px;
58+
59+
div {
60+
overflow-x: hidden;
61+
text-overflow: ellipsis;
62+
}
63+
}
64+
5065
.menu {
5166
max-height: 360px;
5267
overflow-y: auto;
@@ -62,3 +77,8 @@
6277
}
6378
}
6479
}
80+
81+
.disabled {
82+
pointer-events: none;
83+
opacity: .65;
84+
}

src/components/ExplorerActiveChartButton/ExplorerActiveChartButton.react.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ export default class ExplorerActiveChartButton extends React.Component {
8383
align = Directions.RIGHT;
8484
}
8585
// Add the button height to the picker appear on the bottom
86-
position.y += this.node.clientHeight
86+
position.y += this.node.clientHeight - window.pageYOffset
8787
this.setState({
8888
open: !this.state.open,
8989
position,

src/components/ExplorerMenuButton/ExplorerMenuButton.react.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ export default class ExplorerMenuButton extends React.Component {
6868
align = Directions.RIGHT;
6969
}
7070
// Add the button height to the picker appear on the bottom
71-
position.y += this.node.clientHeight
71+
position.y += this.node.clientHeight - window.pageYOffset
7272
return {
7373
currentView: 'picker',
7474
position,

src/components/ExplorerQueryComposer/ExplorerQueryComposer.react.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,13 @@ const FIELD_LABELS = {
5050
]
5151
};
5252

53+
const FILTER_LABELS = {
54+
'Custom Event': [
55+
'Event Name',
56+
'Dimensions'
57+
]
58+
};
59+
5360
const AGGREGATE_TYPE_LABELS = [
5461
'Count' /*, 'Count Distinct', 'Sum', 'Minimum', 'Median', '99th Percentile', 'Average'
5562
*/];
@@ -255,7 +262,7 @@ export default class ExplorerQueryComposer extends React.Component {
255262
this.setState({
256263
filters: this.state.filters.concat([{
257264
op: '$eq',
258-
col: FIELD_LABELS[this.state.source][0],
265+
col: FILTER_LABELS[this.state.source][0],
259266
val: null,
260267
key: null // used to filter dimensions properties
261268
}])
@@ -396,6 +403,7 @@ export default class ExplorerQueryComposer extends React.Component {
396403
<input
397404
className={[styles.formInput, styles.filterInputStyle].join(' ')}
398405
value={filter.key}
406+
placeholder={'key'}
399407
onChange={(e) => {
400408
let filters = this.state.filters;
401409
let newFilter = null;
@@ -413,6 +421,7 @@ export default class ExplorerQueryComposer extends React.Component {
413421
<input
414422
className={[styles.formInput, styles.filterInputStyle].join(' ')}
415423
value={filter.val}
424+
placeholder={'value'}
416425
onChange={(e) => {
417426
let filters = this.state.filters;
418427
filters[index] = {
@@ -466,7 +475,7 @@ export default class ExplorerQueryComposer extends React.Component {
466475
width='33%'
467476
color='blue'
468477
value={filter.col}
469-
options={FIELD_LABELS[this.state.source]}
478+
options={FILTER_LABELS[this.state.source]}
470479
onChange={(val) => {
471480
let filters = this.state.filters;
472481
filters[index] = {

src/components/ExplorerQueryComposer/ExplorerQueryComposer.scss

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ $placeholderColor: rgba(255, 255, 255, 0.5);
5353

5454
&.textInput {
5555
background: none;
56-
border: none;
56+
border: none;
5757
font-size: 1.3em;
5858
color: white;
5959

@@ -150,4 +150,8 @@ $placeholderColor: rgba(255, 255, 255, 0.5);
150150
border-radius: 5px;
151151
padding: 0 30px 0 10px;
152152
overflow: hidden;
153+
154+
@include placeholder {
155+
color: $placeholderColor;
156+
}
153157
}

src/dashboard/Analytics/Explorer/Explorer.react.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,7 @@ export default class Explorer extends DashboardView {
356356
<a
357357
href='javascript:;'
358358
role='button'
359+
onClick={() => window.open('https://www.back4app.com/docs/analytics/mobile-app-analytics', '_blank') }
359360
className={styles.toolbarAction}
360361
style={{ borderRight: '1px solid #66637a' }}>
361362
<Icon name='question-solid' width={14} height={14} fill='#66637a' />
@@ -474,6 +475,15 @@ export default class Explorer extends DashboardView {
474475
formatter={(value, label) => (`${label} ${prettyNumber(value, 3)}`)} />
475476
);
476477
}
478+
else if (!this.state.mutated)
479+
currentDisplay = (
480+
<EmptyState
481+
title={'No data to display.'}
482+
icon='analytics-outline'
483+
description={'These queries didn\'t retrieve any result.'}
484+
cta='Get started with Analytics Explorer'
485+
action={() => window.open('https://www.back4app.com/docs/analytics/mobile-app-analytics', '_blank') } />
486+
);
477487
break;
478488
case 'table':
479489
// Render table

src/dashboard/Analytics/SlowQueries/SlowQueries.react.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ export default class SlowQueries extends TableView {
240240
description={'You haven\'t executed any queries.'}
241241
icon='gears'
242242
cta='Get started with Query'
243-
action={() => window.location = 'http://docs.parseplatform.org/rest/guide/#queries'} />
243+
action={() => window.open('https://www.back4app.com/docs/analytics/slow-query-tool', '_blank') } />
244244
);
245245
}
246246

0 commit comments

Comments
 (0)