Skip to content

Commit

Permalink
Translate new page
Browse files Browse the repository at this point in the history
  • Loading branch information
rafa0128 committed Oct 31, 2023
1 parent fdaef9b commit 2041fd2
Show file tree
Hide file tree
Showing 9 changed files with 130 additions and 30 deletions.
4 changes: 4 additions & 0 deletions webmeter/core/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ def write_JmeterFile(cls, file, content) -> None:
file_path = os.path.join(cls.JMETER_DIR, 'bin', file)
Common.write_file_content(file_path, content)

@classmethod
def remote_hosts(cls):
pass


@classmethod
def run(cls, content: dict, remote=False) -> int:
Expand Down
1 change: 1 addition & 0 deletions webmeter/core/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from enum import Enum, unique
import platform
import psutil
import time
from loguru import logger
from xml.etree import ElementTree
from typing import Optional
Expand Down
38 changes: 38 additions & 0 deletions webmeter/static/js/lan.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,25 @@ const ENGLISH = {
'browser_compatible_headers': 'Browser-compatible headers',
'parameters': 'Parameters',
'body_data': 'Body Data',
'task':'Task',
'plan':'Plan',
'model':'Model',
'threads':'Threads',
'success_num':'Success Num',
'fail_num':'Fail Num',
'status':'Status',
'start_time':'Start Time',
'end_time':'End Time',
'jmeter_config': 'JMETER CONFIG',
'dashboard': 'Dashboard',
'charts':'Charts',
'test_and_report_info': 'Test and Report information',
'requests_summary':'Requests Summary',
'statistics':'Statistics',
'response_times_over_time':'Response Times Over Time (ms)',
'latencies_over_time': 'Latencies Over Time (ms)',
'connect_time_over_time':'Connect Time Over Time (ms)',
'screenshot':'ScreenShot'

}

Expand Down Expand Up @@ -117,4 +136,23 @@ const CHINESE = {
'browser_compatible_headers': '与浏览器兼容的头',
'parameters': '参数',
'body_data': '消息体数据',
'task':'任务',
'plan':'测试计划',
'model':'模式',
'threads':'线程数',
'success_num':'成功数',
'fail_num':'失败数',
'status':'状态',
'start_time':'开始时间',
'end_time':'结束时间',
'jmeter_config': 'JMETER配置文件',
'dashboard': '汇总',
'charts':'图表',
'test_and_report_info': '测试和报告数据信息',
'requests_summary':'请求详细',
'statistics':'统计',
'response_times_over_time':'响应时间(毫秒)',
'latencies_over_time': '延迟时间(毫秒)',
'connect_time_over_time':'连接时间(毫秒)',
'screenshot':'截图'
}
18 changes: 9 additions & 9 deletions webmeter/templates/analysis.html
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ <h2 class="page-title">
<div class="btn-list">
<a class="btn" @click="screenShot('sceen-body', 'analysis.png')">
<svg t="1694597731524" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="51115" width="320" height="320"><path d="M0 0h1024v1024H0z" fill="#F5F5F5" fill-opacity=".01" p-id="51116"></path><path d="M316.94848 57.77408v30.72H121.89696c-17.46944 0-31.80544 13.43488-33.28 30.5152l-0.12288 2.88768v195.05152h-30.72V121.89696a64.12288 64.12288 0 0 1 60.49792-64.02048l3.62496-0.1024h195.05152z" fill="#14142B" p-id="51117"></path><path d="M175.53408 184.32m40.96 0l737.28 0q40.96 0 40.96 40.96l0 737.28q0 40.96-40.96 40.96l-737.28 0q-40.96 0-40.96-40.96l0-737.28q0-40.96 40.96-40.96Z" fill="#FF6600" opacity=".1" p-id="51118"></path><path d="M88.49408 707.05152v195.05152c0 17.46944 13.43488 31.80544 30.5152 33.28l2.88768 0.12288h195.05152v30.72H121.89696a64.12288 64.12288 0 0 1-64.02048-60.49792l-0.1024-3.62496v-195.05152h30.72zM966.22592 707.05152v195.05152a64.12288 64.12288 0 0 1-60.49792 64.02048l-3.62496 0.1024h-195.05152v-30.72h195.05152c17.46944 0 31.80544-13.43488 33.28-30.5152l0.12288-2.88768v-195.05152h30.72zM902.10304 57.77408a64.12288 64.12288 0 0 1 64.02048 60.49792l0.1024 3.62496v195.05152h-30.72V121.89696c0-17.46944-13.43488-31.80544-30.5152-33.28l-2.88768-0.12288h-195.05152v-30.72h195.05152zM593.36704 277.21728h-162.73408l-48.7424 73.1136-153.43616 0.02048v396.43136h567.0912V350.35136h-153.45664l-48.7424-73.13408z m-146.30912 30.72h129.8432l48.78336 73.13408h139.12064v334.97088h-505.6512V381.05088l139.1616 0.02048 48.7424-73.15456z" fill="#14142B" p-id="51119"></path><path d="M512 447.87712a88.49408 88.49408 0 1 0 0 177.00864 88.49408 88.49408 0 0 0 0-177.00864z m0 30.72a57.77408 57.77408 0 1 1 0 115.56864 57.77408 57.77408 0 0 1 0-115.56864z" fill="#14142B" p-id="51120"></path></svg>
ScreenShot
<label v-text="language.screenshot"></label>
</a>
</div>
</div>
Expand All @@ -120,10 +120,10 @@ <h2 class="page-title">
<div class="page-body">
<div class="container-xl">
<el-tabs v-model="activeTab" type="card" class="analysis-tabs">
<el-tab-pane label="Dashboard" name="dashboard">
<el-tab-pane :label="language.dashboard" name="dashboard">
<div class="card">
<div class="card-header">
<h3 class="card-title">Test and Report information</h3>
<h3 class="card-title" v-text="language.test_and_report_info"></h3>
</div>
<div class="card-body">
<div class="card">
Expand Down Expand Up @@ -151,7 +151,7 @@ <h3 class="card-title">Test and Report information</h3>

<div class="card mt-3" style="max-height: 28rem;">
<div class="card-header">
<h3 class="card-title">Requests Summary</h3>
<h3 class="card-title" v-text="language.requests_summary"></h3>
</div>
<div class="card-body card-body-scrollable card-body-scrollable-shadow">
<div class="card">
Expand Down Expand Up @@ -188,7 +188,7 @@ <h3 class="card-title">Requests Summary</h3>
</div>
<div class="card mt-3">
<div class="card-header">
<h3 class="card-title">Statistics</h3>
<h3 class="card-title" v-text="language.statistics"></h3>
</div>
<div class="card-body">
<div class="table-responsive">
Expand Down Expand Up @@ -232,10 +232,10 @@ <h3 class="card-title">Statistics</h3>
</div>
</div>
</el-tab-pane>
<el-tab-pane label="Charts" name="charts">
<el-tab-pane :label="language.charts" name="charts">
<div class="card response-time-card">
<div class="card-header">
<div class='card-title'>Response Times Over Time (ms)</div>
<div class='card-title' v-text="language.response_times_over_time"></div>
<div class="card-actions btn-actions">
<a class="btn-action cursor-pointer" @click="initResponseOverTimeChart()">
<svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M20 11a8.1 8.1 0 0 0 -15.5 -2m-.5 -4v4h4" /><path d="M4 13a8.1 8.1 0 0 0 15.5 2m.5 4v-4h-4" /></svg>
Expand All @@ -251,7 +251,7 @@ <h3 class="card-title">Statistics</h3>
</div>
<div class="card latency-time-card mt-3">
<div class="card-header">
<div class='card-title'>Latencies Over Time (ms)</div>
<div class='card-title' v-text="language.latencies_over_time"></div>
<div class="card-actions btn-actions">
<a class="btn-action cursor-pointer" @click="initLatencyOverTimeChart()">
<svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M20 11a8.1 8.1 0 0 0 -15.5 -2m-.5 -4v4h4" /><path d="M4 13a8.1 8.1 0 0 0 15.5 2m.5 4v-4h-4" /></svg>
Expand All @@ -267,7 +267,7 @@ <h3 class="card-title">Statistics</h3>
</div>
<div class="card connect-time-card mt-3">
<div class="card-header">
<div class='card-title'>Connect Time Over Time (ms)</div>
<div class='card-title' v-text="language.connect_time_over_time"></div>
<div class="card-actions btn-actions">
<a class="btn-action cursor-pointer" @click="initConnectOverTimeChart()">
<svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M20 11a8.1 8.1 0 0 0 -15.5 -2m-.5 -4v4h4" /><path d="M4 13a8.1 8.1 0 0 0 15.5 2m.5 4v-4h-4" /></svg>
Expand Down
21 changes: 12 additions & 9 deletions webmeter/templates/config.html
Original file line number Diff line number Diff line change
Expand Up @@ -90,29 +90,32 @@ <h1 class="navbar-brand navbar-brand-autodark d-none-navbar-horizontal pe-0 pe-m
<div class="row g-0">
<div class="col-2 d-none d-md-block border-end">
<div class="card-header d-none d-md-block">
<strong>JMETER CONFIG</strong>
<strong v-text="language.jmeter_config"></strong>
</div>
<div class="card-body scrollable">
{% if platform == 'windows' %}
<div class="btn-group-vertical w-100 mb-2 "role="group">
<input type="radio" class="btn-check" id="jmeter_bat" name="btn-radio-vertical" checked="true" @click="getJmeterFileContent('jmeter.bat')">
<label type="button" class="btn" for="jmeter_bat">jmeter.bat</label>
</div>
<div class="btn-group-vertical w-100 mb-2 "role="group">
<input type="radio" class="btn-check" id="jmeter_sh" name="btn-radio-vertical" @click="getJmeterFileContent('jmeter.sh')">
<label type="button" class="btn" for="jmeter_sh">jmeter.sh</label>
</div>
<div class="btn-group-vertical w-100 mb-2 "role="group">
<input type="radio" class="btn-check" id="jmeter.properties" name="btn-radio-vertical" @click="getJmeterFileContent('jmeter.properties')">
<label type="button" class="btn" for="jmeter.properties">jmeter.properties</label>
</div>
<div class="btn-group-vertical w-100 mb-2 "role="group">
<input type="radio" class="btn-check" id="jmeter-server.bat" name="btn-radio-vertical" @click="getJmeterFileContent('jmeter-server.bat')">
<label type="button" class="btn" for="jmeter-server.bat">jmeter-server.bat</label>
</div>
{% else %}
<div class="btn-group-vertical w-100 mb-2 "role="group">
<input type="radio" class="btn-check" id="jmeter_sh" name="btn-radio-vertical" @click="getJmeterFileContent('jmeter.sh')">
<label type="button" class="btn" for="jmeter_sh">jmeter.sh</label>
</div>
<div class="btn-group-vertical w-100 mb-2 "role="group">
<input type="radio" class="btn-check" id="jmeter-server.sh" name="btn-radio-vertical" @click="getJmeterFileContent('jmeter-server')">
<label type="button" class="btn" for="jmeter-server.sh">jmeter-server</label>
</div>
{% endif %}
<div class="btn-group-vertical w-100 mb-2 "role="group">
<input type="radio" class="btn-check" id="jmeter.properties" name="btn-radio-vertical" @click="getJmeterFileContent('jmeter.properties')">
<label type="button" class="btn" for="jmeter.properties">jmeter.properties</label>
</div>
</div>
</div>
<div class="col d-flex flex-column">
Expand Down
22 changes: 11 additions & 11 deletions webmeter/templates/result.html
Original file line number Diff line number Diff line change
Expand Up @@ -88,28 +88,28 @@ <h1 class="navbar-brand navbar-brand-autodark d-none-navbar-horizontal pe-0 pe-m
<div class="card-header">
<h3 class="card-title">
<svg t="1694480384519" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="48348" width="320" height="320"><path d="M79.677 876.45H876.45v88.53H79.677z" fill="#005CFF" p-id="48349"></path><path d="M684.634 604.957H271.493c-17.706 0-29.51-11.804-29.51-29.51s11.804-29.51 29.51-29.51h413.141c17.706 0 29.51 11.804 29.51 29.51s-14.755 29.51-29.51 29.51z m0 120.991H271.493c-17.706 0-29.51-11.804-29.51-29.51s11.804-29.51 29.51-29.51h413.141c17.706 0 29.51 11.804 29.51 29.51s-14.755 29.51-29.51 29.51z m-35.412-360.023H448.553c-17.706 0-29.51-11.804-29.51-29.51s11.804-29.51 29.51-29.51h200.669c17.706 0 29.51 11.804 29.51 29.51s-11.804 29.51-29.51 29.51z m35.412 120.991H271.493c-17.706 0-29.51-11.804-29.51-29.51s11.804-29.51 29.51-29.51h413.141c17.706 0 29.51 11.804 29.51 29.51s-14.755 29.51-29.51 29.51z" fill="#5CB6FF" p-id="48350"></path><path d="M779.066 994.49h-616.76c-61.972 0-112.139-53.118-112.139-115.09V327.563c0-17.706 5.902-32.461 17.706-44.265L321.66 20.657C333.464 5.902 348.219 0 365.925 0h413.141c61.971 0 112.139 53.118 112.139 115.09v761.36c0 64.922-50.168 118.04-112.139 118.04zM365.926 59.02L109.186 324.611v554.79c0 32.46 23.608 56.069 53.118 56.069h616.761c29.51 0 53.118-26.56 53.118-56.07V115.09c0-32.462-23.608-56.07-53.118-56.07h-413.14z" fill="#424242" p-id="48351"></path><path d="M377.73 56.07l2.95 224.276c0 32.46-23.608 59.02-56.069 59.02l-218.375 2.951" fill="#D9EBF4" p-id="48352"></path><path d="M106.236 371.827v-59.02l218.375-2.951c14.755 0 26.559-14.755 26.559-29.51l-2.951-224.277h59.02l2.951 224.277c0 50.167-38.363 88.53-85.579 91.481H106.236z" fill="#424242" p-id="48353"></path><path d="M472.162 758.41a236.08 236.08 0 1 0 472.16 0 236.08 236.08 0 1 0-472.16 0z" fill="#2488FF" p-id="48354"></path><path d="M708.242 1024c-67.873 0-135.746-26.56-188.864-76.726-103.286-103.286-103.286-271.493 0-374.778 50.167-50.167 118.04-76.727 188.864-76.727s138.697 26.56 188.865 76.727c50.167 50.167 76.726 118.04 76.726 188.864s-26.56 138.698-76.726 188.865C843.988 997.44 776.115 1024 708.242 1024z m0-472.161c-56.07 0-106.236 20.657-144.6 61.97-79.677 79.678-79.677 212.473 0 292.15s212.473 79.678 292.15 0c38.364-38.362 61.972-91.48 61.972-144.599s-20.657-106.236-61.971-144.6c-41.315-44.264-91.482-64.921-147.55-64.921z" fill="#FFFFFF" p-id="48355"></path><path d="M802.674 826.282h-147.55v-147.55c0-17.706 11.804-29.51 29.51-29.51s29.51 11.804 29.51 29.51v88.53h88.53c17.706 0 29.51 11.804 29.51 29.51 0 14.755-11.804 29.51-29.51 29.51z" fill="#FFFFFF" p-id="48356"></path></svg>
TASK
<label v-text="language.task"></label>
</h3>
<div class="card-actions btn-actions">
<button type="button" class="btn btn-default" data-bs-toggle="modal" data-bs-target="#modal-remove-all">
<svg t="1694419660931" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="24583" width="320" height="320"><path d="M512 512m-469.333333 0a469.333333 469.333333 0 1 0 938.666666 0 469.333333 469.333333 0 1 0-938.666666 0Z" fill="#FF6060" p-id="24584"></path><path d="M648.533333 708.266667L315.733333 375.466667c-8.533333-8.533333-8.533333-21.333333 0-29.866667l29.866667-29.866667c8.533333-8.533333 21.333333-8.533333 29.866667 0l332.8 332.8c8.533333 8.533333 8.533333 21.333333 0 29.866667l-29.866667 29.866667c-8.533333 8.533333-21.333333 8.533333-29.866667 0z" fill="#FFFFFF" p-id="24585"></path><path d="M315.733333 648.533333l332.8-332.8c8.533333-8.533333 21.333333-8.533333 29.866667 0l29.866667 29.866667c8.533333 8.533333 8.533333 21.333333 0 29.866667L375.466667 708.266667c-8.533333 8.533333-21.333333 8.533333-29.866667 0l-29.866667-29.866667c-8.533333-8.533333-8.533333-21.333333 0-29.866667z" fill="#FFFFFF" p-id="24586"></path></svg>
Remove All
<label v-text="language.remove_all"></label>
</button>
</a>
</div>
</div>
<div class="table-responsive" style="font-size: 15px;">
<table class="table card-table table-vcenter text-nowrap datatable">
<thead class="text-center">
<th style="font-size: 13px;">PLAN</th>
<th style="font-size: 13px;">TASK</th>
<th style="font-size: 13px;">MODEL</th>
<th style="font-size: 13px;">THREADS</th>
<th style="font-size: 13px;">SUCCESS NUM</th>
<th style="font-size: 13px;">FAILED NUM</th>
<th style="font-size: 13px;">STATUS</th>
<th style="font-size: 13px;">START TIME</th>
<th style="font-size: 13px;">END TIME</th>
<th style="font-size: 13px;" v-text="language.plan"></th>
<th style="font-size: 13px;" v-text="language.task"></th>
<th style="font-size: 13px;" v-text="language.model"></th>
<th style="font-size: 13px;" v-text="language.threads"></th>
<th style="font-size: 13px;" v-text="language.success_num"></th>
<th style="font-size: 13px;" v-text="language.fail_num"></th>
<th style="font-size: 13px;" v-text="language.start_time"></th>
<th style="font-size: 13px;" v-text="language.end_time"></th>
<th style="font-size: 13px;"></th>
<th></th>
</thead>
<tbody v-for="item in taskDatas" :key="item" class="text-center">
Expand Down
4 changes: 3 additions & 1 deletion webmeter/view/page.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from fastapi.responses import RedirectResponse
from fastapi import APIRouter
import os
from core.utils import Common

router = APIRouter()

Expand All @@ -29,4 +30,5 @@ async def result(request: Request, plan: str, task: str):

@router.get("/config", response_class=HTMLResponse)
async def result(request: Request):
return templates.TemplateResponse("config.html", {"request": request})
platform = Common.pc_platform()
return templates.TemplateResponse("config.html", {"request": request, 'platform': platform})
Binary file added webmeter/webmeter/app.db
Binary file not shown.
Loading

0 comments on commit 2041fd2

Please sign in to comment.