Skip to content

Commit 7daf6d5

Browse files
committed
Add deployment related trans
1 parent 5b241f8 commit 7daf6d5

File tree

7 files changed

+111
-45
lines changed

7 files changed

+111
-45
lines changed

client/packages/lowcoder/src/i18n/locales/en.ts

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2808,6 +2808,63 @@ export const en = {
28082808
"managedError": "Failed to change managed status for {name}"
28092809
},
28102810

2811+
// Deploy Modal and Credential Confirmations
2812+
"deployModal": {
2813+
"deployTitle": "Deploy {singularLabel}: {name}",
2814+
"loadingEnvironments": "Loading environments...",
2815+
"sourceEnvironment": "Source Environment",
2816+
"targetEnvironment": "Target Environment",
2817+
"selectTargetEnvironment": "Select target environment",
2818+
"selectTargetEnvironmentValidation": "Please select a target environment",
2819+
"confirmed": "Confirmed",
2820+
"cancel": "Cancel",
2821+
"deploy": "Deploy",
2822+
"targetEnvironmentNotFound": "Target environment not found",
2823+
"confirmCredentialOverwrite": "Please confirm credential overwrite before deploying",
2824+
"deploySuccess": "Successfully deployed {name} to target environment",
2825+
"deployFailed": "Failed to deploy {singularLabel}",
2826+
"selectFieldValidation": "Please select {label}",
2827+
"selectFieldPlaceholder": "Select {label}",
2828+
"inputFieldValidation": "Please input {label}",
2829+
"inputFieldPlaceholder": "Enter {label}"
2830+
},
2831+
2832+
"credentialConfirmations": {
2833+
"firstConfirmation": {
2834+
"title": "Overwrite Credentials Warning",
2835+
"message": "This action will overwrite existing credentials in the target environment.",
2836+
"description": "This is a serious operation that may affect other applications and users.",
2837+
"question": "Are you sure you want to proceed?",
2838+
"continueButton": "Continue",
2839+
"cancelButton": "Cancel"
2840+
},
2841+
"secondConfirmation": {
2842+
"title": "Final Confirmation Required",
2843+
"message": "Final Warning: Credential Overwrite",
2844+
"description": "You are about to overwrite credentials in the target environment. This action cannot be undone and may break existing integrations.",
2845+
"confirmOnceMore": "Please confirm one more time.",
2846+
"finalQuestion": "Are you absolutely certain you want to overwrite the credentials?",
2847+
"confirmButton": "Yes, Overwrite Credentials",
2848+
"cancelButton": "Cancel"
2849+
}
2850+
},
2851+
2852+
"config": {
2853+
"singularLabels": {
2854+
"app": "App",
2855+
"dataSource": "Data Source",
2856+
"query": "Query",
2857+
"workspace": "Workspace"
2858+
},
2859+
"fields": {
2860+
"updateDependenciesIfNeeded": "Update Dependencies If Needed",
2861+
"publishOnTarget": "Publish On Target",
2862+
"publicToAll": "Public To All",
2863+
"publicToMarketplace": "Public To Marketplace",
2864+
"overwriteCredentials": "Overwrite Credentials"
2865+
}
2866+
},
2867+
28112868
// Service error messages
28122869
"services": {
28132870
"environments": {

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

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import React, { useState, useEffect } from 'react';
33
import { Modal, Form, Select, Checkbox, Button, Spin, Input, Tag, Space, Alert } from 'antd';
44
import { messageInstance } from 'lowcoder-design/src/components/GlobalInstances';
5+
import { trans } from "i18n";
56
import { useSelector } from 'react-redux';
67
import { selectLicensedEnvironments, selectEnvironmentsLoading } from 'redux/selectors/enterpriseSelectors';
78
import { Environment } from '../types/environment.types';
@@ -87,13 +88,13 @@ function DeployItemModal({
8788
const targetEnv = licensedEnvironments.find(env => env.environmentId === values.targetEnvId);
8889

8990
if (!targetEnv) {
90-
messageInstance.error('Target environment not found');
91+
messageInstance.error(trans("enterprise.environments.deployModal.targetEnvironmentNotFound"));
9192
return;
9293
}
9394

9495
// Additional check for credential overwrite
9596
if (values.deployCredential && credentialConfirmationStep !== 2) {
96-
messageInstance.error('Please confirm credential overwrite before deploying');
97+
messageInstance.error(trans("enterprise.environments.deployModal.confirmCredentialOverwrite"));
9798
return;
9899
}
99100

@@ -105,36 +106,39 @@ function DeployItemModal({
105106
// Execute deployment
106107
await config.deploy.execute(params);
107108

108-
messageInstance.success(`Successfully deployed ${item.name} to target environment`);
109+
messageInstance.success(trans("enterprise.environments.deployModal.deploySuccess", { name: item.name }));
109110
if (onSuccess) onSuccess();
110111
onClose();
111112
} catch (error) {
112113
console.error('Deployment error:', error);
113-
messageInstance.error(`Failed to deploy ${config.deploy.singularLabel.toLowerCase()}`);
114+
messageInstance.error(trans("enterprise.environments.deployModal.deployFailed", { singularLabel: config.deploy.singularLabel.toLowerCase() }));
114115
} finally {
115116
setDeploying(false);
116117
}
117118
};
118119

119120
return (
120121
<Modal
121-
title={`Deploy ${config.deploy.singularLabel}: ${item?.name || ''}`}
122+
title={trans("enterprise.environments.deployModal.deployTitle", {
123+
singularLabel: config.deploy.singularLabel,
124+
name: item?.name || ''
125+
})}
122126
open={visible}
123127
onCancel={onClose}
124128
footer={null}
125129
destroyOnHidden
126130
>
127131
{isLoading ? (
128132
<div style={{ textAlign: 'center', padding: '20px' }}>
129-
<Spin tip="Loading environments..." />
133+
<Spin tip={trans("enterprise.environments.deployModal.loadingEnvironments")} />
130134
</div>
131135
) : (
132136
<Form
133137
form={form}
134138
layout="vertical"
135139
>
136140
{/* Source environment display */}
137-
<Form.Item label="Source Environment">
141+
<Form.Item label={trans("enterprise.environments.deployModal.sourceEnvironment")}>
138142
<Space>
139143
<strong>{sourceEnvironment.environmentName}</strong>
140144
{sourceEnvironment.environmentType && (
@@ -147,10 +151,10 @@ function DeployItemModal({
147151

148152
<Form.Item
149153
name="targetEnvId"
150-
label="Target Environment"
151-
rules={[{ required: true, message: 'Please select a target environment' }]}
154+
label={trans("enterprise.environments.deployModal.targetEnvironment")}
155+
rules={[{ required: true, message: trans("enterprise.environments.deployModal.selectTargetEnvironmentValidation") }]}
152156
>
153-
<Select placeholder="Select target environment">
157+
<Select placeholder={trans("enterprise.environments.deployModal.selectTargetEnvironment")}>
154158
{targetEnvironments.map((env) => (
155159
<Select.Option key={env.environmentId} value={env.environmentId}>
156160
<Space>
@@ -196,7 +200,7 @@ function DeployItemModal({
196200
style={{ marginLeft: 8 }}
197201
icon={<ExclamationCircleOutlined />}
198202
>
199-
Confirmed
203+
{trans("enterprise.environments.deployModal.confirmed")}
200204
</Tag>
201205
)}
202206
</Checkbox>
@@ -209,9 +213,9 @@ function DeployItemModal({
209213
name={field.name}
210214
label={field.label}
211215
initialValue={field.defaultValue}
212-
rules={field.required ? [{ required: true, message: `Please select ${field.label}` }] : undefined}
216+
rules={field.required ? [{ required: true, message: trans("enterprise.environments.deployModal.selectFieldValidation", { label: field.label }) }] : undefined}
213217
>
214-
<Select placeholder={`Select ${field.label}`}>
218+
<Select placeholder={trans("enterprise.environments.deployModal.selectFieldPlaceholder", { label: field.label })}>
215219
{field.options?.map(option => (
216220
<Select.Option key={option.value} value={option.value}>
217221
{option.label}
@@ -227,9 +231,9 @@ function DeployItemModal({
227231
name={field.name}
228232
label={field.label}
229233
initialValue={field.defaultValue}
230-
rules={field.required ? [{ required: true, message: `Please input ${field.label}` }] : undefined}
234+
rules={field.required ? [{ required: true, message: trans("enterprise.environments.deployModal.inputFieldValidation", { label: field.label }) }] : undefined}
231235
>
232-
<Input placeholder={`Enter ${field.label}`} />
236+
<Input placeholder={trans("enterprise.environments.deployModal.inputFieldPlaceholder", { label: field.label })} />
233237
</Form.Item>
234238
);
235239
default:
@@ -239,10 +243,10 @@ function DeployItemModal({
239243

240244
<Form.Item>
241245
<Button type="default" onClick={onClose} style={{ marginRight: 8 }}>
242-
Cancel
246+
{trans("enterprise.environments.deployModal.cancel")}
243247
</Button>
244248
<Button type="primary" onClick={handleDeploy} loading={deploying}>
245-
Deploy
249+
{trans("enterprise.environments.deployModal.deploy")}
246250
</Button>
247251
</Form.Item>
248252
</Form>

client/packages/lowcoder/src/pages/setting/environments/components/credentialConfirmations.tsx

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
21
import { Modal, Alert } from 'antd';
32
import { ExclamationCircleOutlined, WarningOutlined } from '@ant-design/icons';
3+
import { trans } from "i18n";
44

55
interface ConfirmHandlers {
66
onOk: () => void;
@@ -15,21 +15,23 @@ export function showFirstCredentialOverwriteConfirm({ onOk, onCancel }: ConfirmH
1515
title: (
1616
<div style={{ display: 'flex', alignItems: 'center', color: '#ff7a00' }}>
1717
<WarningOutlined style={{ marginRight: 8, fontSize: 18 }} />
18-
<span style={{ fontSize: 16, fontWeight: 600 }}>Overwrite Credentials Warning</span>
18+
<span style={{ fontSize: 16, fontWeight: 600 }}>
19+
{trans("enterprise.environments.credentialConfirmations.firstConfirmation.title")}
20+
</span>
1921
</div>
2022
),
2123
icon: null,
2224
content: (
2325
<div style={{ padding: '16px 0' }}>
2426
<Alert
25-
message="This action will overwrite existing credentials in the target environment."
27+
message={trans("enterprise.environments.credentialConfirmations.firstConfirmation.message")}
2628
description={
2729
<div style={{ marginTop: 8 }}>
2830
<p style={{ margin: 0, fontWeight: 500 }}>
29-
This is a serious operation that may affect other applications and users.
31+
{trans("enterprise.environments.credentialConfirmations.firstConfirmation.description")}
3032
</p>
3133
<p style={{ margin: '8px 0 0 0', color: '#8c8c8c' }}>
32-
Are you sure you want to proceed?
34+
{trans("enterprise.environments.credentialConfirmations.firstConfirmation.question")}
3335
</p>
3436
</div>
3537
}
@@ -39,8 +41,8 @@ export function showFirstCredentialOverwriteConfirm({ onOk, onCancel }: ConfirmH
3941
/>
4042
</div>
4143
),
42-
okText: 'Continue',
43-
cancelText: 'Cancel',
44+
okText: trans("enterprise.environments.credentialConfirmations.firstConfirmation.continueButton"),
45+
cancelText: trans("enterprise.environments.credentialConfirmations.firstConfirmation.cancelButton"),
4446
okButtonProps: {
4547
style: { backgroundColor: '#ff7a00', borderColor: '#ff7a00', fontWeight: 500 }
4648
},
@@ -62,21 +64,23 @@ export function showSecondCredentialOverwriteConfirm({ onOk, onCancel }: Confirm
6264
title: (
6365
<div style={{ display: 'flex', alignItems: 'center', color: '#ff4d4f' }}>
6466
<ExclamationCircleOutlined style={{ marginRight: 8, fontSize: 18 }} />
65-
<span style={{ fontSize: 16, fontWeight: 600 }}>Final Confirmation Required</span>
67+
<span style={{ fontSize: 16, fontWeight: 600 }}>
68+
{trans("enterprise.environments.credentialConfirmations.secondConfirmation.title")}
69+
</span>
6670
</div>
6771
),
6872
icon: null,
6973
content: (
7074
<div style={{ padding: '16px 0' }}>
7175
<Alert
72-
message="Final Warning: Credential Overwrite"
76+
message={trans("enterprise.environments.credentialConfirmations.secondConfirmation.message")}
7377
description={
7478
<div style={{ marginTop: 8 }}>
7579
<p style={{ 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.
80+
{trans("enterprise.environments.credentialConfirmations.secondConfirmation.description")}
7781
</p>
7882
<p style={{ margin: '8px 0 0 0', color: '#8c8c8c' }}>
79-
Please confirm one more time.
83+
{trans("enterprise.environments.credentialConfirmations.secondConfirmation.confirmOnceMore")}
8084
</p>
8185
</div>
8286
}
@@ -93,14 +97,14 @@ export function showSecondCredentialOverwriteConfirm({ onOk, onCancel }: Confirm
9397
}}
9498
>
9599
<p style={{ margin: 0, fontWeight: 600, color: '#cf1322', fontSize: 14 }}>
96-
Are you absolutely certain you want to overwrite the credentials?
100+
{trans("enterprise.environments.credentialConfirmations.secondConfirmation.finalQuestion")}
97101
</p>
98102
</div>
99103
</div>
100104
),
101-
okText: 'Yes, Overwrite Credentials',
105+
okText: trans("enterprise.environments.credentialConfirmations.secondConfirmation.confirmButton"),
102106
okType: 'danger',
103-
cancelText: 'Cancel',
107+
cancelText: trans("enterprise.environments.credentialConfirmations.secondConfirmation.cancelButton"),
104108
okButtonProps: { style: { fontWeight: 500 } },
105109
cancelButtonProps: { style: { fontWeight: 500 } },
106110
width: 520,

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

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,47 +2,45 @@
22
import { DeployableItemConfig } from '../types/deployable-item.types';
33
import { Environment } from '../types/environment.types';
44
import { deployApp } from '../services/apps.service';
5-
5+
import { trans } from "i18n";
66
import { App } from '../types/app.types';
77

8-
9-
108
// Define AppStats interface if not already defined
119

1210

1311
export const appsConfig: DeployableItemConfig = {
1412

1513

1614
deploy: {
17-
singularLabel: 'App',
15+
singularLabel: trans("enterprise.environments.config.singularLabels.app"),
1816
fields: [
1917
{
2018
name: 'updateDependenciesIfNeeded',
21-
label: 'Update Dependencies If Needed',
19+
label: trans("enterprise.environments.config.fields.updateDependenciesIfNeeded"),
2220
type: 'checkbox',
2321
defaultValue: false
2422
},
2523
{
2624
name: 'publishOnTarget',
27-
label: 'Publish On Target',
25+
label: trans("enterprise.environments.config.fields.publishOnTarget"),
2826
type: 'checkbox',
2927
defaultValue: false
3028
},
3129
{
3230
name: 'publicToAll',
33-
label: 'Public To All',
31+
label: trans("enterprise.environments.config.fields.publicToAll"),
3432
type: 'checkbox',
3533
defaultValue: false
3634
},
3735
{
3836
name: 'publicToMarketplace',
39-
label: 'Public To Marketplace',
37+
label: trans("enterprise.environments.config.fields.publicToMarketplace"),
4038
type: 'checkbox',
4139
defaultValue: false
4240
},
4341
{
4442
name: 'deployCredential',
45-
label: 'Overwrite Credentials',
43+
label: trans("enterprise.environments.config.fields.overwriteCredentials"),
4644
type: 'checkbox',
4745
defaultValue: false
4846
}

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@ import { DeployableItemConfig } from '../types/deployable-item.types';
44
import { DataSource} from '../types/datasource.types';
55
import { Environment } from '../types/environment.types';
66
import { deployDataSource, DataSourceStats } from '../services/datasources.service';
7+
import { trans } from "i18n";
78

89
export const dataSourcesConfig: DeployableItemConfig = {
910
deploy: {
10-
singularLabel: 'Data Source',
11+
singularLabel: trans("enterprise.environments.config.singularLabels.dataSource"),
1112
fields: [
1213
{
1314
name: 'deployCredential',
14-
label: 'Overwrite Credentials',
15+
label: trans("enterprise.environments.config.fields.overwriteCredentials"),
1516
type: 'checkbox',
1617
defaultValue: false
1718
}

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,16 @@ import { DeployableItemConfig } from '../types/deployable-item.types';
33
import { Query } from '../types/query.types';
44
import { deployQuery } from '../services/query.service';
55
import { Environment } from '../types/environment.types';
6+
import { trans } from "i18n";
67

78
export const queryConfig: DeployableItemConfig = {
89

910
deploy: {
10-
singularLabel: 'Query',
11+
singularLabel: trans("enterprise.environments.config.singularLabels.query"),
1112
fields: [
1213
{
1314
name: 'deployCredential',
14-
label: 'Overwrite Credentials',
15+
label: trans("enterprise.environments.config.fields.overwriteCredentials"),
1516
type: 'checkbox',
1617
defaultValue: false
1718
}

client/packages/lowcoder/src/pages/setting/environments/config/workspace.config.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@ import { DeployableItemConfig } from '../types/deployable-item.types';
44
import { Environment } from '../types/environment.types';
55
import { deployWorkspace } from '../services/workspace.service';
66
import { Workspace } from '../types/workspace.types';
7+
import { trans } from "i18n";
78

89
export const workspaceConfig: DeployableItemConfig = {
910

1011
// Deploy configuration
1112
deploy: {
12-
singularLabel: 'Workspace',
13+
singularLabel: trans("enterprise.environments.config.singularLabels.workspace"),
1314
fields: [
1415
// Removed deployCredential field as workspaces don't need credential overwrite
1516
],

0 commit comments

Comments
 (0)