function TimelineModel(timelineView, streamUtilities) { var mStreamUtilities = streamUtilities; var mNodesPerPage = timelineView.maxVisibleChangeNodes(); function timelinePageLeftListener() { this.pageLeft = function(streamNodes, mostRecentChange) { loadTimelineChanges(streamNodes, mostRecentChange) } } function sortChangelistByNumber(changeA, changeB) { return changeA.Change - changeB.Change; } function loadTimelineChanges(streamNodes, mostRecentChange) { var changelists = new Array(); var mostRecent = ''; if( mostRecentChange ) mostRecent = '@' + mostRecentChange + ' '; for(var i = 0; i < streamNodes.length; i++ ) { var streamNode = streamNodes[i]; var changes = mStreamUtilities.getChanges(mNodesPerPage, streamNode.stream.mStream, mostRecent); for(var j = 0; j < changes.size; j++) { var change = changes.data[j]; change.streamNode = streamNode; change.history = new Array(); mStreamUtilities.groomChangelist(change); changelists.push(change); } } changelists.sort(sortChangelistByNumber); for( var i = 0; i < changelists.length; i++ ) timelineView.addChange(changelists[i]); //console.log( 'number of changes: ' + changelists.length); timelineView.layoutNodes(mNodesPerPage); if( changelists.length > 0 ) loadTimelineChangeHistory(changelists); } function loadTimelineChangeHistory(changes) { for(var i = 0; i < changes.length; i++) { var doneLoadingHistory = changes.length - 1 == i; var changeList = changes[i]; var f = function(cl, cls, done) { return function(obj) { timelineChangeHistoryCallback(cl,cls,done,obj); } }; changeList.history = new Array(); mStreamUtilities.getChangeHistory(changeList.Change, f(changeList, changes, doneLoadingHistory)); } } function timelineChangeHistoryCallback(changeList, changes, doneLoading, history) { var changeHistory= history; var buf = ' '; for (var j = 0; j < changeHistory.size; j++) { var change = changeHistory.data[j]; if( change ) { mStreamUtilities.groomChangelist(change); change.stream = mStreamUtilities.streamFromDepotPath(change.path); changeList.history.push(change); buf += ' ' + change.Change; } } if( doneLoading ) { timelineView.assembleHistory(); timelineView.drawLinks(); timelineView.expandNames(); } } this.Load = function() { timelineView.addPageLeftListener(new timelinePageLeftListener()); loadTimelineChanges(timelineView.streamNodes); } }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 8081 | David George |
Initial submit of JavaScript StreamGraph. Main functionality is: Change Trajectory (Change Flow), Timeline, and GitStreams. |