Compare commits
4 commits
9cf6d8af97
...
f97ea33ba8
| Author | SHA1 | Date | |
|---|---|---|---|
| f97ea33ba8 | |||
| dfd83f78a3 | |||
| 00843155c2 | |||
| bf02cf8307 |
1 changed files with 30 additions and 25 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name Checkmk SwissKnife
|
// @name Checkmk SwissKnife
|
||||||
// @namespace https://luigidacunto.com/
|
// @namespace https://luigidacunto.com/
|
||||||
// @version 2.9.5
|
// @version 2.9.9
|
||||||
// @description Raccolta di miglioramenti all'interfaccia di Checkmk WATO. Ogni fix o enhancement viene aggiunto qui come feature indipendente.
|
// @description Raccolta di miglioramenti all'interfaccia di Checkmk WATO. Ogni fix o enhancement viene aggiunto qui come feature indipendente.
|
||||||
// @author Luigi D'Acunto
|
// @author Luigi D'Acunto
|
||||||
// @homepageURL https://git.luigidacunto.com/tools/checkmk-swissknife
|
// @homepageURL https://git.luigidacunto.com/tools/checkmk-swissknife
|
||||||
|
|
@ -827,34 +827,39 @@
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
}
|
}
|
||||||
.cmk-sk-inv-btn, .cmk-sk-copy-btn, .cmk-sk-copy-short-btn {
|
.cmk-sk-inv-btn, .cmk-sk-copy-btn, .cmk-sk-copy-short-btn {
|
||||||
display: inline-flex;
|
display: inline-flex !important;
|
||||||
align-items: center;
|
align-items: center !important;
|
||||||
justify-content: center;
|
justify-content: center !important;
|
||||||
width: 16px;
|
width: 16px !important;
|
||||||
height: 16px;
|
height: 16px !important;
|
||||||
border-radius: 3px;
|
border-radius: 3px !important;
|
||||||
cursor: pointer;
|
cursor: pointer !important;
|
||||||
opacity: 0.8;
|
opacity: 0.8;
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
padding: 0;
|
padding: 0 !important;
|
||||||
|
margin: 1px !important;
|
||||||
|
box-sizing: border-box !important;
|
||||||
text-decoration: none !important;
|
text-decoration: none !important;
|
||||||
|
font-size: 0 !important;
|
||||||
|
line-height: 0 !important;
|
||||||
|
vertical-align: middle !important;
|
||||||
}
|
}
|
||||||
.cmk-sk-inv-btn, .cmk-sk-inv-btn:visited {
|
.cmk-sk-inv-btn {
|
||||||
background: rgba(229,165,0,0.08);
|
background: rgba(229,165,0,0.08) !important;
|
||||||
color: #e5a500 !important;
|
color: #e5a500 !important;
|
||||||
border: 1px solid #e5a500;
|
border: 1px solid #e5a500 !important;
|
||||||
}
|
}
|
||||||
.cmk-sk-inv-btn:hover { opacity: 1; background: rgba(229,165,0,0.18) !important; }
|
.cmk-sk-inv-btn:hover { opacity: 1 !important; background: rgba(229,165,0,0.18) !important; }
|
||||||
.cmk-sk-copy-btn {
|
.cmk-sk-copy-btn {
|
||||||
background: rgba(90,180,214,0.08);
|
background: rgba(90,180,214,0.08) !important;
|
||||||
color: #5ab4d6 !important;
|
color: #5ab4d6 !important;
|
||||||
border: 1px solid #5ab4d6;
|
border: 1px solid #5ab4d6 !important;
|
||||||
}
|
}
|
||||||
.cmk-sk-copy-btn:hover { opacity: 1; background: rgba(90,180,214,0.18) !important; }
|
.cmk-sk-copy-btn:hover { opacity: 1; background: rgba(90,180,214,0.18) !important; }
|
||||||
.cmk-sk-copy-short-btn {
|
.cmk-sk-copy-short-btn {
|
||||||
background: rgba(160,120,200,0.08);
|
background: rgba(160,120,200,0.08) !important;
|
||||||
color: #a078c8 !important;
|
color: #a078c8 !important;
|
||||||
border: 1px solid #a078c8;
|
border: 1px solid #a078c8 !important;
|
||||||
}
|
}
|
||||||
.cmk-sk-copy-short-btn:hover { opacity: 1; background: rgba(160,120,200,0.18) !important; }
|
.cmk-sk-copy-short-btn:hover { opacity: 1; background: rgba(160,120,200,0.18) !important; }
|
||||||
.cmk-sk-copy-btn.copied, .cmk-sk-copy-short-btn.copied {
|
.cmk-sk-copy-btn.copied, .cmk-sk-copy-short-btn.copied {
|
||||||
|
|
@ -869,23 +874,23 @@
|
||||||
const CLIP_SVG = '<svg xmlns="http://www.w3.org/2000/svg" width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round"><rect x="9" y="9" width="13" height="13" rx="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg>';
|
const CLIP_SVG = '<svg xmlns="http://www.w3.org/2000/svg" width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round"><rect x="9" y="9" width="13" height="13" rx="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg>';
|
||||||
|
|
||||||
hostCells.forEach(td => {
|
hostCells.forEach(td => {
|
||||||
const link = td.querySelector('a[href*="view_name=hoststatus"]');
|
let hostname = null;
|
||||||
if (!link) return;
|
for (const a of td.querySelectorAll('a[href*="host="]')) {
|
||||||
const params = new URLSearchParams(link.getAttribute('href').split('?')[1] || '');
|
const h = new URLSearchParams(a.getAttribute('href').split('?')[1] || '').get('host');
|
||||||
const hostname = params.get('host');
|
if (h) { hostname = h; break; }
|
||||||
|
}
|
||||||
if (!hostname) return;
|
if (!hostname) return;
|
||||||
const shortname = hostname.split('.')[0];
|
const shortname = hostname.split('.')[0];
|
||||||
|
|
||||||
const group = doc.createElement('span');
|
const group = doc.createElement('span');
|
||||||
group.className = 'cmk-sk-btn-group';
|
group.className = 'cmk-sk-btn-group';
|
||||||
|
|
||||||
const btn = doc.createElement('a');
|
const btn = doc.createElement('button');
|
||||||
btn.className = 'cmk-sk-inv-btn';
|
btn.className = 'cmk-sk-inv-btn';
|
||||||
btn.href = `wato.py?host=${encodeURIComponent(hostname)}&mode=inventory`;
|
btn.type = 'button';
|
||||||
btn.target = '_blank';
|
|
||||||
btn.rel = 'noopener';
|
|
||||||
btn.title = `Service Discovery: ${hostname}`;
|
btn.title = `Service Discovery: ${hostname}`;
|
||||||
btn.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round"><rect x="2" y="3" width="20" height="14" rx="2"/><line x1="8" y1="21" x2="16" y2="21"/><line x1="12" y1="17" x2="12" y2="21"/><polyline points="6 9 9 12 14 7" stroke-width="2"/></svg>';
|
btn.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round"><rect x="2" y="3" width="20" height="14" rx="2"/><line x1="8" y1="21" x2="16" y2="21"/><line x1="12" y1="17" x2="12" y2="21"/><polyline points="6 9 9 12 14 7" stroke-width="2"/></svg>';
|
||||||
|
btn.addEventListener('click', () => { window.open(`wato.py?host=${encodeURIComponent(hostname)}&mode=inventory`, '_blank', 'noopener'); });
|
||||||
|
|
||||||
const copyBtn = doc.createElement('button');
|
const copyBtn = doc.createElement('button');
|
||||||
copyBtn.className = 'cmk-sk-copy-btn';
|
copyBtn.className = 'cmk-sk-copy-btn';
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue