Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit13d0dac

Browse files
authored
feat: display error if app is not installed (#16980)
Fixes:#13937
1 parent13a3ddd commit13d0dac

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

‎site/src/modules/resources/AppLink/AppLink.stories.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
MockWorkspaceApp,
99
MockWorkspaceProxies,
1010
}from"testHelpers/entities";
11+
import{withGlobalSnackbar}from"testHelpers/storybook";
1112
import{AppLink}from"./AppLink";
1213

1314
constmeta:Meta<typeofAppLink>={
@@ -72,6 +73,19 @@ export const ExternalApp: Story = {
7273
},
7374
};
7475

76+
exportconstExternalAppNotInstalled:Story={
77+
decorators:[withGlobalSnackbar],
78+
args:{
79+
workspace:MockWorkspace,
80+
app:{
81+
...MockWorkspaceApp,
82+
external:true,
83+
url:"foobar-foobaz://open-me",
84+
},
85+
agent:MockWorkspaceAgent,
86+
},
87+
};
88+
7589
exportconstSharingLevelOwner:Story={
7690
args:{
7791
workspace:MockWorkspace,

‎site/src/modules/resources/AppLink/AppLink.tsx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ import Link from "@mui/material/Link";
55
importTooltipfrom"@mui/material/Tooltip";
66
import{API}from"api/api";
77
importtype*asTypesGenfrom"api/typesGenerated";
8+
import{displayError}from"components/GlobalSnackbar/utils";
89
import{useProxy}from"contexts/ProxyContext";
10+
import{useEffect}from"react";
911
import{typeFC,typeMouseEvent,useState}from"react";
1012
import{createAppLinkHref}from"utils/apps";
1113
import{generateRandomString}from"utils/random";
@@ -152,6 +154,20 @@ export const AppLink: FC<AppLinkProps> = ({ app, workspace, agent }) => {
152154
url=href.replaceAll(magicTokenString,key.key);
153155
setFetchingSessionToken(false);
154156
}
157+
158+
// When browser recognizes the protocol and is able to navigate to the app,
159+
// it will blur away, and will stop the timer. Otherwise,
160+
// an error message will be displayed.
161+
constopenAppExternallyFailedTimeout=500;
162+
constopenAppExternallyFailed=setTimeout(()=>{
163+
displayError(
164+
`${app.display_name!=="" ?app.display_name :app.slug} must be installed first.`,
165+
);
166+
},openAppExternallyFailedTimeout);
167+
window.addEventListener("blur",()=>{
168+
clearTimeout(openAppExternallyFailed);
169+
});
170+
155171
window.location.href=url;
156172
return;
157173
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp