-
Notifications
You must be signed in to change notification settings - Fork 25
add support to launch mssql instance #14
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -30,6 +30,7 @@ import { PostgresInstance } from "./postgres-instance"; | |
| import { Toolbar, ToolbarButton, ToolbarDropdown } from "@/components/toolbar"; | ||
| import { type PullImageProgress } from "electron/ipc/docker"; | ||
| import { parseSafeJson } from "@/lib/json-help"; | ||
| import { SqlServerInstance } from "./mssql-instance"; | ||
|
|
||
| function convertByteToMBString(byte: number) { | ||
| return `${(byte / 1024 / 1024).toFixed(2)}mb`; | ||
|
|
@@ -211,6 +212,10 @@ function InstanceListRoute() { | |
| <PostgreIcon className="h-4 w-4" /> | ||
| PostgreSQL | ||
| </DropdownMenuItem> | ||
| <DropdownMenuItem onClick={() => navigate("/instance/create/mssql")}> | ||
| <PostgreIcon className="h-4 w-4" /> | ||
| Microsoft SQL | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. suggestion: I would go for |
||
| </DropdownMenuItem> | ||
| </ToolbarDropdown> | ||
|
|
||
| <ToolbarButton | ||
|
|
@@ -427,6 +432,10 @@ export default function InstanceTab() { | |
| path="/instance/create/postgres" | ||
| Component={withAnimation(PostgresInstance)} | ||
| /> | ||
| <Route | ||
| path="/instance/create/mssql" | ||
| Component={withAnimation(SqlServerInstance)} | ||
| /> | ||
| <Route | ||
| path="/instance/create/:type" | ||
| Component={withAnimation(InstanceCreateRoute)} | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,121 @@ | ||||||
| import { Toolbar, ToolbarBackButton, ToolbarTitle } from "@/components/toolbar"; | ||||||
| import { Button } from "@/components/ui/button"; | ||||||
| import { Input } from "@/components/ui/input"; | ||||||
| import { Label } from "@/components/ui/label"; | ||||||
| import { | ||||||
| Select, | ||||||
| SelectContent, | ||||||
| SelectItem, | ||||||
| SelectTrigger, | ||||||
| SelectValue, | ||||||
| } from "@/components/ui/select"; | ||||||
| import { | ||||||
| DatabaseInstanceStoreItem, | ||||||
| DatabaseManagerStore, | ||||||
| } from "@/lib/db-manager-store"; | ||||||
| import { MySQLIcon } from "@/lib/outerbase-icon"; | ||||||
| import { useNavigate } from "react-router-dom"; | ||||||
| import { useImmer } from "use-immer"; | ||||||
|
|
||||||
| export function SqlServerInstance() { | ||||||
| const [data, setData] = useImmer<DatabaseInstanceStoreItem>(() => ({ | ||||||
| id: "mssql-" + DatabaseManagerStore.generateShortId(), | ||||||
| name: "MS SSQL Local", | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| type: "mssql", | ||||||
| version: "2017-CU11-ubuntu", | ||||||
| config: { | ||||||
| port: "1433", | ||||||
| username: "sa", | ||||||
| password: "yourStrong(!)Password", | ||||||
| }, | ||||||
| })); | ||||||
| const navigate = useNavigate(); | ||||||
|
|
||||||
| return ( | ||||||
| <div> | ||||||
| <Toolbar> | ||||||
| <ToolbarBackButton /> | ||||||
| <ToolbarTitle text="Create PostgresSQL Database" icon={MySQLIcon} /> | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| </Toolbar> | ||||||
|
|
||||||
| <div className="flex flex-col gap-4 p-8"> | ||||||
| <div className="flex gap-4"> | ||||||
| <div className="flex flex-1 flex-col gap-2"> | ||||||
| <Label>Name</Label> | ||||||
| <Input | ||||||
| value={data.name} | ||||||
| onChange={(e) => | ||||||
| setData((d) => { | ||||||
| d.name = e.target.value; | ||||||
| }) | ||||||
| } | ||||||
| /> | ||||||
| </div> | ||||||
|
|
||||||
| <div className="flex flex-col gap-2"> | ||||||
| <Label>Version</Label> | ||||||
| <Select | ||||||
| value={data.version} | ||||||
| onValueChange={(v) => { | ||||||
| setData((d) => { | ||||||
| d.version = v; | ||||||
| }); | ||||||
| }} | ||||||
| > | ||||||
| <SelectTrigger className="w-[180px]"> | ||||||
| <SelectValue placeholder="Version" /> | ||||||
| </SelectTrigger> | ||||||
| <SelectContent> | ||||||
| <SelectItem value="2017-CU11-ubuntu"> | ||||||
| 2017-CU11-ubuntu | ||||||
| </SelectItem> | ||||||
| </SelectContent> | ||||||
| </Select> | ||||||
| </div> | ||||||
| </div> | ||||||
|
|
||||||
| <div className="flex gap-4"> | ||||||
| <div className="flex flex-1 flex-col gap-2"> | ||||||
| <Label>Username</Label> | ||||||
| <Input value={data.config.username} readOnly disabled /> | ||||||
| </div> | ||||||
|
|
||||||
| <div className="flex flex-1 flex-col gap-2"> | ||||||
| <Label>Password</Label> | ||||||
| <Input | ||||||
| value={data.config.password} | ||||||
| onChange={(e) => | ||||||
| setData((d) => { | ||||||
| d.config.password = e.target.value; | ||||||
| }) | ||||||
| } | ||||||
| /> | ||||||
| </div> | ||||||
|
|
||||||
| <div className="flex w-[150px] flex-col gap-2"> | ||||||
| <Label>Port</Label> | ||||||
| <Input | ||||||
| value={data.config.port} | ||||||
| onChange={(e) => | ||||||
| setData((d) => { | ||||||
| d.config.port = e.target.value; | ||||||
| }) | ||||||
| } | ||||||
| /> | ||||||
| </div> | ||||||
| </div> | ||||||
|
|
||||||
| <div className="mt-8"> | ||||||
| <Button | ||||||
| onClick={() => { | ||||||
| DatabaseManagerStore.add(data); | ||||||
| navigate(-1); | ||||||
| }} | ||||||
| > | ||||||
| Launch | ||||||
| </Button> | ||||||
| </div> | ||||||
| </div> | ||||||
| </div> | ||||||
| ); | ||||||
| } | ||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: not sure if it will help you, but there are some icons here https://react-icons.github.io/react-icons/search/#q=sql