]> glassweightruler.freedombox.rocks Git - Ventoy.git/blobdiff - Plugson/www/plugson_persistence.html
Fix the "Unsupported vtoy type unknown" error when boot a VDI file created by Virtual...
[Ventoy.git] / Plugson / www / plugson_persistence.html
index 03d5bea6eae0131e9a4200f1e95dc1685f525530..37359ab81e44fec02885195e37b102e3b2448430 100644 (file)
@@ -1,10 +1,12 @@
 <div class="box box-primary" id="control">\r
     <div class="box-header">\r
-        <div class="col-sm-10" style="padding-top:8px;">\r
+        <div class="col-sm-9" style="padding-top:8px;">\r
             <i class="fa fa-database">&nbsp;&nbsp;</i>\r
             <h1 class="box-title" style="font-weight:bold;" id="id_h1_page_title">x</h1>\r
         </div>\r
-        \r
+        <div class="col-sm-1" style="padding-top:2px;">\r
+          <button id="id_btn_reset" class="btn btn-sm btn-danger btn-del"><i class="fa fa-trash"></i><span id="id_btn_span_reset">Reset</span></button>\r
+        </div>\r
         <div class="col-sm-2" style="font-size:16px;padding-top:8px;">\r
             <a id="id_a_official_doc" target="_blank" href="https://www.ventoy.net/en/plugin_persistence.html"><span class="fa fa-link"></span><span id="id_span_official_doc">官网文档</span></a>\r
         </div>\r
     var value = $(this).val();\r
     var intval;\r
     \r
-    if (id.length <= 16) {\r
+    if (typeof(id) == 'undefined' || id.length <= 16) {\r
       return;\r
     }\r
 \r
     var id = $(this).attr('id');\r
     var checked = $(this).is(':checked');\r
 \r
-    if (id.length <= 14) {\r
+    if (typeof(id) == 'undefined' || id.length <= 14) {\r
       return;\r
     }\r
 \r
 \r
     $('input[type=text]').each(function (){\r
       var id = $(this).attr('id');\r
+      if (typeof(id) == 'undefined') {\r
+        return;\r
+      }\r
       \r
       if (id.startsWith('id_text_timeout_') || id.startsWith('id_text_autosel_')) {\r
         $(this).change(OnInputTextChange);\r
       backend: call_array,\r
       type: type\r
     }, function(e) {\r
-      list.push(data);\r
-      FillPersistenceTable(list);\r
-      Message.success(g_vtoy_cur_language.STR_SAVE_SUCCESS);\r
+      if (e.result === 'success') {\r
+        list.push(data);\r
+        FillPersistenceTable(list);\r
+        Message.success(g_vtoy_cur_language.STR_SAVE_SUCCESS);\r
+      } else if (e.result === 'duplicate') {\r
+        Message.error(g_vtoy_cur_language.STR_DUPLICATE_PATH);\r
+      }\r
     });\r
   }\r
 \r
   $('#id_tab_persistence a[href="#tab_3"]').click(OnClickMultiModeTab);\r
   $('#id_tab_persistence a[href="#tab_4"]').click(OnClickMultiModeTab);\r
   $('#id_tab_persistence a[href="#tab_5"]').click(OnClickMultiModeTab);\r
-\r
+  function UpdateTabTitleIcon(data) {\r
+    CommonUpdateTabTitleIcon(data.exist_persistence, '#id_tab_persistence a[href="#tab_', 'persistence');\r
+  }\r
+  $('#id_btn_reset').click(function() { \r
+    Modal.confirm({msg:GetResetTabConfigTipMsg(current_tab_index, 'persistence')}).on(function(e) {\r
+        if (e) {            \r
+            callVtoySync({\r
+                method : 'persistence_del',\r
+                index: current_tab_index,\r
+                path: g_del_all_path\r
+            }, function(data) {\r
+                \r
+            });\r
+            \r
+            m_data_persistence[current_tab_index].length = 0;\r
+            VtoyFillCurrentPageItem(m_data_persistence[g_vtoy_data_default_index]);\r
+            Message.success(g_vtoy_cur_language.STR_SAVE_SUCCESS);\r
+        }\r
+    });\r
+  });\r
+  \r
   $('#id_tab_persistence a[href="#tab_0"]').tab('show');\r
   VtoyFillCurrentPageItem(m_data_persistence[0]);\r
   VtoyPageLanguageChange(g_current_language);\r