Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(web): Add a modal overlay when prompt is executing #5142

Merged
merged 1 commit into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions app/web/src/components/Workspace/WorkspaceCustomizeAssets.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
<!-- eslint-disable vue/no-multiple-template-root -->
<template>
<div
v-if="generatingPrompt"
class="text-center text-2xl z-100 absolute w-full h-full bg-black bg-opacity-50 flex flex-row justify-center items-center"
>
<div class="bg-black text-white w-1/5 rounded-lg">
<LoadingMessage>Executing Prompt...</LoadingMessage>
</div>
</div>
<component
:is="ResizablePanel"
ref="leftResizablePanelRef"
Expand Down Expand Up @@ -138,6 +146,7 @@ import {
Stack,
DropdownMenu,
DropdownMenuItemObjectDef,
LoadingMessage,
} from "@si/vue-lib/design-system";
import { useRoute } from "vue-router";
import { useAssetStore } from "@/store/asset.store";
Expand Down Expand Up @@ -263,4 +272,12 @@ const tabContentSlug = computed<"assets" | "newassets">(() => {
return "assets";
}
});

const generatingPrompt = ref(false);
watch(
() => funcStore.executingPrompt,
() => {
generatingPrompt.value = funcStore.executingPrompt;
},
);
</script>
9 changes: 9 additions & 0 deletions app/web/src/store/func/funcs.store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ export const useFuncStore = () => {
generatingFuncCode: {} as Record<FuncId, AwsCliCommand>,
/** Whether the "generate AWS function" panel is toggled open */
generateAwsFunctionPanelToggled: false,
executingPrompt: false,
// So we can ignore websocket update originated by this client
clientUlid: ulid(),
}),
Expand Down Expand Up @@ -715,6 +716,8 @@ export const useFuncStore = () => {
if (changeSetsStore.headSelected)
changeSetsStore.creatingChangeSet = true;

this.executingPrompt = true;

return new ApiRequest<{
command: string;
subcommand: string;
Expand All @@ -723,6 +726,12 @@ export const useFuncStore = () => {
url: API_PREFIX.concat([funcId, "generate_aws_function"]),
params: { command, subcommand, schemaVariantId },
keyRequestStatusBy: funcId,
onSuccess: (response) => {
this.executingPrompt = false;
},
onFail: () => {
this.executingPrompt = false;
},
});
},

Expand Down
Loading