mirror of
https://github.com/45Drives/cockpit-navigator.git
synced 2025-07-30 09:05:23 +02:00
finish adding param typedefs for new functions
This commit is contained in:
parent
901fe71119
commit
db463c265a
@ -405,7 +405,14 @@ class NavFile extends NavEntry {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class NavFileLink extends NavFile{
|
class NavFileLink extends NavFile{
|
||||||
constructor(/*string or array*/ path, /*dict*/ stat, nav_window_ref, link_target) {
|
/**
|
||||||
|
*
|
||||||
|
* @param {string} path
|
||||||
|
* @param {object} stat
|
||||||
|
* @param {NavWindow} nav_window_ref
|
||||||
|
* @param {string} link_target
|
||||||
|
*/
|
||||||
|
constructor(path, stat, nav_window_ref, link_target) {
|
||||||
super(path, stat, nav_window_ref);
|
super(path, stat, nav_window_ref);
|
||||||
var link_icon = this.dom_element.nav_item_icon.link_icon = document.createElement("i");
|
var link_icon = this.dom_element.nav_item_icon.link_icon = document.createElement("i");
|
||||||
link_icon.classList.add("fas", "fa-link", "nav-item-symlink-symbol-file");
|
link_icon.classList.add("fas", "fa-link", "nav-item-symlink-symbol-file");
|
||||||
@ -413,10 +420,16 @@ class NavFileLink extends NavFile{
|
|||||||
this.double_click = false;
|
this.double_click = false;
|
||||||
this.link_target = link_target;
|
this.link_target = link_target;
|
||||||
}
|
}
|
||||||
|
|
||||||
show_properties() {
|
show_properties() {
|
||||||
var extra_properties = property_entry_html("Link Target", this.link_target);
|
var extra_properties = property_entry_html("Link Target", this.link_target);
|
||||||
super.show_properties(extra_properties);
|
super.show_properties(extra_properties);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @returns {string}
|
||||||
|
*/
|
||||||
get_link_target_path() {
|
get_link_target_path() {
|
||||||
var target = "";
|
var target = "";
|
||||||
if(this.link_target.charAt(0) === '/')
|
if(this.link_target.charAt(0) === '/')
|
||||||
@ -425,6 +438,7 @@ class NavFileLink extends NavFile{
|
|||||||
target = "/" + this.parent_dir().join("/") + "/" + this.link_target;
|
target = "/" + this.parent_dir().join("/") + "/" + this.link_target;
|
||||||
return target;
|
return target;
|
||||||
}
|
}
|
||||||
|
|
||||||
async show_edit_file_contents() {
|
async show_edit_file_contents() {
|
||||||
for (let button of document.getElementsByTagName("button")) {
|
for (let button of document.getElementsByTagName("button")) {
|
||||||
if (!button.classList.contains("editor-btn"))
|
if (!button.classList.contains("editor-btn"))
|
||||||
@ -447,6 +461,7 @@ class NavFileLink extends NavFile{
|
|||||||
document.getElementById("nav-contents-view").style.display = "none";
|
document.getElementById("nav-contents-view").style.display = "none";
|
||||||
document.getElementById("nav-edit-contents-view").style.display = "flex";
|
document.getElementById("nav-edit-contents-view").style.display = "flex";
|
||||||
}
|
}
|
||||||
|
|
||||||
async write_to_file() {
|
async write_to_file() {
|
||||||
var target_path = this.get_link_target_path();
|
var target_path = this.get_link_target_path();
|
||||||
var new_contents = document.getElementById("nav-edit-contents-textarea").value;
|
var new_contents = document.getElementById("nav-edit-contents-textarea").value;
|
||||||
@ -556,7 +571,7 @@ class NavDir extends NavEntry {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @returns {any}
|
* @returns {Object}
|
||||||
*/
|
*/
|
||||||
async cephfs_dir_stats() {
|
async cephfs_dir_stats() {
|
||||||
try {
|
try {
|
||||||
@ -569,7 +584,12 @@ class NavDir extends NavEntry {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
async show_properties(/*string*/ extra_properties = "") {
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {string} extra_properties
|
||||||
|
*/
|
||||||
|
async show_properties(extra_properties = "") {
|
||||||
if(!this.hasOwnProperty("ceph_stats"))
|
if(!this.hasOwnProperty("ceph_stats"))
|
||||||
this.ceph_stats = await this.cephfs_dir_stats();
|
this.ceph_stats = await this.cephfs_dir_stats();
|
||||||
// See if a JSON object exists for folder we are currently looking at
|
// See if a JSON object exists for folder we are currently looking at
|
||||||
@ -614,7 +634,14 @@ class NavDir extends NavEntry {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class NavDirLink extends NavDir{
|
class NavDirLink extends NavDir{
|
||||||
constructor(/*string or array*/ path, /*dict*/ stat, nav_window_ref, /*string*/ link_target) {
|
/**
|
||||||
|
*
|
||||||
|
* @param {string|string[]} path
|
||||||
|
* @param {object} stat
|
||||||
|
* @param {NavWindow} nav_window_ref
|
||||||
|
* @param {string} link_target
|
||||||
|
*/
|
||||||
|
constructor(path, stat, nav_window_ref, link_target) {
|
||||||
super(path, stat, nav_window_ref);
|
super(path, stat, nav_window_ref);
|
||||||
var link_icon = this.dom_element.nav_item_icon.link_icon = document.createElement("i");
|
var link_icon = this.dom_element.nav_item_icon.link_icon = document.createElement("i");
|
||||||
link_icon.classList.add("fas", "fa-link", "nav-item-symlink-symbol-dir");
|
link_icon.classList.add("fas", "fa-link", "nav-item-symlink-symbol-dir");
|
||||||
@ -622,6 +649,7 @@ class NavDirLink extends NavDir{
|
|||||||
this.double_click = false;
|
this.double_click = false;
|
||||||
this.link_target = link_target;
|
this.link_target = link_target;
|
||||||
}
|
}
|
||||||
|
|
||||||
async rm() {
|
async rm() {
|
||||||
var proc = cockpit.spawn(
|
var proc = cockpit.spawn(
|
||||||
["rm", "-f", this.path_str()],
|
["rm", "-f", this.path_str()],
|
||||||
@ -632,6 +660,7 @@ class NavDirLink extends NavDir{
|
|||||||
});
|
});
|
||||||
await proc;
|
await proc;
|
||||||
}
|
}
|
||||||
|
|
||||||
show_properties() {
|
show_properties() {
|
||||||
var extra_properties = property_entry_html("Link Target", this.link_target);
|
var extra_properties = property_entry_html("Link Target", this.link_target);
|
||||||
super.show_properties(extra_properties);
|
super.show_properties(extra_properties);
|
||||||
@ -730,7 +759,7 @@ class NavWindow {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param {any} entry
|
* @param {NavEntry} entry
|
||||||
*/
|
*/
|
||||||
set_selected(entry) {
|
set_selected(entry) {
|
||||||
this.hide_edit_selected();
|
this.hide_edit_selected();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user