Skip to content

Commit 79b143f

Browse files
author
Daniel Arrizza
committed
add headers
1 parent 28cd962 commit 79b143f

File tree

4 files changed

+44
-9
lines changed

4 files changed

+44
-9
lines changed

README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@ Create AppD dashboards at lightning speed with a query language
1212
## Development
1313

1414
### Features
15+
- [x] headers
1516
- [] default metric format strings
17+
- [] add a title
1618
- [] more than just bts
17-
- [] headers
1819
- [] CLI input
1920
- [] WHERE on a name/label
2021
- [] WHERE operators (>, <, REGEX, etc.)
@@ -35,6 +36,7 @@ Create AppD dashboards at lightning speed with a query language
3536
- [] table grid lines
3637
- [] electron app
3738
- [] preview dashboard before deploying
39+
- [] share dashboard formulas
3840

3941
### Helpful Links
4042

src/createColumn.js

+13-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export const createLabelColumn = ({ labelTexts, x }) => {
99
width: 300,
1010
height: 50,
1111
x,
12-
y: index * labelWidget.height,
12+
y: (index + 1) * labelWidget.height,
1313
textAlign: 'LEFT',
1414
}))
1515
return labels
@@ -27,10 +27,21 @@ export const createMetricColumn = ({ metricWidgetData, x }) => {
2727
}),
2828
width: 300,
2929
height: 50,
30-
y: index * labelWidget.height,
3130
x,
31+
y: (index + 1) * labelWidget.height,
3232
}
3333
}
3434
)
3535
return metrics
3636
}
37+
38+
export const createHeader = ({ labelText, x }) => ({
39+
...labelWidget,
40+
text: labelText,
41+
width: 300,
42+
height: 50,
43+
x: x * 300,
44+
y: 0,
45+
textAlign: 'LEFT',
46+
fontSize: 18,
47+
})

src/getColumnFromSelect.js

+26-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
import { createLabelColumn, createMetricColumn } from './createColumn'
1+
import {
2+
createLabelColumn,
3+
createMetricColumn,
4+
createHeader,
5+
} from './createColumn'
26
import { getApplicationFromWheres } from './queryParser'
37
import getMetricFromShortcut from './getMetricFromShortcut'
48

@@ -7,15 +11,27 @@ const LABEL_ENTITIES = ['bt', 'tier', 'backend']
711

812
export default ({ selects, selectIndex, data, wheres }) => {
913
const select = selects[selectIndex]
14+
debugger
15+
const header = createHeader({
16+
labelText: getMetricFromShortcut(select),
17+
x: selectIndex,
18+
})
19+
1020
if (LABEL_ENTITIES.includes(select)) {
1121
// create a label column
22+
1223
let labelTexts = []
1324
if (select === 'bt') {
1425
labelTexts = data.bt.map(({ name }) => name)
1526
}
16-
return createLabelColumn({ labelTexts, x: DEFAULT_WIDTH * selectIndex })
27+
28+
return [
29+
header,
30+
...createLabelColumn({ labelTexts, x: DEFAULT_WIDTH * selectIndex }),
31+
]
1732
} else {
1833
// create a metric column
34+
1935
const applicationName = getApplicationFromWheres({ wheres })
2036
const metric = getMetricFromShortcut(select)
2137
if (selects[0] === 'bt') {
@@ -24,10 +40,14 @@ export default ({ selects, selectIndex, data, wheres }) => {
2440
metricPath: `Business Transaction Performance|Business Transactions|${tierName}|${internalName}|${metric}`,
2541
entityName: tierName,
2642
}))
27-
return createMetricColumn({
28-
metricWidgetData,
29-
x: DEFAULT_WIDTH * selectIndex,
30-
})
43+
44+
return [
45+
header,
46+
...createMetricColumn({
47+
metricWidgetData,
48+
x: DEFAULT_WIDTH * selectIndex,
49+
}),
50+
]
3151
}
3252
}
3353
}

src/getMetricFromShortcut.js

+2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
const SHORTCUTS = [
2+
{ metric: 'Tier', shortcut: 'tier' },
3+
{ metric: 'Business Transaction', shortcut: 'bt' },
24
{ metric: 'Average Response Time (ms)', shortcut: 'art' },
35
{ metric: 'Calls per Minute', shortcut: 'cpm' },
46
{ metric: 'Errors per Minute', shortcut: 'epm' },

0 commit comments

Comments
 (0)