update 2026-11-20 19:53
This commit is contained in:
@@ -1,8 +0,0 @@
|
|||||||
# Allow access to everything
|
|
||||||
Require all granted
|
|
||||||
|
|
||||||
# Allow overrides
|
|
||||||
Options +FollowSymLinks -Indexes
|
|
||||||
|
|
||||||
# Default file
|
|
||||||
DirectoryIndex index.php
|
|
||||||
@@ -0,0 +1,667 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="fr">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>lsblk --interactive</title>
|
||||||
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||||
|
<link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;700&display=swap" rel="stylesheet">
|
||||||
|
<style>
|
||||||
|
:root{
|
||||||
|
--bg:#20212c; --panel:#282a36; --line:#44475a; --fg:#f8f8f2;
|
||||||
|
--comment:#6272a4; --cyan:#8be9fd; --green:#50fa7b; --orange:#ffb86c;
|
||||||
|
--pink:#ff79c6; --purple:#bd93f9; --red:#ff5555; --yellow:#f1fa8c;
|
||||||
|
}
|
||||||
|
*{box-sizing:border-box;}
|
||||||
|
body{margin:0;background:var(--bg);color:var(--fg);font-family:'JetBrains Mono', ui-monospace, monospace;min-height:100vh;padding:24px;}
|
||||||
|
h1{font-size:15px;font-weight:500;color:var(--comment);margin:0 0 4px 0;letter-spacing:.02em;}
|
||||||
|
.prompt{color:var(--green);}
|
||||||
|
.subtitle{color:var(--comment);font-size:12px;margin:0 0 20px 0;}
|
||||||
|
.layout{display:grid;grid-template-columns:360px 1fr;gap:20px;max-width:1280px;margin:0 auto;align-items:start;}
|
||||||
|
@media (max-width:900px){ .layout{grid-template-columns:1fr;} }
|
||||||
|
.panel{background:var(--panel);border:1px solid var(--line);border-radius:8px;padding:16px;}
|
||||||
|
.panel + .panel{margin-top:16px;}
|
||||||
|
.panel h2{font-size:11px;text-transform:uppercase;letter-spacing:.08em;color:var(--purple);margin:0 0 4px 0;}
|
||||||
|
.panel .hint{font-size:10.5px;color:var(--comment);margin:0 0 10px 0;line-height:1.4;}
|
||||||
|
label{display:block;font-size:11px;color:var(--comment);margin-bottom:4px;margin-top:10px;}
|
||||||
|
label:first-of-type{margin-top:0;}
|
||||||
|
.row2{display:grid;grid-template-columns:1fr 90px;gap:8px;}
|
||||||
|
input, select, textarea{width:100%;background:var(--bg);border:1px solid var(--line);color:var(--fg);font-family:inherit;font-size:12.5px;padding:7px 8px;border-radius:5px;}
|
||||||
|
textarea{resize:vertical;min-height:110px;font-size:11px;line-height:1.5;}
|
||||||
|
input:focus, select:focus, textarea:focus{outline:1px solid var(--purple);}
|
||||||
|
.checkline{display:flex;align-items:center;gap:6px;margin-top:10px;font-size:11.5px;color:var(--comment);}
|
||||||
|
.checkline input{width:auto;}
|
||||||
|
button{font-family:inherit;font-size:12px;font-weight:500;border:none;border-radius:5px;padding:8px 12px;cursor:pointer;margin-top:12px;width:100%;}
|
||||||
|
.btn-primary{background:var(--purple);color:#1a1b23;}
|
||||||
|
.btn-primary:hover{background:#cba7ff;}
|
||||||
|
.btn-primary:disabled{background:var(--line);color:var(--comment);cursor:not-allowed;}
|
||||||
|
.btn-ghost{background:transparent;border:1px solid var(--line);color:var(--comment);}
|
||||||
|
.btn-ghost:hover{color:var(--red);border-color:var(--red);}
|
||||||
|
.free-info{font-size:11px;color:var(--comment);margin-top:6px;}
|
||||||
|
.free-info b{color:var(--green);}
|
||||||
|
.pool-item{display:flex;align-items:center;gap:8px;padding:6px 8px;border-radius:5px;font-size:12px;}
|
||||||
|
.pool-item:hover{background:var(--bg);}
|
||||||
|
.pool-item input[type=checkbox]{width:auto;}
|
||||||
|
.pool-item .name{color:var(--cyan);min-width:80px;}
|
||||||
|
.pool-item.is-raid .name{color:var(--purple);}
|
||||||
|
.pool-item .meta{color:var(--comment);flex:1;}
|
||||||
|
.pool-empty{color:var(--comment);font-size:12px;font-style:italic;padding:6px 2px;}
|
||||||
|
.error-msg{color:var(--red);font-size:11.5px;margin-top:8px;min-height:14px;}
|
||||||
|
.term{background:var(--panel);border:1px solid var(--line);border-radius:8px;overflow:hidden;}
|
||||||
|
.term-bar{display:flex;align-items:center;gap:6px;padding:10px 14px;background:#1c1d27;border-bottom:1px solid var(--line);}
|
||||||
|
.dot{width:10px;height:10px;border-radius:50%;}
|
||||||
|
.dot.r{background:#ff5f56;} .dot.y{background:#ffbd2e;} .dot.g{background:#27c93f;}
|
||||||
|
.term-title{color:var(--comment);font-size:11.5px;margin-left:8px;}
|
||||||
|
.term-body{padding:16px 18px;overflow-x:auto;}
|
||||||
|
.headerRow{color:var(--comment);font-weight:700;font-size:12px;white-space:pre;margin-bottom:6px;}
|
||||||
|
.line{white-space:pre;font-size:12px;line-height:2;display:flex;align-items:center;}
|
||||||
|
.line .n-disk{color:var(--cyan);} .line .n-part{color:var(--fg);} .line .n-raid{color:var(--purple);font-weight:700;}
|
||||||
|
.line .mm{color:var(--comment);} .line .rm{color:var(--comment);} .line .sz{color:var(--fg);} .line .ro{color:var(--comment);}
|
||||||
|
.line .ty{color:var(--orange);}
|
||||||
|
.line .mt{color:var(--green);} .line .mt.swap{color:var(--yellow);} .line .mt.none{color:var(--comment);}
|
||||||
|
.line .delbtn{background:none;border:none;color:var(--comment);cursor:pointer;font-size:12px;padding:0 4px;margin-left:4px;}
|
||||||
|
.line .delbtn:hover{color:var(--red);}
|
||||||
|
.empty-tree{color:var(--comment);font-size:12.5px;font-style:italic;}
|
||||||
|
.legend{margin-top:16px;padding-top:12px;border-top:1px dashed var(--line);font-size:11px;color:var(--comment);}
|
||||||
|
.legend span{margin-right:14px;}
|
||||||
|
.legend .n-disk{color:var(--cyan);} .legend .n-part{color:var(--fg);} .legend .n-raid{color:var(--purple);} .legend .mt{color:var(--green);} .legend .mt.swap{color:var(--yellow);}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<h1><span class="prompt">$</span> lsblk --interactive</h1>
|
||||||
|
<p class="subtitle">simulateur : disques, partitions, RAID logiciel, import lsblk — tout vit dans l'onglet, rien n'est persistant</p>
|
||||||
|
|
||||||
|
<div class="layout">
|
||||||
|
|
||||||
|
<div class="left">
|
||||||
|
|
||||||
|
<div class="panel">
|
||||||
|
<h2>Importer depuis lsblk</h2>
|
||||||
|
<p class="hint">Colle une sortie <code>lsblk</code> réelle — disques, partitions, RAID (md) et points de montage sont reconstruits automatiquement. Le type de média (HDD/NVMe) est déduit du nom.</p>
|
||||||
|
<textarea id="importText" placeholder="tux@linux:~$ lsblk
|
||||||
|
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
|
||||||
|
sda 8:0 0 232,9G 0 disk
|
||||||
|
..."></textarea>
|
||||||
|
<button class="btn-primary" id="importBtn">Importer (remplace l'état actuel)</button>
|
||||||
|
<div class="error-msg" id="importError"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="panel">
|
||||||
|
<h2>Exporter</h2>
|
||||||
|
<p class="hint">Génère l'état actuel au format <code>lsblk</code> (copiable/collable) ou en JSON complet (fidèle à 100%, pour reprendre une session).</p>
|
||||||
|
<textarea id="exportText" readonly placeholder="clique sur Exporter pour générer le texte..."></textarea>
|
||||||
|
<button class="btn-primary" id="exportTxtBtn">Exporter en texte lsblk</button>
|
||||||
|
<div class="row2" style="margin-top:8px;">
|
||||||
|
<button class="btn-ghost" id="copyExportBtn" style="margin-top:0;">Copier</button>
|
||||||
|
<button class="btn-ghost" id="downloadTxtBtn" style="margin-top:0;">Télécharger .txt</button>
|
||||||
|
</div>
|
||||||
|
<button class="btn-ghost" id="downloadJsonBtn">Télécharger JSON complet</button>
|
||||||
|
<label for="jsonFile">Recharger un JSON exporté</label>
|
||||||
|
<input type="file" id="jsonFile" accept="application/json">
|
||||||
|
<div class="error-msg" id="exportError"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="panel">
|
||||||
|
<h2>Ajouter un disque</h2>
|
||||||
|
<div class="row2">
|
||||||
|
<div>
|
||||||
|
<label for="diskSize">Taille</label>
|
||||||
|
<input id="diskSize" type="number" min="0.01" step="0.1" value="4">
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label for="diskUnit">Unité</label>
|
||||||
|
<select id="diskUnit"><option value="T" selected>To</option><option value="G">Go</option><option value="M">Mo</option></select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="checkline"><input type="checkbox" id="diskDecimal" checked><label style="margin:0" for="diskDecimal">Taille commerciale (décimale — ex : disque acheté "4 To")</label></div>
|
||||||
|
<div class="free-info" id="diskRealSize"></div>
|
||||||
|
<label for="diskMedia">Type</label>
|
||||||
|
<select id="diskMedia">
|
||||||
|
<option value="HDD">HDD</option>
|
||||||
|
<option value="SSD">SSD</option>
|
||||||
|
<option value="NVME">NVMe</option>
|
||||||
|
<option value="USB">USB</option>
|
||||||
|
</select>
|
||||||
|
<button class="btn-primary" id="addDiskBtn">+ Ajouter (prochain : <span id="nextName">sda</span>)</button>
|
||||||
|
<div class="error-msg" id="diskError"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="panel">
|
||||||
|
<h2>Partitionner un disque</h2>
|
||||||
|
<label for="partDisk">Disque</label>
|
||||||
|
<select id="partDisk"></select>
|
||||||
|
<div class="free-info" id="partFreeInfo"></div>
|
||||||
|
<div class="row2">
|
||||||
|
<div>
|
||||||
|
<label for="partSize">Taille</label>
|
||||||
|
<input id="partSize" type="number" min="0.001" step="0.1" value="50">
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label for="partUnit">Unité</label>
|
||||||
|
<select id="partUnit"><option value="G" selected>Go</option><option value="M">Mo</option><option value="T">To</option></select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="checkline"><input type="checkbox" id="partSwap"><label style="margin:0" for="partSwap">Partition swap</label></div>
|
||||||
|
<button class="btn-primary" id="addPartBtn">Créer la partition</button>
|
||||||
|
<div class="error-msg" id="partError"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="panel">
|
||||||
|
<h2>Assembler un RAID</h2>
|
||||||
|
<div id="raidPool"></div>
|
||||||
|
<label for="raidLevel">Niveau RAID</label>
|
||||||
|
<select id="raidLevel">
|
||||||
|
<option value="0">RAID 0 (stripe)</option>
|
||||||
|
<option value="1">RAID 1 (mirror)</option>
|
||||||
|
<option value="5">RAID 5</option>
|
||||||
|
<option value="6">RAID 6</option>
|
||||||
|
<option value="10">RAID 10</option>
|
||||||
|
</select>
|
||||||
|
<button class="btn-primary" id="makeRaidBtn">Assembler la sélection en RAID</button>
|
||||||
|
<div class="error-msg" id="raidError"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="panel">
|
||||||
|
<h2>Formater / monter</h2>
|
||||||
|
<label for="fmtDevice">Périphérique</label>
|
||||||
|
<select id="fmtDevice"></select>
|
||||||
|
<label for="fmtFs">Système de fichiers</label>
|
||||||
|
<select id="fmtFs"><option>ext4</option><option>btrfs</option><option>xfs</option><option>zfs</option></select>
|
||||||
|
<label for="fmtMount">Point de montage</label>
|
||||||
|
<input id="fmtMount" type="text" placeholder="/srv">
|
||||||
|
<button class="btn-primary" id="fmtBtn">Formater et monter</button>
|
||||||
|
<div class="error-msg" id="fmtError"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button class="btn-ghost" id="resetBtn">Tout réinitialiser</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="term">
|
||||||
|
<div class="term-bar">
|
||||||
|
<div class="dot r"></div><div class="dot y"></div><div class="dot g"></div>
|
||||||
|
<div class="term-title">linux — lsblk</div>
|
||||||
|
</div>
|
||||||
|
<div class="term-body">
|
||||||
|
<div class="headerRow" id="headerRow"></div>
|
||||||
|
<div id="tree"></div>
|
||||||
|
<div class="legend">
|
||||||
|
<span class="n-disk">■</span><b>disque</b>
|
||||||
|
<span class="n-part">■</span><b>partition</b>
|
||||||
|
<span class="n-raid">■</span><b>RAID (mdX)</b>
|
||||||
|
<span class="mt">■</span><b>monté</b>
|
||||||
|
<span class="mt swap">■</span><b>swap</b>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
const state = { devices: {}, diskOrder: [] };
|
||||||
|
let diskLetterIdx = 0; // sda, sdb, ...
|
||||||
|
let nvmeIdx = 0; // nvme0n1, nvme1n1, ...
|
||||||
|
let raidCounter = 0; // md0, md1, ...
|
||||||
|
let sdMinorBase = 0; // 8:0, 8:16, ...
|
||||||
|
let nvmeMinorCounter = 0;// 259:0, 259:1, ...
|
||||||
|
|
||||||
|
function nextDiskName(media){
|
||||||
|
return media==='NVME' ? ('nvme'+nvmeIdx+'n1') : ('sd'+String.fromCharCode(97+diskLetterIdx));
|
||||||
|
}
|
||||||
|
function nextPartName(disk){
|
||||||
|
const n = disk.children.length+1;
|
||||||
|
return /^nvme/.test(disk.name) ? (disk.name+'p'+n) : (disk.name+n);
|
||||||
|
}
|
||||||
|
function toGB(value, unit){
|
||||||
|
const mult = {K:1/1024/1024, M:1/1024, G:1, T:1024}[unit];
|
||||||
|
return value*mult;
|
||||||
|
}
|
||||||
|
function toGiBFromDecimal(value, unit){
|
||||||
|
// manufacturer sizes are decimal (1 To = 1 000 000 000 000 o) — convert to real binary GiB
|
||||||
|
const bytes = value * {K:1e3, M:1e6, G:1e9, T:1e12}[unit];
|
||||||
|
return bytes / (1024**3);
|
||||||
|
}
|
||||||
|
function sizeParts(gb){
|
||||||
|
let val, unit;
|
||||||
|
if(gb>=1024){ val=gb/1024; unit='T'; }
|
||||||
|
else if(gb<1){ val=gb*1024; unit='M'; }
|
||||||
|
else { val=gb; unit='G'; }
|
||||||
|
const rounded = Math.round(val*10)/10;
|
||||||
|
const str = Number.isInteger(rounded) ? String(rounded) : rounded.toFixed(1).replace('.', ',');
|
||||||
|
return {str, unit};
|
||||||
|
}
|
||||||
|
function formatSizeIEC(gb){
|
||||||
|
// for the tool's own UI: unambiguous binary units (Kio/Mio/Gio/Tio)
|
||||||
|
const {str, unit} = sizeParts(gb);
|
||||||
|
return str+unit+'io';
|
||||||
|
}
|
||||||
|
function formatSizeLsblk(gb){
|
||||||
|
// matches real lsblk output exactly (K/M/G/T, no 'io' suffix) — used only for the lsblk-text export
|
||||||
|
const {str, unit} = sizeParts(gb);
|
||||||
|
return str+unit;
|
||||||
|
}
|
||||||
|
function parseSizeToken(tok){
|
||||||
|
const m = tok.match(/^([\d.,]+)\s*([KMGT])(?:i?o)?$/i);
|
||||||
|
if(!m) return 0;
|
||||||
|
const num = parseFloat(m[1].replace(',', '.'));
|
||||||
|
const unit = (m[2]||'G').toUpperCase();
|
||||||
|
return toGB(num, unit);
|
||||||
|
}
|
||||||
|
function minReq(level){ return {0:2,1:2,5:3,6:4,10:4}[level]; }
|
||||||
|
function computeRaidSize(level, sizes){
|
||||||
|
const n = sizes.length, min = Math.min(...sizes), sum = sizes.reduce((a,b)=>a+b,0);
|
||||||
|
if(level==0) return sum;
|
||||||
|
if(level==1) return min;
|
||||||
|
if(level==5) return min*(n-1);
|
||||||
|
if(level==6) return min*(n-2);
|
||||||
|
if(level==10) return min*(n/2);
|
||||||
|
}
|
||||||
|
|
||||||
|
function memberOfRaid(id){
|
||||||
|
for(const key in state.devices){
|
||||||
|
const d = state.devices[key];
|
||||||
|
if(d.kind==='raid' && d.members.includes(id)) return d.id;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
function freeSpace(disk){
|
||||||
|
const used = disk.children.reduce((a,cid)=>a+state.devices[cid].size,0);
|
||||||
|
return disk.size - used;
|
||||||
|
}
|
||||||
|
function availableLeaves(){
|
||||||
|
// devices usable as raid members or formattable: partitions, raids, and disks without partitions
|
||||||
|
const out = [];
|
||||||
|
state.diskOrder.forEach(did=>{
|
||||||
|
const disk = state.devices[did];
|
||||||
|
if(disk.children.length===0){ if(!memberOfRaid(did)) out.push(did); }
|
||||||
|
else disk.children.forEach(cid=>{ if(!memberOfRaid(cid)) out.push(cid); });
|
||||||
|
});
|
||||||
|
Object.values(state.devices).forEach(d=>{
|
||||||
|
if(d.kind==='raid' && !memberOfRaid(d.id)) out.push(d.id);
|
||||||
|
});
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------- CRUD ----------
|
||||||
|
function computeDiskSizeGB(){
|
||||||
|
const raw = parseFloat(document.getElementById('diskSize').value);
|
||||||
|
const unit = document.getElementById('diskUnit').value;
|
||||||
|
const decimal = document.getElementById('diskDecimal').checked;
|
||||||
|
if(!raw || raw<=0) return null;
|
||||||
|
return decimal ? toGiBFromDecimal(raw, unit) : toGB(raw, unit);
|
||||||
|
}
|
||||||
|
function updateDiskSizePreview(){
|
||||||
|
const size = computeDiskSizeGB();
|
||||||
|
document.getElementById('diskRealSize').textContent = size
|
||||||
|
? `taille réelle affichée par lsblk : ${formatSizeIEC(size)}`
|
||||||
|
: '';
|
||||||
|
}
|
||||||
|
function addDisk(){
|
||||||
|
const errEl = document.getElementById('diskError'); errEl.textContent='';
|
||||||
|
const size = computeDiskSizeGB();
|
||||||
|
if(!size){ errEl.textContent='Taille invalide.'; return; }
|
||||||
|
const media = document.getElementById('diskMedia').value;
|
||||||
|
const name = nextDiskName(media);
|
||||||
|
let majmin;
|
||||||
|
if(media==='NVME'){ majmin = '259:'+nvmeMinorCounter; nvmeMinorCounter++; nvmeIdx++; }
|
||||||
|
else { majmin = '8:'+sdMinorBase; sdMinorBase+=16; diskLetterIdx++; }
|
||||||
|
const id = 'd'+Date.now()+Math.random().toString(16).slice(2,6);
|
||||||
|
state.devices[id] = {id, kind:'disk', name, size, media, majmin, rm: media==='USB'?'1':'0', ro:'0', children:[], mount:null};
|
||||||
|
state.diskOrder.push(id);
|
||||||
|
render();
|
||||||
|
}
|
||||||
|
|
||||||
|
function addPartition(){
|
||||||
|
const errEl = document.getElementById('partError'); errEl.textContent='';
|
||||||
|
const diskId = document.getElementById('partDisk').value;
|
||||||
|
if(!diskId){ errEl.textContent='Aucun disque disponible.'; return; }
|
||||||
|
const disk = state.devices[diskId];
|
||||||
|
const size = toGB(parseFloat(document.getElementById('partSize').value), document.getElementById('partUnit').value);
|
||||||
|
if(!size || size<=0){ errEl.textContent='Taille invalide.'; return; }
|
||||||
|
if(size > freeSpace(disk)+1e-9){ errEl.textContent=`Espace insuffisant (libre : ${formatSizeIEC(freeSpace(disk))}).`; return; }
|
||||||
|
const swap = document.getElementById('partSwap').checked;
|
||||||
|
const name = nextPartName(disk);
|
||||||
|
let majmin;
|
||||||
|
if(/^nvme/.test(disk.name)){ majmin = '259:'+nvmeMinorCounter; nvmeMinorCounter++; }
|
||||||
|
else { const base = parseInt(disk.majmin.split(':')[1],10); majmin = '8:'+(base+disk.children.length+1); }
|
||||||
|
const id = 'p'+Date.now()+Math.random().toString(16).slice(2,6);
|
||||||
|
state.devices[id] = {id, kind:'part', name, size, parentDisk:diskId, majmin, rm:'0', ro:'0', swap, mount:null};
|
||||||
|
disk.children.push(id);
|
||||||
|
render();
|
||||||
|
}
|
||||||
|
|
||||||
|
function makeRaid(){
|
||||||
|
const errEl = document.getElementById('raidError'); errEl.textContent='';
|
||||||
|
const level = parseInt(document.getElementById('raidLevel').value,10);
|
||||||
|
const checked = Array.from(document.querySelectorAll('.raid-check:checked')).map(c=>c.dataset.id);
|
||||||
|
const need = minReq(level);
|
||||||
|
if(checked.length < need){ errEl.textContent = `RAID ${level} nécessite au moins ${need} membres (${checked.length} sélectionné(s)).`; return; }
|
||||||
|
if(level===10 && checked.length%2!==0){ errEl.textContent='RAID 10 nécessite un nombre pair de membres.'; return; }
|
||||||
|
if(checked.some(id=>state.devices[id].mount || state.devices[id].swap)){ errEl.textContent='Un périphérique monté ou swap ne peut pas rejoindre un RAID.'; return; }
|
||||||
|
const sizes = checked.map(id=>state.devices[id].size);
|
||||||
|
const size = computeRaidSize(level, sizes);
|
||||||
|
const name = 'md'+raidCounter;
|
||||||
|
const majmin = '9:'+raidCounter;
|
||||||
|
raidCounter++;
|
||||||
|
const id = 'r'+Date.now()+Math.random().toString(16).slice(2,6);
|
||||||
|
state.devices[id] = {id, kind:'raid', name, level, majmin, rm:'0', ro:'0', members:checked, size, mount:null};
|
||||||
|
render();
|
||||||
|
}
|
||||||
|
|
||||||
|
function formatDevice(){
|
||||||
|
const errEl = document.getElementById('fmtError'); errEl.textContent='';
|
||||||
|
const id = document.getElementById('fmtDevice').value;
|
||||||
|
const fstype = document.getElementById('fmtFs').value;
|
||||||
|
const mountpoint = document.getElementById('fmtMount').value.trim();
|
||||||
|
if(!id){ errEl.textContent='Sélectionne un périphérique.'; return; }
|
||||||
|
if(!mountpoint.startsWith('/')){ errEl.textContent='Le point de montage doit commencer par /.'; return; }
|
||||||
|
state.devices[id].mount = {fstype, mountpoint};
|
||||||
|
document.getElementById('fmtMount').value='';
|
||||||
|
render();
|
||||||
|
}
|
||||||
|
|
||||||
|
function deleteDeviceCascade(id){
|
||||||
|
const d = state.devices[id];
|
||||||
|
if(!d) return;
|
||||||
|
if(!confirm(`Supprimer ${d.name} ${d.kind==='disk' && d.children.length? '(et ses partitions/RAID dépendants)':''} ?`)) return;
|
||||||
|
cascadeRemove(id);
|
||||||
|
render();
|
||||||
|
}
|
||||||
|
function cascadeRemove(id){
|
||||||
|
const d = state.devices[id];
|
||||||
|
if(!d) return;
|
||||||
|
const rid = memberOfRaid(id);
|
||||||
|
if(rid) cascadeRemove(rid); // remove any raid this device feeds first
|
||||||
|
if(d.kind==='disk'){
|
||||||
|
d.children.slice().forEach(cid=>cascadeRemove(cid));
|
||||||
|
state.diskOrder = state.diskOrder.filter(x=>x!==id);
|
||||||
|
}
|
||||||
|
if(d.kind==='part' && d.parentDisk && state.devices[d.parentDisk]){
|
||||||
|
const parent = state.devices[d.parentDisk];
|
||||||
|
parent.children = parent.children.filter(x=>x!==id);
|
||||||
|
}
|
||||||
|
delete state.devices[id];
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------- Import ----------
|
||||||
|
function parseLsblkText(text){
|
||||||
|
const rawLines = text.split('\n').map(l=>l.replace(/\r$/,'')).filter(l=>l.trim().length>0);
|
||||||
|
let headerIdx = rawLines.findIndex(l=>/NAME/.test(l) && /SIZE/.test(l) && /TYPE/.test(l));
|
||||||
|
const dataLines = headerIdx>=0 ? rawLines.slice(headerIdx+1) : rawLines.filter(l=>!/\$\s*lsblk\b/i.test(l));
|
||||||
|
|
||||||
|
const devices = {}, order = [], nameRegistry = {}, stack = [];
|
||||||
|
dataLines.forEach(line=>{
|
||||||
|
const m = line.match(/^([\s│├└─]*)(\S+)\s+(\S+)\s+(\S+)\s+([\d.,]+[KMGTkmgt]?)\s+(\S+)\s+(\S+)\s*(.*)$/);
|
||||||
|
if(!m) return;
|
||||||
|
const [, prefix, name, majmin, rm, sizeTok, ro, type, mountRest] = m;
|
||||||
|
const depth = Math.round(prefix.length/2);
|
||||||
|
const sizeGB = parseSizeToken(sizeTok);
|
||||||
|
const mountText = (mountRest||'').trim();
|
||||||
|
let mount=null, swap=false;
|
||||||
|
if(mountText==='[SWAP]') swap=true; else if(mountText) mount={fstype:'?', mountpoint:mountText};
|
||||||
|
|
||||||
|
let kind, level=null;
|
||||||
|
if(type==='disk') kind='disk';
|
||||||
|
else if(type==='part') kind='part';
|
||||||
|
else { kind='raid'; const lm=type.match(/raid(\d+)/i); level = lm?Number(lm[1]):0; }
|
||||||
|
|
||||||
|
let id;
|
||||||
|
if(nameRegistry[name]){
|
||||||
|
id = nameRegistry[name];
|
||||||
|
if(mount) devices[id].mount = mount;
|
||||||
|
if(swap) devices[id].swap = true;
|
||||||
|
} else {
|
||||||
|
id = 'imp'+Math.random().toString(16).slice(2,8)+'_'+name;
|
||||||
|
nameRegistry[name]=id;
|
||||||
|
const base = {id, name, majmin, rm, ro, size:sizeGB, mount, swap: swap||false};
|
||||||
|
if(kind==='disk'){ base.kind='disk'; base.media=/^nvme/i.test(name)?'NVME':'HDD'; base.children=[]; devices[id]=base; order.push(id); }
|
||||||
|
else if(kind==='part'){ base.kind='part'; base.parentDisk=null; devices[id]=base; }
|
||||||
|
else { base.kind='raid'; base.level=level; base.members=[]; devices[id]=base; }
|
||||||
|
}
|
||||||
|
if(depth>0){
|
||||||
|
const parentId = stack[depth-1];
|
||||||
|
if(parentId && devices[parentId]){
|
||||||
|
const parent = devices[parentId], cur = devices[id];
|
||||||
|
if(parent.kind==='disk' && cur.kind==='part'){
|
||||||
|
if(!parent.children.includes(id)){ parent.children.push(id); cur.parentDisk=parentId; }
|
||||||
|
} else if(cur.kind==='raid' && !cur.members.includes(parentId)){
|
||||||
|
cur.members.push(parentId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stack[depth]=id; stack.length=depth+1;
|
||||||
|
});
|
||||||
|
return {devices, order};
|
||||||
|
}
|
||||||
|
|
||||||
|
function recalcCounters(){
|
||||||
|
diskLetterIdx=0; nvmeIdx=0; raidCounter=0; sdMinorBase=0; nvmeMinorCounter=0;
|
||||||
|
Object.values(state.devices).forEach(d=>{
|
||||||
|
if(d.kind==='disk'){
|
||||||
|
const sdm = d.name.match(/^sd([a-z])$/);
|
||||||
|
if(sdm) diskLetterIdx = Math.max(diskLetterIdx, sdm[1].charCodeAt(0)-97+1);
|
||||||
|
const nvm = d.name.match(/^nvme(\d+)n1$/);
|
||||||
|
if(nvm) nvmeIdx = Math.max(nvmeIdx, Number(nvm[1])+1);
|
||||||
|
const minor = parseInt((d.majmin||'0:0').split(':')[1]||0,10);
|
||||||
|
if(d.majmin && d.majmin.startsWith('8:')) sdMinorBase = Math.max(sdMinorBase, minor+16);
|
||||||
|
if(d.majmin && d.majmin.startsWith('259:')) nvmeMinorCounter = Math.max(nvmeMinorCounter, minor+1);
|
||||||
|
}
|
||||||
|
if(d.kind==='part' && d.majmin && d.majmin.startsWith('259:')){
|
||||||
|
const minor = parseInt(d.majmin.split(':')[1]||0,10);
|
||||||
|
nvmeMinorCounter = Math.max(nvmeMinorCounter, minor+1);
|
||||||
|
}
|
||||||
|
if(d.kind==='raid'){
|
||||||
|
const rm = d.name.match(/^md(\d+)$/);
|
||||||
|
if(rm) raidCounter = Math.max(raidCounter, Number(rm[1])+1);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function importLsblk(){
|
||||||
|
const errEl = document.getElementById('importError'); errEl.textContent='';
|
||||||
|
const text = document.getElementById('importText').value;
|
||||||
|
if(!text.trim()){ errEl.textContent="Colle une sortie lsblk d'abord."; return; }
|
||||||
|
const parsed = parseLsblkText(text);
|
||||||
|
if(Object.keys(parsed.devices).length===0){ errEl.textContent='Impossible de parser cette sortie.'; return; }
|
||||||
|
if(!confirm('Importer va remplacer la configuration actuelle. Continuer ?')) return;
|
||||||
|
state.devices = parsed.devices;
|
||||||
|
state.diskOrder = parsed.order;
|
||||||
|
recalcCounters();
|
||||||
|
render();
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------- Export ----------
|
||||||
|
function buildLsblkText(){
|
||||||
|
const lines = [];
|
||||||
|
state.diskOrder.forEach(id=>collect(id, '', true, true, lines));
|
||||||
|
if(lines.length===0) return '';
|
||||||
|
const nameW = Math.max(...lines.map(l=>l.display.length)) + 2;
|
||||||
|
const header = 'NAME'.padEnd(nameW)+'MAJ:MIN'.padEnd(8)+'RM'.padEnd(4)+'SIZE'.padEnd(7)+'RO'.padEnd(3)+'TYPE'.padEnd(6)+'MOUNTPOINTS';
|
||||||
|
const rows = lines.map(l=>{
|
||||||
|
const mountText = l.swap ? '[SWAP]' : (l.mount ? l.mount.mountpoint : '');
|
||||||
|
const sizeStr = formatSizeLsblk(l.sizeRaw);
|
||||||
|
return l.display.padEnd(nameW)+l.majmin.padEnd(8)+l.rm.padEnd(4)+sizeStr.padEnd(7)+l.ro.padEnd(3)+l.type.padEnd(6)+mountText;
|
||||||
|
});
|
||||||
|
return 'tux@linux:~$ lsblk\n'+header+'\n'+rows.join('\n');
|
||||||
|
}
|
||||||
|
|
||||||
|
function downloadBlob(filename, content, mime){
|
||||||
|
const blob = new Blob([content], {type: mime});
|
||||||
|
const url = URL.createObjectURL(blob);
|
||||||
|
const a = document.createElement('a');
|
||||||
|
a.href = url; a.download = filename;
|
||||||
|
document.body.appendChild(a); a.click(); document.body.removeChild(a);
|
||||||
|
URL.revokeObjectURL(url);
|
||||||
|
}
|
||||||
|
|
||||||
|
function exportLsblkText(){
|
||||||
|
const errEl = document.getElementById('exportError'); errEl.textContent='';
|
||||||
|
const text = buildLsblkText();
|
||||||
|
if(!text){ errEl.textContent='Rien à exporter — ajoute au moins un disque.'; return; }
|
||||||
|
document.getElementById('exportText').value = text;
|
||||||
|
}
|
||||||
|
|
||||||
|
function copyExportText(){
|
||||||
|
const ta = document.getElementById('exportText');
|
||||||
|
const errEl = document.getElementById('exportError'); errEl.textContent='';
|
||||||
|
if(!ta.value.trim()){ errEl.textContent="Rien à copier — clique d'abord sur Exporter."; return; }
|
||||||
|
navigator.clipboard.writeText(ta.value).catch(()=>{ ta.select(); document.execCommand('copy'); });
|
||||||
|
}
|
||||||
|
|
||||||
|
function downloadTxt(){
|
||||||
|
const ta = document.getElementById('exportText');
|
||||||
|
const errEl = document.getElementById('exportError'); errEl.textContent='';
|
||||||
|
const text = ta.value.trim() ? ta.value : buildLsblkText();
|
||||||
|
if(!text){ errEl.textContent='Rien à exporter — ajoute au moins un disque.'; return; }
|
||||||
|
ta.value = text;
|
||||||
|
downloadBlob('lsblk-linux.txt', text, 'text/plain');
|
||||||
|
}
|
||||||
|
|
||||||
|
function downloadJson(){
|
||||||
|
const errEl = document.getElementById('exportError'); errEl.textContent='';
|
||||||
|
if(state.diskOrder.length===0){ errEl.textContent='Rien à exporter — ajoute au moins un disque.'; return; }
|
||||||
|
const payload = {
|
||||||
|
devices: state.devices,
|
||||||
|
diskOrder: state.diskOrder,
|
||||||
|
counters: {diskLetterIdx, nvmeIdx, raidCounter, sdMinorBase, nvmeMinorCounter}
|
||||||
|
};
|
||||||
|
downloadBlob('lsblk-linux.json', JSON.stringify(payload, null, 2), 'application/json');
|
||||||
|
}
|
||||||
|
|
||||||
|
function loadJsonFile(evt){
|
||||||
|
const errEl = document.getElementById('exportError'); errEl.textContent='';
|
||||||
|
const file = evt.target.files[0];
|
||||||
|
if(!file) return;
|
||||||
|
const reader = new FileReader();
|
||||||
|
reader.onload = () => {
|
||||||
|
try{
|
||||||
|
const payload = JSON.parse(reader.result);
|
||||||
|
if(!payload.devices || !payload.diskOrder) throw new Error('format invalide');
|
||||||
|
if(!confirm('Charger ce JSON va remplacer la configuration actuelle. Continuer ?')) { evt.target.value=''; return; }
|
||||||
|
state.devices = payload.devices;
|
||||||
|
state.diskOrder = payload.diskOrder;
|
||||||
|
if(payload.counters){
|
||||||
|
diskLetterIdx = payload.counters.diskLetterIdx||0;
|
||||||
|
nvmeIdx = payload.counters.nvmeIdx||0;
|
||||||
|
raidCounter = payload.counters.raidCounter||0;
|
||||||
|
sdMinorBase = payload.counters.sdMinorBase||0;
|
||||||
|
nvmeMinorCounter = payload.counters.nvmeMinorCounter||0;
|
||||||
|
} else recalcCounters();
|
||||||
|
render();
|
||||||
|
} catch(e){
|
||||||
|
errEl.textContent='JSON invalide ou corrompu.';
|
||||||
|
}
|
||||||
|
evt.target.value='';
|
||||||
|
};
|
||||||
|
reader.readAsText(file);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------- Render ----------
|
||||||
|
function collect(id, prefix, isLast, isRoot, out){
|
||||||
|
const d = state.devices[id];
|
||||||
|
if(!d) return;
|
||||||
|
const dispPrefix = isRoot ? '' : prefix + (isLast ? '└─' : '├─');
|
||||||
|
const typeLabel = d.kind==='disk' ? 'disk' : d.kind==='part' ? 'part' : ('raid'+d.level);
|
||||||
|
out.push({id:d.id, display:dispPrefix+d.name, majmin:d.majmin, rm:d.rm, sizeRaw:d.size, ro:d.ro, type:typeLabel, mount:d.mount, swap:d.swap, kind:d.kind});
|
||||||
|
const childPrefix = isRoot ? '' : prefix + (isLast ? ' ' : '│ ');
|
||||||
|
if(d.kind==='disk' && d.children.length>0){
|
||||||
|
d.children.forEach((cid,i)=>collect(cid, childPrefix, i===d.children.length-1, false, out));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const rid = memberOfRaid(id);
|
||||||
|
if(rid) collect(rid, childPrefix, true, false, out);
|
||||||
|
}
|
||||||
|
|
||||||
|
function render(){
|
||||||
|
// --- partition disk select ---
|
||||||
|
const partSel = document.getElementById('partDisk');
|
||||||
|
const disksWithSpace = state.diskOrder.filter(id=>freeSpace(state.devices[id])>0.001);
|
||||||
|
partSel.innerHTML = disksWithSpace.length
|
||||||
|
? disksWithSpace.map(id=>`<option value="${id}">${state.devices[id].name} (libre : ${formatSizeIEC(freeSpace(state.devices[id]))})</option>`).join('')
|
||||||
|
: '<option value="">— aucun disque avec espace libre —</option>';
|
||||||
|
const selectedDisk = state.devices[partSel.value];
|
||||||
|
document.getElementById('partFreeInfo').textContent = (disksWithSpace.length && selectedDisk)
|
||||||
|
? `espace libre sur ${selectedDisk.name} : ${formatSizeIEC(freeSpace(selectedDisk))}`
|
||||||
|
: '';
|
||||||
|
|
||||||
|
// --- raid pool ---
|
||||||
|
const raidPool = document.getElementById('raidPool');
|
||||||
|
const leaves = availableLeaves().filter(id=>{ const d=state.devices[id]; return !d.mount && !d.swap; });
|
||||||
|
raidPool.innerHTML = leaves.length
|
||||||
|
? leaves.map(id=>{
|
||||||
|
const d = state.devices[id];
|
||||||
|
const typeLabel = d.kind==='disk'?'disk':d.kind==='part'?'part':('raid'+d.level);
|
||||||
|
return `<div class="pool-item ${d.kind==='raid'?'is-raid':''}">
|
||||||
|
<input type="checkbox" class="raid-check" data-id="${id}">
|
||||||
|
<span class="name">${d.name}</span>
|
||||||
|
<span class="meta">${formatSizeIEC(d.size)} · ${typeLabel}</span>
|
||||||
|
</div>`;
|
||||||
|
}).join('')
|
||||||
|
: '<div class="pool-empty">aucun périphérique disponible pour un RAID</div>';
|
||||||
|
|
||||||
|
// --- format dropdown ---
|
||||||
|
const fmtSel = document.getElementById('fmtDevice');
|
||||||
|
const formattable = availableLeaves().filter(id=>{ const d=state.devices[id]; return !d.mount && !d.swap; });
|
||||||
|
fmtSel.innerHTML = formattable.length
|
||||||
|
? formattable.map(id=>`<option value="${id}">${state.devices[id].name}</option>`).join('')
|
||||||
|
: '<option value="">— aucun périphérique disponible —</option>';
|
||||||
|
|
||||||
|
// --- tree ---
|
||||||
|
const treeEl = document.getElementById('tree');
|
||||||
|
const header = document.getElementById('headerRow');
|
||||||
|
const lines = [];
|
||||||
|
state.diskOrder.forEach(id=>collect(id, '', true, true, lines));
|
||||||
|
|
||||||
|
if(lines.length===0){
|
||||||
|
header.textContent='';
|
||||||
|
treeEl.innerHTML = '<div class="empty-tree">rien à afficher — ajoute un disque ou importe une sortie lsblk</div>';
|
||||||
|
} else {
|
||||||
|
const nameW = Math.max(...lines.map(l=>l.display.length)) + 3;
|
||||||
|
header.textContent = 'NAME'.padEnd(nameW)+'MAJ:MIN'.padEnd(9)+'RM'.padEnd(4)+'SIZE'.padEnd(10)+'RO'.padEnd(4)+'TYPE'.padEnd(8)+'MOUNTPOINTS';
|
||||||
|
treeEl.innerHTML = lines.map(l=>{
|
||||||
|
const nameCls = l.kind==='raid' ? 'n-raid' : l.kind==='part' ? 'n-part' : 'n-disk';
|
||||||
|
let mountText='-', mountCls='mt none';
|
||||||
|
if(l.swap){ mountText='[SWAP]'; mountCls='mt swap'; }
|
||||||
|
else if(l.mount){ mountText=l.mount.mountpoint; mountCls='mt'; }
|
||||||
|
return `<div class="line">`+
|
||||||
|
`<span class="${nameCls}">${l.display.padEnd(nameW)}</span>`+
|
||||||
|
`<span class="mm">${l.majmin.padEnd(9)}</span>`+
|
||||||
|
`<span class="rm">${l.rm.padEnd(4)}</span>`+
|
||||||
|
`<span class="sz">${formatSizeIEC(l.sizeRaw).padEnd(10)}</span>`+
|
||||||
|
`<span class="ro">${l.ro.padEnd(4)}</span>`+
|
||||||
|
`<span class="ty">${l.type.padEnd(8)}</span>`+
|
||||||
|
`<span class="${mountCls}">${mountText}</span>`+
|
||||||
|
`<button class="delbtn" onclick="deleteDeviceCascade('${l.id}')" title="supprimer">✕</button>`+
|
||||||
|
`</div>`;
|
||||||
|
}).join('');
|
||||||
|
}
|
||||||
|
|
||||||
|
document.getElementById('nextName').textContent = nextDiskName(document.getElementById('diskMedia').value);
|
||||||
|
}
|
||||||
|
|
||||||
|
document.getElementById('addDiskBtn').addEventListener('click', addDisk);
|
||||||
|
document.getElementById('diskMedia').addEventListener('change', ()=>{ document.getElementById('nextName').textContent = nextDiskName(document.getElementById('diskMedia').value); });
|
||||||
|
document.getElementById('diskSize').addEventListener('input', updateDiskSizePreview);
|
||||||
|
document.getElementById('diskUnit').addEventListener('change', updateDiskSizePreview);
|
||||||
|
document.getElementById('diskDecimal').addEventListener('change', updateDiskSizePreview);
|
||||||
|
document.getElementById('addPartBtn').addEventListener('click', addPartition);
|
||||||
|
document.getElementById('partDisk').addEventListener('change', render);
|
||||||
|
document.getElementById('makeRaidBtn').addEventListener('click', makeRaid);
|
||||||
|
document.getElementById('fmtBtn').addEventListener('click', formatDevice);
|
||||||
|
document.getElementById('importBtn').addEventListener('click', importLsblk);
|
||||||
|
document.getElementById('exportTxtBtn').addEventListener('click', exportLsblkText);
|
||||||
|
document.getElementById('copyExportBtn').addEventListener('click', copyExportText);
|
||||||
|
document.getElementById('downloadTxtBtn').addEventListener('click', downloadTxt);
|
||||||
|
document.getElementById('downloadJsonBtn').addEventListener('click', downloadJson);
|
||||||
|
document.getElementById('jsonFile').addEventListener('change', loadJsonFile);
|
||||||
|
document.getElementById('resetBtn').addEventListener('click', ()=>{
|
||||||
|
if(!confirm('Tout réinitialiser ?')) return;
|
||||||
|
state.devices={}; state.diskOrder=[];
|
||||||
|
diskLetterIdx=0; nvmeIdx=0; raidCounter=0; sdMinorBase=0; nvmeMinorCounter=0;
|
||||||
|
render();
|
||||||
|
});
|
||||||
|
|
||||||
|
updateDiskSizePreview();
|
||||||
|
render();
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
:root{--bg:#20212c;--panel:#282a36;--line:#44475a;--fg:#f8f8f2;--dim:#6272a4;--cyan:#8be9fd;--green:#50fa7b;--orange:#ffb86c;--purple:#bd93f9;--red:#ff5555;--yellow:#f1fa8c}
|
||||||
|
*{box-sizing:border-box}
|
||||||
|
body{margin:0;padding:24px;background:var(--bg);color:var(--fg);font:12.5px 'JetBrains Mono',ui-monospace,monospace}
|
||||||
|
h1{font-size:15px;font-weight:500;color:var(--dim);margin:0 0 4px}.prompt{color:var(--green)}
|
||||||
|
.sub{color:var(--dim);font-size:12px;margin:0 0 20px}
|
||||||
|
.layout{display:grid;grid-template-columns:340px 1fr;gap:20px;max-width:1400px;margin:auto;align-items:start}
|
||||||
|
@media(max-width:900px){.layout{grid-template-columns:1fr}}
|
||||||
|
.panel{background:var(--panel);border:1px solid var(--line);border-radius:8px;padding:14px;margin-bottom:14px}
|
||||||
|
h2{font-size:11px;text-transform:uppercase;letter-spacing:.08em;color:var(--purple);margin:0 0 8px}
|
||||||
|
.hint{font-size:10.5px;color:var(--dim);line-height:1.5;margin:0 0 8px}code{color:var(--cyan);word-break:break-all}
|
||||||
|
label{display:block;font-size:11px;color:var(--dim);margin:8px 0 4px}
|
||||||
|
input,select,textarea{width:100%;background:var(--bg);border:1px solid var(--line);color:var(--fg);font:inherit;padding:6px 8px;border-radius:5px}
|
||||||
|
textarea{min-height:80px;font-size:11px;resize:vertical}
|
||||||
|
.r2{display:grid;grid-template-columns:1fr 80px;gap:8px}
|
||||||
|
.chk{display:flex;gap:6px;align-items:center}.chk input{width:auto}
|
||||||
|
button{font:inherit;font-weight:500;border:0;border-radius:5px;padding:7px 10px;margin-top:10px;width:100%;cursor:pointer;background:var(--purple);color:#1a1b23}
|
||||||
|
button:hover{filter:brightness(1.1)}
|
||||||
|
button.ghost{background:none;border:1px solid var(--line);color:var(--dim)}button.ghost:hover{color:var(--red);border-color:var(--red)}
|
||||||
|
.err{color:var(--red);min-height:16px;margin:-6px 0 10px;font-size:11.5px}
|
||||||
|
.term{background:var(--panel);border:1px solid var(--line);border-radius:8px;overflow:hidden;margin-bottom:14px}
|
||||||
|
.term-bar{padding:10px 14px;background:#1c1d27;border-bottom:1px solid var(--line);color:var(--dim);font-size:11.5px}
|
||||||
|
.term-body{padding:12px 16px;overflow-x:auto}
|
||||||
|
.row{display:grid;grid-template-columns:200px 80px 36px 80px 36px 60px 1fr;line-height:2;white-space:pre;cursor:pointer;border-radius:4px;padding:0 6px}
|
||||||
|
.row:hover{background:var(--bg)}.row.sel{background:#3a3d52}
|
||||||
|
.row.head{color:var(--dim);font-weight:700;cursor:default}.row.head:hover{background:none}
|
||||||
|
.n-disk{color:var(--cyan)}.n-raid{color:var(--purple);font-weight:700}.mt{color:var(--green)}.sw{color:var(--yellow)}.dim{color:var(--dim)}.or{color:var(--orange)}
|
||||||
|
.info{margin-bottom:12px}.info b{color:var(--cyan)}
|
||||||
|
.gauge{display:flex;gap:2px;height:44px;border-radius:6px;overflow:hidden;border:1px solid var(--line);background:var(--bg)}
|
||||||
|
.seg{min-width:6px;display:flex;align-items:center;justify-content:center;color:#1a1b23;font-size:11px;overflow:hidden;cursor:pointer;opacity:.85}
|
||||||
|
.seg.on,.seg:hover{opacity:1;outline:2px solid var(--fg);outline-offset:-2px}
|
||||||
|
.seg.free{background:repeating-linear-gradient(45deg,#2c2e3d,#2c2e3d 6px,#34374a 6px,#34374a 12px);color:var(--dim);cursor:default}
|
||||||
|
.legend{display:flex;flex-wrap:wrap;gap:14px;margin:10px 0 14px;font-size:11px;color:var(--dim)}
|
||||||
|
.legend i,.dot{display:inline-block;width:10px;height:10px;border-radius:2px;margin-right:5px}
|
||||||
|
table{width:100%;border-collapse:collapse}
|
||||||
|
th{text-align:left;color:var(--dim);font-weight:500;padding:6px;border-bottom:1px solid var(--line)}
|
||||||
|
td{padding:6px;vertical-align:top;border-bottom:1px solid #31344a}
|
||||||
|
tr[data-act]{cursor:pointer}tr.sel{background:#3a3d52}
|
||||||
|
.mnt{display:flex;justify-content:space-between;align-items:center;padding:3px 0;color:var(--green)}
|
||||||
|
.mnt button{width:auto;margin:0;padding:0 6px;background:none;color:var(--dim)}.mnt button:hover{color:var(--red)}
|
||||||
@@ -0,0 +1,76 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="fr">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>lsblk --manager</title>
|
||||||
|
<link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;700&display=swap" rel="stylesheet">
|
||||||
|
<link rel="stylesheet" href="css/style.css">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1><span class="prompt">$</span> lsblk --manager</h1>
|
||||||
|
<p class="sub">simulateur de disques/partitions — clique un disque ou une partition pour le détail. Sauvegarde auto dans le navigateur.</p>
|
||||||
|
|
||||||
|
<div class="layout">
|
||||||
|
<aside>
|
||||||
|
<section class="panel"><h2>Sélection</h2><div id="devPanel"></div></section>
|
||||||
|
|
||||||
|
<section class="panel"><h2>Ajouter un disque</h2>
|
||||||
|
<div class="r2"><input id="dSize" type="number" min="0.01" step="0.1" value="500">
|
||||||
|
<select id="dUnit"><option value="G">Go</option><option value="T">To</option><option value="M">Mo</option></select></div>
|
||||||
|
<label class="chk"><input type="checkbox" id="dDec" checked> taille commerciale (décimale)</label>
|
||||||
|
<label>Type</label><select id="dMedia"><option value="nvme">NVMe (nvmeXn1)</option><option value="sd">SATA/USB (sdX)</option></select>
|
||||||
|
<button data-act="addDisk">+ Ajouter le disque</button>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="panel"><h2>Nouvelle partition</h2>
|
||||||
|
<p class="hint" id="pTarget"></p>
|
||||||
|
<div class="r2"><input id="pSize" type="number" min="0.001" step="0.1" value="50">
|
||||||
|
<select id="pUnit"><option value="G">Gio</option><option value="M">Mio</option><option value="T">Tio</option></select></div>
|
||||||
|
<label>Système de fichiers</label><select id="pFs"></select>
|
||||||
|
<button data-act="addPart">Créer la partition</button>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="panel"><h2>RAID / pool btrfs</h2>
|
||||||
|
<p class="hint">Coche les périphériques. mdadm crée un mdX ; btrfs crée un pool multi-disques (pas de mdX, montage sur le 1er membre coché).</p>
|
||||||
|
<div id="raidPool"></div>
|
||||||
|
<label>Type</label><select id="rLevel">
|
||||||
|
<optgroup label="mdadm">
|
||||||
|
<option value="md:0">RAID 0</option><option value="md:1" selected>RAID 1</option><option value="md:5">RAID 5</option><option value="md:6">RAID 6</option><option value="md:10">RAID 10</option>
|
||||||
|
</optgroup>
|
||||||
|
<optgroup label="btrfs (natif)">
|
||||||
|
<option value="btrfs:single">btrfs single</option><option value="btrfs:raid0">btrfs raid0</option><option value="btrfs:raid1">btrfs raid1</option><option value="btrfs:raid1c3">btrfs raid1c3</option><option value="btrfs:raid10">btrfs raid10</option><option value="btrfs:raid5">btrfs raid5</option><option value="btrfs:raid6">btrfs raid6</option>
|
||||||
|
</optgroup>
|
||||||
|
</select>
|
||||||
|
<label>Étiquette (btrfs)</label><input id="rLabel" placeholder="pool">
|
||||||
|
<button data-act="raid">Assembler la sélection</button>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="panel"><h2>Importer</h2>
|
||||||
|
<p class="hint">Colle un <code>lsblk</code> classique, ou mieux (FS, label, usage) :<br><code>lsblk -J -b -o NAME,MAJ:MIN,RM,SIZE,RO,TYPE,FSTYPE,LABEL,FSUSED,UUID,MOUNTPOINTS</code></p>
|
||||||
|
<textarea id="impTxt"></textarea>
|
||||||
|
<button data-act="imp">Importer (remplace tout)</button>
|
||||||
|
<label>…ou charger un fichier (.json / .txt)</label><input type="file" id="impFile">
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="panel"><h2>Exporter</h2>
|
||||||
|
<textarea id="expTxt" readonly></textarea>
|
||||||
|
<button data-act="exTxt">Générer le texte lsblk</button>
|
||||||
|
<button class="ghost" data-act="copy">Copier</button>
|
||||||
|
<button class="ghost" data-act="exJson">Télécharger JSON complet</button>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<button class="ghost" data-act="reset">Tout réinitialiser</button>
|
||||||
|
</aside>
|
||||||
|
|
||||||
|
<main>
|
||||||
|
<div class="term"><div class="term-bar">lsblk</div><div class="term-body" id="tree"></div></div>
|
||||||
|
<p class="err" id="err"></p>
|
||||||
|
<div class="panel"><h2>Détail du disque</h2><div id="detail"></div></div>
|
||||||
|
</main>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script src="js/model.js"></script>
|
||||||
|
<script src="js/lsblk.js"></script>
|
||||||
|
<script src="js/ui.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,95 @@
|
|||||||
|
// Import (texte lsblk, JSON lsblk -J, JSON exporté par l'outil) et export.
|
||||||
|
// LVM / crypt / loop sont ignorés à l'import (RAID md géré).
|
||||||
|
const PFX = '[\\s│├└─|`\\-]*';
|
||||||
|
|
||||||
|
function addImported(d, list) {
|
||||||
|
list.forEach(x => {
|
||||||
|
if (x === '[SWAP]') d.fstype = 'swap';
|
||||||
|
else { d.mounts.push({ mp: x, subvol: '' }); if (!d.fstype) d.fstype = '?'; }
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// un mdX apparaît sous chacun de ses membres : on ne le crée qu'une fois
|
||||||
|
function raidFor(name, o, level, member) {
|
||||||
|
let r = Object.values(S.devs).find(x => x.kind === 'raid' && x.name === name);
|
||||||
|
const fresh = !r;
|
||||||
|
if (fresh) r = mk({ ...o, kind: 'raid', name, level, members: [] });
|
||||||
|
if (!r.members.includes(member.id)) r.members.push(member.id);
|
||||||
|
member.fstype = 'linux_raid_member'; member.mounts = [];
|
||||||
|
return fresh ? r : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function fromText(t) {
|
||||||
|
let disk = null, par = null, last = null;
|
||||||
|
const re = new RegExp('^' + PFX + '(\\S+)\\s+(\\d+:\\d+)\\s+(\\d)\\s+([\\d.,]+[BKMGT]?)\\s+(\\d)\\s+(\\S+)\\s*(.*)$', 'i');
|
||||||
|
const cont = new RegExp('^' + PFX + '(\\/\\S*|\\[SWAP\\])\\s*$');
|
||||||
|
t.split('\n').forEach(l => {
|
||||||
|
const m = l.replace(/\r$/, '').match(re);
|
||||||
|
if (m) {
|
||||||
|
const [, name, majmin, rm, size, ro, type, mt] = m;
|
||||||
|
const o = { name, majmin, rm, ro, size: sz(size) }, rl = type.match(/^raid(\d+)$/i);
|
||||||
|
last = null;
|
||||||
|
if (type === 'disk') { disk = mk({ ...o, kind: 'disk' }); S.order.push(disk.id); last = par = disk; }
|
||||||
|
else if (type === 'part' && disk) { last = par = mk({ ...o, kind: 'part', parent: disk.id }); disk.children.push(last.id); }
|
||||||
|
else if (rl && par) last = raidFor(name, o, +rl[1], par);
|
||||||
|
if (last && mt.trim()) addImported(last, [mt.trim()]);
|
||||||
|
} else if (last) {
|
||||||
|
const c = l.match(cont);
|
||||||
|
if (c) addImported(last, [c[1]]);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function fromJSON(j) {
|
||||||
|
const base = (b, kind) => {
|
||||||
|
const mp = (b.mountpoints || [b.mountpoint]).filter(Boolean);
|
||||||
|
const swap = mp.includes('[SWAP]');
|
||||||
|
return { kind, name: b.name, majmin: b['maj:min'], size: sz(b.size), rm: +b.rm ? '1' : '0', ro: +b.ro ? '1' : '0',
|
||||||
|
uuid: b.uuid || '', fstype: swap ? 'swap' : (b.fstype || (mp.length ? '?' : '')), label: b.label || '',
|
||||||
|
used: b.fsused ? sz(b.fsused) : null, mounts: swap ? [] : mp.map(x => ({ mp: x, subvol: '' })) };
|
||||||
|
};
|
||||||
|
const raids = (b, m) => (b.children || []).forEach(c => { if (/^raid\d+$/i.test(c.type)) raidFor(c.name, base(c, 'raid'), +c.type.slice(4), m); });
|
||||||
|
(j.blockdevices || []).forEach(b => {
|
||||||
|
if (b.type !== 'disk') return;
|
||||||
|
const d = mk(base(b, 'disk')); S.order.push(d.id); raids(b, d);
|
||||||
|
(b.children || []).forEach(c => {
|
||||||
|
if (c.type !== 'part') return;
|
||||||
|
const p = mk({ ...base(c, 'part'), parent: d.id }); d.children.push(p.id); raids(c, p);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
groupPools();
|
||||||
|
}
|
||||||
|
|
||||||
|
// btrfs multi-device : mêmes UUID -> un pool (profil inconnu), montages regroupés sur le membre principal
|
||||||
|
function groupPools() {
|
||||||
|
const g = {};
|
||||||
|
Object.values(S.devs).forEach(d => { if (d.fstype === 'btrfs' && d.uuid) (g[d.uuid] = g[d.uuid] || []).push(d); });
|
||||||
|
Object.values(g).filter(a => a.length > 1).forEach(a => {
|
||||||
|
const id = 'pool' + uid(), prim = a.find(d => d.mounts.length) || a[0];
|
||||||
|
S.pools[id] = { id, profile: '?', label: prim.label || '', usable: null, members: a.map(d => d.id), primary: prim.id };
|
||||||
|
a.forEach(d => { d.pool = id; if (d !== prim) { prim.mounts.push(...d.mounts); d.mounts = []; } });
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function importAny(text) {
|
||||||
|
text = text.trim();
|
||||||
|
if (!text) return 'Colle une sortie lsblk (texte ou JSON).';
|
||||||
|
const bak = { devs: S.devs, order: S.order, pools: S.pools };
|
||||||
|
S.devs = {}; S.order = []; S.pools = {};
|
||||||
|
try {
|
||||||
|
if (text[0] === '{') { const j = JSON.parse(text); if (j.devs) { S.devs = j.devs; S.order = j.order; S.pools = j.pools || {}; } else fromJSON(j); }
|
||||||
|
else fromText(text);
|
||||||
|
if (!S.order.length) throw 0;
|
||||||
|
S.sel = S.order[0];
|
||||||
|
return '';
|
||||||
|
} catch (e) { S.devs = bak.devs; S.order = bak.order; S.pools = bak.pools; return 'Import impossible : format non reconnu.'; }
|
||||||
|
}
|
||||||
|
|
||||||
|
function toText() {
|
||||||
|
const R = rows(false); if (!R.length) return '';
|
||||||
|
const w = Math.max(4, ...R.map(r => r.name.length)) + 1;
|
||||||
|
const head = 'NAME'.padEnd(w) + 'MAJ:MIN'.padEnd(8) + 'RM'.padEnd(3) + 'SIZE'.padEnd(8) + 'RO'.padEnd(3) + 'TYPE'.padEnd(6) + 'MOUNTPOINTS';
|
||||||
|
return [head, ...R.map(r => r.cont
|
||||||
|
? r.name.padEnd(w + 28) + r.mount
|
||||||
|
: r.name.padEnd(w) + r.d.majmin.padEnd(8) + r.d.rm.padEnd(3) + fmtLsblk(r.d.size).padEnd(8) + r.d.ro.padEnd(3) + typeOf(r.d).padEnd(6) + r.mount)].join('\n');
|
||||||
|
}
|
||||||
@@ -0,0 +1,138 @@
|
|||||||
|
// État + logique métier. Tailles en octets.
|
||||||
|
const S = { devs: {}, order: [], pools: {}, sel: null };
|
||||||
|
const U = { B: 1, K: 1024, M: 1024 ** 2, G: 1024 ** 3, T: 1024 ** 4 };
|
||||||
|
const FS = ['ext4', 'btrfs', 'xfs', 'vfat', 'ntfs', 'zfs', 'swap'];
|
||||||
|
let seq = 0;
|
||||||
|
const uid = () => 'x' + (++seq) + Math.random().toString(36).slice(2, 6);
|
||||||
|
|
||||||
|
const unitOf = b => b >= U.T ? ['T', U.T] : b >= U.G ? ['G', U.G] : b >= U.M ? ['M', U.M] : ['K', U.K];
|
||||||
|
const num = (x, d) => String(+x.toFixed(d)).replace('.', ',');
|
||||||
|
const fmtIEC = b => { const [u, v] = unitOf(b); return num(b / v, 2) + ' ' + u + 'io'; };
|
||||||
|
const fmtLsblk = b => { const [u, v] = unitOf(b); return num(b / v, 1) + u; };
|
||||||
|
const sz = x => { // "463,2G" | 1234 | "1234" -> octets
|
||||||
|
if (typeof x === 'number') return x;
|
||||||
|
const m = String(x).match(/^([\d.,]+)\s*([BKMGT])?/i);
|
||||||
|
return m ? parseFloat(m[1].replace(',', '.')) * U[(m[2] || 'B').toUpperCase()] : 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
const diskOf = d => d.kind === 'disk' ? d : d.kind === 'part' ? S.devs[d.parent] : null;
|
||||||
|
const free = d => d.size - d.children.reduce((a, c) => a + S.devs[c].size, 0);
|
||||||
|
|
||||||
|
function mk(o) {
|
||||||
|
const d = { id: uid(), fstype: '', label: '', used: null, mounts: [], children: [], rm: '0', ro: '0', ...o };
|
||||||
|
S.devs[d.id] = d;
|
||||||
|
return d;
|
||||||
|
}
|
||||||
|
const nextNvmeMinor = () => 1 + Math.max(-1, ...Object.values(S.devs).filter(d => d.majmin.startsWith('259:')).map(d => +d.majmin.split(':')[1]));
|
||||||
|
|
||||||
|
function addDisk(size, media) {
|
||||||
|
const names = Object.values(S.devs).filter(d => d.kind === 'disk').map(d => d.name);
|
||||||
|
let i = 0, name, majmin;
|
||||||
|
if (media === 'nvme') { while (names.includes(`nvme${i}n1`)) i++; name = `nvme${i}n1`; majmin = '259:' + nextNvmeMinor(); }
|
||||||
|
else { while (names.includes('sd' + String.fromCharCode(97 + i))) i++; name = 'sd' + String.fromCharCode(97 + i); majmin = '8:' + i * 16; }
|
||||||
|
const d = mk({ kind: 'disk', name, size, majmin, rm: media === 'sd' ? '0' : '0' });
|
||||||
|
S.order.push(d.id);
|
||||||
|
return d;
|
||||||
|
}
|
||||||
|
|
||||||
|
function addPart(disk, size, fstype) {
|
||||||
|
if (disk.pool) dissolvePool(disk.pool);
|
||||||
|
disk.fstype = ''; disk.mounts = []; // disque entier -> partitionné
|
||||||
|
const n = 1 + Math.max(0, ...disk.children.map(c => parseInt(S.devs[c].name.match(/(\d+)$/)[1])));
|
||||||
|
const nv = disk.name.startsWith('nvme');
|
||||||
|
const base = +disk.majmin.split(':')[1];
|
||||||
|
const p = mk({ kind: 'part', name: disk.name + (nv ? 'p' : '') + n, size, parent: disk.id, fstype,
|
||||||
|
majmin: nv ? '259:' + nextNvmeMinor() : '8:' + (base + n) });
|
||||||
|
disk.children.push(p.id);
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
function setFs(d, fstype, label) { d.fstype = fstype; d.label = label; d.mounts = []; d.used = null; }
|
||||||
|
|
||||||
|
function addMount(d, mp, subvol) {
|
||||||
|
if (!d.fstype || d.fstype === 'swap') return 'Formate d\'abord (hors swap).';
|
||||||
|
if (!mp.startsWith('/')) return 'Le point de montage doit commencer par /.';
|
||||||
|
if (Object.values(S.devs).some(x => x.mounts.some(m => m.mp === mp))) return `${mp} est déjà monté.`;
|
||||||
|
d.mounts.push({ mp, subvol });
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
const RAID_MIN = { 0: 2, 1: 2, 5: 3, 6: 4, 10: 4 };
|
||||||
|
const typeOf = d => d.kind === 'raid' ? 'raid' + d.level : d.kind;
|
||||||
|
const eligible = () => Object.values(S.devs).filter(d => (d.kind === 'part' || (d.kind === 'disk' && !d.children.length))
|
||||||
|
&& !d.mounts.length && d.fstype !== 'swap' && d.fstype !== 'linux_raid_member' && !d.pool);
|
||||||
|
|
||||||
|
function addRaid(ids, level) {
|
||||||
|
if (ids.length < RAID_MIN[level]) return `RAID ${level} : au moins ${RAID_MIN[level]} membres.`;
|
||||||
|
if (level === 10 && ids.length % 2) return 'RAID 10 : nombre pair de membres.';
|
||||||
|
const s = ids.map(i => S.devs[i].size), min = Math.min(...s), n = s.length;
|
||||||
|
const size = level === 0 ? s.reduce((a, b) => a + b, 0) : level === 1 ? min : level === 5 ? min * (n - 1) : level === 6 ? min * (n - 2) : min * n / 2;
|
||||||
|
const names = Object.values(S.devs).map(d => d.name); let i = 0;
|
||||||
|
while (names.includes('md' + i)) i++;
|
||||||
|
const r = mk({ kind: 'raid', name: 'md' + i, level, size, majmin: '9:' + i, members: ids });
|
||||||
|
ids.forEach(m => { S.devs[m].fstype = 'linux_raid_member'; });
|
||||||
|
S.sel = r.id;
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
const freeMembers = r => r.members.forEach(m => { const x = S.devs[m]; if (x && x.fstype === 'linux_raid_member') x.fstype = ''; });
|
||||||
|
function dropRaids(id) {
|
||||||
|
Object.values(S.devs).filter(r => r.kind === 'raid' && r.members.includes(id)).forEach(r => { freeMembers(r); delete S.devs[r.id]; });
|
||||||
|
}
|
||||||
|
|
||||||
|
// Pool btrfs multi-périphériques : pas de mdX, tous les membres sont "btrfs",
|
||||||
|
// le montage n'est affiché que sur le membre principal (comme lsblk).
|
||||||
|
const BTRFS_MIN = { single: 2, raid0: 2, raid1: 2, raid1c3: 3, raid10: 4, raid5: 2, raid6: 3 };
|
||||||
|
const host = d => d.pool ? S.devs[S.pools[d.pool].primary] : d;
|
||||||
|
|
||||||
|
function addPool(ids, profile, label) {
|
||||||
|
if (ids.length < BTRFS_MIN[profile]) return `btrfs ${profile} : au moins ${BTRFS_MIN[profile]} périphériques.`;
|
||||||
|
const s = ids.map(i => S.devs[i].size), sum = s.reduce((a, b) => a + b, 0), max = Math.max(...s);
|
||||||
|
const usable = { single: sum, raid0: sum, raid1: Math.min(sum / 2, sum - max), raid1c3: Math.min(sum / 3, (sum - max) / 2),
|
||||||
|
raid10: sum / 2, raid5: sum - max, raid6: sum - 2 * max }[profile];
|
||||||
|
const id = 'pool' + uid();
|
||||||
|
S.pools[id] = { id, profile, label, usable, members: ids, primary: ids[0] };
|
||||||
|
ids.forEach(i => { const d = S.devs[i]; d.fstype = 'btrfs'; d.pool = id; d.label = label; d.mounts = []; d.used = null; });
|
||||||
|
S.sel = ids[0];
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
function dissolvePool(pid) {
|
||||||
|
const p = S.pools[pid]; if (!p) return;
|
||||||
|
p.members.forEach(m => { const d = S.devs[m]; if (d) { d.fstype = ''; d.pool = null; d.label = ''; d.mounts = []; } });
|
||||||
|
delete S.pools[pid];
|
||||||
|
}
|
||||||
|
function dropPool(id) { const d = S.devs[id]; if (d && d.pool) dissolvePool(d.pool); }
|
||||||
|
|
||||||
|
function delDev(id) {
|
||||||
|
const d = S.devs[id]; if (!d) return;
|
||||||
|
if (d.kind === 'raid') freeMembers(d); else { dropRaids(id); dropPool(id); }
|
||||||
|
if (d.kind === 'disk') { d.children.forEach(c => { dropRaids(c); dropPool(c); delete S.devs[c]; }); S.order = S.order.filter(x => x !== id); }
|
||||||
|
else if (d.kind === 'part' && S.devs[d.parent]) S.devs[d.parent].children = S.devs[d.parent].children.filter(x => x !== id);
|
||||||
|
delete S.devs[id];
|
||||||
|
S.sel = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Lignes de l'arbre lsblk (1 ligne par point de montage, comme le vrai lsblk)
|
||||||
|
// all=true : un pool btrfs affiche ses montages sur chaque membre (all=false : comme le vrai lsblk, membre principal seul)
|
||||||
|
const mountTexts = (d, all) => d.fstype === 'swap' ? ['[SWAP]'] : (all ? host(d) : d).mounts.map(m => m.mp);
|
||||||
|
function rows(all = true) {
|
||||||
|
const out = [];
|
||||||
|
const add = (d, name, pfx) => {
|
||||||
|
const m = mountTexts(d, all);
|
||||||
|
out.push({ d, name, mount: m[0] || '' });
|
||||||
|
m.slice(1).forEach(x => out.push({ d, name: pfx, mount: x, cont: true }));
|
||||||
|
};
|
||||||
|
const raids = (d, ind) => Object.values(S.devs).filter(r => r.kind === 'raid' && r.members.includes(d.id)).forEach(r => add(r, ind + '└─' + r.name, ''));
|
||||||
|
S.order.forEach(id => {
|
||||||
|
const d = S.devs[id]; add(d, d.name, ''); raids(d, '');
|
||||||
|
d.children.forEach((c, i) => {
|
||||||
|
const last = i === d.children.length - 1, p = S.devs[c];
|
||||||
|
add(p, (last ? '└─' : '├─') + p.name, last ? '' : '│'); raids(p, last ? ' ' : '│ ');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
const save = () => { try { localStorage.setItem('lsblk-mgr', JSON.stringify({ devs: S.devs, order: S.order, pools: S.pools })); } catch (e) {} };
|
||||||
|
const load = () => { try { const j = JSON.parse(localStorage.getItem('lsblk-mgr')); if (j && j.devs) { S.devs = j.devs; S.order = j.order; S.pools = j.pools || {}; S.sel = S.order[0] || null; } } catch (e) {} };
|
||||||
@@ -0,0 +1,119 @@
|
|||||||
|
const $ = id => document.getElementById(id);
|
||||||
|
const esc = s => String(s).replace(/[&<>"]/g, c => ({ '&': '&', '<': '<', '>': '>', '"': '"' }[c]));
|
||||||
|
const COL = { ext4: '#8be9fd', btrfs: '#bd93f9', xfs: '#ffb86c', vfat: '#ff79c6', ntfs: '#f1fa8c', zfs: '#50fa7b', swap: '#ff5555', '?': '#a0a4bd', linux_raid_member: '#c9a0ff', '': '#6272a4' };
|
||||||
|
const fsLabel = f => f === '?' ? 'inconnu' : f === 'linux_raid_member' ? 'membre RAID' : f || 'non formaté';
|
||||||
|
const colorOf = d => COL[d.fstype] || COL['?'];
|
||||||
|
const fsName = d => fsLabel(d.fstype);
|
||||||
|
const sel = () => S.devs[S.sel];
|
||||||
|
let err = '';
|
||||||
|
|
||||||
|
const poolTag = p => p.pool && S.pools[p.pool] ? ` <small class="dim">pool ${S.pools[p.pool].profile === '?' ? '' : S.pools[p.pool].profile + ' '}×${S.pools[p.pool].members.length}</small>` : '';
|
||||||
|
const mountHtml = p => p.fstype === 'swap' ? '[SWAP]'
|
||||||
|
: host(p).mounts.map(m => esc(m.mp) + (m.subvol ? ` <small class="dim">(subvol=${esc(m.subvol)})</small>` : '')).join('<br>');
|
||||||
|
|
||||||
|
function renderTree() {
|
||||||
|
const R = rows();
|
||||||
|
$('tree').innerHTML = !R.length ? '<span class="dim">rien à afficher — ajoute un disque ou importe un lsblk</span>' :
|
||||||
|
'<div class="row head"><span>NAME</span><span>MAJ:MIN</span><span>RM</span><span>SIZE</span><span>RO</span><span>TYPE</span><span>MOUNTPOINTS</span></div>' +
|
||||||
|
R.map(r => `<div class="row ${r.d.id === S.sel ? 'sel' : ''}" data-act="sel" data-id="${r.d.id}"><span class="n-${r.d.kind}">${esc(r.name)}</span>` +
|
||||||
|
(r.cont ? '<span></span>'.repeat(5)
|
||||||
|
: `<span class="dim">${r.d.majmin}</span><span class="dim">${r.d.rm}</span><span>${fmtLsblk(r.d.size)}</span><span class="dim">${r.d.ro}</span><span class="or">${typeOf(r.d)}</span>`) +
|
||||||
|
`<span class="${r.mount === '[SWAP]' ? 'sw' : 'mt'}">${esc(r.mount)}</span></div>`).join('');
|
||||||
|
}
|
||||||
|
|
||||||
|
function renderDetail() {
|
||||||
|
const d = sel();
|
||||||
|
if (!d) { $('detail').innerHTML = '<span class="dim">clique un disque ou une partition</span>'; return; }
|
||||||
|
if (d.kind === 'raid') {
|
||||||
|
$('detail').innerHTML = `<div class="info"><b>${esc(d.name)}</b> · RAID ${d.level} · ${fmtIEC(d.size)} · ${d.majmin} · ${fsName(d)} · <span class="mt">${mountHtml(d)}</span></div>` +
|
||||||
|
'<table><tr><th>Membre</th><th>Taille</th></tr>' + d.members.map(m => `<tr data-act="sel" data-id="${m}"><td>${esc(S.devs[m].name)}</td><td>${fmtIEC(S.devs[m].size)}</td></tr>`).join('') + '</table>';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const dk = diskOf(d), fr = free(dk);
|
||||||
|
const parts = dk.children.length ? dk.children.map(c => S.devs[c]) : (dk.fstype ? [dk] : []);
|
||||||
|
const pct = s => s / dk.size * 100;
|
||||||
|
const gauge = parts.map(p => `<div class="seg ${p.id === S.sel ? 'on' : ''}" data-act="sel" data-id="${p.id}" style="flex:${p.size} 1 0;background:${colorOf(p)}" title="${esc(p.name)} · ${fsName(p)} · ${fmtIEC(p.size)}">${pct(p.size) > 7 ? esc(p.name) : ''}</div>`).join('') +
|
||||||
|
(fr > 0 ? `<div class="seg free" style="flex:${fr} 1 0" title="non alloué · ${fmtIEC(fr)}">${pct(fr) > 7 ? 'libre' : ''}</div>` : '');
|
||||||
|
const fss = [...new Set(parts.map(p => p.fstype))];
|
||||||
|
const legend = fss.map(f => `<span><i style="background:${COL[f] || COL['?']}"></i>${fsLabel(f)}</span>`).join('') + (fr > 0 ? '<span><i style="background:#34374a"></i>non alloué</span>' : '');
|
||||||
|
$('detail').innerHTML =
|
||||||
|
`<div class="info"><b>${esc(dk.name)}</b> · ${fmtIEC(dk.size)} · ${dk.majmin} · ${dk.children.length} partition(s) · <b>${fmtIEC(fr)}</b> libre</div>` +
|
||||||
|
`<div class="gauge">${gauge}</div><div class="legend">${legend}</div>` +
|
||||||
|
(parts.length ? '<table><tr><th>Partition</th><th>FS</th><th>Montages</th><th>Étiquette</th><th>Taille</th><th>Utilisé</th></tr>' +
|
||||||
|
parts.map(p => `<tr class="${p.id === S.sel ? 'sel' : ''}" data-act="sel" data-id="${p.id}"><td>${esc(p.name)}</td><td><span class="dot" style="background:${colorOf(p)}"></span>${fsName(p)}${poolTag(p)}</td><td class="mt">${mountHtml(p)}</td><td>${esc(p.label)}</td><td>${fmtIEC(p.size)}</td><td>${p.used != null ? fmtIEC(p.used) : '—'}</td></tr>`).join('') + '</table>' : '');
|
||||||
|
}
|
||||||
|
|
||||||
|
function renderDevPanel() {
|
||||||
|
const d = sel();
|
||||||
|
if (!d) { $('devPanel').innerHTML = '<p class="hint">Aucune sélection.</p>'; return; }
|
||||||
|
const pool = d.pool && S.pools[d.pool], h = host(d);
|
||||||
|
const canFs = !pool && !(d.kind === 'disk' && d.children.length);
|
||||||
|
$('devPanel').innerHTML = `<div class="info"><b>${esc(d.name)}</b> · ${fmtIEC(d.size)} · ${fsName(d)}</div>` +
|
||||||
|
(pool ? `<p class="hint">Pool btrfs <b>${esc(pool.label || '(sans étiquette)')}</b> · profil ${pool.profile === '?' ? 'inconnu' : pool.profile} · ${pool.members.length} périphériques${pool.usable != null ? ' · utilisable ≈ ' + fmtIEC(pool.usable) : ''}<br>Membres : ${pool.members.map(m => esc(S.devs[m].name)).join(', ')}<br>Montages portés par <b>${esc(h.name)}</b>.</p><button class="ghost" data-act="unpool">Dissoudre le pool</button>` : '') +
|
||||||
|
(canFs ? `<label>Système de fichiers</label><select id="fsSel">${['', ...FS].map(f => `<option value="${f}" ${f === d.fstype ? 'selected' : ''}>${f || '— non formaté —'}</option>`).join('')}</select>
|
||||||
|
<label>Étiquette</label><input id="lblIn" value="${esc(d.label)}"><button data-act="fmt">Formater (efface les montages)</button>` : pool ? '' : '<p class="hint">Disque partitionné : sélectionne une partition pour la formater/monter.</p>') +
|
||||||
|
(h.fstype && h.fstype !== 'swap' ? `<label>Points de montage (${h.mounts.length})</label>` +
|
||||||
|
h.mounts.map((m, i) => `<div class="mnt"><span>${esc(m.mp)}${m.subvol ? ` <small class="dim">(subvol=${esc(m.subvol)})</small>` : ''}</span><button data-act="umount" data-i="${i}">✕</button></div>`).join('') +
|
||||||
|
`<div class="r2" style="grid-template-columns:1fr 1fr;margin-top:6px"><input id="mpIn" placeholder="/home"><input id="svIn" placeholder="sous-volume (@home)"></div><button data-act="mount">+ Ajouter un montage</button>` : '') +
|
||||||
|
'<button class="ghost" data-act="del">Supprimer</button>';
|
||||||
|
}
|
||||||
|
|
||||||
|
function render() {
|
||||||
|
save();
|
||||||
|
const d = sel(), dk = d && diskOf(d);
|
||||||
|
$('pTarget').textContent = dk ? `sur ${dk.name} — libre : ${fmtIEC(free(dk))}` : 'sélectionne un disque ou une de ses partitions';
|
||||||
|
$('err').textContent = err;
|
||||||
|
renderTree(); renderDetail(); renderDevPanel();
|
||||||
|
const el = eligible();
|
||||||
|
$('raidPool').innerHTML = el.length ? el.map(x => `<label class="chk"><input type="checkbox" class="rchk" value="${x.id}">${esc(x.name)} · ${fmtIEC(x.size)}</label>`).join('') : '<p class="hint">aucun périphérique libre (non monté, hors RAID)</p>';
|
||||||
|
}
|
||||||
|
|
||||||
|
function download(name, text) {
|
||||||
|
const a = document.createElement('a');
|
||||||
|
a.href = URL.createObjectURL(new Blob([text], { type: 'application/json' }));
|
||||||
|
a.download = name; a.click(); URL.revokeObjectURL(a.href);
|
||||||
|
}
|
||||||
|
|
||||||
|
const ACT = {
|
||||||
|
sel: t => { S.sel = t.dataset.id; },
|
||||||
|
addDisk: () => {
|
||||||
|
const v = +$('dSize').value, u = $('dUnit').value;
|
||||||
|
if (!(v > 0)) { err = 'Taille invalide.'; return; }
|
||||||
|
const mult = $('dDec').checked ? { K: 1e3, M: 1e6, G: 1e9, T: 1e12 }[u] : U[u];
|
||||||
|
S.sel = addDisk(Math.round(v * mult), $('dMedia').value).id;
|
||||||
|
},
|
||||||
|
addPart: () => {
|
||||||
|
const d = sel(), dk = d && diskOf(d);
|
||||||
|
if (!dk) { err = 'Sélectionne un disque.'; return; }
|
||||||
|
const b = Math.round(+$('pSize').value * U[$('pUnit').value]);
|
||||||
|
if (!(b > 0)) { err = 'Taille invalide.'; return; }
|
||||||
|
if (b > free(dk)) { err = `Espace insuffisant (libre : ${fmtIEC(free(dk))}).`; return; }
|
||||||
|
S.sel = addPart(dk, b, $('pFs').value).id;
|
||||||
|
},
|
||||||
|
fmt: () => { const d = sel(); if (d && !d.children.length && !d.pool) setFs(d, $('fsSel').value, $('lblIn').value.trim()); },
|
||||||
|
mount: () => { const d = sel(); if (d) err = addMount(host(d), $('mpIn').value.trim(), $('svIn').value.trim()); },
|
||||||
|
umount: t => { const d = sel(); if (d) host(d).mounts.splice(+t.dataset.i, 1); },
|
||||||
|
del: () => { const d = sel(); if (d && confirm(`Supprimer ${d.name}${d.children.length ? ' et ses partitions' : ''} ?`)) delDev(d.id); },
|
||||||
|
raid: () => {
|
||||||
|
const ids = [...document.querySelectorAll('.rchk:checked')].map(c => c.value), [k, v] = $('rLevel').value.split(':');
|
||||||
|
err = k === 'md' ? addRaid(ids, +v) : addPool(ids, v, $('rLabel').value.trim());
|
||||||
|
},
|
||||||
|
unpool: () => { const d = sel(); if (d && d.pool) dissolvePool(d.pool); },
|
||||||
|
reset: () => { if (confirm('Tout réinitialiser ?')) { S.devs = {}; S.order = []; S.pools = {}; S.sel = null; } },
|
||||||
|
imp: () => { if (!S.order.length || confirm('Remplacer la configuration actuelle ?')) err = importAny($('impTxt').value); },
|
||||||
|
exTxt: () => { $('expTxt').value = toText(); },
|
||||||
|
copy: () => { navigator.clipboard && navigator.clipboard.writeText($('expTxt').value); },
|
||||||
|
exJson: () => download('lsblk-manager.json', JSON.stringify({ devs: S.devs, order: S.order, pools: S.pools }, null, 2)),
|
||||||
|
};
|
||||||
|
|
||||||
|
document.addEventListener('click', e => {
|
||||||
|
const t = e.target.closest('[data-act]'); if (!t) return;
|
||||||
|
err = ''; ACT[t.dataset.act](t); render();
|
||||||
|
});
|
||||||
|
$('impFile').addEventListener('change', e => {
|
||||||
|
const f = e.target.files[0]; if (!f) return;
|
||||||
|
f.text().then(txt => { if (!S.order.length || confirm('Remplacer la configuration actuelle ?')) { err = importAny(txt); } render(); e.target.value = ''; });
|
||||||
|
});
|
||||||
|
|
||||||
|
$('pFs').innerHTML = ['', ...FS].map(f => `<option value="${f}">${f || '— non formaté —'}</option>`).join('');
|
||||||
|
load(); render();
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
// --- Configuration des serveurs ---
|
// --- Configuration des serveurs ---
|
||||||
$servers = [
|
$servers = [
|
||||||
'Fabric 1.19.2' => '/srv/fabric-1.19.2',
|
'Forge 1.20.1' => '/srv/forge-1.20.1',
|
||||||
'Forge 1.19.2' => '/srv/forge-1.19.2',
|
'Forge 1.19.2' => '/srv/forge-1.19.2',
|
||||||
];
|
];
|
||||||
// ----------------------------------
|
// ----------------------------------
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,49 @@
|
|||||||
|
Stats chaîne vs exact (In) vs ILS
|
||||||
|
1000n 10c
|
||||||
|
essai 1 :
|
||||||
|
ILS (3s) : 315 (100%)
|
||||||
|
chaîne (300 essais) : 304 (96,5%)
|
||||||
|
exact (150s) : 269 (85,4%)
|
||||||
|
|
||||||
|
essai 2 :
|
||||||
|
ILS (3s) : 317 (100%)
|
||||||
|
chaîne (300 essais) : 313 (98,7%)
|
||||||
|
exact (150s) : 276 (87,1%)
|
||||||
|
|
||||||
|
essai 3 :
|
||||||
|
ILS (3s) : 318 (100%)
|
||||||
|
chaîne (300 essais) : 309 (97,2%)
|
||||||
|
exact (150s) : 266 (83,6%)
|
||||||
|
|
||||||
|
essai 4 :
|
||||||
|
ILS (3s) : 320 (100%)
|
||||||
|
chaîne (300 essais) : 313 (97,8%)
|
||||||
|
exact (150s) : 267 (83,4%)
|
||||||
|
|
||||||
|
1000n 15c
|
||||||
|
essai 1 :
|
||||||
|
ILS (3s) : 247 (100%)
|
||||||
|
chaîne (300 essais) : 238 (96,4%)
|
||||||
|
exact (150s) : 199 (80,6%)
|
||||||
|
|
||||||
|
essai 2 :
|
||||||
|
ILS (3s) : 252 (100%)
|
||||||
|
chaîne (300 essais) : 245 (97,2%)
|
||||||
|
exact (150s) : 203 (80,6%)
|
||||||
|
|
||||||
|
essai 3 :
|
||||||
|
ILS (3s) : 250 (100%)
|
||||||
|
chaîne (300 essais) : 239 (95,6%)
|
||||||
|
exact (150s) : 199 (79,6%)
|
||||||
|
|
||||||
|
essai 4 :
|
||||||
|
ILS (3s) : 251 (100%)
|
||||||
|
chaîne (300 essais) : 245 (97,6%)
|
||||||
|
exact (150s) : 207 (82,5%)
|
||||||
|
|
||||||
|
moyennes
|
||||||
|
Configuration ILS Chaîne Exact
|
||||||
|
1000n – 10c 317,5 309,75 269,5
|
||||||
|
1000n – 15c 250 241,75 202
|
||||||
|
10c (%) 100 % 97,55 % 84,88 %
|
||||||
|
15c (%) 100 % 96,70 % 80,83 %
|
||||||
+37
-13
@@ -6,23 +6,47 @@
|
|||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div id='DivG'>
|
<!-- CORPS DU SITE -->
|
||||||
<div class='DivLien'>
|
|
||||||
<a href="https://steampowered.com">Steam</a>
|
<h1 class='centre mimicolor'>TEST TITRE</h1>
|
||||||
|
<header class='centre pad'>emerge --ask --getbinpkg --binpkg-respect-use=n --update --deep --newuse @world</header>
|
||||||
|
|
||||||
|
<div class='parent grid-parent'>
|
||||||
|
<!-- DIV PARENTE (dans la quel les autres seront) -->
|
||||||
|
<div class='child large'>
|
||||||
|
<!-- Div enfant (de gauche) -->
|
||||||
|
<h1 class='centre'>TEST</h1>
|
||||||
|
<div class='child divclic'> <!-- Div cliquable -->
|
||||||
|
<a href="https://steampowered.com">TEST2</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class='child divclic'> <!-- Div cliquable -->
|
||||||
|
<a href="https://steampowered.com">TEST2</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class='child divclic'> <!-- Div cliquable -->
|
||||||
|
<a href="https://steampowered.com">TEST2</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class='child divclic'> <!-- Div cliquable -->
|
||||||
|
<a href="https://steampowered.com">TEST2</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class='child large'>
|
||||||
|
<!-- Div enfant (de droite) -->
|
||||||
|
<h1 class='centre'>TEST</h1>
|
||||||
|
<div class='child divclic'> <!-- Div cliquable -->
|
||||||
|
<a href="https://steampowered.com">TEST2</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class ='DivLien'>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id='DivM'>
|
<script src='script.js' defer></script>
|
||||||
<div class ='child_div_1'>asd</div>
|
|
||||||
<div class ='child_div_2'>asd</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id='DivD'>
|
<footer class='centre pad'>Ce site fonktionne :)</footer>
|
||||||
<div class ='child_div_1'>asd</div>
|
|
||||||
<div class ='child_div_2'>asd</div>
|
|
||||||
</div>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
+1
-14
@@ -1,14 +1 @@
|
|||||||
var couleurs = [
|
console.log("Le site est pas fini hein")
|
||||||
"red",
|
|
||||||
"blue",
|
|
||||||
"gray",
|
|
||||||
"black",
|
|
||||||
"purple",
|
|
||||||
"pink",
|
|
||||||
"green"
|
|
||||||
];
|
|
||||||
|
|
||||||
if (true == true) {
|
|
||||||
var random = Math.floor(Math.random() * couleurs.length);
|
|
||||||
document.getElementById("rainbow").style.color = couleurs[random];
|
|
||||||
}
|
|
||||||
|
|||||||
+80
-23
@@ -4,39 +4,96 @@ html {
|
|||||||
font-family: 'Comfortaa', cursive;
|
font-family: 'Comfortaa', cursive;
|
||||||
}
|
}
|
||||||
|
|
||||||
#DivG, #DivM, #DivD {
|
.large {
|
||||||
border: 2px solid rgb(95 97 110);
|
width: 80%;
|
||||||
border-radius: 0.5em;
|
|
||||||
width: 300px;
|
|
||||||
height: 100px;
|
|
||||||
margin-right: 10px;
|
|
||||||
float: left;
|
|
||||||
text-align: center;
|
|
||||||
width: 600px;
|
|
||||||
align-content: center;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.DivLien {
|
body {
|
||||||
border: 2px solid rgb(95 97 110);
|
background: url(../data/fond/Pino.png) no-repeat center center fixed;
|
||||||
border-radius: 0.5em;
|
}
|
||||||
|
|
||||||
|
.parent {
|
||||||
|
padding: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.grid-parent {
|
||||||
|
background: yellow;
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 1fr 1fr;
|
||||||
|
}
|
||||||
|
|
||||||
|
.child {
|
||||||
|
background: pink;
|
||||||
|
padding: 1rem;
|
||||||
|
margin: 0 auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.divclic {
|
||||||
|
border-radius: 10px;
|
||||||
|
background: lightblue;
|
||||||
|
margin: 1% auto;
|
||||||
width: 500px;
|
width: 500px;
|
||||||
height: 100px;
|
height: 100px;
|
||||||
align-content: center;
|
text-align: center;
|
||||||
|
overflow-wrap: anywhere;
|
||||||
|
padding: 20px;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Alignement au centre et espacé des autre éléments */
|
||||||
|
|
||||||
|
.centre {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pad {
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Animation multicolor */
|
||||||
|
|
||||||
.mimicolor {
|
.mimicolor {
|
||||||
font-family: monospace;
|
font-family: Comfortaa;
|
||||||
font-size: 3em;
|
font-size: 3em;
|
||||||
animation: color-change 1s infinite;
|
animation: color-change 1s infinite;
|
||||||
}
|
}
|
||||||
|
|
||||||
@keyframes color-change {
|
@keyframes color-change {
|
||||||
0% { color: #cc0001; }
|
0% { color: #ff0000; }
|
||||||
16% { color: #fb940b; }
|
10% { color: #ff5300; }
|
||||||
32% { color: #ffff01; }
|
20% { color: #ffa500; }
|
||||||
48% { color: #01cc00; }
|
30% { color: #ffd200; }
|
||||||
64% { color: #03c0c6; }
|
40% { color: #ffff00; }
|
||||||
80% { color: #0000fe; }
|
50% { color: #80c000; }
|
||||||
90% { color: #762ca7; }
|
60% { color: #008000; }
|
||||||
100% { color: #fe98bf; }
|
70% { color: #004080; }
|
||||||
|
80% { color: #0000ff; }
|
||||||
|
90% { color: #2600c1; }
|
||||||
|
100% { color: #4b0082; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Apparence des LIENS */
|
||||||
|
|
||||||
|
a {
|
||||||
|
color: white;
|
||||||
|
background-color: black;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
a:link {
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
a:visited {
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
a:hover {
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
a:active {
|
||||||
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user