Explorar o código

调整dashboard表格固定显示格式;修正guests_boot_jobs,guest_status_format bug

James Iter %!s(int64=8) %!d(string=hai) anos
pai
achega
a5f0d3c2ca

+ 3 - 1
docs/todo.md

@@ -42,8 +42,10 @@
 - [ ] 初始化页面检测redis、mysql是否准备好
 - [ ] 允许删除创建失败的虚拟机
 - [ ] 日志里面加入操作轨迹
-- [ ] 日志实现简短字段及详情字段,详情字段用text,存储完整的日志文本。因为日志太长,无法在简短日志字段存放完整。
+- [x] 日志实现简短字段及详情字段,详情字段用text,存储完整的日志文本。因为日志太长,无法在简短日志字段存放完整。
 - [x] 修改密码功能
 - [ ] 密码[找回|重置]功能
 - [ ] 前端页面校验字段有效值
 - [ ] 当计算节点离线时,计算节点页面显示,清除离线计算节点显示的倒计时
+- [ ] 系统模板加入是否为Windows类系统的标记
+- [ ] 系统模板为 Windows 时,时钟偏移值设定为 localtime,否则为 utc

+ 14 - 1
models/guest_xml.py

@@ -25,9 +25,12 @@ class GuestXML(object):
         self.config = config
 
     def get_domain(self):
+        # clock 参考链接:https://libvirt.org/formatdomain.html#elementsTime
+        # Windows Guest 设为 localtime,非 Windows Guest 都设为 utc
         return """<?xml version="1.0" encoding="utf-8"?>
             <domain type="kvm">
             {0}
+            <clock offset='utc'/>
             {1}
             {2}
             {3}
@@ -76,8 +79,9 @@ class GuestXML(object):
                 {1}
                 {2}
                 {3}
+                {4}
             </devices>
-        """.format(self.get_interface(), self.get_disk(), self.get_graphics(), self.get_console())
+        """.format(self.get_interface(), self.get_disk(), self.get_graphics(), self.get_console(), self.get_channel())
 
     def get_interface(self):
         return """
@@ -140,3 +144,12 @@ class GuestXML(object):
             </console>
         """
 
+    @staticmethod
+    def get_channel():
+        return """
+            <channel type='unix'>
+                <source mode='bind'/>
+                <target type='virtio' name='org.qemu.guest_agent.0'/>
+            </channel>
+        """
+

+ 1 - 1
static/elements/tables.css

@@ -55,7 +55,7 @@
   
   .table-hover tr:hover td {
       color: #000;
-      background: #fffdf4;
+      background: #fafaff;
   }
   /* Bordered */
   

+ 5 - 5
templates/dashboard.html

@@ -111,7 +111,7 @@
                             CPU
                         </h3>
                         <div class="content-box-wrapper" style="padding-top: 0;">
-                            <table class="table mrg0B mrg10T">
+                            <table class="table mrg0B mrg10T" style="table-layout: fixed;">
                                 <thead>
                                 <tr>
                                     <td style="width: 65%;">实例</td>
@@ -223,7 +223,7 @@
                             网络流量
                         </h3>
                         <div class="content-box-wrapper" style="padding-top: 0;">
-                            <table class="table mrg0B mrg10T">
+                            <table class="table mrg0B mrg10T" style="table-layout: fixed;">
                                 <thead>
                                 <tr>
                                     <td style="width: 65%;">实例</td>
@@ -277,7 +277,7 @@
                             CPU
                         </h3>
                         <div class="content-box-wrapper" style="padding-top: 0;">
-                            <table class="table mrg0B mrg10T">
+                            <table class="table mrg0B mrg10T" style="table-layout: fixed;">
                                 <thead>
                                 <tr>
                                     <td style="width: 65%;">实例</td>
@@ -387,7 +387,7 @@
                             网络流量
                         </h3>
                         <div class="content-box-wrapper" style="padding-top: 0;">
-                            <table class="table mrg0B mrg10T">
+                            <table class="table mrg0B mrg10T" style="table-layout: fixed;">
                                 <thead>
                                 <tr>
                                     <td style="width: 65%;">实例</td>
@@ -428,7 +428,7 @@
                             内存使用率
                         </h3>
                         <div class="content-box-wrapper" style="padding-top: 0;">
-                            <table class="table mrg0B mrg10T">
+                            <table class="table mrg0B mrg10T" style="table-layout: fixed;">
                                 <thead>
                                 <tr>
                                     <td style="width: 65%;">实例</td>

+ 1 - 1
templates/disks_show.html

@@ -53,7 +53,7 @@
         .tr-selected td,
         .tr-selected {
             color: #000 !important;
-            background: #fffdf4 !important;
+            background: #fafaff !important;
         }
     </style>
 

+ 2 - 2
templates/guests_boot_jobs.html

@@ -43,7 +43,7 @@
         .tr-selected td,
         .tr-selected {
             color: #000 !important;
-            background: #fffdf4 !important;
+            background: #fafaff !important;
         }
     </style>
 
@@ -296,7 +296,7 @@
                             </div>
                         </td>
                         <td><span class="{{ os_templates_mapping_by_id[guests_mapping_by_uuid[uuid].os_template_id].icon }}"></span></td>
-                        <td>{{ format_guest_status(guests_mapping_by_uuid[uuid].status)|safe }}</td>
+                        <td>{{ format_guest_status(guests_mapping_by_uuid[uuid].status, guests_mapping_by_uuid[uuid].progress)|safe }}</td>
                         <td>{{ guests_mapping_by_uuid[uuid].ip }}</td>
                         <td>
                             <div class="dropdown inline-block">

+ 1 - 1
templates/guests_show.html

@@ -53,7 +53,7 @@
         .tr-selected td,
         .tr-selected {
             color: #000 !important;
-            background: #fffdf4 !important;
+            background: #fafaff !important;
         }
 
         .dropdown-menu {

+ 1 - 1
templates/os_templates_show.html

@@ -63,7 +63,7 @@
         .tr-selected td,
         .tr-selected {
             color: #000 !important;
-            background: #fffdf4 !important;
+            background: #fafaff !important;
         }
     </style>