Skip to content
This repository has been archived by the owner on Nov 19, 2019. It is now read-only.

Logging Statements Added, js-Logger added #149

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"plugins": [
"transform-es3-property-literals",
"transform-es3-member-expression-literals",
"@babel/plugin-transform-runtime"
"@babel/plugin-transform-runtime",
["js-logger", {"variable" : "L"}]
]
}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ gen/
coverage/
package-lock.json
yarn.lock
.DS_Store
3 changes: 3 additions & 0 deletions lib/DataSet.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,8 @@ class DataSet {
if ('*' in this._subscribers) {
subscribers = subscribers.concat(this._subscribers['*']);
}
L.debug("Event: " + event + " params: " + params
+ " Sender: " + senderId);

for (let i = 0, len = subscribers.length; i < len; i++) {
const subscriber = subscribers[i];
Expand Down Expand Up @@ -269,6 +271,7 @@ class DataSet {
const props = { items: updatedIds, oldData, data: updatedData };
this._trigger('update', props, senderId);
}
L.debug('Ids updated ' + addedIds.concat(updatedIds) + " sender: " + senderId);

return addedIds.concat(updatedIds);
}
Expand Down
1 change: 1 addition & 0 deletions lib/logger-init.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require('js-logger').useDefaults();
17 changes: 17 additions & 0 deletions lib/timeline/component/Group.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class Group {
this.subgroupOrderer = data && data.subgroupOrder;
this.itemSet = itemSet;
this.isVisible = null;
this.visible = true;
this.stackDirty = true; // if true, items will be restacked on next redraw

if (data && data.nestedGroups) {
Expand Down Expand Up @@ -137,6 +138,11 @@ class Group {
} else {
content = data && data.content;
}
L.debug(this.groupId + ".setData: " + content);
L.debug(this.groupId + " being updated with data having props: ");
if (data) {
L.debug(Object.keys(data));
}

if (content instanceof Element) {
while (this.dom.inner.firstChild) {
Expand Down Expand Up @@ -177,6 +183,8 @@ class Group {
}
}



util.addClassName(this.dom.label, 'timeline-nesting-group');
var collapsedDirClassName = this.itemSet.options.rtl ? 'collapsed-rtl' : 'collapsed'
if (this.showNested) {
Expand Down Expand Up @@ -232,6 +240,13 @@ class Group {
util.addCssText(this.dom.label, data.style);
this.style = data.style;
}


if (this.visible == undefined){
L.debug("" + this.groupId + ".visible: was undefined");
this.visible = true;
}
L.debug("" + this.groupId + ".visible == " + this.visible);
}

/**
Expand Down Expand Up @@ -588,6 +603,7 @@ class Group {
* Show this group: attach to the DOM
*/
show() {
L.debug("Showing " + this.dom.label )
if (!this.dom.label.parentNode) {
this.itemSet.dom.labelSet.appendChild(this.dom.label);
}
Expand All @@ -610,6 +626,7 @@ class Group {
*/
hide() {
const label = this.dom.label;
L.debug("Hiding " + label )
if (label.parentNode) {
label.parentNode.removeChild(label);
}
Expand Down
21 changes: 19 additions & 2 deletions lib/timeline/component/ItemSet.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ class ItemSet extends Component {
if (!updatedNestedGroup) { return; }
updatedNestedGroup.nestedInGroup = groupData.id;
if (groupData.showNested == false) {
L.debug("Setting " + nestedGroupId + ".visible to false");
updatedNestedGroup.visible = false;
}
updatedGroups = updatedGroups.concat(updatedNestedGroup);
Expand Down Expand Up @@ -533,6 +534,7 @@ class ItemSet extends Component {
* Hide the component from the DOM
*/
hide() {
L.debug("ItemSet: calling hide on " + this);
// remove the frame containing the items
if (this.dom.frame.parentNode) {
this.dom.frame.parentNode.removeChild(this.dom.frame);
Expand All @@ -553,6 +555,7 @@ class ItemSet extends Component {
* Show the component in the DOM (when not already visible).
*/
show() {
L.debug("ItemSet: calling show on " + this);
// show frame containing the items
if (!this.dom.frame.parentNode) {
this.body.dom.center.appendChild(this.dom.frame);
Expand Down Expand Up @@ -951,6 +954,7 @@ class ItemSet extends Component {
setGroups(groups) {
const me = this;
let ids;
L.debug("setGroups called");

// unsubscribe from current dataset
if (this.groupsData) {
Expand Down Expand Up @@ -1183,6 +1187,7 @@ class ItemSet extends Component {
*/
_onAddGroups(ids) {
const me = this;
L.debug("Adding/Updating group ids: " + ids);

ids.forEach(id => {
const groupData = me.groupsData.get(id);
Expand Down Expand Up @@ -1255,15 +1260,22 @@ class ItemSet extends Component {
* @private
*/
_orderGroups() {
L.info("_orderGroups called");
if (this.groupsData) {
// reorder the groups
let groupIds = this.groupsData.getIds({
order: this.options.groupOrder
});
L.debug("_orderGroups, before _orderNestedGroups: this.groupsData.getIds == " + groupIds);
L.debug("_orderGroups, before _orderNestedGroups: this.groupIds == " + this.groupIds);

groupIds = this._orderNestedGroups(groupIds);


L.debug("_orderGroups, after _orderNestedGroups: this.groupsData.getIds == " + groupIds);
L.debug("_orderGroups, after _orderNestedGroups: this.groupIds == " + this.groupIds);

const changed = !util.equalArray(groupIds, this.groupIds);

if (changed) {
// hide all groups, removes them from the DOM
const groups = this.groups;
Expand Down Expand Up @@ -1830,12 +1842,17 @@ class ItemSet extends Component {
if (nestedGroup.visible == undefined) {
nestedGroup.visible = true;
}
L.debug(""+nestedGroup.id + ".visible was: " + nestedGroup.visible);
nestedGroup.visible = !!nestingGroup.showNested;
L.debug(""+nestedGroup.id + ".visible is: " + nestedGroup.visible);
return nestedGroup;
});

groupsData.update(nestedGroups.concat(nestingGroup));

L.debug("Nesting: " + Object.keys(nestingGroup));


// Handle styling of collapse/uncollapse tabs
if (nestingGroup.showNested) {
util.removeClassName(group.dom.label, 'collapsed');
util.addClassName(group.dom.label, 'expanded');
Expand Down
1 change: 1 addition & 0 deletions lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// first check if moment.js is already loaded in the browser window, if so,
// use this instance. Else, load via commonjs.

import './logger-init.js';

import moment from './module/moment';

Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"dependencies": {
"emitter-component": "^1.1.1",
"hammerjs": "^2.0.8",
"js-logger": "^1.6.0",
"keycharm": "^0.2.0",
"moment": "^2.18.1",
"propagating-hammerjs": "^1.4.6",
Expand All @@ -51,6 +52,7 @@
"async": "^2.5.0",
"babel-cli": "^6.26.0",
"babel-loader": "^8.0.5",
"babel-plugin-js-logger": "^1.0.17",
"babel-plugin-transform-es3-member-expression-literals": "^6.22.0",
"babel-plugin-transform-es3-property-literals": "^6.22.0",
"babelify": "^7.3.0",
Expand Down