Skip to content

Commit 7a6626c

Browse files
committed
disable button unless managed
1 parent cae995a commit 7a6626c

File tree

1 file changed

+27
-17
lines changed

1 file changed

+27
-17
lines changed

client/packages/lowcoder/src/pages/setting/environments/utils/columnFactories.tsx

Lines changed: 27 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -141,27 +141,37 @@ export function createDeployColumn<T extends DeployableItem, S extends BaseStats
141141
return {
142142
title: 'Actions',
143143
key: 'actions',
144-
render: (_, record: T) => (
145-
<Space>
146-
<Tooltip title={`Deploy this ${config.singularLabel.toLowerCase()} to another environment`}>
147-
<Button
148-
icon={<CloudUploadOutlined />}
149-
onClick={(e) => {
150-
e.stopPropagation(); // Prevent row click navigation
151-
openDeployModal(record, config, environment);
152-
}}
153-
type="primary"
154-
ghost
144+
render: (_, record: T) => {
145+
// Check if the item is managed
146+
const isManaged = record.managed === true;
147+
148+
return (
149+
<Space>
150+
<Tooltip title={isManaged
151+
? `Deploy this ${config.singularLabel.toLowerCase()} to another environment`
152+
: `Item must be managed before it can be deployed`}
155153
>
156-
Deploy
157-
</Button>
158-
</Tooltip>
159-
</Space>
160-
),
154+
<Button
155+
icon={<CloudUploadOutlined />}
156+
onClick={(e) => {
157+
e.stopPropagation(); // Prevent row click navigation
158+
if (isManaged) {
159+
openDeployModal(record, config, environment);
160+
}
161+
}}
162+
type="primary"
163+
ghost
164+
disabled={!isManaged}
165+
>
166+
Deploy
167+
</Button>
168+
</Tooltip>
169+
</Space>
170+
);
171+
},
161172
};
162173
}
163174

164-
165175
// App-specific columns
166176
export function createPublishedColumn<T extends { published?: boolean }>(): ColumnType<T> {
167177
return {

0 commit comments

Comments
 (0)