-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Display API monitoring history #3533
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Solution is incomplete. Table is missing. Please check this #3521 (comment).
@matleppa review the code, I will do the layout. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some changes needed.
In addition to that, I commented the issue 3521 about inputting here only (API base path and) the endpoint. And about displaying the endpoint in monitoring table.
Meteor.publish('getApiStatuRecordsData', (apiId) => { | ||
// Make sure apiId is a string | ||
check(apiId, String); | ||
// Find all API Backends |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change comment to be:
Find monitoring data from previous 24 hours
// Find all API Backends | ||
const startDate = new Date(); | ||
const lastDate = new Date(); | ||
lastDate.setDate(lastDate.getDate() - 2); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To get only last 24 hours
--> lastDate.setDate(lastDate.getDate() - 1);
@@ -11,6 +11,17 @@ import { check } from 'meteor/check'; | |||
import Apis from '/apinf_packages/apis/collection'; | |||
import { MonitoringData } from '/apinf_packages/monitoring/collection'; | |||
|
|||
Meteor.publish('getApiStatuRecordsData', (apiId) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'getApiStatuRecordsData'
-->
'getApiStatusRecordData'
@@ -145,6 +145,7 @@ | |||
"apiIntro_steps_settings_intro": "Edit API settings from this tab. You can also delete API here.", | |||
"apiIntro_steps_welcome_intro": "Welcome", | |||
"apiIntro_skipLabel": "Skip", | |||
"apiIntro_steps_monitoring_data": "Monitoring data", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
--> "Start and stop API monitoring. When monitoring is on, the response statuses during latest 24 hours are displayed."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replace value "Monitoring data" with text "Start and stop API monitoring. When monitoring is on, the response statuses during latest 24 hours are displayed."
|
||
{{> afQuickField name='enabled' }} | ||
{{# if apiMonitoringSettings.enabled }} | ||
<h2 style="font-size:1.4em;margin-top:0;"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use style classes instead of direct style in element.
<h2 style="font-size:1.4em;margin-top:0;"> | ||
Status Messages | ||
</h2> | ||
<p style="color:#6d859e;"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use style classes instead of direct style in element.
</tbody> | ||
</table> | ||
|
||
<hr style="color: rgba(59, 59, 88, 0.15); margin-right: -20px; margin-left: -20px; margin-top: 2em; margin-bottom: 2em;"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use style classes instead of direct style in element.
<h3 style="font-size:16px; margin-top:0;"> | ||
{{_ "apiMonitoring_panelTitle_Monitoring" }} | ||
</h3> | ||
<p style="color:#6d859e;">{{_ "apiMonitoring_helpIcon_text" }}</p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use style classes instead of direct style in element.
@@ -18,8 +18,8 @@ Template.apiMonitoring.onCreated(function () { | |||
|
|||
// Subscribe on Monitoring collection | |||
instance.subscribe('monitoringSettings', apiId); | |||
instance.subscribe('getApiStatuRecordsData', apiId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'getApiStatuRecordsData'
-->
'getApiStatusRecordData'
|
||
MonitoringData.allow({ | ||
insert () { | ||
// Get API document |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove unnecessary comment
// Get API ID | ||
const apiId = this.api._id; | ||
const monitoringDatas = MonitoringData.findOne({ apiId }); | ||
return monitoringDatas.responses; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add checking and return monitoringDatas.responses only in case monitoringData was found.
@@ -28,6 +28,10 @@ | |||
{{> apiFeedback api=api feedbackItems=feedbackItems }} | |||
</div> <!-- /api-feedback --> | |||
|
|||
<div id="api-monitoring" class="tab-pane fade"> | |||
{{> apiMonitoring api=api }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two space indentation.
Historical data on API availability | ||
</p> | ||
<table id="rtable"> | ||
<tr> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct indentations to two spaces.
<label for="endpoint-monitor-field"> | ||
{{ afFieldLabelText name='url' }} | ||
</label> | ||
{{> afFieldInput name='url' }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove unnecessary indentation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unnecessary indentation for the input field.
@import "/apinf_packages/core/client/style/bootstrap-variables.less"; | ||
|
||
#rtable { | ||
font-family: "Trebuchet MS", Arial, Helvetica, sans-serif; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct indentations to two spaces.
…d with data = false is found, create a record for API in question into MonitoringData and fill the id of created record into field data in MonitoringSettings.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The functionality seems to be correct. I also verified, that the migration works as expected.
Good work!
There still are a few minor findings. After you have corrected them, I'll approve this PR.
In original issue there are comments about displaying also the endpoint, against what the API status is checked.
I'll make another issue about them, so we get this one closed.
@@ -11,6 +11,17 @@ import { check } from 'meteor/check'; | |||
import Apis from '/apinf_packages/apis/collection'; | |||
import { MonitoringData } from '/apinf_packages/monitoring/collection'; | |||
|
|||
Meteor.publish('getApiStatuRecordData', (apiId) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getApiStatuRecordData
-->
getApiStatusRecordData
@@ -145,6 +145,7 @@ | |||
"apiIntro_steps_settings_intro": "Edit API settings from this tab. You can also delete API here.", | |||
"apiIntro_steps_welcome_intro": "Welcome", | |||
"apiIntro_skipLabel": "Skip", | |||
"apiIntro_steps_monitoring_data": "Monitoring data", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replace value "Monitoring data" with text "Start and stop API monitoring. When monitoring is on, the response statuses during latest 24 hours are displayed."
<label for="endpoint-monitor-field"> | ||
{{ afFieldLabelText name='url' }} | ||
</label> | ||
{{> afFieldInput name='url' }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unnecessary indentation for the input field.
@@ -18,8 +18,8 @@ Template.apiMonitoring.onCreated(function () { | |||
|
|||
// Subscribe on Monitoring collection | |||
instance.subscribe('monitoringSettings', apiId); | |||
instance.subscribe('getApiStatuRecordData', apiId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getApiStatuRecordData
-->
getApiStatusRecordData
…g of function name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Functionality as expected.
@55 Please have a look at this PR 3533. If your change requests are met, please approve them so I can merge the PR. |
Closes #3521
Changes
Describe your changes here as a bulleted list:
Developer checklist
This checklist is to be completed by the PR developer:
Reviewer checklist
Reviewed by: @55
This list is to be completed by the pull request reviewer: