Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions public/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"standalone": false,
"standaloneProtocol": "neo4j",
"standaloneHost": "localhost",
"standalonePassword":"test123",
"standalonePort": "7687",
"standaloneDatabase": "neo4j",
"standaloneDashboardName": "My Dashboard",
Expand Down
31 changes: 24 additions & 7 deletions src/application/ApplicationThunks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,8 @@ export const onConfirmLoadSharedDashboardThunk = () => (dispatch: any, getState:
const shareDetails = state.application.shareDetails;
dispatch(setWelcomeScreenOpen(false));
dispatch(setDashboardToLoadAfterConnecting(shareDetails.id));
if(shareDetails.dashboardDatabase){
if (shareDetails.dashboardDatabase) {
dispatch(setStandaloneDashboardDatabase(shareDetails.dashboardDatabase));

dispatch(setStandaloneDashboardDatabase(shareDetails.database));
}
if (shareDetails.url) {
Expand All @@ -172,13 +171,13 @@ export const loadApplicationConfigThunk = () => async (dispatch: any, getState:
standaloneProtocol: "neo4j",
standaloneHost: "localhost",
standalonePort: "7687",
standaloneDatabase: "neo4j",
standaloneDatabase: "neo4j",
standaloneDashboardName: "My Dashboard",
standaloneDashboardDatabase: "dashboards"
standaloneDashboardDatabase: "dashboards"
}
try {
config = await (await fetch("/config.json")).json();
}catch (e){
} catch (e) {
// Config may not be found, for example when we are in Neo4j Desktop.
console.log("No config file detected. Setting to safe defaults.")
}
Expand All @@ -188,13 +187,31 @@ export const loadApplicationConfigThunk = () => async (dispatch: any, getState:
const standalone = config['standalone'];// || (state.application.shareDetails !== undefined && state.application.shareDetails.standalone);
dispatch(setStandaloneEnabled(standalone, config['standaloneProtocol'], config['standaloneHost'], config['standalonePort'], config['standaloneDatabase'], config['standaloneDashboardName'], config['standaloneDashboardDatabase']))
if (standalone) {
dispatch(setConnectionProperties(config['standaloneProtocol'], config['standaloneHost'], config['standalonePort'], config['standaloneDatabase'], state.application.connection.username, state.application.connection.password));
dispatch(setConnectionModalOpen(true));
// If we are running in standalone mode, auto-set the connection details that are configured.
dispatch(setConnectionProperties(
config['standaloneProtocol'],
config['standaloneHost'],
config['standalonePort'],
config['standaloneDatabase'],
config['standaloneUsername'] ? config['standaloneUsername'] : state.application.connection.username,
config['standalonePassword'] ? config['standalonePassword'] : state.application.connection.password));

dispatch(setAboutModalOpen(false));
dispatch(setConnected(false));
dispatch(setWelcomeScreenOpen(false));
dispatch(setDashboardToLoadAfterConnecting("name:" + config['standaloneDashboardName']));
dispatch(clearNotification());
// Override for when username and password are specified in the config - automatically connect to the specified URL.
if (config['standaloneUsername'] && config['standalonePassword']) {
dispatch(createConnectionThunk(config['standaloneProtocol'],
config['standaloneHost'],
config['standalonePort'],
config['standaloneDatabase'],
config['standaloneUsername'],
config['standalonePassword']));
}else{
dispatch(setConnectionModalOpen(true));
}
} else {
dispatch(clearDesktopConnectionProperties());
dispatch(setDatabaseFromNeo4jDesktopIntegrationThunk());
Expand Down