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

Network test popup #36

Merged
merged 1 commit into from
Sep 6, 2018
Merged

Conversation

mdhorn
Copy link
Contributor

@mdhorn mdhorn commented Aug 31, 2018

Fixes Issue: #27

Changes proposed in this pull request:

  • Switch to using a model PopUp window for Network testing.
  • Added URL checking to the Proxy setting

@mdhorn mdhorn requested a review from dorileo August 31, 2018 19:04
@mdhorn mdhorn self-assigned this Aug 31, 2018
@mdhorn mdhorn added the enhancement New feature or request label Aug 31, 2018
tui/common.go Outdated Show resolved Hide resolved
var (
// NetworkPassing is used to track if the latest network configuration
// is passing; changes in proxy, etc.
NetworkPassing bool
Copy link
Contributor

Choose a reason for hiding this comment

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

we could use the model to store this flag, we don't even need to export it anyway.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@dorileo But is "the network working" really part of the model of the install? To me, it was a status of something during execution. But if you feel strongly I can relocate it.

if dialog.RunNetworkTest() {
// Automatically close if it worked
clui.RefreshScreen()
time.Sleep(time.Second)
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you really need this sleep here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It was only there to give the user a "second" to see the Success status before the dialog automatically goes away. I added it because it bothered me that the popup went away too quickly. If you have a strong feeling about this, we can remove it.

// the progress bar to "full"
func (dialog *NetworkTestDialog) Success() {
dialog.progressBar.SetValue(dialog.progressMax)
clui.RefreshScreen()
Copy link
Contributor

Choose a reason for hiding this comment

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

You're refreshing the screen twice (here and in the menu callback), is that intentional?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Who doesn't like a Fresh a screen? :) I can remove one of these and retest.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@dorileo We are also doing a refresh after SetValue in the tui/installer code and after SetTitle; this seems to be the BKM pattern, no?

time.Sleep(flashTime)
dialog.progressBar.SetBackColor(bg)
clui.RefreshScreen()
time.Sleep(flashTime)
Copy link
Contributor

Choose a reason for hiding this comment

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

sleeping and refreshing twice?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the "Flashing" between Red and the default color to make the failure obvious to the user. We have the same code in Failure code for the Progress bar during the installation code.

// Desc is part of the progress.Client implementation and sets the progress bar label
func (dialog *NetworkTestDialog) Desc(desc string) {
dialog.resultLabel.SetTitle(desc)
clui.RefreshScreen()
Copy link
Contributor

Choose a reason for hiding this comment

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

Also refreshing? are you running this dialog in a different goroutine?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This refresh after setting the Title was imitated from the Dialog window code in clui.

// OnClose sets the callback that is called when the
// dialog is closed
func (dialog *NetworkTestDialog) OnClose(fn func()) {
clui.WindowManager().BeginUpdate()
Copy link
Contributor

Choose a reason for hiding this comment

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

You shouldn't need this bend and end update pairs, specially here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This Begin and End was imitated from the Dialog window code in clui.


// Close closes the dialog window and executes a callback if registered
func (dialog *NetworkTestDialog) Close() {
clui.WindowManager().DestroyWindow(dialog.DialogBox)
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ditto

dialog.DialogBox.SetTitleButtons(0)
dialog.DialogBox.SetMovable(false)
dialog.DialogBox.SetSizable(false)
clui.WindowManager().BeginUpdate()
Copy link
Contributor

Choose a reason for hiding this comment

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

again?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is how it is code in the PopUp dialog code in clui.

@dorileo
Copy link
Contributor

dorileo commented Aug 31, 2018

@mdhorn all those RefreshScreen() calls might have been inherited from my original code, I think it's a good opportunity to review'em.

@dorileo
Copy link
Contributor

dorileo commented Sep 4, 2018

@mdhorn I've just tested the patches and it breaks when resizing terminal. If you hit "test network" and resize the terminal then the TUI window is not properly placed/moved, I also saw some window corruption.

@dorileo
Copy link
Contributor

dorileo commented Sep 4, 2018

if we fail the testing after changing the proxy settings we shouldn't revert the user's change.

@dorileo
Copy link
Contributor

dorileo commented Sep 4, 2018

if we fail the testing after changing the network settings we shouldn't revert the user's change.

@mdhorn
Copy link
Contributor Author

mdhorn commented Sep 4, 2018

@dorileo After testing proxy settings, if testing fails, we do reset the proxy to the previous value.

@mdhorn mdhorn force-pushed the network-test-popup branch 2 times, most recently from a24db1a to 3f3510c Compare September 6, 2018 18:55
@mdhorn
Copy link
Contributor Author

mdhorn commented Sep 6, 2018

@dorileo Can you please re-review now that I have pushed changes.
Are there any concerns which still need to be addressed or discussed?

Copy link
Contributor

@dorileo dorileo left a comment

Choose a reason for hiding this comment

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

LGTM

Switch to using a model PopUp window for Network testing.

This should be re-used for all network testing:
- Manual
- Change of Proxy
- Change of Interface
- Before starting Install

Added URL checking to the Proxy setting

Signed-off-by: Mark D Horn <mark.d.horn@intel.com>
@mdhorn mdhorn merged commit 1866154 into clearlinux:master Sep 6, 2018
@mdhorn mdhorn deleted the network-test-popup branch September 6, 2018 23:37
@dorileo dorileo mentioned this pull request Sep 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants