소스 검색

feat:修改不同的标题主题

zhaohaipeng 5 일 전
부모
커밋
34c79de3c1
1개의 변경된 파일6개의 추가작업 그리고 1개의 파일을 삭제
  1. 6 1
      monitor/supply_workflow_monitor.py

+ 6 - 1
monitor/supply_workflow_monitor.py

@@ -22,6 +22,9 @@ column_width_map = {
     "记录数": "80px",
 }
 
+header_template = ["blue", "wathet", "turquoise", "green", "yellow", "orange"]
+header_template_index = 0
+
 
 def build_table_json(df: pandas.DataFrame, title: str) -> Dict[str, Any]:
     columns = []
@@ -43,7 +46,7 @@ def build_table_json(df: pandas.DataFrame, title: str) -> Dict[str, Any]:
             "title": {
                 "content": title
             },
-            "template": "green",
+            "template": header_template[header_template_index % len(header_template)],
         },
         "body": {
             "elements": [
@@ -203,12 +206,14 @@ def workflow_status_stat(ts: int, workflow_id: str, workflow_name: str):
 
 
 def main():
+    global header_template_index
     today_midnight = datetime.now().replace(hour=0, minute=0, second=0, microsecond=0)
     timestamp_ms = int(today_midnight.timestamp() * 1000)
     workflows = mysql_helper.execute_query('select id, name from supply_workflow;')
     for workflow in workflows:
         task_exe_step_stat(timestamp_ms, workflow['id'], workflow['name'])
         workflow_status_stat(timestamp_ms, workflow['id'], workflow['name'])
+        header_template_index = header_template_index + 1
 
 
 if __name__ == '__main__':