mirror of
https://github.com/45Drives/cockpit-navigator.git
synced 2025-07-29 08:34:50 +02:00
add ability to create symlinks
This commit is contained in:
parent
60fe5a3bf5
commit
442470dffd
@ -428,3 +428,14 @@ input:checked + .slider:before {
|
||||
.slider.round:before {
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.nav-icon-decorated {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.nav-icon-decoration {
|
||||
position: absolute;
|
||||
font-size: 60%;
|
||||
top: -10%;
|
||||
left: -30%;
|
||||
}
|
||||
|
@ -54,9 +54,13 @@
|
||||
</select>
|
||||
</datalist>
|
||||
<div class="horizontal-spacer"></div>
|
||||
<button class="pf-c-button pf-m-primary" id="nav-mkdir-btn"><i class="fas fa-folder-plus"></i></button>
|
||||
<div class="horizontal-spacer"></div>
|
||||
<button class="pf-c-button pf-m-primary" id="nav-touch-btn"><i class="fas fa-file-medical"></i></button>
|
||||
<div class="nav-btn-group">
|
||||
<button class="pf-c-button pf-m-primary" id="nav-mkdir-btn"><i class="fas fa-folder-plus"></i></button>
|
||||
<div class="horizontal-spacer"></div>
|
||||
<button class="pf-c-button pf-m-primary" id="nav-touch-btn"><i class="fas fa-file-medical"></i></button>
|
||||
<div class="horizontal-spacer"></div>
|
||||
<button class="pf-c-button pf-m-primary" id="nav-ln-btn"><i class="fas fa-link nav-icon-decorated"><i class="fas fa-plus nav-icon-decoration"></i></i></button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="vertical-spacer"></div>
|
||||
<div class="flex-row inner-container">
|
||||
|
@ -934,6 +934,29 @@ class NavWindow {
|
||||
this.refresh();
|
||||
}
|
||||
|
||||
async ln() {
|
||||
var link_target = window.prompt("Link Target: ");
|
||||
if (link_target === null)
|
||||
return;
|
||||
var link_name = window.prompt("Link Name: ");
|
||||
if (link_name === null)
|
||||
return;
|
||||
if (link_name.includes("/")) {
|
||||
window.alert("Link name can't contain `/`.");
|
||||
return;
|
||||
}
|
||||
var link_path = this.pwd().path_str() + "/" + link_name;
|
||||
var proc = cockpit.spawn(
|
||||
["ln", "-sn", link_target, link_path],
|
||||
{superuser: "try", err: "out"}
|
||||
);
|
||||
proc.fail((e, data) => {
|
||||
window.alert(data);
|
||||
});
|
||||
await proc;
|
||||
this.refresh();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {Event} e
|
||||
@ -1071,6 +1094,7 @@ function set_up_buttons() {
|
||||
document.getElementById("nav-refresh-btn").addEventListener("click", nav_window.refresh.bind(nav_window));
|
||||
document.getElementById("nav-mkdir-btn").addEventListener("click", nav_window.mkdir.bind(nav_window));
|
||||
document.getElementById("nav-touch-btn").addEventListener("click", nav_window.touch.bind(nav_window));
|
||||
document.getElementById("nav-ln-btn").addEventListener("click", nav_window.ln.bind(nav_window));
|
||||
document.getElementById("nav-delete-btn").addEventListener("click", nav_window.delete_selected.bind(nav_window));
|
||||
document.getElementById("nav-edit-properties-btn").addEventListener("click", nav_window.show_edit_selected.bind(nav_window));
|
||||
document.getElementById("nav-cancel-edit-btn").addEventListener("click", nav_window.hide_edit_selected.bind(nav_window));
|
||||
|
Loading…
x
Reference in New Issue
Block a user