-
Notifications
You must be signed in to change notification settings - Fork 1
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
Showing
27 changed files
with
1,227 additions
and
492 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
{ | ||
"repo": "default", | ||
"channels": | ||
[ | ||
{ | ||
"name": "paper", | ||
"title": "Paper", | ||
"experimental": false, | ||
"logo": "https://python.doctor/images/django-python.png", | ||
"long": "The paper deployment to reproduce the paper. Comes with a preconfigured set of apps and services to reproduce the paper", | ||
"description": "The original paper deployment", | ||
"features": [ | ||
{ | ||
"name": "Easy", | ||
"description": "Easy to use", | ||
"long": "This deployment is easy to use" | ||
} | ||
], | ||
"builder": "jhnnsrs/arkitekt_paper_builder", | ||
"forms": ["admin_user", "users", "groups"], | ||
"defaults": { | ||
"name": "mydeployment", | ||
"admin_username": "", | ||
"admin_password": "", | ||
"admin_email": "" | ||
} | ||
}, | ||
{ | ||
"name": "next", | ||
"title": "next", | ||
"experimental": true, | ||
"logo": "https://python.doctor/images/django-python.png", | ||
"long": "The next deployment contains breaking changes and is not yet stable. It does however give an impression of the future of Arkitekt", | ||
"description": "The next deployment", | ||
"features": [ | ||
{ | ||
"name": "Easy", | ||
"description": "Easy to use", | ||
"long": "This deployment is easy to use" | ||
} | ||
], | ||
"builder": "jhnnsrs/arkitekt_paper_builder", | ||
"forms": ["admin_user", "users", "groups"], | ||
"defaults": { | ||
"name": "mydeployment", | ||
"admin_username": "", | ||
"admin_password": "", | ||
"admin_email": "" | ||
} | ||
} | ||
] | ||
} |
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,31 @@ | ||
import { DialogTitle } from "@radix-ui/react-dialog"; | ||
import { | ||
Dialog, | ||
DialogContent, | ||
DialogDescription, | ||
} from "../components/ui/dialog"; | ||
import { useAlerter } from "./alerter-context"; | ||
import { useEffect } from "react"; | ||
import React from "react"; | ||
|
||
export const AlerterDialog = () => { | ||
const { activeError, ack } = useAlerter(); | ||
|
||
const [open, setOpen] = React.useState(false); | ||
|
||
useEffect(() => { | ||
setOpen(activeError != null); | ||
}, [activeError]); | ||
|
||
return ( | ||
<> | ||
<Dialog open={open} onOpenChange={ack}> | ||
<DialogContent> | ||
<DialogTitle>{activeError?.error}</DialogTitle> | ||
<DialogDescription>{activeError?.message}</DialogDescription> | ||
<DialogDescription>{activeError?.subtitle}</DialogDescription> | ||
</DialogContent> | ||
</Dialog> | ||
</> | ||
); | ||
}; |
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 { forage } from "@tauri-apps/tauri-forage"; | ||
import React, { useCallback, useEffect, useState } from "react"; | ||
import { InstalledApp } from "../screens/wizard/types"; | ||
import { AlerterContext, AlertingError } from "./alerter-context"; | ||
import { ErrorBoundary } from "react-error-boundary"; | ||
|
||
export const AlerterProvider: React.FC<{ children: React.ReactNode }> = ({ | ||
children, | ||
}) => { | ||
const [activeError, setActiveError] = useState<AlertingError | null>(null); | ||
|
||
const catchAlert = useCallback( | ||
(e: Error | unknown) => { | ||
if (e instanceof Error) { | ||
setActiveError({ | ||
error: e.name, | ||
message: e.message, | ||
subtitle: e.stack || "", | ||
causedBy: e, | ||
}); | ||
return; | ||
} else { | ||
setActiveError({ | ||
error: "Unknown Error", | ||
message: "An unknown error occurred", | ||
subtitle: JSON.stringify(e), | ||
}); | ||
} | ||
}, | ||
[setActiveError] | ||
); | ||
|
||
const alert = useCallback( | ||
(e: AlertingError) => { | ||
setActiveError(e); | ||
}, | ||
[setActiveError] | ||
); | ||
|
||
const ack = useCallback(() => { | ||
setActiveError(null); | ||
}, [setActiveError]); | ||
|
||
return ( | ||
<AlerterContext.Provider | ||
value={{ | ||
catchAlert: catchAlert, | ||
alert: alert, | ||
activeError: activeError, | ||
ack: ack, | ||
}} | ||
> | ||
{children} | ||
</AlerterContext.Provider> | ||
); | ||
}; |
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,29 @@ | ||
import React, { useContext } from "react"; | ||
import { SetupValues } from "../screens/wizard/Setup"; | ||
|
||
export type AlertingError = { | ||
error: string; | ||
message: string; | ||
subtitle: string; | ||
causedBy?: Error; | ||
}; | ||
|
||
export type AlerterContext = { | ||
catchAlert: (e: Error) => void; | ||
alert: (e: AlertingError) => void; | ||
activeError: AlertingError | null; | ||
ack: () => void; | ||
}; | ||
|
||
export const AlerterContext = React.createContext<AlerterContext>({ | ||
catchAlert(e: Error) { | ||
alert(e.message); | ||
}, | ||
alert(e: AlertingError) { | ||
alert(e.message); | ||
}, | ||
activeError: null, | ||
ack() {}, | ||
}); | ||
|
||
export const useAlerter = () => useContext(AlerterContext); |
Oops, something went wrong.