-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b3e1584
commit b254e5d
Showing
10 changed files
with
297 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
const {useState, useEffect} = React; | ||
const ArchivedReport = (reportDataElems) => { | ||
|
||
const [teamData, setTeamData] = useState([]); | ||
const [repos, setRepos] = useState([]); | ||
const [reportData, setReportData] = useState({}); | ||
const [commits, setCommits] = useState([]); | ||
const [pullRequests, setPullRequests] = useState({}); | ||
const [broadCategories, setBroadCategories] = useState({}); | ||
const [commitNums, setCommitNums] = useState({}); | ||
const [rawInputText, setRawInputText] = useState(""); | ||
const [commentText, setCommentText] = useState(""); | ||
|
||
|
||
const openRepoPopover = () => { | ||
console.log("open repo popover"); | ||
// setRepoSelected(true); | ||
} | ||
|
||
useEffect(() => { | ||
const results = reportDataElems; | ||
printData({results}) | ||
}, [reportDataElems]); | ||
|
||
function printData(reportDataElems) { | ||
var obj = JSON.parse(JSON.stringify(reportDataElems)); | ||
// var objb = JSON.parse(JSON.stringify(obj)); | ||
var test_data = JSON.parse(JSON.stringify(obj.results.data)) | ||
setCommitNums(test_data.commit_nums); | ||
setPullRequests(test_data.pull_requests); | ||
var test_data2 = JSON.parse(JSON.stringify(obj.results.raw_input_elem)) | ||
setRawInputText(test_data2.raw_input); | ||
var new_data = obj.results.reportDataElems.replace(/\'/g, "\""); | ||
var test1 = JSON.parse(new_data); | ||
Object.entries(test1).forEach((entry) => { | ||
const [key, value] = entry; | ||
var obj_new = JSON.parse(JSON.stringify(value)); | ||
if (key === "team") { | ||
setTeamData({ | ||
teamData:obj_new, | ||
}); | ||
} else if (key === "report") { | ||
setReportData(obj_new); | ||
} else if (key === "commits") { | ||
setCommits({ | ||
commits:obj_new, | ||
}); | ||
} else if (key === "broad_categories") { | ||
setBroadCategories(obj_new); | ||
} else if (key === "repos") { | ||
setRepos({ | ||
repos:obj_new, | ||
}); | ||
} else if (key == "commit_nums") { | ||
setCommitNums(obj_new); | ||
} else if (key == "pull_requests") { | ||
setPullRequests(obj_new); | ||
} | ||
}) | ||
} | ||
|
||
return ( | ||
<div> | ||
<h1 id="h1content" className="self-center text-center text-2xl text-blue-800 text-center font-bold font-mono pt-5 mb-8 pt-8 mx-30 px-20"> | ||
Archived Team Report | ||
</h1> | ||
<div id="topRow" className="grid grid-cols-3 gap-10 rounded-3xl mx-20 mt-6"> | ||
{EditArchiveSummaryElem({ | ||
"repos": repos, | ||
"commits": commits, | ||
"raw_text": rawInputText | ||
}, {reportData}, openRepoPopover)} | ||
{ArchivedSummarySection(commentText, reportData)} | ||
{ShowArchivedTeamSection({teamData}, closePopover)} | ||
{showAllGraphics({"commit_nums": commitNums, "pull_requests": pullRequests, "broad_categories": broadCategories}, '#map-container', '#map-container2', '#map-container3')} | ||
</div> | ||
<GraphicsUI/> | ||
</div> | ||
) | ||
} |
129 changes: 129 additions & 0 deletions
129
DirectReport/browserview/static/js/archived_report_components.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
const EditArchiveSummaryElem = (props, state, openRepoPopover) => { | ||
let raw_text = props['raw_text']; | ||
return ( | ||
<div className="lg:col-span-1 sm:col-span-3 justify-center" id="edit_summary_div"> | ||
<div className="pb-6 pt-2 bg-blue-600 rounded-3xl px-6 shadow-[1.0px_1.0px_2.0px_1.0px_rgba(0,0,0,0.58)]"> | ||
<h1 id="title_element" className="self-center text-center text-white text-xl text-center font-bold font-mono mb-1 mt-3 py-2">Github Data</h1> | ||
<div className="h-30 px-2 pt-2 pb-1"> | ||
<div className="overflow-y-scroll h-80 rounded-3xl tracking-wide bg-white shadow-[1.0px_1.0px_6.0px_0.0px_rgba(0,0,0,0.58)]"> | ||
{ArchivedEntry(raw_text)} | ||
</div> | ||
</div> | ||
|
||
</div> | ||
</div> | ||
) | ||
} | ||
|
||
|
||
const ShowArchivedSummary = (report) => { | ||
return ( | ||
<p id="show_summary" className="w-97 sm:w-97 overflow-y-auto break-words"> | ||
{report && | ||
<div className="px-2 mb-1 text-xs text-blue-700 px-2 pt-2 pb-3"> | ||
{report.summary} | ||
</div> | ||
} | ||
</p> | ||
); | ||
}; | ||
|
||
const ArchivedEntry = (raw_input) => { | ||
return ( | ||
<div className="px-2"> | ||
<p className="text-xs font-regular break-words text-blue-600 px-4 py-2 pb-4">{raw_input}</p> | ||
</div> | ||
) | ||
} | ||
|
||
|
||
const ShowArchivedHighlights = (report) => { | ||
if (!(report !== undefined)) { | ||
return ( | ||
<div className="h-30"> | ||
<ul className="px-2 pt-2 pb-3"> | ||
</ul> | ||
</div> | ||
) | ||
} else { | ||
return ( | ||
<div> | ||
<div className="h-30"> | ||
<ul className="px-2 pt-2 pb-3"> | ||
{/* Check if 'highlights' in report is not undefined */} | ||
{report["highlights"] !== undefined ? | ||
// Map each highlight to an HTML structure | ||
report["highlights"].map(high_light => | ||
<li className="mt-1 mb-3"> | ||
<h3 className="font-bold text-xs mb-1 mt-1 text-blue-700"> | ||
{high_light.title} | ||
</h3> | ||
<p className="w-90 sm:w-90 overflow-y-auto text-xs font-sm break-words tracking-wide text-blue-600"> | ||
{high_light.description} | ||
</p> | ||
</li> | ||
) : null // Render nothing if 'highlights' is undefined | ||
} | ||
</ul> | ||
</div> | ||
</div> | ||
) | ||
} | ||
|
||
} | ||
|
||
|
||
const ArchivedSummarySection = (commentText, reportData) => { | ||
console.log("ArchivedSummarySection") | ||
console.log(reportData); | ||
return ( | ||
<div id="show_summmary_div" className="lg:col-span-1 sm:col-span-3 justify-center"> | ||
<div className="pb-6 pt-2 bg-blue-600 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-bold font-mono mb-1 mt-3 py-2 mt-2 mx-20 px-20">Summary</h1> | ||
<div id="summary" className="px-4 mx-0 mb-1 mt-1"> | ||
<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-80 rounded-3xl tracking-wide text-gray-500 md:text-gl dark:text-gray-400 mt-3 px-3"> | ||
{ShowArchivedSummary(reportData)} | ||
{ShowArchivedHighlights(reportData)} | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
) | ||
} | ||
|
||
|
||
const ShowArchivedTeamSection = (teamData, closePopover) => { | ||
console.log(teamData["teamData"]); | ||
return ( | ||
<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-600 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-bold font-mono mb-1 mt-3 py-2 mx-20 px-20">Team</h1> | ||
{PopoverUI(closePopover)} | ||
<div | ||
className="content-center py-2 h-90 rounded-3xl mb-1 bg-slate-100 shadow-[1.0px_1.0px_6.0px_0.0px_rgba(0,0,0,0.58)] mx-1 mt-3 px-3"> | ||
{ShowArchivedTeamList(teamData["teamData"])} | ||
</div> | ||
</div> | ||
</div> | ||
) | ||
} | ||
const ShowArchivedTeamList = (team) => { | ||
|
||
if (!(team !== undefined)) { | ||
return ( | ||
null | ||
) | ||
} else { | ||
return ( | ||
<div class="items-center pt-1 select-none"> | ||
{team.teamData !== undefined && team.teamData.length > 0? | ||
team.teamData.map(team_member => | ||
<button class="bg-blue-600 py-1 px-2 pb-1 pt-1 mr-0.5 my-0.5 no-underline rounded-full text-white font-sans border-2 border-gray text-xs btn-primary hover:text-white hover:bg-indigo-700 focus:outline-none active:shadow-none" onClick={(event) => openPopover(event, team_member)}>{ | ||
team_member.name} | ||
</button> | ||
) : null | ||
} | ||
</div> | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.