Skip to content

Commit

Permalink
Fixed bug in TSV export function. The function relied on an object th…
Browse files Browse the repository at this point in the history
…at was not being populated correctly when loading the tree via upload or drag and drop. Fixed minor bugs: added a margin to toggle buttons to avoid visual clipping in case the container has overflow:hidden or overflow:auto; modified the message related to the absence of metadata for the metadata component.
  • Loading branch information
aldelucaizs committed Aug 28, 2024
1 parent 8bd0629 commit ff1147f
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 20 deletions.
1 change: 1 addition & 0 deletions css/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -1168,6 +1168,7 @@ button i {
width: 5.6rem;
border-radius: 1.6rem;
border: 0.1rem solid var(--secondary);
margin-left: 0.2rem; /* If the container has an overflow:auto or overflow:hidden, the border radius causes a cut */
display: inline-block;
cursor: pointer;
position: relative;
Expand Down
4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ <h4>
<div class="card-form"></div>
<div id="metadata-grid" class="ag-theme-alpine ag-theme-genpat"></div>
<div class="metadata-empty-message">
<i class="iconic iconic-warning-triangle"></i> <span data-i18n-key="no_geo_info_message"></span>
<i class="iconic iconic-warning-triangle"></i> <span data-i18n-key="no_metadata_info_message"></span>
</div>
</div>
</div>
Expand Down Expand Up @@ -302,7 +302,7 @@ <h3 class="card-title" data-i18n-key="legend">Legend</h3>
<div class="footer-info">
<div class="info">
<p><span data-i18n-key="cookies_notice">Questa applicazione non utilizza cookies.</span></p>
<p><span data-i18n-key="last_updated_on">Last updated on</span> <span class="last-update-date">2024-08-28</span></p>
<p><span data-i18n-key="last_updated_on">Last updated on</span> <span class="last-update-date">__LAST_UPDATE__</span></p>
<p class="copyright">&copy; <span class="copyright-year"></span> IZSAM 'G. Caporale'</p>
</div>
</div>
Expand Down
18 changes: 8 additions & 10 deletions js/file-handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,16 @@ gtiz_file_handler.save_options = [
label : gtiz_locales.current.export_metadata + ' (.tsv)',
icon : 'iconic-file-text',
function : () => {
let text = gtiz_file_handler.tsv_metadata ? gtiz_file_handler.tsv_metadata : undefined;
let timestamp = Date.now();
let name = "metadata" + timestamp + ".tsv";
let feedback = document.querySelector('.modal-feedback');
if (text) {
gtiz_file_handler.saveTextAsFile(text, name);
feedback.innerHTML = '';
let feedback = document.querySelector('.modal-feedback');
if (gtiz_metadata.initialized) {
let type = 'tsv';
gtiz_metadata.exportTable(type);
feedback.innerHTML = '';
feedback.classList.remove('show');
} else {
feedback.innerHTML = '<p>' + gtiz_locales.current.save_feedback_metadata + '</p>';
} else {
feedback.innerHTML = '<p>' + gtiz_locales.current.save_feedback_metadata + '</p>';
feedback.classList.add('show');
}
}
}
}, {
type : 'abutton',
Expand Down
18 changes: 10 additions & 8 deletions js/metadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,11 @@ gtiz_metadata.context_menu = [{
return 'csv';
},
function: (e) => {
gtiz_metadata.exportTable(e);
let buttuon = e.currentTarget;
let box = buttuon.parentElement;
let select = box.querySelector('select');
let type = select ? select.value : 'csv';
gtiz_metadata.exportTable(type);
}
}];

Expand Down Expand Up @@ -1252,15 +1256,13 @@ gtiz_metadata.getColorByOptions = function (filtered) {
*
* We use same function by changing separator value and file name.
*
* @param {event} e Event object
* @param {String} type `csv` || `tsv`
*/
gtiz_metadata.exportTable = function (e) {
let buttuon = e.currentTarget;
let box = buttuon.parentElement;
let select = box.querySelector('select');
let value = select ? select.value : 'csv';
let separator = value == 'csv' ? ',' : '\t';
gtiz_metadata.exportTable = function (type) {

let separator = type === 'csv' ? ',' : '\t';
let timestamp = Date.now();
let value = type === 'csv' ? 'csv' : 'tsv';
let name = "metadata" + timestamp + "." + value;
let columns = gtiz_metadata.options.columnApi.getColumns();
// we are removing first column dedicated to checkbox
Expand Down

0 comments on commit ff1147f

Please sign in to comment.