Skip to content

Commit

Permalink
Merge pull request #1396 from griidc/epic/PELAGOS-5113-Add-Standardiz…
Browse files Browse the repository at this point in the history
…ed-Keywords

Epic/pelagos 5113 add standardized keywords
  • Loading branch information
mickel1138 authored Nov 14, 2023
2 parents e76fb9c + c5573c2 commit db56444
Show file tree
Hide file tree
Showing 55 changed files with 3,208 additions and 1,004 deletions.
3 changes: 3 additions & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ ANONYMOUS_FTP_USER=user
ANONYMOUS_FTP_PASS=pass
DOWNLOAD_PATH="path/to/zip"
INGEST_API_URL="https://ingest-server:port/api-name"
GCMD_VERSION="16.9"
GCMD_VERSION_YEAR="2023"
ANZSRC_VERSION="2020"

###> INDEX NAMES ###
DISCOVERY_INDEX=pelagos_instancename
Expand Down
5 changes: 5 additions & 0 deletions assets/static/css/dataset-submission.css
Original file line number Diff line number Diff line change
Expand Up @@ -158,3 +158,8 @@ table.dataTable.stripe tbody tr:hover {
#clearLargeFilePath {
margin-left: 30px;
}

.dx-list-item-content {
padding-top: 0px;
padding-bottom: 0px;
}
42 changes: 42 additions & 0 deletions assets/static/css/keyword-dataset-edit.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
html, body {
overflow: hidden;
}
.main {
height: 100%;
}
.left {
float: left;
width: 50%;
height: 100%;
overflow-y: scroll;
position: absolute;
top: 300px;
bottom: 0;
left: 0;
padding-inline: 20px;
padding-bottom: 300px;
}
.right {
float: left;
width: 50%;
height: 100%;
overflow-y: scroll;
overflow-x: hidden;
position: absolute;
top: 300px;
bottom: 0;
right: 0;
padding-inline: 20px;
padding-bottom: 300px;
}
.tab-table tr:nth-child(even) {
background-color: #FFF
}

.tab-table tr:nth-child(odd) {
background-color: #FFF
}

pre {
white-space: pre-wrap;
}
21 changes: 20 additions & 1 deletion assets/static/js/dataset-submission.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,23 @@ $(function() {
$("html").show();

$("#funderList").trigger("fundersAdded", {"disabled": defaultFunderTagBoxDisabled});
$("#keywordList").trigger("keywordsAdded", {"disabled": false});

$("#keywordList").on("change", function(event){
$('[id^="keywords_"]').remove();
var maxKeywordId = 0;
$.each(($("#keywordList").val().split(',')), function(key, value) {
if (value === "") { return; }
var newElement = document.createElement("input");
var keywordId = value;
newElement.id = `keywords_${maxKeywordId}`;
newElement.name = `keywords[${maxKeywordId}]`;
newElement.value = keywordId;
newElement.type = "hidden";
$('[id="keyword-items"]').append(newElement);
maxKeywordId++;
})
});

$("label").next("input[required],textarea[required],select[required]").prev().addClass("emRequired");
//Setup qTip
Expand Down Expand Up @@ -191,7 +208,9 @@ $(function() {
},
funderList: {
require_from_group: "This field is required. Please select a funder from the dropdown or add it under Additional Funders."
}
},
keywordListAnzsrc: "Please select at least one ANZSRC keyword.",
keywordListGcmd: "Please select at least one GCMD keyword.",
},
ignore: ".ignore,.prototype",
submitHandler: function(form) {
Expand Down
17 changes: 17 additions & 0 deletions assets/static/js/datasetReview.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,23 @@ $(document).ready(function(){
"use strict";

$("#funderList").trigger("fundersAdded", {"disabled": false});
$("#keywordList").trigger("keywordsAdded", {"disabled": false});

$("#keywordList").on("change", function(event){
$('[id^="keywords_"]').remove();
var maxKeywordId = 0;
$.each(($("#keywordList").val().split(',')), function(key, value) {
if (value === "") { return; }
var newElement = document.createElement("input");
var keywordId = value;
newElement.id = `keywords_${maxKeywordId}`;
newElement.name = `keywords[${maxKeywordId}]`;
newElement.value = keywordId;
newElement.type = "hidden";
$('[id="keyword-items"]').append(newElement);
maxKeywordId++;
})
});

$("#udiLoadReviewform").on("change keyup mouseout", function() {
var udiTextBox = $("#udiReview");
Expand Down
29 changes: 29 additions & 0 deletions assets/static/js/dif.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,23 @@ $(document).ready(function()
});

$("#funderList").trigger("fundersAdded", {"disabled": false});
$("#keywordList").trigger("keywordsAdded", {"disabled": false});

$("#keywordList").on("change", function(event){
$('[id^="keywords_"]').remove();
var maxKeywordId = 0;
$.each(($("#keywordList").val().split(',')), function(key, value) {
if (value === "") { return; }
var newElement = document.createElement("input");
var keywordId = value;
newElement.id = `keywords_${maxKeywordId}`;
newElement.name = `keywords[${maxKeywordId}]`;
newElement.value = keywordId;
newElement.type = "hidden";
$('[id="keyword-items"]').append(newElement);
maxKeywordId++;
})
});

$("#btnDS").button({
disabled : true
Expand Down Expand Up @@ -168,6 +185,9 @@ $(document).ready(function()
},
funderList: {
require_from_group: "This field is required. Please select a funder from the dropdown or add it under Additional Funders."
},
keywordList: {
required: "This field is required. Please select at least one keyword."
}
},
submitHandler: function(form) {
Expand Down Expand Up @@ -464,6 +484,7 @@ function setFormStatus()
$("#btnSubmit").prop("disabled",true);
$("#btnSave").prop("disabled",true);
$("#funderList").trigger("fundersAdded", {"disabled": true});
$("#keywordList").trigger("keywordsAdded", {"disabled": true});
if (Status == "2")
{
$("#btnReqUnlock").show();
Expand Down Expand Up @@ -802,6 +823,8 @@ function formReset(dontScrollToTop)
$("#status").val(0).change();
$("#funderTagBox").data('dxTagBox').reset();
$("#funderList").trigger("fundersAdded", {"disabled": false});
$("#keywordList").val('').trigger("change").trigger('keywordsAdded', {"disabled": false});

//formHash = $("#difForm").serialize();
formHash = undefined;
geowizard.cleanMap();
Expand Down Expand Up @@ -1082,6 +1105,7 @@ function fillForm(Form, UDI, ID)
if (json.dataset.funders != null) {
var funders = json.dataset.funders;
var addedFunders = [];
$('[id^="funders_"]').remove();
$.each(funders, function(key, value) {
var newElement = document.createElement("input");
var funderId = value.id;
Expand All @@ -1097,6 +1121,11 @@ function fillForm(Form, UDI, ID)
$("#funderList").val(addedFunders.toString()).trigger("fundersAdded", {"disabled": false});
}

if (json.keywords != null) {
var keywords = json.keywords;
$("#keywordList").val(keywords.map(keyword => keyword["id"]).toString()).trigger("change").trigger("keywordsAdded", {"disabled": false});
}

loadPOCs(json.dataset.researchGroup.id, primaryPointOfContact, secondaryPointOfContact);
$.each(json, function(name,value) {
var element = $("[name="+name+"]");
Expand Down
58 changes: 58 additions & 0 deletions assets/static/js/keyword-dataset-edit.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
$(function() {
$("#btnUpdate").on('click', function(event) {
var formData = $("form[datasetsubmission]").serialize();
var url = $("form[datasetsubmission]").attr("action")

$.ajax({
url: url,
method: "POST",
data: formData,
success: function(data, textStatus, jqXHR) {
var n = noty(
{
layout: "top",
theme: "relax",
type: "success",
text: "Your changes have been saved!",
timeout: 4000,
modal: false,
}
);
},
error: function(jqXHR, textStatus, errorThrown) {
console.log(jqXHR, textStatus, errorThrown);
var n = noty(
{
layout: "top",
theme: "relax",
type: "error",
text: textStatus,
modal: true,
}
);
},
});
});

$("#btnBack").on('click', function(event) {
location.href = `${Routing.generate('pelagos_app_ui_list_keyword_dataset')}`;
});

$("#keywordList").trigger("keywordsAdded", {"disabled": false});

$("#keywordList").on("change", function(event){
$('[id^="keywords_"]').remove();
var maxKeywordId = 0;
$.each(($("#keywordList").val().split(',')), function(key, value) {
if (value === "") { return; }
var newElement = document.createElement("input");
var keywordId = value;
newElement.id = `keywords_${maxKeywordId}`;
newElement.name = `keywords[${maxKeywordId}]`;
newElement.value = keywordId;
newElement.type = "hidden";
$('[id="keyword-items"]').append(newElement);
maxKeywordId++;
})
});
});
57 changes: 57 additions & 0 deletions assets/static/js/keyword-dataset-list.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
$(() => {
$('#gridContainer').dxDataGrid({
dataSource: `${Routing.generate('pelagos_app_api_keyword_dataset')}`,
columns: [
{
type: 'buttons',
width: 110,
buttons: [{
hint: 'Edit',
icon: 'edit',
onClick(e) {
const udi = e.row.data.udi;
e.event.preventDefault();
window.open(`${Routing.generate('pelagos_app_ui_edit_keyword_dataset')}/${udi}`);
},
}],
},
{
dataField: 'udi',
caption: 'UDI',
width: 200,
},
{
dataField: 'title',
caption: 'Title',
},
{
dataField: 'acceptedDate',
caption: 'Accepted Date',
dataType: 'date',
width: 250,
},
{
dataField: 'keywords',
caption: 'Number of Keywords',
width: 150,
filterValue: 0,
},
],
showBorders: true,
showColumnLines: true,
showRowLines: true,
rowAlternationEnabled: true,
filterPanel: {
visible: true,
},
filterRow: {
visible: true,
},
summary: {
totalItems: [{
column: 'udi',
summaryType: 'count',
}],
},
});
});
Loading

0 comments on commit db56444

Please sign in to comment.