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 on 2012-09-24

merge with trunk

359. By Mike McCracken on 2012-09-28

Test calling connect_files after receiving credentials.

Roberto Alsina (ralsina) :
review: Approve
Diego Sarmentero (diegosarmentero) wrote :

+1

review: Approve
360. By Mike McCracken on 2012-10-17

merge with trunk and resolve conflict

Roberto Alsina (ralsina) wrote :

+1

review: Approve (check conflict resolution)
361. By Mike McCracken on 2012-10-18

merge with trunk and resolve conflict in controlpanel.py

362. By Mike McCracken on 2012-11-13

merge with current trunk

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
1=== modified file 'ubuntuone/controlpanel/gui/qt/controlpanel.py'
2--- ubuntuone/controlpanel/gui/qt/controlpanel.py 2012-10-16 11:31:33 +0000
3+++ ubuntuone/controlpanel/gui/qt/controlpanel.py 2012-11-13 10:10:24 +0000
4@@ -100,7 +100,7 @@
5
6 @log_call(logger.debug)
7 def on_credentials_not_found(self):
8- """Credentials are not found or were removed."""
9+ """Credentials not found / were removed. Log in, then show wizard."""
10 self.ui.wizard.restart()
11 self.ui.switcher.setCurrentWidget(self.ui.wizard)
12 # By design request, when the user logs in, he has to end
13@@ -113,10 +113,14 @@
14 @defer.inlineCallbacks
15 @log_call(logger.debug)
16 def on_credentials_found(self):
17- """Credentials are not found or were removed."""
18+ """Credentials are found on first try, connect and show mgmt UI."""
19+ self.connect_file_sync()
20+ yield self.show_management_ui()
21+
22+ @defer.inlineCallbacks
23+ def show_management_ui(self):
24+ """Show mgmt UI. File sync is already connected if desired."""
25 self.ui.switcher.setCurrentWidget(self.ui.management)
26- self.connect_file_sync()
27-
28 info = yield self.backend.account_info()
29 self.process_info(info)
30 self.is_processing = False
31@@ -182,7 +186,8 @@
32 @log_call(logger.info)
33 def on_wizard_finished(self, status):
34 """Move to controlpanel if wizard ended successfully."""
35- self.on_credentials_found()
36+ # NOTE: the wizard has connected the files service already
37+ self.show_management_ui()
38
39 @log_call(logger.info)
40 def start_from_license(self):
41
42=== modified file 'ubuntuone/controlpanel/gui/qt/tests/test_controlpanel.py'
43--- ubuntuone/controlpanel/gui/qt/tests/test_controlpanel.py 2012-10-08 18:11:55 +0000
44+++ ubuntuone/controlpanel/gui/qt/tests/test_controlpanel.py 2012-11-13 10:10:24 +0000
45@@ -91,10 +91,9 @@
46 self.assertEqual(self._called, ((), {}))
47
48 def test_on_credentials_found(self):
49- """The management panel is shown."""
50+ """File sync is connected and the management panel is shown."""
51 self.patch(self.ui, 'connect_file_sync', self._set_called)
52- self.ui.on_credentials_not_found()
53- self.ui.on_credentials_found()
54+ yield self.ui.on_credentials_found()
55
56 self.assertIs(self.ui.ui.switcher.currentWidget(),
57 self.ui.ui.management)
58@@ -154,7 +153,7 @@
59
60 def test_on_wizard_finished(self):
61 """When the wizard is finished, the management panel is shown."""
62- self.patch(self.ui, 'on_credentials_found', self._set_called)
63+ self.patch(self.ui, 'show_management_ui', self._set_called)
64 self.ui.ui.wizard.finished.emit(1)
65
66 self.assertEqual(self._called, ((), {}))
67
68=== modified file 'ubuntuone/controlpanel/gui/qt/tests/test_wizard.py'
69--- ubuntuone/controlpanel/gui/qt/tests/test_wizard.py 2012-03-29 19:05:02 +0000
70+++ ubuntuone/controlpanel/gui/qt/tests/test_wizard.py 2012-11-13 10:10:24 +0000
71@@ -296,7 +296,7 @@
72
73
74 class UbuntuOneWizardSettingsTestCase(UbuntuOneWizardSignInTestCase):
75- """Test the CloudToComputerPage wizard page."""
76+ """Test the Settings wizard page."""
77
78 buttons = {'BackButton': (None, 'currentIdChanged', (1,))}
79 page_name = 'settings'
80@@ -304,7 +304,7 @@
81
82
83 class UbuntuOneWizardComputerToCloudTestCase(UbuntuOneWizardSignInTestCase):
84- """Test the CloudToComputerPage wizard page."""
85+ """Test the ComputerToCloudPage wizard page."""
86
87 buttons = {
88 'FinishButton': (None, 'finished', (gui.QtGui.QDialog.Accepted,)),
89@@ -354,6 +354,17 @@
90 method = 'login'
91
92 @defer.inlineCallbacks
93+ def setUp(self):
94+ yield super(UbuntuOneWizardLoginTestCase, self).setUp()
95+ self.connect_files_called = False
96+
97+ def fake_connect_files():
98+ self.connect_files_called = True
99+
100+ self.patch(self.ui.backend, 'connect_files',
101+ fake_connect_files)
102+
103+ @defer.inlineCallbacks
104 def test_with_credentials(self):
105 """Wizard is done when credentials were retrieved."""
106 self.ui.currentIdChanged.connect(self._set_called)
107@@ -370,7 +381,7 @@
108 button.click()
109
110 yield d
111-
112+ self.assertEqual(True, self.connect_files_called)
113 self.assertTrue(self.ui.signin_page.isEnabled())
114 expected_next_id = self.ui.pages[self.ui.cloud_folders_page]
115 self.assertEqual(self._called, ((expected_next_id,), {}))
116@@ -392,7 +403,7 @@
117 button.click()
118
119 yield d
120-
121+ self.assertEqual(False, self.connect_files_called)
122 self.assertTrue(self.ui.signin_page.isEnabled())
123 self.assertFalse(self._called)
124
125@@ -413,7 +424,7 @@
126 button.click()
127
128 yield d
129-
130+ self.assertEqual(False, self.connect_files_called)
131 self.assertTrue(self.ui.signin_page.isEnabled())
132 self.assertFalse(self._called) # the wizard page was not changed
133
134
135=== modified file 'ubuntuone/controlpanel/gui/qt/wizard.py'
136--- ubuntuone/controlpanel/gui/qt/wizard.py 2012-03-29 19:05:02 +0000
137+++ ubuntuone/controlpanel/gui/qt/wizard.py 2012-11-13 10:10:24 +0000
138@@ -298,6 +298,10 @@
139 def _process_credentials(self, credentials=None):
140 """Confirm which is the next step after analyzing 'credentials'."""
141 if credentials:
142+ # NOTE: we don't check the autoconnect key here because we
143+ # do need the connection for the initial remote volumes
144+ # list, and it is on by default anyway.
145+ self.backend.connect_files()
146 self.next()
147
148 @QtCore.pyqtSlot()

Subscribers

People subscribed via source and target branches