jaime 1d06d4324b
fix: Int64 overflow in JSON encoding (#37657)
issue: ##36621

- For simple types in a struct, add "string" to the JSON tag for
automatic string conversion during JSON encoding.
- For complex types in a struct, replace "int64" with "string."

Signed-off-by: jaime <yun.zhang@zilliz.com>
2024-11-14 22:52:30 +08:00

55 lines
1.8 KiB
JavaScript

var DEBUG_MODE = false; // Set this to false to disable debug mode
var MILVUS_URI = "http://127.0.0.1:9091/api/v1"
// Function to check URL for "debug" parameter and switch debug mode
function toggleDebugMode() {
// Get the current URL's query parameters
const urlParams = new URLSearchParams(window.location.search);
// Check if "debug" parameter is present and its value
if (urlParams.has('debug')) {
if (urlParams.get('debug') === 'true') {
console.log("Debug mode is ON");
// Enable debug mode: Add any additional debug functionality here
localStorage.setItem('debug', 'true');
} else {
console.log("Debug mode is OFF");
localStorage.setItem('debug', 'false');
}
}
// Check if debug mode is enabled
DEBUG_MODE = localStorage.getItem('debug') === 'true';
}
// Call the function to check the URL and apply debug mode
toggleDebugMode();
const handleError = (error) => {
console.error('Error fetching data:', error);
// const errorMessage = encodeURIComponent(error.message || 'Unknown error');
// window.location.href = `5xx.html?error=${errorMessage}`;
};
const fetchData = (url, localData) => {
if (DEBUG_MODE) {
return new Promise((resolve) => {
resolve(JSON.parse(localData));
});
} else {
return fetch(url).then(response => {
return response.json();
})
}
};
function getQueryParams() {
const params = {};
const queryString = window.location.search.substring(1);
const queryArray = queryString.split('&');
queryArray.forEach(param => {
const [key, value] = param.split('=');
params[decodeURIComponent(key)] = decodeURIComponent(value || '');
});
return params;
}