-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add version check to parameters
- Loading branch information
Showing
8 changed files
with
144 additions
and
71 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
{ | ||
"version": "0.5.0", | ||
"cfg": { | ||
"default": 6, | ||
"min": 1, | ||
|
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,24 @@ | ||
import { Alert, AlertTitle, Typography } from '@mui/material'; | ||
import * as React from 'react'; | ||
import { PARAM_VERSION } from '../../config'; | ||
|
||
export interface ParamsVersionErrorProps { | ||
root: string; | ||
version: string; | ||
} | ||
|
||
export function ParamsVersionError(props: ParamsVersionErrorProps) { | ||
return <Alert severity='error'> | ||
<AlertTitle> | ||
Parameter Version Error | ||
</AlertTitle> | ||
<Typography> | ||
The server returned parameters that are too old for the client to load. | ||
</Typography> | ||
<Typography> | ||
The server parameters are version <code>{props.version}</code>, but this client's required version | ||
is <code>{PARAM_VERSION}</code>. Please update your server or use a matching version of the client. | ||
</Typography> | ||
</Alert>; | ||
} | ||
|
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 { Alert, AlertTitle, Typography } from '@mui/material'; | ||
import * as React from 'react'; | ||
|
||
export interface ServerParamsErrorProps { | ||
error: unknown; | ||
root: string; | ||
} | ||
|
||
function getErrorMessage(error: unknown): string { | ||
if (error instanceof Error) { | ||
return error.message; | ||
} else if (typeof error === 'string') { | ||
return error; | ||
} else { | ||
return 'unknown error'; | ||
} | ||
} | ||
|
||
export function ServerParamsError(props: ServerParamsErrorProps) { | ||
return <Alert severity='error'> | ||
<AlertTitle> | ||
Server Error | ||
</AlertTitle> | ||
<Typography> | ||
Could not fetch parameters from the ONNX web API server at <code>{props.root}</code>. | ||
</Typography> | ||
<Typography> | ||
{getErrorMessage(props.error)} | ||
</Typography> | ||
</Alert>; | ||
} |
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