Commit 29f2e66d authored by Oleksii Savran's avatar Oleksii Savran
Browse files

Merge branch 'historical-accession' into 'release/1.1'

Historical accession

See merge request !29
parents 4146a8ac dd8d5463
......@@ -11,10 +11,13 @@ The demo at https://genesys-pgr.p.gitlab.croptrust.org/ui-embedded/ displays dat
Add Javascript dependencies to your page:
```html
<script src="https://cdn.jsdelivr.net/npm/@genesys-pgr/ui-embedded@1.0.0/dist/genesys-deps.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@genesys-pgr/ui-embedded@1.0.0/dist/genesys-ui.js"></script>
<!-- Optionally use bootstrap CSS -->
<script src="https://cdn.jsdelivr.net/npm/@genesys-pgr/ui-embedded@1.1.0/dist/genesys-deps.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@genesys-pgr/ui-embedded@1.1.0/dist/genesys-ui.js"></script>
<!-- Recommended: Bootstrap CSS -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/css/bootstrap.min.css" />
<!-- Genesys UI CSS -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@genesys-pgr/ui-embedded@1.1.0/dist/genesys-deps.css" />
```
Add a container `<div>` to your HTML page and initialize the Genesys UI with the `<script>`:
......
......@@ -113,7 +113,7 @@ module.exports = {
{
test: /\.(png|jpe?g)$/,
use: [
{ loader: "file-loader?name=images/[name].[ext]" },
{ loader: 'file-loader?name=images/[name].[ext]' },
],
},
],
......
......@@ -7,9 +7,9 @@ const commonConfig = require('./webpack-base.config.js');
module.exports = webpackMerge.smart(commonConfig, {
mode: "development",
mode: 'development',
devtool: "source-map",
devtool: 'source-map',
entry: {},
......
......@@ -4,7 +4,7 @@ const CopyWebpackPlugin = require('copy-webpack-plugin');
module.exports = {
mode: "development",
mode: 'development',
entry: {
ui: './src/genesys.tsx',
......@@ -17,7 +17,8 @@ module.exports = {
// chunkFilename: '[name].[hash].js',
library: 'genesys',
libraryTarget: 'umd',
// globalObject: '',
globalObject: 'this',
crossOriginLoading: false,
},
resolve: {
......@@ -54,7 +55,7 @@ module.exports = {
{
test: /\.(png|jpe?g)$/,
use: [
{ loader: "file-loader?name=images/[name].[ext]" },
{ loader: 'file-loader?name=images/[name].[ext]' },
],
},
{
......@@ -67,15 +68,6 @@ module.exports = {
modules: false,
},
},
'resolve-url-loader', {
loader: 'sass-loader',
options: {
sourceMap: true,
sassOptions: {
includePaths: ['node_modules'],
},
},
},
],
},
],
......@@ -84,8 +76,8 @@ module.exports = {
plugins: [
// Keep CSS separate
new MiniCssExtractPlugin({
filename: '[name].[hash].css',
chunkFilename: '[name].[hash].css',
filename: 'genesys-[name].css',
// chunkFilename: 'genesys-[name].css',
}),
new CopyWebpackPlugin({
......@@ -102,10 +94,19 @@ module.exports = {
splitChunks: {
chunks: 'all',
cacheGroups: {
styles: {
name: 'deps',
test: /\.css$/,
chunks: 'all',
enforce: true,
reuseExistingChunk: true,
priority: 10, // make sure all CSS is grouped in this chunk
},
deps: {
test: /[\\/]node_modules[\\/]/,
name: 'deps',
chunks: 'all'
test: /[\\/]node_modules[\\/]/,
chunks: 'all',
priority: 1,
},
},
},
......
......@@ -9,7 +9,7 @@ const commonConfig = require('./webpack-base.config.js');
module.exports = webpackMerge.smart(commonConfig, {
mode: "production",
mode: 'production',
devServer: {
hot: false,
......@@ -20,7 +20,7 @@ module.exports = webpackMerge.smart(commonConfig, {
plugins: [
new webpack.LoaderOptionsPlugin({
minimize: true,
debug: false
debug: false,
}),
new HtmlWebpackPlugin({
filename: 'index.html', // The file to write the HTML to
......@@ -37,7 +37,7 @@ module.exports = webpackMerge.smart(commonConfig, {
vendor: {
test: /[\\/]node_modules[\\/]/,
name: 'vendors',
chunks: 'all'
chunks: 'all',
},
client: {
test: /[\\/]client[\\/]/,
......@@ -76,6 +76,6 @@ module.exports = webpackMerge.smart(commonConfig, {
// },
// canPrint: true
}),
]
}
],
},
});
......@@ -8,7 +8,7 @@ const commonConfig = require('./webpack-library.js');
module.exports = webpackMerge.smart(commonConfig, {
mode: "production",
mode: 'production',
optimization: {
usedExports: true,
......@@ -42,6 +42,6 @@ module.exports = webpackMerge.smart(commonConfig, {
// },
// canPrint: true
}),
]
}
],
},
});
......@@ -8,6 +8,8 @@
<meta name="author" content="Genesys Team, helpdesk@genesys-pgr.org" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/css/bootstrap.min.css"
integrity="sha384-TX8t27EcRE3e/ihU7zmQxVncDAy5uIKz4rEkgIXeMed4M0jlfIDPvg6uqKI2xXr2" crossorigin="anonymous" />
<!-- Genesys UI CSS-->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@genesys-pgr/ui-embedded@1.1.0/dist/genesys-deps.css" />
</head>
<body>
......@@ -55,8 +57,8 @@
felis nec auctor ultrices.</p>
</div>
<script src="https://cdn.jsdelivr.net/npm/@genesys-pgr/ui-embedded@1.0.0/dist/genesys-deps.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@genesys-pgr/ui-embedded@1.0.0/dist/genesys-ui.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@genesys-pgr/ui-embedded@1.1.0/dist/genesys-deps.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@genesys-pgr/ui-embedded@1.1.0/dist/genesys-ui.js"></script>
<script type="text/javascript">
// Detect language from query string
const queryLang = document.location.search && document.location.search.substr(1) || undefined;
......
......@@ -85,7 +85,7 @@ class AccessionDetailsPage extends React.Component<IAccessionDetailsPage & WithT
const canAdd = canAddToCart(accession.details);
return <button
return !accession.details.historic && <button
type="button"
disabled={ !canAdd }
name={ `button-add-${accession.details.uuid}` }
......@@ -137,15 +137,14 @@ class AccessionDetailsPage extends React.Component<IAccessionDetailsPage & WithT
}
</div>
{ details.historic && <div className="bg-warning p-2 mb-2">{ t('accession.historicalNote') }</div> }
{ details.doi && <Property title={ t('accession.doi') } value={ <a href={ `https://doi.org/${details.doi}` } target="_blank">{ details.doi }</a> } index={ propertyIndex++ }/> }
{ details.accessionName && <Property title={ t('accession.accessionName') } value={ <b>{ details.accessionName }</b> } index={ propertyIndex++ }/> }
<Property title={ t('accession.acceNumb') } value={ details.accessionNumber } index={ propertyIndex++ } />
{ details.institute && details.institute.fullName &&
<Property title={ t('accession.holdingInstitute') } value={ details.institute.fullName } index={ propertyIndex++ }/>
}
{ details.historic &&
<Property title="Historic accession" value={ 'This is a historic record of an accession' } index={ propertyIndex++ }/>
}
{ details.institute && details.institute.code &&
<Property title={ t('accession.instituteCode') } value={ details.institute.code } index={ propertyIndex++ }/>
}
......
......@@ -216,7 +216,7 @@ class AccessionListPage extends React.Component<IAccessionListPageProps & WithTr
</thead>
<tbody>
{ accessions.content.map((a, i) => (
<tr key={ a.id } className={ selectedUUIDs.has(a.uuid) ? 'table-primary' : '' }>
<tr key={ a.id } className={ a.historic ? 'table-historical' : selectedUUIDs.has(a.uuid) ? 'table-primary' : '' }>
{ shoppingCart.enabled && (
<td>
{ canAddToCart(a) &&
......
tr.table-historical {
opacity: .5;
}
......@@ -31,6 +31,7 @@
"accession": {
"model": "Accession",
"model_plural": "Accessions",
"historicalNote": "This is a historical record of an accession.",
"doi": "Accession DOI",
"crop": "Crop",
"cropName": "Crop name",
......
......@@ -18,6 +18,7 @@ import MapPage from 'map/MapPage';
import ApiInfo from '@genesys/client/model/ApiInfo';
import 'leaflet/dist/leaflet.css';
import 'genesys.css';
const hashHistory = createHashHistory({});
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment