-
Notifications
You must be signed in to change notification settings - Fork 56
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
Improve pending tx modal + shell/download file error handling #36
Merged
Merged
Changes from 7 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
18059ad
Prevent closing tx modal
Redm4x 23528bd
Add link to FAQ in shell connection lost message
Redm4x a1df928
Add faq entry for tab completion
Redm4x 30b0515
Show warning when trying to use up arrow in sh shell
Redm4x 6c71c4a
Add warning when trying to download from URL
Redm4x 974d757
Fix download file
Redm4x f01618b
Improve download file error handling
Redm4x d247d03
Use UrlService for faq links
Redm4x File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
|
@@ -13,6 +13,8 @@ import { LeaseShellCode } from "@src/types/shell"; | |
import { useCustomWebSocket } from "@src/hooks/useCustomWebSocket"; | ||
import { LeaseDto } from "@src/types/deployment"; | ||
import { useProviderList } from "@src/queries/useProvidersQuery"; | ||
import Link from "next/link"; | ||
import LaunchIcon from "@mui/icons-material/Launch"; | ||
|
||
type Props = { | ||
leases: LeaseDto[]; | ||
|
@@ -28,6 +30,7 @@ export const DeploymentLeaseShell: React.FunctionComponent<Props> = ({ leases }) | |
const [selectedLease, setSelectedLease] = useState<LeaseDto>(null); | ||
const [isShowingDownloadModal, setIsShowingDownloadModal] = useState(false); | ||
const [isChangingSocket, setIsChangingSocket] = useState(false); | ||
const [showArrowAndTabWarning, setShowArrowAndTabWarning] = useState(false); | ||
const { data: providers } = useProviderList(); | ||
const { localCert, isLocalCertMatching, createCertificate, isCreatingCert } = useCertificate(); | ||
const providerInfo = providers?.find(p => p.owner === selectedLease?.provider); | ||
|
@@ -103,6 +106,12 @@ export const DeploymentLeaseShell: React.FunctionComponent<Props> = ({ leases }) | |
if (message?.data) { | ||
let parsedData = Buffer.from(message.data).toString("utf-8", 1); | ||
|
||
// Check if parsedData is either ^[[A, ^[[B, ^[[C or ^[[D | ||
const arrowKeyPattern = /\^\[\[[A-D]/; | ||
if (arrowKeyPattern.test(parsedData)) { | ||
setShowArrowAndTabWarning(true); | ||
} | ||
|
||
let exitCode, errorMessage; | ||
try { | ||
const jsonData = JSON.parse(parsedData); | ||
|
@@ -268,10 +277,24 @@ export const DeploymentLeaseShell: React.FunctionComponent<Props> = ({ leases }) | |
)} | ||
</Box> | ||
|
||
{showArrowAndTabWarning && ( | ||
<Alert variant="standard" severity="warning" sx={{ borderRadius: 0, marginBottom: 1 }}> | ||
<Link href="/faq#shell-arrows-and-completion" target="_blank" style={{ display: "inline-flex", alignItems: "center" }}> | ||
Why is my UP arrow and TAB autocompletion not working? | ||
<LaunchIcon fontSize={"small"} alignmentBaseline="middle" /> | ||
</Link> | ||
</Alert> | ||
)} | ||
|
||
<ViewPanel stickToBottom style={{ overflow: "hidden" }}> | ||
{isConnectionClosed && ( | ||
<Alert variant="standard" severity="warning" sx={{ borderRadius: 0 }}> | ||
The connection to your Cloudmos Shell was lost. | ||
The connection to your Cloudmos Shell was lost. ( | ||
<Link href="/faq#shell-lost" target="_blank" style={{ display: "inline-flex", alignItems: "center" }}> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
More Info | ||
<LaunchIcon fontSize={"small"} alignmentBaseline="middle" /> | ||
</Link> | ||
) | ||
</Alert> | ||
)} | ||
<XTerm ref={terminalRef} onKey={onTerminalKey} onTerminalPaste={onTerminalPaste} /> | ||
|
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
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
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
UrlService