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

Launch Anvil From the Client #105

Open
wants to merge 42 commits into
base: main
Choose a base branch
from
Open

Conversation

kaganAtZetane
Copy link
Contributor

@kaganAtZetane kaganAtZetane commented Jun 13, 2024

This is currently in testing phase, This also address issue #193 #197

Release Notes for starting anvil directly from the client:

NOTE: This feature is not available on pip, or development environment, but only in compiled apps.


UX:
1) On a launch, the client first checks if it can ping the anvil with the given set of configuration. If it can ping(for e.g. if the settings are pointing to the cloud, or user starts anvil separately), then the client launches as usual. 

If not, then the client checks if the embedded anvil has a config file. If yes, then client displays a confirmation modal, that has the settings. If user wishes, it can just launch the anvil from that config file. If not, user is displayed with the Anvil Configuration modal.

Anvil configurations Modal has two tabs, Anvil configurations and SetKubeContext. SetKubeContext is disabled if the chosen configuration does not point to a local address. Moreover, there’s Save & Relaunch Button, which is disabled if the configuration is not local OR it’s local but user hasn’t chosen a context and driver in SetKubeContext.

From SetKubeContext, user can choose a context and driver(minikube or docker). And then from there, they can click Save & Relaunch button to launch anvil. Once the loading is complete user can close the modal and start using anvil.

If in anytime, for any reason, we cannot ping anvil(client pings anvil in every 2 seconds), then we disable Run and Rebuild buttons.


What to Test:

1) Local launch.

2) Change Local launch context/driver, and relaunch.

  1. Run pipelines, both using docker-driver and minikube.

3) Failed launches(for e.g. try to run without opening docker desktop, to see the error)

4) Cloud.(Also, close and reopen the app after choosing cloud. It shouldn’t display the config modal)

  2. Try to run on pip. Add the anvil folder manually to the pip PATH, and run it. It must not display the modals nor let you change the context. Configurations can still be changed tho(cloud vs. local)


  3. Test agents, compilations and test runs(already tested on my end, they’re running fine, but it won’t hurt if other users also test them)

@kaganAtZetane kaganAtZetane self-assigned this Jun 13, 2024
@kaganAtZetane kaganAtZetane marked this pull request as draft June 13, 2024 22:28
@kaganAtZetane kaganAtZetane force-pushed the f/client-launch-anvil branch 5 times, most recently from a15703c to c498fb8 Compare June 20, 2024 20:29
@kaganAtZetane kaganAtZetane force-pushed the f/client-launch-anvil branch 2 times, most recently from a507109 to 8890732 Compare July 9, 2024 18:18
@kaganAtZetane kaganAtZetane force-pushed the f/client-launch-anvil branch 3 times, most recently from 30ae4a4 to 8c8a311 Compare August 1, 2024 17:30
@kaganAtZetane kaganAtZetane marked this pull request as ready for review August 7, 2024 14:37
@kaganAtZetane kaganAtZetane changed the title Draft: Launch Anvil From the Client Launch Anvil From the Client Aug 7, 2024
@kaganAtZetane kaganAtZetane linked an issue Aug 13, 2024 that may be closed by this pull request
@kaganAtZetane kaganAtZetane linked an issue Aug 13, 2024 that may be closed by this pull request
Copy link
Member

@FGRCL FGRCL left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a really big task, good hustle!

frontend/macPacker.cjs Outdated Show resolved Hide resolved
Comment on lines 132 to 175
<AnvilConfigurationsModal
open={configOpen}
onRequestClose={() => setConfigOpen(false)}
isInitial={true}
appIsPackaged={appIsPackaged}
/>

{/* Confirmation */}
<ClosableModal
modalHeading="Would you like to run your anvil locally with your existing settings"
size="md"
primaryButtonText="Yes"
secondaryButtonText="No"
onRequestSubmit={confirmSettings}
onRequestClose={() => {
setConfirmationIsOpen(false);
setConfigOpen(true);
}}
open={confirmationOpen}
>
<div className="flex flex-col gap-4 p-3">
{confirmationText.map((error, i) => {
return <p key={"error-msg-" + i}>{error}</p>;
})}
</div>
<Loading active={loading} />
</ClosableModal>

{/* Error */}
<ClosableModal
modalHeading="Following errors happened, please change your local config, or choose a cloud configuration"
size="md"
primaryButtonText="Yes"
secondaryButtonText="No"
passiveModal
onRequestClose={() => {
setErrModalOpen(false);
setConfigOpen(true);
}}
open={errModalOpen}
>
<div className="flex flex-col gap-4 p-3">
{errText.map((error, i) => {
return <p key={"error-msg-" + i}>{error}</p>;
})}
</div>
</ClosableModal>

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am thinking we might want to extract this to a new component

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want to treat AnvilConfigurationModal as it's own, but I refactored error and confirmation modals into one component

frontend/src/App.jsx Outdated Show resolved Hide resolved
frontend/src/App.jsx Outdated Show resolved Hide resolved
frontend/server/express.mjs Outdated Show resolved Hide resolved
Comment on lines 140 to 178
<ClosableModal
modalHeading="Would you like to run your anvil locally with your existing settings"
size="md"
primaryButtonText="Yes"
secondaryButtonText="No"
onRequestSubmit={confirmSettings}
onRequestClose={() => {
setConfirmationIsOpen(false);
setConfigOpen(true);
}}
open={confirmationOpen}
>
<div className="flex flex-col gap-4 p-3">
{confirmationText.map((error, i) => {
return <p key={"error-msg-" + i}>{error}</p>;
})}
</div>
<Loading active={loading} />
</ClosableModal>

{/* Error */}
<ClosableModal
modalHeading="Following errors happened, please change your local config, or choose a cloud configuration"
size="md"
primaryButtonText="Yes"
secondaryButtonText="No"
passiveModal
onRequestClose={() => {
setErrModalOpen(false);
setConfigOpen(true);
}}
open={errModalOpen}
>
<div className="flex flex-col gap-4 p-3">
{errText.map((error, i) => {
return <p key={"error-msg-" + i}>{error}</p>;
})}
</div>
</ClosableModal>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are also similar to the ones in the AnvilConfigurationsModal.

});
});

app.post("/launch-anvil", (req, res) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’m not sure if I understand the difference between this endpoint and the one above it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One of them is basically starts the anvil runs from an existing config, whereas the other creates/re-creates the config.

@kaganAtZetane kaganAtZetane changed the title Launch Anvil From the Client WIP: Launch Anvil From the Client Aug 19, 2024
@kaganAtZetane kaganAtZetane force-pushed the f/client-launch-anvil branch 2 times, most recently from ea666ac to 05ba4fb Compare August 20, 2024 01:44
@kaganAtZetane kaganAtZetane linked an issue Aug 20, 2024 that may be closed by this pull request
@kaganAtZetane kaganAtZetane changed the title WIP: Launch Anvil From the Client Launch Anvil From the Client Aug 21, 2024
@kaganAtZetane kaganAtZetane force-pushed the f/client-launch-anvil branch 2 times, most recently from b29f50b to 56b8ee7 Compare August 30, 2024 23:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Minikube check fails on Anvil in main Block compilation and block tests won't work on electron app
4 participants