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

Commitaf91f08

Browse files
author
dragonpoo
authored
Merge pull request#1694 from iamfaran/fix/environments-new
Add error component on invalid URL and managed-obj endpoint
2 parentsf30fbd4 +392a4ad commitaf91f08

File tree

13 files changed

+71
-79
lines changed

13 files changed

+71
-79
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 & 7 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

@@ -34,7 +35,6 @@ const WorkspaceDetail: React.FC = () => {
3435
const{ workspace, isLoading, error, toggleManagedStatus}=useWorkspaceContext();
3536
const{ openDeployModal}=useDeployModal();
3637

37-
console.log("workspace render",workspace);
3838

3939
const[isToggling,setIsToggling]=useState(false);
4040

@@ -58,18 +58,18 @@ const WorkspaceDetail: React.FC = () => {
5858
if(isLoading){
5959
return(
6060
<divstyle={{display:'flex',justifyContent:'center',alignItems:'center',height:'100%',padding:'50px'}}>
61-
<Spinsize="large"tip="Loading workspace details..."/>
61+
<Spinsize="large"tip="Loading workspace details..."style={{display:'block',textAlign:'center'}}/>
6262
</div>
6363
);
6464
}
6565

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

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;

‎client/packages/lowcoder/src/pages/setting/environments/config/apps.config.tsx‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ export const appsConfig: DeployableItemConfig = {
5050
publishOnTarget:values.publishOnTarget,
5151
publicToAll:values.publicToAll,
5252
publicToMarketplace:values.publicToMarketplace,
53+
applicationGid:item.applicationGid,
5354
};
5455
},
5556
execute:(params:any)=>deployApp(params)

‎client/packages/lowcoder/src/pages/setting/environments/config/data-sources.config.tsx‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ export const dataSourcesConfig: DeployableItemConfig = {
2323
envId:sourceEnv.environmentId,
2424
targetEnvId:targetEnv.environmentId,
2525
datasourceId:item.id,
26-
updateDependenciesIfNeeded:values.updateDependenciesIfNeeded
26+
updateDependenciesIfNeeded:values.updateDependenciesIfNeeded,
27+
datasourceGid:item.gid
2728
};
2829
},
2930
execute:(params:any)=>deployDataSource(params)

‎client/packages/lowcoder/src/pages/setting/environments/config/query.config.tsx‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ export const queryConfig: DeployableItemConfig = {
2424
envId:sourceEnv.environmentId,
2525
targetEnvId:targetEnv.environmentId,
2626
queryId:item.id,
27-
updateDependenciesIfNeeded:values.updateDependenciesIfNeeded
27+
updateDependenciesIfNeeded:values.updateDependenciesIfNeeded,
28+
queryGid:item.gid,
2829
};
2930
},
3031
execute:(params:any)=>deployQuery(params)

‎client/packages/lowcoder/src/pages/setting/environments/services/apps.service.ts‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export interface DeployAppParams {
1818
envId:string;
1919
targetEnvId:string;
2020
applicationId:string;
21+
applicationGid:string;
2122
updateDependenciesIfNeeded?:boolean;
2223
publishOnTarget?:boolean;
2324
publicToAll?:boolean;
@@ -79,7 +80,7 @@ export async function getMergedWorkspaceApps(
7980
// Fetch managed objects instead of managed apps
8081
letmanagedObjects:ManagedObject[]=[];
8182
try{
82-
managedObjects=awaitgetManagedObjects(environmentId);
83+
managedObjects=awaitgetManagedObjects(environmentId,ManagedObjectType.APP);
8384
}catch(error){
8485
console.error("Failed to fetch managed objects:",error);
8586
// Continue with empty managed list
@@ -125,7 +126,7 @@ export const deployApp = async (params: DeployAppParams): Promise<boolean> => {
125126

126127
if(response.status===200){
127128
awaittransferManagedObject(
128-
params.applicationId,
129+
params.applicationGid,
129130
params.envId,
130131
params.targetEnvId,
131132
ManagedObjectType.APP

‎client/packages/lowcoder/src/pages/setting/environments/services/datasources.service.ts‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ export interface DeployDataSourceParams {
2020
envId:string;
2121
targetEnvId:string;
2222
datasourceId:string;
23+
datasourceGid:string;
2324
updateDependenciesIfNeeded?:boolean;
25+
2426
}
2527
// Get data sources for a workspace - using your correct implementation
2628
exportasyncfunctiongetWorkspaceDataSources(
@@ -54,7 +56,6 @@ export async function getWorkspaceDataSources(
5456
orgId:workspaceId
5557
}
5658
});
57-
console.log("data source response",response);
5859

5960
// Check if response is valid
6061
if(!response.data){
@@ -157,12 +158,12 @@ export async function deployDataSource(params: DeployDataSourceParams): Promise<
157158
envId:params.envId,
158159
targetEnvId:params.targetEnvId,
159160
datasourceId:params.datasourceId,
160-
updateDependenciesIfNeeded:params.updateDependenciesIfNeeded??false
161+
updateDependenciesIfNeeded:params.updateDependenciesIfNeeded??false,
161162
}
162163
});
163164
if(response.status===200){
164165
awaittransferManagedObject(
165-
params.datasourceId,
166+
params.datasourceGid,
166167
params.envId,
167168
params.targetEnvId,
168169
ManagedObjectType.DATASOURCE

‎client/packages/lowcoder/src/pages/setting/environments/services/enterprise.service.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,6 @@ export async function getManagedQueries(environmentId: string): Promise<Query[]>
204204
environmentId
205205
}
206206
});
207-
console.log("Managed queries response function:",response.data);
208207

209208
if(!response.data.data||!Array.isArray(response.data.data)){
210209
return[];

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp