Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
chriswebb09 committed Dec 18, 2023
1 parent 7def27a commit e4e8b0c
Show file tree
Hide file tree
Showing 16 changed files with 67 additions and 98 deletions.
2 changes: 1 addition & 1 deletion DirectReport/browserview/blueprints/auth/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def account_data():
"lastname": current_user.lastname,
"userid": current_user.id,
"username": current_user.username,
"email": current_user.email,
"email": current_user.email
}
user_element = {"user": user_account, "reports": report_results, "shortlog": shortlog}
return user_element, 201
2 changes: 1 addition & 1 deletion DirectReport/browserview/blueprints/reports/reportbp.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def report():
}
data_json["shortlog"] = client.parse_git_shortlog(log_item)
data_json["repos"] = repodata
ReportBuilder.new(data_json, prompt, current_user.id)
ReportBuilder.new(data_json, prompt, current_user.id, "DirectReport")
return data_json, 201


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ 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="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)]">
Expand Down
4 changes: 2 additions & 2 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 Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const { useState, useEffect } = React;

const ListApp = () => {
const SavedReportListApp = () => {

const [listData, setListData] = useState([]);
const [loading, setLoading] = useState(true);
Expand Down Expand Up @@ -37,7 +37,7 @@ const ListApp = () => {
if (listData.length > 0) {
return (
<div>
<EntryList name="Entry List" listdata={listData}/>
<SavedReportList name="Entry List" listdata={listData}/>
</div>
)
} else {
Expand All @@ -51,4 +51,4 @@ const ListApp = () => {
}

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

class EntryList extends React.Component {
class SavedReportList extends React.Component {
render() {
return (
<div className="grid grid-cols-3 gap-1 mb-20 mx-20">
<h1 className="col-span-3 text-2xl text-blue-800 text-left font-bold font-mono mb-4 mx-10">
Saved Reports
<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>
{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">{'Topic: ' + item.user_id}</h2>
<p className="mt-3 text-sm text-justify line-clamp-5 text-gray-500">{'Entry: ' + item.raw_input}</p>
</div>
</a>
</article>
</div>
)}
<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>
);
}
Expand Down
1 change: 1 addition & 0 deletions DirectReport/browserview/static/js/note.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ function jsonEscape(str) {
}
class ReportItem extends React.Component {
render() {

console.log(this.props.report["summary"])
console.log(this.props.report["areas_of_focus"])
console.log(this.props.report["total_commits"])
Expand Down
42 changes: 15 additions & 27 deletions DirectReport/browserview/static/js/teamreport/teamreport.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,42 +77,31 @@ const TeamReport = () => {
document.getElementById('popoverCommits').innerHTML = "Commits: " + teammember.commits;
}

const openRepoPopover = (e: ChangeEvent<HTMLInputElement>) => {
const element = document.getElementById('formUI');
const openRepoPopover = (e: ChangeEvent<HTMLInputElement>) => {
const element = document.getElementById('h1content');
Popper.createPopper(element, document.getElementById('popover-repo-left-purple'), {
strategy: 'fixed',
modifiers: [{
name: "offset", // offsets popper from the reference/button
options: {
offset: [0, 8]
}
}, {
name: "flip", // flips popper with allowed placements
options: {
allowedAutoPlacements: ["right", "left", "top", "bottom"],
rootBoundary: "viewport"
}
}]
strategy: 'fixed'
});
document.getElementById('popover-repo-left-purple').classList.toggle("hidden");
document.getElementById('popover-repo-TitleContent').innerHTML = "Repos" + "(" + teamData["repos"].length + ")";
var list = '<ul className="px-30 py-30">';
var list = '<ul>';
for (var i = 0; i < teamData["repos"].length; i++) {
list += '<li>' + '<a href=/repo/' + teamData["repos"][i] + '>' + teamData["repos"][i] + '' + '</li>';
list += '<li class="px-1 py-2 border-b border-solid border-blueGray-100 hover:bg-gray-400">' + '<a className="px-8 py-10" href=/repo/' + teamData["repos"][i] + '>' + teamData["repos"][i] + '' + '</li>';
}
list += '</ul>';
document.getElementById('popover-repo-Content').innerHTML = list;
}

const repoPopoverUI = () => {
return (
<div className="hidden bg-indigo-600 border-0 mr-3 block z-50 font-normal leading-normal text-sm max-w-xs text-left no-underline break-words rounded-lg" id="popover-repo-left-purple" style={{zIndex: -1}}>
<div className="hidden bg-indigo-600 border-0 mx-3 block z-50 font-normal leading-normal text-sm max-w-xs text-left no-underline break-words rounded-2xl h-58" id="popover-repo-left-purple" style={{zIndex: 2}}>
<div>
<div id="popover-repo-Title" className="bg-indigo-600 text-white opacity-75 font-semibold p-3 mb-0 border-b border-solid border-blueGray-100 uppercase rounded-t-lg py-3">
<div id="popover-repo-Title" className="bg-indigo-600 text-white opacity-75 font-semibold p-3 mb-0 border-b border-solid border-blueGray-100 uppercase rounded-t-2xl py-3">
<span id="popover-repo-TitleContent"></span>
<button className="float-right" onClick={closeRepoPopover}>X</button>
</div>
<div id="popover-repo-Content" className="text-white px-6 py-4"></div>
<div id="popover-repo-Content" className="text-white px-6 py-4 h-2/3 overflow-y-scroll h-28"></div>
<div id="profile-repo-Button" className="text-white px-6 py-4"></div>
{/*<div id="profile-repo-Button" className="text-white px-6 py-4 border-t border-solid border-blueGray-100">*/}
{/*</div>*/}
</div>
Expand All @@ -134,9 +123,9 @@ const TeamReport = () => {

const FormDiv = (handleSubmit, openRepoPopover, commentText) => {
return (
<div className="py-1 bg-blue-500 rounded-3xl px-30 shadow-[1.0px_1.0px_2.0px_1.0px_rgba(0,0,0,0.58)]">
<form onSubmit={handleSubmit} className="w-97 sm:w-97">
<h1 className="self-center text-center text-white text-xl text-center font-semibold font-mono mb-1 mt-3">Enter
<div className="py-1 bg-blue-500 rounded-3xl px-20 shadow-[1.0px_1.0px_2.0px_1.0px_rgba(0,0,0,0.58)]">
<form onSubmit={handleSubmit}>
<h1 id="title_element" className="self-center text-center text-white text-xl text-center font-semibold font-mono mb-1 mt-3">Enter
Github Data
</h1>
<div className="self-center mb-4 mt-2">
Expand All @@ -159,13 +148,12 @@ const TeamReport = () => {

return (
<div>
<h1 className="self-center text-center text-2xl text-blue-800 text-center font-bold font-mono pt-3 pb-2 mb-2 pt-4 mx-10 px-20">
<h1 id="h1content" className="self-center text-center text-2xl text-blue-800 text-center font-bold font-mono pt-10 pb-2 mb-2 pt-8 mx-30 px-20">
Generate Team Report From Metadata
</h1>
{/*{repoPopoverUI()}*/}
<div id="topRow" className="grid grid-cols-3 gap-8 rounded-3xl mx-10 mt-6">
{repoPopoverUI()}
<div id="topRow" className="grid grid-cols-3 gap-10 rounded-3xl mx-20 mt-6">
<div className="lg:col-span-1 sm:col-span-3 justify-center" id="edit_summary_div">
{/*<FormDiv handleSum/>*/}
{FormDiv(handleSubmit, openRepoPopover, commentText)}
</div>
<div id="show_summmary_div" className="lg:col-span-1 sm:col-span-3 justify-center">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const ShowHighlights = (report) => {
<ul className="px-2 pt-2 pb-2">
{report["highlights"] && report["highlights"].map(hightlight =>
<li className="mt-1 mb-3">
<h3 className="font-bold text-sm mb-1 mt-1 text-blue-700">
<h3 className="font-bold text-xs mb-1 mt-1 text-blue-700">
{hightlight.title}
</h3>
<p class="w-90 sm:w-90 overflow-y-auto text-xs font-sm break-words tracking-wide text-blue-600">
Expand Down Expand Up @@ -47,20 +47,20 @@ const ShowTeamList = (team, openPopover) => {
class GraphDiv extends React.Component {
render() {
return (
<div className="grid grid-cols-3 gap-6 mt-5 mx-10 bg-blue-500 shadow-[1.0px_1.0px_5.0px_0.0px_rgba(0,0,0,0.58)] rounded-3xl px-30 py-3">
<div className="grid grid-cols-3 gap-6 mt-5 mx-20 bg-blue-500 shadow-[1.0px_1.0px_5.0px_0.0px_rgba(0,0,0,0.58)] rounded-3xl px-30 py-3">
<div className="lg:col-span-1 sm:col-span-3 justify-center mt-7 mb-7 bg-white shadow-[1.0px_1.0px_6.0px_0.0px_rgba(0,0,0,0.58)] rounded-3xl px-30 ml-10" id="dd">
<div className="col-span-1 flex justify-center my-2 px-3" id="data_display_div">
<div id="map-container" className="pl-10 pr-5"></div>
<div id="map-container" className="pl-10 pr-5 rounded-3xl"></div>
</div>
</div>
<div className="lg:col-span-1 sm:col-span-3 justify-center mt-7 mb-7 bg-white shadow-[1.0px_1.0px_6.0px_0.0px_rgba(0,0,0,0.58)] rounded-3xl px-30 mx-6" id="dd">
<div className="col-span-1 justify-center my-2 px-3" id="data_display_div-r">
<div id="map-container2" className="pl-5 pr-5"></div>
<div id="map-container2" className="pl-5 pr-5 rounded-3xl"></div>
</div>
</div>
<div className="lg:col-span-1 sm:col-span-3 justify-center mt-7 mb-7 bg-white shadow-[1.0px_1.0px_6.0px_0.0px_rgba(0,0,0,0.58)] rounded-3xl px-30 mr-10" id="dd">
<div className="col-span-1 justify-center my-2 px-3" id="data_display_div-rr">
<div id="map-container3" className="pl-5 pr-10"></div>
<div id="map-container3" className="pl-5 pr-10 rounded-3xl"></div>
</div>
</div>
</div>
Expand Down
22 changes: 4 additions & 18 deletions DirectReport/browserview/templates/_navigation.html
Original file line number Diff line number Diff line change
@@ -1,23 +1,9 @@


{#<nav class="bg-gray-900 text-white w-screen">#}
{# <div class="px-14 py-6 flex w-full items-center">#}
{# <a class="ml-14 w-3/4 text-xl font-bold" href="/">DirectReport.</a>#}
{# <ul class="flex pl-2 pr-12 ml-14 font-semibold font-heading space-x-18">#}
{# {% if current_user.is_authenticated %}#}
{# <li><a class="px-12 text-md hover:text-gray-200" href="/account">Account</a></li>#}
{# {% else %}#}
{# <li><a class="px-12 text-md hover:text-gray-200" href="/login">Login</a></li>#}
{# {% endif %}#}
{# </ul>#}
{# </div>#}
{#</nav>#}

<nav class="px-8 bg-gray-900 text-white ">
<nav class="bg-gray-900 text-white ">
<div class="flex w-full items-center">
<a class="ml-14 w-3/4 text-2xl font-bold" href="/">DirectReport.</a>
<a class="ml-20 w-3/4 text-2xl font-bold" href="/">DirectReport.</a>
<div class="dropdown inline-block relative px-20">
<button class="text-white font-semibold inline-flex mt-2 pt-5 pb-5 pl-4 pr-0 hover:border-gray-200">
<button class="text-white font-semibold inline-flex mt-2 pt-5 pb-5 pl-2 pr-0 hover:border-gray-200">
{% if current_user.is_authenticated %}
<span class="mr-8 ml-8 text-md hover:text-gray-200">Account</span>
{% else %}
Expand All @@ -27,7 +13,7 @@
<ul class="dropdown-menu absolute hidden text-gray-700">
{% if current_user.is_authenticated %}
<li class="">
<a class="bg-gray-900 hover:bg-gray-400 py-5 pl-8 pr-8 block whitespace-no-wrap text-white border-b-2 border-t-2 border-gray-200" href="/account">Dash</a>
<a class="bg-gray-900 hover:bg-gray-400 py-5 pl-8 pr-8 block whitespace-no-wrap text-white border-b-2 border-t-2 border-gray-200" href="/account">Dashboard</a>
</li>
<li class="">
<a class="bg-gray-900 hover:bg-gray-400 py-5 pl-8 pr-8 block whitespace-no-wrap text-white border-b-2 border-gray-200" href="/teamreport">New Report</a>
Expand Down
4 changes: 2 additions & 2 deletions DirectReport/browserview/templates/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
{% block content %}
<main>
<div id="root" class='mt-18 pt-10 mb-20 md:max-lg:flex content-start'></div>
<script type="text/babel" src="{{url_for('static', filename='js/list.js')}}"></script>
<script type="text/babel" src="{{url_for('static', filename='js/listcomponents.js')}}"></script>
<script type="text/babel" src="{{url_for('static', filename='js/list/list.js')}}"></script>
<script type="text/babel" src="{{url_for('static', filename='js/list/listcomponents.js')}}"></script>
<script type="text/babel" src="{{url_for('static', filename='js/entryform.js')}}"></script>
</main>
{% endblock %}
2 changes: 1 addition & 1 deletion DirectReport/browserview/templates/team/teamreport.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

{% block content %}
<main className="">
<div id="root" class='md:max-lg:flex content-start bg-slate-200 pb-[120px]'></div>
<div id="root" class='bg-slate-200 mx-50 pb-[120px]'></div>
<script type="text/babel" src="{{url_for('static', filename='js/teamreport/teamreportcomponents.js')}}"></script>
<script type="text/babel" src="{{url_for('static', filename='js/chart_helper.js')}}"></script>
<script type="text/babel" src="{{url_for('static', filename='js/teamreport/teamreport.js')}}"></script>
Expand Down
5 changes: 4 additions & 1 deletion DirectReport/models/Report/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class Report:
A class to represent a journal entry.
"""

def __init__(self, uuid, user_id, raw_input, report, created_at):
def __init__(self, uuid, user_id, raw_input, report, repo_name, created_at):
"""
Initialize the Entry object.
:param uuid: A unique identifier for the entry.
Expand All @@ -23,6 +23,7 @@ def __init__(self, uuid, user_id, raw_input, report, created_at):
self.user_id = user_id
self.raw_input = raw_input
self.report = report
self.repo_name = repo_name
self.created_at = created_at

def get_created_at_formatted(self, date_format="%Y-%m-%d %H:%M:%S"):
Expand All @@ -46,6 +47,7 @@ def to_dict(self):
"user_id": self.user_id,
"raw_input": self.raw_input,
"report": self.report,
"repo_name": self.repo_name,
"created_at": str(self.created_at),
}

Expand All @@ -62,6 +64,7 @@ def from_dict(cls, data):
user_id = data.get("user_id")
raw_input = data.get("raw_input")
report = data.get("report")
repo_name = data.get("repo_name")
created_at = datetime.datetime.fromisoformat(data.get("created_at")).timestamp()
return cls(uuid, user_id, raw_input, report, created_at)

Expand Down
4 changes: 2 additions & 2 deletions DirectReport/models/Report/report_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def __init__(self):
pass

@staticmethod
def new(report, raw_input, user_id):
def new(report, raw_input, user_id, repo_name):
"""
Creates a new entry with the given entry text and topic.
:param entry_text: The entry text.
Expand All @@ -27,7 +27,7 @@ def new(report, raw_input, user_id):
storage.create_table()
if report is None or report == '':
report = "Entry for work on " + str(today)
new_report = Report(str(uuid.uuid1()), user_id, raw_input, report, datetime.datetime.now().timestamp())
new_report = Report(str(uuid.uuid1()), user_id, raw_input, report, repo_name, datetime.datetime.now().timestamp())
storage.add_report(new_report)

@staticmethod
Expand Down
Loading

0 comments on commit e4e8b0c

Please sign in to comment.