From dd4f2609faa4acb5a6c3b62c64e84566fc9f013b Mon Sep 17 00:00:00 2001 From: chriswebb09 Date: Tue, 2 Jan 2024 04:04:50 -0500 Subject: [PATCH] fix ui issues --- DirectReport/browserview/dashboard/routes.py | 4 +++- DirectReport/browserview/services/github.py | 5 +++-- .../static/js/account/account_components.js | 17 +++++++++-------- .../static/js/teamreport/teamreport.js | 2 +- .../js/teamreport/teamreport_components.js | 1 - DirectReport/browserview/templates/account.html | 2 +- .../browserview/templates/team/teamreport.html | 2 +- 7 files changed, 18 insertions(+), 15 deletions(-) diff --git a/DirectReport/browserview/dashboard/routes.py b/DirectReport/browserview/dashboard/routes.py index 678923b8..bfc84a88 100644 --- a/DirectReport/browserview/dashboard/routes.py +++ b/DirectReport/browserview/dashboard/routes.py @@ -54,7 +54,9 @@ def dashboard_reports_update(): prompt = "" prompt = request.get_json()["prompt"] client = GithubClient() - user_repos = client.get_user_repos(current_user.github_username) + h_token = session['header_token'] + print(current_user.github_username) + user_repos = client.get_user_repos(current_user.github_username, h_token) repodata = [] for repo in user_repos: repodata.append(repo["name"]) diff --git a/DirectReport/browserview/services/github.py b/DirectReport/browserview/services/github.py index 50b74e97..648bc579 100644 --- a/DirectReport/browserview/services/github.py +++ b/DirectReport/browserview/services/github.py @@ -67,9 +67,9 @@ def get_pull_requests_count(self, repo_owner, repo_name): response.raise_for_status() return len(response.json()) - def get_user_repos(self, repo_owner): + def get_user_repos(self, repo_owner, token): url = f"https://api.github.com/users/{repo_owner}/repos?sort=updated&order=desc" - headers = {"Authorization": f"token {appsecrets.GITHUB_TOKEN}"} + headers = {"Authorization": f"token {token}"} response = requests.get(url, headers=headers) response.raise_for_status() return response.json() @@ -102,6 +102,7 @@ def query(self, prompt): def get_data_from(self, prompt): response = self.query(prompt) + print(response) response_data = response["candidates"][0]["output"] json_loaded = json.loads(response_data) return json_loaded diff --git a/DirectReport/browserview/static/js/account/account_components.js b/DirectReport/browserview/static/js/account/account_components.js index 54f6052b..e1fe8c5d 100644 --- a/DirectReport/browserview/static/js/account/account_components.js +++ b/DirectReport/browserview/static/js/account/account_components.js @@ -24,21 +24,22 @@ const AccountUserInfo = (userData, reportData) => { -
+

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

- LAST REPORT: DEC - 12, 2021 + LAST REPORT: + DEC 12, 2021

- GITHUB ACOUNT USERNAME: {userData.github_username} + GITHUB ACOUNT USERNAME: + {userData.github_username}

- SELECTED REPO: DirectReport + SELECTED REPO: + DirectReport

{this.state.teamData.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 80c4c678..f91c2a89 100644 --- a/DirectReport/browserview/static/js/teamreport/teamreport_components.js +++ b/DirectReport/browserview/static/js/teamreport/teamreport_components.js @@ -1,6 +1,5 @@ const { useState, useEffect } = React; - const ShowSummary = ({ report }) => { return (

diff --git a/DirectReport/browserview/templates/account.html b/DirectReport/browserview/templates/account.html index 4b83f824..cf60cebf 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 b8f6aebe..fe79c19b 100644 --- a/DirectReport/browserview/templates/team/teamreport.html +++ b/DirectReport/browserview/templates/team/teamreport.html @@ -6,7 +6,7 @@ {% block content %}
-
+