-
Notifications
You must be signed in to change notification settings - Fork 14
No bubbles displayed if only start date exist. #92
Changes from 9 commits
7f87b07
aa514d6
9759d3b
a431e2a
47ed29e
a1ef2ee
07fcb0e
fdf9077
7e8ee67
81db318
49dc771
3154b41
54c811d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
/* global angular */ | ||
define(function (require) { | ||
require('ui/highlight/highlight_tags'); | ||
const _ = require('lodash'); | ||
|
@@ -235,18 +236,35 @@ define(function (require) { | |
const startValue = value; | ||
const startRawValue = startRawFieldValue[i]; | ||
|
||
const content = | ||
'<div title="index: ' + indexId + | ||
', startField: ' + params.startField + | ||
(params.endField ? ', endField: ' + params.endField : '') + | ||
'">' + labelValue + | ||
(params.useHighlight ? '<p class="tiny-txt">' + timelineHelper.pluckHighlights(hit, highlightTags) + | ||
'</p>' : '') + '</div>'; | ||
const itemDict = { | ||
indexId: indexId, | ||
startField: params.startField, | ||
endField: params.endField, | ||
labelValue: labelValue, | ||
useHighlight: params.useHighlight, | ||
highlight: timelineHelper.pluckHighlights(hit, highlightTags), | ||
groupColor: groupColor, | ||
startValue: startValue, | ||
endFieldValue: endFieldValue | ||
}; | ||
|
||
const content = timelineHelper.createItemTemplate(i, itemDict); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are you using "i" if not please remove There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, I do it in the template building method. But I'll look, maybe I can refactor. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I got rid of the |
||
|
||
let style = `background-color: ${groupColor}; color: #fff;`; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @szydan Seems I can't deprecate this |
||
if (!endFieldValue || startValue === endFieldValue[i]) { | ||
// here the end field value missing but expected | ||
// or start field value === end field value | ||
// force vis box look like vis point | ||
style = `border-style: none; background-color: #fff; color: ${groupColor}; border-color: ${groupColor}`; | ||
} | ||
|
||
let style = 'background-color: ' + groupColor + '; color: #fff;'; | ||
if (params.invertFirstLabelInstance && | ||
!_.includes(uniqueLabels, labelValue.toLowerCase().trim())) { | ||
style = 'background-color: #fff; color: ' + groupColor + ';'; | ||
if (!endFieldValue || startValue === endFieldValue[i]) { | ||
style = `border-style: solid; background-color: #fff; color: ${groupColor}; border-color: ${groupColor}`; | ||
} else { | ||
style = `background-color: #fff; color: ${groupColor};`; | ||
} | ||
uniqueLabels.push(labelValue.toLowerCase().trim()); | ||
} | ||
|
||
|
@@ -265,25 +283,16 @@ define(function (require) { | |
groupId: groupId | ||
}; | ||
|
||
if (params.endField) { | ||
if (!endFieldValue) { | ||
// here the end field value missing but expected | ||
// force the event to be of type point | ||
e.type = 'point'; | ||
} else { | ||
const endValue = endFieldValue[i]; | ||
const endRawValue = endRawFieldValue[i]; | ||
if (startValue === endValue) { | ||
// also force it to be a point | ||
e.type = 'point'; | ||
} else { | ||
e.type = 'range'; | ||
e.end = new Date(endRawValue); | ||
e.endField = { | ||
name: params.endField, | ||
value: endValue | ||
}; | ||
} | ||
if (endFieldValue && startValue !== endFieldValue[i]) { | ||
const endValue = endFieldValue[i]; | ||
const endRawValue = endRawFieldValue[i]; | ||
if (startValue !== endValue) { | ||
e.type = 'range'; | ||
e.end = new Date(endRawValue); | ||
e.endField = { | ||
name: params.endField, | ||
value: endValue | ||
}; | ||
} | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -184,6 +184,5 @@ define(function (require) { | |
removeVisStateChangedHandler(); | ||
}); | ||
} | ||
|
||
}); | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,16 @@ define(function (require) { | |
function TimelineHelper() { | ||
} | ||
|
||
TimelineHelper.prototype.createItemTemplate = function (i, itemDict) { | ||
return '<div title="index: ' + itemDict.indexId + ', startField: ' + itemDict.startField + | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. could you try using lodash template ? https://lodash.com/docs/3.10.1#template |
||
(itemDict.endField ? ', endField: ' + itemDict.endField : '') + '">' + | ||
(!itemDict.endFieldValue || itemDict.startValue === itemDict.endFieldValue[i] | ||
? '<div class="kibi-tl-dot-item" style="border-color:' + itemDict.groupColor + '"></div>' : '') + | ||
(!itemDict.endFieldValue || itemDict.startValue === itemDict.endFieldValue[i] | ||
? '<div class="kibi-tl-label-item">' + itemDict.labelValue + '</div>' : itemDict.labelValue) + | ||
(itemDict.useHighlight ? '<p class="tiny-txt">' + itemDict.highlight + '</p>' : '') + '</div>'; | ||
}; | ||
|
||
TimelineHelper.prototype.changeTimezone = function (timezone) { | ||
if (timezone !== 'Browser') { | ||
return moment().tz(timezone).format('Z'); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this needed ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It isn't needed anymore, I'll delete it.