Author: smaisonneuve Date: 2015-04-30 15:22:38 +0000 (Thu, 30 Apr 2015) New Revision: 1310 Url: http://forge.nuiton.org/projects/sandbox/repository/revisions/1310 Log: [Wit] - Filter logs : add global activity summary Modified: wit/css/timeline.less wit/js/components/FilterLogs.js wit/js/components/Timeline.js wit/js/pages/Rapport.js Modified: wit/css/timeline.less =================================================================== --- wit/css/timeline.less 2015-04-30 14:17:16 UTC (rev 1309) +++ wit/css/timeline.less 2015-04-30 15:22:38 UTC (rev 1310) @@ -3,6 +3,8 @@ .timeline { + margin: 10px 0; + .sessions { display: flex; Modified: wit/js/components/FilterLogs.js =================================================================== --- wit/js/components/FilterLogs.js 2015-04-30 14:17:16 UTC (rev 1309) +++ wit/js/components/FilterLogs.js 2015-04-30 15:22:38 UTC (rev 1310) @@ -81,6 +81,10 @@ this.mail(content); }, + onShowSummary: function () { + React.findDOMNode(this.refs.summary).classList.toggle("hidden"); + }, + mail: function(content) { content = content.replace(/\n/g, "%0A").replace(/;/g, "%3B").replace(/-/g, "%2D"); var link = "mailto:?body=" + content; @@ -123,7 +127,7 @@ var data = {}, tags = {}; - currentState.data.forEach(function(log) { + currentState.data.result.forEach(function(log) { var date = moment(log.startDate).format("MM/DD/YY"); var diff = moment(moment(log.endDate).diff(log.startDate)).utcOffset(0); @@ -147,7 +151,7 @@ current.duration = current.diff.format("HH:mm:ss"); }); - this.setState({data: data, tags: currentState.tags || tags}); + this.setState({data: data, tags: currentState.tags || tags, startDate: currentState.data.startDate, endDate: currentState.data.endDate}); }, renderTd: function(date, tags, tagObject) { @@ -229,6 +233,9 @@ <button type="button" className="btn btn-primary" onClick={this.onMailTXT}> TXT <span className="glyphicon glyphicon-envelope" aria-hidden="true"></span> </button> + <button type="button" className="btn btn-primary" onClick={this.onShowSummary}> + View <span className="glyphicon glyphicon-triangle-bottom" aria-hidden="true"></span> + </button> </div> <div ref="filterTags" className="hidden" onChange={this.filterTag}> @@ -240,6 +247,10 @@ </div> {tags} </div> + + <div ref="summary" className="hidden"> + <Timeline data={this.state}/> + </div> <table className="table"> <thead> Modified: wit/js/components/Timeline.js =================================================================== --- wit/js/components/Timeline.js 2015-04-30 14:17:16 UTC (rev 1309) +++ wit/js/components/Timeline.js 2015-04-30 15:22:38 UTC (rev 1310) @@ -25,17 +25,19 @@ }, refresh: function (startDate, endDate) { - this.startDate = startDate; - this.endDate = endDate; + if (startDate && endDate) { + this.startDate = startDate; + this.endDate = endDate; - var self = this; - - user.getSessions(startDate, endDate, true) - .then(function (sessions) { - self.setState({ - sessions: sessions + var self = this; + + user.getSessions(startDate, endDate, true) + .then(function (sessions) { + self.setState({ + sessions: sessions + }); }); - }); + } }, render: function() { Modified: wit/js/pages/Rapport.js =================================================================== --- wit/js/pages/Rapport.js 2015-04-30 14:17:16 UTC (rev 1309) +++ wit/js/pages/Rapport.js 2015-04-30 15:22:38 UTC (rev 1310) @@ -23,8 +23,7 @@ return ( <div> <FilterBar onSearchResult={this.handleSearchResult}/> - <FilterLogs data={this.state.result}/> - <Timeline data={this.state}/> + <FilterLogs data={this.state}/> </div> ); }