Complete ConfigurationPage porting

This commit is contained in:
PCoder 2021-07-28 12:43:08 +05:30
parent 03812ecf93
commit 837592039c
18 changed files with 1173 additions and 2 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,130 @@
/* List View - fix trash icon inside table column */
.model-list form.icon {
display: inline;
}
.model-list form.icon button {
border: none;
background: transparent;
text-decoration: none;
padding: 0;
line-height: normal;
}
.model-list a.icon:first-child {
margin-left: 10px;
}
/* List View - prevent link icons from differing from trash icon */
.model-list a.icon {
text-decoration: none;
color: inherit;
}
/* List View - fix checkbox column width */
.list-checkbox-column {
width: 14px;
}
/* List View - fix overlapping border between actions and table */
.model-list {
position: static;
margin-top: -1px;
z-index: 999;
}
/* List View Search Form - fix gap between form and table */
.actions-nav form.navbar-form {
margin: 1px 0 0 0;
}
/* List View - prevent word wrap on buttons column, to keep it on one line */
.list-buttons-column {
white-space: nowrap;
}
/* Filters */
table.filters {
border-collapse: collapse;
border-spacing: 4px;
}
/* prevents gap between table and actions while there are no filters set */
table.filters:not(:empty) {
margin: 12px 0px 20px 0px;
}
/* spacing between filter X button, operation, and value field */
/* uses tables instead of form classes for bootstrap2-3 compatibility */
table.filters tr td {
padding-right: 5px;
padding-bottom: 3px;
}
/* Filters - Select2 Boxes */
.filters .filter-op {
width: 130px;
}
.filters .filter-val {
width: 220px;
}
/* Image thumbnails */
.image-thumbnail img {
max-width: 100px;
max-height: 100px;
}
/* Forms */
/* adds spacing between navbar and edit/create form (non-modal only) */
/* required because form-horizontal removes top padding */
div.container > .admin-form {
margin-top: 35px;
}
/* Form Field Description - Appears when field has 'description' attribute */
/* Test with: form_args = {'name':{'description': 'test'}} */
/* prevents awkward gap after help-block - This is default for bootstrap2 */
.admin-form .help-block {
margin-bottom: 0px;
}
/* Modals */
/* hack to prevent cut-off left side of select2 inside of modal */
/* may be able to remove this after Bootstrap v3.3.5 */
body.modal-open {
overflow-y: scroll;
padding-right: 0 !important;
}
/* Details View - add space between navbar and results */
.fa_filter_container {
margin-top: 20px;
margin-bottom: 10px;
}
.table-responsive
{
overflow-x: auto;
}
[placeholder]{
text-overflow:ellipsis;
}
::-webkit-input-placeholder { /* Chrome/Opera/Safari */
text-overflow:ellipsis;
}
::-moz-placeholder { /* Firefox 19+ */
text-overflow:ellipsis;
}
:-ms-input-placeholder { /* IE 10+ */
text-overflow:ellipsis;
}
:-moz-placeholder { /* Firefox 18- */
text-overflow:ellipsis;
}

View File

@ -0,0 +1,18 @@
.nav li.dropdown ul.dropdown-menu li:hover ul {
display:block;
position:absolute;
left:100%;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
}
.nav li.dropdown ul.dropdown-menu ul {
display: none;
float:right;
position: relative;
top: auto;
margin-top: -30px;
}
.nav li.dropdown a.dropdown-toggle .glyphicon {
margin: 0 4px;
}

View File

@ -0,0 +1,12 @@
(function() {
window.faHelpers = {
// A simple confirm() wrapper
safeConfirm: function(msg) {
try {
return confirm(msg) ? true : false;
} catch (e) {
return false;
}
}
};
})();

2
app/static/app/admin/js/jquery.min.js vendored Normal file

File diff suppressed because one or more lines are too long

1
app/static/app/admin/js/moment.min.js vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 567 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

View File

@ -0,0 +1,474 @@
{% load static %}
<!DOCTYPE html>
<html>
<head>
<title>Configuration - GMBA Connect</title>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<link href="{% static 'app/admin/bootstrap/bootstrap3/swatch/default/bootstrap.min.css' %}?v=3.3.5" rel="stylesheet">
<link href="{% static 'app/admin/bootstrap/bootstrap3/css/bootstrap-theme.min.css' %}?v=3.3.5" rel="stylesheet">
<link href="{% static 'app/admin/css/bootstrap3/admin.css' %}?v=1.1.1" rel="stylesheet">
<link href="{% static 'app/admin/css/bootstrap3/submenu.css' %}" rel="stylesheet">
<style>
body {
padding-top: 4px;
}
</style>
</head>
<body>
<div class="container">
<nav class="navbar navbar-default" role="navigation">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#admin-navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/50b20cba056a31a89803">GMBA Connect</a>
</div>
<!-- navbar content -->
<div class="collapse navbar-collapse" id="admin-navbar-collapse">
<ul class="nav navbar-nav">
<li>
<a href="/50b20cba056a31a89803/">Home</a>
</li>
<li>
<a href="/50b20cba056a31a89803/person/">Person</a>
</li>
<li>
<a href="/50b20cba056a31a89803/resource/">Resource</a>
</li>
<li>
<a href="/50b20cba056a31a89803/range/">Range</a>
</li>
<li>
<a href="/50b20cba056a31a89803/method/">Method</a>
</li>
<li>
<a href="/50b20cba056a31a89803/scale/">Scale</a>
</li>
<li>
<a href="/50b20cba056a31a89803/taxon/">Taxon</a>
</li>
<li>
<a href="/50b20cba056a31a89803/field/">Field</a>
</li>
<li class="active">
<a href="/50b20cba056a31a89803/config/">Configuration</a>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
</ul>
</div>
</nav>
<div class="container">
<div class="row">
<div class="col-sm-10 col-sm-offset-1">
<h1>Configuration</h1>
<p class="lead">
Settings and data used in the application can be uploaded and refreshed here.
</p>
<h3>1. Obtain data exports</h3>
<p>Each of the following data exports from the GMBA Access database are needed to completely refresh the database.
Details on how to export them is <a href="#data-sources">documented below</a>. The filenames need to exactly match the ones in this list:
<ul>
<li data-file="people_details" class="datafile">
<span class="filename">
<font color="green">&#9745;</font>
<b>people_details</b>.csv
</span>
<span class="commands">
<a href="#people_details" title="Click to see information">
info
<i class="glyphicon glyphicon-info-sign"></i>
</a>
<a href="/data/people_details.csv" download title="Download">
download
<i class="glyphicon glyphicon-download"></i>
</a>
</span>
</li>
<li data-file="resources" class="datafile">
<span class="filename">
<font color="green">&#9745;</font>
<b>resources</b>.csv
</span>
<span class="commands">
<a href="#resources" title="Click to see information">
info
<i class="glyphicon glyphicon-info-sign"></i>
</a>
<a href="/data/resources.csv" download title="Download">
download
<i class="glyphicon glyphicon-download"></i>
</a>
</span>
</li>
<li data-file="ranges" class="datafile">
<span class="filename">
<font color="green">&#9745;</font>
<b>ranges</b>.csv
</span>
<span class="commands">
<a href="#ranges" title="Click to see information">
info
<i class="glyphicon glyphicon-info-sign"></i>
</a>
<a href="/data/ranges.csv" download title="Download">
download
<i class="glyphicon glyphicon-download"></i>
</a>
</span>
</li>
<li data-file="people_resources" class="datafile">
<span class="filename">
<font color="green">&#9745;</font>
<b>people_resources</b>.csv
</span>
<span class="commands">
<a href="#people_resources" title="Click to see information">
info
<i class="glyphicon glyphicon-info-sign"></i>
</a>
<a href="/data/people_resources.csv" download title="Download">
download
<i class="glyphicon glyphicon-download"></i>
</a>
</span>
</li>
<li data-file="people_ranges" class="datafile">
<span class="filename">
<font color="green">&#9745;</font>
<b>people_ranges</b>.csv
</span>
<span class="commands">
<a href="#people_ranges" title="Click to see information">
info
<i class="glyphicon glyphicon-info-sign"></i>
</a>
<a href="/data/people_ranges.csv" download title="Download">
download
<i class="glyphicon glyphicon-download"></i>
</a>
</span>
</li>
<li data-file="gmba" class="datafile">
<span class="filename">
<font color="green">&#9745;</font>
<b>gmba</b>.geojson
</span>
<span class="commands">
<a href="#gmba" title="Click to see information">
info
<i class="glyphicon glyphicon-info-sign"></i>
</a>
<a href="/geodata/gmba.geojson" download title="Download">
download
<i class="glyphicon glyphicon-download"></i>
</a>
</span>
</li>
</ul>
<div class="progress" style="width: 50%; margin: 50px;">
<div class="progress-bar progress-bar-striped active" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 0%">
<span class="progress-bar-label">Processing: 0%</span>
</div>
</div>
<h3>2. Send data to the server</h3>
<p>Use this form to select a file on your machine for uploading to the server.
Repeat the process until each source above has a green checkmark.</p>
<form method="POST" enctype="multipart/form-data" action="/upload">
<input type="file" name="datafile">
<button type="submit" class="btn btn-success">
Upload data file
<i class="glyphicon glyphicon-chevron-right"></i>
</button>
</form>
<h3>3. Refresh application data</h3>
<p>Once the files have all been uploaded (green), you can press the orange button here to
validate and refresh the information in the app. Any errors will stop the processing,
and you will see a notification at the top of the screen. This step takes a few minutes.</p>
<form action="/refresh" method="post">
<button type="submit" disabled class="btn btn-warning" id="refresh-all">
Refresh dataset
<i class="glyphicon glyphicon-chevron-right"></i>
</button>
</form>
<h3>4. Prepare the search engine</h3>
<p>The last step is to reindex the application's search engine by clicking the button below.
At this point users will see information in the search results.</p>
<form action="/reindex" method="post">
<button type="submit" class="btn btn-primary">
Reindex the search
<i class="glyphicon glyphicon-chevron-right"></i>
</button>
</form>
<hr>
<h1 id="data-sources">Data sources</h1>
<p>In this section you can find out how to obtain data for each of the resources listed above.</p>
<p>Each of the sources expected is a CSV file encoded with <b>UTF-8</b> format, except for geodata in GeoJSON format.</p>
<h4 id="people-details">people_details</h4>
<p>
The fields being updated are all part of one query on three tables: “People”, “Organisations” and “LU_Countries”. Selected fields come from the different tables and the selection of people is based on the Yes/No value “ProfileOnWeb” (lower right field in the screenshot).
</p><p>
<a href="{% static 'app/images/screenshot-access1.jpg' %}"><img src="{% static 'app/images/screenshot-access1.jpg' %}" width="25%"></a>
</p><p>
The fields: “Taxa”, “Methods” and “Geographic area of expertise” and “Scale“ concatenate information from various YesNo columns, as you see at the bottom of the screenshot for “Scale”
</p><p>
So, at this stage, producing the table with the fields listed above requires to run the query called “<b>QryPeopleExport</b>”.
</p><p>
We expect the table to have this header:
<table class="head">
<tr>
<td align="left"><b>MrMrs</b></td>
<td align="left"><b>Title</b></td>
<td align="left"><b>First name</b></td>
<td align="left"><b>Last name</b></td>
<td align="left"><b>Position</b></td>
<td align="left"><b>e-mail 1</b></td>
<td align="left"><b>URL</b></td>
<td align="left"><b>Organisation English</b></td>
<td align="left"><b>Country</b></td>
<td align="left"><b>Biography</b></td>
<td align="left"><b>Field of expertise</b></td>
<td align="left"><b>Taxa</b></td>
<td align="left"><b>Methods</b></td>
<td align="left"><b>Geographic area of expertise</b></td>
<td align="left"><b>Scale</b></td>
<td align="left"><b>ProfileOnWeb</b></td>
<td align="left"><b>ID</b></td>
</tr>
</table>
</p>
<h4 id="resources">resources</h4>
<p>This is a full export of the <b>Resources</b> table.</p>
<table class="head">
<tr>
<td align="left"><b>ID</b></td>
<td align="left"><b>Title</b></td>
<td align="left"><b>Citation</b></td>
<td align="left"><b>Type</b></td>
<td align="left"><b>Range</b></td>
<td align="left"><b>URL</b></td>
<td align="left"><b>Abstract</b></td>
<td align="left"><b>AuthorKeywords</b></td>
<td align="left"><b>Lat</b></td>
<td align="left"><b>Lon</b></td>
<td align="left"><b>Stars</b></td>
</tr>
</table>
<h4 id="ranges">ranges</h4>
<p>This is a full export of the (Mountain) <b>Ranges</b> table.</p>
<table class="head">
<tr>
<td align="left"><b>Range_ID</b></td>
<td align="left"><b>RangeName</b></td>
<td align="left"><b>RangeNameLanguage</b></td>
<td align="left"><b>MotherRange</b></td>
<td align="left"><b>Level</b></td>
<td align="left"><b>Centroid_Latitude</b></td>
<td align="left"><b>Centroid_Longitude</b></td>
<td align="left"><b>Orogeny</b></td>
<td align="left"><b>Area</b></td>
<td align="left"><b>GMBA_ID</b></td>
<td align="left"><b>Countries</b></td>
<td align="left"><b>Peak_Elevation</b></td>
<td align="left"><b>Peak_Name</b></td>
<td align="left"><b>Peak_Latitude</b></td>
<td align="left"><b>Peak_Longitude</b></td>
<td align="left"><b>Comments</b></td>
<td align="left"><b>Checked</b></td>
<td align="left"><b>Source</b></td>
<td align="left"><b>Range_AlternateID</b></td>
</tr>
</table>
<h4 id="people_resources">people_resources</h4>
<p>This is a full export of the <b>People to Resources</b> table.</p>
<table class="head">
<tr>
<td align="left"><b>ID</b></td>
<td align="left"><b>Resource</b></td>
<td align="left"><b>Person</b></td>
<td align="left"><b>Role</b></td>
</tr>
</table>
<h4 id="people_ranges">people_ranges</h4>
<p>This is a full export of the <b>People to Ranges</b> table.</p>
<table class="head">
<tr>
<td align="left"><b>ID</b></td>
<td align="left"><b>Person</b></td>
<td align="left"><b>MountainRange</b></td>
</tr>
</table>
<h4 id="gmba">gmba.geojson</h4>
<p>This file contains geodata about mountain ranges in
<a href="http://geojson.org/">GeoJSON</a> format.
The source of the data is a GIS layer maintained by GMBA with mountain polygons.
The export folder contains one small scale layer and one large scale one.
We use the small scale version, additionally simplified and compressed using
<a href="https://www.qgis.org/">QGIS</a> or <a href="https://mapshaper.org/">Mapshaper</a>.
Each polygon comes with a GMBA-ID that matches the <b>people_ranges</b> table.
</p>
<p>The data can be uploaded in the backend, but will be reset on deployments.
To ensure that it is preserved, it should also be updated in the
<a href="https://github.com/loleg/gmba-connect/blob/master/geodata/gmba.geojson">source code</a>
- <tt>geodata</tt> folder.</p>
</div>
</div>
</div>
</div>
<script src="{% static 'app/admin/js/jquery.min.js' %}?v=3.3.1" type="text/javascript"></script>
<script src="{% static 'app/admin/bootstrap/bootstrap3/js/bootstrap.min.js' %}?v=3.3.5" type="text/javascript"></script>
<script src="{% static 'app/admin/js/moment.min.js' %}?v=2.22.2" type="text/javascript"></script>
<script src="{% static 'app/admin/select2/select2.min.js' %}?v=3.5.2" type="text/javascript"></script>
<script src="{% static 'app/admin/js/helpers.js' %}?v=1.0.0" type="text/javascript"></script>
<style>
table.head { width: 100%; overflow-x: scroll; display: block; }
table.head tr td { padding: 5pt; border: 1px solid darkgrey; }
h4 { padding: 10pt; background: #ffd; }
</style>
<script>
(function($) {
$(function() {
$("#refresh-all").removeAttr('disabled');
var source = new EventSource("/progress");
source.onmessage = function(event) {
//console.log(event.data);
jd = JSON.parse(event.data);
pc = Math.min(100, Math.round(jd.p));
$('.progress-bar').css('width', pc+'%').attr('aria-valuenow', pc);
$('.progress-bar-label').text('Processing: '+pc+'%');
if (pc > 0)
$("#refresh-all").attr('disabled', 1);
else
$("#refresh-all").removeAttr('disabled');
// Status highlighting
$('.datafile').removeClass('active');
$('.datafile[data-file="'+jd.f+'"]').addClass('active');
$('.progress').css('display', (jd.f=='') ? 'none':'block');
}
$("#refresh-all").click(function(e) {
e.preventDefault(); e.stopPropagation();
$(this).attr('disabled', 1);
var frm = $(this).parent();
$.post(frm.attr('action'), frm.serialize(), function(data) {
if (data.indexOf('done:')>=0) {
a_type = 'success';
data = data.substring(data.indexOf('done:')+5);
} else if (data.indexOf('error:')>=0) {
a_type = 'danger';
data = data.substring(data.indexOf('error:')+6);
} else {
a_type = 'info';
}
$('.navbar').first().after('<div class="alert alert-' +
a_type + ' alert-dismissable">' +
'<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>' +
data +
'</div>');
});
});
}); //-
})(jQuery);
</script>
<style type="text/css">
.datafile.active { background: lightseagreen }
li.datafile { list-style:none;font-size:150% }
li.datafile:hover { background: yellow }
li.datafile .filename, li.datafile .commands { display:inline-block; width:16em }
</style>
</body>
</html>

View File

@ -0,0 +1,474 @@
{% load static %}
<!DOCTYPE html>
<html>
<head>
<title>Configuration - GMBA Connect</title>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<link href="{% static 'app/admin/bootstrap/bootstrap3/swatch/default/bootstrap.min.css' %}?v=3.3.5" rel="stylesheet">
<link href="{% static 'app/admin/bootstrap/bootstrap3/css/bootstrap-theme.min.css' %}?v=3.3.5" rel="stylesheet">
<link href="{% static 'app/admin/css/bootstrap3/admin.css' %}?v=1.1.1" rel="stylesheet">
<link href="{% static 'app/admin/css/bootstrap3/submenu.css' %}" rel="stylesheet">
<style>
body {
padding-top: 4px;
}
</style>
</head>
<body>
<div class="container">
<nav class="navbar navbar-default" role="navigation">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#admin-navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/50b20cba056a31a89803">GMBA Connect</a>
</div>
<!-- navbar content -->
<div class="collapse navbar-collapse" id="admin-navbar-collapse">
<ul class="nav navbar-nav">
<li>
<a href="/50b20cba056a31a89803/">Home</a>
</li>
<li>
<a href="/50b20cba056a31a89803/person/">Person</a>
</li>
<li>
<a href="/50b20cba056a31a89803/resource/">Resource</a>
</li>
<li>
<a href="/50b20cba056a31a89803/range/">Range</a>
</li>
<li>
<a href="/50b20cba056a31a89803/method/">Method</a>
</li>
<li>
<a href="/50b20cba056a31a89803/scale/">Scale</a>
</li>
<li>
<a href="/50b20cba056a31a89803/taxon/">Taxon</a>
</li>
<li>
<a href="/50b20cba056a31a89803/field/">Field</a>
</li>
<li class="active">
<a href="/50b20cba056a31a89803/config/">Configuration</a>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
</ul>
</div>
</nav>
<div class="container">
<div class="row">
<div class="col-sm-10 col-sm-offset-1">
<h1>Configuration</h1>
<p class="lead">
Settings and data used in the application can be uploaded and refreshed here.
</p>
<h3>1. Obtain data exports</h3>
<p>Each of the following data exports from the GMBA Access database are needed to completely refresh the database.
Details on how to export them is <a href="#data-sources">documented below</a>. The filenames need to exactly match the ones in this list:
<ul>
<li data-file="people_details" class="datafile">
<span class="filename">
<font color="green">&#9745;</font>
<b>people_details</b>.csv
</span>
<span class="commands">
<a href="#people_details" title="Click to see information">
info
<i class="glyphicon glyphicon-info-sign"></i>
</a>
<a href="/data/people_details.csv" download title="Download">
download
<i class="glyphicon glyphicon-download"></i>
</a>
</span>
</li>
<li data-file="resources" class="datafile">
<span class="filename">
<font color="green">&#9745;</font>
<b>resources</b>.csv
</span>
<span class="commands">
<a href="#resources" title="Click to see information">
info
<i class="glyphicon glyphicon-info-sign"></i>
</a>
<a href="/data/resources.csv" download title="Download">
download
<i class="glyphicon glyphicon-download"></i>
</a>
</span>
</li>
<li data-file="ranges" class="datafile">
<span class="filename">
<font color="green">&#9745;</font>
<b>ranges</b>.csv
</span>
<span class="commands">
<a href="#ranges" title="Click to see information">
info
<i class="glyphicon glyphicon-info-sign"></i>
</a>
<a href="/data/ranges.csv" download title="Download">
download
<i class="glyphicon glyphicon-download"></i>
</a>
</span>
</li>
<li data-file="people_resources" class="datafile">
<span class="filename">
<font color="green">&#9745;</font>
<b>people_resources</b>.csv
</span>
<span class="commands">
<a href="#people_resources" title="Click to see information">
info
<i class="glyphicon glyphicon-info-sign"></i>
</a>
<a href="/data/people_resources.csv" download title="Download">
download
<i class="glyphicon glyphicon-download"></i>
</a>
</span>
</li>
<li data-file="people_ranges" class="datafile">
<span class="filename">
<font color="green">&#9745;</font>
<b>people_ranges</b>.csv
</span>
<span class="commands">
<a href="#people_ranges" title="Click to see information">
info
<i class="glyphicon glyphicon-info-sign"></i>
</a>
<a href="/data/people_ranges.csv" download title="Download">
download
<i class="glyphicon glyphicon-download"></i>
</a>
</span>
</li>
<li data-file="gmba" class="datafile">
<span class="filename">
<font color="green">&#9745;</font>
<b>gmba</b>.geojson
</span>
<span class="commands">
<a href="#gmba" title="Click to see information">
info
<i class="glyphicon glyphicon-info-sign"></i>
</a>
<a href="/geodata/gmba.geojson" download title="Download">
download
<i class="glyphicon glyphicon-download"></i>
</a>
</span>
</li>
</ul>
<div class="progress" style="width: 50%; margin: 50px;">
<div class="progress-bar progress-bar-striped active" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 0%">
<span class="progress-bar-label">Processing: 0%</span>
</div>
</div>
<h3>2. Send data to the server</h3>
<p>Use this form to select a file on your machine for uploading to the server.
Repeat the process until each source above has a green checkmark.</p>
<form method="POST" enctype="multipart/form-data" action="/upload">
<input type="file" name="datafile">
<button type="submit" class="btn btn-success">
Upload data file
<i class="glyphicon glyphicon-chevron-right"></i>
</button>
</form>
<h3>3. Refresh application data</h3>
<p>Once the files have all been uploaded (green), you can press the orange button here to
validate and refresh the information in the app. Any errors will stop the processing,
and you will see a notification at the top of the screen. This step takes a few minutes.</p>
<form action="/refresh" method="post">
<button type="submit" disabled class="btn btn-warning" id="refresh-all">
Refresh dataset
<i class="glyphicon glyphicon-chevron-right"></i>
</button>
</form>
<h3>4. Prepare the search engine</h3>
<p>The last step is to reindex the application's search engine by clicking the button below.
At this point users will see information in the search results.</p>
<form action="/reindex" method="post">
<button type="submit" class="btn btn-primary">
Reindex the search
<i class="glyphicon glyphicon-chevron-right"></i>
</button>
</form>
<hr>
<h1 id="data-sources">Data sources</h1>
<p>In this section you can find out how to obtain data for each of the resources listed above.</p>
<p>Each of the sources expected is a CSV file encoded with <b>UTF-8</b> format, except for geodata in GeoJSON format.</p>
<h4 id="people-details">people_details</h4>
<p>
The fields being updated are all part of one query on three tables: “People”, “Organisations” and “LU_Countries”. Selected fields come from the different tables and the selection of people is based on the Yes/No value “ProfileOnWeb” (lower right field in the screenshot).
</p><p>
<a href="{% static 'app/images/screenshot-access1.jpg' %}"><img src="{% static 'app/images/screenshot-access1.jpg' %}" width="25%"></a>
</p><p>
The fields: “Taxa”, “Methods” and “Geographic area of expertise” and “Scale“ concatenate information from various YesNo columns, as you see at the bottom of the screenshot for “Scale”
</p><p>
So, at this stage, producing the table with the fields listed above requires to run the query called “<b>QryPeopleExport</b>”.
</p><p>
We expect the table to have this header:
<table class="head">
<tr>
<td align="left"><b>MrMrs</b></td>
<td align="left"><b>Title</b></td>
<td align="left"><b>First name</b></td>
<td align="left"><b>Last name</b></td>
<td align="left"><b>Position</b></td>
<td align="left"><b>e-mail 1</b></td>
<td align="left"><b>URL</b></td>
<td align="left"><b>Organisation English</b></td>
<td align="left"><b>Country</b></td>
<td align="left"><b>Biography</b></td>
<td align="left"><b>Field of expertise</b></td>
<td align="left"><b>Taxa</b></td>
<td align="left"><b>Methods</b></td>
<td align="left"><b>Geographic area of expertise</b></td>
<td align="left"><b>Scale</b></td>
<td align="left"><b>ProfileOnWeb</b></td>
<td align="left"><b>ID</b></td>
</tr>
</table>
</p>
<h4 id="resources">resources</h4>
<p>This is a full export of the <b>Resources</b> table.</p>
<table class="head">
<tr>
<td align="left"><b>ID</b></td>
<td align="left"><b>Title</b></td>
<td align="left"><b>Citation</b></td>
<td align="left"><b>Type</b></td>
<td align="left"><b>Range</b></td>
<td align="left"><b>URL</b></td>
<td align="left"><b>Abstract</b></td>
<td align="left"><b>AuthorKeywords</b></td>
<td align="left"><b>Lat</b></td>
<td align="left"><b>Lon</b></td>
<td align="left"><b>Stars</b></td>
</tr>
</table>
<h4 id="ranges">ranges</h4>
<p>This is a full export of the (Mountain) <b>Ranges</b> table.</p>
<table class="head">
<tr>
<td align="left"><b>Range_ID</b></td>
<td align="left"><b>RangeName</b></td>
<td align="left"><b>RangeNameLanguage</b></td>
<td align="left"><b>MotherRange</b></td>
<td align="left"><b>Level</b></td>
<td align="left"><b>Centroid_Latitude</b></td>
<td align="left"><b>Centroid_Longitude</b></td>
<td align="left"><b>Orogeny</b></td>
<td align="left"><b>Area</b></td>
<td align="left"><b>GMBA_ID</b></td>
<td align="left"><b>Countries</b></td>
<td align="left"><b>Peak_Elevation</b></td>
<td align="left"><b>Peak_Name</b></td>
<td align="left"><b>Peak_Latitude</b></td>
<td align="left"><b>Peak_Longitude</b></td>
<td align="left"><b>Comments</b></td>
<td align="left"><b>Checked</b></td>
<td align="left"><b>Source</b></td>
<td align="left"><b>Range_AlternateID</b></td>
</tr>
</table>
<h4 id="people_resources">people_resources</h4>
<p>This is a full export of the <b>People to Resources</b> table.</p>
<table class="head">
<tr>
<td align="left"><b>ID</b></td>
<td align="left"><b>Resource</b></td>
<td align="left"><b>Person</b></td>
<td align="left"><b>Role</b></td>
</tr>
</table>
<h4 id="people_ranges">people_ranges</h4>
<p>This is a full export of the <b>People to Ranges</b> table.</p>
<table class="head">
<tr>
<td align="left"><b>ID</b></td>
<td align="left"><b>Person</b></td>
<td align="left"><b>MountainRange</b></td>
</tr>
</table>
<h4 id="gmba">gmba.geojson</h4>
<p>This file contains geodata about mountain ranges in
<a href="http://geojson.org/">GeoJSON</a> format.
The source of the data is a GIS layer maintained by GMBA with mountain polygons.
The export folder contains one small scale layer and one large scale one.
We use the small scale version, additionally simplified and compressed using
<a href="https://www.qgis.org/">QGIS</a> or <a href="https://mapshaper.org/">Mapshaper</a>.
Each polygon comes with a GMBA-ID that matches the <b>people_ranges</b> table.
</p>
<p>The data can be uploaded in the backend, but will be reset on deployments.
To ensure that it is preserved, it should also be updated in the
<a href="https://github.com/loleg/gmba-connect/blob/master/geodata/gmba.geojson">source code</a>
- <tt>geodata</tt> folder.</p>
</div>
</div>
</div>
</div>
<script src="{% static 'app/admin/js/jquery.min.js' %}?v=3.3.1" type="text/javascript"></script>
<script src="{% static 'app/admin/bootstrap/bootstrap3/js/bootstrap.min.js' %}?v=3.3.5" type="text/javascript"></script>
<script src="{% static 'app/admin/js/moment.min.js' %}?v=2.22.2" type="text/javascript"></script>
<script src="{% static 'app/admin/select2/select2.min.js' %}?v=3.5.2" type="text/javascript"></script>
<script src="{% static 'app/admin/js/helpers.js' %}?v=1.0.0" type="text/javascript"></script>
<style>
table.head { width: 100%; overflow-x: scroll; display: block; }
table.head tr td { padding: 5pt; border: 1px solid darkgrey; }
h4 { padding: 10pt; background: #ffd; }
</style>
<script>
(function($) {
$(function() {
$("#refresh-all").removeAttr('disabled');
var source = new EventSource("/progress");
source.onmessage = function(event) {
//console.log(event.data);
jd = JSON.parse(event.data);
pc = Math.min(100, Math.round(jd.p));
$('.progress-bar').css('width', pc+'%').attr('aria-valuenow', pc);
$('.progress-bar-label').text('Processing: '+pc+'%');
if (pc > 0)
$("#refresh-all").attr('disabled', 1);
else
$("#refresh-all").removeAttr('disabled');
// Status highlighting
$('.datafile').removeClass('active');
$('.datafile[data-file="'+jd.f+'"]').addClass('active');
$('.progress').css('display', (jd.f=='') ? 'none':'block');
}
$("#refresh-all").click(function(e) {
e.preventDefault(); e.stopPropagation();
$(this).attr('disabled', 1);
var frm = $(this).parent();
$.post(frm.attr('action'), frm.serialize(), function(data) {
if (data.indexOf('done:')>=0) {
a_type = 'success';
data = data.substring(data.indexOf('done:')+5);
} else if (data.indexOf('error:')>=0) {
a_type = 'danger';
data = data.substring(data.indexOf('error:')+6);
} else {
a_type = 'info';
}
$('.navbar').first().after('<div class="alert alert-' +
a_type + ' alert-dismissable">' +
'<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>' +
data +
'</div>');
});
});
}); //-
})(jQuery);
</script>
<style type="text/css">
.datafile.active { background: lightseagreen }
li.datafile { list-style:none;font-size:150% }
li.datafile:hover { background: yellow }
li.datafile .filename, li.datafile .commands { display:inline-block; width:16em }
</style>
</body>
</html>

View File

@ -77,6 +77,24 @@ class ReindexPageView(TemplateView):
return HttpResponsePermanentRedirect(reverse('admin:index'))
class ConfigurationPageView(TemplateView):
template_name = "app/admin/config.html"
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
return context
def post(self, request, **kwargs):
global c_progress
c_progress = 0
global c_filename
c_filename = ""
reindex_data()
messages.add_message(request, messages.INFO, 'Search engine refresh complete')
print("Search engine reindexed")
return HttpResponsePermanentRedirect(reverse('admin:index'))
def send_from_file(request, filename):
request_for = ''
if request.path.startswith('/geodata'):

View File

@ -16,7 +16,7 @@ Including another URLconf
from django.contrib import admin
from django.urls import path
from django.views.generic import TemplateView
from app.views import HomePageView, OfflinePageView, send_from_file, DemoPageView
from app.views import HomePageView, OfflinePageView, send_from_file, DemoPageView, ConfigurationPageView
FILTER_QUERIES = [ 'country', 'range', 'field', 'taxon' ]
@ -62,7 +62,9 @@ urlpatterns = [
path('geodata/<path:path>/', send_from_file, name='send_geodata_file'),
path('data/<path:path>', send_from_file, name='send_data_file'),
path('demo/', DemoPageView.as_view(), name='demo'),
path('admin/', admin.site.urls, name='demo'),
path('admin/', admin.site.urls, name='admin'),
path('config/', ConfigurationPageView.as_view(), name='config'),
# TODO Implement the following
# path('reindex/', admin.site.urls),