@@ -23,6 +23,7 @@ import { applicationGetConnection } from '../application/ApplicationSelectors';
23
23
24
24
// const shareBaseURL = "http://localhost:3000";
25
25
const shareBaseURL = "http://neodash.graphapp.io" ;
26
+ const shareLocalURL = window . location . origin . startsWith ( "file" ) ? shareBaseURL : window . location . origin ;
26
27
const styles = {
27
28
28
29
} ;
@@ -42,6 +43,8 @@ export const NeoShareModal = ({ connection, loadDashboardListFromNeo4j, loadData
42
43
const [ shareFileURL , setShareFileURL ] = React . useState ( "" ) ;
43
44
const [ shareConnectionDetails , setShareConnectionDetails ] = React . useState ( "No" ) ;
44
45
const [ shareStandalone , setShareStandalone ] = React . useState ( "No" ) ;
46
+ const [ selfHosted , setSelfHosted ] = React . useState ( "No" ) ;
47
+
45
48
const [ shareLink , setShareLink ] = React . useState ( null ) ;
46
49
47
50
@@ -164,6 +167,7 @@ export const NeoShareModal = ({ connection, loadDashboardListFromNeo4j, loadData
164
167
setShareConnectionDetails ( e )
165
168
} }
166
169
/>
170
+ { shareLocalURL != shareBaseURL ?
167
171
< NeoSetting key = { "standalone" } name = { "standalone" }
168
172
value = { shareStandalone }
169
173
style = { { marginLeft : "0px" , width : "100%" , marginBottom : "10px" } }
@@ -179,11 +183,24 @@ export const NeoShareModal = ({ connection, loadDashboardListFromNeo4j, loadData
179
183
setShareConnectionDetails ( "Yes" )
180
184
}
181
185
} }
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
+ } }
182
199
/>
183
200
< Button
184
201
component = "label"
185
202
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 ) +
187
204
( shareConnectionDetails == "Yes" ? "&credentials=" + encodeURIComponent ( connection . protocol + "://"
188
205
+ connection . username + ":" + connection . password + "@" + connection . database + ":" + connection . url + ":" + connection . port ) : "" )
189
206
+ ( shareStandalone == "Yes" ? "&standalone=" + shareStandalone : "" ) ) ) ;
0 commit comments