luci-app-diskman: bump to v0.2.9
This commit is contained in:
parent
5d04487ee5
commit
98357774a9
@ -1,7 +1,7 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-diskman
|
||||
PKG_VERSION:=v0.2.8
|
||||
PKG_VERSION:=v0.2.9
|
||||
PKG_RELEASE:=beta
|
||||
PKG_MAINTAINER:=lisaac <https://github.com/lisaac/luci-app-diskman>
|
||||
PKG_LICENSE:=AGPL-3.0
|
||||
|
||||
@ -51,7 +51,7 @@ function format_partition()
|
||||
local dm = require "luci.model.diskman"
|
||||
code, msg = dm.format_partition(partation_name, fs)
|
||||
luci.http.status(code, msg)
|
||||
luci.http.write_json({msg})
|
||||
luci.http.write_json(msg)
|
||||
end
|
||||
|
||||
function get_disk_info(dev)
|
||||
|
||||
@ -196,7 +196,7 @@ if not disk_info.p_table:match("Raid") then
|
||||
if disk_info.partitions[section].mount_point == "-" and disk_info.partitions[section].number ~= -1 and disk_info.partitions[section].type ~= "extended" then
|
||||
self.template = "diskman/cbi/format_button"
|
||||
self.inputstyle = "reset"
|
||||
self.inputtitle = disk_info.partitions[section].fs:match("^%s+$") and "Format" or disk_info.partitions[section].fs
|
||||
self.inputtitle = disk_info.partitions[section].fs:match("^%s+$") and translate("Format") or disk_info.partitions[section].fs
|
||||
Button.render(self, section, scope)
|
||||
-- self:reset_values()
|
||||
-- self.keylist = {}
|
||||
|
||||
@ -455,7 +455,7 @@ d.get_format_cmd = function()
|
||||
ext2 = { cmd = "mkfs.ext2", option = "-F -E lazy_itable_init=1" },
|
||||
ext3 = { cmd = "mkfs.ext3", option = "-F -E lazy_itable_init=1" },
|
||||
ext4 = { cmd = "mkfs.ext4", option = "-F -E lazy_itable_init=1" },
|
||||
fat32 = { cmd = "mkfs.fat", option = "-F 32 -I" },
|
||||
fat32 = { cmd = "mkfs.vfat", option = "-F" },
|
||||
exfat = { cmd = "mkexfat", option = "-f" },
|
||||
hfsplus = { cmd = "mkhfs", option = "-f" },
|
||||
ntfs = { cmd = "mkntfs", option = "-f" },
|
||||
@ -717,12 +717,12 @@ end
|
||||
d.format_partition = function(partition, fs)
|
||||
local partition_name = "/dev/".. partition
|
||||
if not nixio.fs.access(partition_name) then
|
||||
return 500, translate("Partition NOT found!")
|
||||
return 500, "Partition NOT found!"
|
||||
end
|
||||
|
||||
local format_cmd = d.get_format_cmd()
|
||||
if not format_cmd[fs] then
|
||||
return 500, translate("Filesystem NOT support!")
|
||||
return 500, "Filesystem NOT support!"
|
||||
end
|
||||
local cmd = format_cmd[fs].cmd .. " " .. format_cmd[fs].option .. " " .. partition_name
|
||||
local res = luci.util.exec(cmd .. " 2>&1")
|
||||
|
||||
@ -64,7 +64,7 @@
|
||||
btn_p_table.onchange = function () {
|
||||
let btn_p_table_index = btn_p_table.selectedIndex
|
||||
if (btn_p_table_index != btn_p_table_raw_index) {
|
||||
if (confirm("Warnning !! \nTHIS WILL OVERWRITE EXISTING PARTITIONS!! \nModify the partition table?")) {
|
||||
if (confirm("<%:Warnning !! \nTHIS WILL OVERWRITE EXISTING PARTITIONS!! \nModify the partition table?%>")) {
|
||||
let p_table = btn_p_table.options[btn_p_table_index].value
|
||||
XHR.get('<%=luci.dispatcher.build_url("admin/system/diskman/mk_p_table")%>', { dev: val_name, p_table: p_table }, (x, res) => {
|
||||
if (res.code == 0) {
|
||||
@ -89,22 +89,38 @@
|
||||
}
|
||||
function do_format(partation_name){
|
||||
let fs = document.getElementById("filesystem_list").value
|
||||
let status = document.getElementById("format-status")
|
||||
if(!fs) {
|
||||
status.innerHTML = "<%:Please select file system!%>"
|
||||
return
|
||||
}
|
||||
status.innerHTML = "<%:Formatting..%>"
|
||||
let b = document.getElementById('btn_format')
|
||||
b.disabled = true
|
||||
let xhr = new XHR()
|
||||
xhr.post('<%=luci.dispatcher.build_url("admin/system/diskman/format_partition")%>', { partation_name: partation_name, file_system: fs }, (x, res) => {
|
||||
if (x.status == 200) {
|
||||
status.innerHTML = x.statusText
|
||||
location.reload();
|
||||
}else{
|
||||
status.innerHTML = x.statusText
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function clear_text(){
|
||||
let s = document.getElementById('format-status')
|
||||
s.innerHTML = ""
|
||||
let b = document.getElementById('btn_format')
|
||||
b.disabled = false
|
||||
}
|
||||
|
||||
function partition_format(partition_name, format_cmd, current_fs){
|
||||
console.log(format_cmd)
|
||||
let list = ''
|
||||
format_cmd.split(",").forEach(e => {
|
||||
list = list + '<option value="'+e+'">'+e+'</option>'
|
||||
});
|
||||
console.log(partition_name)
|
||||
document.getElementById('dialog_format') || document.body.insertAdjacentHTML("beforeend", '<div id="dialog_format"><div class="dialog_box"><div class="dialog_line"></div><div class="dialog_line"><span><%:Format partation:%> <b>'+partition_name+'</b></span><br><spanid="cmd-line-status"></span></div><div class="dialog_line"><select id="filesystem_list" class="cbi-input-select">'+list+'</select></div><div class="dialog_line" style="text-align: right;"><input type="button" class="cbi-button cbi-button-apply"type="submit" value="<%:Format%>" onclick="do_format(`'+partition_name+'`)" /> <input type="button"class="cbi-button cbi-button-reset" type="reset" value="<%:Cancel%>" onclick="close_dialog()" /></div><div class="dialog_line"></div></div></div>>')
|
||||
document.getElementById('dialog_format') || document.body.insertAdjacentHTML("beforeend", '<div id="dialog_format"><div class="dialog_box"><div class="dialog_line"></div><div class="dialog_line"><span><%:Format partation:%> <b>'+partition_name+'</b></span><br><span id="format-status" style="color: red;"></span></div><div class="dialog_line"><select id="filesystem_list" class="cbi-input-select" onchange="clear_text()">'+list+'</select></div><div class="dialog_line" style="text-align: right;"><input type="button" class="cbi-button cbi-button-apply" id="btn_format" type="submit" value="<%:Format%>" onclick="do_format(`'+partition_name+'`)" /> <input type="button"class="cbi-button cbi-button-reset" type="reset" value="<%:Cancel%>" onclick="close_dialog()" /></div><div class="dialog_line"></div></div></div>>')
|
||||
document.body.classList.add('dialog-format-active')
|
||||
document.documentElement.style.overflowY = 'hidden'
|
||||
let fs_list = document.getElementById("filesystem_list")
|
||||
|
||||
@ -228,3 +228,12 @@ msgstr "分区不存在!"
|
||||
|
||||
msgid "Creation"
|
||||
msgstr "创建"
|
||||
|
||||
msgid "Please select file system!"
|
||||
msgstr "请选择文件系统!"
|
||||
|
||||
msgid "Format partation:"
|
||||
msgstr "格式化分区:"
|
||||
|
||||
msgid "Warnning !! \nTHIS WILL OVERWRITE EXISTING PARTITIONS!! \nModify the partition table?"
|
||||
msgstr "警告!!\n此操作会覆盖现有分区\n确定修改分区表?"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user