Skip to content

Commit 0d1a73e

Browse files
committed
app-catalog: Handle add repository api failure
This patch also handles closing the editor once install request is accepted and repository is added, instead of just waiting and saying installing we now show a notistack saying the request is accepted.
1 parent 3927672 commit 0d1a73e

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

app-catalog/src/components/charts/EditorDialog.tsx

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -112,14 +112,16 @@ export function EditorDialog(props: {
112112
});
113113
return;
114114
}
115-
if (!validateFormField(selectedVersion)) {
116-
enqueueSnackbar('Version is required', {
115+
116+
if (!validateFormField(selectedNamespace)) {
117+
enqueueSnackbar('Namespace is required', {
117118
variant: 'error',
118119
});
119120
return;
120121
}
121-
if (!validateFormField(selectedNamespace)) {
122-
enqueueSnackbar('Namespace is required', {
122+
123+
if (!validateFormField(selectedVersion)) {
124+
enqueueSnackbar('Version is required', {
123125
variant: 'error',
124126
});
125127
return;
@@ -149,8 +151,8 @@ export function EditorDialog(props: {
149151
chartInstallDescription
150152
)
151153
.then(() => {
152-
enqueueSnackbar(`Install release request for ${releaseName} created successfully`, {
153-
variant: 'info',
154+
enqueueSnackbar(`Installation request for ${releaseName} accepted`, {
155+
variant: 'info'
154156
})
155157
handleEditor(false);
156158
checkInstallStatus(releaseName);
@@ -161,6 +163,11 @@ export function EditorDialog(props: {
161163
variant: 'error',
162164
});
163165
});
166+
}).catch(error => {
167+
handleEditor(false);
168+
enqueueSnackbar(`Error adding repository ${error}`, {
169+
variant: 'error',
170+
});
164171
});
165172
}
166173

0 commit comments

Comments
 (0)