Compare commits

...

2 Commits

Author SHA1 Message Date
6dd88bf1aa feat: add breadcrumb navigation
All checks were successful
Deploy MinIO Explorer / deploy (push) Successful in 51s
2025-09-08 22:17:08 +02:00
510959340d feat: uiux improvements. no scroll, direct link 2025-09-08 22:11:16 +02:00
2 changed files with 138 additions and 11 deletions

View File

@@ -165,9 +165,49 @@ function showLoading(show = true) {
function updateCurrentPathDisplay() { function updateCurrentPathDisplay() {
const pathDisplay = document.getElementById("current-path"); const pathDisplay = document.getElementById("current-path");
if (pathDisplay) { if (!pathDisplay) return;
pathDisplay.textContent = "/" + config.currentPath;
// Créer la structure de navigation breadcrumb
let breadcrumbHTML = '';
// Toujours commencer par la racine
if (config.currentPath) {
// Si on n'est pas à la racine, rendre "/" cliquable
breadcrumbHTML += '<a href="#" class="path-segment" data-path="">/ </a>';
} else {
// Si on est à la racine, afficher "/" sans lien
breadcrumbHTML += '/';
} }
// Si on a un chemin, découper et créer les segments
if (config.currentPath) {
const segments = config.currentPath.split('/').filter(segment => segment.length > 0);
for (let i = 0; i < segments.length; i++) {
const segment = segments[i];
const segmentPath = segments.slice(0, i + 1).join('/');
// Le dernier segment (actuel) n'est pas cliquable
if (i === segments.length - 1) {
breadcrumbHTML += segment;
} else {
// Les segments précédents sont cliquables
breadcrumbHTML += `<a href="#" class="path-segment" data-path="${segmentPath}">${segment}</a> / `;
}
}
}
pathDisplay.innerHTML = breadcrumbHTML;
// Ajouter les event listeners aux liens de navigation
const pathLinks = pathDisplay.querySelectorAll('.path-segment');
pathLinks.forEach(link => {
link.addEventListener('click', (e) => {
e.preventDefault();
const targetPath = link.getAttribute('data-path');
loadBucketContents(targetPath, true);
});
});
} }
async function loadBucketContents(path = "", pushToHistory = true) { async function loadBucketContents(path = "", pushToHistory = true) {
@@ -367,6 +407,7 @@ function displayContents(contents) {
function createParentRow(parentPath) { function createParentRow(parentPath) {
const row = document.createElement("tr"); const row = document.createElement("tr");
row.className = "clickable-row";
row.innerHTML = ` row.innerHTML = `
<td> <td>
<span class="icon-parent"></span> <span class="icon-parent"></span>
@@ -377,6 +418,15 @@ function createParentRow(parentPath) {
<td>-</td> <td>-</td>
`; `;
// Rendre toute la ligne cliquable
row.addEventListener("click", (e) => {
// Éviter le double clic si on clique sur le lien
if (e.target.tagName !== 'A') {
e.preventDefault();
loadBucketContents(parentPath, true);
}
});
const link = row.querySelector(".folder-link"); const link = row.querySelector(".folder-link");
link.addEventListener("click", (e) => { link.addEventListener("click", (e) => {
e.preventDefault(); e.preventDefault();
@@ -388,6 +438,7 @@ function createParentRow(parentPath) {
function createFolderRow(folder) { function createFolderRow(folder) {
const row = document.createElement("tr"); const row = document.createElement("tr");
row.className = "clickable-row";
row.innerHTML = ` row.innerHTML = `
<td> <td>
<span class="icon-folder"></span> <span class="icon-folder"></span>
@@ -398,6 +449,15 @@ function createFolderRow(folder) {
<td>-</td> <td>-</td>
`; `;
// Rendre toute la ligne cliquable
row.addEventListener("click", (e) => {
// Éviter le double clic si on clique sur le lien
if (e.target.tagName !== 'A') {
e.preventDefault();
loadBucketContents(folder.path, true);
}
});
const link = row.querySelector(".folder-link"); const link = row.querySelector(".folder-link");
link.addEventListener("click", (e) => { link.addEventListener("click", (e) => {
e.preventDefault(); e.preventDefault();
@@ -409,6 +469,7 @@ function createFolderRow(folder) {
function createFileRow(file) { function createFileRow(file) {
const row = document.createElement("tr"); const row = document.createElement("tr");
row.className = "clickable-row";
const fileUrl = `${config.baseUrl}/${file.fullKey}`; const fileUrl = `${config.baseUrl}/${file.fullKey}`;
row.innerHTML = ` row.innerHTML = `
@@ -420,9 +481,19 @@ function createFileRow(file) {
<td class="file-date">${formatDate(file.modified)}</td> <td class="file-date">${formatDate(file.modified)}</td>
<td> <td>
<button class="copy-btn" data-url="${fileUrl}">Copier lien</button> <button class="copy-btn" data-url="${fileUrl}">Copier lien</button>
<button class="open-btn" data-url="${fileUrl}">Ouvrir</button>
</td> </td>
`; `;
// Rendre toute la ligne cliquable
row.addEventListener("click", (e) => {
// Éviter le clic sur les boutons d'action et les liens
if (e.target.tagName !== 'BUTTON' && e.target.tagName !== 'A') {
e.preventDefault();
showPreview(fileUrl, file.name);
}
});
const fileLink = row.querySelector(".file-link"); const fileLink = row.querySelector(".file-link");
fileLink.addEventListener("click", (e) => { fileLink.addEventListener("click", (e) => {
e.preventDefault(); e.preventDefault();
@@ -430,7 +501,16 @@ function createFileRow(file) {
}); });
const copyBtn = row.querySelector(".copy-btn"); const copyBtn = row.querySelector(".copy-btn");
copyBtn.addEventListener("click", () => copyToClipboard(fileUrl)); copyBtn.addEventListener("click", (e) => {
e.stopPropagation(); // Empêcher la propagation vers le clic sur la ligne
copyToClipboard(fileUrl);
});
const openBtn = row.querySelector(".open-btn");
openBtn.addEventListener("click", (e) => {
e.stopPropagation(); // Empêcher la propagation vers le clic sur la ligne
openInNewTab(fileUrl);
});
return row; return row;
} }
@@ -480,6 +560,10 @@ async function copyToClipboard(text) {
} }
} }
function openInNewTab(fileUrl) {
window.open(fileUrl, '_blank', 'noopener,noreferrer');
}
// Variables globales pour la prévisualisation // Variables globales pour la prévisualisation
let currentPreviewFile = { let currentPreviewFile = {
url: "", url: "",

View File

@@ -34,6 +34,23 @@ h1 {
margin-bottom: 20px; margin-bottom: 20px;
} }
/* Styles pour la navigation breadcrumb dans le titre */
.path-segment {
color: #0066cc;
text-decoration: none;
font-weight: normal;
cursor: pointer;
}
.path-segment:hover {
text-decoration: underline;
color: #004499;
}
.path-segment:active {
color: #002266;
}
/* Section développement */ /* Section développement */
.dev-section { .dev-section {
background-color: #f0f0f0; background-color: #f0f0f0;
@@ -133,6 +150,15 @@ tr:hover {
background-color: #e6f3ff; background-color: #e6f3ff;
} }
/* Lignes cliquables */
.clickable-row {
cursor: pointer;
}
.clickable-row:hover {
background-color: #e6f3ff !important;
}
/* Liens et dossiers */ /* Liens et dossiers */
.folder-link { .folder-link {
color: #0066cc; color: #0066cc;
@@ -157,24 +183,41 @@ tr:hover {
font-weight: bold; font-weight: bold;
} }
/* Bouton copier lien */ /* Boutons d'actions */
.copy-btn { .copy-btn,
.open-btn {
background-color: #f0f0f0; background-color: #f0f0f0;
border: 1px solid #ccc; border: 1px solid #ccc;
padding: 2px 6px; padding: 2px 6px;
font-size: 11px; font-size: 11px;
cursor: pointer; cursor: pointer;
border-radius: 2px; border-radius: 2px;
margin-left: 2px;
} }
.copy-btn:hover { .copy-btn:hover,
.open-btn:hover {
background-color: #e0e0e0; background-color: #e0e0e0;
} }
.copy-btn:active { .copy-btn:active,
.open-btn:active {
background-color: #d0d0d0; background-color: #d0d0d0;
} }
.open-btn {
background-color: #007acc;
color: white;
}
.open-btn:hover {
background-color: #005999;
}
.open-btn:active {
background-color: #004d80;
}
/* Tailles de fichiers */ /* Tailles de fichiers */
.file-size { .file-size {
text-align: right; text-align: right;
@@ -244,8 +287,8 @@ tr:hover {
} }
#content-section { #content-section {
flex: 0 0 25%; /* Tableau prend seulement 25% de la hauteur */ flex: none; /* Tableau prend l'espace nécessaire */
overflow-y: auto; overflow-y: visible;
} }
#files-table { #files-table {
@@ -271,8 +314,8 @@ tr:hover {
} }
#content-section { #content-section {
flex: 0 0 20%; /* Encore moins d'espace pour le tableau sur mobile */ flex: none; /* Tableau prend l'espace nécessaire */
overflow-y: auto; overflow-y: visible;
} }
#files-table { #files-table {