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

288 http error #309

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
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
8 changes: 6 additions & 2 deletions dashboard/src/components/Atoms/WarningAlert.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
import clsx from 'clsx'

export default function WarningAlert({
children,
className,
}: {
children: React.ReactNode;
children: React.ReactNode,
className?: string,
}) {
return (
<div className="rounded-md border border-red-200 bg-red-faded/25 p-2 text-medium font-medium tracking-medium text-white">
<div className={clsx("rounded-md border border-red-200 bg-red-faded/25 p-2 text-medium font-medium tracking-medium text-white", className)}>
<span className="block sm:inline">{children}</span>
</div>
);
Expand Down
38 changes: 20 additions & 18 deletions dashboard/src/pages/login/CoreConnect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ const CoreConnect = () => {
useDocumentTitle('Connect to Core - Lodestone');
const { navigateBack, setPathname } = useContext(BrowserLocationContext);
const { setCore, addCore } = useContext(LodestoneContext);
const [ ShowBlurb, setShowBlurb ] = useState(false);
const [ showBlurb, setShowBlurb ] = useState(false);
const [ showPopup, setShowPopup ] = useState(false);
const [ httpProtocol, setHttpProtocol ] = useState(true);

const initialValues: CoreConnectionInfo = {
address: '',
Expand All @@ -44,6 +45,7 @@ const CoreConnect = () => {
values: CoreConnectionInfo,
actions: FormikHelpers<CoreConnectionInfo>
) => {
setHttpProtocol(values.protocol == "http");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to add a special case for localhost/127.0.0.1/etc, which does not need mixed content enabled

https://developer.mozilla.org/en-US/docs/Web/Security/Mixed_content#loading_locally_delivered_mixed-resources

// check if core can be reached
axios
.get<CoreInfo>(`/info`, {
Expand Down Expand Up @@ -89,9 +91,9 @@ const CoreConnect = () => {

return (
<div className="flex w-[768px] max-w-full flex-col items-stretch justify-center gap-12 rounded-2xl px-12 py-14 @container">
{showPopup && (
{httpProtocol && showPopup && (
<ConfirmDialog
isOpen={ShowBlurb}
isOpen={showBlurb}
onClose={() => setShowPopup(false)}
title="HTTP Error"
type="danger"
Expand All @@ -112,22 +114,22 @@ const CoreConnect = () => {
<h1 className="font-title text-h1 font-bold tracking-medium text-gray-300">
Add a new core
</h1>
{ShowBlurb && (
<WarningAlert>
<p>
You may need to adjust your network and browser settings. {' '}
<a
href="https://github.com/Lodestone-Team/lodestone/wiki/Known-Issues#network-errors"
target="_blank"
rel="noreferrer"
className="text-blue-200 underline hover:text-blue-300"
>
Learn more.
</a>
</p>
{showBlurb && (
<WarningAlert className='w-full'>
<p>
You may need to adjust your network and browser settings. {' '}
<a
href="https://github.com/Lodestone-Team/lodestone/wiki/Known-Issues#network-errors"
target="_blank"
rel="noreferrer"
className="text-blue-200 underline hover:text-blue-300"
>
Learn more.
</a>
</p>
</WarningAlert>
)}
</div>
</div>
<Formik
initialValues={initialValues}
validationSchema={validationSchema}
Expand All @@ -142,7 +144,7 @@ const CoreConnect = () => {
autoComplete={DISABLE_AUTOFILL}
>
{status && (
<WarningAlert>
<WarningAlert className='-mt-9'>
<p>
<b>{status.error}</b>: Please ensure your fields are filled
out correctly.
Expand Down
Loading