Skip to content

Commit 0f7c5f3

Browse files
Merge pull request #1723 from iamfaran/fix/environment-type
[FIX] Make env type optional in frontend
2 parents 6816dcb + ac2cc48 commit 0f7c5f3

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ const EnvironmentsList: React.FC = () => {
8282
// Calculate environment type statistics
8383
const environmentStats = React.useMemo(() => {
8484
const stats = environments.reduce((acc, env) => {
85-
const type = env.environmentType.toUpperCase();
85+
const type = env.environmentType?.toUpperCase() || 'TEST';
8686
acc[type] = (acc[type] || 0) + 1;
8787
return acc;
8888
}, {} as Record<string, number>);
@@ -145,7 +145,7 @@ const EnvironmentsList: React.FC = () => {
145145
(env.environmentName || "").toLowerCase().includes(searchLower) ||
146146
(env.environmentFrontendUrl || "").toLowerCase().includes(searchLower) ||
147147
env.environmentId.toLowerCase().includes(searchLower) ||
148-
env.environmentType.toLowerCase().includes(searchLower)
148+
(env.environmentType || "").toLowerCase().includes(searchLower)
149149
);
150150
}).sort((a, b) => {
151151
// Sort by license status: licensed environments first

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ const EnvironmentsTable: React.FC<EnvironmentsTableProps> = ({
152152
<div style={{ display: 'flex', alignItems: 'center', gap: '12px' }}>
153153
<Avatar
154154
style={{
155-
backgroundColor: getAvatarColor(env.environmentType),
155+
backgroundColor: getAvatarColor(env.environmentType || 'TEST'),
156156
display: 'flex',
157157
alignItems: 'center',
158158
justifyContent: 'center'

client/packages/lowcoder/src/pages/setting/environments/types/environment.types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export interface Environment {
66
environmentName?: string;
77
environmentDescription?: string;
88
environmentIcon?: string;
9-
environmentType: string;
9+
environmentType?: string;
1010
environmentApiServiceUrl?: string;
1111
environmentNodeServiceUrl?: string;
1212
environmentFrontendUrl?: string;

client/packages/lowcoder/src/pages/setting/environments/utils/environmentUtils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,6 @@ export const getEnvironmentHeaderGradient = (envType: string | undefined): strin
6666
* @returns Formatted environment type string
6767
*/
6868
export const formatEnvironmentType = (envType: string | undefined): string => {
69-
if (!envType) return 'UNKNOWN';
69+
if (!envType) return 'TEST';
7070
return envType.toUpperCase();
7171
};

0 commit comments

Comments
 (0)