Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cucumber/features/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ def after_scenario(context, scenario):
# Remove any temporary files
for temp_file in os.listdir('.'):
if temp_file.startswith('genericNonCustomisableName') or temp_file.startswith('temp_image_'):
os.remove(temp_file)
os.remove(temp_file)
20 changes: 10 additions & 10 deletions cucumber/features/steps/step_definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def step_use_example_file(context, filePath, fileInput):
context.file_name = filePath.split('/')[-1]
if not hasattr(context, 'files'):
context.files = {}

# Ensure the file exists before opening
try:
example_file = open(filePath, 'rb')
Expand Down Expand Up @@ -165,17 +165,17 @@ def step_pdf_contains_pages_with_random_text(context, page_count):
buffer = io.BytesIO()
c = canvas.Canvas(buffer, pagesize=letter)
width, height = letter

for _ in range(page_count):
text = ''.join(random.choices(string.ascii_letters + string.digits, k=100))
c.drawString(100, height - 100, text)
c.showPage()

c.save()

with open(context.file_name, 'wb') as f:
f.write(buffer.getvalue())

context.files[context.param_name].close()
context.files[context.param_name] = open(context.file_name, 'rb')

Expand All @@ -184,16 +184,16 @@ def step_pdf_pages_contain_text(context, text):
buffer = io.BytesIO()
c = canvas.Canvas(buffer, pagesize=letter)
width, height = letter

for _ in range(len(PdfReader(context.file_name).pages)):
c.drawString(100, height - 100, text)
c.showPage()

c.save()

with open(context.file_name, 'wb') as f:
f.write(buffer.getvalue())

context.files[context.param_name].close()
context.files[context.param_name] = open(context.file_name, 'rb')

Expand Down Expand Up @@ -354,7 +354,7 @@ def step_check_response_zip_doc_page_count(context, doc_count, pages_per_doc):
with zipfile.ZipFile(io.BytesIO(response_file.getvalue())) as zip_file:
actual_doc_count = len(zip_file.namelist())
assert actual_doc_count == doc_count, f"Expected {doc_count} documents but got {actual_doc_count} documents"

for file_name in zip_file.namelist():
with zip_file.open(file_name) as pdf_file:
reader = PdfReader(pdf_file)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,4 @@ services:
timeout: 5s
retries: 10
volumes:
- ./stirling/latest/data:/pgdata
- ./stirling/latest/data:/pgdata
7 changes: 4 additions & 3 deletions scripts/counter_translation.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,10 @@ def compare_files(
# elif "language.direction" in sort_ignore_translation[language]["missing"]:
# sort_ignore_translation[language]["missing"].remove("language.direction")

with open(default_file_path, encoding="utf-8") as default_file, open(
file_path, encoding="utf-8"
) as file:
with (
open(default_file_path, encoding="utf-8") as default_file,
open(file_path, encoding="utf-8") as file,
):
for _ in range(5):
next(default_file)
try:
Expand Down
14 changes: 7 additions & 7 deletions src/main/resources/static/js/cacheFormInputs.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
document.addEventListener("DOMContentLoaded", function() {

var cacheInputs = localStorage.getItem("cacheInputs") || "disabled";
if (cacheInputs !== "enabled") {
return; // Stop execution if caching is not enabled
}

// Function to generate a key based on the form's action attribute
function generateStorageKey(form) {
const action = form.getAttribute('action');
Expand All @@ -24,11 +24,11 @@ document.addEventListener("DOMContentLoaded", function() {
for (let i = 0; i < elements.length; i++) {
const element = elements[i];
// Skip elements without names, passwords, files, hidden fields, and submit/reset buttons
if (!element.name ||
element.type === 'password' ||
element.type === 'file' ||
//element.type === 'hidden' ||
element.type === 'submit' ||
if (!element.name ||
element.type === 'password' ||
element.type === 'file' ||
//element.type === 'hidden' ||
element.type === 'submit' ||
element.type === 'reset') {
continue;
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/static/js/csrf.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ document.addEventListener('DOMContentLoaded', function() {
// Find all forms and add CSRF token
const forms = document.querySelectorAll('form');
const csrfToken = decodeCsrfToken(getCsrfToken());

// Only proceed if we have a cookie-based token
if (csrfToken) {
forms.forEach(form => {
Expand All @@ -34,4 +34,4 @@ document.addEventListener('DOMContentLoaded', function() {
form.appendChild(csrfInput);
});
}
});
});
2 changes: 1 addition & 1 deletion src/main/resources/static/js/darkmode.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,4 @@ document.addEventListener("DOMContentLoaded", function () {
toggleDarkMode();
});
}
});
});
8 changes: 4 additions & 4 deletions src/main/resources/static/js/fetch-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ window.fetchWithCsrf = async function(url, options = {}) {
.split('; ')
.find(row => row.startsWith('XSRF-TOKEN='))
?.split('=')[1];

if (cookieValue) {
return cookieValue;
}
Expand All @@ -14,15 +14,15 @@ window.fetchWithCsrf = async function(url, options = {}) {

// Create a new options object to avoid modifying the passed object
const fetchOptions = { ...options };

// Ensure headers object exists
fetchOptions.headers = { ...options.headers };

// Add CSRF token if available
const csrfToken = getCsrfToken();
if (csrfToken) {
fetchOptions.headers['X-XSRF-TOKEN'] = csrfToken;
}

return fetch(url, fetchOptions);
}
}
10 changes: 5 additions & 5 deletions src/main/resources/static/js/game.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ function initializeGame() {
const BASE_SPAWN_INTERVAL_MS = 1250; // milliseconds before a new enemy spawns
const LEVEL_INCREASE_FACTOR_MS = 25; // milliseconds to decrease the spawn interval per level
const MAX_SPAWN_RATE_REDUCTION_MS = 800; // Max milliseconds from the base spawn interval


let keysPressed = {};
const pdfs = [];
const projectiles = [];
Expand All @@ -42,7 +42,7 @@ function initializeGame() {
let pdfSpeed = BASE_PDF_SPEED;
let gameOver = false;


function handleKeys() {
if (keysPressed["ArrowLeft"]) {
playerX -= PLAYER_MOVE_SPEED;
Expand Down Expand Up @@ -72,7 +72,7 @@ function initializeGame() {
function onKeyUp(event) {
keysPressed[event.key] = false;
}

document.removeEventListener("keydown", onKeydown);
document.removeEventListener("keyup", onKeyUp);
document.addEventListener("keydown", onKeydown);
Expand Down Expand Up @@ -243,7 +243,7 @@ function initializeGame() {

let spawnPdfTimeout;



function spawnPdfInterval() {
if (gameOver || paused) {
Expand Down
100 changes: 50 additions & 50 deletions src/main/resources/static/js/pipeline.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,30 +222,30 @@ document.getElementById('deletePipelineBtn').addEventListener('click', function(
event.preventDefault();
let pipelineName = document.getElementById('pipelineName').value;

if (confirm(deletePipelineText + pipelineName)) {
removePipelineFromUI(pipelineName);
let key = "#Pipeline-" + pipelineName;
if (localStorage.getItem(key)) {
localStorage.removeItem(key);
}
let pipelineSelect = document.getElementById("pipelineSelect");
let modal = document.getElementById('pipelineSettingsModal');
if (modal.style.display !== 'none') {
$('#pipelineSettingsModal').modal('hide');
}

if (pipelineSelect.options.length > 0) {
pipelineSelect.selectedIndex = 0;
pipelineSelect.dispatchEvent(new Event('change'));
}
if (confirm(deletePipelineText + pipelineName)) {
removePipelineFromUI(pipelineName);
let key = "#Pipeline-" + pipelineName;
if (localStorage.getItem(key)) {
localStorage.removeItem(key);
}
let pipelineSelect = document.getElementById("pipelineSelect");
let modal = document.getElementById('pipelineSettingsModal');
if (modal.style.display !== 'none') {
$('#pipelineSettingsModal').modal('hide');
}

if (pipelineSelect.options.length > 0) {
pipelineSelect.selectedIndex = 0;
pipelineSelect.dispatchEvent(new Event('change'));
}
}
});

function removePipelineFromUI(pipelineName) {
let pipelineSelect = document.getElementById("pipelineSelect");
for (let i = 0; i < pipelineSelect.options.length; i++) {
console.log(pipelineSelect.options[i])
console.log("list " + pipelineSelect.options[i].innerText + " vs " + pipelineName)
console.log(pipelineSelect.options[i])
console.log("list " + pipelineSelect.options[i].innerText + " vs " + pipelineName)
if (pipelineSelect.options[i].innerText === pipelineName) {
pipelineSelect.remove(i);
break;
Expand Down Expand Up @@ -415,17 +415,17 @@ document.getElementById("addOperationBtn").addEventListener("click", function ()
if (defaultValue === true) parameterInput.checked = true;
break;
case "array":
// If parameter.schema.format === 'binary' is to be checked, it should be checked here
parameterInput = document.createElement("textarea");
parameterInput.placeholder = 'Enter a JSON formatted array, e.g., ["item1", "item2", "item3"]';
parameterInput.className = "form-control";
break;
case "object":
parameterInput = document.createElement("textarea");
parameterInput.placeholder = 'Enter a JSON formatted object, e.g., {"key": "value"} If this is a fileInput, it is not currently supported';
parameterInput.className = "form-control";
break;
default:
// If parameter.schema.format === 'binary' is to be checked, it should be checked here
parameterInput = document.createElement("textarea");
parameterInput.placeholder = 'Enter a JSON formatted array, e.g., ["item1", "item2", "item3"]';
parameterInput.className = "form-control";
break;
case "object":
parameterInput = document.createElement("textarea");
parameterInput.placeholder = 'Enter a JSON formatted object, e.g., {"key": "value"} If this is a fileInput, it is not currently supported';
parameterInput.className = "form-control";
break;
default:
parameterInput = document.createElement("input");
parameterInput.type = "text";
parameterInput.className = "form-control";
Expand Down Expand Up @@ -482,20 +482,20 @@ document.getElementById("addOperationBtn").addEventListener("click", function ()
case "array":
case "object":
if (value === null || value === "") {
settings[parameter.name] = "";
} else {
try {
const parsedValue = JSON.parse(value);
if (Array.isArray(parsedValue)) {
settings[parameter.name] = parsedValue;
} else {
settings[parameter.name] = value;
}
} catch (e) {
settings[parameter.name] = value;
}
}
break;
settings[parameter.name] = "";
} else {
try {
const parsedValue = JSON.parse(value);
if (Array.isArray(parsedValue)) {
settings[parameter.name] = parsedValue;
} else {
settings[parameter.name] = value;
}
} catch (e) {
settings[parameter.name] = value;
}
}
break;
default:
settings[parameter.name] = value;
}
Expand Down Expand Up @@ -686,13 +686,13 @@ async function processPipelineConfig(configString) {
case "text":
case "textarea":
default:
var value = operationConfig.parameters[parameterName]
if (typeof value !== 'string') {
input.value = JSON.stringify(value) ;
} else {
input.value = value;
}
var value = operationConfig.parameters[parameterName]
if (typeof value !== 'string') {
input.value = JSON.stringify(value) ;
} else {
input.value = value;
}

}
}
});
Expand Down
1 change: 0 additions & 1 deletion src/main/resources/static/js/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,3 @@ document.getElementById("cacheInputs").addEventListener("change", function () {
cacheInputs = this.checked ? "enabled" : "disabled";
localStorage.setItem("cacheInputs", cacheInputs);
});

Loading