8000 Refactored printStats, becoming serveStats! by mattharwood · Pull Request #50 · pesos/grofer · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Refactored printStats, becoming serveStats! #50

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

Merged
merged 1 commit into from
Sep 6, 2020

Conversation

mattharwood
Copy link
Contributor

Description

As per issue #47, I have refactored printStats.go, which is now serveStats.go. Functions have been renamed, and mentions of the functions throughout the project updated. I've also added comments to exported functions in the serveStats.go file.

Fixes #47

Type of change

Please delete options that are not relevant.

  • [ x ] Bug fix (non-breaking change which fixes an issue)

Checklist:

  • [ x ] I have read the contribution guidelines and followed it as far as possible.
  • [ x ] I have performed a self-review of my own code (if applicable)
  • [ x ] I have commented my code, particularly in hard-to-understand areas (if applicable)
  • [ x ] I have run go fmt on my code (reference)
  • [ x ] I have made corresponding changes to the documentation (if applicable)
  • [ x ] My changes generate no new warnings
  • [ x ] Any dependent and pending changes have been merged and published

Copy link
Member
@MadhavJivrajani MadhavJivrajani left a comment

Choose a reason for hiding this comment

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

Hi!
Thanks for your contribution! It looks good to me, I'll wait for another maintainer to approve the changes before merging 😄

@mattharwood
Copy link
Contributor Author

Hi!
Thanks for your contribution! It looks good to me, I'll wait for another maintainer to approve the changes before merging 😄

Thanks Madhav! It's actually my first contribution on Github ever 😁 Much appreciated!

@MadhavJivrajani MadhavJivrajani merged commit 20d912c into pesos:master Sep 6, 2020
MadhavJivrajani added a commit that referenced this pull request Sep 13, 2020
* Add feature for more CPU info (#46)

* added code for additional cpu info

* added cpu rates to CPULoad type

* Made UI for CPU info

* Cleaned use fo sync.once variables for faster UI rendering

Co-authored-by: Madhav Jivrajani <madhav.jiv@gmail.com>

* added cpuinfo in README

* removed stray comment

* Update README

* Add extra comments

* Refactored printStats, becoming serveStats! (#50)

Co-authored-by: lrb <lrb@envs.net>

* Readme update

Co-authored-by: Madhav Jivrajani <madhav.jiv@gmail.com>
Co-authored-by: mattharwood <matt@mattharwood.com>
Co-authored-by: lrb <lrb@envs.net>
MadhavJivrajani added a commit that referenced this pull request Jan 4, 2021
* Add feature for more CPU info (#46)

* added code for additional cpu info

* added cpu rates to CPULoad type

* Made UI for CPU info

* Cleaned use fo sync.once variables for faster UI rendering

Co-authored-by: Madhav Jivrajani <madhav.jiv@gmail.com>

* added cpuinfo in README

* removed stray comment

* Update README

* Add extra comments

* Refactored printStats, becoming serveStats! (#50)

Co-authored-by: lrb <lrb@envs.net>

* Readme update

* Remove duplicate error printing. (#52)

* added common error general.ErrCanceledByUser

* Fix error handlings under cmd/root (#48)

* use context to cancel executions

* use errgroup in cmd/root.go

* every functions returns error

* use context to stop ServerFuncs

* add license to src/general/errors.go

* Add completion subcommand

* Clean up description and remove generic stuff

* Added license header

* Render Grid on scroll to fix UI lag (#60)

* Replaced for loops with strings.Repeat() for whitespace generation

* inconsistent allignment in list of child process for gropher proc command (#61)

* Fixes #45 (inconsistent allignment in list of child process for  command)

* remove temp test logic and run gofmt

* add yellow color to PID text irrespective of any condition

* make color scheme consistent with AllProcsPage

* Add Cute ASCII for error messages! (#62)

* Added cute ascii art!

* Updated goobe art

* Renamed doggo.go to error.go

* Change tabs to spaces in license

* Change yourprogram to grofer

* Add section about completion in readme

* refactored flag variable default values into consts (#67)

* refactored flag variable default values into consts

* removed comment and added new line

* checking with default value before validation

* Fixed issues with text being invisible under bright backgrounds

termui defaults to ColorWhite, which displays white text irrespective of terminal. Using ColorClear instead uses the default text color that the terminal uses.

ISSUES: Plot widget does not accept changes to the color of the axes for some reason, hence it remains grey under both Dark and Light-colored backgrounds.

* issue #65 (#68)

* issue #65

* fix: uint32->int32

* fix wrong type in flag initialization in root.go

* Add keybindings to kill process in list (#16)

Avoid storing all procs, parse PID when killing the process

* Add error handling in process kill

Exit proc gracefully and fix formatting

* Change Kill key to K, ignore error if PID does not exist

* confirm process kill, refactor some parts

* Change color of selected process when killing

Paint row red on error in proc

Also, changed row color to magenta when selected for killing

* Check if process still exists when killing

 - renamed `paused` to `killSelected`
 - removed unnecessary once statement in updateProcs
 - if a process is selected for killing, check if the
   PID still exists on every update

Fixed selection color not persisting

* Fix UI closing in proc -p

* Feature/help (#74)

* Toggle help window in procs page

* Refactor to separate help message from widget

* Use ui.List instead of ui.Block

ui.List provides some styling and a simpler way to load data, as well as
option to wrap lines, allowing easier resizing of the widget

* Fix resizing of help widget

* Add keybindings for main and `proc -pid` pages

* Add help widget to `proc -pid` page

* Add help widget to main page

* Fix escape keybinding to clear screen first

Escape was mapped to exiting the help screen, but the help menu would
persist for a while on top of the page (until the next tick). This
causes the redraw to happen immediately

* Fix resizing issue

* Fix formatting error

* Add scroll in help menu, fix render delay

Add scroll option for the help widget when all lines are not visible.
Also fix the render delay when help widget is exited with <Esc>

* Fix formatting and spacing issues

* Fix procGraphs rendering

* Remove unneccesary comment

* Use slice of strings instead of string

* Add kill keybind to help message

* Remove unused module

* Re-add scroll in help menu

* Fix formatting issue

* update readme and root.go for documentation

* update readme for feature/help

* Fix UI flickering. Removed unnecessary calls to ui.Clear()

* Added cute beaver and elephant ASCII Art

* Clear background UI on rendering help

* Fix UI clearing for grofer --cpudinfo and initialize help

* made functions not exportable, fixed error in random selection#

* Removed comments of unexported Functions

* GH-75: using after channel instead of delay so exit is immediate (#77)

* GH-75: using after channel instead of delay so exit is immediate

* GH-75 BUG exit time too slow

- Using single select loop for generalStats.
- Using select time.After instead of time.Delay for proc single and multiple.

* GH-75: using ticker instead of after

* GH-75: using common tick util for cpu info

* GH-75: added license to tickutils.go

* Add .circleci/config.yml

* Set working directory for circleci

* Modified tests

* Attempt dependecy fix for test

* Update go version

* Attempt python install

* Attempt python install as root

* Remove travis and testing circleci

* Fix indentation and shift CI to circleci

* Add .circleci/config.yml

* Remove extra comments from CI config

* Show correct error msg. on neg. pids (#86)

Giving a pid 0 from `grofer proc -p 0` is the same as
`grofer proc`.

Fixes #86

* Documented PID 0 in grofer proc

* Add export functionality  (#88)

* added boilerplate code for exporting json

* forgot license :p

* removed test json

* fixed file descriptors

* add export functionality for json

* added better validation of file names and slight refactoring done

* remove explicit extension append for default case

* ocd fix

* delete output of test run

* remove unescessary comments

* change export type validation in map

* change exportable consts to non-exportable consts

* change export type validation

* Add JSON export functionality (#84)

* Implement JSON per proc export

* Update switch conditions for export

* Restructured packages

* Add license to procExport.go

* Fixed package name, removed output file before creation

* issue #65 (#68)

* issue #65

* fix: uint32->int32

* fix wrong type in flag initialization in root.go

* Add keybindings to kill process in list (#16)

Avoid storing all procs, parse PID when killing the process

* Add error handling in process kill

Exit proc gracefully and fix formatting

* Change Kill key to K, ignore error if PID does not exist

* confirm process kill, refactor some parts

* Change color of selected process when killing

Paint row red on error in proc

Also, changed row color to magenta when selected for killing

* Check if process still exists when killing

 - renamed `paused` to `killSelected`
 - removed unnecessary once statement in updateProcs
 - if a process is selected for killing, check if the
   PID still exists on every update

Fixed selection color not persisting

* Fix UI closing in proc -p

* Feature/help (#74)

* Toggle help window in procs page

* Refactor to separate help message from widget

* Use ui.List instead of ui.Block

ui.List provides some styling and a simpler way to load data, as well as
option to wrap lines, allowing easier resizing of the widget

* Fix resizing of help widget

* Add keybindings for main and `proc -pid` pages

* Add help widget to `proc -pid` page

* Add help widget to main page

* Fix escape keybinding to clear screen first

Escape was mapped to exiting the help screen, but the help menu would
persist for a while on top of the page (until the next tick). This
causes the redraw to happen immediately

* Fix resizing issue

* Fix formatting error

* Add scroll in help menu, fix render delay

Add scroll option for the help widget when all lines are not visible.
Also fix the render delay when help widget is exited with <Esc>

* Fix formatting and spacing issues

* Fix procGraphs rendering

* Remove unneccesary comment

* Use slice of strings instead of string

* Add kill keybind to help message

* Remove unused module

* Re-add scroll in help menu

* Fix formatting issue

* update readme and root.go for documentation

* update readme for feature/help

* Fix UI flickering. Removed unnecessary calls to ui.Clear()

* Added cute beaver and elephant ASCII Art

* Clear background UI on rendering help

* Fix UI clearing for grofer --cpudinfo and initialize help

* made functions not exportable, fixed error in random selection#

* Removed comments of unexported Functions

* GH-75: using after channel instead of delay so exit is immediate (#77)

* GH-75: using after channel instead of delay so exit is immediate

* GH-75 BUG exit time too slow

- Using single select loop for generalStats.
- Using select time.After instead of time.Delay for proc single and multiple.

* GH-75: using ticker instead of after

* GH-75: using common tick util for cpu info

* GH-75: added license to tickutils.go

* Made general export line by line json

* Add export functionality for per proc

* Add .circleci/config.yml

* Set working directory for circleci

* Modified tests

* Attempt dependecy fix for test

* Update go version

* Attempt python install

* Attempt python install as root

* Remove travis and testing circleci

* Fix indentation and shift CI to circleci

* Add .circleci/config.yml

* Remove extra comments from CI config

* Removed redundant export files

* Fix formatting

* Update license in cpuInfo

* Fix precision for exported fields

* Add prompt to confirm profile overwrites

* Moved roundOff to utils and removed redundant print statements

* Add overwrite prompt to per proc export, format prompt text with filname

* Log errors in export iterations

* Nested error handling

* Update documentation

* Remove mentions of JSON

* Add export type explanation

Co-authored-by: Prince Verma <prncvrm@gmail.com>
Co-authored-by: Madhav Jivrajani <madhav.jiv@gmail.com>
7EF1

Co-authored-by: Samyak S Sarnayak <samyak201@gmail.com>
Co-authored-by: Anirudh Haritas Murali <49116134+anihm136@users.noreply.github.com>
Co-authored-by: localleon <me@lrau.xyz>
Co-authored-by: ataboo <doubar2001@gmail.com>

Co-authored-by: Bhargav SNV <44526455+Gituser143@users.noreply.github.com>
Co-authored-by: Prince Verma <prncvrm@gmail.com>
Co-authored-by: Samyak S Sarnayak <samyak201@gmail.com>
Co-authored-by: Anirudh Haritas Murali <49116134+anihm136@users.noreply.github.com>
Co-authored-by: localleon <me@lrau.xyz>
Co-authored-by: ataboo <doubar2001@gmail.com>

* removed extraneous RenderCPUInfo func

Co-authored-by: Bhargav SNV <44526455+Gituser143@users.noreply.github.com>
Co-authored-by: Gituser143 <bhargavsnv100@gmail.com>
Co-authored-by: mattharwood <matt@mattharwood.com>
Co-authored-by: lrb <lrb@envs.net>
Co-authored-by: __touk__ <zerouali.t@gmail.com>
Co-authored-by: egawata <egawa.takashi@gmail.com>
Co-authored-by: Anirudh H M <anihm136@gmail.com>
Co-authored-by: Siddhant Sinha <siddhant94@users.noreply.github.com>
Co-authored-by: Anirudh Haritas Murali <49116134+anihm136@users.noreply.github.com>
Co-authored-by: Souvik Maji <souvikmaji94@gmail.com>
Co-authored-by: Kunal Bhat <kunal.bhat2001@gmail.com>
Co-authored-by: Prince Verma <prncvrm@gmail.com>
Co-authored-by: Samyak S Sarnayak <samyak201@gmail.com>
Co-authored-by: localleon <me@lrau.xyz>
Co-authored-by: ataboo <doubar2001@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[REFACTOR] Rename the file printStats.go and the functions inside it to more meaningful names
3 participants
0