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

Commit29a4fae

Browse files
committed
add err component and fix errors
1 parented55d12 commit29a4fae

File tree

4 files changed

+54
-53
lines changed

4 files changed

+54
-53
lines changed

‎client/packages/lowcoder/src/pages/setting/environments/EnvironmentDetail.tsx‎

Lines changed: 7 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import UserGroupsTab from "./components/UserGroupsTab";
2727
importEnvironmentHeaderfrom"./components/EnvironmentHeader";
2828
importModernBreadcrumbsfrom"./components/ModernBreadcrumbs";
2929
import{getEnvironmentTagColor}from"./utils/environmentUtils";
30-
const{ Title, Text}=Typography;
30+
importErrorComponentfrom'./components/ErrorComponent';
3131
const{ TabPane}=Tabs;
3232

3333
/**
@@ -80,50 +80,18 @@ const EnvironmentDetail: React.FC = () => {
8080
if(isLoading){
8181
return(
8282
<divstyle={{display:'flex',justifyContent:'center',padding:'50px'}}>
83-
<Spinsize="large"tip="Loading environment..."/>
83+
<Spinsize="large"tip="Loading environment..."style={{display:'block',textAlign:'center'}}/>
8484
</div>
8585
);
8686
}
8787

8888
if(error||!environment){
89-
consterrorItems=[
90-
{
91-
key:'environments',
92-
title:(
93-
<span>
94-
<HomeOutlined/> Environments
95-
</span>
96-
),
97-
onClick:()=>history.push("/setting/environments")
98-
},
99-
{
100-
key:'notFound',
101-
title:'Not Found'
102-
}
103-
];
104-
10589
return(
106-
<divstyle={{padding:"24px",flex:1}}>
107-
<ModernBreadcrumbsitems={errorItems}/>
108-
109-
<Cardstyle={{borderRadius:'8px',boxShadow:'0 2px 8px rgba(0,0,0,0.05)'}}>
110-
<divstyle={{textAlign:"center",padding:"40px 0"}}>
111-
<Titlelevel={3}style={{color:"#ff4d4f"}}>
112-
Environment Not Found
113-
</Title>
114-
<Texttype="secondary"style={{display:"block",margin:"16px 0"}}>
115-
{error||"The environment you're looking for doesn't exist or you don't have permission to view it."}
116-
</Text>
117-
<Button
118-
type="primary"
119-
onClick={()=>history.push("/setting/environments")}
120-
style={{marginTop:"16px"}}
121-
>
122-
Return to Environments List
123-
</Button>
124-
</div>
125-
</Card>
126-
</div>
90+
<ErrorComponent
91+
errorMessage={"Environment Not Found"}
92+
returnPath="/setting/environments"
93+
returnLabel="Return to Environments List"
94+
/>
12795
);
12896
}
12997

‎client/packages/lowcoder/src/pages/setting/environments/EnvironmentsList.tsx‎

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,7 @@ const EnvironmentsList: React.FC = () => {
139139
borderRadius:'12px',
140140
boxShadow:'0 2px 8px rgba(0,0,0,0.05)'
141141
}}
142-
headStyle={{
143-
borderBottom:'1px solid #f0f0f0',
144-
padding:'16px 24px'
145-
}}
142+
styles={{header:{borderBottom:'1px solid #f0f0f0',padding:'16px 24px'}}}
146143
bodyStyle={{padding:'24px'}}
147144
>
148145
<Rowgutter={[32,16]}justify="space-around">
@@ -191,10 +188,7 @@ const EnvironmentsList: React.FC = () => {
191188
borderRadius:'12px',
192189
boxShadow:'0 2px 8px rgba(0,0,0,0.05)',
193190
}}
194-
headStyle={{
195-
borderBottom:'1px solid #f0f0f0',
196-
padding:'16px 24px'
197-
}}
191+
styles={{header:{borderBottom:'1px solid #f0f0f0',padding:'16px 24px'}}}
198192
bodyStyle={{padding:'24px'}}
199193
extra={
200194
<Input

‎client/packages/lowcoder/src/pages/setting/environments/WorkspaceDetail.tsx‎

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import DataSourcesTab from "./components/DataSourcesTab";
2525
importQueriesTabfrom"./components/QueriesTab";
2626
importModernBreadcrumbsfrom"./components/ModernBreadcrumbs";
2727
importWorkspaceHeaderfrom"./components/WorkspaceHeader";
28+
importErrorComponentfrom"./components/ErrorComponent";
2829

2930
const{ TabPane}=Tabs;
3031

@@ -57,18 +58,18 @@ const WorkspaceDetail: React.FC = () => {
5758
if(isLoading){
5859
return(
5960
<divstyle={{display:'flex',justifyContent:'center',alignItems:'center',height:'100%',padding:'50px'}}>
60-
<Spinsize="large"tip="Loading workspace details..."/>
61+
<Spinsize="large"tip="Loading workspace details..."style={{display:'block',textAlign:'center'}}/>
6162
</div>
6263
);
6364
}
6465

6566
if(error||!environment||!workspace){
6667
return(
67-
<divstyle={{display:'flex',justifyContent:'center',alignItems:'center',height:'100%',padding:'50px'}}>
68-
<Typography.Titlelevel={3}>
69-
{error||"Workspace not found"}
70-
</Typography.Title>
71-
</div>
68+
<ErrorComponent
69+
errorMessage={"Workspace not found"}
70+
returnPath="/setting/environments"
71+
returnLabel="Return to Environments List"
72+
/>
7273
);
7374
}
7475

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
importReactfrom'react';
2+
import{Card,Button,Typography}from'antd';
3+
import{HomeOutlined}from'@ant-design/icons';
4+
importhistoryfrom'@lowcoder-ee/util/history';
5+
6+
const{ Title, Text}=Typography;
7+
8+
interfaceErrorComponentProps{
9+
errorMessage:string;
10+
returnPath:string;
11+
returnLabel:string;
12+
}
13+
14+
constErrorComponent:React.FC<ErrorComponentProps>=({ errorMessage, returnPath, returnLabel})=>{
15+
return(
16+
<divstyle={{padding:'24px',flex:1}}>
17+
<Cardstyle={{borderRadius:'8px',boxShadow:'0 2px 8px rgba(0,0,0,0.05)'}}>
18+
<divstyle={{textAlign:'center',padding:'40px 0'}}>
19+
<Titlelevel={3}style={{color:'#ff4d4f'}}>
20+
{errorMessage}
21+
</Title>
22+
<Texttype="secondary"style={{display:'block',margin:'16px 0'}}>
23+
The item you're looking for doesn't exist or you don't have permission to view it.
24+
</Text>
25+
<Button
26+
type="primary"
27+
onClick={()=>history.push(returnPath)}
28+
style={{marginTop:'16px'}}
29+
>
30+
<HomeOutlined/>{returnLabel}
31+
</Button>
32+
</div>
33+
</Card>
34+
</div>
35+
);
36+
};
37+
38+
exportdefaultErrorComponent;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp