-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Show a list of team member with placeholder recorded time * Update the tests * Sum total time * Show the total time on the server * Clear whitespace * Add a fix * Show the name of a role instead of slug * Send time in seconds instead of a string
- Loading branch information
Showing
7 changed files
with
285 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
orchestra/static/orchestra/team-info/team-info-card.directive.es6.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { reduce } from 'lodash' | ||
import template from './team-info-card.html' | ||
import moment from 'moment-timezone' | ||
|
||
export default function teamInfoCard (orchestraApi) { | ||
'ngAnnotate' | ||
return { | ||
template, | ||
restrict: 'E', | ||
scope: { | ||
projectId: '=' | ||
}, | ||
controllerAs: 'teamInfoCard', | ||
bindToController: true, | ||
controller: ($scope) => { | ||
const teamInfoCard = $scope.teamInfoCard | ||
orchestraApi.projectInformation(teamInfoCard.projectId) | ||
.then(response => { | ||
const {steps, tasks} = response.data | ||
const humanSteps = new Set(steps.filter(step => step.is_human).map(step => step.slug)) | ||
teamInfoCard.steps = reduce( | ||
Object.values(response.data.steps), (result, step) => { | ||
result[step.slug] = step | ||
return result | ||
}, {}) | ||
teamInfoCard.assignments = [] | ||
for (let stepSlug of humanSteps.values()) { | ||
const task = tasks[stepSlug] | ||
if (task) { | ||
teamInfoCard.assignments = teamInfoCard.assignments.concat(task.assignments.map(a => { | ||
return { | ||
role: teamInfoCard.steps[stepSlug].name, | ||
worker: a.worker, | ||
recordedTime: moment.duration(a.recorded_work_time, 'seconds').roundMinute().humanizeUnits() | ||
} | ||
})) | ||
} | ||
} | ||
}) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<section class="section-panel todo-list"> | ||
<div class="container-fluid"> | ||
<div class="row section-header"> | ||
<div class="col-lg-12 col-md-12 col-sm-12"> | ||
<h3> | ||
Team info | ||
</h3> | ||
</div> | ||
</div> | ||
<div class="row section-body"> | ||
<div class="col-lg-12 col-md-12 col-sm-12"> | ||
<table class="table table-striped"> | ||
<thead> | ||
<th>Role</th> | ||
<th>Username</th> | ||
<th>Name</th> | ||
<th>Recorded time spent</th> | ||
</thead> | ||
<tbody> | ||
<tr ng-repeat="assignment in teamInfoCard.assignments"> | ||
<td>{{assignment.role}}</td> | ||
<td>{{assignment.worker.username}}</td> | ||
<td>{{assignment.worker.first_name}} {{assignment.worker.last_name}}</td> | ||
<td>{{assignment.recordedTime}}</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
</div> | ||
</div> | ||
</div> | ||
</section> |
10 changes: 10 additions & 0 deletions
10
orchestra/static/orchestra/team-info/team-info.module.es6.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/* global angular */ | ||
|
||
import common from 'orchestra/common/common.module.es6.js' | ||
import teamInfoCard from 'orchestra/team-info/team-info-card.directive.es6.js' | ||
|
||
const name = 'orchestra.teamInfo' | ||
angular.module(name, ['ui.select', 'ngSanitize', common]) | ||
.directive('teamInfoCard', teamInfoCard) | ||
|
||
export default name |