Skip to content

Commit

Permalink
add bug status setting
Browse files Browse the repository at this point in the history
  • Loading branch information
okunishinishi committed Dec 30, 2012
1 parent 0241f1e commit d9d4eb8
Show file tree
Hide file tree
Showing 19 changed files with 232 additions and 77 deletions.
37 changes: 27 additions & 10 deletions agent/agn.redmine.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,37 @@ RedmineAgent.prototype.getIssue = function (condition, callback) {
url = conf.url.base + '/issues.json',
query = new RedmineAgent.Query(condition).toQueryString();
s.get([url, query].join('?'), function (res, body) {
console.log('body', body);
var json = {};//TODO
var json = JSON.parse(body);
callback.call(s, true, json);
});
};

RedmineAgent.prototype.issue_statuses = function(callback){
var s = this,
url = conf.url.base + '/issue_statuses';
s.get(url, function(res, body, $){
try{
var data = [];
$('#content').find('table.list').find('tbody').find('tr').each(function(){
var tr = $(this);
var a = tr.find('a');
var id = a.eq(0).attr('href')
.replace('/redmine/issue_statuses/edit/', '');
data.push({
id:id,
name:a.eq(0).text(),
closed:!!tr.find('td').eq(2).find('img').length
});
});
callback && callback.call(s, true, data);
} catch(e){
console.error(e);
callback && callback.call(s, false);
}

});
};

RedmineAgent.prototype.getProjects = function (callback) {
var s = this,
url = conf.url.base + '/projects.xml';
Expand Down Expand Up @@ -140,11 +165,3 @@ RedmineAgent.prototype.getVersions = function (project_identifier, callback) {
});
};

//
//new RedmineAgent().login(conf.admin, function () {
// var s = this;
// s.getVersions('project00', function (success, data) {
// console.log(success, data);
// });
//
//});
5 changes: 3 additions & 2 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,16 @@ app.configure('development', function () {
app.post('/remove_team', r.team.remove);
app.post('/update_team/redmine_projects', r.team.update.redmine_projects);

app.get('/sprint/issue_count', r.sprint.issue_count);
app.get('/sprint/task_time', r.sprint.task_time);
app.get('/sprint/count_bugs', r.sprint.count_bugs);
app.get('/sprint/get_task_times', r.sprint.task_time);
app.post('/sprint/new', r.sprint.new);
app.post('/sprint/update', r.sprint.update);
app.post('/sprint/update_keep_in_mind', r.sprint.update_keep_in_mind);
app.post('/sprint/remove', r.sprint.remove);

app.get('/setting/get_redmine_projects', r.setting.getRedmineProjects);
app.get('/setting/get_redmine_versions', r.setting.getRedmineVersions);
app.get('/setting/get_issue_statuses', r.setting.getIssueStatuses);


})(require('./routes'));
Expand Down
13 changes: 10 additions & 3 deletions msg/msg.label.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ exports = module.exports = {
teams:'select your team'
},
daily:{
issues:'issues',
bugs:'bugs',
tasks:'task time',
grouping:'grouping',
events:'events',
Expand All @@ -24,7 +24,7 @@ exports = module.exports = {
remain:'remain',
consumed:'consumed'
},
issue_count:{
bug_count:{
total:'total',
modified:'modified',
done:'done'
Expand All @@ -37,7 +37,13 @@ exports = module.exports = {
teams:'teams',
sprints:'sprints',
redmine:'redmine',
redmine_projects:'projects',
redmine_projects:'proceeding projects',
redmine_projects_lead:'Select projects proceeded by this team.',
redmine_bug_status:'bug status',
redmine_bug_status_table:{
issue_status:'issue status',
report_as:'report as'
},
members:'members',
sprint:{
caption_new:'new sprint',
Expand All @@ -46,5 +52,6 @@ exports = module.exports = {
duration:'duration',
redmine_sprint:'redmine sprint'
}

}
};
1 change: 0 additions & 1 deletion public/javascripts/jquery.rate-circle.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@
startAngle + PI * 2 * s.rate * s.step.getRate(),
false);
ctx.stroke();
console.log('s.step.getRate()', s.step.getRate());
};
var Root = function (radius, rate) {
var s = this;
Expand Down
46 changes: 22 additions & 24 deletions public/javascripts/view.daily.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,44 +44,42 @@
});
return display;
},
issueSection:function (sprint) {
bugsSection:function (sprint) {
var section = $(this),
doneRate = $('#issue-done-rate', section),
rateCircle = $('#issue-done-rate-circle', section);
doneRate = $('#bug-done-rate', section),
rateCircle = $('#bug-done-rate-circle', section);

sprint = true;//TODO remove
if (sprint) {
var data = {sprint_id:sprint};
$.getJSON('/sprint/issue_count', data, function (data) {
if (!data.success) {
console.error('failed to get issue_count');
return;
}
section.dataDisplay(data);
var rate = data.done / data.total;
doneRate.text((rate * 100).toFixed(1))
if (!sprint) return section;

rateCircle.rateCircle(rate);
});
}
var data = {sprint:sprint};
$.getJSON('/sprint/count_bugs', data, function (data) {
if (!data.success) {
console.error('failed to get bug_count');
return;
}
section.dataDisplay(data);
var rate = data.done / data.total;
doneRate.text((rate * 100).toFixed(1));

rateCircle.rateCircle(rate);
});
return section;
},
taskSection:function (sprint) {
var section = $(this),
doneRate = $('#task-done-rate', section),
rateCircle = $('#task-done-rate-circle', section);

sprint = true; //TODO remove
if (sprint) {
var data = {sprint_id:sprint};
$.getJSON('/sprint/task_time', data, function (data) {
var data = {sprint:sprint};
$.getJSON('/sprint/get_task_times', data, function (data) {
if (!data.success) {
console.error('failed to get task time');
return;
}
section.dataDisplay(data);
var rate = (data.estimated - data.remain) / data.estimated;
doneRate.text((rate * 100).toFixed(1))
doneRate.text((rate * 100).toFixed(1));

rateCircle.rateCircle(rate);
});
Expand Down Expand Up @@ -191,7 +189,7 @@
}

(function (members) {
var tmpl = Handlebars.templates['tmple.grouping-roulette-item'];
var tmpl = Handlebars.templates['tmpl.grouping-roulette-item'];
$('.grouping-group', roulette).remove();
var group = newGroup();
if (members && members.length) {
Expand Down Expand Up @@ -310,8 +308,8 @@
$('#head-nav', body).nav('daily');


$('#issue-section', body).issueSection();
$('#task-section', body).taskSection();
$('#bugs-section', body).bugsSection(CS.sprint);
$('#task-section', body).taskSection(CS.sprint);


$('#keep-in-mind-section', body).keepInMindSection();
Expand Down
4 changes: 4 additions & 0 deletions public/javascripts/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,10 @@ var CS = {};
spin.show();
return elm;
},
removeSpin:function(){
$('.spin', this).remove();
return $(this);
},
/* フォーム */
form:function () {
return $(this).each(function () {
Expand Down
23 changes: 23 additions & 0 deletions public/javascripts/view.setting.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,27 @@
});
});

return pane;
},
redmineBugStatusPane:function(){
var pane = $(this);


var table = $('#bug-status-table', pane),
tbody = $('tbody', table);

table.showSpin();
$.get('/setting/get_issue_statuses', function(data){
table.removeSpin();
var tmpl = Handlebars.templates['tmpl.redmine-bug-status-table-row'];
if(!data.success){
console.error('failed to get_issue_statuses');
return;
}
data.issue_statuses.forEach(function(data){
var tr = $(tmpl(data)).appendTo(tbody);
});
});
return pane;
}
});
Expand All @@ -222,5 +243,7 @@


$('#redmine-project-list-pane', body).redmineProjectListPane();

$('#redmine-bug-status-pane', body).redmineBugStatusPane();
});
})(jQuery);
9 changes: 9 additions & 0 deletions public/stylesheets/setting.less
Original file line number Diff line number Diff line change
Expand Up @@ -120,3 +120,12 @@
right: 4px;
top: 8px;
}

#member-add-btn{
top:-45px;
}
#bug-status-table{
th,td{
padding: 0;
}
}
13 changes: 13 additions & 0 deletions public/stylesheets/style.less
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,15 @@ a {
.paper-title{
font-size: 1.5em;
margin: 10px 0;
color:lighten(@black, 40);
}
.paper-title-lead{
opacity: 0.6;
font-weight: bold;
padding: 2px 0;
font-size:12px;
display: block;
font-style: italic;
}

section {
Expand Down Expand Up @@ -691,4 +700,8 @@ form{

.block-select{
width:100%;
}

#ui-datepicker-div{
display: none;
}
2 changes: 2 additions & 0 deletions routes/rt.daily.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@ exports.index = function (req, res) {
});
};



28 changes: 23 additions & 5 deletions routes/rt.setting.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,21 @@ exports.getRedmineProjects = function (req, res) {
});
};

exports.getRedmineVersions = function(req, res){
exports.getRedmineVersions = function (req, res) {
var project = req.query.project;
function fail(){

function fail() {
res.json({
success:false
});
}
if(!project){

if (!project) {
fail();
return;
}
RedmineAgent.admin.getVersions(project, function(success, data){
if(!success){
RedmineAgent.admin.getVersions(project, function (success, data) {
if (!success) {
fail();
return;
}
Expand All @@ -43,4 +45,20 @@ exports.getRedmineVersions = function(req, res){
});
});

};

/* get issues statuses of redmine */
exports.getIssueStatuses = function (req, res) {
RedmineAgent.admin.issue_statuses(function (success, data) {
if (success) {
res.json({
success:true,
issue_statuses:data
});
} else {
res.json({
success:false
});
}
});
};
Loading

0 comments on commit d9d4eb8

Please sign in to comment.