feat(ui): add archive/api data source switch
This commit is contained in:
@@ -1,12 +1,39 @@
|
||||
// LOGPile Frontend Application
|
||||
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
initSourceType();
|
||||
initUpload();
|
||||
initTabs();
|
||||
initFilters();
|
||||
loadParsersInfo();
|
||||
});
|
||||
|
||||
let sourceType = 'archive';
|
||||
|
||||
function initSourceType() {
|
||||
const sourceButtons = document.querySelectorAll('.source-switch-btn');
|
||||
sourceButtons.forEach(button => {
|
||||
button.addEventListener('click', () => {
|
||||
setSourceType(button.dataset.sourceType);
|
||||
});
|
||||
});
|
||||
|
||||
setSourceType(sourceType);
|
||||
}
|
||||
|
||||
function setSourceType(nextType) {
|
||||
sourceType = nextType === 'api' ? 'api' : 'archive';
|
||||
|
||||
document.querySelectorAll('.source-switch-btn').forEach(button => {
|
||||
button.classList.toggle('active', button.dataset.sourceType === sourceType);
|
||||
});
|
||||
|
||||
const archiveContent = document.getElementById('archive-source-content');
|
||||
const apiPlaceholder = document.getElementById('api-source-placeholder');
|
||||
archiveContent.classList.toggle('hidden', sourceType !== 'archive');
|
||||
apiPlaceholder.classList.toggle('hidden', sourceType !== 'api');
|
||||
}
|
||||
|
||||
// Load and display available parsers
|
||||
async function loadParsersInfo() {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user