Skip to content

Commit

Permalink
fix: some bugs for scope config (#7443)
Browse files Browse the repository at this point in the history
  • Loading branch information
mintsweet authored May 8, 2024
1 parent 1b1291f commit 653456f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ export const ScopeConfigSelect = ({ plugin, connectionId, scopeConfigId, onCance
[data, scopeConfigId],
);

const defaultName = useMemo(() => `shared-config-<${(data ?? []).length}>`, [data]);

useEffect(() => {
setTrId(scopeConfigId);
}, [scopeConfigId]);
Expand Down Expand Up @@ -103,6 +105,7 @@ export const ScopeConfigSelect = ({ plugin, connectionId, scopeConfigId, onCance
<ScopeConfigForm
plugin={plugin}
connectionId={connectionId}
defaultName={defaultName}
onCancel={handleHideDialog}
onSubmit={handleSubmit}
/>
Expand Down
8 changes: 7 additions & 1 deletion config-ui/src/routes/connection/connection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -232,12 +232,18 @@ export const Connection = () => {

const handleScopeConfigChange = async (scopeConfigId?: ID) => {
if (!scopeConfigId) {
setVersion(version + 1);
return;
}

const [success, res] = await operator(() => API.scopeConfig.check(plugin, scopeConfigId), { hideToast: true });

if (success) {
if (!res.projects) {
setVersion(version + 1);
return;
}

modal.success({
closable: true,
centered: true,
Expand All @@ -250,7 +256,7 @@ export const Connection = () => {
</div>
<ul>
{res.projects.map((it: any) => (
<li style={{ marginBottom: 10 }}>
<li key={it.name} style={{ marginBottom: 10 }}>
<Space>
<span>{it.name}</span>
<Button
Expand Down

0 comments on commit 653456f

Please sign in to comment.