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 #54

Merged
merged 2 commits into from
Dec 20, 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
30 changes: 18 additions & 12 deletions DirectReport/browserview/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,13 @@

@app.route('/authorize/github')
def oauth2_authorize():
github_url = "https://github.com/login/oauth/authorize?scope=user:email&client_id=" + client_id + "&client_secret=" + client_secret + "&redirect_uri=http%3A%2F%2F127.0.0.1%3A5000%2Fcallback%2Fgithub"
github_url = (
"https://github.com/login/oauth/authorize?scope=user:email&client_id="
+ client_id
+ "&client_secret="
+ client_secret
+ "&redirect_uri=http%3A%2F%2F127.0.0.1%3A5000%2Fcallback%2Fgithub"
)
return redirect(github_url)


Expand All @@ -62,6 +68,7 @@ def get_commits_last_month():
print(f"Error: {response.status_code}")
print(response.text)


@app.route('/repo', methods=['GET', 'POST'])
def reponame():
args_url = request.args.get('repo_url')
Expand All @@ -70,13 +77,9 @@ def reponame():
headers443 = {
'Accept': 'application/vnd.github+json',
'Authorization': 'Bearer ' + h_token,
'X-GitHub-Api-Version': '2022-11-28'
'X-GitHub-Api-Version': '2022-11-28',
}
response3 = requests.get(
url=reponame,
headers=headers443,
auth=(client_id, client_secret)
)
response3 = requests.get(url=reponame, headers=headers443, auth=(client_id, client_secret))
json_Data3 = json.loads(response3.content)

USERNAME = "chriswebb09"
Expand Down Expand Up @@ -120,13 +123,13 @@ def reponame():
"verified": commit["commit"]["verification"]["verified"],
"verification_reason": commit["commit"]["verification"]["reason"],
"verification_signature": commit["commit"]["verification"]["signature"],
"type": "commit"
"type": "commit",
}
results.append(commit_data_res)
result_log = " ".join(results_2)
res_json = {"json_array": json_Data3, "result_log": result_log}
print(result_log)
return json_Data3, 200

return res_json, 200


@app.route('/callback/github', methods=['GET', 'POST'])
Expand All @@ -151,7 +154,9 @@ def ouath2_callback():
auth=(client_id, client_secret),
)
json_Data = json.loads(response2.content)
repos = requests.get(json_Data["user"]['repos_url'] + "?sort=updated&direction=desc", data=data2, auth=(client_id, client_secret))
repos = requests.get(
json_Data["user"]['repos_url'] + "?sort=updated&direction=desc", data=data2, auth=(client_id, client_secret)
)
json_Data2 = json.loads(repos.content)
results = []
for repo in json_Data2:
Expand All @@ -163,11 +168,12 @@ def ouath2_callback():
"description": repo['description'],
"url": repo['url'],
'url_repo': url_repo,
"owner_url": owner['url']
"owner_url": owner['url'],
}
results.append(data_res)
return render_template('team/teamreport.html', title='Team', data=results)


@app.route("/")
def home():
"""
Expand Down
9 changes: 5 additions & 4 deletions DirectReport/browserview/blueprints/reports/reportbp.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,17 @@ 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")
# 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", " ")
response_data = response_data.replace('\n', " ")
data_json = json.loads(response_data)
data_json["broad_categories"] = {
"debug_info": 16,
Expand Down Expand Up @@ -59,7 +60,7 @@ def team_report():
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"])
# print(report["report"])
return render_template('team/teamreport.html', title='Team Report', teamData=report["report"])


Expand Down
1 change: 1 addition & 0 deletions DirectReport/browserview/services/github.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,4 +103,5 @@ 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
114 changes: 63 additions & 51 deletions DirectReport/browserview/static/js/teamreport/teamreport.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,22 @@ const { useState, useCallback, useEffect } = React;
class TeamReport extends React.Component {
constructor(props) {
super(props);

this.state = {
teamData: {},
commits: []
teamData: [],
reportData: {},
commits: [],
commentText: ''
}

this.handleTeamDataChange = this.handleTeamDataChange.bind(this);
this.handleSubmit = this.handleSubmit.bind(this)
this.openRepoPopover = this.openRepoPopover.bind(this);
this.setCommits = this.setCommits.bind(this);
this.toggle = this.toggle.bind(this);
this.toggleHide = this.toggleHide.bind(this);
this.setComments = this.setComments.bind(this);
this.handleReportDataChange = this.handleReportDataChange.bind(this);
}

toggle() {
Expand All @@ -25,23 +31,53 @@ class TeamReport extends React.Component {
this.setState({isHidden: !this.state.isHidden});
}

handleTeamDataChange(team) {
this.setState({teamData: team});
handleTeamDataChange(teamD) {
this.setState({teamData: teamD});
}

handleReportDataChange(reportD) {
this.setState({reportData: reportD});
}

setCommits(commitsData) {
this.setState({commits: commitsData});
}

setComments(commentData) {
this.setState({commentText: commentData});
}

handleSubmit() {
let payload = { "prompt" : this.state.commentText };
axios({
method: 'post',
url: '/report',
data: payload,
headers: {
"Accept": "application/json",
"Content-Type": "application/json"
}
}).then(result => {
console.log(result.data);
this.handleTeamDataChange(result.data["team"]);
this.handleReportDataChange(result.data["report"]);
showGraphics(result.data, '#map-container');
showGraphics2(result.data, '#map-container2');
showGraphics3(result.data, '#map-container3');
this.toggle()
}).catch(function (response) {
console.log(response);
});
}

update(repoURL) {
axios({
method: 'post',
url: "/repo" + repoURL,
headers: {'content-type': 'application/json'}
}).then(result => {

const results = result.data.map((commit) =>{
console.log(commit)
this.setComments(result.data['result_log'])
const results = result.data['json_array'].map((commit) => {
return {
'message': commit['commit']['message'],
'name': commit['commit']['author']['name'],
Expand All @@ -57,39 +93,15 @@ class TeamReport extends React.Component {
'type': 'commit'
}
})
console.log(results)
this.setCommits(results);
this.handleSubmit();
console.log(results)
}).catch(error => {
console.log(error);
})
}


handleSubmit(event) {
var dataForm = {
"prompt": this.state.commentText
};
const formDataJsonString = JSON.stringify(dataForm);
fetch("/report", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Accept": "application/json"
},
body: formDataJsonString
}).then(function(res) {
return res.json();
}).then(function(data) {
this.handleTeamDataChange(data);
this.toggle();
showGraphics(data, '#map-container');
showGraphics2(data, '#map-container2');
showGraphics3(data, '#map-container3');
}).then(function() {
console.log('done');
});
}

openRepoPopover(repos, state) {
const element = document.getElementById('h1content');
Popper.createPopper(element, document.getElementById('popover-repo-left-purple'), {
Expand Down Expand Up @@ -157,11 +169,13 @@ class TeamReport extends React.Component {
{this.props.repos.length > 0 && (
<button className="bg-slate-100 hover:bg-blue-400 text-blue-500 shadow-[1.5px_2px_1.0px_0.5px_rgba(0,0,0,0.48)] hover:text-white hover:border-gray-200 text-lg font-semibold py-3 px-20 rounded-2xl mt-2"
onClick={(e) => this.openRepoPopover(this.props.repos, this.state)}
type="button">Select</button>
type="button">
<span className="px-10 py-2">Select</span>
</button>
)}
{this.props.repos.length <= 0 && (
<button className="bg-slate-100 shadow-[1.5px_2px_1.0px_0.5px_rgba(0,0,0,0.48)] hover:bg-blue-400 text-blue-500 hover:text-white hover:border-gray-200 text-lg font-semibold py-3 px-20 rounded-2xl mt-2" type="button">
<a href='/authorize/github'>Authorize</a>
<a className="px-10 py-2" href='/authorize/github'>Authorize</a>
</button>
)}
</div>
Expand All @@ -172,31 +186,29 @@ class TeamReport extends React.Component {
<div className="pb-6 pt-2 bg-blue-500 rounded-3xl px-30 shadow-[1.0px_1.0px_5.0px_0.0px_rgba(0,0,0,0.58)]">
<h1 className="self-center text-center text-xl text-white text-center font-semibold font-mono mb-1 mt-2 mx-20 px-20">Summary</h1>
<div id="summary" className="px-4 mx-0 mb-3 mt-2">
{this.props.isOpened && (
<div id="summary-container" className="ml-3 mr-3 bg-slate-100 shadow-[1.0px_1.0px_6.0px_0.0px_rgba(0,0,0,0.58)] overflow-y-scroll h-100 rounded-3xl tracking-wide text-gray-500 md:text-gl dark:text-gray-400 mt-3 px-3 pt-6">
{ShowSummary(this.props.teamData["report"])}
{ShowHighlights(this.props.teamData["report"])}
</div>
)}
<div id="summary-container" className="ml-3 mr-3 bg-slate-100 shadow-[1.0px_1.0px_6.0px_0.0px_rgba(0,0,0,0.58)] overflow-y-scroll h-100 rounded-3xl tracking-wide text-gray-500 md:text-gl dark:text-gray-400 mt-3 px-3 pt-6">
{ShowSummary(this.state.reportData)}
{ShowHighlights(this.state.reportData)}
</div>
</div>
</div>
</div>
<div id="team_member_to_select" className="lg:col-span-1 sm:col-span-3 justify-center">
<div className="pb-6 pt-2 bg-blue-500 rounded-3xl px-4 mb-2 shadow-[1.0px_1.0px_5.0px_0.0px_rgba(0,0,0,0.58)]">
<h1 className="self-center text-center text-xl text-white text-center font-semibold font-mono mb-1 mt-2 mx-20 px-20">Team</h1>
<h1 className="self-center text-center text-xl text-white text-center font-semibold font-mono mb-4 mt-2 mx-20 px-20">Team</h1>
{PopoverUI(closePopover)}
<div id="display_team" className="my-3"></div>
{this.props.isOpened && (
<div className="content-center py-1 h-90 rounded-3xl mb-4 bg-slate-100 shadow-[1.0px_1.0px_6.0px_0.0px_rgba(0,0,0,0.58)] mx-1 px-3">
{ShowTeamList(this.props.teamData["team"], openPopover)}
</div>
)}
{/*<div id="display_team" className="my-3">*/}
{/*</div>*/}
<div className="content-center py-1 h-90 rounded-3xl mb-4 bg-slate-100 shadow-[1.0px_1.0px_6.0px_0.0px_rgba(0,0,0,0.58)] mx-1 mt-2 px-3">
{ShowTeamList(this.state.teamData)}
</div>
</div>
</div>
</div>
{this.props.isOpened && (
<GraphicsUI/>
)}
<GraphicsUI/>
{/*{this.state.isOpened && (*/}
{/* */}
{/*)}*/}
</div>
)
}
Expand Down
Loading
Loading