Skip to content
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

Improve workloads statuses graphs on overview page #2598

Merged
merged 11 commits into from
Nov 22, 2017

Conversation

floreks
Copy link
Member

@floreks floreks commented Nov 20, 2017

Fixes #2593

Changes

  • Reorganized resources on overview page (sorted alphabetically per group)
  • Added resource status ratio charts for all resource on overview page.
  • Show information about status and number of related resources on chart hover, i.e. hovering over green color on pods chart can show Running: 4.
  • Removed unnecessary IsTypeFilled calls on backend.
  • Added Status struct to all resource list objects that contain basic info about the state of resources on the list.
  • Made resource charts easier to customize.

There is an issue (visible on below ss) with graph not being fully filled. It's related to how nvd3 handles showing charts. There is not much we can do right now.

TODO

  • Add tests

Before

zrzut ekranu z 2017-11-17 14-18-21

After

zrzut ekranu z 2017-11-20 15-59-38

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Nov 20, 2017
@maciaszczykm maciaszczykm mentioned this pull request Nov 20, 2017
8 tasks
@cheld
Copy link
Contributor

cheld commented Nov 20, 2017

Great!

@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Nov 21, 2017
Copy link
Member

@maciaszczykm maciaszczykm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good in general. UI is great. Few comments regarding backend implementation.

package common

// Status provides basic information about resources status on the list.
type Status struct {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change to ResourceStatus?

Failed int32 `json:"failed"`

// Number of resources that are in succeeded state.
Succeeded int32 `json:"succeeded"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer map[string]int32 here, because it may be misleading in case of Cron Jobs for example, which are Active or Suspended only. And these labels are not translated anyways.

Copy link
Member

@maciaszczykm maciaszczykm Nov 21, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There might be an issue with colouring graph slices... Perhaps some constant values for common names like active, failed, running, pending etc. would make it better.

Copy link
Member Author

@floreks floreks Nov 21, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was considering map but it requires introducing yet another portions of strings that would need to be hardcoded in backend and in frontend, and kept in sync. Using generic names like that and mapping them to specific resources seems like better idea. Map would complicate the code even more.

For CronJob Running can be easily considered as Active state and Failed as Suspended state. Icons used to show CronJob state in frontend are the same as for Running/Failed resource anyway.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Syncing frontend with the backend is required at the moment too. You need to keep in mind, that for Cron Job active = running and suspended = failed during development. Both have their own drawbacks. We can stick to the current implementation for now and make the release.


for _, cronJob := range cronJobList.Items {
if cronJob.Spec.Suspend != nil && !(*cronJob.Spec.Suspend) {
info.Running++
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is what I have mentioned in my earlier comment.

info.Pending++
} else {
info.Running++
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Export to a function if it repeats somewhere?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does not

Copy link
Member

@maciaszczykm maciaszczykm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests for it?

@k8s-ci-robot k8s-ci-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Nov 21, 2017
@floreks floreks force-pushed the new-branch branch 2 times, most recently from 8a0d1b1 to beed590 Compare November 21, 2017 13:50
@codecov
Copy link

codecov bot commented Nov 21, 2017

Codecov Report

Merging #2598 into master will increase coverage by 0.55%.
The diff coverage is 62.97%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2598      +/-   ##
==========================================
+ Coverage   53.63%   54.18%   +0.55%     
==========================================
  Files         562      563       +1     
  Lines       11955    12108     +153     
==========================================
+ Hits         6412     6561     +149     
+ Misses       5322     5289      -33     
- Partials      221      258      +37
Impacted Files Coverage Δ
src/app/frontend/deployment/detail/controller.js 100% <ø> (ø) ⬆️
src/app/frontend/overview/module.js 0% <ø> (ø) ⬆️
src/app/backend/resource/common/podinfo.go 66.66% <ø> (ø) ⬆️
src/app/backend/handler/terminal.go 0% <0%> (ø) ⬆️
src/app/backend/resource/service/events.go 76.92% <100%> (-4.33%) ⬇️
src/app/backend/resource/cronjob/list.go 79.24% <100%> (+0.81%) ⬆️
src/app/backend/resource/daemonset/list.go 73.91% <100%> (+23.91%) ⬆️
src/app/frontend/pod/list/card_component.js 91.17% <100%> (ø) ⬆️
src/app/backend/resource/job/list.go 72.85% <100%> (+0.79%) ⬆️
...pp/frontend/overview/workloadstatuses/component.js 100% <100%> (ø)
... and 24 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c648848...0969c1f. Read the comment docs.

@maciaszczykm maciaszczykm added this to the 1.8 milestone Nov 21, 2017
@floreks floreks merged commit 38e6827 into kubernetes:master Nov 22, 2017
@floreks floreks deleted the new-branch branch November 22, 2017 11:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants