show call time and instance id in bmi page.#246
Conversation
| return roundToOnePrecision(bmi); | ||
|
|
||
| double result = roundToOnePrecision(bmi); | ||
|
|
There was a problem hiding this comment.
apply code style first, the indent should be two spaces instead of four. You can find the code style file at the ServiceComb-Java-Chassis/etc directory.
- For Eclipse IDE: Under Window/Preferences select Java/Code Style/Formatter. Import the settings file by selecting Import and select the
eclipse-java-google-style.xmlfile. - For Intellij IDE: You can refer to http://servicecomb.io/cn/developers/setup-develop-environment/#intellij-idea-配置 .
After import the code style, reformat the code again.
|
|
||
| double result = roundToOnePrecision(bmi); | ||
|
|
||
| MicroserviceInstance name = RegistryUtils.getMicroserviceInstance(); |
There was a problem hiding this comment.
use instance as the variable name may be better than the name.
| MicroserviceInstance name = RegistryUtils.getMicroserviceInstance(); | ||
| String processID = name.getInstanceId().substring(0, 12); | ||
|
|
||
| Date date=new Date(); |
There was a problem hiding this comment.
leave space before and after the equal symbol. This will be done when you reformat the code after importing the code style.
|
|
||
| Date date=new Date(); | ||
| DateFormat format = new SimpleDateFormat("HH:mm:ss"); | ||
| String calltime = format.format(date); |
There was a problem hiding this comment.
use camelCase for the variable name, namely callTime
| Map<String, String> map = new HashMap<String, String>(); | ||
| map.put("result", Double.toString(result)); | ||
| map.put("processID", processID); | ||
| map.put("calltime", calltime); |
| DateFormat format = new SimpleDateFormat("HH:mm:ss"); | ||
| String calltime = format.format(date); | ||
|
|
||
| Map<String, String> map = new HashMap<String, String>(); |
There was a problem hiding this comment.
maybe resultMap is better
| <div class="alert alert-light" role="alert" id="bmi"> | ||
| <h3>Your BMI result is: <span id="bmi_result"></span></h3> | ||
| <h3>BMI Result: <span id="bmi_result"></span></h3> | ||
| <h3>BMI Container ID: <span id="bmi_processid"></span></h3> |
There was a problem hiding this comment.
bmi_processId is better
| <h3>Your BMI result is: <span id="bmi_result"></span></h3> | ||
| <h3>BMI Result: <span id="bmi_result"></span></h3> | ||
| <h3>BMI Container ID: <span id="bmi_processid"></span></h3> | ||
| <h3>BMI Called time: <span id="bmi_calltime"></span></h3> |
There was a problem hiding this comment.
bmi_callTime is better
| $("#bmi_result").text(data); | ||
| if ( data < 18.5 || (data < 30 && data >= 25) ) { | ||
| $("#bmi_result").text(data.result); | ||
| $("#bmi_processid").text(data.processID); |
There was a problem hiding this comment.
maybe change both processid and processID to processId is better
| if ( data < 18.5 || (data < 30 && data >= 25) ) { | ||
| $("#bmi_result").text(data.result); | ||
| $("#bmi_processid").text(data.processID); | ||
| $("#bmi_calltime").text(data.calltime); |
There was a problem hiding this comment.
change calltime to callTime is better
| double heightInMeter = height / 100; | ||
| double bmi = weight / (heightInMeter * heightInMeter); | ||
| return roundToOnePrecision(bmi); | ||
|
|
There was a problem hiding this comment.
Please create another interface to get the system information instead of hacking the old interface. BTW, it's not a good practice that using map for response message.
| DateFormat format = new SimpleDateFormat("HH:mm:ss"); | ||
| String callTime = format.format(date); | ||
|
|
||
| Map<String, String> resultMap = new HashMap<String, String>(); |
There was a problem hiding this comment.
how can consumers know there are result/processId/callTime in response message?
There was a problem hiding this comment.
We can create a response class which holds the result , processId and callTime for the service consumer to use.
update BMI samples. Show call time and instance id in bmi page.
Signed-off-by: zhuhoudong