Commit 0e55a679 authored by malzer's avatar malzer
Browse files

Merge branch 'add-webpack' into 'develop'

New release workflow based on Webpack and GitlabCI

See merge request !13
parents c9a500fc 46c94ddf
/PLATIN/**
/docs/_build/**
/node_modules
/dist
variables:
BRANCH_NAME: $CI_COMMIT_REF_NAME
stages:
- build_platin
- build_docs
- build_app
- packaging
- deploy
build_platin:
only:
- tags
- master
image: ruby:3.0
stage: build_platin
script:
- git clone https://github.com/DARIAH-DE/PLATIN.git
- apt-get update && apt-get -y install default-jre
- cd PLATIN
- rake all
artifacts:
paths:
- PLATIN
build_docs:
only:
- tags
- master
image: python:3
stage: build_docs
script:
- cd docs
- apt-get update && apt-get -y install python3-virtualenv
- virtualenv venv
- pwd . venv/bin/activate
- pip install -r requirements.txt
- beta="-BETA"
- if test "$BRANCH_NAME" = 'master'; then beta=""; fi
- RELEASE_DATE="$(date +'%Y/%m/%d')${beta}"
- RELEASE_VERSION="$(date +'%Y')${beta}"
- make clean html SPHINXOPTS="-D version=${BUILD_VERSION} -D release=${RELEASE_DATE}"
artifacts:
paths:
- docs/_build/html
build_dev:
only:
- tags
image: node:15
stage: build_app
script:
- npm ci
- VERSION=$(node -p "require('./package.json').version")
- echo "VERSION=${VERSION}" >> build.env
- npm run build:beta
artifacts:
paths:
- dist/
reports:
dotenv: build.env
#build_live:
# only:
# - master
# - merge-requests
#image: node:15
#stage: build_app
#script:
# - npm ci
# - VERSION=$(node -p "require('./package.json').version")
# - echo "VERSION=${VERSION}" >> build.env
# - npm run build:release
#artifacts:
# paths:
# - dist/
#reports:
# dotenv: build.env
package_dev:
only:
- tags
image: ruby:3.0
stage: packaging
variables:
prefix: $BETA_PATH
name: 'dariahde-geobrowser-beta'
description: 'DARIAH-DE Geo-Browser BETA'
url: $BETA_URL
deb_file_name: '${name}_${VERSION}.deb'
script:
- gem install fpm
- cd dist
- 'fpm -p ${deb_file_name}
-t deb -a noarch -s dir
--name ${name}
--description "${description}"
--maintainer "DARIAH-DE <info@de.dariah.eu>"
--vendor "DARIAH-DE"
--url ${url}
--version ${VERSION}
--prefix ${prefix} .'
- mv $deb_file_name ../$deb_file_name
artifacts:
paths:
- $deb_file_name
#package_live:
# only:
# - master
# - merge_requests
# image: ruby:3.0
# stage: packaging
# variables:
# prefix: $LIVE_PATH
# name: 'dariahde-geobrowser'
# description: 'DARIAH-DE Geo-Browser'
# url: $LIVE_URL
# deb_file_name: '${name}_${VERSION}.deb'
# script:
# - gem install fpm
# - cd dist
# - 'fpm -p ${deb_file_name}
# -t deb -a noarch -s dir
# --name ${name}
# --description "${description}"
# --maintainer "DARIAH-DE <info@de.dariah.eu>"
# --vendor "DARIAH-DE"
# --url ${url}
# --version ${VERSION}
# --prefix ${prefix} .'
#- mv $deb_file_name ../$deb_file_name
#artifacts:
# paths:
# - $deb_file_name
deploy_dev:
only:
- tags
image: alpine:3.14
stage:
deploy
script:
- 'apk add --no-cache bash'
- 'apk add --no-cache curl'
- curl --version
- deb_package=$(ls ./*.deb)
- echo $deb_package
- curl -u ci:${APTLY_PASSWORD} -X POST -F file=@deb_package ${APTLY_URL}/files/${deb_package}
- curl -u ci:${APTLY_PASSWORD} -X POST ${APTLY_URL}/repos/indy-releases/file/${deb_package}
......@@ -50,7 +50,7 @@ node {
pip install -r requirements.txt
echo "===> Building HTML version within $(pwd)"
make clean html
make clean html SPHINXOPTS="-D version='TEST' -D release='RELEASE-TEST'"
'''
}
......
# The DARIAH-DE Geo-Browser and Datasheet Editor
## Install DARIAH-DE Geo-Browser und Datasheet Editor v3
## Install DARIAH-DE Geo-Browser und Datasheet Editor
1. Check out Geo-Browser main folder
......@@ -11,15 +11,9 @@
git clone https://github.com/DARIAH-DE/PLATIN.git
3. Build all the PLATIN stuff
3. Run and debug Geo-Browser locally (this already includes building PLATIN):
cd PLATIN
rake all
4. Run and debug Geo-Browser locally:
cd ..
npm install
npm start
5. Enjoy your new Geo-Browser installation!
4. Enjoy your new Geo-Browser installation!
# RELEASE.md
For releasing a new Geo-Browser and Datasheet version, please have a look at the [DARIAH-DE Release Management Page](https://wiki.de.dariah.eu/display/DARIAH3/DARIAH-DE+Release+Management).
## Deployment Workflow
The deployment workflows for SNAPSHOT and RELEASE deployments are covered by the Jenkinsfile of each branch, please see [Jenkinsfile](./Jenkinsfile), and of course the [DARIAH-DE Jenkins](https://ci.de.dariah.eu/jenkins/job/DARIAH-DE-Geo-Browser/) installation.
## Specials in Geo-Browser and Datasheet releases are the following
### Release PLATIN first (if changed)
You must first release the [DARIAH-DE PLATIN Library](https://github.com/DARIAH-DE/PLATIN) (only if changed at all!)
To do this, merge the updated `develop` branch into the `master` branch. During Geo-Browser release, only PLATIN's `master` branch will be checked out (for both BETA and release version). The URL to the storage will be determined automatically depending on the URL of the application.
git checkout develop
git flow release start 3.6.9
Edit the file `./PLATIN/js/GeoTemConfig.js` and maybe adapt all references and links from BETA versions and DEVELOPMENT services to RELEASE and PRODUCTIVE (such as DARIAH-DE OwnStorage):
* dariahOwnStorageURL
* dataSheetEditor
git commit -am "New RELEASE version 3.6.9"
git flow release finish 3.6.9
Edit `./PLATIN/js/GeoTemConfig.js` again and change back the
### Release Geo-Browser
* dariahOwnStorageURL
* dataSheetEditor
* Update the [CHANGELOG.md](./CHANGELOG.md) to the new RELEASE version
Afterwards:
git commit -m "Update changelog for new RELEASE version 3.6.9"
git push origin develop
git commit -am "New SNAPSHOT version 3.6.10-BETA"
git push origin develop master --tag
* Update the version number in **package.json** by typing **one** of these commands, depending on the type of change:
### Release Geo-Browser
npm version patch # e.g. 3.6.8 --> 3.6.9
npm version minor # e.g. 3.6.8 --> 3.7.0
npm version major # e.g. 3.6.8 --> 4.0.0
git checkout develop
git pull
git flow release start 3.6.9
* Please adapt the [Jenkinsfile](./Jenkinsfile) for the release version, please see comments there.
- Use `package_version = '3.6.9-BETA` for BETA deployment at [geobrowser.de.dariah.eu/beta](https://geobrowser.de.dariah.eu/beta), and
- use `package_version = '3.6.9'` for RELEASE deployment at [geobrowser.de.dariah.eu](https://geobrowser.de.dariah.eu).
- See FIXME: Remove develop checkout if releasing!!!
* Adapt the version strings in the following files:
- [index.html](./index.html)
- [edit/index.html](./edit/index.html)
- [edit/list.html](./edit/list.html)
- [embed/index.html](./embed/index.html)] (comment only!)
- [docs/conf.py](./docs/conf.py)
* Adapt all references to RELEASE and PRODUCTIVE services in config files
- [js/dariah.geobro.conf.js](./js/dariah.geobro.conf.js)
* Update the [CHANGELOG.md](./CHANGELOG.md) to the new RELEASE version
This will increase the version automatically and create a version commit and tag. Afterwards, just do:
git commit -am "String changes for new RELEASE version 3.6.9"
git flow release finish 3.6.9
git push --follow-tags
* Increase version in Jenkinsfile (such as `3.6.10-BETA`) and change back Jenkinsfile release adaptations.
* Increase version and add “-BETA“ in all above mentioned files.
The tag will trigger the `develop` (BETA) pipeline on Gitlab CI and deploy this version on the BETA server.
git commit -am "New SNAPSHOT version 3.6.10-BETA"
git push origin develop master --tags
Once this has been finished successfully, you can RELEASE the same version on the live server. All URL updates / version names will be handled automatically. You just need to trigger the `master` (RELEASE) pipeline by merging `develop` into `master`.
......@@ -25,12 +25,6 @@ select, button, input {
display: block;
overflow-y: scroll;
}
.dropdownSelection {
width: 250px;
}
.dropdownMenu {
width: 250px;
}
#navbar {
z-index: 10100;
}
......
# Main dependencies for compilation
sphinx==1.3.1
pygments==1.6
pygments>=2.0
docutils <0.13.1
# additional sphinx plugins
......
......@@ -17,20 +17,14 @@
<link rel="stylesheet" href="https://dariah-de.github.io/status/dariah/embed.css">
<link rel="stylesheet" type="text/css" media="screen" href="./css/dariah.workflow.css" />
<link rel="shortcut icon" type="image/png" href="https://res.de.dariah.eu/dhrep/img/page_icon.png" />
<!-- DARIAH utils with some login/logout things and storage of course. We do need this right from the start! -->
<script src="../js/dariah.geobro.conf.js"></script>
<script src="../js/sessionStorageWrapper.js"></script>
<script src="./js/dariah.utils.js"></script>
<script src="./js/dariah.storage.js"></script>
<script src="./js/dariah.workflow.conf.js"></script>
<script>getEmbeddedDariahStatus();</script>
<style>
body { padding-top: 50px; }
</style>
<script src="../js/matomo.js"></script>
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top navbar-dariah" id="top">
<script src="../PLATIN/lib/jquery/jquery.min.js"></script>
<script src="../PLATIN/platin.js"></script>
<div class="navbar navbar-inverse navbar-fixed-top navbar-dariah" id="top">
<div class="navbar-inner">
<div class="container-fluid">
<div class="row-fluid">
......@@ -52,11 +46,11 @@
<i class="icon-wrench icon-white"></i> Actions <b class="caret"></b>
</a>
<ul class="dropdown-menu">
<li><a href="list.html">List OwnStorage files &nbsp; <span class="badge badge-important">EXPERIMENTAL</span></a></li>
<li><a href="list.html">List OwnStorage files &nbsp; <span class="badge badge-warning">Beta</span></a></li>
</ul>
</li>
<li>
<a id="loggedin" title="Login or logout here – as you wish! You need to be logged in for reading, writing, and sharing/unsharing non-public data from DARIAH-DE Storage that you are owner of."></a>
<a id="loggedin" href="" title="Login or logout here – as you wish! You need to be logged in for reading, writing, and sharing/unsharing non-public data from DARIAH-DE Storage that you are owner of."></a>
</li>
</ul>
<ul class="nav">
......@@ -125,10 +119,10 @@
<span id="importMessage" class="console-large">&nbsp;</span>
</p>
</div>
<div id="sheetArea">
<div id="sheetArea" style="display:none">
<div id="howtoArea"></div>
<button id="howtoButton" class="btn btn-small pull-right" onclick="toggleHowto();" title="Read a small howto to get help filling in the table data.">How to fill the table</button>
<button id="clearSelectionButton" class="btn btn-small pull-right" style="margin-right: 5px" onclick="clearTableSelection();" title="Clear selection of table cells.">Clear selection</button>
<button id="howtoButton" class="btn btn-small pull-right" title="Read a small howto to get help filling in the table data.">How to fill the table</button>
<button id="clearSelectionButton" class="btn btn-small pull-right" style="margin-right: 5px" title="Clear selection of table cells.">Clear selection</button>
<br/>
<p>
<img id="spinningConsoleCompletionFlower" class="hide" src="https://res.de.dariah.eu/dhrep/img/spinning-flower_slow.gif" alt="Data table loading..." width="16" />
......@@ -139,12 +133,12 @@
</div>
</div>
</div>
<div id = "geolocationArea" class="row-fluid">
<div id = "geolocationArea" style="display:none" class="row-fluid">
<div id="content" class="primary-area">
<div id="tgnArea" class="well span6">
<h3>Place selection &nbsp; <img id="spinningGeolocationCompletionFlower" class="hide" src="https://res.de.dariah.eu/dhrep/img/spinning-flower_slow.gif" alt="Geolocation completion running" width="22" /></h3>
<label for="geolocationSource">Geolocation can be based either on the <i>Getty Thesaurus of Geographic Names (TGN)</i>, <i>OpenStreetMap (OSM)</i>, or <i>GeoNames</i>. Choose which geolocator to use: </label>
<select name="geolocationSource" id="geolocationSource" onchange="toggleTGNOptions()">
<select name="geolocationSource" id="geolocationSource">
<option value="TGN">TGN</option>
<option value="OSM">OSM (Nominatim)</option>
<option value="GeoNames">GeoNames</option>
......@@ -171,10 +165,10 @@
</div>
<div class="input-append">
<input id="osmPlaceName" style="width:77%;" type="text" class="input-large" placeholder="Enter exact place name as in “Address“ field..."/>
<button id="setAllPlacesOSMButton" class="btn" style="width:18%;" onClick="setAllPlacesOSM()" title="Sets all places with this name to the chosen coordinates."><i id='setAllPlacesIcon' class="icon-pencil"></i>&nbsp;Set</button>
<button id="setAllPlacesOSMButton" class="btn" style="width:18%;" title="Sets all places with this name to the chosen coordinates."><i id='setAllPlacesIcon' class="icon-pencil"></i>&nbsp;Set</button>
</div>
<div>
<i>Note: 'Set' will overwrite coordinates for <b>all</b> table rows matching this place unless you only select specific rows or cells first.</i>
<i>Note: 'Set' will overwrite coordinates for <b>all</b> table rows matching this address unless you only select specific rows or cells first.</i>
<p></p>
</div>
<div id="editMap" class="osmMap"></div>
......@@ -184,9 +178,9 @@
<div>
<input type="text" placeholder="Enter your TGN/OSM/GeoNames search term here..." class="input-xlarge" style="width:94%;" id="search"/>
<br/>
<button title="Search the Getty Thesaurus of Geographical Names for the name in the above input field." style="width:32%;" class="btn" onclick="tgnSearch();"><i class="icon-search"></i> TGN</button>
<button title="Search OpenStreetMap for the name in the above input field." style="width:32%;" class="btn" onclick="osmSearch();"><i class="icon-search"></i> OSM</button>
<button title="Search GeoNames for the name in the above input field." style="width:32%;" class="btn" onclick="ognSearch();"><i class="icon-search"></i> GeoNames</button>
<button id="tgnButton" title="Search the Getty Thesaurus of Geographical Names for the name in the above input field." style="width:32%;" class="btn"><i class="icon-search"></i> TGN</button>
<button id="osmButton" title="Search OpenStreetMap for the name in the above input field." style="width:32%;" class="btn"><i class="icon-search"></i> OSM</button>
<button id="geonamesButton" title="Search GeoNames for the name in the above input field." style="width:32%;" class="btn"><i class="icon-search"></i> GeoNames</button>
</div>
<div id="tgnOsmList"></div>
</div>
......@@ -196,11 +190,11 @@
<div class="span3">
<div class="primary-area main-content-wrapper">
<h3>Manage your data</h3>
<button id="newButton" class="btn btn-primary" style="width:100%;" onclick="createNew();" title="Create a new datasheet and store it to the DARIAH-DE OwnStorage.">
<button id="newButton" class="btn btn-primary" style="width:100%;" title="Create a new datasheet and store it to the DARIAH-DE OwnStorage.">
<i class="icon-plus-sign"></i> &nbsp;Create new datasheet
</button>
<p></p>
<button id="importButton" class="btn btn-primary" style="width:100%;" onclick="toggleUploadButton()" title="Create a new datasheet by importing a local CSV file.">
<button id="importButton" class="btn btn-primary" style="width:100%;" title="Create a new datasheet by importing a local CSV file.">
<i class="icon-upload"></i> &nbsp;Import local CSV or KML file</button>
<form id="uploadButton" style="display:none;">
<input id="files" class="btn btn-small" type="file" name="files[]" style="width:91%;"/>
......@@ -215,18 +209,18 @@
</div>
<p></p>
<p></p><div class="console" id="sharedStatus">&nbsp;</div>
<button id="gbShareThisDatasetButton" class="btn" style="width:100%;" onclick="shareGeobrowserDataset();" title="Wonderful! You now can share this dataset with others! It can be viewed and downloaded via the given URL from everyone (read-only). You can unshare your dataset any time you like." disabled>
<button id="gbShareThisDatasetButton" class="btn" style="width:100%;" title="Wonderful! You now can share this dataset with others! It can be viewed and downloaded via the given URL from everyone (read-only). You can unshare your dataset any time you like." disabled>
<i class="icon-globe"></i> &nbsp;Share dataset
</button>
<button id="gbUnshareThisDatasetButton" class="btn hide disabled" style="width:100%;" onclick="unshareGeobrowserDataset();" title="You can unshare this dataset again. You will then be the only one that has read and write access. You can share your dataset again any time you like!" disabled>
<button id="gbUnshareThisDatasetButton" class="btn hide disabled" style="width:100%;" title="You can unshare this dataset again. You will then be the only one that has read and write access. You can share your dataset again any time you like!" disabled>
<i class="icon-lock"></i> &nbsp;Unshare dataset
</button>
<p></p>
<button id="downloadButton" class="btn disabled" onclick="download();" title="Download your dataset as a CSV (Comma Separated Value) file." style="width:100%;" disabled>
<button id="downloadButton" class="btn disabled" title="Download your dataset as a CSV (Comma Separated Value) file." style="width:100%;" disabled>
<i class="icon-download"></i> &nbsp;Download dataset
</button>
<p></p>
<button id="deleteButton" class="btn disabled" style="width:100%;" onclick="deleteDataset();" title="Delete your dataset! You will not be able to get it back!" disabled>
<button id="deleteButton" class="btn disabled" style="width:100%;" title="Delete your dataset! You will not be able to get it back!" disabled>
<i class="icon-trash"></i> &nbsp;Delete dataset
</button>
</div>
......@@ -234,7 +228,7 @@
<div class="primary-area main-content-wrapper">
<h3>Add geocoordinates</h3>
<p>Geocoordinates for places from the <strong>Address</strong> field can be added with the Getty Thesaurus Service.</p>
<button id="geolocationCompletionButton" class="btn" style="width:100%;" onClick="startGeocoding();" title="Have a look at the places the Address fields of your dataset do match. Please choose the ones that fit for your places.">
<button id="geolocationCompletionButton" class="btn" style="width:100%;" title="Have a look at the places the Address fields of your dataset do match. Please choose the ones that fit for your places.">
<i class="icon-globe"></i>
&nbsp;Geolocation completion
</button>
......@@ -243,7 +237,7 @@
<div class="primary-area main-content-wrapper">
<h3>Open with Geo-Browser</h3>
<p>Your dataset will be validated and sent to the <strong>Geo-Browser</strong>.</p>
<button id="openWithGeoBrowserButton" class="btn" style="width:100%;" onclick="openGeoBrowser(true,true);" title="The Geo-Browser will be opened in a new window and your dataset is shown in map and table view.">
<button id="openWithGeoBrowserButton" class="btn" style="width:100%;" title="The Geo-Browser will be opened in a new window and your dataset is shown in map and table view.">
<i class="icon-globe"></i>
&nbsp;View dataset
</button>
......@@ -253,7 +247,7 @@
</div> <!-- id="content-layout" -->
<div class="row-fluid">
<div class="span12 no-margin footer">
<span>Datasheet Editor version 3.6.13-BETA &copy;2021 DARIAH-DE &nbsp; <a href="https://validator.w3.org/nu/?doc=https://geobrowser.de.dariah.eu/edit/index.html">&nbsp;</a></span>
<span>Datasheet Editor version <%= htmlWebpackPlugin.options.version %> &copy;2021 DARIAH-DE &nbsp; <a href="https://validator.w3.org/nu/?doc=https://geobrowser.de.dariah.eu/edit/index.html">&nbsp;</a></span>
<ul class="pull-right inline">
<li><a href="https://de.dariah.eu/impressum">Imprint</a></li>
<li><a href="https://de.dariah.eu/privacy-policy">Privacy Policy</a></li>
......@@ -272,7 +266,7 @@
<p>Do you really want to delete this dataset? The data can not be restored!</p>
</div>
<div class="modal-footer">
<button class="btn btn-success" data-dismiss="modal" onClick="unpublishAndDeleteDataset();">Yes</button>
<button id = "deleteUnpublishButton" class="btn btn-success" data-dismiss="modal">Yes</button>
<button class="btn btn-danger" data-dismiss="modal" aria-hidden="true">No</button>
</div>
</div>
......@@ -286,7 +280,7 @@
<p>If you do so, this dataset can be read by anyone and also be publicly viewed in the DARIAH-DE Geo-Browser. Editing and deleting will still be possible only by you. Do you really want to share this dataset? You can unshare it any time you want.</p>
</div>
<div class="modal-footer">
<button class="btn btn-success" data-dismiss="modal" onClick="publishDataset();">Yes</button>
<button id="publishConfirmButton" class="btn btn-success" data-dismiss="modal" >Yes</button>
<button class="btn btn-danger" data-dismiss="modal" aria-hidden="true">No</button>
</div>
</div>
......@@ -300,7 +294,7 @@
<p>If you do so, this dataset can only be accessed (read, edited, and deleted) by you again and can not be publicly viewed in the DARIAH-DE Geo-Browser. Do you really want to unshare this dataset? You can share it again any time you want.</p>
</div>
<div class="modal-footer">
<button class="btn btn-success" data-dismiss="modal" onClick="unpublishDataset();">Yes</button>
<button id="unpublishConfirmButton" class="btn btn-success" data-dismiss="modal">Yes</button>
<button class="btn btn-danger" data-dismiss="modal" aria-hidden="true">No</button>
</div>
</div>
......@@ -314,7 +308,7 @@
<p>You are about to create a new dataset though your current one is still on display! Do you really want to create a new one?</p>
</div>
<div class="modal-footer">
<button class="btn btn-success" data-dismiss="modal" onClick="createNewDataset();">Yes</button>
<button id="newDatasetButton" class="btn btn-success" data-dismiss="modal">Yes</button>
<button class="btn btn-danger" data-dismiss="modal" aria-hidden="true">No</button>
</div>
</div>
......@@ -328,7 +322,7 @@
<p>You are about to create a new dataset by importing data from local storage though your current one is still on display! Do you really want to create a new one?</p>
</div>
<div class="modal-footer">
<button class="btn btn-success" data-dismiss="modal" onClick="showUploadButton();">Yes</button>
<button id="confirmUploadButton" class="btn btn-success" data-dismiss="modal">Yes</button>
<button class="btn btn-danger" data-dismiss="modal" aria-hidden="true">No</button>
</div>
</div>
......@@ -338,26 +332,9 @@
Your web browser must have JavaScript enabled in order for this application to display correctly.
</div>
</noscript>
<!-- javascript
================================================== -->
<!-- placed at the end of the document so the pages load faster -->
<!-- javascript ================================================== -->
<script src="https://code.jquery.com/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/jquery-csv@1.0.21/src/jquery.csv.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/underscore@1.13.1/underscore-umd-min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/handsontable@9.0.1/dist/handsontable.full.min.js"></script>
<script src="https://res.de.dariah.eu/dhrep/js/bootstrap.js"></script>
<!-- OpenLayers -->
<script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=requestAnimationFrame,Element.prototype.classList"></script>
<script src="https://cdn.jsdelivr.net/gh/openlayers/openlayers.github.io@master/en/v6.5.0/build/ol.js"></script>
<!-- main logic and page init -->
<script src="./js/dariah.workflow.js"></script>
<!-- functions for checking dates -->
<script src="./js/dariah.workflow.datecheck.js"></script>
<!-- functions for handling tabledata -->
<script src="./js/dariah.workflow.table.js"></script>
<!-- functions for geographic checks & maps -->
<script src="./js/dariah.workflow.geo.js"></script>
<script src="https://res.de.dariah.eu/globalmenu/globalmenu.js"></script>
<script src="https://res.de.dariah.eu/dhrep/js/clipboard-2.0.0.min.js"></script>
</body>
</html>
......@@ -4,14 +4,41 @@
*
* TODO: jquery object
*/
import {storageURL, pdpURL, oldStorageURL} from "../../js/dariah.geobro.conf";
import {
bearerPrefix, logIDPrefix, csvStorageMimetype, allowedMimeTypes, defaultColumnHeaders,
setDSID, getDSID, setOwnStorageElementList,
} from "./dariah.workflow.conf";
import {checkIfDatasheetEditorFile, newAlert} from "./dariah.utils";
import {
clearStorage,
migrationIsSet, publicIsSet,
readToken,
removeMigration, removePublic,
setMigration,
setPublic,
setToken
} from "../../js/sessionStorageWrapper";
import {
setWorkingConsoleMessage,
doThingsOnIDExistingCheck,
showFirstStartWizard,
csvToReadOnlyTable,
isOldStorageID,
newSheetAlert,
setPermanentConsoleMessage,
csvToTable,
doThingsOnOldStorageID,
setSharedUnsharedStatusOnScreen
} from "./dariah.workflow";
var mustStartWith = '"Name","Address","Description","Longitude","Latitude","TimeStamp","TimeSpan:begin","TimeSpan:end","GettyID"';
/*
* Create new file, get storage file ID.
*/
function postToDariahStorage(postdata) {
export function postToDariahStorage(postdata) {
// Check for migration from old storage.
var dsid = getDSID();
if (isOldStorageID(dsid)) {
setMigration();
} else {
......@@ -35,9 +62,9 @@ function postToDariahStorage(postdata) {
success: function(data, status, xhr) {
//console.log('loc: ' + xhr.getResponseHeader('Location'));
var location = xhr.getResponseHeader('Location');
dsid = location.substring(location.lastIndexOf('/') + 1);
setDSID(location.substring(location.lastIndexOf('/') + 1));
// Reload dataset if just migrated.
var redirectURL = window.location.origin + window.location.pathname + '?id=' + dsid;
var redirectURL = window.location.origin + window.location.pathname + '?id=' + getDSID();
if (migrationIsSet()) {
document.location.href = redirectURL;
}
......@@ -50,6 +77,7 @@ function postToDariahStorage(postdata) {
newSheetAlert();
doThingsOnIDExistingCheck();
// Enable create and import buttons again.
// Enable create and import buttons again.
$('#newButton').removeClass('disabled');
$('#importButton').removeClass('disabled');
}
......@@ -59,7 +87,7 @@ function postToDariahStorage(postdata) {
var message = '<p>No new dataset could be created!</p>';
newAlert('error', title, message);
// Re-set storage ID.
dsid = "";
setDSID("")
setPermanentConsoleMessage(title);
}
});
......@@ -68,7 +96,7 @@ function postToDariahStorage(postdata) {
/**
* Load file from DARIAH-DE storage using storage ID.
*/
function loadFromDariahStorage(id) {
export function loadFromDariahStorage(id) {
// Assemble bearer token and logID.
var token = bearerPrefix + readToken();
var logID = logIDPrefix + (new Date()).getMilliseconds();
......@@ -85,7 +113,7 @@ function loadFromDariahStorage(id) {
var message = '<p>The dataset with ID <i>' + id + '</i> (mimetype ' + responseMimetype+ ') can not be loaded into the Datasheet Editor: The mimetype must be one of the following: <strong>' + allowedMimeTypes + '</strong></p>';
newAlert('error', title, message);
// Re-set storage ID.
dsid = "";
setDSID("")
doThingsOnIDExistingCheck();
showFirstStartWizard();
}
......@@ -94,7 +122,7 @@ function loadFromDariahStorage(id) {
var message = '<p>The dataset with ID <i>' + id + ' (mimetype ' + responseMimetype + ') can not be loaded into the Datasheet Editor: The first line must at least contain one of the following titles: <strong>' + defaultColumnHeaders + '</strong>.</p><p>First line seems to be instead: <strong>' + firstLineOfData + '</strong></p>';
newAlert('error', title, message);
// Re-set storage ID.
dsid = "";
setDSID("");
doThingsOnIDExistingCheck();
showFirstStartWizard();
}
......@@ -106,6 +134,7 @@ function loadFromDariahStorage(id) {
error: function(xhr, textStatus, errorThrown) {
// Have we got a token already? If not, just do authenticate first!
if (readToken() === null) {
console.error("No token! Re-authenticate...");
authenticate('id=' + id);
}
// If a token does exist and no read access is granted, just give the correct error.
......@@ -114,7 +143,7 @@ function loadFromDariahStorage(id) {
var message = '<p>The dataset with ID <i>' + id + '</i> is not existing or private.</p>';
newAlert('error', title, message);
// Re-set storage ID.