@@ -23,6 +23,7 @@ import { applicationGetConnection } from '../application/ApplicationSelectors';
2323
2424// const shareBaseURL = "http://localhost:3000";
2525const shareBaseURL = "http://neodash.graphapp.io" ;
26+ const shareLocalURL = window . location . origin . startsWith ( "file" ) ? shareBaseURL : window . location . origin ;
2627const styles = {
2728
2829} ;
@@ -42,6 +43,8 @@ export const NeoShareModal = ({ connection, loadDashboardListFromNeo4j, loadData
4243 const [ shareFileURL , setShareFileURL ] = React . useState ( "" ) ;
4344 const [ shareConnectionDetails , setShareConnectionDetails ] = React . useState ( "No" ) ;
4445 const [ shareStandalone , setShareStandalone ] = React . useState ( "No" ) ;
46+ const [ selfHosted , setSelfHosted ] = React . useState ( "No" ) ;
47+
4548 const [ shareLink , setShareLink ] = React . useState ( null ) ;
4649
4750
@@ -164,6 +167,7 @@ export const NeoShareModal = ({ connection, loadDashboardListFromNeo4j, loadData
164167 setShareConnectionDetails ( e )
165168 } }
166169 />
170+ { shareLocalURL != shareBaseURL ?
167171 < NeoSetting key = { "standalone" } name = { "standalone" }
168172 value = { shareStandalone }
169173 style = { { marginLeft : "0px" , width : "100%" , marginBottom : "10px" } }
@@ -179,11 +183,24 @@ export const NeoShareModal = ({ connection, loadDashboardListFromNeo4j, loadData
179183 setShareConnectionDetails ( "Yes" )
180184 }
181185 } }
186+ /> : < > </ > }
187+ < NeoSetting key = { "selfHosted" } name = { "selfHosted" }
188+ value = { selfHosted }
189+ style = { { marginLeft : "0px" , width : "100%" , marginBottom : "10px" } }
190+ type = { SELECTION_TYPES . LIST }
191+ helperText = { "Share the dashboard using self Hosted Neodash, otherwise neodash.graphapp.io will be used" }
192+ label = { "Self Hosted Dashboard" }
193+ defaultValue = { "No" }
194+ choices = { [ "Yes" , "No" ] }
195+ onChange = { ( e ) => {
196+ setShareLink ( null ) ;
197+ setSelfHosted ( e ) ;
198+ } }
182199 />
183200 < Button
184201 component = "label"
185202 onClick = { ( e ) => {
186- setShareLink ( ( shareBaseURL + "/?share&type=" + shareType + "&id=" + encodeURIComponent ( shareID ) + "&dashboardDatabase=" + encodeURIComponent ( dashboardDatabase ) +
203+ setShareLink ( ( ( selfHosted == "Yes" ? shareLocalURL : shareBaseURL ) + "/?share&type=" + shareType + "&id=" + encodeURIComponent ( shareID ) + "&dashboardDatabase=" + encodeURIComponent ( dashboardDatabase ) +
187204 ( shareConnectionDetails == "Yes" ? "&credentials=" + encodeURIComponent ( connection . protocol + "://"
188205 + connection . username + ":" + connection . password + "@" + connection . database + ":" + connection . url + ":" + connection . port ) : "" )
189206 + ( shareStandalone == "Yes" ? "&standalone=" + shareStandalone : "" ) ) ) ;
0 commit comments