Merge lp:~mikemc/ubuntuone-control-panel/remote-folders-fix into lp:ubuntuone-control-panel

Proposed by Mike McCracken
Status: Merged
Approved by: Brian Curtin
Approved revision: 362
Merged at revision: 381
Proposed branch: lp:~mikemc/ubuntuone-control-panel/remote-folders-fix
Merge into: lp:ubuntuone-control-panel
Diff against target: 148 lines (+33/-14)
4 files modified
ubuntuone/controlpanel/gui/qt/controlpanel.py (+10/-5)
ubuntuone/controlpanel/gui/qt/tests/test_controlpanel.py (+3/-4)
ubuntuone/controlpanel/gui/qt/tests/test_wizard.py (+16/-5)
ubuntuone/controlpanel/gui/qt/wizard.py (+4/-0)
To merge this branch: bzr merge lp:~mikemc/ubuntuone-control-panel/remote-folders-fix
Reviewer Review Type Date Requested Status
Brian Curtin (community) Approve
Roberto Alsina (community) check conflict resolution Approve
Diego Sarmentero (community) Approve
Review via email: mp+126037@code.launchpad.net

Commit message

- Connect files service in wizard to enable display of remote folders. (LP: #978043)

Description of the change

- Connect files service in wizard to enable display of remote folders. (LP: #978043)

Summary:

The remote folders panel requires a syncdaemon with an active actionqueue to process the ListVolumes action, in order to display the remote folders. Connecting the files service makes that happen.

To test:

- remove your credentials, kill syncdaemon
(OR start on a new user account)
- open control panel, log in with your existing account
- does the first wizard page hang with a loading overlay or show remote folders?
(It should show remote folders)

Gritty Details:

CloudToComputer page uses folders.py RemoteFoldersPanel, which calls
backend.py volumes_info() with refresh=True. Setting refresh=True
means it'll call sd_client.refresh_volumes(), which eventually calls
interaction_interfaces.py refresh_volumes(), which calls
volume_manager.py refresh_volumes(), which calls action_queue.py
list_volumes(), which queues a ListVolumes class, which gets stuck
because the queue is inactive, and won't get re-enabled until we are
done with the wizard, which triggers on_wizard_finished() in
controlpanel.py, which calls on_credentials_found() and that'll start
the queue, but by then it's too late.

The fix is to call backend.connect_files() in wizard.py
_process_credentials(), so that the queue is active when we load the
CloudToComputerPage. To work, this has to actually connect, so it
ignores the autoconnect setting, which I assert is OK because we
probably don't get to this page with non-default settings, and
autoconnect is on by default.

So, how does the folders tab in the main management UI work when
autoconnect is False? If the main control panel found creds, then
it'll check autoconnect and if it's false, it doesn't call
backend.connect_files(). It just goes ahead and shows the folders tab
However, the folders tab calls backend.volumes_info() with
refresh=False, so none of that stuff above happens, and it doesn't
matter what state the queue is in (hence it doesn't matter if
autoconnect is enabled or not, the folders tab will still work).

To post a comment you must log in.
358. By Mike McCracken

merge with trunk

359. By Mike McCracken

Test calling connect_files after receiving credentials.

Revision history for this message
Roberto Alsina (ralsina) :
review: Approve
Revision history for this message
Diego Sarmentero (diegosarmentero) wrote :

+1

review: Approve
360. By Mike McCracken

merge with trunk and resolve conflict

Revision history for this message
Roberto Alsina (ralsina) wrote :

+1

review: Approve (check conflict resolution)
361. By Mike McCracken

merge with trunk and resolve conflict in controlpanel.py

362. By Mike McCracken

merge with current trunk

Revision history for this message
Brian Curtin (brian.curtin) wrote :

Approved on Windows. Code looks good, tests pass, and IRL on Windows looks good.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'ubuntuone/controlpanel/gui/qt/controlpanel.py'
--- ubuntuone/controlpanel/gui/qt/controlpanel.py 2012-10-16 11:31:33 +0000
+++ ubuntuone/controlpanel/gui/qt/controlpanel.py 2012-11-13 10:10:24 +0000
@@ -100,7 +100,7 @@
100100
101 @log_call(logger.debug)101 @log_call(logger.debug)
102 def on_credentials_not_found(self):102 def on_credentials_not_found(self):
103 """Credentials are not found or were removed."""103 """Credentials not found / were removed. Log in, then show wizard."""
104 self.ui.wizard.restart()104 self.ui.wizard.restart()
105 self.ui.switcher.setCurrentWidget(self.ui.wizard)105 self.ui.switcher.setCurrentWidget(self.ui.wizard)
106 # By design request, when the user logs in, he has to end106 # By design request, when the user logs in, he has to end
@@ -113,10 +113,14 @@
113 @defer.inlineCallbacks113 @defer.inlineCallbacks
114 @log_call(logger.debug)114 @log_call(logger.debug)
115 def on_credentials_found(self):115 def on_credentials_found(self):
116 """Credentials are not found or were removed."""116 """Credentials are found on first try, connect and show mgmt UI."""
117 self.connect_file_sync()
118 yield self.show_management_ui()
119
120 @defer.inlineCallbacks
121 def show_management_ui(self):
122 """Show mgmt UI. File sync is already connected if desired."""
117 self.ui.switcher.setCurrentWidget(self.ui.management)123 self.ui.switcher.setCurrentWidget(self.ui.management)
118 self.connect_file_sync()
119
120 info = yield self.backend.account_info()124 info = yield self.backend.account_info()
121 self.process_info(info)125 self.process_info(info)
122 self.is_processing = False126 self.is_processing = False
@@ -182,7 +186,8 @@
182 @log_call(logger.info)186 @log_call(logger.info)
183 def on_wizard_finished(self, status):187 def on_wizard_finished(self, status):
184 """Move to controlpanel if wizard ended successfully."""188 """Move to controlpanel if wizard ended successfully."""
185 self.on_credentials_found()189 # NOTE: the wizard has connected the files service already
190 self.show_management_ui()
186191
187 @log_call(logger.info)192 @log_call(logger.info)
188 def start_from_license(self):193 def start_from_license(self):
189194
=== modified file 'ubuntuone/controlpanel/gui/qt/tests/test_controlpanel.py'
--- ubuntuone/controlpanel/gui/qt/tests/test_controlpanel.py 2012-10-08 18:11:55 +0000
+++ ubuntuone/controlpanel/gui/qt/tests/test_controlpanel.py 2012-11-13 10:10:24 +0000
@@ -91,10 +91,9 @@
91 self.assertEqual(self._called, ((), {}))91 self.assertEqual(self._called, ((), {}))
9292
93 def test_on_credentials_found(self):93 def test_on_credentials_found(self):
94 """The management panel is shown."""94 """File sync is connected and the management panel is shown."""
95 self.patch(self.ui, 'connect_file_sync', self._set_called)95 self.patch(self.ui, 'connect_file_sync', self._set_called)
96 self.ui.on_credentials_not_found()96 yield self.ui.on_credentials_found()
97 self.ui.on_credentials_found()
9897
99 self.assertIs(self.ui.ui.switcher.currentWidget(),98 self.assertIs(self.ui.ui.switcher.currentWidget(),
100 self.ui.ui.management)99 self.ui.ui.management)
@@ -154,7 +153,7 @@
154153
155 def test_on_wizard_finished(self):154 def test_on_wizard_finished(self):
156 """When the wizard is finished, the management panel is shown."""155 """When the wizard is finished, the management panel is shown."""
157 self.patch(self.ui, 'on_credentials_found', self._set_called)156 self.patch(self.ui, 'show_management_ui', self._set_called)
158 self.ui.ui.wizard.finished.emit(1)157 self.ui.ui.wizard.finished.emit(1)
159158
160 self.assertEqual(self._called, ((), {}))159 self.assertEqual(self._called, ((), {}))
161160
=== modified file 'ubuntuone/controlpanel/gui/qt/tests/test_wizard.py'
--- ubuntuone/controlpanel/gui/qt/tests/test_wizard.py 2012-03-29 19:05:02 +0000
+++ ubuntuone/controlpanel/gui/qt/tests/test_wizard.py 2012-11-13 10:10:24 +0000
@@ -296,7 +296,7 @@
296296
297297
298class UbuntuOneWizardSettingsTestCase(UbuntuOneWizardSignInTestCase):298class UbuntuOneWizardSettingsTestCase(UbuntuOneWizardSignInTestCase):
299 """Test the CloudToComputerPage wizard page."""299 """Test the Settings wizard page."""
300300
301 buttons = {'BackButton': (None, 'currentIdChanged', (1,))}301 buttons = {'BackButton': (None, 'currentIdChanged', (1,))}
302 page_name = 'settings'302 page_name = 'settings'
@@ -304,7 +304,7 @@
304304
305305
306class UbuntuOneWizardComputerToCloudTestCase(UbuntuOneWizardSignInTestCase):306class UbuntuOneWizardComputerToCloudTestCase(UbuntuOneWizardSignInTestCase):
307 """Test the CloudToComputerPage wizard page."""307 """Test the ComputerToCloudPage wizard page."""
308308
309 buttons = {309 buttons = {
310 'FinishButton': (None, 'finished', (gui.QtGui.QDialog.Accepted,)),310 'FinishButton': (None, 'finished', (gui.QtGui.QDialog.Accepted,)),
@@ -354,6 +354,17 @@
354 method = 'login'354 method = 'login'
355355
356 @defer.inlineCallbacks356 @defer.inlineCallbacks
357 def setUp(self):
358 yield super(UbuntuOneWizardLoginTestCase, self).setUp()
359 self.connect_files_called = False
360
361 def fake_connect_files():
362 self.connect_files_called = True
363
364 self.patch(self.ui.backend, 'connect_files',
365 fake_connect_files)
366
367 @defer.inlineCallbacks
357 def test_with_credentials(self):368 def test_with_credentials(self):
358 """Wizard is done when credentials were retrieved."""369 """Wizard is done when credentials were retrieved."""
359 self.ui.currentIdChanged.connect(self._set_called)370 self.ui.currentIdChanged.connect(self._set_called)
@@ -370,7 +381,7 @@
370 button.click()381 button.click()
371382
372 yield d383 yield d
373384 self.assertEqual(True, self.connect_files_called)
374 self.assertTrue(self.ui.signin_page.isEnabled())385 self.assertTrue(self.ui.signin_page.isEnabled())
375 expected_next_id = self.ui.pages[self.ui.cloud_folders_page]386 expected_next_id = self.ui.pages[self.ui.cloud_folders_page]
376 self.assertEqual(self._called, ((expected_next_id,), {}))387 self.assertEqual(self._called, ((expected_next_id,), {}))
@@ -392,7 +403,7 @@
392 button.click()403 button.click()
393404
394 yield d405 yield d
395406 self.assertEqual(False, self.connect_files_called)
396 self.assertTrue(self.ui.signin_page.isEnabled())407 self.assertTrue(self.ui.signin_page.isEnabled())
397 self.assertFalse(self._called)408 self.assertFalse(self._called)
398409
@@ -413,7 +424,7 @@
413 button.click()424 button.click()
414425
415 yield d426 yield d
416427 self.assertEqual(False, self.connect_files_called)
417 self.assertTrue(self.ui.signin_page.isEnabled())428 self.assertTrue(self.ui.signin_page.isEnabled())
418 self.assertFalse(self._called) # the wizard page was not changed429 self.assertFalse(self._called) # the wizard page was not changed
419430
420431
=== modified file 'ubuntuone/controlpanel/gui/qt/wizard.py'
--- ubuntuone/controlpanel/gui/qt/wizard.py 2012-03-29 19:05:02 +0000
+++ ubuntuone/controlpanel/gui/qt/wizard.py 2012-11-13 10:10:24 +0000
@@ -298,6 +298,10 @@
298 def _process_credentials(self, credentials=None):298 def _process_credentials(self, credentials=None):
299 """Confirm which is the next step after analyzing 'credentials'."""299 """Confirm which is the next step after analyzing 'credentials'."""
300 if credentials:300 if credentials:
301 # NOTE: we don't check the autoconnect key here because we
302 # do need the connection for the initial remote volumes
303 # list, and it is on by default anyway.
304 self.backend.connect_files()
301 self.next()305 self.next()
302306
303 @QtCore.pyqtSlot()307 @QtCore.pyqtSlot()

Subscribers

People subscribed via source and target branches