From 905a8a195245ca44ca6c92b31b9a95cc8699b71b Mon Sep 17 00:00:00 2001 From: brookshi Date: Fri, 8 Jun 2018 12:49:54 +0800 Subject: [PATCH 1/3] #112 highlight err in table for stress result --- client/src/modules/stress_test/stress_run_diagram.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/client/src/modules/stress_test/stress_run_diagram.tsx b/client/src/modules/stress_test/stress_run_diagram.tsx index a174555..283fc99 100644 --- a/client/src/modules/stress_test/stress_run_diagram.tsx +++ b/client/src/modules/stress_test/stress_run_diagram.tsx @@ -326,7 +326,8 @@ class StressRunDiagram extends React.Component LocalesString.get(`Common.${s}`)).concat(['ErrRatio', 'TestFailed', 'NoResponse', 'ServerError500'].map(s => LocalesString.get(`Stress.${s}`))); - const dataIndexs = ['averageDns', 'averageConnect', 'averageRequest', 'high', 'low', 'stddev', 'p95', 'p90', 'p75', 'p50', 'errRatio', 'testFailed', 'noRes', 'm500']; + const errDataIndexs = ['errRatio', 'testFailed', 'noRes', 'm500']; + const dataIndexs = ['averageDns', 'averageConnect', 'averageRequest', 'high', 'low', 'stddev', 'p95', 'p90', 'p75', 'p50'].concat(errDataIndexs); const keys = Object.keys(runState.stressReqDuration); const dataSource = keys.map(d => { @@ -367,7 +368,7 @@ class StressRunDiagram extends React.Component _.round((text || 0), 2)} + render={(text, record) => this.highlightCellIfNeed(text, errDataIndexs, dataIndexs[i])} />)) } @@ -375,6 +376,10 @@ class StressRunDiagram extends React.Component { + return text > 0 && errDataIndexs.some(e => e === index) ? ({_.round((text || 0), 2)}) : _.round((text || 0), 2); + } + private generateExcel = () => { const { name, runDate } = this.props; var link = document.createElement('a'); From 2825a0c458414b4843825653cb2ac9a4cf031703 Mon Sep 17 00:00:00 2001 From: brookshi Date: Fri, 8 Jun 2018 13:11:32 +0800 Subject: [PATCH 2/3] #197 should not update session while syncing data --- api/controllers/user_controller.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/api/controllers/user_controller.ts b/api/controllers/user_controller.ts index ba10809..2587ff0 100644 --- a/api/controllers/user_controller.ts +++ b/api/controllers/user_controller.ts @@ -42,13 +42,23 @@ export default class UserController extends BaseController { @POST() async login(ctx: Koa.Context, @BodyParam body: DtoUser): Promise { - let checkLogin = await UserService.checkUser(body.email, body.password); + const checkLogin = await this.tryLogin(body); + if (!checkLogin.success) { return checkLogin; } SessionService.login(ctx, (checkLogin.result.user).id); + return checkLogin; + } + + private async tryLogin(user: DtoUser) { + let checkLogin = await UserService.checkUser(user.email, user.password); + if (!checkLogin.success) { + return checkLogin; + } + checkLogin.message = Message.get('userLoginSuccess'); (checkLogin.result.user).password = undefined; @@ -58,7 +68,7 @@ export default class UserController extends BaseController { @GET('/user/me') async getUserInfo(ctx: Koa.Context): Promise { const user = (ctx).session.user; - return await this.login(ctx, user); + return await this.tryLogin(user); } @GET('/user/logout') From c70e4f93f0d7afdd07c1acb7a931da072809d41e Mon Sep 17 00:00:00 2001 From: brookshi Date: Fri, 8 Jun 2018 13:18:24 +0800 Subject: [PATCH 3/3] dynamic bar width --- client/src/modules/stress_test/stress_run_diagram.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/src/modules/stress_test/stress_run_diagram.tsx b/client/src/modules/stress_test/stress_run_diagram.tsx index 283fc99..3e68989 100644 --- a/client/src/modules/stress_test/stress_run_diagram.tsx +++ b/client/src/modules/stress_test/stress_run_diagram.tsx @@ -162,7 +162,7 @@ class StressRunDiagram extends React.Component