-
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.
Co-authored-by: Guillaume Belanger <[email protected]>
- Loading branch information
Showing
14 changed files
with
543 additions
and
30 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,8 @@ | ||
import { expect, test } from 'vitest' | ||
import { render, screen } from '@testing-library/react' | ||
import CertificateRequests from './page' | ||
|
||
test('CertificateRequestsPage', () => { | ||
render(< CertificateRequests />) | ||
expect(screen.getByRole('table', {})).toBeDefined() | ||
}) |
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,9 @@ | ||
"use client" | ||
|
||
import { CertificateRequestsTable } from "./table" | ||
|
||
export default function CertificateRequests() { | ||
return ( | ||
<CertificateRequestsTable /> | ||
) | ||
} |
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,11 @@ | ||
import { expect, test } from 'vitest' | ||
import { render, screen } from '@testing-library/react' | ||
import Row from './row' | ||
|
||
test('Certificate Requests Table Row', () => { | ||
render(<Row id={1} csr='' certificate='' />) | ||
expect(screen.getByText('1')).toBeDefined() | ||
}) | ||
// TODO: when certificate rejected => rejected status | ||
// TODO: when certificate empty => outstanding status | ||
// TODO: when certificate anything else => certificate.NotAfter |
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,78 @@ | ||
import { useState, Dispatch, SetStateAction } from "react" | ||
const extractCSR = (csrPemString: string) => { | ||
//TODO | ||
} | ||
|
||
const extractCert = (certPemString: string) => { | ||
//TODO | ||
} | ||
|
||
type rowProps = { | ||
id: number, | ||
csr: string, | ||
certificate: string | ||
|
||
ActionMenuExpanded: number | ||
setActionMenuExpanded: Dispatch<SetStateAction<number>> | ||
} | ||
export default function Row({ id, csr, certificate, ActionMenuExpanded, setActionMenuExpanded }: rowProps) { | ||
const [detailsMenuOpen, setDetailsMenuOpen] = useState<boolean>(false) | ||
|
||
const toggleActionMenu = () => { | ||
if (ActionMenuExpanded == id) { | ||
setActionMenuExpanded(0) | ||
}else{ | ||
setActionMenuExpanded(id) | ||
} | ||
} | ||
return ( | ||
<tr> | ||
<td className="" width={5} data-test-column="id">{id}</td> | ||
<td className=""> | ||
<button | ||
className="u-toggle p-contextual-menu__toggle p-button--base is-small" | ||
aria-controls="expanded-row" | ||
aria-expanded={detailsMenuOpen? "true": "false"} | ||
onClick={() => setDetailsMenuOpen(!detailsMenuOpen)}> | ||
<i className="p-icon--chevron-down p-contextual-menu__indicator"></i> | ||
</button> | ||
<span> example.com</span> | ||
</td> | ||
<td className="" data-test-column="status">{certificate == "" ? "outstanding" : (certificate == "rejected" ? "rejected" : "fulfilled")}</td> | ||
<td className="" data-test-column="status">{certificate == "" ? "" : (certificate == "rejected" ? "" : "date")}</td> | ||
<td className="has-overflow" data-heading="Actions"> | ||
<span className="p-contextual-menu--center u-no-margin--bottom"> | ||
<button | ||
className="p-contextual-menu__toggle p-button--base is-small u-no-margin--bottom" | ||
aria-controls="action-menu" | ||
aria-expanded={ActionMenuExpanded == id ? "true": "false"} | ||
aria-haspopup="true" | ||
onClick={toggleActionMenu} | ||
onBlur={toggleActionMenu}> | ||
<i className="p-icon--menu p-contextual-menu__indicator"></i> | ||
</button> | ||
<span className="p-contextual-menu__dropdown" id="action-menu" aria-hidden={ActionMenuExpanded == id? "false": "true"}> | ||
<span className="p-contextual-menu__group"> | ||
<button className="p-contextual-menu__link">Copy Certificate Request to Clipboard</button> | ||
<button className="p-contextual-menu__link">Download Certificate Request</button> | ||
<button className="p-contextual-menu__link">Reject Certificate Request</button> | ||
<button className="p-contextual-menu__link">Delete Certificate Request</button> | ||
</span> | ||
<span className="p-contextual-menu__group"> | ||
<button className="p-contextual-menu__link">Upload Certificate</button> | ||
<button className="p-contextual-menu__link">Revoke Certificate</button> | ||
</span> | ||
</span> | ||
</span> | ||
</td> | ||
<td id="expanded-row" className="p-table__expanding-panel" aria-hidden={detailsMenuOpen? "false": "true"}> | ||
<div className="row"> | ||
<div className="col-8"> | ||
<p><b>Common Name</b>: example.com</p> | ||
<p><b>Subject Alternative Names</b>: example.com, 127.0.0.1, 1.2.3.4.5.56</p> | ||
</div> | ||
</div> | ||
</td> | ||
</tr> | ||
) | ||
} |
Oops, something went wrong.