-
Notifications
You must be signed in to change notification settings - Fork 356
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
Container trends chart - wait for loadingDone before displaying pf-trends-chart #5310
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…ends-chart prevents TypeError: Cannot read property 'layout' of undefined at trendsChartController.e.updateAll (application-d966831b…581bed47155710.js:3) at trendsChartController.e.$onChanges (application-d966831b…581bed47155710.js:3) when the JSON endpoints are taking longer to respond. The controller already has a concept of loadingDone, used to display a spinner. But it was never used to prevent rendering of the pf-trends-chart component, which fails when config is undefined. Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1684226
Testing: diff --git a/app/controllers/container_dashboard_controller.rb b/app/controllers/container_dashboard_controller.rb
index 7cc34bf56..1a067ebce 100644
--- a/app/controllers/container_dashboard_controller.rb
+++ b/app/controllers/container_dashboard_controller.rb
@@ -20,29 +20,38 @@ class ContainerDashboardController < ApplicationController
redirect_to(:action => 'show')
end
+ def null
+ nil
+ end
+
def data
- return data_live if params[:live] == 'true'
- render :json => {:data => collect_data(params[:id])}
+ sleep(rand * 6) + 2
+ render :json => {"data":{"status":{"nodes":{"count":5,"errorCount":0,"warningCount":0,"href":"https://10.8.197.218/ems_container/2?display=container_nodes"},"containers":{"count":19,"errorCount":0,"warningCount":0,"href":"https://10.8.197.218/ems_container/2?display=containers"},"registries":{"count":2,"errorCount":0,"warningCount":0,"href":"https://10.8.197.218/ems_container/2?display=container_image_registries"},"projects":{"count":15,"errorCount":0,"warningCount":0,"href":"https://10.8.197.218/ems_container/2?display=container_projects"},"pods":{"count":18,"errorCount":0,"warningCount":0,"href":"https://10.8.197.218/ems_container/2?display=container_groups"},"services":{"count":14,"errorCount":0,"warningCount":0,"href":"https://10.8.197.218/ems_container/2?display=container_services"},"images":{"count":141,"errorCount":0,"warningCount":0,"href":"https://10.8.197.218/ems_container/2?display=container_images"},"routes":{"count":5,"errorCount":0,"warningCount":0,"href":"https://10.8.197.218/ems_container/2?display=container_routes"}},"providers":[[{"count":1,"typeName":"Openshift","iconImage":"/assets/svg/vendor-openshift-c33e45a9f6f48fbdd99bbad7f827c328e32d8bf032d0b64c76e4511b6cd18ef3.svg","statusIcon":"pficon pficon-ok"}],null],"alerts":{"count":null,"href":"/alerts_overview/show","notifications":[{}],"dataAvailable":false}}}
end
def heatmaps_data
- render :json => {:data => collect_heatmaps_data(params[:id])}
+ sleep(rand * 6) + 2
+ render :json => {"data":{"heatmaps":{"nodeCpuUsage":[{"id":5,"node":"env-ocp-compute1-v1.cmqe.lab.eng.rdu2.redhat.com","provider":"ocp-37-hawk","unit":"Cores","total":4,"percent":0.07},{"id":6,"node":"env-ocp-compute2-v1.cmqe.lab.eng.rdu2.redhat.com","provider":"ocp-37-hawk","unit":"Cores","total":4,"percent":0.02},{"id":7,"node":"env-ocp-compute3-v1.cmqe.lab.eng.rdu2.redhat.com","provider":"ocp-37-hawk","unit":"Cores","total":1,"percent":0.04},{"id":8,"node":"env-ocp-infra-v1.cmqe.lab.eng.rdu2.redhat.com","provider":"ocp-37-hawk","unit":"Cores","total":4,"percent":0.03},{"id":9,"node":"env-ocp-master-v1.cmqe.lab.eng.rdu2.redhat.com","provider":"ocp-37-hawk","unit":"Cores","total":4,"percent":0.04}],"nodeMemoryUsage":[{"id":5,"node":"env-ocp-compute1-v1.cmqe.lab.eng.rdu2.redhat.com","provider":"ocp-37-hawk","unit":"GB","total":11852,"percent":0.3},{"id":6,"node":"env-ocp-compute2-v1.cmqe.lab.eng.rdu2.redhat.com","provider":"ocp-37-hawk","unit":"GB","total":11852,"percent":0.31},{"id":7,"node":"env-ocp-compute3-v1.cmqe.lab.eng.rdu2.redhat.com","provider":"ocp-37-hawk","unit":"GB","total":11852,"percent":0.15},{"id":8,"node":"env-ocp-infra-v1.cmqe.lab.eng.rdu2.redhat.com","provider":"ocp-37-hawk","unit":"GB","total":11852,"percent":0.44},{"id":9,"node":"env-ocp-master-v1.cmqe.lab.eng.rdu2.redhat.com","provider":"ocp-37-hawk","unit":"GB","total":15884,"percent":0.55}],"title":"Node Utilization"}}}
end
def ems_utilization_data
- render :json => {:data => collect_ems_utilization_data(params[:id])}
+ sleep(rand * 6) + 2
+ render :json => {"data":{"ems_utilization":{"interval_name":"daily","xy_data":{"cpu":{"used":1,"total":17,"xData":["2019-02-28T00:00:00.000Z","2019-03-01T00:00:00.000Z","2019-03-02T00:00:00.000Z","2019-03-03T00:00:00.000Z"],"yData":[0.7,0.7,0.7,0.7]},"memory":{"used":22,"total":62,"xData":["2019-02-28T00:00:00.000Z","2019-03-01T00:00:00.000Z","2019-03-02T00:00:00.000Z","2019-03-03T00:00:00.000Z"],"yData":[22.35,22.32,22.38,22.45]}}}}}
end
def network_metrics_data
- render :json => {:data => collect_network_metrics_data(params[:id])}
+ sleep(rand * 6) + 2
+ render :json => {"data":{"network_metrics":{"dataAvailable":true,"interval_name":"daily","xy_data":{"xData":["2019-02-28T00:00:00.000Z","2019-03-01T00:00:00.000Z","2019-03-02T00:00:00.000Z","2019-03-03T00:00:00.000Z"],"yData":[745,692,684,694]}}}}
end
def pod_metrics_data
- render :json => {:data => collect_pod_metrics_data(params[:id])}
+ sleep(rand * 6) + 2
+ render :json => {"data":{"pod_metrics":{"dataAvailable":true,"interval_name":"daily","xy_data":{"xData":["2019-02-28T00:00:00.000Z","2019-03-01T00:00:00.000Z","2019-03-02T00:00:00.000Z","2019-03-03T00:00:00.000Z"],"yCreated":[0,0,0,0],"yDeleted":[0,0,0,0]}}}}
end
def image_metrics_data
- render :json => {:data => collect_image_metrics_data(params[:id])}
+ sleep(rand * 6) + 2
+ render :json => {"data":{"image_metrics":{"dataAvailable":true,"interval_name":"daily","xy_data":{"xData":["2019-02-28T00:00:00.000Z","2019-03-01T00:00:00.000Z","2019-03-02T00:00:00.000Z","2019-03-03T00:00:00.000Z"],"yData":[0,0,0,0]}}}}
end
def data_live (the data comes from the appliance provided in the BZ, but it looks like those |
Checked commit https://github.com/himdel/manageiq-ui-classic/commit/8e3a5f476a3f6a8bd11344affac3b3a5f344d918 with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0 **
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Compute > Containers > Overview or Compute > Containers > Providers > pick one, dashboard view
This fixes a
when the JSON endpoints are taking longer to respond. (Longer = angular manages to do the first render before any data arrives.)
The controller already has a concept of
loadingDone
, used to display a spinner.But it was never used to prevent rendering of the
pf-trends-chart
component, which fails when config is undefined.Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1684226
(related to but not the same problem as in #5232)