Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(752)

Side by Side Diff: chrome/browser/resources/chromeos/login/screen_locally_managed_user_creation.js

Issue 256223003: Supervised users import: make sure users are up-to-date. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixes Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/chromeos/login/managed/locally_managed_user_creation_screen.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @fileoverview Locally managed user creation flow screen. 6 * @fileoverview Locally managed user creation flow screen.
7 */ 7 */
8 8
9 login.createScreen('LocallyManagedUserCreationScreen', 9 login.createScreen('LocallyManagedUserCreationScreen',
10 'managed-user-creation', function() { 10 'managed-user-creation', function() {
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 }, 363 },
364 364
365 /** 365 /**
366 * Returns all the pods in this pod list. 366 * Returns all the pods in this pod list.
367 * @type {NodeList} 367 * @type {NodeList}
368 */ 368 */
369 get pods() { 369 get pods() {
370 return this.children; 370 return this.children;
371 }, 371 },
372 372
373 /**
374 * Returns selected pod.
375 * @type {Node}
376 */
377 get selectedPod() {
378 return this.selectedPod_;
379 },
380
373 addPod: function(user) { 381 addPod: function(user) {
374 var importPod = new ImportPod({user: user}); 382 var importPod = new ImportPod({user: user});
375 this.appendChild(importPod); 383 this.appendChild(importPod);
376 importPod.update(); 384 importPod.update();
377 }, 385 },
378 386
379 clearPods: function() { 387 clearPods: function() {
380 this.innerHTML = ''; 388 this.innerHTML = '';
381 this.selectedPod_ = null; 389 this.selectedPod_ = null;
382 }, 390 },
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
828 $('managed-user-creation-password-confirm').value; 836 $('managed-user-creation-password-confirm').value;
829 var userName = $('managed-user-creation-name').value; 837 var userName = $('managed-user-creation-name').value;
830 if (firstPassword != secondPassword) { 838 if (firstPassword != secondPassword) {
831 this.showPasswordError( 839 this.showPasswordError(
832 loadTimeData.getString('createManagedUserPasswordMismatchError')); 840 loadTimeData.getString('createManagedUserPasswordMismatchError'));
833 return; 841 return;
834 } 842 }
835 if (this.disabled) 843 if (this.disabled)
836 return; 844 return;
837 this.disabled = true; 845 this.disabled = true;
846
838 this.context_.managedName = userName; 847 this.context_.managedName = userName;
839 chrome.send('specifyLocallyManagedUserCreationFlowUserData', 848 chrome.send('specifyLocallyManagedUserCreationFlowUserData',
840 [userName, firstPassword]); 849 [userName, firstPassword]);
841 }, 850 },
842 851
843 /** 852 /**
844 * Does sanity check and calls backend with selected existing supervised 853 * Does sanity check and calls backend with selected existing supervised
845 * user id to import user. 854 * user id to import user.
846 * @private 855 * @private
847 */ 856 */
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after
1294 return this.disabled_; 1303 return this.disabled_;
1295 }, 1304 },
1296 1305
1297 set disabled(value) { 1306 set disabled(value) {
1298 this.disabled_ = value; 1307 this.disabled_ = value;
1299 var controls = this.querySelectorAll('button,input'); 1308 var controls = this.querySelectorAll('button,input');
1300 for (var i = 0, control; control = controls[i]; ++i) { 1309 for (var i = 0, control; control = controls[i]; ++i) {
1301 control.disabled = value; 1310 control.disabled = value;
1302 } 1311 }
1303 $('login-header-bar').disabled = value; 1312 $('login-header-bar').disabled = value;
1313 $('cancel-add-user-button').disabled = false;
1304 }, 1314 },
1305 1315
1306 /** 1316 /**
1307 * Called by backend part to propagate list of possible managers. 1317 * Called by backend part to propagate list of possible managers.
1308 * @param {Array} userList - list of users that can be managers. 1318 * @param {Array} userList - list of users that can be managers.
1309 */ 1319 */
1310 loadManagers: function(userList) { 1320 loadManagers: function(userList) {
1311 $('managed-user-creation-managers-block').hidden = false; 1321 $('managed-user-creation-managers-block').hidden = false;
1312 this.managerList_.clearPods(); 1322 this.managerList_.clearPods();
1313 for (var i = 0; i < userList.length; ++i) 1323 for (var i = 0; i < userList.length; ++i)
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
1535 chrome.send('supervisedUserDiscardPhoto'); 1545 chrome.send('supervisedUserDiscardPhoto');
1536 announceAccessibleMessage( 1546 announceAccessibleMessage(
1537 loadTimeData.getString('photoDiscardAccessibleText')); 1547 loadTimeData.getString('photoDiscardAccessibleText'));
1538 }, 1548 },
1539 1549
1540 setCameraPresent: function(present) { 1550 setCameraPresent: function(present) {
1541 this.getScreenElement('image-grid').cameraPresent = present; 1551 this.getScreenElement('image-grid').cameraPresent = present;
1542 }, 1552 },
1543 1553
1544 setExistingManagedUsers: function(users) { 1554 setExistingManagedUsers: function(users) {
1555 var selectedUser = null;
1556 // Store selected user
1557 if (this.importList_.selectedPod)
1558 selectedUser = this.importList_.selectedPod.user.id;
1559
1545 var userList = users; 1560 var userList = users;
1546
1547 userList.sort(function(a, b) { 1561 userList.sort(function(a, b) {
1548 // Put existing users last. 1562 // Put existing users last.
1549 if (a.exists != b.exists) 1563 if (a.exists != b.exists)
1550 return a.exists ? 1 : -1; 1564 return a.exists ? 1 : -1;
1551 // Sort rest by name. 1565 // Sort rest by name.
1552 return a.name.localeCompare(b.name, [], {sensitivity: 'base'}); 1566 return a.name.localeCompare(b.name, [], {sensitivity: 'base'});
1553 }); 1567 });
1554 1568
1555 this.importList_.clearPods(); 1569 this.importList_.clearPods();
1556 for (var i = 0; i < userList.length; ++i) 1570 var selectedIndex = -1;
1571 for (var i = 0; i < userList.length; ++i) {
1557 this.importList_.addPod(userList[i]); 1572 this.importList_.addPod(userList[i]);
1573 if (selectedUser == userList[i].id)
1574 selectedIndex = i;
1575 }
1558 1576
1559 if (userList.length == 1) 1577 if (userList.length == 1)
1560 this.importList_.selectPod(this.managerList_.pods[0]); 1578 this.importList_.selectPod(this.importList_.pods[0]);
1561 1579
1562 if (userList.length > 0 && this.currentPage_ == 'username') 1580 if (selectedIndex >= 0)
1563 this.getScreenElement('import-link').hidden = false; 1581 this.importList_.selectPod(this.importList_.pods[selectedIndex]);
1582
1583 if (this.currentPage_ == 'username')
1584 this.getScreenElement('import-link').hidden = (userList.length == 0);
1564 }, 1585 },
1565 }; 1586 };
1566 }); 1587 });
1567 1588
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/managed/locally_managed_user_creation_screen.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698