Skip to content
This repository has been archived by the owner on Mar 16, 2024. It is now read-only.

Commit

Permalink
added button to remove profile before install server (#102)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivan0348 authored Nov 9, 2023
1 parent 6c423a2 commit 4cb2a40
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
1 change: 1 addition & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 9 additions & 8 deletions frontend/src/pages/InstallUpdater.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ import {
Typography
} from "@mui/joy";
import {OpenDirectoryDialog} from "../../wailsjs/go/helpers/HelpersController";
import {IconDownload} from "@tabler/icons-react";
import {IconDownload, IconTrash} from "@tabler/icons-react";
import {InstallUpdateVerify} from "../../wailsjs/go/installer/InstallerController";
import {EventsOn} from "../../wailsjs/runtime";
import {useAlert} from "../components/AlertProvider";
import {DeleteProfile} from "../../wailsjs/go/server/ServerController";

type Props = {
setServ: React.Dispatch<React.SetStateAction<server.Server>>
Expand Down Expand Up @@ -48,16 +49,17 @@ export function InstallUpdater({setServ, serv, onInstalled}: Props) {
})
}

function onCancelButtonClicked() {
DeleteProfile(serv.id).then(() => {addAlert("Deleted profile", "success"); setTimeout(() => {location.reload()}, 500) }).catch((err) => {console.error(err); addAlert(err, "danger")})
}

useEffect(() => {
EventsOn("installingUpdateAction", (data) => {setAction(data);})
EventsOn("installingUpdateProgress", (data) => {setProgress(data);})
EventsOn("appInstalled", (i) => {setIsCompleted(true); setAction("Done"); setProgress(100)})
}, []);





return (
<div>
<Modal open={installerModalOpen} >
Expand Down Expand Up @@ -87,11 +89,10 @@ export function InstallUpdater({setServ, serv, onInstalled}: Props) {
<Divider className={'mx-2'}/>
<FormLabel>Server Path</FormLabel>
<Input className={'w-1/3'} value={serv.serverPath} required onClick={onServerPathClicked} ></Input>
<div className={"text-center"}>
<Button endDecorator={<IconDownload/>} onClick={onStartInstallButtonClicked}>Install server</Button>
<div className={"text-center pt-5"}>
<Button endDecorator={<IconDownload/>} onClick={onStartInstallButtonClicked} className={"mx-5"}>Install server</Button>
<Button endDecorator={<IconTrash/>} onClick={onCancelButtonClicked} className={"mx-5"} color={"danger"}>Delete profile</Button>
</div>


</Card>
</div>
);
Expand Down

0 comments on commit 4cb2a40

Please sign in to comment.