Skip to content

Commit ba8a118

Browse files
committed
WIP Stack actions
1 parent 85f5eec commit ba8a118

File tree

5 files changed

+79
-19
lines changed

5 files changed

+79
-19
lines changed

src/Exceptionless.Web/ClientApp/src/lib/features/stacks/components/StackOptionsDropdownMenu.svelte

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import { Stack } from '../models';
1313
import AddStackReferenceDialog from './dialogs/AddStackReferenceDialog.svelte';
1414
import RemoveStackDialog from './dialogs/RemoveStackDialog.svelte';
15+
import RequiresPromotedWebHookDialog from './dialogs/RequiresPromotedWebHookDialog.svelte';
1516
1617
interface Props {
1718
stack: Stack;
@@ -20,6 +21,7 @@
2021
let { stack }: Props = $props();
2122
let openAddStackReferenceDialog = $state<boolean>(false);
2223
let openRemoveStackDialog = $state<boolean>(false);
24+
let openRequiresPromotedWebHookDialog = $state<boolean>(false);
2325
2426
const addStackReference = mutateAddStackReference({
2527
get id() {
@@ -68,13 +70,16 @@
6870
}
6971
7072
if (response.status === 501) {
71-
toast.error('No promoted web hooks are configured for this project. Please add a promoted web hook to use this feature.');
72-
// confirm dialog .confirm(response.data.message, translateService.T("Manage Integrations"))
73-
await goto(`/next/account/manage/notifications?project=${stack.project_id}`);
73+
openRequiresPromotedWebHookDialog = true;
7474
return;
7575
}
7676
}
7777
78+
async function navigateToProjectIntegrations() {
79+
// TODO: Verify this works once page is added.
80+
await goto(`/next/project/${stack.project_id}/manage/integrations`);
81+
}
82+
7883
async function updateCritical() {
7984
if (stack.occurrences_are_critical) {
8085
await markStackAsNotCritical.mutateAsync();
@@ -132,3 +137,4 @@
132137

133138
<AddStackReferenceDialog bind:open={openAddStackReferenceDialog} save={addReference} />
134139
<RemoveStackDialog bind:open={openRemoveStackDialog} {remove} />
140+
<RequiresPromotedWebHookDialog bind:open={openRequiresPromotedWebHookDialog} navigate={navigateToProjectIntegrations} />

src/Exceptionless.Web/ClientApp/src/lib/features/stacks/components/StackStatusDropdownMenu.svelte

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
66
import { mutateStackFixedStatus, mutateStackSnoozedStatus, mutateStackStatus } from '../api.svelte';
77
import { Stack, StackStatus } from '../models';
8+
import MarkStackDiscardedDialog from './dialogs/MarkStackDiscardedDialog.svelte';
89
import MarkStackFixedInVersionDialog from './dialogs/MarkStackFixedInVersionDialog.svelte';
910
1011
interface Props {
@@ -23,6 +24,7 @@
2324
{ label: 'Discarded', value: StackStatus.Discarded }
2425
];
2526
27+
let openMarkStackDiscardedDialog = $state<boolean>(false);
2628
let openMarkStackFixedInVersionDialog = $state<boolean>(false);
2729
let selected = $derived((items.find((item) => item.value === stack?.status) || items[items.length - 1]) as Item);
2830
@@ -89,17 +91,7 @@
8991
if (stack.status === StackStatus.Discarded) {
9092
return;
9193
}
92-
// if (vm.stack.status === "discarded") {
93-
// return updateOpen();
94-
// }
95-
// translateService.T(
96-
// "Are you sure you want to all current stack events and discard any future stack events?"
97-
// ) +
98-
// " " +
99-
// translateService.T(
100-
// "All future occurrences will be discarded and will not count against your event limit."
101-
// );
102-
//changeStatus(vm._stackId, "discarded")
94+
10395
await updateStackStatus.mutateAsync(StackStatus.Discarded);
10496
}
10597
</script>
@@ -129,11 +121,13 @@
129121
</DropdownMenu.SubContent>
130122
</DropdownMenu.Sub>
131123
<DropdownMenu.Item title="Stop sending occurrence notifications for this stack" onclick={() => updateIgnore()}>Ignored</DropdownMenu.Item>
132-
<DropdownMenu.Item title="All future occurrences will be discarded and will not count against your event limit" onclick={() => updateDiscard()}
133-
>Discarded</DropdownMenu.Item
124+
<DropdownMenu.Item
125+
title="All future occurrences will be discarded and will not count against your event limit"
126+
onclick={() => (openMarkStackDiscardedDialog = true)}>Discarded</DropdownMenu.Item
134127
>
135128
</DropdownMenu.Group>
136129
</DropdownMenu.Content>
137130
</DropdownMenu.Root>
138131

132+
<MarkStackDiscardedDialog bind:open={openMarkStackDiscardedDialog} discard={updateDiscard} />
139133
<MarkStackFixedInVersionDialog bind:open={openMarkStackFixedInVersionDialog} save={updateFixed} />
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<script lang="ts">
2+
import { P } from '$comp/typography';
3+
import * as AlertDialog from '$comp/ui/alert-dialog';
4+
import { buttonVariants } from '$comp/ui/button';
5+
6+
interface Props {
7+
discard: () => Promise<void>;
8+
open: boolean;
9+
}
10+
11+
let { discard, open = $bindable() }: Props = $props();
12+
13+
async function onSubmit() {
14+
await discard();
15+
open = false;
16+
}
17+
</script>
18+
19+
<AlertDialog.Root bind:open>
20+
<AlertDialog.Content>
21+
<AlertDialog.Header>
22+
<AlertDialog.Title>Discard Stack</AlertDialog.Title>
23+
<AlertDialog.Description>Are you sure you want to all current stack events and discard any future stack events?</AlertDialog.Description>
24+
</AlertDialog.Header>
25+
All future occurrences will be discarded and will not count against your event limit.
26+
<AlertDialog.Footer>
27+
<AlertDialog.Cancel>Cancel</AlertDialog.Cancel>
28+
<AlertDialog.Action class={buttonVariants({ variant: 'destructive' })} onclick={onSubmit}>Discard Stack</AlertDialog.Action>
29+
</AlertDialog.Footer>
30+
</AlertDialog.Content>
31+
</AlertDialog.Root>

src/Exceptionless.Web/ClientApp/src/lib/features/stacks/components/dialogs/RemoveStackDialog.svelte

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
remove: () => Promise<void>;
88
}
99
10-
let { open = $bindable(), remove: removeStack }: Props = $props();
10+
let { open = $bindable(), remove }: Props = $props();
1111
1212
async function onSubmit() {
13-
await removeStack();
13+
await remove();
1414
open = false;
1515
}
1616
</script>
@@ -23,7 +23,7 @@
2323
</AlertDialog.Header>
2424
<AlertDialog.Footer>
2525
<AlertDialog.Cancel>Cancel</AlertDialog.Cancel>
26-
<AlertDialog.Action class={buttonVariants({ variant: 'destructive' })} onclick={onSubmit}>DELETE STACK</AlertDialog.Action>
26+
<AlertDialog.Action class={buttonVariants({ variant: 'destructive' })} onclick={onSubmit}>Delete Stack</AlertDialog.Action>
2727
</AlertDialog.Footer>
2828
</AlertDialog.Content>
2929
</AlertDialog.Root>
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<script lang="ts">
2+
import * as AlertDialog from '$comp/ui/alert-dialog';
3+
interface Props {
4+
navigate: () => Promise<void>;
5+
open: boolean;
6+
}
7+
8+
let { navigate, open = $bindable() }: Props = $props();
9+
10+
async function onSubmit() {
11+
await navigate();
12+
open = false;
13+
}
14+
</script>
15+
16+
<AlertDialog.Root bind:open>
17+
<AlertDialog.Content>
18+
<AlertDialog.Header>
19+
<AlertDialog.Title>Manage Integrations</AlertDialog.Title>
20+
<AlertDialog.Description
21+
>No promoted web hooks are configured for this project. Please add a promoted web hook to use this feature.</AlertDialog.Description
22+
>
23+
</AlertDialog.Header>
24+
<AlertDialog.Footer>
25+
<AlertDialog.Cancel>Cancel</AlertDialog.Cancel>
26+
<AlertDialog.Action onclick={onSubmit}>Manage Integrations</AlertDialog.Action>
27+
</AlertDialog.Footer>
28+
</AlertDialog.Content>
29+
</AlertDialog.Root>

0 commit comments

Comments
 (0)