Skip to content

Commit

Permalink
add toggle for global.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
cmason3 committed Feb 3, 2025
1 parent e1e35f6 commit 6acaea3
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 6 deletions.
8 changes: 3 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
## CHANGELOG

### [25.4.0] - In Development
- Add the ability to hide the `GLOBAL.YML` pane via a toggle switch

-- Issue with deleting DataSets and Templates with the dropdown open
-- Save global visible status on saved datatemplates
### [25.4.0] - Feb 3, 2025
- Add the ability to hide the `Global.yml` pane via a toggle switch
- If you delete a DataSet or Template with the dropdown open it will now close automatically.

### [25.3.2] - Jan 28, 2025
- Allow `/` and `.` to be used in template names
Expand Down
3 changes: 3 additions & 0 deletions jinjafx_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -767,6 +767,9 @@ def authenticate_dt(rdt, r):

dt_yml += 'revision: ' + str(dt_revision) + '\n'
dt_yml += 'dataset: "' + dt['dataset'] + '"\n'

if 'show_global' in dt:
dt_yml += 'show_global: ' + dt['show_global'] + '\n'

if dt_encrypted:
dt_yml += 'encrypted: 1\n'
Expand Down
2 changes: 1 addition & 1 deletion www/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-yaml/4.1.0/js-yaml.min.js" integrity="sha512-CSBhVREyzHAjAFfBlIBakjoRUKp5h7VSweP0InR/pAJyptH7peuhCsqAI/snV+TwZmXZqoUklpXp6R6wMnYf5Q==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/dayjs/1.11.13/dayjs.min.js" integrity="sha512-FwNWaxyfy2XlEINoSnZh1JQ5TRRtGow0D6XcmAWmYCRgvqOUTnzCxPc9uF35u5ZEpirk1uhlPVA19tflhvnW1g==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/dayjs/1.11.13/plugin/relativeTime.min.js" integrity="sha512-MVzDPmm7QZ8PhEiqJXKz/zw2HJuv61waxb8XXuZMMs9b+an3LoqOqhOEt5Nq3LY1e4Ipbbd/e+AWgERdHlVgaA==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="/cc9aaa09/jinjafx_m.js"></script>
<script src="/1e6090c7/jinjafx_m.js"></script>
</head>
<body>
<div id="overlay"></div>
Expand Down
15 changes: 15 additions & 0 deletions www/jinjafx_m.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,11 @@ function getStatusText(code) {
global_visible = false;
unsplit_vars(false);
}
window.addEventListener('beforeunload', onBeforeUnload);
if (document.getElementById('get_link').value != 'false') {
document.title = 'JinjaFx [unsaved]';
}
dirty = true;
}

function split_vars() {
Expand Down Expand Up @@ -413,6 +418,7 @@ function getStatusText(code) {
fe.focus();

if (method == "delete_dataset") {
document.getElementById('datasets').classList.remove('show');
if ((window.cmData.getValue().match(/\S/) || window.cmVars.getValue().match(/\S/)) || ((Object.keys(datasets).length == 2) && window.cmgVars.getValue().match(/\S/))) {
if (confirm("Are You Sure?") === true) {
delete_dataset(current_ds);
Expand All @@ -424,13 +430,15 @@ function getStatusText(code) {
return false;
}
else if (method == "add_dataset") {
document.getElementById('datasets').classList.remove('show');
document.getElementById("ds_name").value = '';
new bootstrap.Modal(document.getElementById('dataset_input'), {
keyboard: true
}).show();
return false;
}
else if (method == "delete_template") {
document.getElementById('templates').classList.remove('show');
if (window.cmTemplate.getValue().match(/\S/)) {
if (confirm("Are You Sure?") === true) {
delete_template(current_t);
Expand All @@ -442,6 +450,7 @@ function getStatusText(code) {
return false;
}
else if (method == "add_template") {
document.getElementById('templates').classList.remove('show');
document.getElementById("t_name").value = '';
new bootstrap.Modal(document.getElementById('template_input'), {
keyboard: true
Expand Down Expand Up @@ -714,6 +723,10 @@ function getStatusText(code) {

dt.dataset = current_ds;

if (Object.keys(datasets).length > 1) {
dt.show_global = global_visible ? '1' : '0';
}

if (Object.keys(templates).length === 1) {
dt.template = e(window.cmTemplate.getValue().replace(/\t/g, " "));
}
Expand Down Expand Up @@ -945,6 +958,8 @@ function getStatusText(code) {
dt_encrypted = false;
}

global_visible = (!dt.hasOwnProperty('show_global') || dt['show_global']) ? true : false;

if (qs.hasOwnProperty('ds')) {
load_datatemplate(dt['dt'], qs, qs['ds']);
}
Expand Down

0 comments on commit 6acaea3

Please sign in to comment.