-- coding: utf-8 --
import json
import os
from datetime import datetime
from datetime import date
from string import split
import requests
import xlrd
from django.db.models import Q
from django.http import JsonResponse, HttpResponse
from common.mymako import render_mako_context
from common.mymako import render_json
from conf.default import APP_ID, APP_TOKEN, BK_PAAS_HOST
from home_application.esb_helper import cc_search_biz, cc_search_set, run_fast_execute_script, cc_search_host,
get_job_instance_log, get_host_ip_list, cc_get_job_detail, run_execute_job, cc_fast_push_file, get_all_user
from models import CheckTemplate, CheckTask, CheckResult, CheckDetail, Test, ExamResult, ZdSx, DBManager, HostInfo
def home(request):
“”"
首页
“”"
id = request.GET.get(‘id’)
return render_mako_context(request, ‘/home_application/home.html’, {“id”: id})
def dev_guide(request):
“”"
开发指引
“”"
return render_mako_context(request, ‘/home_application/dev_guide.html’)
def contactus(request):
“”"
联系我们
“”"
return render_mako_context(request, ‘/home_application/contact.html’)
def check_task(request):
“”"
巡检任务
“”"
id = request.GET.get(‘id’)
return render_mako_context(request, ‘/home_application/check_task.html’, {“id”: id})
def template(request):
“”"
巡检模板
“”"
return render_mako_context(request, ‘/home_application/template.html’)
def check_message(request):
“”"
巡检模板
“”"
return render_mako_context(request, ‘/home_application/check_message.html’)
def exam(request):
“”"
考试
“”"
return render_mako_context(request, ‘/home_application/exam.html’)
def form(request):
“”"
图表
“”"
return render_mako_context(request, ‘/home_application/form.html’)
def test1(request):
“”"
联系1
“”"
return render_mako_context(request, ‘/home_application/test1.html’)
def DB_manage(request):
“”"
联系1
“”"
return render_mako_context(request, ‘/home_application/DB_manage.html’)
def beikao(request):
“”"
备考前端页面
“”"
return render_mako_context(request, ‘/home_application/aaa.html’)
def modal(request):
“”"
测试
“”"
return render_mako_context(request, ‘/home_application/modal.html’)
def getJson(request):
data = [
{‘time’: ‘1月1日’, ‘cpu’: 89.3, ‘men’: 96.4, ‘disk’: 88},
{‘time’: ‘1月2日’, ‘cpu’: 79.3, ‘men’: 88.4, ‘disk’: 78},
{‘time’: ‘1月3日’, ‘cpu’: 88.3, ‘men’: 78.4, ‘disk’: 84},
{‘time’: ‘1月4日’, ‘cpu’: 78.3, ‘men’: 63.4, ‘disk’: 76},
{‘time’: ‘1月5日’, ‘cpu’: 74.3, ‘men’: 94.4, ‘disk’: 79},
{‘time’: ‘1月6日’, ‘cpu’: 85.3, ‘men’: 87.4, ‘disk’: 98}
]
return render_json({“result”: True, “data”: data})
返回echarts 图标拼接格式数据
series 下面的type 表示需要渲染哪种图表类型
line:折线图 bar:柱状图
def getEchartsJson(request):
data = {
“xAxis”: [“1月”, “2月”, “3月”, “4月”, “5月”, “6月”, “7月”, “8月”, “9月”, “10月”, “11月”, “12月”],
“series”: [
{
“name”: “cpu”,
“type”: “line”,
“data”: [2.0, 4.9, 7.0, 23.2, 25.6, 76.7, 135.6, 162.2, 32.6, 20.0, 6.4, 3.3]
},
{
“name”: “men”,
“type”: “line”,
“data”: [3.6, 6.9, 8.0, 21.4, 23.7, 78.7, 165.6, 152.2, 68.7, 28.8, 7.0, 8.3]
},
{
“name”: “disk”,
“type”: “bar”,
“data”: [2.6, 5.9, 9.0, 26.4, 28.7, 70.7, 175.6, 182.2, 48.7, 18.8, 6.0, 2.3]
}
]
}
return render_json({“result”: True, “data”: data})
该方法一般不作修改
def search_set(request):
“”"
传递参数
:param 业务id biz_id
: