argos/dmp-backend/src/main/webapp/resources/js/home.js

81 lines
1.9 KiB
JavaScript

$(document).ready(function(){
$('[data-toggle="tooltip"]').tooltip({html:true});
});
function clickedShow(dmp){
$("#jsonModal").find("div.modal-body > p").jsonViewer(dmp, {withQuotes: true, collapsed: true});
}
function clickedDelete(id){
console.log(id);
$.notify(
{
title: "<strong><b>Deleting is disabled</b></strong><br>",
message: "Deleting DMPs is currently not allowed."
},
{
type: 'danger'
}
);
}
function clickedEdit_Disabled(id){
console.log(id);
$.notify({
title: "<strong><b>Editing is disabled</b></strong><br>",
message: "Editing DMPs is currently not allowed."
});
}
function clickedEdit(dmp) {
console.log(dmp);
var titles = ["DatasetProfileRuleset", "DatasetProfileViewStyle", "DatasetProfile"];
$('#edit-dmp-modal-container').find('.modal-title').html("Edit DMP: "+dmp.id);
var form = $('#edit-dmp-form');
form.find("#dmp-id").val(dmp.id); //set the current id on the hidden form element
if((dmp.dataset != null) && (dmp.dataset.profile != null)){
form.find('#dp-definition').val(vkbeautify.xml(dmp.dataset.profile.definition));
if(dmp.dataset.profile.ruleset != 'undefined')
form.find('#dpr-definition').val(vkbeautify.xml(dmp.dataset.profile.ruleset.definition));
if(dmp.dataset.profile.viewstyle != 'undefined')
form.find('#dpv-definition').val(vkbeautify.xml(dmp.dataset.profile.viewstyle.definition));
}
//var listGroup = $(document.createElement('div'));
//listGroup.addClass("list-group");
//listGroup.append( "<a href='#' class='list-group-item list-group-item-action'>DatasetProfileRuleset</a>" );
//console.log(listGroup);
//$('#edit-dmp-modal-container').find('.modal-body').html("");
//$('#edit-dmp-modal-container').find('.modal-body').append(listGroup);
}
function loadTile(data){
if($("#tile-"+data.id).html() == ''){
$("#tile-"+data.id).jsonViewer(data, {withQuotes: true, collapsed: true});
}
}