Ejemplo n.º 1
0
def dashboard(request):
    """
    Render dashboard overview. It will contain the following:
    1. Issue Tracker reports
    2. Changeset reports
    3. Progress reports
    4. Charts and graphs
    """
    # Get retrieved issues from subscribed repositories
    subscribed  = bitmanager.get_all_subscriptions(request.user)
    data = bitmethods.package_context(subscribed)
    data['screenshots'] = bitdashboard.get_screenshots()
    return render(request, 'dashboard.html', data)
Ejemplo n.º 2
0
def manage_repositories(request):
    """
    Renders manage repositories page
    """
    # Get OAuth tokens
    auth_tokens = bitauth.get_auth_tokens(request.user)

    # Get subscriptions and Parse list of all repositories
    subscribed = bitmanager.get_all_subscriptions(request.user)
    repo_ids = bitmanager.get_repo_id_from_subscriptions(subscribed)
    repositories  = bitmanager.get_list_of_repositories(auth_tokens)

    # Package subscribed
    data = bitmethods.package_context(subscribed)
    data['repositories'] = bitmanager.parse_repositories(repositories, repo_ids)
    return render(request, 'manage.html', data)
Ejemplo n.º 3
0
def dashboard_issues(request):
    """
    Render dashboard issue tracker overview.
    """
    # Get OAuth tokens
    auth_tokens = bitauth.get_auth_tokens(request.user)

    # Get all subscribed repositories
    subscribed  = bitmanager.get_all_subscriptions(request.user)
    repo_urls   = bitmanager.get_subscribed_repo_urls(subscribed, 'issues', 10)
    repo_issues = bitissues.parse_all_issues(
                  bitmethods.send_async_bitbucket_requests(repo_urls, auth_tokens))
    issues_list = bitissues.attach_meta(subscribed, repo_issues)

    # Get retrieved issues from subscribed repositories
    data = bitmethods.package_context(subscribed)
    data['issues_list'] = issues_list
    return render(request, 'dashboard_issues.html', data)
Ejemplo n.º 4
0
def reports(request, owner, repo_slug):
    """
    Render the webpage to show reports and graphs
    """
    # Get OAuth tokens
    auth_tokens = bitauth.get_auth_tokens(request.user)

    # Tally all of the changesets for each user
    changesets_count = bitmethods.get_count(owner, repo_slug, auth_tokens, 'changesets')
    changesets_urls = bitmethods.get_api_urls(owner, repo_slug, 'changesets', changesets_count)
    changesets_parsed = bitchangesets.iterate_all_changesets(changesets_urls, auth_tokens)
    changesets_tallied = bitstats.tally_changesets(changesets_parsed)

    # Tally the number of issues opened, assigned
    issues_count = bitmethods.get_count(owner, repo_slug, auth_tokens, 'issues')
    issues_urls = bitissues.get_issues_urls(owner, repo_slug, 'issues', issues_count)
    issues_parsed = bitstats.parse_issues_for_tallying(issues_urls, auth_tokens)
    issues_tallied = bitstats.tally_issues(issues_parsed)

    # Tally issue comments
    issues_comments_urls = bitissues.get_issue_comments_urls(issues_parsed, owner, repo_slug)
    issues_comments = bitmethods.send_async_bitbucket_requests(issues_comments_urls, auth_tokens)
    issues_tallied = bitstats.tally_issue_comments(issues_tallied, issues_comments)

    # Combine tallies for issues and changesets for each user
    tallies = bitstats.combine_tallies(changesets_tallied, issues_tallied)

    # Get retrieved context from subscribed repositories
    subscribed = bitmanager.get_all_subscriptions(request.user)
    context = bitmethods.package_context(subscribed)
    context['owner'] = owner
    context['repo_slug'] = repo_slug
    context['tallies'] = tallies

    # Set up graphs for nvd3
    context['commits_linegraph'] = bitgraphs.commits_linegraph(changesets_parsed, changesets_count)
    context['commits_piegraph'] = bitgraphs.set_up_graph(tallies, 'changesets')
    context['issues_bargraph'] = bitgraphs.set_up_graph(tallies, 'issues_completed')
    return render(request, 'statistics.html', context)