Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev branch #52

Merged
merged 5 commits into from
Dec 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions DirectReport/browserview/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
from flask import Flask, render_template, request, redirect, json, url_for
from flask_login import LoginManager, login_required, current_user

from DirectReport.browserview.github import GithubClient
from DirectReport.browserview.prompt_logic import generate_email
from DirectReport.browserview.services.github import GithubClient
from DirectReport.browserview.services.prompt_logic import generate_email
from DirectReport.datadependencies import appsecrets
from DirectReport.models.user_model import UserModel
from .auth.auth import auth
from .reportbp import reportsbp
from DirectReport.browserview.blueprints.auth.auth import auth
from DirectReport.browserview.blueprints.reports.reportbp import reportsbp

file = Path(__file__).resolve()
package_root_directory = file.parents[1]
Expand Down Expand Up @@ -100,8 +100,7 @@ def generateemail():
def repo(reponame=None):
client = GithubClient()
repo = client.get_repo_issues("chriswebb09", reponame)
print(repo)
return render_template('team/team.html', title='Team', data=[])
return render_template('team/team.html', title='Team', data=repo)


if __name__ == "__main__":
Expand Down
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
from DirectReport.models.user_model import UserModel
from flask_login import login_user, login_required, logout_user, current_user
from DirectReport.browserview import app
from DirectReport.models.report_builder import ReportBuilder
from DirectReport.browserview.github import GithubClient
from DirectReport.models.Report.report_builder import ReportBuilder
from DirectReport.browserview.services.github import GithubClient

auth = Blueprint('auth', __name__)

Expand Down
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@
from flask import render_template, request, json
from flask_login import login_required, current_user

from DirectReport.browserview.github import GithubClient
from DirectReport.browserview.github import GoogleAIClient
from DirectReport.models.entry_storage import EntryStorage
from DirectReport.models.list_builder import ListBuilder
from DirectReport.models.report_builder import ReportBuilder
from DirectReport.models.report_model import ReportModel
from DirectReport.browserview.services.github import GithubClient
from DirectReport.browserview.services.github import GoogleAIClient
from DirectReport.models.Report.report_builder import ReportBuilder
from DirectReport.models.Report.report_model import ReportModel

reportsbp = Blueprint('reportsbp', __name__)

Expand Down Expand Up @@ -56,35 +54,13 @@ def team_report():
return render_template('team/teamreport.html', title='Team Report', data=[])


@reportsbp.route('/entry/<uid>', methods=['GET', 'POST'])
@login_required
def detail(uid=None):
"""
Retrieves and renders the details of a specific entry.

:param uid: The ID of the entry to display.
:return: Rendered HTML template for the entry details page.
"""
reports = ReportBuilder.get_reports_for_user_id(current_user.id)
report = list(filter(lambda report: report["uuid"] == uid, reports))[0]
json.loads(json.dumps(report))
item = EntryStorage('SQLite_Python.db')
if request.method == "POST":
json_data = request.get_json()
ListBuilder.update(
json_data["id"], json_data['entry'], json_data['topic'], json_data['created_at'], json_data['week_id']
)
entry = item.get_entry(uid).to_dict()
print(entry)
return render_template('detail.html', title='Detail', data=entry)


@reportsbp.route("/getreport/<uid>", 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 report, 201
print(report["report"])
return render_template('team/teamreport.html', title='Team Report', teamData=report["report"])


@reportsbp.route("/getlist", methods=['GET'])
Expand Down
Empty file.
Original file line number Diff line number Diff line change
@@ -1,35 +1,6 @@

const { useState, useEffect } = React;

const AccountUserInfo = (userData, reportData) => {
return (
<div className="lg:col-span-3 md:col-span-1 sm:col-span-3 justify-center">
<div className="grid grid-flow-col gap-10 shadow-lg self-center bg-blue-200 py-6 px-5 my-2 shadow-lg rounded-3xl">
<div className="col-span-1 py-6 bg-blue-50 rounded-3xl">
<div className="bg-blue-50 rounded-2xl pl-20">
<h1 className="text-left pl-5">
<span className="pr-4 font-semibold">Account: </span>{userData.name}
</h1>
<h1 className="text-left pl-5 pt-1">
<span className="pr-10 font-semibold">Email: </span> {userData.userid}
</h1>
</div>
</div>
<div className="col-span-1 py-6 bg-blue-50 rounded-3xl">
<div className="bg-blue-50 rounded-2xl pl-20">
<p className="text-left pl-4 pt-1">
<span className="pr-11 font-semibold">Username: </span> {userData.username}
</p>
<p className="text-left pl-4 pt-1">
<span className="pr-4 font-semibold">Number of reports saved: </span> {reportData.length}
</p>
</div>
</div>
</div>
</div>
)
}

const Account = () => {
const [userData, setUserData] = useState({});
const [actualData, setActualData] = useState({});
Expand Down Expand Up @@ -68,7 +39,7 @@ const Account = () => {
)
} else {
return (
<div className="mx-50 content-center mt-0 mb-48 h-150">
<div className="mx-30 content-center mt-0 mb-48 h-150">
<div className="pt-5 pb-3 mt-0 mb-5 ml-20 px-20">
<h1 className="text-2xl text-blue-800 text-left font-bold font-mono pt-5">
User Account
Expand All @@ -83,5 +54,7 @@ const Account = () => {
}
};



const domContainer = document.querySelector('#root');
ReactDOM.render(<Account/>, domContainer);
33 changes: 33 additions & 0 deletions DirectReport/browserview/static/js/account/accountcomponents.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@

const { useState, useEffect } = React;

const AccountUserInfo = (userData, reportData) => {
return (
<div className="lg:col-span-3 md:col-span-1 sm:col-span-1 sm:col-span-3 justify-center">
<div className="bg-blue-500 py-10 px-14 my-2 shadow-[1.0px_1.0px_5.0px_0.0px_rgba(0,0,0,0.58)] rounded-3xl">
<div className="grid grid-flow-col gap-10 self-center bg-blue-200 py-10 px-15 my-6 shadow-[1.0px_1.0px_5.0px_0.0px_rgba(0,0,0,0.58)] rounded-3xl">
<div className="col-span-1 ml-10 py-10 px-15 bg-blue-50 rounded-3xl shadow-[1.0px_1.0px_5.0px_0.0px_rgba(0,0,0,0.58)]">
<div className="bg-blue-50 rounded-2xl pl-10">
<h1 className="text-left pl-10">
<span className="pl-4 font-semibold">Account: </span> {userData.name}
</h1>
<h1 className="text-left pl-10 pt-1">
<span className="pl-4 font-semibold">Email: </span> {userData.userid}
</h1>
</div>
</div>
<div className="col-span-1 mr-10 py-8 bg-blue-50 rounded-3xl shadow-[1.0px_1.0px_5.0px_0.0px_rgba(0,0,0,0.58)]">
<div className="bg-blue-50 rounded-2xl pl-10">
<p className="text-left pl-4 ml-10 pt-1">
<span className="pr-11 font-semibold">Username: </span> {userData.username}
</p>
<p className="text-left pl-4 ml-10 pt-1">
<span className="pr-4 font-semibold">Number of reports saved: </span> {reportData.length}
</p>
</div>
</div>
</div>
</div>
</div>
)
}
6 changes: 3 additions & 3 deletions DirectReport/browserview/static/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class Home extends React.Component {
React.createElement(
'div',
{
className: "py-20 flex h-50",
className: "pt-20 pb-20 flex h-50",
style: {background: "linear-gradient(90deg, #667eea 0%, #764ba2 100%)"}
},
React.createElement(
Expand All @@ -20,7 +20,7 @@ class Home extends React.Component {
React.createElement(
"h2",
{
className: "mt-1 text-3xl font-bold mb-3 text-white"
className: "text-3xl font-bold mb-3 text-white"
},
"DirectReport."
),
Expand All @@ -39,7 +39,7 @@ class Home extends React.Component {
React.createElement(
"a",
{
className: "my-14 px-10 py-5 text-md font-bold tracking-wide text-center text-indigo-500 bg-white rounded-full hover:bg-blue-800 hover:text-white shadow-lg uppercase",
className: "my-14 px-10 py-5 text-md font-bold tracking-wide text-center text-indigo-500 bg-white rounded-full hover:bg-blue-800 hover:text-white shadow-[1.0px_1.0px_5.0px_0.0px_rgba(0,0,0,0.58)] uppercase",
href: "/account"
},
"Get Started"
Expand Down
92 changes: 0 additions & 92 deletions DirectReport/browserview/static/js/list.js

This file was deleted.

54 changes: 54 additions & 0 deletions DirectReport/browserview/static/js/list/list.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
const { useState, useEffect } = React;

const SavedReportListApp = () => {

const [listData, setListData] = useState([]);
const [loading, setLoading] = useState(true);
const [error, setError] = useState(null);

useEffect(() => {
fetch(`/getlist`)
.then((response) => {
if (!response.ok) {
throw new Error(
`This is an HTTP error: The status is ${response.status}`
);
}
return response.json();
})
.then((actualData) => {
setListData(actualData);
setError(null);
})
.catch((err) => {
setError(err.message);
setListData(null)
})
.finally(() => {
setLoading(false);
});
}, []);

if (loading) {
return (
<div>{`There is a problem fetching the post data - ${error}`}</div>
)
} else {
if (listData.length > 0) {
return (
<div>
<SavedReportList name="Entry List" listdata={listData}/>
</div>
)
} else {
return (
<div>
<EmptyEntryList/>
</div>
)
}
}
}

const domContainer = document.querySelector("#root");
ReactDOM.render(<SavedReportListApp/>, domContainer);
40 changes: 40 additions & 0 deletions DirectReport/browserview/static/js/list/listcomponents.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
const { useState, useEffect } = React;

class SavedReportList extends React.Component {
render() {
return (
<div className="mx-20 pb-10">
<h1 className="text-2xl text-blue-800 text-left font-bold font-mono mb-4 mx-10">
Saved Reports
</h1>
<div className="grid grid-cols-3 gap-1 mb-20 mx-10">
{this.props.listdata.map(item =>
<div className="col-span-1 justify-center mt-3 mb-3">
<article className="mx-4 mt-2 w-90 rounded-2xl border border-gray-200 p-1 shadow-lg transition hover:shadow-xl">
<a className="block rounded-xl bg-white p-1 sm:p-6 lg:p-8" href={'/getreport/' + item.uuid}>
<div className="mt-1">
<h2 className="text-2xl font-bold text-gray-800 sm:text-xl">{'User: ' + item.user_id}</h2>
<p className="mt-3 text-sm text-justify line-clamp-3 text-gray-500">{'Raw Input: ' + item.raw_input}</p>
</div>
</a>
</article>
</div>
)}
</div>
</div>
);
}
}

class EmptyEntryList extends React.Component {
render() {
return (
<div className="mx-50 content-center mt-20 my-28 h-150">
<div className="flex flex-col justify-center my-6 mx-60">
<h1 className="self-center text-3xl text-gray-700 text-center font-bold">Add New Entry</h1>
<EntryForm/>
</div>
</div>
);
}
}
Loading
Loading