From f63a2e04af8e2d8839d194d93007209f9ea34e95 Mon Sep 17 00:00:00 2001 From: Tarun Samanta Date: Sat, 25 Mar 2023 21:08:50 +0530 Subject: [PATCH 01/12] commit_for_testing --- frontend/src/pages/project/newdb.tsx | 106 ++++++++++++++++++++++++--- 1 file changed, 95 insertions(+), 11 deletions(-) diff --git a/frontend/src/pages/project/newdb.tsx b/frontend/src/pages/project/newdb.tsx index f0ac4306..12d446c4 100644 --- a/frontend/src/pages/project/newdb.tsx +++ b/frontend/src/pages/project/newdb.tsx @@ -18,10 +18,13 @@ const NewDBPage: FunctionComponent<{}> = () => { const dispatch = useAppDispatch() const projects: Project[] = useAppSelector(selectProjects) const project = projects.find(x => x.id === id) - const [addingError, setAddingError] = useState(false) const [adding, setAdding] = useState(false) - + const [inputError, setInputError] = useState({ + error_1: false, error_2: false, error_3: false, error_4: false, error_5: false, + error_6: false, error_7: false, error_8: false, error_9: false, error_10: false, + error_11: false + }) const [data, setData] = useState({ dbName: "", dbType: DBConnType.POSTGRES , @@ -40,9 +43,49 @@ const NewDBPage: FunctionComponent<{}> = () => { }) const handleChange = (e:React.ChangeEvent) => { - const type = e.target.type + const type = e.target.type; + const name = e.target.name; - const name = e.target.name + switch (name) { + case "dbName": + (e.target.value.trim().length>=1) ? setInputError({...inputError, error_1: false}): setInputError({...inputError, error_1: true}) + break; + case "dbScheme": + (e.target.value.localeCompare("mongodb")==0 || e.target.value.localeCompare("mongodb+srv")==0) ? + setInputError({...inputError, error_2: false}): setInputError({...inputError, error_2: true}) + break; + case "dbHost": + (e.target.value.trim().length>0) ? setInputError({...inputError, error_3: false}): setInputError({...inputError, error_3: true}) + break; + case "dbPort": + (e.target.value.trim().length>0) ? setInputError({...inputError, error_4: false}): setInputError({...inputError, error_4: true}) + break; + case "dbDatabase": + (e.target.value.trim().length>0) ? setInputError({...inputError, error_5: false}): setInputError({...inputError, error_5: true}) + break; + case "dbUsername": + (e.target.value.trim().length>0) ? setInputError({...inputError, error_6: false}): setInputError({...inputError, error_6: true}) + break; + case "dbPassword": + (e.target.value.trim().length>0) ? setInputError({...inputError, error_7: false}): setInputError({...inputError, error_7: true}) + break; + case "dbSSHHost": + (e.target.value.trim().length>0) ? + setInputError({...inputError, error_8:false}) : setInputError({...inputError, error_8: true}) + break; + case "dbSSHUser": + (e.target.value.trim().length>0) ? + setInputError({...inputError, error_9:false}) : setInputError({...inputError, error_9: true}) + break; + case "dbSSHPassword": + (e.target.value.trim().length>0) ? + setInputError({...inputError, error_10:false}) : setInputError({...inputError, error_10: true}) + break; + case "dbSSHKeyFile": + (e.target.value.trim().length>0) ? + setInputError({...inputError, error_11:false}) : setInputError({...inputError, error_11: true}) + break; + } const value = type === "checkbox" ? (e.target as HTMLInputElement).checked @@ -81,16 +124,41 @@ const NewDBPage: FunctionComponent<{}> = () => { sshKeyFile: data.dbSSHKeyFile, useSSL: data.dbUseSSL, } - try { await dispatch(addNewDBConn(payload)).unwrap() navigate(Constants.APP_PATHS.PROJECT.path.replace('[id]', project.id)) } catch (e: any) { + var f1=false, f2=false, f3=false, f4=false, f5=false, f6=false, f7=false, + f8=false, f9=false, f10=false, f11=false; + (payload.name.length===0) ? f1=true : f1=false; + (payload.scheme.localeCompare("mongodb") == 0 || payload.scheme.localeCompare("mongodb+srv") == 0) ? + f2=false : f2= true; + (payload.host.length===0) ? f3=true : f3=false; + (payload.port.length===0) ? f4=true : f4=false; + (payload.dbname.length===0) ? f5=true : f5=false; + (payload.user.length===0) ? f6=true : f6=false; + (payload.password.length===0) ? f7=true : f7=false; + (payload.sshHost.length===0) ? f8=true : f8=false; + (payload.sshUser.length===0) ? f9=true : f9=false; + (payload.sshPassword.length===0) ? f10=true : f10=false; + (payload.sshKeyFile.length===0) ? f11=true : f11=false; + setInputError({...inputError,error_1: f1,error_2: f2,error_3: f3, + error_4: f4, error_5: f5, error_6: f6, error_7: f7, error_8: f8, + error_9: f9, error_10: f10, error_11: f11}) setAddingError(e) } + setAdding(false) } - + + let normal={ + border: 'thin solid grey' + } + let inputStyle = { + border: '1px solid red' + } + + return ( <>

Add new database connection

@@ -100,7 +168,9 @@ const NewDBPage: FunctionComponent<{}> = () => { name='dbName' value={data.dbName} onChange={e => handleChange(e)} - placeholder="Enter a display name for database" + placeholder="Enter a me for database" + style={inputError.error_1 ? inputStyle : normal} + />
@@ -118,7 +188,7 @@ const NewDBPage: FunctionComponent<{}> = () => {
- handleChange(e)}> @@ -132,6 +202,7 @@ const NewDBPage: FunctionComponent<{}> = () => { value={data.dbHost} onChange={e => handleChange(e)} placeholder="Enter host" + style={inputError.error_3 ? inputStyle : normal} /> = () => { value={data.dbPort} onChange={e => handleChange(e)} placeholder="Enter Port" + style={inputError.error_4 ? inputStyle : normal} /> = () => { value={data.dbDatabase} onChange={e => handleChange(e)} placeholder="Enter Database" + style={inputError.error_5 ? inputStyle : normal} /> = () => { value={data.dbUsername} onChange={e => handleChange(e)} placeholder="Enter Database username" + style={inputError.error_6 ? inputStyle : normal} /> = () => { value={data.dbPassword} onChange={e=>handleChange(e)} placeholder="Enter database password" + style={inputError.error_7 ? inputStyle : normal} />
@@ -170,7 +245,7 @@ const NewDBPage: FunctionComponent<{}> = () => { onChange={e => handleChange(e)} >
} From 4ef11dc9bfefd0c0785c6b190dc04df3e130ffeb Mon Sep 17 00:00:00 2001 From: Paras Waykole Date: Fri, 31 Mar 2023 14:13:37 +0530 Subject: [PATCH 02/12] update wails version --- go.mod | 11 +++++------ go.sum | 25 ++++++++++++------------- 2 files changed, 17 insertions(+), 19 deletions(-) diff --git a/go.mod b/go.mod index c469ef94..7ee7cfa3 100644 --- a/go.mod +++ b/go.mod @@ -13,10 +13,10 @@ require ( github.com/joho/godotenv v1.4.0 github.com/posthog/posthog-go v0.0.0-20221221115252-24dfed35d71a github.com/tdewolff/parse/v2 v2.6.5 - github.com/wailsapp/wails/v2 v2.3.1 + github.com/wailsapp/wails/v2 v2.4.1 github.com/xwb1989/sqlparser v0.0.0-20180606152119-120387863bf2 go.mongodb.org/mongo-driver v1.11.1 - golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa + golang.org/x/crypto v0.1.0 gopkg.in/yaml.v2 v2.4.0 gorm.io/driver/sqlite v1.4.4 gorm.io/gorm v1.24.3 @@ -47,7 +47,6 @@ require ( github.com/golang/protobuf v1.5.0 // indirect github.com/golang/snappy v0.0.1 // indirect github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect - github.com/imdario/mergo v0.3.12 // indirect github.com/jackc/chunkreader/v2 v2.0.1 // indirect github.com/jackc/pgconn v1.13.0 // indirect github.com/jackc/pgio v1.0.0 // indirect @@ -89,10 +88,10 @@ require ( github.com/xtgo/uuid v0.0.0-20140804021211-a0b114877d4c // indirect github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d // indirect golang.org/x/exp v0.0.0-20220303212507-bbda1eaf7a17 // indirect - golang.org/x/net v0.4.0 // indirect + golang.org/x/net v0.7.0 // indirect golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect - golang.org/x/sys v0.3.0 // indirect - golang.org/x/text v0.5.0 // indirect + golang.org/x/sys v0.5.0 // indirect + golang.org/x/text v0.7.0 // indirect google.golang.org/genproto v0.0.0-20200911024640-645f7a48b24f // indirect google.golang.org/grpc v1.33.1 // indirect google.golang.org/protobuf v1.28.1 // indirect diff --git a/go.sum b/go.sum index ce08f121..49160636 100644 --- a/go.sum +++ b/go.sum @@ -140,8 +140,6 @@ github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09 github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/hydrogen18/memlistener v0.0.0-20141126152155-54553eb933fb/go.mod h1:qEIFzExnS6016fRpRfxrExeVn2gbClQA99gQhnIcdhE= -github.com/imdario/mergo v0.3.12 h1:b6R2BslTbIEToALKP7LxUvijTsNI9TAe80pLWN2g/HU= -github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= github.com/imkira/go-interpol v1.1.0/go.mod h1:z0h2/2T3XF8kyEPpRgJ3kmNv+C43p+I/CoI+jC3w2iA= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/iris-contrib/blackfriday v2.0.0+incompatible/go.mod h1:UzZ2bDEoaSGPbkg6SAB4att1aAwTmVIx/5gCVqeyUdI= @@ -379,7 +377,7 @@ github.com/tdewolff/test v1.0.7 h1:8Vs0142DmPFW/bQeHRP3MV19m1gvndjUb1sn8yy74LM= github.com/tdewolff/test v1.0.7/go.mod h1:6DAvZliBAAnD7rhVgwaM7DE5/d9NMOAJ09SqYqeK4QE= github.com/thoas/go-funk v0.9.1 h1:O549iLZqPpTUQ10ykd26sZhzD+rmR5pWhuElrhbC20M= github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= -github.com/tidwall/pretty v1.1.0 h1:K3hMW5epkdAVwibsQEfR/7Zj0Qgt4DxtNumTq/VloO8= +github.com/tidwall/pretty v1.2.0 h1:RWIZEg2iJ8/g6fDDYzMpobmaoGh5OLl4AXtGUGPcqCs= github.com/tkrajina/go-reflector v0.5.5 h1:gwoQFNye30Kk7NrExj8zm3zFtrGPqOkzFMLuQZg1DtQ= github.com/tkrajina/go-reflector v0.5.5/go.mod h1:ECbqLgccecY5kPmPmXg1MrHW585yMcDkVl6IvJe64T4= github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= @@ -395,8 +393,8 @@ github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+ github.com/valyala/tcplisten v0.0.0-20161114210144-ceec8f93295a/go.mod h1:v3UYOV9WzVtRmSR+PDvWpU/qWl4Wa5LApYYX4ZtKbio= github.com/wailsapp/mimetype v1.4.1 h1:pQN9ycO7uo4vsUUuPeHEYoUkLVkaRntMnHJxVwYhwHs= github.com/wailsapp/mimetype v1.4.1/go.mod h1:9aV5k31bBOv5z6u+QP8TltzvNGJPmNJD4XlAL3U+j3o= -github.com/wailsapp/wails/v2 v2.3.1 h1:ZJz+pyIBKyASkgO8JO31NuHO1gTTHmvwiHYHwei1CqM= -github.com/wailsapp/wails/v2 v2.3.1/go.mod h1:zlNLI0E2c2qA6miiuAHtp0Bac8FaGH0tlhA19OssR/8= +github.com/wailsapp/wails/v2 v2.4.1 h1:Ns7MOKWQM6l0ttBxpd5VcgYrH+GNPOnoDfnsBpbDnzM= +github.com/wailsapp/wails/v2 v2.4.1/go.mod h1:jbOZbcr/zm79PxXxAjP8UoVlDd9wLW3uDs+isIthDfs= github.com/xdg-go/pbkdf2 v1.0.0 h1:Su7DPu48wXMwC3bs7MCNG+z4FhcyEuz5dlvchbq0B0c= github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= github.com/xdg-go/scram v1.1.1 h1:VOMT+81stJgXW3CpHyqHN3AXDYIMsx56mEFrB37Mb/E= @@ -446,8 +444,9 @@ golang.org/x/crypto v0.0.0-20201203163018-be400aefbc4c/go.mod h1:jdWPYTVW3xRLrWP golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa h1:zuSxTR4o9y82ebqCUJYNGJbGPo6sKVl54f/TVDObg1c= golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.1.0 h1:MDRAIl0xIo9Io2xV565hzXHw3zVseKrJKodhohM5CjU= +golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20220303212507-bbda1eaf7a17 h1:3MTrJm4PyNL9NBqvYDSj3DHl46qQakyfqfWo4jgfaEM= golang.org/x/exp v0.0.0-20220303212507-bbda1eaf7a17/go.mod h1:lgLbSvA5ygNOMpwM/9anMpWVlVJ7Z+cHWq/eFuinpGE= @@ -480,8 +479,8 @@ golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwY golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210505024714-0287a6fb4125/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.4.0 h1:Q5QPcMlvfxFTAPV0+07Xz/MpK9NTXu2VDUuy0FeMfaU= -golang.org/x/net v0.4.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= +golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= +golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -524,19 +523,19 @@ golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211103235746-7861aae1554b/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.3.0 h1:w8ZOecv6NaNa/zC8944JTU3vz4u6Lagfk4RPQxv92NQ= -golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.3.0 h1:qoo4akIqOcDME5bhc/NgxUdovd6BSS2uMsVjB56q1xI= +golang.org/x/term v0.5.0 h1:n2a8QNdAb0sZNpU9R1ALUXBbY+w51fCQDN+7EdxNBsY= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.5.0 h1:OLmvp0KP+FVG99Ct/qFiL/Fhk4zp4QQnZ7b2U+5piUM= -golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20181221001348-537d06c36207/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= From 72dacfb10741fefd0e9e15f7138859a545953e54 Mon Sep 17 00:00:00 2001 From: Eldemarkki <38920928+Eldemarkki@users.noreply.github.com> Date: Fri, 31 Mar 2023 17:43:56 +0300 Subject: [PATCH 03/12] Add note on Linux + few grammar fixes --- README.md | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index bc41106a..608206f1 100644 --- a/README.md +++ b/README.md @@ -29,22 +29,22 @@ # About -Slashbase is a modern database IDE for your dev/data workflows. Use Slashbase to connect to any of your database, browse data and schema, write, run and save queries, create charts. Supports MySQL, PostgreSQL and MongoDB. +Slashbase is a modern database IDE for your dev/data workflows. Use Slashbase to connect to any of your databases, browse data and schemas, write, run and save queries, and create charts. Supports MySQL, PostgreSQL and MongoDB. It is in beta (v0.8), help us make it better by sending your feedback and reach a stable (v1.0) version. > Star 🌟 & watch 👀 the repository to get updates. ## Features: -- **🧑‍ðŸ’ŧ Desktop App**: Use the IDE as standalone desktop app. +- **🧑‍ðŸ’ŧ Desktop App**: Use the IDE as a standalone desktop app. - **🊄 Modern Interface**: With a modern interface, it is easy to use. - **ðŸŠķ Lightweight**: Doesn't take much space on your system. - **⚡ïļ Quick Browse**: Quickly filter, sort & browse data and schema with a low-code UI. -- **ðŸ’ū Save Queries**: Write and Save queries to re-run in future. +- **ðŸ’ū Save Queries**: Write and Save queries to re-run in the future. - **📊 Create Charts**: Create charts from your query results. -- **📚 Console**: Run commands like in you do in terminal. +- **📚 Console**: Run commands like you do in the terminal. - **🗂 Projects**: Organise all database connections into various projects. -- **📕 Query Cheatsheets**: Search and view query commands syntax right inside IDE. +- **📕 Query Cheatsheets**: Search and view query commands syntax right inside the IDE. - **✅ Database Support**: MySQL, PostgreSQL and MongoDB. # Installation @@ -56,12 +56,14 @@ Follow the steps below to download & start the app: 1. Download the [latest release](https://github.com/slashbaseide/slashbase/releases) and extract / open the downloaded file. 2. Follow the platform specific step below - For Windows, double click the Slashbase file to open the app - - For MacOS, drag the Slashbase file to Applications folder and start the app from launchpad. - - For linux, run `./Slashbase` on terminal to start the app. + - For MacOS, drag the Slashbase file into the Applications folder and start the app from Launchpad. + - For Linux, run `./Slashbase` in the terminal to start the app. + - Requires `libwebkit2gtk-4.0` to be installed. + - On Arch-based distributions, you can install it with `pacman -S webkit2gtk` ## Build from source -Follow the steps build & start the app: +Follow the steps to build & start the app: 1. Clone the repository or download the zip. 2. Make sure Go and Wails is installed. Follow the steps [here](https://wails.io/docs/gettingstarted/installation), if not installed. @@ -85,18 +87,18 @@ Detailed documentation is available on [slashbase guide](https://slashbase.bip.w # Community -Join our community on [discord](https://discord.gg/U6fXgm3FAX) and [bip](https://bip.so/slashbase/feed). +Join our community on [Discord](https://discord.gg/U6fXgm3FAX) and [bip](https://bip.so/slashbase/feed). # Roadmap -### Database Support +## Database Support - ✅ PostgreSQL Query Engine - ✅ MongoDB Query Engine - ✅ MySQL Query Engine - ☑ïļ SQLite Query Engine - ☑ïļ Redis Query Engine -### Features +## Features - ✅ Query Cheatsheets - ☑ïļ Add/delete Data Models (Table/collections) - ☑ïļ Manage Views @@ -109,7 +111,7 @@ Read our [contribution guide](CONTRIBUTING.md) for getting started on contributi # Support -If you face any issues installing or using slashbase, send us a mail on slashbaseide@gmail.com or contact support chat on our website [slashbase.com](https://slashbase.com). +If you face any issues installing or using Slashbase, send us a mail to slashbaseide@gmail.com or contact support chat on our website [slashbase.com](https://slashbase.com). # License From 7f35301abb258b2358bf0dfb4029bb7bfc51be28 Mon Sep 17 00:00:00 2001 From: Tarun Samanta Date: Sat, 1 Apr 2023 11:28:05 +0530 Subject: [PATCH 04/12] modified PR as per your request --- frontend/src/pages/project/newdb.tsx | 83 ++++++++-------------------- 1 file changed, 23 insertions(+), 60 deletions(-) diff --git a/frontend/src/pages/project/newdb.tsx b/frontend/src/pages/project/newdb.tsx index ce009724..60198f6e 100644 --- a/frontend/src/pages/project/newdb.tsx +++ b/frontend/src/pages/project/newdb.tsx @@ -21,9 +21,7 @@ const NewDBPage: FunctionComponent<{}> = () => { const [addingError, setAddingError] = useState(false) const [adding, setAdding] = useState(false) const [inputError, setInputError] = useState({ - error_1: false, error_2: false, error_3: false, error_4: false, error_5: false, - error_6: false, error_7: false, error_8: false, error_9: false, error_10: false, - error_11: false + error_1: false, error_2: false, error_3: false, error_4: false }) const [data, setData] = useState({ dbName: "", @@ -48,43 +46,17 @@ const NewDBPage: FunctionComponent<{}> = () => { switch (name) { case "dbName": - (e.target.value.trim().length>=1) ? setInputError({...inputError, error_1: false}): setInputError({...inputError, error_1: true}) + (e.target.value.trim().length>0) ? setInputError({...inputError, error_1: false}): setInputError({...inputError, error_1: true}) break; - case "dbScheme": - (e.target.value.localeCompare("mongodb")==0 || e.target.value.localeCompare("mongodb+srv")==0) ? - setInputError({...inputError, error_2: false}): setInputError({...inputError, error_2: true}) - break; case "dbHost": - (e.target.value.trim().length>0) ? setInputError({...inputError, error_3: false}): setInputError({...inputError, error_3: true}) + (e.target.value.trim().length>0) ? setInputError({...inputError, error_2: false}): setInputError({...inputError, error_2: true}) break; case "dbPort": - (e.target.value.trim().length>0) ? setInputError({...inputError, error_4: false}): setInputError({...inputError, error_4: true}) + (e.target.value.trim().length>0) ? setInputError({...inputError, error_3: false}): setInputError({...inputError, error_3: true}) break; case "dbDatabase": - (e.target.value.trim().length>0) ? setInputError({...inputError, error_5: false}): setInputError({...inputError, error_5: true}) - break; - case "dbUsername": - (e.target.value.trim().length>0) ? setInputError({...inputError, error_6: false}): setInputError({...inputError, error_6: true}) - break; - case "dbPassword": - (e.target.value.trim().length>0) ? setInputError({...inputError, error_7: false}): setInputError({...inputError, error_7: true}) - break; - case "dbSSHHost": - (e.target.value.trim().length>0) ? - setInputError({...inputError, error_8:false}) : setInputError({...inputError, error_8: true}) - break; - case "dbSSHUser": - (e.target.value.trim().length>0) ? - setInputError({...inputError, error_9:false}) : setInputError({...inputError, error_9: true}) - break; - case "dbSSHPassword": - (e.target.value.trim().length>0) ? - setInputError({...inputError, error_10:false}) : setInputError({...inputError, error_10: true}) + (e.target.value.trim().length>0) ? setInputError({...inputError, error_4: false}): setInputError({...inputError, error_4: true}) break; - case "dbSSHKeyFile": - (e.target.value.trim().length>0) ? - setInputError({...inputError, error_11:false}) : setInputError({...inputError, error_11: true}) - break; } const value = type === "checkbox" @@ -128,23 +100,13 @@ const NewDBPage: FunctionComponent<{}> = () => { await dispatch(addNewDBConn(payload)).unwrap() navigate(Constants.APP_PATHS.PROJECT.path.replace('[id]', project.id)) } catch (e: any) { - var f1=false, f2=false, f3=false, f4=false, f5=false, f6=false, f7=false, - f8=false, f9=false, f10=false, f11=false; + var f1=false, f2=false, f3=false, f4=false; (payload.name.length===0) ? f1=true : f1=false; - (payload.scheme.localeCompare("mongodb") == 0 || payload.scheme.localeCompare("mongodb+srv") == 0) ? - f2=false : f2= true; - (payload.host.length===0) ? f3=true : f3=false; - (payload.port.length===0) ? f4=true : f4=false; - (payload.dbname.length===0) ? f5=true : f5=false; - (payload.user.length===0) ? f6=true : f6=false; - (payload.password.length===0) ? f7=true : f7=false; - (payload.sshHost.length===0) ? f8=true : f8=false; - (payload.sshUser.length===0) ? f9=true : f9=false; - (payload.sshPassword.length===0) ? f10=true : f10=false; - (payload.sshKeyFile.length===0) ? f11=true : f11=false; + (payload.host.length===0) ? f2=true : f2=false; + (payload.port.length===0) ? f3=true : f3=false; + (payload.dbname.length===0) ? f4=true : f4=false; setInputError({...inputError,error_1: f1,error_2: f2,error_3: f3, - error_4: f4, error_5: f5, error_6: f6, error_7: f7, error_8: f8, - error_9: f9, error_10: f10, error_11: f11}) + error_4: f4}) setAddingError(e) } @@ -175,8 +137,8 @@ const NewDBPage: FunctionComponent<{}> = () => {
- ) => { setData((prev)=> ({...prev, [e.target.name]:e.target.value, dbScheme :""}))}}> + @@ -187,7 +149,7 @@ const NewDBPage: FunctionComponent<{}> = () => {
- handleChange(e)}> @@ -201,7 +163,7 @@ const NewDBPage: FunctionComponent<{}> = () => { value={data.dbHost} onChange={e => handleChange(e)} placeholder="Enter host" - style={inputError.error_3 ? inputStyle : normal} + style={inputError.error_2 ? inputStyle : normal} /> = () => { value={data.dbPort} onChange={e => handleChange(e)} placeholder="Enter Port" - style={inputError.error_4 ? inputStyle : normal} + style={inputError.error_3 ? inputStyle : normal} /> = () => { value={data.dbDatabase} onChange={e => handleChange(e)} placeholder="Enter Database" - style={inputError.error_5 ? inputStyle : normal} + style={inputError.error_4 ? inputStyle : normal} /> = () => { value={data.dbUsername} onChange={e => handleChange(e)} placeholder="Enter Database username" - style={inputError.error_6 ? inputStyle : normal} + style= {normal} /> = () => { value={data.dbPassword} onChange={e => handleChange(e)} placeholder="Enter database password" - style={inputError.error_7 ? inputStyle : normal} + style= {normal} />
@@ -242,6 +204,7 @@ const NewDBPage: FunctionComponent<{}> = () => { name='dbUseSSH' value={data.dbUseSSH} onChange={e => handleChange(e)} + style= {normal} >
From b271fd226fefc0b5af4e671f5b006f6d9ce4c587 Mon Sep 17 00:00:00 2001 From: Tarun Samanta Date: Sat, 1 Apr 2023 18:53:38 +0530 Subject: [PATCH 05/12] change some placeholder name --- frontend/src/pages/project/newdb.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/src/pages/project/newdb.tsx b/frontend/src/pages/project/newdb.tsx index 60198f6e..9bc086a6 100644 --- a/frontend/src/pages/project/newdb.tsx +++ b/frontend/src/pages/project/newdb.tsx @@ -130,7 +130,7 @@ const NewDBPage: FunctionComponent<{}> = () => { name='dbName' value={data.dbName} onChange={e => handleChange(e)} - placeholder="Enter a me for database" + placeholder="Enter a display name for database" style={inputError.error_1 ? inputStyle : normal} />
@@ -138,7 +138,7 @@ const NewDBPage: FunctionComponent<{}> = () => {
From 225aecdae4e7cfaabe06aaab39c5f1d485b7b026 Mon Sep 17 00:00:00 2001 From: Paras Waykole Date: Mon, 3 Apr 2023 11:34:08 +0530 Subject: [PATCH 06/12] wails update new functions --- frontend/wailsjs/runtime/runtime.d.ts | 8 ++++++++ frontend/wailsjs/runtime/runtime.js | 14 +++++++++++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/frontend/wailsjs/runtime/runtime.d.ts b/frontend/wailsjs/runtime/runtime.d.ts index 40068079..a3723f94 100644 --- a/frontend/wailsjs/runtime/runtime.d.ts +++ b/frontend/wailsjs/runtime/runtime.d.ts @@ -225,3 +225,11 @@ export function Hide(): void; // [Show](https://wails.io/docs/reference/runtime/intro#show) // Shows the application. export function Show(): void; + +// [ClipboardGetText](https://wails.io/docs/reference/runtime/clipboard#clipboardgettext) +// Returns the current text stored on clipboard +export function ClipboardGetText(): Promise; + +// [ClipboardSetText](https://wails.io/docs/reference/runtime/clipboard#clipboardsettext) +// Sets a text on the clipboard +export function ClipboardSetText(text: string): Promise; diff --git a/frontend/wailsjs/runtime/runtime.js b/frontend/wailsjs/runtime/runtime.js index b9be812c..bd4f371a 100644 --- a/frontend/wailsjs/runtime/runtime.js +++ b/frontend/wailsjs/runtime/runtime.js @@ -37,11 +37,11 @@ export function LogFatal(message) { } export function EventsOnMultiple(eventName, callback, maxCallbacks) { - window.runtime.EventsOnMultiple(eventName, callback, maxCallbacks); + return window.runtime.EventsOnMultiple(eventName, callback, maxCallbacks); } export function EventsOn(eventName, callback) { - EventsOnMultiple(eventName, callback, -1); + return EventsOnMultiple(eventName, callback, -1); } export function EventsOff(eventName, ...additionalEventNames) { @@ -49,7 +49,7 @@ export function EventsOff(eventName, ...additionalEventNames) { } export function EventsOnce(eventName, callback) { - EventsOnMultiple(eventName, callback, 1); + return EventsOnMultiple(eventName, callback, 1); } export function EventsEmit(eventName) { @@ -192,3 +192,11 @@ export function Hide() { export function Show() { window.runtime.Show(); } + +export function ClipboardGetText() { + return window.runtime.ClipboardGetText(); +} + +export function ClipboardSetText(text) { + return window.runtime.ClipboardSetText(text); +} \ No newline at end of file From 4a1401d0f42300cfd4082c94cd971108d7c575e6 Mon Sep 17 00:00:00 2001 From: Paras Waykole Date: Mon, 3 Apr 2023 11:34:47 +0530 Subject: [PATCH 07/12] minor fe fix --- frontend/src/components/dbfragments/console.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/src/components/dbfragments/console.tsx b/frontend/src/components/dbfragments/console.tsx index d5bc0d1f..43a52b3f 100644 --- a/frontend/src/components/dbfragments/console.tsx +++ b/frontend/src/components/dbfragments/console.tsx @@ -46,8 +46,8 @@ const DBConsoleFragment = ({ }: DBConsolePropType) => { text: "Start typing command and press enter to run it.\nType 'help' for more info on console.", cmd: false }} /> - {output.map(block => { - return + {output.map((block, idx) => { + return })} From 3c7b1d5e27c8e4e0a028689060d48b1a00a19918 Mon Sep 17 00:00:00 2001 From: Paras Waykole Date: Mon, 3 Apr 2023 11:52:39 +0530 Subject: [PATCH 08/12] code refactoring --- frontend/src/pages/project/newdb.tsx | 81 ++++++++++++++-------------- 1 file changed, 40 insertions(+), 41 deletions(-) diff --git a/frontend/src/pages/project/newdb.tsx b/frontend/src/pages/project/newdb.tsx index 9bc086a6..63dcb0a0 100644 --- a/frontend/src/pages/project/newdb.tsx +++ b/frontend/src/pages/project/newdb.tsx @@ -39,25 +39,25 @@ const NewDBPage: FunctionComponent<{}> = () => { dbSSHKeyFile: "", dbUseSSL: false, }) - + const handleChange = (e: React.ChangeEvent) => { const type = e.target.type const name = e.target.name; switch (name) { case "dbName": - (e.target.value.trim().length>0) ? setInputError({...inputError, error_1: false}): setInputError({...inputError, error_1: true}) - break; + (e.target.value.trim().length > 0) ? setInputError({ ...inputError, error_1: false }) : setInputError({ ...inputError, error_1: true }) + break; case "dbHost": - (e.target.value.trim().length>0) ? setInputError({...inputError, error_2: false}): setInputError({...inputError, error_2: true}) + (e.target.value.trim().length > 0) ? setInputError({ ...inputError, error_2: false }) : setInputError({ ...inputError, error_2: true }) break; case "dbPort": - (e.target.value.trim().length>0) ? setInputError({...inputError, error_3: false}): setInputError({...inputError, error_3: true}) + (e.target.value.trim().length > 0) ? setInputError({ ...inputError, error_3: false }) : setInputError({ ...inputError, error_3: true }) break; case "dbDatabase": - (e.target.value.trim().length>0) ? setInputError({...inputError, error_4: false}): setInputError({...inputError, error_4: true}) + (e.target.value.trim().length > 0) ? setInputError({ ...inputError, error_4: false }) : setInputError({ ...inputError, error_4: true }) break; - } + } const value = type === "checkbox" ? (e.target as HTMLInputElement).checked @@ -100,27 +100,29 @@ const NewDBPage: FunctionComponent<{}> = () => { await dispatch(addNewDBConn(payload)).unwrap() navigate(Constants.APP_PATHS.PROJECT.path.replace('[id]', project.id)) } catch (e: any) { - var f1=false, f2=false, f3=false, f4=false; - (payload.name.length===0) ? f1=true : f1=false; - (payload.host.length===0) ? f2=true : f2=false; - (payload.port.length===0) ? f3=true : f3=false; - (payload.dbname.length===0) ? f4=true : f4=false; - setInputError({...inputError,error_1: f1,error_2: f2,error_3: f3, - error_4: f4}) + var f1 = false, f2 = false, f3 = false, f4 = false; + (payload.name.length === 0) ? f1 = true : f1 = false; + (payload.host.length === 0) ? f2 = true : f2 = false; + (payload.port.length === 0) ? f3 = true : f3 = false; + (payload.dbname.length === 0) ? f4 = true : f4 = false; + setInputError({ + ...inputError, error_1: f1, error_2: f2, error_3: f3, + error_4: f4 + }) setAddingError(e) } - + setAdding(false) } - - let normal={ - border: 'thin solid grey' + + const normal = { + border: '' } - let inputStyle = { + + const inputStyle = { border: '1px solid red' - } - - + } + return ( <>

Add new database connection

@@ -131,13 +133,13 @@ const NewDBPage: FunctionComponent<{}> = () => { value={data.dbName} onChange={e => handleChange(e)} placeholder="Enter a display name for database" - style={inputError.error_1 ? inputStyle : normal} + style={inputError.error_1 ? inputStyle : normal} />
- ) => { setData((prev) => ({ ...prev, [e.target.name]: e.target.value, dbScheme: "" })) }}> @@ -149,7 +151,7 @@ const NewDBPage: FunctionComponent<{}> = () => {
- handleChange(e)}> @@ -163,7 +165,7 @@ const NewDBPage: FunctionComponent<{}> = () => { value={data.dbHost} onChange={e => handleChange(e)} placeholder="Enter host" - style={inputError.error_2 ? inputStyle : normal} + style={inputError.error_2 ? inputStyle : normal} /> = () => { value={data.dbPort} onChange={e => handleChange(e)} placeholder="Enter Port" - style={inputError.error_3 ? inputStyle : normal} + style={inputError.error_3 ? inputStyle : normal} /> = () => { value={data.dbDatabase} onChange={e => handleChange(e)} placeholder="Enter Database" - style={inputError.error_4 ? inputStyle : normal} + style={inputError.error_4 ? inputStyle : normal} /> = () => { value={data.dbUsername} onChange={e => handleChange(e)} placeholder="Enter Database username" - style= {normal} + style={normal} /> = () => { value={data.dbPassword} onChange={e => handleChange(e)} placeholder="Enter database password" - style= {normal} + style={normal} />
@@ -204,7 +206,7 @@ const NewDBPage: FunctionComponent<{}> = () => { name='dbUseSSH' value={data.dbUseSSH} onChange={e => handleChange(e)} - style= {normal} + style={normal} >
} From 644a1c560faf91b5356d8a87a08ba76df81ff9cf Mon Sep 17 00:00:00 2001 From: Paras Waykole Date: Mon, 3 Apr 2023 11:53:07 +0530 Subject: [PATCH 09/12] code refactoring --- frontend/src/pages/project/newdb.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/frontend/src/pages/project/newdb.tsx b/frontend/src/pages/project/newdb.tsx index 63dcb0a0..f1707047 100644 --- a/frontend/src/pages/project/newdb.tsx +++ b/frontend/src/pages/project/newdb.tsx @@ -106,7 +106,10 @@ const NewDBPage: FunctionComponent<{}> = () => { (payload.port.length === 0) ? f3 = true : f3 = false; (payload.dbname.length === 0) ? f4 = true : f4 = false; setInputError({ - ...inputError, error_1: f1, error_2: f2, error_3: f3, + ...inputError, + error_1: f1, + error_2: f2, + error_3: f3, error_4: f4 }) setAddingError(e) From b8448c3ed1941fce510feb914c4edb4133ba4a08 Mon Sep 17 00:00:00 2001 From: Paras Waykole Date: Mon, 3 Apr 2023 11:57:49 +0530 Subject: [PATCH 10/12] footer bug fixed --- frontend/src/components/layouts/footer.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/components/layouts/footer.tsx b/frontend/src/components/layouts/footer.tsx index 5bf6f7a0..0f598a56 100644 --- a/frontend/src/components/layouts/footer.tsx +++ b/frontend/src/components/layouts/footer.tsx @@ -46,7 +46,7 @@ const Footer = (_: FooterPropType) => { {(isDBConnected !== undefined && isDBConnected) ? "connected" : "not connected"} ) } - {isDBConnected === true && + {showStatus && isDBConnected === true && (