From 4d26ffd3ffaaa861690775c817c5bc74ae89e6d0 Mon Sep 17 00:00:00 2001 From: chriswebb09 Date: Tue, 9 Jan 2024 03:39:21 -0500 Subject: [PATCH] update api routes --- DirectReport/browserview/api/reports.py | 137 ++++++++++++++++++ DirectReport/browserview/dashboard/routes.py | 63 +------- DirectReport/browserview/errors/handlers.py | 2 - DirectReport/browserview/main/routes.py | 87 ----------- DirectReport/browserview/services/github.py | 33 ++++- .../browserview/static/js/account/account.js | 7 +- .../static/js/account/account_components.js | 76 +++++----- .../browserview/static/js/archived_report.js | 16 +- .../browserview/static/js/chart_helper.js | 6 +- .../static/js/teamreport/teamreport.js | 20 +-- .../js/teamreport/teamreport_components.js | 25 ++-- .../browserview/templates/account.html | 2 +- .../templates/team/teamreport.html | 2 +- 13 files changed, 235 insertions(+), 241 deletions(-) diff --git a/DirectReport/browserview/api/reports.py b/DirectReport/browserview/api/reports.py index d1fc99b9..31ef6f28 100644 --- a/DirectReport/browserview/api/reports.py +++ b/DirectReport/browserview/api/reports.py @@ -1,8 +1,18 @@ #!/usr/bin/env python3 +from datetime import datetime, timedelta +import requests +from flask import session, request, json, jsonify from flask_login import login_required, current_user +from DirectReport.models.user_model import UserModel from DirectReport.models.report.report_builder import ReportBuilder +from DirectReport.browserview.services.prompt_logic import generate_email, team_summary_from_shortlog +from DirectReport.browserview.services.github import GithubClient from DirectReport.browserview.api import bp +from DirectReport.datadependencies import appsecrets + +client_id = appsecrets.GITHUB_CLIENT_ID +client_secret = appsecrets.GITHUB_CLIENT_SECRET @bp.route("/reports/list", methods=['GET']) @@ -10,3 +20,130 @@ def get_list(): reports = ReportBuilder.get_reports_for_user_id(current_user.id) return reports, 201 + + +@bp.route("/reports/update", methods=['GET', 'POST']) +@login_required +def dashboard_reports_update(): + prompt = "" + prompt = request.get_json()["prompt"].strip() + client = GithubClient() + h_token = session['header_token'] + user_repos = client.get_user_repos(current_user.github_username, h_token) + commits_count_last_month = client.get_commits_count_in_last_month( + current_user.github_username, current_user.github_repo, h_token + ) + commits_count_last_sixty = client.get_commits_count_in_last_sixty_days( + current_user.github_username, current_user.github_repo, h_token + ) + commits_count_last_ninety = client.get_commits_count_in_last_ninety_days( + current_user.github_username, current_user.github_repo, h_token + ) + + get_pull_requests_count = client.get_pull_requests_count( + current_user.github_username, current_user.github_repo, h_token + ) + get_pull_requests_count_sixty = client.get_pull_requests_count_sixty_days( + current_user.github_username, current_user.github_repo, h_token + ) + repo_data = [] + for repo in user_repos: + repo_data.append(repo["name"]) + raw_data = team_summary_from_shortlog(prompt)["choices"][0]["message"]["content"] + response_data = json.loads(raw_data) + response_data["commit_nums"] = { + "15 days": 4, + "30 days": (commits_count_last_month / 10), + "60 days": (commits_count_last_sixty / 10), + "90 days": (commits_count_last_ninety / 10), + "120 days": 10, + } + response_data["pull_requests"] = { + "30 days": get_pull_requests_count, + "60 days": get_pull_requests_count_sixty, + "90 days": 8, + "120 days": 10, + "150 days": 10, + "1 year": 30, + } + response_data["repos"] = repo_data + print(response_data) + ReportBuilder.new(response_data, prompt, current_user.id, current_user.github_repo) + return response_data, 201 + + +@bp.route('/repo', methods=['GET', 'POST']) +def reponame(): + args_url = request.args.get('repo_url') + repo = args_url.split('/')[1] + h_token = session['header_token'] + repo_name = "https://api.github.com/repos/" + args_url + "/commits" + client = GithubClient() + user_model = UserModel() + user_model.update_github_repo(current_user.email, repo) + + headers = { + 'Accept': 'application/vnd.github+json', + 'Authorization': 'Bearer ' + h_token, + 'X-GitHub-Api-Version': '2022-11-28', + } + + test = client.get_commits_in_last_month(current_user.github_username, current_user.github_repo, h_token) + print(test) + json_response_data = json.dumps(test) + print(json_response_data) + json_response_data_loads = json.loads(json_response_data) + print(json_response_data_loads) + res_json = {"json_array": json_response_data_loads} + return res_json, 200 + # response_data = requests.get(url=repo_name, headers=headers, auth=(client_id, client_secret)) + # if response_data.status_code == 200: + # json_response_data = json.loads(response_data.content) + # res_json = {"json_array": json_response_data} + # return res_json, 200 + # else: + # return jsonify([]), 200 + + +@bp.route('/repos', methods=['GET', 'POST']) +def repos(): + if request.method == 'GET': + h_token = session['header_token'] + username = current_user.github_username + url = f"https://api.github.com/users/{username}/repos" + "?sort=updated&direction=desc" + headers = { + 'Accept': 'application/vnd.github+json', + 'Authorization': 'Bearer ' + h_token, + 'X-GitHub-Api-Version': '2022-11-28', + } + response = requests.get(url, headers=headers) + if response.status_code == 200: + repos = response.json() + results = [] + for repo in repos: + owner = repo['owner'] + url_repo = repo['url'] + data_res = { + "name": repo['name'], + "description": repo['description'], + "url": repo['url'], + 'url_repo': url_repo, + "owner_url": owner['url'], + } + results.append(data_res) + return jsonify(results), 200 + else: + print(f"Error Response FROM API: {response.status_code} - {response.text}") + return jsonify([]), 200 + else: + return jsonify([]), 200 + + +@bp.route("/generate_email", methods=['POST']) +def generateemail(): + prompt = "" + if request.method == "POST": + prompt = json.dumps(request.get_json()["prompt"]) + report = generate_email(prompt) + elements = {"email": report.choices[0].message.content} + return elements, 201 diff --git a/DirectReport/browserview/dashboard/routes.py b/DirectReport/browserview/dashboard/routes.py index 5af03053..829efc3a 100644 --- a/DirectReport/browserview/dashboard/routes.py +++ b/DirectReport/browserview/dashboard/routes.py @@ -1,16 +1,10 @@ #!/usr/bin/env python3 import requests -from flask import render_template, session, request, redirect, json, jsonify -from flask_login import login_user, login_required, logout_user, current_user -import re +from flask import render_template +from flask_login import login_required, current_user from DirectReport.browserview.dashboard import bp from DirectReport.models.report.report_builder import ReportBuilder -from DirectReport.browserview.services.github import GithubClient -from DirectReport.browserview.services.huggingface_client import HuggingFaceClient -from DirectReport.browserview.services.googleai_client import GoogleAIClient -from DirectReport.browserview.services.prompt_logic import generate_email, team_summary_from_shortlog -from DirectReport.models.report.report_model import ReportModel from DirectReport.datadependencies import appsecrets client_id = appsecrets.GITHUB_CLIENT_ID @@ -36,7 +30,6 @@ def dashboard_reports_saved(): Retrieves and renders the list of all entries. :return: Rendered HTML template for the list page. """ - results = requests.get('http://127.0.0.1:5000/api/reports/list') return render_template('list.html', title='List', data=results) @@ -47,63 +40,11 @@ def dashboard_reports_new(): return render_template('team/teamreport.html', title='Team Report', data=[]) -@bp.route("/reports/update", methods=['GET', 'POST']) -@login_required -def dashboard_reports_update(): - prompt = "" - # googleAi = GoogleAIClient() - prompt = request.get_json()["prompt"].strip() - client = GithubClient() - h_token = session['header_token'] - user_repos = client.get_user_repos(current_user.github_username, h_token) - commits_last_month = client.get_commits_in_last_month( - current_user.github_username, current_user.github_repo, h_token - ) - commits_last_sixty = client.get_commits_in_last_sixty_days( - current_user.github_username, current_user.github_repo, h_token - ) - commits_last_ninety = client.get_commits_in_last_ninety_days( - current_user.github_username, current_user.github_repo, h_token - ) - get_pull_requests_count = client.get_pull_requests_count( - current_user.github_username, current_user.github_repo, h_token - ) - get_pull_requests_count_sixty = client.get_pull_requests_count_sixty_days( - current_user.github_username, current_user.github_repo, h_token - ) - repo_data = [] - for repo in user_repos: - repo_data.append(repo["name"]) - raw_data = team_summary_from_shortlog(prompt)["choices"][0]["message"]["content"] - response_data = json.loads(raw_data) - print(response_data) - response_data["commit_nums"] = { - "15 days": 4, - "30 days": (commits_last_month / 10), - "60 days": (commits_last_sixty / 10), - "90 days": (commits_last_ninety / 10), - "120 days": 10, - } - response_data["pull_requests"] = { - "30 days": get_pull_requests_count, - "60 days": get_pull_requests_count_sixty, - "90 days": 8, - "120 days": 10, - "150 days": 10, - "1 year": 30, - } - response_data["repos"] = repo_data - print(repo_data) - ReportBuilder.new(response_data, prompt, current_user.id, current_user.github_repo) - return response_data, 201 - - @bp.route("/reports/", methods=['GET']) @login_required def dashboard_saved_report(uid=None): reports = ReportBuilder.get_reports_for_user_id(current_user.id) report = list(filter(lambda report: report["uuid"] == uid, reports))[0] - print(report) report["commit_nums"] = { "15 days": 4, "30 days": (8 / 10), diff --git a/DirectReport/browserview/errors/handlers.py b/DirectReport/browserview/errors/handlers.py index 14bdf7b3..59ae8c2a 100644 --- a/DirectReport/browserview/errors/handlers.py +++ b/DirectReport/browserview/errors/handlers.py @@ -18,7 +18,6 @@ def page_not_found(e): :return: Rendered HTML template for the 404 error page. """ if wants_json_response(): - print(e) return api_error_response(404) return render_template('404.html', error=e), 404 @@ -26,6 +25,5 @@ def page_not_found(e): @bp.app_errorhandler(500) def internal_error(error): if wants_json_response(): - print(error) return api_error_response(500) return render_template('500.html', error=error), 500 diff --git a/DirectReport/browserview/main/routes.py b/DirectReport/browserview/main/routes.py index e247717e..d85ddccd 100644 --- a/DirectReport/browserview/main/routes.py +++ b/DirectReport/browserview/main/routes.py @@ -1,15 +1,11 @@ #!/usr/bin/env python3 -from datetime import datetime, timedelta - import requests from flask import render_template, session, request, redirect, json, jsonify from flask_login import current_user - from DirectReport.models.user_model import UserModel from DirectReport.browserview.main import bp from DirectReport.browserview.services.github import GithubClient -from DirectReport.browserview.services.prompt_logic import generate_email from DirectReport.datadependencies import appsecrets @@ -42,45 +38,6 @@ def oauth2_authorize(): return redirect(github_url) -def get_commits_last_month(repo_name): - owner = current_user.github_username - url = f'https://api.github.com/repos/{owner}/{repo_name}/pulls' - h_token = session['header_token'] - headers = {"Authorization": f"token {h_token}"} - since_date = (datetime.utcnow() - timedelta(days=30)).strftime('%Y-%m-%dT%H:%M:%SZ') - params = {'state': 'all', 'sort': 'created', 'direction': 'desc', 'since': since_date} - response = requests.get(url, headers=headers, params=params) - if response.status_code == 200: - pull_requests = response.json() - return pull_requests - else: - print(f"Error: {response.status_code}") - print(response.text) - - -@bp.route('/repo', methods=['GET', 'POST']) -def reponame(): - args_url = request.args.get('repo_url') - repo = args_url.split('/')[1] - h_token = session['header_token'] - repo_name = "https://api.github.com/repos/" + args_url + "/commits" - user_model = UserModel() - user_model.update_github_repo(current_user.email, repo) - headers = { - 'Accept': 'application/vnd.github+json', - 'Authorization': 'Bearer ' + h_token, - 'X-GitHub-Api-Version': '2022-11-28', - } - response_data = requests.get(url=repo_name, headers=headers, auth=(client_id, client_secret)) - print(response_data) - if response_data.status_code == 200: - json_response_data = json.loads(response_data.content) - res_json = {"json_array": json_response_data} - return res_json, 200 - else: - return jsonify([]), 200 - - @bp.route('/callback/github', methods=['GET', 'POST']) def ouath2_callback(): data = {'client_id': client_id, 'client_secret': client_secret, 'code': request.args.get("code")} @@ -107,55 +64,11 @@ def ouath2_callback(): return render_template('team/teamreport.html', title='Team', data=[]) -@bp.route('/repos', methods=['GET', 'POST']) -def repos(): - if request.method == 'GET': - h_token = session['header_token'] - username = current_user.github_username - url = f"https://api.github.com/users/{username}/repos" + "?sort=updated&direction=desc" - headers = { - 'Accept': 'application/vnd.github+json', - 'Authorization': 'Bearer ' + h_token, - 'X-GitHub-Api-Version': '2022-11-28', - } - response = requests.get(url, headers=headers) - if response.status_code == 200: - repos = response.json() - results = [] - for repo in repos: - owner = repo['owner'] - url_repo = repo['url'] - data_res = { - "name": repo['name'], - "description": repo['description'], - "url": repo['url'], - 'url_repo': url_repo, - "owner_url": owner['url'], - } - results.append(data_res) - return jsonify(results), 200 - else: - print(f"Error Response FROM API: {response.status_code} - {response.text}") - return jsonify([]), 200 - else: - return jsonify([]), 200 - - @bp.route("/team", methods=['GET']) def team(): return render_template('team/team.html', title='Team', data=[]) -@bp.route("/generate_email", methods=['POST']) -def generateemail(): - prompt = "" - if request.method == "POST": - prompt = json.dumps(request.get_json()["prompt"]) - report = generate_email(prompt) - elements = {"email": report.choices[0].message.content} - return elements, 201 - - @bp.route("/repo/", methods=['GET']) def repo(reponame=None): client = GithubClient() diff --git a/DirectReport/browserview/services/github.py b/DirectReport/browserview/services/github.py index eaa1f9c0..5424f041 100644 --- a/DirectReport/browserview/services/github.py +++ b/DirectReport/browserview/services/github.py @@ -26,7 +26,6 @@ def parse_git_shortlog(self, shortlog): authors[author] = int(commits) return authors - # def get_pull_request_comments_count(repo_owner, repo_name, pull_request_number): def get_pull_request_comments(self, repo_owner, repo_name): """ Gets the number of comments on a pull request. @@ -130,7 +129,7 @@ def get_repo_issues(self, repo_owner, repo_name, token): response.raise_for_status() return response.json() - def get_commits_in_last_month(self, repo_owner, repo_name, token): + def get_commits_count_in_last_month(self, repo_owner, repo_name, token): thirty_days_ago = datetime.now() - timedelta(days=30) since = thirty_days_ago.isoformat() headers = {"Authorization": f"token {token}"} @@ -152,7 +151,33 @@ def get_commits_in_last_month(self, repo_owner, repo_name, token): page += 1 return commits_count - def get_commits_in_last_sixty_days(self, repo_owner, repo_name, token): + def get_commits_in_last_month(self, repo_owner, repo_name, token): + thirty_days_ago = datetime.now() - timedelta(days=30) + since = thirty_days_ago.isoformat() + headers = {"Authorization": f"token {token}"} + url = f"https://api.github.com/repos/{repo_owner}/{repo_name}/commits" + commits_count = 0 + page = 1 + per_page = 100 # Number of results per page + commits_data = [] + while True: + # Make a request to the GitHub API + response = requests.get(url, headers=headers, params={'since': since, 'page': page, 'per_page': per_page}) + if response.status_code != 200: + # Break the loop if the response is not successful + break + commits = response.json() + # print(commits) + commits_data.extend(commits) + # commits_data.append(commits) + current_count = len(commits) + commits_count += current_count + if current_count < per_page: + break + page += 1 + return commits_data + + def get_commits_count_in_last_sixty_days(self, repo_owner, repo_name, token): sixty_days_ago = datetime.now() - timedelta(days=60) since = sixty_days_ago.isoformat() headers = {"Authorization": f"token {token}"} @@ -174,7 +199,7 @@ def get_commits_in_last_sixty_days(self, repo_owner, repo_name, token): page += 1 return commits_count - def get_commits_in_last_ninety_days(self, repo_owner, repo_name, token): + def get_commits_count_in_last_ninety_days(self, repo_owner, repo_name, token): ninety_days_ago = datetime.now() - timedelta(days=90) since = ninety_days_ago.isoformat() headers = {"Authorization": f"token {token}"} diff --git a/DirectReport/browserview/static/js/account/account.js b/DirectReport/browserview/static/js/account/account.js index 4323fc67..8180e551 100644 --- a/DirectReport/browserview/static/js/account/account.js +++ b/DirectReport/browserview/static/js/account/account.js @@ -37,12 +37,11 @@ const Account = () => { ) } else { return ( -
-
-
+
+

User Account Data

+
{userData && AccountUserInfo(userData, reportData)}
-
) } diff --git a/DirectReport/browserview/static/js/account/account_components.js b/DirectReport/browserview/static/js/account/account_components.js index 44568cf4..5ccdae25 100644 --- a/DirectReport/browserview/static/js/account/account_components.js +++ b/DirectReport/browserview/static/js/account/account_components.js @@ -3,73 +3,67 @@ const { useState, useEffect } = React; const AccountUserInfo = (userData, reportData) => { return ( -
-
-
-
-
-
-

- FULL NAME: {userData.name} +

+
+
+
+
+
+

+ FULL NAME: {userData.name}

-

- EMAIL ADDRESS: {userData.userid} +

+ EMAIL ADDRESS: {userData.userid}

-

- USER NAME: {userData.username} +

+ USER NAME: {userData.username}

-
-
-
-

- NUMBER OF REPORTS SAVED: +

+

+ NUMBER OF REPORTS SAVED: {reportData.length}

-

- DATE STARTED TRACKING: +

+ DATE STARTED TRACKING: DEC 12, 2018

-

- LAST REPORT CREATED: +

+ LAST REPORT CREATED: DEC 12, 2021

-
+
-

+

CONNECT ACCOUNT

-
+
  • - GITHUB ACCOUNT: + GITHUB ACCOUNT: {userData.github_username ? userData.github_username : 'None Connected'}

  • - SELECTED REPO: + SELECTED REPO: {userData.github_repo ? userData.github_repo : 'None Selected'}

    @@ -78,16 +72,12 @@ const AccountUserInfo = (userData, reportData) => {
-
-
diff --git a/DirectReport/browserview/static/js/archived_report.js b/DirectReport/browserview/static/js/archived_report.js index 1bc3b7a5..29692a1f 100644 --- a/DirectReport/browserview/static/js/archived_report.js +++ b/DirectReport/browserview/static/js/archived_report.js @@ -14,7 +14,6 @@ const ArchivedReport = (reportDataElems) => { const openRepoPopover = () => { console.log("open repo popover"); - // setRepoSelected(true); } useEffect(() => { @@ -23,15 +22,14 @@ const ArchivedReport = (reportDataElems) => { }, [reportDataElems]); function printData(reportDataElems) { - var obj = JSON.parse(JSON.stringify(reportDataElems)); - // var objb = JSON.parse(JSON.stringify(obj)); - var test_data = JSON.parse(JSON.stringify(obj.results.data)) + const obj = JSON.parse(JSON.stringify(reportDataElems)); + const test_data = JSON.parse(JSON.stringify(obj.results.data)) setCommitNums(test_data.commit_nums); setPullRequests(test_data.pull_requests); - var test_data2 = JSON.parse(JSON.stringify(obj.results.raw_input_elem)) + const test_data2 = JSON.parse(JSON.stringify(obj.results.raw_input_elem)) setRawInputText(test_data2.raw_input); - var new_data = obj.results.reportDataElems.replace(/\'/g, "\""); - var test1 = JSON.parse(new_data); + const new_data = obj.results.reportDataElems.replace(/'/g, '"'); + const test1 = JSON.parse(new_data); Object.entries(test1).forEach((entry) => { const [key, value] = entry; var obj_new = JSON.parse(JSON.stringify(value)); @@ -47,10 +45,6 @@ const ArchivedReport = (reportDataElems) => { }); } else if (key === "broad_categories") { setBroadCategories(obj_new); - } else if (key === "repos") { - setRepos({ - repos:obj_new, - }); } else if (key == "commit_nums") { setCommitNums(obj_new); } else if (key == "pull_requests") { diff --git a/DirectReport/browserview/static/js/chart_helper.js b/DirectReport/browserview/static/js/chart_helper.js index 5c9257f8..ca789969 100644 --- a/DirectReport/browserview/static/js/chart_helper.js +++ b/DirectReport/browserview/static/js/chart_helper.js @@ -176,7 +176,7 @@ function showGraphics3(data, divtag) { const chartWidth = 350 const chartHeight = 300 - const padding = 20 + const padding = 10 var data = values const heightScalingFactor = chartHeight / 67 @@ -203,13 +203,13 @@ function showGraphics3(data, divtag) { } }) .attr('y', function (value, index) { - return (chartHeight - 30) - (value[1] * 17) + return (chartHeight - 30) - (value[1] * 10) }) .attr("width", function (value, index) { return (chartWidth / data.length) - padding }) .attr("height", function (value, index) { - return value[1] * 17 + return value[1] * 10 }) .attr("fill", "teal"); diff --git a/DirectReport/browserview/static/js/teamreport/teamreport.js b/DirectReport/browserview/static/js/teamreport/teamreport.js index 36482943..873016ca 100644 --- a/DirectReport/browserview/static/js/teamreport/teamreport.js +++ b/DirectReport/browserview/static/js/teamreport/teamreport.js @@ -65,7 +65,7 @@ class TeamReport extends React.Component { const payload = {"prompt": this.state.commentText} axios({ method: 'post', - url: '/dashboard/reports/update', + url: '/api/reports/update', data: payload, headers: { "Accept": "application/json", @@ -91,7 +91,7 @@ class TeamReport extends React.Component { getRepoData() { axios({ method: 'get', - url: '/repos', + url: '/api/repos', headers: { "Accept": "application/json", "Content-Type": "application/json" @@ -106,10 +106,12 @@ class TeamReport extends React.Component { update(repoURL) { axios({ method: 'post', - url: "/repo" + repoURL, + url: "/api/repo" + repoURL, headers: {'content-type': 'application/json'} }).then(result => { - const results = GetResults(result); + // console.log(result.data) + const results = GetResults(result.data["json_array"]); + console.log(results) const prompt = results.map((commit) => { return commit.name + " " + commit.message + " " + commit.commit_author_date + "\n" }) @@ -126,7 +128,7 @@ class TeamReport extends React.Component { openRepoPopover(repos, state) { const element = document.getElementById('h1content'); Popper.createPopper(element, document.getElementById('popover-repo-left-purple'), { - strategy: 'fixed' + resize: true }); document.getElementById('popover-repo-left-purple').classList.toggle("hidden"); document.getElementById('popover-repo-TitleContent').innerHTML = "Repos" + "(" + this.state.repos.length + ")"; @@ -149,8 +151,8 @@ class TeamReport extends React.Component { render() { return ( -
-

Generate Team Report From Metadata

+
+

Generate Team Report From Metadata

{repoPopoverUI()} {spinnerUI()}
@@ -158,8 +160,8 @@ class TeamReport extends React.Component { {SummarySection(this.state.reportData)} {TeamSection(this.state.teamData, this.closePopover)}
- {this.state.teamData.length <= 0 && ( -
+ {this.state.commits.length <= 0 && ( +
)} {this.state.teamData.length > 0 && ( diff --git a/DirectReport/browserview/static/js/teamreport/teamreport_components.js b/DirectReport/browserview/static/js/teamreport/teamreport_components.js index af5611d0..0d84eff7 100644 --- a/DirectReport/browserview/static/js/teamreport/teamreport_components.js +++ b/DirectReport/browserview/static/js/teamreport/teamreport_components.js @@ -16,7 +16,6 @@ const ShowSummary = (report) => { // Define a functional component named 'ShowHighlights' const ShowHighlights = (report) => { - console.log(report); return (
{/*

{report}

*/} @@ -78,13 +77,13 @@ const openPopover = (e: ChangeEvent, team_member) => { const repoPopoverUI = () => { return ( -
+
- +
-
+
@@ -92,9 +91,6 @@ const repoPopoverUI = () => { } const SummarySection = (reportData) => { - console.log("SummarySection"); - console.log(reportData); - // var report = reportData["report"]; return (
@@ -181,11 +177,11 @@ const GithubEntryElement = (commits) => { } const GetResults = (result) => { - const results = result.data['json_array'].map((commit) => { + const results = result.map((commit) => { return { - 'message': commit['commit']['message'], - 'name': commit['commit']['author']['name'], - 'author_url': commit['author']['html_url'], + 'message': commit["commit"].message, + 'name': commit["author"]["name"], + 'author_url': commit["author"]["html_url"], 'author_name': commit['author']['login'], 'commit_author_email': commit['commit']['author']['email'], 'commit_author_name': commit['commit']['author']['name'], @@ -238,7 +234,9 @@ const EditSummaryElem = (props, state, openRepoPopover) => {

Github Data

- {GithubEntryElement(commits)} + {commits && commits.length > 0 && ( + GithubEntryElement(commits) + )} {GithubButtonElement(repos, openRepoPopover, state)}
@@ -254,9 +252,6 @@ const closePopover = () => { } const GraphElement = (title, id, mapcontainer_id) => { - console.log(title); - console.log(id); - console.log(mapcontainer_id); return (

{title}

diff --git a/DirectReport/browserview/templates/account.html b/DirectReport/browserview/templates/account.html index cf60cebf..11e84aa9 100644 --- a/DirectReport/browserview/templates/account.html +++ b/DirectReport/browserview/templates/account.html @@ -14,7 +14,7 @@ {% block content %}
-
+
diff --git a/DirectReport/browserview/templates/team/teamreport.html b/DirectReport/browserview/templates/team/teamreport.html index 2e57b4df..2cc0c6c6 100644 --- a/DirectReport/browserview/templates/team/teamreport.html +++ b/DirectReport/browserview/templates/team/teamreport.html @@ -6,7 +6,7 @@ {% block content %}
-
+