Skip to content

Commit b99ed1a

Browse files
committed
Add inUse check back to list delete
1 parent 042e5ce commit b99ed1a

File tree

1 file changed

+21
-9
lines changed

1 file changed

+21
-9
lines changed

frontend/src/pages/org/browser-profiles-list.ts

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -382,21 +382,33 @@ export class BrowserProfilesList extends BtrixElement {
382382

383383
private async deleteProfile(profile: Profile) {
384384
try {
385-
await this.api.fetch<Profile & { error?: boolean }>(
385+
const data = await this.api.fetch<Profile & { error?: boolean }>(
386386
`/orgs/${this.orgId}/profiles/${profile.id}`,
387387
{
388388
method: "DELETE",
389389
},
390390
);
391391

392-
this.notify.toast({
393-
message: msg(html`Deleted <strong>${profile.name}</strong>.`),
394-
variant: "success",
395-
icon: "check2-circle",
396-
id: "browser-profile-deleted-status",
397-
});
398-
399-
void this.fetchBrowserProfiles();
392+
if (data.error && data.inUse) {
393+
this.notify.toast({
394+
message: msg(
395+
html`Could not delete <strong>${profile.name}</strong>, currently in
396+
use. Please remove browser profile from all Crawl Workflows to
397+
continue.`,
398+
),
399+
variant: "warning",
400+
duration: 15000,
401+
});
402+
} else {
403+
this.notify.toast({
404+
message: msg(html`Deleted <strong>${profile.name}</strong>.`),
405+
variant: "success",
406+
icon: "check2-circle",
407+
id: "browser-profile-deleted-status",
408+
});
409+
410+
void this.fetchBrowserProfiles();
411+
}
400412
} catch (e) {
401413
this.notify.toast({
402414
message: msg("Sorry, couldn't delete browser profile at this time."),

0 commit comments

Comments
 (0)