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

Commit38cd16b

Browse files
committed
refactor deploy modal
1 parent97b0aab commit38cd16b

File tree

2 files changed

+125
-126
lines changed

2 files changed

+125
-126
lines changed

‎client/packages/lowcoder/src/pages/setting/environments/components/DeployItemModal.tsx‎

Lines changed: 14 additions & 126 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ import { Environment } from '../types/environment.types';
66
import{DeployableItemConfig}from'../types/deployable-item.types';
77
import{useEnvironmentContext}from'../context/EnvironmentContext';
88
import{getEnvironmentTagColor,formatEnvironmentType}from'../utils/environmentUtils';
9-
import{ExclamationCircleOutlined,WarningOutlined}from'@ant-design/icons';
9+
import{ExclamationCircleOutlined}from'@ant-design/icons';
10+
import{showFirstCredentialOverwriteConfirm,showSecondCredentialOverwriteConfirm}from'./credentialConfirmations';
1011

1112
interfaceDeployItemModalProps{
1213
visible:boolean;
@@ -53,58 +54,20 @@ function DeployItemModal({
5354

5455
// First confirmation
5556
if(credentialConfirmationStep===0){
56-
Modal.confirm({
57-
title:(
58-
<divstyle={{display:'flex',alignItems:'center',color:'#ff7a00'}}>
59-
<WarningOutlinedstyle={{marginRight:8,fontSize:'18px'}}/>
60-
<spanstyle={{fontSize:'16px',fontWeight:'600'}}>Overwrite Credentials Warning</span>
61-
</div>
62-
),
63-
icon:null,
64-
content:(
65-
<divstyle={{padding:'16px 0'}}>
66-
<Alert
67-
message="This action will overwrite existing credentials in the target environment."
68-
description={
69-
<divstyle={{marginTop:'8px'}}>
70-
<pstyle={{margin:0,fontWeight:'500'}}>
71-
This is a serious operation that may affect other applications and users.
72-
</p>
73-
<pstyle={{margin:'8px 0 0 0',color:'#8c8c8c'}}>
74-
Are you sure you want to proceed?
75-
</p>
76-
</div>
77-
}
78-
type="warning"
79-
showIcon
80-
style={{
81-
marginBottom:0,
82-
border:'1px solid #fff2e8',
83-
borderRadius:'8px'
84-
}}
85-
/>
86-
</div>
87-
),
88-
okText:'Continue',
89-
cancelText:'Cancel',
90-
okButtonProps:{
91-
style:{
92-
backgroundColor:'#ff7a00',
93-
borderColor:'#ff7a00',
94-
fontWeight:'500'
95-
}
96-
},
97-
cancelButtonProps:{
98-
style:{
99-
fontWeight:'500'
100-
}
101-
},
102-
width:520,
103-
centered:false,
57+
showFirstCredentialOverwriteConfirm({
10458
onOk:()=>{
10559
setCredentialConfirmationStep(1);
10660
// Show second confirmation immediately
107-
showSecondConfirmation(fieldName);
61+
showSecondCredentialOverwriteConfirm({
62+
onOk:()=>{
63+
setCredentialConfirmationStep(2);
64+
form.setFieldsValue({[fieldName]:true});
65+
},
66+
onCancel:()=>{
67+
setCredentialConfirmationStep(0);
68+
form.setFieldsValue({[fieldName]:false});
69+
}
70+
});
10871
},
10972
onCancel:()=>{
11073
setCredentialConfirmationStep(0);
@@ -114,81 +77,6 @@ function DeployItemModal({
11477
}
11578
};
11679

117-
constshowSecondConfirmation=(fieldName:string)=>{
118-
Modal.confirm({
119-
title:(
120-
<divstyle={{display:'flex',alignItems:'center',color:'#ff4d4f'}}>
121-
<ExclamationCircleOutlinedstyle={{marginRight:8,fontSize:'18px'}}/>
122-
<spanstyle={{fontSize:'16px',fontWeight:'600'}}>Final Confirmation Required</span>
123-
</div>
124-
),
125-
icon:null,
126-
content:(
127-
<divstyle={{padding:'16px 0'}}>
128-
<Alert
129-
message="Final Warning: Credential Overwrite"
130-
description={
131-
<divstyle={{marginTop:'8px'}}>
132-
<pstyle={{margin:0,fontWeight:'500'}}>
133-
You are about to overwrite credentials in the target environment.
134-
This action cannot be undone and may break existing integrations.
135-
</p>
136-
<pstyle={{margin:'8px 0 0 0',color:'#8c8c8c'}}>
137-
Please confirm one more time.
138-
</p>
139-
</div>
140-
}
141-
type="error"
142-
showIcon
143-
style={{
144-
marginBottom:16,
145-
border:'1px solid #ffebee',
146-
borderRadius:'8px'
147-
}}
148-
/>
149-
<divstyle={{
150-
padding:'12px 16px',
151-
backgroundColor:'#fff2f0',
152-
borderRadius:'8px',
153-
border:'1px solid #ffccc7'
154-
}}>
155-
<pstyle={{
156-
margin:0,
157-
fontWeight:'600',
158-
color:'#cf1322',
159-
fontSize:'14px'
160-
}}>
161-
Are you absolutely certain you want to overwrite the credentials?
162-
</p>
163-
</div>
164-
</div>
165-
),
166-
okText:'Yes, Overwrite Credentials',
167-
okType:'danger',
168-
cancelText:'Cancel',
169-
okButtonProps:{
170-
style:{
171-
fontWeight:'500'
172-
}
173-
},
174-
cancelButtonProps:{
175-
style:{
176-
fontWeight:'500'
177-
}
178-
},
179-
width:520,
180-
centered:false,
181-
onOk:()=>{
182-
setCredentialConfirmationStep(2);
183-
form.setFieldsValue({[fieldName]:true});
184-
},
185-
onCancel:()=>{
186-
setCredentialConfirmationStep(0);
187-
form.setFieldsValue({[fieldName]:false});
188-
}
189-
});
190-
};
191-
19280
consthandleDeploy=async()=>{
19381
if(!config.deploy||!item)return;
19482

@@ -346,7 +234,7 @@ function DeployItemModal({
346234
returnnull;
347235
}
348236
})}
349-
237+
350238
<Form.Item>
351239
<Buttontype="default"onClick={onClose}style={{marginRight:8}}>
352240
Cancel
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
2+
import{Modal,Alert}from'antd';
3+
import{ExclamationCircleOutlined,WarningOutlined}from'@ant-design/icons';
4+
5+
interfaceConfirmHandlers{
6+
onOk:()=>void;
7+
onCancel:()=>void;
8+
}
9+
10+
/**
11+
* First-step confirmation modal (orange / warning).
12+
*/
13+
exportfunctionshowFirstCredentialOverwriteConfirm({ onOk, onCancel}:ConfirmHandlers){
14+
Modal.confirm({
15+
title:(
16+
<divstyle={{display:'flex',alignItems:'center',color:'#ff7a00'}}>
17+
<WarningOutlinedstyle={{marginRight:8,fontSize:18}}/>
18+
<spanstyle={{fontSize:16,fontWeight:600}}>Overwrite Credentials Warning</span>
19+
</div>
20+
),
21+
icon:null,
22+
content:(
23+
<divstyle={{padding:'16px 0'}}>
24+
<Alert
25+
message="This action will overwrite existing credentials in the target environment."
26+
description={
27+
<divstyle={{marginTop:8}}>
28+
<pstyle={{margin:0,fontWeight:500}}>
29+
This is a serious operation that may affect other applications and users.
30+
</p>
31+
<pstyle={{margin:'8px 0 0 0',color:'#8c8c8c'}}>
32+
Are you sure you want to proceed?
33+
</p>
34+
</div>
35+
}
36+
type="warning"
37+
showIcon
38+
style={{marginBottom:0,border:'1px solid #fff2e8',borderRadius:8}}
39+
/>
40+
</div>
41+
),
42+
okText:'Continue',
43+
cancelText:'Cancel',
44+
okButtonProps:{
45+
style:{backgroundColor:'#ff7a00',borderColor:'#ff7a00',fontWeight:500}
46+
},
47+
cancelButtonProps:{
48+
style:{fontWeight:500}
49+
},
50+
width:520,
51+
centered:false,
52+
onOk,
53+
onCancel
54+
});
55+
}
56+
57+
/**
58+
* Second-step (final) confirmation modal (red / danger).
59+
*/
60+
exportfunctionshowSecondCredentialOverwriteConfirm({ onOk, onCancel}:ConfirmHandlers){
61+
Modal.confirm({
62+
title:(
63+
<divstyle={{display:'flex',alignItems:'center',color:'#ff4d4f'}}>
64+
<ExclamationCircleOutlinedstyle={{marginRight:8,fontSize:18}}/>
65+
<spanstyle={{fontSize:16,fontWeight:600}}>Final Confirmation Required</span>
66+
</div>
67+
),
68+
icon:null,
69+
content:(
70+
<divstyle={{padding:'16px 0'}}>
71+
<Alert
72+
message="Final Warning: Credential Overwrite"
73+
description={
74+
<divstyle={{marginTop:8}}>
75+
<pstyle={{margin:0,fontWeight:500}}>
76+
You are about to overwrite credentials in the target environment. This action cannot be undone and may break existing integrations.
77+
</p>
78+
<pstyle={{margin:'8px 0 0 0',color:'#8c8c8c'}}>
79+
Please confirm one more time.
80+
</p>
81+
</div>
82+
}
83+
type="error"
84+
showIcon
85+
style={{marginBottom:16,border:'1px solid #ffebee',borderRadius:8}}
86+
/>
87+
<div
88+
style={{
89+
padding:'12px 16px',
90+
backgroundColor:'#fff2f0',
91+
borderRadius:8,
92+
border:'1px solid #ffccc7'
93+
}}
94+
>
95+
<pstyle={{margin:0,fontWeight:600,color:'#cf1322',fontSize:14}}>
96+
Are you absolutely certain you want to overwrite the credentials?
97+
</p>
98+
</div>
99+
</div>
100+
),
101+
okText:'Yes, Overwrite Credentials',
102+
okType:'danger',
103+
cancelText:'Cancel',
104+
okButtonProps:{style:{fontWeight:500}},
105+
cancelButtonProps:{style:{fontWeight:500}},
106+
width:520,
107+
centered:false,
108+
onOk,
109+
onCancel
110+
});
111+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp