forked from geosolutions-it/geonode-mapstore-client
-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e69bc1b
commit 6fbe38e
Showing
24 changed files
with
1,325 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
/* | ||
* Copyright 2022, GeoSolutions Sas. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
import { connect } from 'react-redux'; | ||
import main from '@mapstore/framework/components/app/main'; | ||
import MetadataRoute from '@js/routes/Metadata'; | ||
import MainLoader from '@js/components/MainLoader'; | ||
import Router, { withRoutes } from '@js/components/Router'; | ||
import security from '@mapstore/framework/reducers/security'; | ||
import { | ||
getEndpoints, | ||
getConfiguration, | ||
getAccountInfo | ||
} from '@js/api/geonode/v2'; | ||
import { | ||
setupConfiguration, | ||
initializeApp, | ||
getPluginsConfiguration, | ||
getPluginsConfigOverride | ||
} from '@js/utils/AppUtils'; | ||
import pluginsDefinition, { storeEpicsNamesToExclude, cleanEpics } from '@js/plugins/index'; | ||
import gnsettings from '@js/reducers/gnsettings'; | ||
import { updateGeoNodeSettings } from '@js/actions/gnsettings'; | ||
import { METADATA_ROUTES, appRouteComponentTypes } from '@js/utils/AppRoutesUtils'; | ||
|
||
const requires = {}; | ||
|
||
initializeApp(); | ||
|
||
const DEFAULT_LOCALE = {}; | ||
const ConnectedRouter = connect((state) => ({ | ||
locale: state?.locale || DEFAULT_LOCALE | ||
}))(Router); | ||
|
||
const viewer = { | ||
[appRouteComponentTypes.METADATA]: MetadataRoute | ||
}; | ||
|
||
const routes = METADATA_ROUTES.map(({ component, ...config }) => ({ ...config, component: viewer[component] })); | ||
|
||
document.addEventListener('DOMContentLoaded', function() { | ||
getEndpoints().then(() => { | ||
Promise.all([ | ||
getConfiguration(), | ||
getAccountInfo() | ||
]) | ||
.then(([localConfig, user]) => { | ||
|
||
setupConfiguration({ localConfig, user }) | ||
.then(({ | ||
securityState, | ||
pluginsConfigKey, | ||
geoNodeConfiguration, | ||
configEpics, | ||
onStoreInit, | ||
settings | ||
}) => { | ||
|
||
const appEpics = cleanEpics({ | ||
...configEpics | ||
}); | ||
|
||
storeEpicsNamesToExclude(appEpics); | ||
|
||
main({ | ||
appComponent: withRoutes(routes)(ConnectedRouter), | ||
pluginsConfig: getPluginsConfigOverride(getPluginsConfiguration(localConfig.plugins, pluginsConfigKey)), | ||
targetId: 'ms-container', | ||
loaderComponent: MainLoader, | ||
pluginsDef: { | ||
plugins: { | ||
...pluginsDefinition.plugins | ||
}, | ||
requires: { | ||
...requires, | ||
...pluginsDefinition.requires | ||
} | ||
}, | ||
initialState: { | ||
defaultState: { | ||
...securityState | ||
} | ||
}, | ||
themeCfg: null, | ||
appReducers: { | ||
security, | ||
gnsettings | ||
}, | ||
appEpics, | ||
onStoreInit, | ||
geoNodeConfiguration, | ||
initialActions: [ | ||
updateGeoNodeSettings.bind(null, settings) | ||
] | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.