Commit fc53b12b authored by Oleksii Savran's avatar Oleksii Savran
Browse files

Merge branch '12-map-of-accessions' into 'release/1.1'

Resolve "Map of accessions"

See merge request !15
parents 5d95215b ce431984
......@@ -42,6 +42,13 @@ Add a container `<div>` to your HTML page and initialize the Genesys UI with the
enabled: true, // Enable shopping cart
},
recaptchaSiteKey: '<public key for your site>', // Public ReCaptcha site key
map: {
enabled: true, // Enable map
baseMap: {
url: 'https://server.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer/tile/{z}/{y}/{x}/', // tile server url for the base layer
attribution: 'Tiles &copy; Esri &mdash; Esri, DeLorme, NAVTEQ' // attribution data
},
}
};
// Show UI
......@@ -70,6 +77,7 @@ to *@geneesys-pgr/ui-embedded*:
|`title`| *Genesys:* | HTML page title prefix |
| `accession` | `{ ... }` | See *Accession* configuration options |
| `shoppingCart` | `{ ... }` | See *Shopping cart* configuration options |
| `map` | `{ ... }` | See *Map* configuration |
Additional configuration options are described below.
......@@ -103,3 +111,15 @@ const genesysConfig = {
|---|---|---|
|`enabled`|`false`| Toggle Shopping cart functionality |
### Map configuration
The map is **disabled by default**. To allow users to see map of accession collecting site on accession details page and access the map page you must explicity enable it in your configuration and provide a tile server URL and an attribution data for the base map layer:
|Property|Default|Description|
|---|---|---|
|`enabled`|`false`| Toggle map functionality |
|`height`|`'400px'`| Height of the map of accessions (use a CSS expression) |
|`baseMap`|`{ url: ..., attribution: ... }`| See `url` and `attribution` below. |
|`baseMap.url`|[World_Light_Gray_Base](https://server.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer/tile/{z}/{y}/{x}/)| Tile server url for the map base layer. |
|`baseMap.attribution`|Tiles &copy; ...| Base layer attribution. |
......@@ -5,7 +5,7 @@ const ScriptExtHtmlWebpackPlugin = require('script-ext-html-webpack-plugin');
const HtmlWebpackExcludeAssetsPlugin = require('html-webpack-exclude-assets-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const ManifestPlugin = require('webpack-manifest-plugin');
// const CopyWebpackPlugin = require('copy-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
// const fs = require('fs');
// devserver configuration
......@@ -14,178 +14,161 @@ const PORT = process.env.PORT || 3000;
module.exports = {
stats: {
colors: true
stats: {
colors: true,
},
devServer: {
hot: true,
inline: true,
contentBase: false,
compress: true,
port: PORT,
host: HOST,
watchOptions: {
ignored: /node_modules/,
},
devServer: {
hot: true,
inline: true,
contentBase: false,
compress: true,
port: PORT,
host: HOST,
watchOptions: {
ignored: /node_modules/
},
overlay: {
warnings: true,
errors: true
},
clientLogLevel: 'warning',
historyApiFallback: {
disableDotRule: true
},
overlay: {
warnings: true,
errors: true,
},
entry: {
genesys: [ 'babel-polyfill', /* './entrypoints/vendor.ts', */ './entrypoints/client.tsx' ]
clientLogLevel: 'warning',
historyApiFallback: {
disableDotRule: true,
},
output: {
filename: '[name].[hash].js',
// chunkFilename: '[name].[hash].js',
path: path.join(process.cwd(), 'target/app/assets'),
publicPath: ''
},
entry: {
genesys: ['babel-polyfill', /* './entrypoints/vendor.ts', */ './entrypoints/client.tsx'],
},
output: {
filename: '[name].[hash].js',
// chunkFilename: '[name].[hash].js',
path: path.join(process.cwd(), 'target/app/assets'),
publicPath: '',
},
resolve: {
extensions: ['.ts', '.tsx', '.js', '.jsx'],
modules: [path.resolve('./src'), 'node_modules'],
alias: {
'@genesys/client': path.resolve(process.cwd(), '../genesys-ui/workspaces/client/src'),
'@assets': path.resolve(process.cwd(), './assets'),
},
resolve: {
extensions: ['.ts', '.tsx', '.js', '.jsx'],
modules: [path.resolve('./src'), 'node_modules'],
alias: {
'@genesys/client': path.resolve(process.cwd(), '../genesys-ui/workspaces/client/src'),
'@assets': path.resolve(process.cwd(), './assets'),
},
module: {
rules: [
{
test: /\.tsx?$/,
enforce: 'pre',
loader: 'eslint-loader',
exclude: /node_modules/,
},
{
test: /\.tsx?$/,
use: {
loader: 'awesome-typescript-loader',
},
},
module: {
rules: [
{
test: /\.tsx?$/,
enforce: 'pre',
loader: 'eslint-loader',
exclude: /node_modules/,
},
{
test: /\.tsx?$/,
use: {
loader: 'awesome-typescript-loader',
},
},
{
test: /\.scss$/,
use: [
MiniCssExtractPlugin.loader,
{
loader: 'css-loader',
options: {
modules: false
},
},
'resolve-url-loader', {
loader: 'sass-loader',
options: {
sourceMap: true,
sassOptions: {
includePaths: ['node_modules']
}
}
}
]
},
{
test: /\.css$/,
exclude: /node_modules\/react\-toolbox/,
use: [
MiniCssExtractPlugin.loader,
'css-loader'
]
},
{
test: /\.css$/,
include: /node_modules\/react\-toolbox/,
use: [
MiniCssExtractPlugin.loader,
{
loader: 'css-loader',
options: {
modules: true,
importLoaders: 1,
sourceMap: true,
localIdentName: '[path][name]__[local]'
}
}, 'resolve-url-loader', 'postcss-loader'
]
},
// fonts
{
test: /\.(woff|woff2|eot)(\?.*)?$/,
loader: 'file-loader?name=fonts/[hash].[ext]'
},
{
test: /\.ttf(\?.*)?$/,
loader: 'url-loader?limit=10000&mimetype=application/octet-stream&name=fonts/[hash].[ext]'
},
{
test: /\.(jpe?g|png|gif|svg)$/i,
exclude: /node_modules\/leaflet/,
loader: 'url-loader?limit=100000&name=images/[name].[ext]'
},
{
test: /\.(jpe?g|png|gif|svg)$/i,
include: /node_modules\/leaflet/,
loader: 'file-loader?limit=100000&name=images/[name].[ext]'
}
]
},
plugins: [
new ManifestPlugin({
basePath: '/html/'
}),
// Inject scripts to app's real index.html
new HtmlWebpackPlugin({
title: 'Genesys', // The title to use for the generated HTML document
filename: 'index.html', // The file to write the HTML to
// minify: {...}, // Pass a html-minifier options object to minify the output
xhtml: true,
template: './entrypoints/index.html',
// favicon: 'favicon.ico',
// localesMapping: fs.readFileSync('./generated/locales/localesMapping.json', {encoding: 'utf8'}),
}),
// Defer/Async scripts
new ScriptExtHtmlWebpackPlugin({
defaultAttribute: 'async',
// async: [ 'genesys' ],
}),
// Keep CSS separate
new MiniCssExtractPlugin({
filename: '[name].[hash].css',
chunkFilename: '[name].[hash].css'
}),
new HtmlWebpackExcludeAssetsPlugin(),
// Used with i18next-http-backend plugin
// new CopyWebpackPlugin([
// { from: 'src/locales', to: 'locales'},
// ]),
},
// {
// test: /\.scss$/,
// use: [
// MiniCssExtractPlugin.loader,
// {
// loader: 'css-loader',
// options: {
// modules: false,
// },
// },
// 'resolve-url-loader', {
// loader: 'sass-loader',
// options: {
// sourceMap: true,
// sassOptions: {
// includePaths: ['node_modules'],
// },
// },
// },
// ],
// },
{
test: /\.css$/,
// exclude: /node_modules\/react\-toolbox/,
use: [
MiniCssExtractPlugin.loader,
'css-loader',
],
},
// fonts
{
test: /\.(woff|woff2|eot)(\?.*)?$/,
loader: 'file-loader?name=fonts/[hash].[ext]',
},
{
test: /\.ttf(\?.*)?$/,
loader: 'url-loader?limit=10000&mimetype=application/octet-stream&name=fonts/[hash].[ext]',
},
{
test: /\.(png|jpe?g)$/,
use: [
{ loader: "file-loader?name=images/[name].[ext]" },
],
},
],
// optimization: {
// splitChunks: {
// chunks: 'all',
// cacheGroups: {
// vendor: {
// test: /[\\/]node_modules[\\/]/,
// name: 'vendors',
// chunks: 'all'
// }
// },
// },
// }
},
plugins: [
new ManifestPlugin({
basePath: '/html/',
}),
// Inject scripts to app's real index.html
new HtmlWebpackPlugin({
title: 'Genesys', // The title to use for the generated HTML document
filename: 'index.html', // The file to write the HTML to
// minify: {...}, // Pass a html-minifier options object to minify the output
xhtml: true,
template: './entrypoints/index.html',
// favicon: 'favicon.ico',
// localesMapping: fs.readFileSync('./generated/locales/localesMapping.json', {encoding: 'utf8'}),
}),
// Defer/Async scripts
new ScriptExtHtmlWebpackPlugin({
defaultAttribute: 'async',
// async: [ 'genesys' ],
}),
// Keep CSS separate
new MiniCssExtractPlugin({
filename: '[name].[hash].css',
chunkFilename: '[name].[hash].css',
}),
new HtmlWebpackExcludeAssetsPlugin(),
new CopyWebpackPlugin({
patterns: [
{ from: './node_modules/leaflet/dist/images', to: 'images' },
// Used with i18next-http-backend plugin
// { from: 'src/locales', to: 'locales' },
],
}),
],
// optimization: {
// splitChunks: {
// chunks: 'all',
// cacheGroups: {
// vendor: {
// test: /[\\/]node_modules[\\/]/,
// name: 'vendors',
// chunks: 'all'
// }
// },
// },
// }
};
......@@ -7,29 +7,29 @@ const commonConfig = require('./webpack-base.config.js');
module.exports = webpackMerge.smart(commonConfig, {
mode: "development",
mode: "development",
devtool: "source-map",
devtool: "source-map",
entry: {},
entry: {},
plugins: [
new webpack.LoaderOptionsPlugin({
minimize: false,
debug: true,
options: {
tslint: {
failOnHint: false
}
}
}),
new HtmlWebpackPlugin({
filename: 'index.html', // The file to write the HTML to
// minify: {...}, // Pass a html-minifier options object to minify the output
xhtml: true,
template: './entrypoints/index.html',
}),
// hot module replacement for webpack-dev-server
new webpack.HotModuleReplacementPlugin(),
],
plugins: [
new webpack.LoaderOptionsPlugin({
minimize: false,
debug: true,
options: {
tslint: {
failOnHint: false,
},
},
}),
new HtmlWebpackPlugin({
filename: 'index.html', // The file to write the HTML to
// minify: {...}, // Pass a html-minifier options object to minify the output
xhtml: true,
template: './entrypoints/index.html',
}),
// hot module replacement for webpack-dev-server
new webpack.HotModuleReplacementPlugin(),
],
});
const path = require('path');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
module.exports = {
......@@ -24,7 +25,7 @@ module.exports = {
commonjs: 'lodash',
commonjs2: 'lodash',
amd: 'lodash',
root: '_'
root: '_',
},
},
......@@ -39,42 +40,72 @@ module.exports = {
module: {
rules: [
{
test: /\.tsx?$/,
enforce: 'pre',
loader: 'eslint-loader',
exclude: /node_modules/,
{
test: /\.tsx?$/,
enforce: 'pre',
loader: 'eslint-loader',
exclude: /node_modules/,
},
{
test: /\.tsx?$/,
use: {
loader: 'awesome-typescript-loader',
},
{
test: /\.tsx?$/,
use: {
loader: 'awesome-typescript-loader',
},
{
test: /\.css$/,
// exclude: /node_modules\/react\-toolbox/,
use: [
MiniCssExtractPlugin.loader,
'css-loader',
],
},
{
test: /\.(png|jpe?g)$/,
use: [
{ loader: "file-loader?name=images/[name].[ext]" },
],
},
{
test: /\.scss$/,
use: [
MiniCssExtractPlugin.loader,
{
loader: 'css-loader',
options: {
modules: false,
},
},
{
test: /\.scss$/,
use: [
MiniCssExtractPlugin.loader,
{
loader: 'css-loader',
options: {
modules: false
},
},
'resolve-url-loader', {
loader: 'sass-loader',
options: {
sourceMap: true,
sassOptions: {
includePaths: ['node_modules']
}
}
}
]
},
]
},
'resolve-url-loader', {
loader: 'sass-loader',
options: {
sourceMap: true,
sassOptions: {
includePaths: ['node_modules'],
},
},
},
],
},
],
},
plugins: [
// Keep CSS separate
new MiniCssExtractPlugin({
filename: '[name].[hash].css',
chunkFilename: '[name].[hash].css',
}),
new CopyWebpackPlugin({
patterns: [
{ from: './node_modules/leaflet/dist/images', to: 'images' },
// Used with i18next-http-backend plugin
// { from: 'src/locales', to: 'locales' },
],
}),
],
optimization: {
noEmitOnErrors: true,
splitChunks: {
......@@ -87,5 +118,5 @@ module.exports = {
},
},
},
}
},
};
......@@ -9,73 +9,73 @@ const commonConfig = require('./webpack-base.config.js');
module.exports = webpackMerge.smart(commonConfig, {
mode: "production",
mode: "production",
devServer: {
hot: false,
inline: false,
compress: true,
},
devServer: {
hot: false,
inline: false,
compress: true,
},
plugins: [
new webpack.LoaderOptionsPlugin({
minimize: true,
debug: false
}),
new HtmlWebpackPlugin({
filename: 'index.html', // The file to write the HTML to
// minify: {...}, // Pass a html-minifier options object to minify the output
xhtml: true,
template: './entrypoints/index.html',
}),
],
optimization: {
noEmitOnErrors: true,
splitChunks: {
chunks: 'all',
cacheGroups: {
vendor: {
test: /[\\/]node_modules[\\/]/,
name: 'vendors',
chunks: 'all'
},
client: {
test: /[\\/]client[\\/]/,
name: 'client',
chunks: 'all',
},
},
plugins: [
new webpack.LoaderOptionsPlugin({
minimize: true,
debug: false
}),
new HtmlWebpackPlugin({
filename: 'index.html', // The file to write the HTML to
// minify: {...}, // Pass a html-minifier options object to minify the output
xhtml: true,
template: './entrypoints/index.html',
}),
],
optimization: {
noEmitOnErrors: true,
splitChunks: {
chunks: 'all',