-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Your Name
committed
Jan 2, 2025
1 parent
289f2ac
commit 8afe6c2
Showing
10 changed files
with
498 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
|
||
#panel-vpn-service { | ||
top: 85px; | ||
right: 40px; | ||
|
||
/* height: 400px; */ | ||
width: 340px; | ||
|
||
max-height: 85vh; /* 80% of the viewport height */ | ||
max-width: 80vw; /* 80% of the viewport width */ | ||
|
||
/* min-height: 400px; */ | ||
min-width: 340px; | ||
} | ||
|
||
.resizable { | ||
/* box-shadow: 0px 3px 6px rgba(0, 0, 0, 0.4); */ | ||
/* background-color: rgba(140, 140, 140, 1); */ | ||
position: absolute; | ||
} | ||
|
||
.resizable .resizers{ | ||
width: 100%; | ||
height: 100%; | ||
box-sizing: border-box; | ||
} | ||
|
||
.resizable .resizers .resizer{ | ||
width: 10px; | ||
height: 10px; | ||
border-radius: 50%; /*magic to turn square into circle*/ | ||
position: absolute; | ||
} | ||
|
||
.resizable .resizers .resizer.top-left { | ||
left: -5px; | ||
top: -5px; | ||
cursor: nwse-resize; /*resizer cursor*/ | ||
background-color: rgba(140, 140, 140, 0.5); | ||
} | ||
.resizable .resizers .resizer.top-right { | ||
right: -5px; | ||
top: -5px; | ||
cursor: nesw-resize; | ||
background-color: rgba(140, 140, 140, 0.5); | ||
} | ||
.resizable .resizers .resizer.bottom-left { | ||
left: -5px; | ||
bottom: 5px; | ||
cursor: nesw-resize; | ||
background-color: rgba(140, 140, 140, 0.5); | ||
} | ||
.resizable .resizers .resizer.bottom-right { | ||
right: -5px; | ||
bottom: -5px; | ||
cursor: nwse-resize; | ||
background-color: rgba(140, 140, 140, 0.5); | ||
} | ||
|
||
.resizable .resizers .resizer.mid-left { | ||
|
||
/* left: -5px; | ||
bottom: 5px; */ | ||
top: 40px; | ||
cursor: ew-resize; | ||
|
||
background-color: rgba(140, 140, 140, 0.5); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
170 changes: 170 additions & 0 deletions
170
dist/html-static/js/library/bulma-resizeable-panel.min.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,170 @@ | ||
/* Make resizable div by Hung Nguyen */ | ||
function makeResizableDiv(div) { | ||
const element = document.querySelector(div); | ||
const resizers = document.querySelectorAll(div + ' .resizer'); | ||
// const minimum_size = 20; | ||
|
||
var panelNode = document.getElementById("panel-vpn-service"); | ||
|
||
console.log("panelNode: ", panelNode); | ||
|
||
const rect = panelNode.getBoundingClientRect(); | ||
const minimum_size_width = rect.width; | ||
const minimum_size_height = rect.height; | ||
|
||
console.log("Rendered Width: ", minimum_size_width); | ||
console.log("Rendered Height: ", minimum_size_height); | ||
|
||
const minimum_size = 20 | ||
|
||
let original_width = 0; | ||
let original_height = 0; | ||
let original_x = 0; | ||
let original_y = 0; | ||
let original_mouse_x = 0; | ||
let original_mouse_y = 0; | ||
|
||
for (let i = 0; i < resizers.length; i++) { | ||
const currentResizer = resizers[i]; | ||
currentResizer.addEventListener('mousedown', function(e) { | ||
e.preventDefault(); | ||
original_width = parseFloat( | ||
getComputedStyle(element, null).getPropertyValue('width').replace('px', '') | ||
); | ||
original_height = parseFloat( | ||
getComputedStyle(element, null).getPropertyValue('height').replace('px', '') | ||
); | ||
original_x = element.getBoundingClientRect().left; | ||
original_y = element.getBoundingClientRect().top; | ||
original_mouse_x = e.pageX; | ||
original_mouse_y = e.pageY; | ||
window.addEventListener('mousemove', resize); | ||
window.addEventListener('mouseup', stopResize); | ||
}); | ||
|
||
function resize(e) { | ||
if (currentResizer.classList.contains('bottom-right')) { | ||
const width = original_width + (e.pageX - original_mouse_x); | ||
const height = original_height + (e.pageY - original_mouse_y); | ||
if (width > minimum_size) { | ||
element.style.width = width + 'px'; | ||
} | ||
if (height > minimum_size) { | ||
element.style.height = height + 'px'; | ||
} | ||
|
||
} else if (currentResizer.classList.contains('mid-left')) { | ||
const height = original_height + (e.pageY - original_mouse_y); | ||
const width = original_width - (e.pageX - original_mouse_x); | ||
if (width > minimum_size_width) { | ||
element.style.width = width + 'px'; | ||
// element.style.left = original_x + (e.pageX - original_mouse_x) + 'px'; | ||
console.log("left: ", element.style.left); | ||
} | ||
|
||
|
||
} else if (currentResizer.classList.contains('bottom-left')) { | ||
const height = original_height + (e.pageY - original_mouse_y); | ||
const width = original_width - (e.pageX - original_mouse_x); | ||
if (height > minimum_size_height) { | ||
element.style.height = height + 'px'; | ||
console.log("height: ", element.style.height); | ||
} | ||
if (width > minimum_size_width) { | ||
element.style.width = width + 'px'; | ||
element.style.left = original_x + (e.pageX - original_mouse_x) + 'px'; | ||
console.log("left: ", element.style.left); | ||
} | ||
|
||
|
||
|
||
} else if (currentResizer.classList.contains('top-right')) { | ||
const width = original_width + (e.pageX - original_mouse_x); | ||
const height = original_height - (e.pageY - original_mouse_y); | ||
if (width > minimum_size) { | ||
element.style.width = width + 'px'; | ||
} | ||
if (height > minimum_size) { | ||
element.style.height = height + 'px'; | ||
element.style.top = original_y + (e.pageY - original_mouse_y) + 'px'; | ||
} | ||
} else { | ||
const width = original_width - (e.pageX - original_mouse_x); | ||
const height = original_height - (e.pageY - original_mouse_y); | ||
if (width > minimum_size) { | ||
element.style.width = width + 'px'; | ||
element.style.left = original_x + (e.pageX - original_mouse_x) + 'px'; | ||
} | ||
if (height > minimum_size) { | ||
element.style.height = height + 'px'; | ||
element.style.top = original_y + (e.pageY - original_mouse_y) + 'px'; | ||
} | ||
} | ||
} | ||
|
||
function stopResize() { | ||
window.removeEventListener('mousemove', resize); | ||
} | ||
} | ||
} | ||
|
||
makeResizableDiv('.resizable'); | ||
|
||
|
||
// tabulator | ||
// Sample data | ||
const activeSymptoms = Array.from({ | ||
length: 120 | ||
}, (_, i) => ({ | ||
rootCause: `eBGP Session to neighbor 30.1.1.${i + 2} is not up for Device: Node-${i + 5}, Vrf: vpn-${i + 100}`, | ||
subservice: "subservice.ebgp.nbr.health system", | ||
priority: Math.floor(Math.random() * 256), | ||
lastUpdated: `19-Jan-2023 ${("0" + (i % 12 + 1)).slice(-2)}:${("0" + (i % 60)).slice(-2)}:34 AM`, | ||
})); | ||
|
||
// Tabulator Column Definitions | ||
const columns = [{ | ||
title: "Root Cause", | ||
field: "rootCause", | ||
widthGrow: 3, | ||
headerFilter: "input" | ||
}, | ||
{ | ||
title: "Subservice", | ||
field: "subservice", | ||
widthGrow: 2, | ||
headerFilter: "input" | ||
}, | ||
{ | ||
title: "Priority", | ||
field: "priority", | ||
widthGrow: 1, | ||
hozAlign: "right", | ||
sorter: "number", | ||
headerFilter: "number" | ||
}, | ||
{ | ||
title: "Last Updated", | ||
field: "lastUpdated", | ||
widthGrow: 1, | ||
sorter: "datetime", | ||
headerFilter: "input" | ||
}, | ||
]; | ||
|
||
// Initialize Tabulator | ||
new Tabulator("#tabulator-grid", { | ||
data: activeSymptoms, | ||
layout: "fitData", | ||
// responsiveLayout: true, | ||
tooltips: true, | ||
pagination: "local", | ||
paginationSize: 5, | ||
movableColumns: true, | ||
resizableRows: true, | ||
initialSort: [{ | ||
column: "priority", | ||
dir: "desc" | ||
}], | ||
columns, | ||
}); |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
|
||
#panel-vpn-service { | ||
top: 85px; | ||
right: 40px; | ||
|
||
/* height: 400px; */ | ||
width: 340px; | ||
|
||
max-height: 85vh; /* 80% of the viewport height */ | ||
max-width: 80vw; /* 80% of the viewport width */ | ||
|
||
/* min-height: 400px; */ | ||
min-width: 340px; | ||
} | ||
|
||
.resizable { | ||
/* box-shadow: 0px 3px 6px rgba(0, 0, 0, 0.4); */ | ||
/* background-color: rgba(140, 140, 140, 1); */ | ||
position: absolute; | ||
} | ||
|
||
.resizable .resizers{ | ||
width: 100%; | ||
height: 100%; | ||
box-sizing: border-box; | ||
} | ||
|
||
.resizable .resizers .resizer{ | ||
width: 10px; | ||
height: 10px; | ||
border-radius: 50%; /*magic to turn square into circle*/ | ||
position: absolute; | ||
} | ||
|
||
.resizable .resizers .resizer.top-left { | ||
left: -5px; | ||
top: -5px; | ||
cursor: nwse-resize; /*resizer cursor*/ | ||
background-color: rgba(140, 140, 140, 0.5); | ||
} | ||
.resizable .resizers .resizer.top-right { | ||
right: -5px; | ||
top: -5px; | ||
cursor: nesw-resize; | ||
background-color: rgba(140, 140, 140, 0.5); | ||
} | ||
.resizable .resizers .resizer.bottom-left { | ||
left: -5px; | ||
bottom: 5px; | ||
cursor: nesw-resize; | ||
background-color: rgba(140, 140, 140, 0.5); | ||
} | ||
.resizable .resizers .resizer.bottom-right { | ||
right: -5px; | ||
bottom: -5px; | ||
cursor: nwse-resize; | ||
background-color: rgba(140, 140, 140, 0.5); | ||
} | ||
|
||
.resizable .resizers .resizer.mid-left { | ||
|
||
/* left: -5px; | ||
bottom: 5px; */ | ||
top: 40px; | ||
cursor: ew-resize; | ||
|
||
background-color: rgba(140, 140, 140, 0.5); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.