YouTrackProjects

    Table of contents
    No headers
    var projects = $0 ?? $projects;
    
    // collect all projects/objectives/tasks for a project
    var projects = [
        {
            project: p,
            objectives: [
                { 
                    objective: objective,
                    tasks: youtrack.issues('order by: priority, {issue id} required by: ' .. objective.id .. ' #unresolved')
                } foreach 
                    var objective in objectives where objective.subsystem === 'Objective'
            ],
            tasks: [ task foreach var task in objectives where task.subsystem !== 'Objective' && !task.resolved ]
        } foreach 
            var p in youtrack.issues('project:product subsystem:project order by: summary #unresolved ' .. projects), 
            var objectives = youtrack.issues('order by: priority, {issue id} required by: ' .. p.id .. ' #unresolved')
    ];
    
    // create table of contents
    <h2> "Table of Contents" </h2>
    <ul>
        foreach(var p in projects) {
            <li><a href=('#' .. p.project.id)> p.project.summary </a></li>
        }
    </ul>
    <hr/>
    
    
    // DEBUG
    //web.pre(json.format(projects));
    
    // list projects
    foreach(var p in projects) {
        <h2 id=(p.project.id)>
            youtrack.issuelink{
                id: p.project.id,
                text: p.project.summary .. ' (' .. p.project.id .. ')',
                target: '_blank'
            }
        </h2>
        <p> web.format(p.project.description) </p>
        
        // list objectives for project
        foreach(var o in p.objectives) {
            
            <h4>
                youtrack.issuelink{
                    id: o.objective.id,
                    text: o.objective.summary .. ' (' .. o.objective.id .. ')',
                    target: '_blank'
                };
                " ";
                youtrack.querylink{
                    query: 'order by: priority, {issue id} required by: ' .. o.objective.id .. ' #unresolved',
                    text: '(issues only)',
                    target: '_blank'
                };
            </h4>
            <p> web.format(o.objective.description) </p>
            
            if(#o.tasks) {
                <ol>
                    foreach(var task in o.tasks) {
                        <li>
                            var label;
                            var assignedto = <span>' - '; (!#task.assignee ? <span style=('color: red;')>'unassigned';</span> : task.assignee)</span>;
                            switch(task.priority) {
                            case 4:
                                let label = <span><span style=(task.resolved ? 'text-decoration: line-through; color:grey;' : nil)> task.id .. ' - '; <font color="red"> "(show-stopper) "; </font> task.summary </span>assignedto;</span>;
                            case 3:
                                let label = <span><span style=(task.resolved ? 'text-decoration: line-through; color:grey;' : nil)> task.id .. ' - '; <font color="red"> "(critical) "; </font> task.summary </span>assignedto;</span>;
                            case 2:
                                let label = <span><span style=(task.resolved ? 'text-decoration: line-through; color:grey;' : nil)> task.id .. ' - '; <font color="red"> "(major) "; </font> task.summary </span>assignedto;</span>;
                            case 0:
                                let label = <span><span style=(task.resolved ? 'text-decoration: line-through; color:grey;' : nil)> task.id .. ' - '; <font color="silver"> "(minor) "; </font> task.summary </span>assignedto;</span>;
                            default:
                                let label = <span><span style=(task.resolved ? 'text-decoration: line-through; color:grey;' : nil)> task.id .. ' - ' .. task.summary </span>assignedto;</span>;
                            }
    
                            youtrack.issuelink{
                                id: task.id, 
                                text: label,
                                target: '_blank'
                            };
                        </li>
                    }
                </ol>
            }
        }
    
        // list tasks for project    
        if(#p.tasks) {
            <h4>
                youtrack.querylink{
                    query: 'order by: priority, {issue id} required by: ' .. p.project.id .. ' subsystem: -Objective #unresolved',
                    text: 'Other Tasks (issues only)',
                    target: '_blank'
                }
            </h4>
            <ol>
                foreach(var task in p.tasks) {
                    <li>
                        var label;
                        var assignedto = <span>' - '; (!#task.assignee ? <span style=('color: red;')>'unassigned';</span> : task.assignee)</span>;
                        switch(task.priority) {
                        case 4:
                            let label = <span><span style=(task.resolved ? 'text-decoration: line-through; color:grey;' : nil)> task.id .. ' - '; <font color="red"> "(show-stopper) "; </font> task.summary </span>assignedto;</span>;
                        case 3:
                            let label = <span><span style=(task.resolved ? 'text-decoration: line-through; color:grey;' : nil)> task.id .. ' - '; <font color="red"> "(critical) "; </font> task.summary </span>assignedto;</span>;
                        case 2:
                            let label = <span><span style=(task.resolved ? 'text-decoration: line-through; color:grey;' : nil)> task.id .. ' - '; <font color="red"> "(major) "; </font> task.summary </span>assignedto;</span>;
                        case 0:
                            let label = <span><span style=(task.resolved ? 'text-decoration: line-through; color:grey;' : nil)> task.id .. ' - '; <font color="silver"> "(minor) "; </font> task.summary </span>assignedto;</span>;
                        default:
                            let label = <span><span style=(task.resolved ? 'text-decoration: line-through; color:grey;' : nil)> task.id .. ' - ' .. task.summary </span>assignedto;</span>;
                        }
                        youtrack.issuelink{
                            id: task.id, 
                            text: label,
                            target: '_blank'
                        };
                    </li>
                }
            </ol>
        }
        <hr/>
    }
    
    Tag page
    You must login to post a comment.

    Copyright © 2011 MindTouch, Inc. Powered by