From 01bbf437069938d445c10e6b66fc4e2446fef438 Mon Sep 17 00:00:00 2001 From: chriswebb09 Date: Sun, 24 Dec 2023 02:52:19 -0500 Subject: [PATCH 1/2] update ui for reports --- DirectReport/browserview/__init__.py | 9 +- DirectReport/browserview/api/__init__.py | 2 + DirectReport/browserview/api/auth.py | 5 +- DirectReport/browserview/api/errors.py | 3 + DirectReport/browserview/api/reports.py | 123 +++++++++--------- DirectReport/browserview/auth/__init__.py | 5 +- DirectReport/browserview/auth/routes.py | 13 +- .../browserview/dashboard/__init__.py | 7 + DirectReport/browserview/dashboard/routes.py | 91 +++++++++++++ DirectReport/browserview/errors/__init__.py | 6 +- DirectReport/browserview/errors/handlers.py | 2 + DirectReport/browserview/main/__init__.py | 8 +- DirectReport/browserview/main/routes.py | 5 +- DirectReport/browserview/services/github.py | 8 +- .../static/js/account/accountcomponents.js | 47 +++---- .../static/js/teamreport/teamreport.js | 53 +++++--- .../js/teamreport/teamreportcomponents.js | 4 +- .../templates/components/_navigation.html | 6 +- .../templates/team/teamreport.html | 1 - DirectReport/config.py | 6 +- 20 files changed, 275 insertions(+), 129 deletions(-) create mode 100644 DirectReport/browserview/dashboard/__init__.py create mode 100644 DirectReport/browserview/dashboard/routes.py diff --git a/DirectReport/browserview/__init__.py b/DirectReport/browserview/__init__.py index 83fb0c3f..650c6a2a 100644 --- a/DirectReport/browserview/__init__.py +++ b/DirectReport/browserview/__init__.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python3 + import sys from pathlib import Path from flask import Flask, request @@ -13,7 +15,6 @@ package_root_directory = file.parents[1] sys.path.append(str(package_root_directory)) - client_id = appsecrets.GITHUB_CLIENT_ID client_secret = appsecrets.GITHUB_CLIENT_SECRET login_manager = LoginManager() @@ -57,12 +58,16 @@ def create_app(config_class=Config): from DirectReport.browserview.api import bp as api_bp - app.register_blueprint(api_bp) + app.register_blueprint(api_bp, url_prefix='/api') from DirectReport.browserview.errors import bp as errors_bp app.register_blueprint(errors_bp) + from DirectReport.browserview.dashboard import bp as dashboard_bp + + app.register_blueprint(dashboard_bp, url_prefix='/dashboard') + app.secret_key = appsecrets.SECRET_KEY login_manager.init_app(app) app.config.from_object(config_class) diff --git a/DirectReport/browserview/api/__init__.py b/DirectReport/browserview/api/__init__.py index 9f4b4680..8df0c8bd 100644 --- a/DirectReport/browserview/api/__init__.py +++ b/DirectReport/browserview/api/__init__.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python3 + from flask import Blueprint bp = Blueprint('api', __name__) diff --git a/DirectReport/browserview/api/auth.py b/DirectReport/browserview/api/auth.py index ef3ea331..f673e2d0 100644 --- a/DirectReport/browserview/api/auth.py +++ b/DirectReport/browserview/api/auth.py @@ -1,7 +1,6 @@ -import sqlalchemy as sa -from flask_httpauth import HTTPBasicAuth, HTTPTokenAuth +#!/usr/bin/env python3 -# from app import db +from flask_httpauth import HTTPBasicAuth, HTTPTokenAuth from DirectReport.models.user_model import UserModel from DirectReport.browserview.api.errors import error_response diff --git a/DirectReport/browserview/api/errors.py b/DirectReport/browserview/api/errors.py index c8ae2e77..24ff47c1 100644 --- a/DirectReport/browserview/api/errors.py +++ b/DirectReport/browserview/api/errors.py @@ -1,5 +1,8 @@ +#!/usr/bin/env python3 + from werkzeug.http import HTTP_STATUS_CODES from werkzeug.exceptions import HTTPException + from DirectReport.browserview.api import bp diff --git a/DirectReport/browserview/api/reports.py b/DirectReport/browserview/api/reports.py index b25b1aad..4a04391e 100644 --- a/DirectReport/browserview/api/reports.py +++ b/DirectReport/browserview/api/reports.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python3 + from flask import render_template, request, json from flask_login import login_required, current_user @@ -9,75 +11,74 @@ from DirectReport.browserview.api import bp -@bp.route("/report", methods=['GET', 'POST']) -@login_required -def report(): - prompt = "" - prompt = request.get_json()["prompt"] - client = GithubClient() - # print(prompt) - user_repos = client.get_user_repos("chriswebb09") - repodata = [] - for repo in user_repos: - # print(repo) - # print("\n") - repodata.append(repo["name"]) - log_item = "Adrian Prantl (67):\n add mangling testcase\n Debug Info: Represent private discriminators in DWARF.\n Revert \"Debug Info: Represent private discriminators in DWARF.\n Debug Info: Represent private discriminators in DWARF.\n Un-XFAIL and update test.\n Move the logic for ignoring the debug locations for closure setup code into SILGen. NFC-ish.\n Debug Info: Associate a function call with the beginning of the expression.\n Debug Info / SILGen: fix the source location of variable assignments\n typo\n Fix the debug locations of inserted operations in AvailableValueAggregator.\n Don't emit shadow copies for anonymous variables.\n Remove dead API IRGenDebugInfo::setArtificialTrapLocation().\n Use compiler-generated location for func.-sig.-spec. thunks\n whitespace\n Fix the missing inlined-at field of function-level SILDebugScopes.\n Add debug info support for inlined and specialized generic variables.\n Revert Add debug info support for inlined and specialized generic variables.\n Add debug info support for inlined and specialized generic variables.\n Update mangling prefix in Mangling.rst\n Add initial support for debug info for coroutine allocas.\n Temporarily disable failing test case, rdar://problem/43340064\n Add build-script support for the Swift LLDB backwards-compatibility tests.\n Remove accidentally committed debugging code\n Deserialize Swift compatibility version in CompilerInvocation::loadFromSerializedAST()\n SILGen: Preserve function argument debug info for arguments needing alloc_stack\n Use as the filename for SILLocation-less functions to avoid misleading source locatio\nns in backtraces.\n Add a -verify-linetable LLVM option.\n Enable debug info for inlined generics by default. It works now.\n Fix nonasserts compilation\n\nAhmad Alhashemi (5):\n [Parser] Detect nonbreaking space U+00A0 and fixit\n Move non-breaking space handling to lexUnknown\n Add more non-breaking space test cases\n Minor style edits\n Add tests for non-breaking space detect and fix-it\n\nAkshay Shrimali (1):\n Update README.md\n\nAlan Zeino (1):\n Fix typo in code example in libSyntax README\n\nAlbin Sadowski (1):\n Fix syntax highlighting in CHANGELOG (#15107)\n\nAlejandro (3):\n Remove a warning, some doc fixes (#16863)\n [SR-8178] Fix BinaryFloatingPoint.random(in:) open range returning upperBound (#17794)\n [Docs] Fix minor code typo in SILPro..Man..md\n\nAlex Blewitt (5):\n [SR-7032] Fix compare for lhs and rhs\n [SR-7036] Use || instead of && for kind comparison\n [SR-7041] Remove duplicate conditional check\n Remove duplicate verb\n [SR-7043] Remove duplicate if statement" - googleAi = GoogleAIClient() - response_data = googleAi.get_data_from(prompt).replace("\'", "\"") - response_data = response_data.replace('\n', " ") - data_json = json.loads(response_data) - data_json["broad_categories"] = { - "debug_info": 16, - "code_maintenance": 9, - "documentation": 7, - "test_related": 6, - "nonbreaking_space_handling": 5, - "readme_update": 1, - "syntax_fix": 1, - } - data_json["shortlog"] = client.parse_git_shortlog(log_item) - data_json["repos"] = repodata - ReportBuilder.new(data_json, prompt, current_user.id, "DirectReport") - return data_json, 201 - +# @bp.route("/report", methods=['GET', 'POST']) +# @login_required +# def report(): +# prompt = "" +# prompt = request.get_json()["prompt"] +# client = GithubClient() +# user_repos = client.get_user_repos("chriswebb09") +# repodata = [] +# for repo in user_repos: +# repodata.append(repo["name"]) +# log_item = "Adrian Prantl (67):\n add mangling testcase\n Debug Info: Represent private discriminators in DWARF.\n Revert \"Debug Info: Represent private discriminators in DWARF.\n Debug Info: Represent private discriminators in DWARF.\n Un-XFAIL and update test.\n Move the logic for ignoring the debug locations for closure setup code into SILGen. NFC-ish.\n Debug Info: Associate a function call with the beginning of the expression.\n Debug Info / SILGen: fix the source location of variable assignments\n typo\n Fix the debug locations of inserted operations in AvailableValueAggregator.\n Don't emit shadow copies for anonymous variables.\n Remove dead API IRGenDebugInfo::setArtificialTrapLocation().\n Use compiler-generated location for func.-sig.-spec. thunks\n whitespace\n Fix the missing inlined-at field of function-level SILDebugScopes.\n Add debug info support for inlined and specialized generic variables.\n Revert Add debug info support for inlined and specialized generic variables.\n Add debug info support for inlined and specialized generic variables.\n Update mangling prefix in Mangling.rst\n Add initial support for debug info for coroutine allocas.\n Temporarily disable failing test case, rdar://problem/43340064\n Add build-script support for the Swift LLDB backwards-compatibility tests.\n Remove accidentally committed debugging code\n Deserialize Swift compatibility version in CompilerInvocation::loadFromSerializedAST()\n SILGen: Preserve function argument debug info for arguments needing alloc_stack\n Use as the filename for SILLocation-less functions to avoid misleading source locatio\nns in backtraces.\n Add a -verify-linetable LLVM option.\n Enable debug info for inlined generics by default. It works now.\n Fix nonasserts compilation\n\nAhmad Alhashemi (5):\n [Parser] Detect nonbreaking space U+00A0 and fixit\n Move non-breaking space handling to lexUnknown\n Add more non-breaking space test cases\n Minor style edits\n Add tests for non-breaking space detect and fix-it\n\nAkshay Shrimali (1):\n Update README.md\n\nAlan Zeino (1):\n Fix typo in code example in libSyntax README\n\nAlbin Sadowski (1):\n Fix syntax highlighting in CHANGELOG (#15107)\n\nAlejandro (3):\n Remove a warning, some doc fixes (#16863)\n [SR-8178] Fix BinaryFloatingPoint.random(in:) open range returning upperBound (#17794)\n [Docs] Fix minor code typo in SILPro..Man..md\n\nAlex Blewitt (5):\n [SR-7032] Fix compare for lhs and rhs\n [SR-7036] Use || instead of && for kind comparison\n [SR-7041] Remove duplicate conditional check\n Remove duplicate verb\n [SR-7043] Remove duplicate if statement" +# googleAi = GoogleAIClient() +# response_data = googleAi.get_data_from(prompt).replace("\'", "\"") +# response_data = response_data.replace('\n', " ") +# data_json = json.loads(response_data) +# data_json["broad_categories"] = { +# "debug_info": 16, +# "code_maintenance": 9, +# "documentation": 7, +# "test_related": 6, +# "nonbreaking_space_handling": 5, +# "readme_update": 1, +# "syntax_fix": 1, +# } +# data_json["shortlog"] = client.parse_git_shortlog(log_item) +# data_json["repos"] = repodata +# ReportBuilder.new(data_json, prompt, current_user.id, "DirectReport") +# return data_json, 201 -@bp.route("/reports/new", methods=['GET', 'POST']) -@login_required -def team_report(): - if request.method == "POST": - json_data = request.get_json() - report_model = ReportModel(json_data["id"], json_data['summary'], json_data['created_at']) - print(report_model) - return render_template('team/teamreport.html', title='Team Report', data=[]) +# @bp.route("/reports/new", methods=['GET', 'POST']) +# @login_required +# def team_report(): +# if request.method == "POST": +# json_data = request.get_json() +# report_model = ReportModel(json_data["id"], json_data['summary'], json_data['created_at']) +# print(report_model) +# return render_template('team/teamreport.html', title='Team Report', data=[]) +# -@bp.route("/reports/", methods=['GET']) -@login_required -def get_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"]) - return render_template('team/teamreport.html', title='Team Report', teamData=report["report"]) +# @bp.route("/reports/", methods=['GET']) +# @login_required +# def get_report(uid=None): +# reports = ReportBuilder.get_reports_for_user_id(current_user.id) +# report = list(filter(lambda report: report["uuid"] == uid, reports))[0] +# return render_template('team/teamreport.html', title='Team Report', teamData=report["report"]) +# -@bp.route("/reports/list/new", methods=['GET']) +@bp.route("/reports/list", methods=['GET']) @login_required def get_list(): + print(current_user.id) reports = ReportBuilder.get_reports_for_user_id(current_user.id) return reports, 201 -@bp.route("/reports", methods=['GET', 'POST']) -@login_required -def list_entries(): - """ - Retrieves and renders the list of all entries. - :return: Rendered HTML template for the list page. - """ - reports = ReportBuilder.get_reports_for_user_id(current_user.id) - report_results = [] - for report in reports: - report_element = {"report": report} - report_results.append(report_element) - return render_template('list.html', title='List', data=report_results) +# +# @bp.route("/reports", methods=['GET', 'POST']) +# @login_required +# def list_entries(): +# """ +# Retrieves and renders the list of all entries. +# :return: Rendered HTML template for the list page. +# """ +# reports = ReportBuilder.get_reports_for_user_id(current_user.id) +# report_results = [] +# for report in reports: +# report_element = {"report": report} +# report_results.append(report_element) +# return render_template('list.html', title='List', data=report_results) diff --git a/DirectReport/browserview/auth/__init__.py b/DirectReport/browserview/auth/__init__.py index 5207fc5b..ec5df20c 100644 --- a/DirectReport/browserview/auth/__init__.py +++ b/DirectReport/browserview/auth/__init__.py @@ -1,4 +1,7 @@ +#!/usr/bin/env python3 + from flask import Blueprint -from DirectReport.browserview.auth import routes bp = Blueprint('auth', __name__) + +from DirectReport.browserview.auth import routes diff --git a/DirectReport/browserview/auth/routes.py b/DirectReport/browserview/auth/routes.py index 75c1abdd..5eaaa01d 100644 --- a/DirectReport/browserview/auth/routes.py +++ b/DirectReport/browserview/auth/routes.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python3 + from flask import render_template, request, redirect, url_for, flash from flask_login import login_user, login_required, logout_user, current_user from werkzeug.security import generate_password_hash @@ -43,7 +45,7 @@ def login(): if user and user.check_password(password): login_user(user, remember=remember, force=True) if current_user.is_authenticated(): - return redirect(url_for('auth.account')) + return redirect(url_for('dashboard.dashboard_home')) else: print("password no match") flash("Please check your login details and try again.") @@ -52,11 +54,10 @@ def login(): ) -# -@bp.route("/account", methods=['GET', 'POST']) -@login_required -def account(): - return render_template('account.html', title='Account', name=current_user.username, userid=current_user.id) +# @bp.route("/account", methods=['GET', 'POST']) +# @login_required +# def account(): +# return render_template('account.html', title='Account', name=current_user.username, userid=current_user.id) @bp.route("/account_data", methods=['GET']) diff --git a/DirectReport/browserview/dashboard/__init__.py b/DirectReport/browserview/dashboard/__init__.py new file mode 100644 index 00000000..45b78e25 --- /dev/null +++ b/DirectReport/browserview/dashboard/__init__.py @@ -0,0 +1,7 @@ +#!/usr/bin/env python3 + +from flask import Blueprint + +bp = Blueprint('dashboard', __name__) + +from DirectReport.browserview.dashboard import routes diff --git a/DirectReport/browserview/dashboard/routes.py b/DirectReport/browserview/dashboard/routes.py new file mode 100644 index 00000000..f0b2f38e --- /dev/null +++ b/DirectReport/browserview/dashboard/routes.py @@ -0,0 +1,91 @@ +#!/usr/bin/env python3 + +from datetime import datetime, timedelta +import requests +from flask import render_template, session, request, redirect, json +from flask_login import login_user, login_required, logout_user, 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.github import GoogleAIClient +from DirectReport.models.report.report_model import ReportModel +from DirectReport.datadependencies import appsecrets + +client_id = appsecrets.GITHUB_CLIENT_ID +client_secret = appsecrets.GITHUB_CLIENT_SECRET + + +@bp.route("/home", methods=['GET', 'POST']) +@login_required +def dashboard_home(): + return render_template('account.html', title='Account', name=current_user.username, userid=current_user.id) + + +@bp.route("/reports/saved", methods=['GET', 'POST']) +@login_required +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') + print(results) + # reports = ReportBuilder.get_reports_for_user_id(current_user.id) + # report_results = [] + # for report in reports: + # report_element = {"report": report} + # report_results.append(report_element) + # print(len(report_results)) + return render_template('list.html', title='List', data=results) + + +@bp.route("/reports/new", methods=['GET', 'POST']) +@login_required +def dashboard_reports_new(): + if request.method == "POST": + json_data = request.get_json() + report_model = ReportModel(json_data["id"], json_data['summary'], json_data['created_at']) + return render_template('team/teamreport.html', title='Team Report', data=[]) + + +@bp.route("/reports/update", methods=['GET', 'POST']) +@login_required +def dashboard_reports_update(): + prompt = "" + prompt = request.get_json()["prompt"] + client = GithubClient() + user_repos = client.get_user_repos("chriswebb09") + repodata = [] + for repo in user_repos: + repodata.append(repo["name"]) + log_item = "Adrian Prantl (67):\n add mangling testcase\n Debug Info: Represent private discriminators in DWARF.\n Revert \"Debug Info: Represent private discriminators in DWARF.\n Debug Info: Represent private discriminators in DWARF.\n Un-XFAIL and update test.\n Move the logic for ignoring the debug locations for closure setup code into SILGen. NFC-ish.\n Debug Info: Associate a function call with the beginning of the expression.\n Debug Info / SILGen: fix the source location of variable assignments\n typo\n Fix the debug locations of inserted operations in AvailableValueAggregator.\n Don't emit shadow copies for anonymous variables.\n Remove dead API IRGenDebugInfo::setArtificialTrapLocation().\n Use compiler-generated location for func.-sig.-spec. thunks\n whitespace\n Fix the missing inlined-at field of function-level SILDebugScopes.\n Add debug info support for inlined and specialized generic variables.\n Revert Add debug info support for inlined and specialized generic variables.\n Add debug info support for inlined and specialized generic variables.\n Update mangling prefix in Mangling.rst\n Add initial support for debug info for coroutine allocas.\n Temporarily disable failing test case, rdar://problem/43340064\n Add build-script support for the Swift LLDB backwards-compatibility tests.\n Remove accidentally committed debugging code\n Deserialize Swift compatibility version in CompilerInvocation::loadFromSerializedAST()\n SILGen: Preserve function argument debug info for arguments needing alloc_stack\n Use as the filename for SILLocation-less functions to avoid misleading source locatio\nns in backtraces.\n Add a -verify-linetable LLVM option.\n Enable debug info for inlined generics by default. It works now.\n Fix nonasserts compilation\n\nAhmad Alhashemi (5):\n [Parser] Detect nonbreaking space U+00A0 and fixit\n Move non-breaking space handling to lexUnknown\n Add more non-breaking space test cases\n Minor style edits\n Add tests for non-breaking space detect and fix-it\n\nAkshay Shrimali (1):\n Update README.md\n\nAlan Zeino (1):\n Fix typo in code example in libSyntax README\n\nAlbin Sadowski (1):\n Fix syntax highlighting in CHANGELOG (#15107)\n\nAlejandro (3):\n Remove a warning, some doc fixes (#16863)\n [SR-8178] Fix BinaryFloatingPoint.random(in:) open range returning upperBound (#17794)\n [Docs] Fix minor code typo in SILPro..Man..md\n\nAlex Blewitt (5):\n [SR-7032] Fix compare for lhs and rhs\n [SR-7036] Use || instead of && for kind comparison\n [SR-7041] Remove duplicate conditional check\n Remove duplicate verb\n [SR-7043] Remove duplicate if statement" + googleAi = GoogleAIClient() + response_data = googleAi.get_data_from(prompt) + print(response_data) + # ).replace("\'", "\"") + # response_data = response_data.replace('\n', " ") + # print(response_data) + # data_json = json.loads(response_data) + response_data["broad_categories"] = { + "debug_info": 16, + "code_maintenance": 9, + "documentation": 7, + "test_related": 6, + "nonbreaking_space_handling": 5, + "readme_update": 1, + "syntax_fix": 1, + } + response_data["shortlog"] = client.parse_git_shortlog(log_item) + response_data["repos"] = repodata + ReportBuilder.new(response_data, prompt, current_user.id, "DirectReport") + 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] + return render_template('team/teamreport.html', title='Team Report', teamData=report["report"]) diff --git a/DirectReport/browserview/errors/__init__.py b/DirectReport/browserview/errors/__init__.py index 485ca853..0dcbe8a7 100644 --- a/DirectReport/browserview/errors/__init__.py +++ b/DirectReport/browserview/errors/__init__.py @@ -1,5 +1,7 @@ -from flask import Blueprint -from DirectReport.browserview.errors import handlers +#!/usr/bin/env python3 +from flask import Blueprint bp = Blueprint('errors', __name__) + +from DirectReport.browserview.errors import handlers diff --git a/DirectReport/browserview/errors/handlers.py b/DirectReport/browserview/errors/handlers.py index b5619610..bd48e6a0 100644 --- a/DirectReport/browserview/errors/handlers.py +++ b/DirectReport/browserview/errors/handlers.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python3 + from flask import render_template, request from DirectReport.browserview.errors import bp from DirectReport.browserview.api.errors import error_response as api_error_response diff --git a/DirectReport/browserview/main/__init__.py b/DirectReport/browserview/main/__init__.py index c537d020..588405bb 100644 --- a/DirectReport/browserview/main/__init__.py +++ b/DirectReport/browserview/main/__init__.py @@ -1,5 +1,9 @@ +#!/usr/bin/env python3 + from flask import Blueprint -from DirectReport.browserview.main import routes -bp = Blueprint('main', __name__) +bp: Blueprint = Blueprint('main', __name__) + + +from DirectReport.browserview.main import routes diff --git a/DirectReport/browserview/main/routes.py b/DirectReport/browserview/main/routes.py index 59394b7e..756a9d10 100644 --- a/DirectReport/browserview/main/routes.py +++ b/DirectReport/browserview/main/routes.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python3 + from datetime import datetime, timedelta import requests @@ -181,6 +183,3 @@ def repo(reponame=None): client = GithubClient() repo = client.get_repo_issues("chriswebb09", reponame) return render_template('team/team.html', title='Team', data=repo) - - -# diff --git a/DirectReport/browserview/services/github.py b/DirectReport/browserview/services/github.py index 7c5c0d00..bc71f437 100644 --- a/DirectReport/browserview/services/github.py +++ b/DirectReport/browserview/services/github.py @@ -103,5 +103,9 @@ def query(self, prompt): def get_data_from(self, prompt): response = self.query(prompt) response_data = response["candidates"][0]["output"] - print(response_data) - return response_data + print("response: ") + # print(response_data.keys()) + data2 = json.loads(response_data) + print(data2) + # print(response_data) + return data2 diff --git a/DirectReport/browserview/static/js/account/accountcomponents.js b/DirectReport/browserview/static/js/account/accountcomponents.js index 1e9eabf8..adf45635 100644 --- a/DirectReport/browserview/static/js/account/accountcomponents.js +++ b/DirectReport/browserview/static/js/account/accountcomponents.js @@ -4,37 +4,40 @@ const { useState, useEffect } = React; const AccountUserInfo = (userData, reportData) => { return (
-
-
-
-
-

- ACCOUNT: {userData.name} +

+
+
+
+

+ ACCOUNT: {userData.name}

-

- EMAIL: {userData.userid} +

+ EMAIL: {userData.userid}

-

- USERNAME: {userData.username} +

+ USERNAME: {userData.username}

-

- NUMBER OF REPORTS SAVED: {reportData.length} +

+ NUMBER OF REPORTS SAVED: {reportData.length}

-
-
- + {/*
*/} +
+

Authorize + Github Account

+
-
-
+ {/**/} + {/*
*/} -
-
+ {/*
*/} + {/*
*/}
diff --git a/DirectReport/browserview/static/js/teamreport/teamreport.js b/DirectReport/browserview/static/js/teamreport/teamreport.js index 12d4f6b8..a1c1eeb7 100644 --- a/DirectReport/browserview/static/js/teamreport/teamreport.js +++ b/DirectReport/browserview/static/js/teamreport/teamreport.js @@ -48,10 +48,11 @@ class TeamReport extends React.Component { } handleSubmit() { - const payload = {prompt: commentText}; + const payload = {"prompt": this.state.commentText}; + console.log(payload); axios({ method: 'post', - url: '/report', + url: '/dashboard/reports/update', data: payload, headers: { "Accept": "application/json", @@ -77,6 +78,7 @@ class TeamReport extends React.Component { headers: {'content-type': 'application/json'} }).then(result => { this.setComments(result.data['result_log']) + const results = result.data['json_array'].map((commit) => { return { 'message': commit['commit']['message'], @@ -94,8 +96,8 @@ class TeamReport extends React.Component { } }) this.setCommits(results); - this.handleSubmit(); console.log(results) + this.handleSubmit(); }).catch(error => { console.log(error); }) @@ -151,7 +153,7 @@ class TeamReport extends React.Component { )} {this.state.commits.length > 0 && ( -
+
{this.state.commits.map((commit) => { return (
@@ -166,15 +168,15 @@ class TeamReport extends React.Component {
{this.props.repos.length > 0 && ( - )} {this.props.repos.length <= 0 && ( - )}
@@ -185,24 +187,41 @@ class TeamReport extends React.Component {

Summary

-
- {ShowSummary(this.state.reportData)} - {ShowHighlights(this.state.reportData)} -
+ {this.props.repos.length > 0 && ( +
+ {ShowSummary(this.state.reportData)} + {ShowHighlights(this.state.reportData)} +
+ )} +
-
+

Team

{PopoverUI(closePopover)} -
- {ShowTeamList(this.state.teamData)} -
+ {this.props.repos.length > 0 && ( +
+ {ShowTeamList(this.state.teamData)} +
+ + )} +
- + {this.props.repos.length <= 0 && ( +
+
+ )} + {this.props.repos.length > 0 && ( + + )} +
) } diff --git a/DirectReport/browserview/static/js/teamreport/teamreportcomponents.js b/DirectReport/browserview/static/js/teamreport/teamreportcomponents.js index 87a74b80..b0ae1fbd 100644 --- a/DirectReport/browserview/static/js/teamreport/teamreportcomponents.js +++ b/DirectReport/browserview/static/js/teamreport/teamreportcomponents.js @@ -38,10 +38,10 @@ const ShowHighlights = (report) => { const ShowTeamList = (team) => { return ( -
+
{team !== undefined ? team.map(team_member => - ) : null diff --git a/DirectReport/browserview/templates/components/_navigation.html b/DirectReport/browserview/templates/components/_navigation.html index 620fd4d0..b16e8098 100644 --- a/DirectReport/browserview/templates/components/_navigation.html +++ b/DirectReport/browserview/templates/components/_navigation.html @@ -13,13 +13,13 @@