fleek did this

This commit is contained in:
Telesphoreo 2022-06-29 23:03:04 -05:00
parent 4043486550
commit 3b35680b72
2 changed files with 27 additions and 20 deletions

View File

@ -41,10 +41,10 @@ const DownloadPage = () => {
<div className="header"> <div className="header">
<h1>Scissors Downloads</h1> <h1>Scissors Downloads</h1>
</div> </div>
<br/> <br />
<div className="download_section"> <div className="download_section">
<ul className="versions"> <ul className="versions">
{Array.from(jobs.keys()).sort(function(x, y) { {Array.from(jobs.keys()).sort(function (x, y) {
let x1 = x.name.split(".") let x1 = x.name.split(".")
let y1 = y.name.split(".") let y1 = y.name.split(".")
if (x1.length >= 3) { if (x1.length >= 3) {
@ -58,18 +58,18 @@ const DownloadPage = () => {
return <li key={job.name} className={version === job.name ? "selected" : "selectable"} onClick={() => setVersion(job.name)}>{job.name}</li> return <li key={job.name} className={version === job.name ? "selected" : "selectable"} onClick={() => setVersion(job.name)}>{job.name}</li>
})} })}
</ul> </ul>
<br/><br/> <br /><br />
<table className="downloads"> <table className="downloads">
<tbody> <tbody>
{jobs.get(Array.from(jobs.keys()).filter(value => value.name == version)[0])?.map(value => { {jobs.get(Array.from(jobs.keys()).filter(value => value.name == version)[0])?.map(value => {
return <tr key={value.number}> return <tr key={value.number}>
<td align="center"><Button className="download" href={value.artifact ? `${value.url}/artifact/${value.artifact}` : value.url}>#{value.number}</Button></td> <td align="center"><Button className="download" href={value.artifact ? `${value.url}/artifact/${value.artifact}` : value.url}>#{value.number}</Button></td>
<td className="commits"><ul>{value.changes?.map(value1 => { <td className="commits"><ul>{value.changes?.map(value1 => {
return (<li key={value1.id}>[<a className="commit_id" href={`https://github.com/AtlasMediaGroup/Scissors/commit/${value1.id}`}>{value1.id}</a>]&nbsp;&nbsp;{value1.comment}</li>) return (<li key={value1.id}>[<a className="commit_id" href={value1.id !== "x" ? `https://github.com/AtlasMediaGroup/Scissors/commit/${value1.id}` : `https://github.com/AtlasMediaGroup/Scissors/tree/${version}`}>{value1.id}</a>]&nbsp;&nbsp;{value1.comment}</li>)
})}</ul></td> })}</ul></td>
<td className="date" align="center">{dayjs(value.timestamp!).format("MM/DD/YYYY [at] hh:mm A")}</td> <td className="date" align="center">{dayjs(value.timestamp!).format("MM/DD/YYYY [at] hh:mm A")}</td>
</tr> </tr>
})} })}
</tbody> </tbody>
</table> </table>
</div> </div>

View File

@ -32,7 +32,6 @@ export function getJobs(): Promise<Job[]> {
}).catch(() => reject) }).catch(() => reject)
}) })
} }
export function getBuilds(version: string): Promise<Build[]> { export function getBuilds(version: string): Promise<Build[]> {
let builds: Build[] = [] let builds: Build[] = []
let request = axios.get(`${JENKINS_URL}/${ARTIFACT_NAME}/job/${version}/api/json?pretty=true`) let request = axios.get(`${JENKINS_URL}/${ARTIFACT_NAME}/job/${version}/api/json?pretty=true`)
@ -46,22 +45,30 @@ export function getBuilds(version: string): Promise<Build[]> {
let changeSet: any[] = value1.data.changeSets let changeSet: any[] = value1.data.changeSets
if (changeSet.length > 0) { if (changeSet.length > 0) {
let changes = changeSet[0].items as BuildChange[] let changes = changeSet[0].items as BuildChange[]
for (let change of changes) { if (changes.length > 0) {
change.id = change.id.substring(0, 7) for (let change of changes) {
change.id = change.id.substring(0, 7)
}
} }
build.changes = changes build.changes = changes
if (value1.data.artifacts) { if (value1.data.artifacts) {
let artifacts: any[] = value1.data.artifacts let artifacts: any[] = value1.data.artifacts
if (artifacts.length > 0) { if (artifacts.length > 0) {
build.artifact = value1.data.artifacts[0].relativePath build.artifact = artifacts[0].relativePath
} }
} }
} else {
resolve(builds) let changes: BuildChange[] = []
changes.push({
id: "x",
comment: "No changes"
})
build.changes = changes
} }
resolve(builds)
}) })
} }
}).catch(() => reject) }).catch(() => reject)
}) })
} }