-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement basic functionality of testbed (#12)
* Implement testbed --------- Co-authored-by: Maximilian Pohl <[email protected]> Co-authored-by: Marlon Baeten <[email protected]>
- Loading branch information
1 parent
de6cc07
commit 747ec6e
Showing
35 changed files
with
2,291 additions
and
993 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,36 @@ | ||
import React from 'react'; | ||
import clipboard from '../img/clipboard.svg?url'; | ||
import download from '../img/download.svg?url'; | ||
import useTranslations from '../hooks/useTranslations'; | ||
import {Notification, NotificationType} from '../core/types'; | ||
|
||
export interface CopyDownloadButtonProps { | ||
xml: string, | ||
name: string, | ||
setNotification: (notification: Notification) => void, | ||
} | ||
|
||
export default function CopyDownloadButton({xml, name, setNotification}: CopyDownloadButtonProps) { | ||
const t = useTranslations(); | ||
|
||
const onCopy = () => { | ||
navigator.clipboard.writeText(xml); | ||
|
||
setNotification({ | ||
type: NotificationType.success, | ||
message: t.common.copySuccess | ||
}); | ||
}; | ||
|
||
return ( | ||
<> | ||
<button className="button large icon" type="button" title={t.common.copy} onClick={onCopy}> | ||
<img src={clipboard} alt={t.common.copy}/> | ||
</button> | ||
<a className="button large icon" title={t.common.download} | ||
href={`data:application/xml;base64,${btoa(xml)}`} download={`${name}.xml`}> | ||
<img src={download} alt={t.common.download}/> | ||
</a> | ||
</> | ||
); | ||
} |
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,23 @@ | ||
import React from 'react'; | ||
import { Notification } from '../core/types'; | ||
import useNavigation from '../hooks/useNavigation'; | ||
|
||
interface NotificationProps { | ||
notification: Notification, | ||
} | ||
|
||
export default function NotificationElem({ notification }: NotificationProps) { | ||
const navigate = useNavigation(); | ||
|
||
return ( | ||
<div className={`notification ${ notification.type }`}> | ||
<button className="close" onClick={() => navigate({ notification: 'clear' })}> | ||
× | ||
</button> | ||
<span> | ||
{notification.message} | ||
</span> | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import React, { FormEvent, useState } from 'react'; | ||
import Layout from './Layout'; | ||
import welcome from '../img/welcome.svg?url'; | ||
import useTranslations from '../hooks/useTranslations'; | ||
import useNavigation from '../hooks/useNavigation'; | ||
|
||
export default function Onboarding() { | ||
const navigate = useNavigation(); | ||
const [name, setName] = useState(''); | ||
const t = useTranslations(); | ||
|
||
const submit = (e: FormEvent) => { | ||
e.preventDefault(); | ||
navigate({ name }); | ||
}; | ||
|
||
return ( | ||
<Layout> | ||
<form method="POST" onSubmit={submit} className="center-form"> | ||
<div> | ||
<img src={welcome} alt={t.common.copy} /> | ||
<h2>{t.onboarding.welcome}</h2> | ||
<div dangerouslySetInnerHTML={{ __html: t.onboarding.welcomeHtml }} /> | ||
</div> | ||
<div> | ||
<label htmlFor="token required">CA {t.caDetails.handle}</label> | ||
<input | ||
name="name" | ||
type="test" | ||
value={name} | ||
onChange={(e) => setName(e.target.value)} | ||
required | ||
/> | ||
</div> | ||
<div> | ||
<button type="submit" className="button"> | ||
{t.onboarding.addCAForm.confirm} | ||
</button> | ||
</div> | ||
</form> | ||
</Layout> | ||
); | ||
} |
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,15 @@ | ||
import React from 'react'; | ||
import Layout from './Layout'; | ||
import TestBedHeader from './TestBedHeader'; | ||
import TestBedAddCaForm from './forms/TestBedAddCaForm'; | ||
|
||
export default function TestBed() { | ||
return ( | ||
<Layout> | ||
<div className="testbed"> | ||
<TestBedHeader /> | ||
<TestBedAddCaForm /> | ||
</div> | ||
</Layout> | ||
); | ||
} |
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,15 @@ | ||
import React from 'react'; | ||
import Layout from './Layout'; | ||
import TestBedHeader from './TestBedHeader'; | ||
import TestBedAddPubForm from './forms/TestBedAddPubForm'; | ||
|
||
export default function TestBedAddPub() { | ||
return ( | ||
<Layout> | ||
<div className="testbed"> | ||
<TestBedHeader /> | ||
<TestBedAddPubForm /> | ||
</div> | ||
</Layout> | ||
); | ||
} |
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,15 @@ | ||
import React from 'react'; | ||
import Layout from './Layout'; | ||
import TestBedHeader from './TestBedHeader'; | ||
import TestBedDelCaForm from './forms/TestBedDelCaForm'; | ||
|
||
export default function TestBedDelCa() { | ||
return ( | ||
<Layout> | ||
<div className="testbed"> | ||
<TestBedHeader /> | ||
<TestBedDelCaForm /> | ||
</div> | ||
</Layout> | ||
); | ||
} |
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,15 @@ | ||
import React from 'react'; | ||
import Layout from './Layout'; | ||
import TestBedHeader from './TestBedHeader'; | ||
import TestBedDelPubForm from './forms/TestBedDelPubForm'; | ||
|
||
export default function TestBedDelPub() { | ||
return ( | ||
<Layout> | ||
<div className="testbed"> | ||
<TestBedHeader /> | ||
<TestBedDelPubForm /> | ||
</div> | ||
</Layout> | ||
); | ||
} |
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,56 @@ | ||
import React from 'react'; | ||
import welcome from '../img/welcome.svg?url'; | ||
import useTranslations from '../hooks/useTranslations'; | ||
import { Link } from 'react-router5'; | ||
|
||
export default function TestBedHeader() { | ||
const t = useTranslations(); | ||
|
||
return ( | ||
<> | ||
<div> | ||
<img src={welcome} alt={t.common.copy} /> | ||
<h2>{t.testbed.welcome}</h2> | ||
</div> | ||
<div> | ||
<h3>{t.testbed.disclaimer.heading}</h3> | ||
<p dangerouslySetInnerHTML={{ __html: t.testbed.disclaimer.body }}></p> | ||
<h3>{t.testbed.rpconfighelp.heading}</h3> | ||
<p | ||
dangerouslySetInnerHTML={{ | ||
__html: t.testbed.rpconfighelp.body.replace( | ||
'{tallink}', | ||
'/ta/ta.tal' | ||
), | ||
}} | ||
></p> | ||
<h3>{t.testbed.regunreg.heading}</h3> | ||
<p dangerouslySetInnerHTML={{ __html: t.testbed.regunreg.body }}></p> | ||
</div> | ||
<div> | ||
<ul className="tabs"> | ||
<li> | ||
<Link routeName="testbed" activeStrict> | ||
{t.testbed.addChild.heading} | ||
</Link> | ||
</li> | ||
<li> | ||
<Link routeName="testbed.del_ca"> | ||
{t.testbed.removeChild.heading} | ||
</Link> | ||
</li> | ||
<li> | ||
<Link routeName="testbed.add_pub"> | ||
{t.testbed.addPublisher.heading} | ||
</Link> | ||
</li> | ||
<li> | ||
<Link routeName="testbed.del_pub"> | ||
{t.testbed.removePublisher.heading} | ||
</Link> | ||
</li> | ||
</ul> | ||
</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.