From 2f614c82d5d0a1748eff33a0ecac4e2b2461a8c0 Mon Sep 17 00:00:00 2001 From: Lloyd Wheeler Date: Wed, 20 Mar 2019 00:59:32 -0700 Subject: [PATCH 01/16] Add placeholder flag --- .../directives/peopleAndRoles/rolesTable/rolesTable.css | 4 ++++ .../directives/peopleAndRoles/rolesTable/rolesTable.html | 3 +++ app/workgroup/services/workgroupActionCreators.js | 1 + 3 files changed, 8 insertions(+) diff --git a/app/workgroup/directives/peopleAndRoles/rolesTable/rolesTable.css b/app/workgroup/directives/peopleAndRoles/rolesTable/rolesTable.css index 4ba2a39d7..cf3f2c06c 100644 --- a/app/workgroup/directives/peopleAndRoles/rolesTable/rolesTable.css +++ b/app/workgroup/directives/peopleAndRoles/rolesTable/rolesTable.css @@ -73,3 +73,7 @@ padding: 10px; color: #aaabae; } + +.roles-table__placeholder { + +} diff --git a/app/workgroup/directives/peopleAndRoles/rolesTable/rolesTable.html b/app/workgroup/directives/peopleAndRoles/rolesTable/rolesTable.html index f839fd8bf..30ebe02cf 100644 --- a/app/workgroup/directives/peopleAndRoles/rolesTable/rolesTable.html +++ b/app/workgroup/directives/peopleAndRoles/rolesTable/rolesTable.html @@ -71,6 +71,9 @@ {{ userRole.userDisplayName }} +
+ +
diff --git a/app/workgroup/services/workgroupActionCreators.js b/app/workgroup/services/workgroupActionCreators.js index e4d0ce07c..2bd88bc74 100644 --- a/app/workgroup/services/workgroupActionCreators.js +++ b/app/workgroup/services/workgroupActionCreators.js @@ -321,6 +321,7 @@ class WorkgroupActionCreators { workgroupId: userRole.workgroupId, userDisplayName: user.name, userId: user.id, + userIsPlaceholder: user.placeholder, userLoginId: user.loginId, userEmail: user.email, displayPresence: shouldDisplayPresence, From b222ea9f5a7aaadb92789c42510f14124651ac44 Mon Sep 17 00:00:00 2001 From: Lloyd Wheeler Date: Wed, 20 Mar 2019 01:29:26 -0700 Subject: [PATCH 02/16] Add tooltip to notification --- .../directives/peopleAndRoles/rolesTable/rolesTable.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/workgroup/directives/peopleAndRoles/rolesTable/rolesTable.html b/app/workgroup/directives/peopleAndRoles/rolesTable/rolesTable.html index 30ebe02cf..bfaf6ccd8 100644 --- a/app/workgroup/directives/peopleAndRoles/rolesTable/rolesTable.html +++ b/app/workgroup/directives/peopleAndRoles/rolesTable/rolesTable.html @@ -72,7 +72,7 @@ {{ userRole.userDisplayName }}
- +
From 2e34d630aa943976fcb88cc66ef727134385c722 Mon Sep 17 00:00:00 2001 From: Lloyd Wheeler Date: Thu, 28 Mar 2019 10:45:43 -0700 Subject: [PATCH 03/16] Adding freeform user button --- .../peopleAndRoles/rolesTable/rolesTable.html | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/workgroup/directives/peopleAndRoles/rolesTable/rolesTable.html b/app/workgroup/directives/peopleAndRoles/rolesTable/rolesTable.html index bfaf6ccd8..6fac189f7 100644 --- a/app/workgroup/directives/peopleAndRoles/rolesTable/rolesTable.html +++ b/app/workgroup/directives/peopleAndRoles/rolesTable/rolesTable.html @@ -35,7 +35,15 @@ - + +
+ + + +
From bc37a899276b6ec232ef6ae07f8b222f0b020fa7 Mon Sep 17 00:00:00 2001 From: Lloyd Wheeler Date: Thu, 28 Mar 2019 13:30:26 -0700 Subject: [PATCH 04/16] Add UI to add placeholder person --- .../peopleAndRoles/rolesTable/rolesTable.html | 46 ++++- .../peopleAndRoles/rolesTable/rolesTable.js | 176 ++++++++++++------ 2 files changed, 166 insertions(+), 56 deletions(-) diff --git a/app/workgroup/directives/peopleAndRoles/rolesTable/rolesTable.html b/app/workgroup/directives/peopleAndRoles/rolesTable/rolesTable.html index 6fac189f7..3d5b66eff 100644 --- a/app/workgroup/directives/peopleAndRoles/rolesTable/rolesTable.html +++ b/app/workgroup/directives/peopleAndRoles/rolesTable/rolesTable.html @@ -36,12 +36,52 @@ -
- +
+
+
+ + +
+
+ + +
+
+ + +
+
+ + + + +
diff --git a/app/workgroup/directives/peopleAndRoles/rolesTable/rolesTable.js b/app/workgroup/directives/peopleAndRoles/rolesTable/rolesTable.js index 97272c9ca..8ff44877f 100644 --- a/app/workgroup/directives/peopleAndRoles/rolesTable/rolesTable.js +++ b/app/workgroup/directives/peopleAndRoles/rolesTable/rolesTable.js @@ -1,56 +1,126 @@ -import './rolesTable.css'; - -let rolesTable = function ($rootScope, WorkgroupActionCreators, WorkgroupService) { - return { - restrict: 'E', - template: require('./rolesTable.html'), - replace: true, - scope: { - userRoles: '<', - activeRoleId: '<', - users: '<', - ui: '<' - }, - link: function(scope) { - scope.view = { - loadingPeople: false, - noResults: false - }; - - scope.removeUserRole = function (userRole) { - WorkgroupActionCreators.removeRoleFromUser(userRole.userId, userRole.roleId, userRole); - }; - - scope.clearUserSearch = function () { - scope.users.newUser = {}; - scope.users.searchQuery = ""; - scope.view.noResults = false; - }; - - scope.searchOnChange = function () { - scope.view.noResults = false; - scope.users.newUser = {}; - }; - - scope.searchUsers = function (query) { - return WorkgroupService.searchUsers(scope.ui.workgroupId, query).then(function (userSearchResults) { - return userSearchResults; - }, function () { - $rootScope.$emit('toast', {message: "Could not search users.", type: "ERROR"}); - }); - }; - - scope.searchUsersResultSelected = function ($item) { - scope.users.newUser = $item; - }; - - scope.addUserToWorkgroup = function() { - scope.users.newUser; - WorkgroupActionCreators.createUser(scope.ui.workgroupId, scope.users.newUser, scope.activeRoleId); - scope.clearUserSearch(); - }; - } - }; +import "./rolesTable.css"; + +let rolesTable = function( + $rootScope, + WorkgroupActionCreators, + WorkgroupService +) { + return { + restrict: "E", + template: require("./rolesTable.html"), + replace: true, + scope: { + userRoles: "<", + activeRoleId: "<", + users: "<", + ui: "<" + }, + link: function(scope) { + scope.view = { + loadingPeople: false, + noResults: false, + placeholder: { + show: false, + first: "", + last: "", + email: "", + validationMessage: "" + } + }; + + scope.removeUserRole = function(userRole) { + WorkgroupActionCreators.removeRoleFromUser( + userRole.userId, + userRole.roleId, + userRole + ); + }; + + scope.openPlaceholderUI = function() { + scope.view.placeholder.show = true; + }; + + scope.closePlaceholderUI = function() { + scope.view.placeholder.show = false; + scope.view.placeholder.first = ""; + scope.view.placeholder.last = ""; + scope.view.placeholder.email = ""; + }; + + scope.isPlaceholderUserValid = function() { + if (!scope.view.placeholder.show) { + scope.view.placeholder.validationMessage = ""; + return false; + } + + if ( + !scope.view.placeholder.first && + !scope.view.placeholder.last && + !scope.view.placeholder.email + ) { + scope.view.placeholder.validationMessage = ""; + return false; + } + + if (!scope.view.placeholder.first) { + scope.view.placeholder.validationMessage = "First name is required"; + return false; + } + + if (!scope.view.placeholder.last) { + scope.view.placeholder.validationMessage = "Last name is required"; + return false; + } + + if (!scope.view.placeholder.email) { + scope.view.placeholder.validationMessage = "Email is required"; + return false; + } + + scope.view.placeholder.validationMessage = ""; + return true; + }; + + scope.clearUserSearch = function() { + scope.users.newUser = {}; + scope.users.searchQuery = ""; + scope.view.noResults = false; + }; + + scope.searchOnChange = function() { + scope.view.noResults = false; + scope.users.newUser = {}; + }; + + scope.searchUsers = function(query) { + return WorkgroupService.searchUsers(scope.ui.workgroupId, query).then( + function(userSearchResults) { + return userSearchResults; + }, + function() { + $rootScope.$emit("toast", { + message: "Could not search users.", + type: "ERROR" + }); + } + ); + }; + + scope.searchUsersResultSelected = function($item) { + scope.users.newUser = $item; + }; + + scope.addUserToWorkgroup = function() { + scope.users.newUser; + WorkgroupActionCreators.createUser( + scope.ui.workgroupId, + scope.users.newUser, + scope.activeRoleId + ); + scope.clearUserSearch(); + }; + } + }; }; export default rolesTable; From 16a07664001918f8bccc3feea5c9d88582bbb5cf Mon Sep 17 00:00:00 2001 From: Lloyd Wheeler Date: Wed, 3 Apr 2019 04:39:35 -0700 Subject: [PATCH 05/16] Adding freeform user UI updates --- .../peopleAndRoles/rolesTable/rolesTable.css | 8 ++- .../peopleAndRoles/rolesTable/rolesTable.html | 47 +++++++++++++--- .../peopleAndRoles/rolesTable/rolesTable.js | 54 ++++++++++++++++--- .../services/workgroupActionCreators.js | 33 ++++++++++++ app/workgroup/services/workgroupService.js | 6 +++ .../services/workgroupStateService.js | 3 ++ app/workgroup/workgroupApp.js | 3 +- 7 files changed, 136 insertions(+), 18 deletions(-) diff --git a/app/workgroup/directives/peopleAndRoles/rolesTable/rolesTable.css b/app/workgroup/directives/peopleAndRoles/rolesTable/rolesTable.css index cf3f2c06c..4f35c7536 100644 --- a/app/workgroup/directives/peopleAndRoles/rolesTable/rolesTable.css +++ b/app/workgroup/directives/peopleAndRoles/rolesTable/rolesTable.css @@ -74,6 +74,10 @@ color: #aaabae; } -.roles-table__placeholder { - +.roles-table__placeholder-update-validation { + padding-top: 2px; + padding-bottom: 2px; + min-height: 1.3em; + line-height: 1; + color: gray; } diff --git a/app/workgroup/directives/peopleAndRoles/rolesTable/rolesTable.html b/app/workgroup/directives/peopleAndRoles/rolesTable/rolesTable.html index 3d5b66eff..a24d4ba17 100644 --- a/app/workgroup/directives/peopleAndRoles/rolesTable/rolesTable.html +++ b/app/workgroup/directives/peopleAndRoles/rolesTable/rolesTable.html @@ -39,13 +39,13 @@
-
- @@ -58,7 +58,7 @@
- + @@ -87,6 +87,13 @@
+ + + + + + + diff --git a/app/workgroup/directives/peopleAndRoles/rolesTable/rolesTable.js b/app/workgroup/directives/peopleAndRoles/rolesTable/rolesTable.js index 8ff44877f..863d9863e 100644 --- a/app/workgroup/directives/peopleAndRoles/rolesTable/rolesTable.js +++ b/app/workgroup/directives/peopleAndRoles/rolesTable/rolesTable.js @@ -21,10 +21,15 @@ let rolesTable = function( noResults: false, placeholder: { show: false, - first: "", - last: "", + firstName: "", + lastName: "", email: "", validationMessage: "" + }, + placeholderUpdate: { + show: false, + loginId: "", + validationMessage: "" } }; @@ -42,11 +47,40 @@ let rolesTable = function( scope.closePlaceholderUI = function() { scope.view.placeholder.show = false; - scope.view.placeholder.first = ""; - scope.view.placeholder.last = ""; + scope.view.placeholder.firstName = ""; + scope.view.placeholder.lastName = ""; scope.view.placeholder.email = ""; }; + scope.openPlaceholderUpdateUI = function () { + scope.view.placeholderUpdate.show = true; + }; + + scope.closePlaceholderUpdateUI = function () { + scope.view.placeholderUpdate.show = false; + scope.view.placeholderUpdate.loginId = ""; + scope.view.placeholderUpdate.validationMessage = ""; + scope.view.placeholderUpdate.isValid = false; + scope.view.placeholderUpdate.dwUser = null; + }; + + scope.isPlaceholderUpdateValid = function () { + scope.searchUsers(scope.view.placeholderUpdate.loginId).then(function(results) { + if (results.length == 1) { + scope.view.placeholderUpdate.validationMessage = results[0].name + '(' + results[0].email + ')'; + scope.view.placeholderUpdate.isValid = true; + scope.view.placeholderUpdate.dwUser = results[0]; + } else { + scope.view.placeholderUpdate.validationMessage = "No users with that loginid found"; + scope.view.placeholderUpdate.isValid = false; + } + }); + }; + + scope.updatePlaceholderUser = function (userRole) { + WorkgroupActionCreators.updatePlaceholderUser(scope.view.placeholderUpdate.dwUser, userRole.userLoginId); + }; + scope.isPlaceholderUserValid = function() { if (!scope.view.placeholder.show) { scope.view.placeholder.validationMessage = ""; @@ -54,20 +88,20 @@ let rolesTable = function( } if ( - !scope.view.placeholder.first && - !scope.view.placeholder.last && + !scope.view.placeholder.firstName && + !scope.view.placeholder.lastName && !scope.view.placeholder.email ) { scope.view.placeholder.validationMessage = ""; return false; } - if (!scope.view.placeholder.first) { + if (!scope.view.placeholder.firstName) { scope.view.placeholder.validationMessage = "First name is required"; return false; } - if (!scope.view.placeholder.last) { + if (!scope.view.placeholder.lastName) { scope.view.placeholder.validationMessage = "Last name is required"; return false; } @@ -81,6 +115,10 @@ let rolesTable = function( return true; }; + scope.addPlaceholderUser = function() { + WorkgroupActionCreators.addPlaceholderUser(scope.view.placeholder); + }; + scope.clearUserSearch = function() { scope.users.newUser = {}; scope.users.searchQuery = ""; diff --git a/app/workgroup/services/workgroupActionCreators.js b/app/workgroup/services/workgroupActionCreators.js index 2bd88bc74..c28f48d42 100644 --- a/app/workgroup/services/workgroupActionCreators.js +++ b/app/workgroup/services/workgroupActionCreators.js @@ -54,6 +54,39 @@ class WorkgroupActionCreators { $rootScope.$emit('toast', { message: "Could not update instructor type", type: "ERROR" }); }); }, + addPlaceholderUser: function (placeholderUser) { + var _this = this; + + var roleId = WorkgroupStateService._state.ui.roles.activeRoleId; + var workgroupId = parseInt(WorkgroupStateService._state.ui.workgroupId); + + WorkgroupService.addPlaceholderUser(placeholderUser, workgroupId).then(function (newUser) { + WorkgroupStateService.reduce({ + type: ActionTypes.ADD_USER_COMPLETED, + payload: { + user: newUser + } + }); + + var role = new Role({ name: WorkgroupStateService._state.roles.list[roleId].name }); + _this.addRoleToUser(workgroupId, newUser, new Role({ name: "presence"})); + _this.addRoleToUser(workgroupId, newUser, role); + }, function () { + $rootScope.$emit('toast', { message: "Could not add user.", type: "ERROR" }); + }); + }, + updatePlaceholderUser: function (user, previousLoginId) { + var workgroupId = parseInt(WorkgroupStateService._state.ui.workgroupId); + + WorkgroupService.updatePlaceholderUser(user, previousLoginId, workgroupId).then(function (newUser) { + WorkgroupStateService.reduce({ + type: ActionTypes.UPDATE_USER, + payload: { + user: newUser + } + }); + }); + }, addTag: function (workgroupId, tag) { WorkgroupService.addTag(workgroupId, tag).then(function (newTag) { $rootScope.$emit('toast', { message: "Created tag " + newTag.name, type: "SUCCESS" }); diff --git a/app/workgroup/services/workgroupService.js b/app/workgroup/services/workgroupService.js index 824cf00c1..0367ddd9a 100644 --- a/app/workgroup/services/workgroupService.js +++ b/app/workgroup/services/workgroupService.js @@ -51,6 +51,12 @@ class WorkgroupService { updateUserRole: function (userRole) { return ApiService.put("/api/workgroupView/userRoles/" + userRole.id + "/roles/" + userRole.roleId); }, + addPlaceholderUser: function (placeholderUser, workgroupId) { + return ApiService.post("/api/workgroups/" + workgroupId + "/users/placeholder/", placeholderUser); + }, + updatePlaceholderUser: function (user, previousLoginId, workgroupId) { + return ApiService.put("/api/workgroups/" + workgroupId + "/users/placeholder/" + previousLoginId, user); + } }; } } diff --git a/app/workgroup/services/workgroupStateService.js b/app/workgroup/services/workgroupStateService.js index 0827b164e..d125f2500 100644 --- a/app/workgroup/services/workgroupStateService.js +++ b/app/workgroup/services/workgroupStateService.js @@ -155,6 +155,9 @@ class WorkgroupStateService { users.userSearchResults = []; users.searchQuery = ""; return users; + case ActionTypes.UPDATE_USER: + users.list[action.payload.user.id] = new User(action.payload.user); + return users; case ActionTypes.REMOVE_USER: userIndex = users.ids.indexOf(action.payload.user.id); users.ids.splice(userIndex, 1); diff --git a/app/workgroup/workgroupApp.js b/app/workgroup/workgroupApp.js index a66c0024e..e85d62dcc 100644 --- a/app/workgroup/workgroupApp.js +++ b/app/workgroup/workgroupApp.js @@ -101,7 +101,8 @@ const workgroupApp = angular.module("workgroupApp", dependencies) // eslint-disa UPDATE_USER_ROLE: "UPDATE_USER_ROLE", SET_ROLE_TAB: "SET_ROLE_TAB", CALCULATE_USER_ROLES: "CALCULATE_USER_ROLES", - CALCULATE_ROLE_TOTALS: "CALCULATE_ROLE_TOTALS" + CALCULATE_ROLE_TOTALS: "CALCULATE_ROLE_TOTALS", + UPDATE_USER: "UPDATE_USER" }); export default workgroupApp; From c282dd39db495b6cc8ed59d5dd12c8595b9e3a62 Mon Sep 17 00:00:00 2001 From: Lloyd Wheeler Date: Wed, 3 Apr 2019 08:08:37 -0700 Subject: [PATCH 06/16] After replacing placeholder user, should update in UI immediately --- app/workgroup/services/workgroupActionCreators.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/workgroup/services/workgroupActionCreators.js b/app/workgroup/services/workgroupActionCreators.js index c28f48d42..136cf9ec9 100644 --- a/app/workgroup/services/workgroupActionCreators.js +++ b/app/workgroup/services/workgroupActionCreators.js @@ -76,6 +76,7 @@ class WorkgroupActionCreators { }); }, updatePlaceholderUser: function (user, previousLoginId) { + var _this = this; var workgroupId = parseInt(WorkgroupStateService._state.ui.workgroupId); WorkgroupService.updatePlaceholderUser(user, previousLoginId, workgroupId).then(function (newUser) { @@ -85,8 +86,10 @@ class WorkgroupActionCreators { user: newUser } }); - }); - }, + + _this._calculateUserRoles(); + }); + }, addTag: function (workgroupId, tag) { WorkgroupService.addTag(workgroupId, tag).then(function (newTag) { $rootScope.$emit('toast', { message: "Created tag " + newTag.name, type: "SUCCESS" }); From e1b3059a8676e492dbec1394954659c77b136fd5 Mon Sep 17 00:00:00 2001 From: Lloyd Wheeler Date: Wed, 3 Apr 2019 08:15:28 -0700 Subject: [PATCH 07/16] Close UI on submit --- .../directives/peopleAndRoles/rolesTable/rolesTable.js | 9 ++++++++- app/workgroup/services/workgroupActionCreators.js | 3 ++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/app/workgroup/directives/peopleAndRoles/rolesTable/rolesTable.js b/app/workgroup/directives/peopleAndRoles/rolesTable/rolesTable.js index 863d9863e..991c6ca0d 100644 --- a/app/workgroup/directives/peopleAndRoles/rolesTable/rolesTable.js +++ b/app/workgroup/directives/peopleAndRoles/rolesTable/rolesTable.js @@ -116,7 +116,14 @@ let rolesTable = function( }; scope.addPlaceholderUser = function() { - WorkgroupActionCreators.addPlaceholderUser(scope.view.placeholder); + var user = { + firstName: scope.view.placeholder.firstName, + lastName: scope.view.placeholder.lastName, + email: scope.view.placeholder.email + }; + + WorkgroupActionCreators.addPlaceholderUser(user); + scope.closePlaceholderUI(); }; scope.clearUserSearch = function() { diff --git a/app/workgroup/services/workgroupActionCreators.js b/app/workgroup/services/workgroupActionCreators.js index 136cf9ec9..7f147f2a9 100644 --- a/app/workgroup/services/workgroupActionCreators.js +++ b/app/workgroup/services/workgroupActionCreators.js @@ -67,6 +67,7 @@ class WorkgroupActionCreators { user: newUser } }); + $rootScope.$emit('toast', { message: "Added user", type: "SUCCESS" }); var role = new Role({ name: WorkgroupStateService._state.roles.list[roleId].name }); _this.addRoleToUser(workgroupId, newUser, new Role({ name: "presence"})); @@ -86,7 +87,7 @@ class WorkgroupActionCreators { user: newUser } }); - + $rootScope.$emit('toast', { message: "Updated user", type: "SUCCESS" }); _this._calculateUserRoles(); }); }, From 473e5db8f248e995bc07f18003fd6b5a4c85d6b4 Mon Sep 17 00:00:00 2001 From: Lloyd Wheeler Date: Wed, 3 Apr 2019 08:21:14 -0700 Subject: [PATCH 08/16] Update styling on warning icon --- .../peopleAndRoles/rolesTable/rolesTable.css | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/app/workgroup/directives/peopleAndRoles/rolesTable/rolesTable.css b/app/workgroup/directives/peopleAndRoles/rolesTable/rolesTable.css index 4f35c7536..0e1868bd5 100644 --- a/app/workgroup/directives/peopleAndRoles/rolesTable/rolesTable.css +++ b/app/workgroup/directives/peopleAndRoles/rolesTable/rolesTable.css @@ -81,3 +81,14 @@ line-height: 1; color: gray; } + +.roles-table__placeholder { + color: #f5a0a0; + border: 1px solid; + border-radius: 4px; + font-size: 15px; + padding-top: 3px; + padding-left: 4px; + padding-right: 4px; + padding-bottom: 3px; +} \ No newline at end of file From 428fe81d9d56c13a10a74c6546ae9ff855c99e98 Mon Sep 17 00:00:00 2001 From: Lloyd Wheeler Date: Wed, 3 Apr 2019 09:03:00 -0700 Subject: [PATCH 09/16] Refactoring into modal --- .../addPlaceholderUser.html | 39 +++++++ .../addPlaceholderUser/addPlaceholderUser.js | 64 +++++++++++ .../peopleAndRoles/rolesTable/rolesTable.css | 18 ++- .../peopleAndRoles/rolesTable/rolesTable.html | 108 +++++++----------- .../peopleAndRoles/rolesTable/rolesTable.js | 67 +---------- .../services/workgroupActionCreators.js | 6 + .../services/workgroupStateService.js | 4 + app/workgroup/templates/WorkgroupCtrl.html | 7 ++ app/workgroup/workgroupApp.js | 5 +- 9 files changed, 186 insertions(+), 132 deletions(-) create mode 100644 app/workgroup/directives/modals/addPlaceholderUser/addPlaceholderUser.html create mode 100644 app/workgroup/directives/modals/addPlaceholderUser/addPlaceholderUser.js diff --git a/app/workgroup/directives/modals/addPlaceholderUser/addPlaceholderUser.html b/app/workgroup/directives/modals/addPlaceholderUser/addPlaceholderUser.html new file mode 100644 index 000000000..e2b3f7876 --- /dev/null +++ b/app/workgroup/directives/modals/addPlaceholderUser/addPlaceholderUser.html @@ -0,0 +1,39 @@ +
+
+ + +
+
+ + +
+
+ + +
+ +
+ + + +
+
diff --git a/app/workgroup/directives/modals/addPlaceholderUser/addPlaceholderUser.js b/app/workgroup/directives/modals/addPlaceholderUser/addPlaceholderUser.js new file mode 100644 index 000000000..352bc5e64 --- /dev/null +++ b/app/workgroup/directives/modals/addPlaceholderUser/addPlaceholderUser.js @@ -0,0 +1,64 @@ +let addPlaceholderUser = function (WorkgroupActionCreators) { + return { + restrict: 'E', + template: require('./addPlaceholderUser.html'), + replace: true, + scope: { + isVisible: '=' + }, + link: function (scope) { + scope.view = { + firstName: "", + lastName: "", + email: "", + validationMessage: "" + }; + + scope.addPlaceholderUser = function() { + var user = { + firstName: scope.view.firstName, + lastName: scope.view.lastName, + email: scope.view.email + }; + + WorkgroupActionCreators.addPlaceholderUser(user); + scope.close(); + }; + + scope.isPlaceholderUserValid = function() { + if ( + !scope.view.firstName && + !scope.view.lastName && + !scope.view.email + ) { + scope.view.validationMessage = ""; + return false; + } + + if (!scope.view.firstName) { + scope.view.validationMessage = "First name is required"; + return false; + } + + if (!scope.view.lastName) { + scope.view.validationMessage = "Last name is required"; + return false; + } + + if (!scope.view.email) { + scope.view.validationMessage = "Email is required"; + return false; + } + + scope.view.validationMessage = ""; + return true; + }; + + scope.close = function () { + scope.isVisible = false; + }; + } // end link + }; +}; + +export default addPlaceholderUser; diff --git a/app/workgroup/directives/peopleAndRoles/rolesTable/rolesTable.css b/app/workgroup/directives/peopleAndRoles/rolesTable/rolesTable.css index 0e1868bd5..e2aca812f 100644 --- a/app/workgroup/directives/peopleAndRoles/rolesTable/rolesTable.css +++ b/app/workgroup/directives/peopleAndRoles/rolesTable/rolesTable.css @@ -91,4 +91,20 @@ padding-left: 4px; padding-right: 4px; padding-bottom: 3px; -} \ No newline at end of file +} + +.roles-table__update-placeholder-ui { + padding-top: 5px; +} + +.roles-table__update-placeholder-container { + display: flex; +} + +.roles-table__update-placeholder-input { + margin-left: -5px; +} + +.roles-table__update-placeholder-buttons { + padding-right: 2px; +} diff --git a/app/workgroup/directives/peopleAndRoles/rolesTable/rolesTable.html b/app/workgroup/directives/peopleAndRoles/rolesTable/rolesTable.html index a24d4ba17..cf2db102f 100644 --- a/app/workgroup/directives/peopleAndRoles/rolesTable/rolesTable.html +++ b/app/workgroup/directives/peopleAndRoles/rolesTable/rolesTable.html @@ -37,51 +37,13 @@
-
-
- - -
-
- - -
-
- - -
-
- - - -
@@ -125,36 +87,48 @@ ng-if="(activeRoleId == -1 && (userRole.roleId == 11 || userRole.roleId == 12 || userRole.roleId == 13)) || (userRole.roleId == activeRoleId && (activeRoleId != 9 || userRole.displayPresence))">
diff --git a/app/workgroup/directives/peopleAndRoles/rolesTable/rolesTable.js b/app/workgroup/directives/peopleAndRoles/rolesTable/rolesTable.js index 991c6ca0d..14d79bb5c 100644 --- a/app/workgroup/directives/peopleAndRoles/rolesTable/rolesTable.js +++ b/app/workgroup/directives/peopleAndRoles/rolesTable/rolesTable.js @@ -19,13 +19,6 @@ let rolesTable = function( scope.view = { loadingPeople: false, noResults: false, - placeholder: { - show: false, - firstName: "", - lastName: "", - email: "", - validationMessage: "" - }, placeholderUpdate: { show: false, loginId: "", @@ -33,6 +26,10 @@ let rolesTable = function( } }; + scope.openPlaceholderModal = function () { + WorkgroupActionCreators.openPlaceholderModal(); + }; + scope.removeUserRole = function(userRole) { WorkgroupActionCreators.removeRoleFromUser( userRole.userId, @@ -41,17 +38,6 @@ let rolesTable = function( ); }; - scope.openPlaceholderUI = function() { - scope.view.placeholder.show = true; - }; - - scope.closePlaceholderUI = function() { - scope.view.placeholder.show = false; - scope.view.placeholder.firstName = ""; - scope.view.placeholder.lastName = ""; - scope.view.placeholder.email = ""; - }; - scope.openPlaceholderUpdateUI = function () { scope.view.placeholderUpdate.show = true; }; @@ -81,51 +67,6 @@ let rolesTable = function( WorkgroupActionCreators.updatePlaceholderUser(scope.view.placeholderUpdate.dwUser, userRole.userLoginId); }; - scope.isPlaceholderUserValid = function() { - if (!scope.view.placeholder.show) { - scope.view.placeholder.validationMessage = ""; - return false; - } - - if ( - !scope.view.placeholder.firstName && - !scope.view.placeholder.lastName && - !scope.view.placeholder.email - ) { - scope.view.placeholder.validationMessage = ""; - return false; - } - - if (!scope.view.placeholder.firstName) { - scope.view.placeholder.validationMessage = "First name is required"; - return false; - } - - if (!scope.view.placeholder.lastName) { - scope.view.placeholder.validationMessage = "Last name is required"; - return false; - } - - if (!scope.view.placeholder.email) { - scope.view.placeholder.validationMessage = "Email is required"; - return false; - } - - scope.view.placeholder.validationMessage = ""; - return true; - }; - - scope.addPlaceholderUser = function() { - var user = { - firstName: scope.view.placeholder.firstName, - lastName: scope.view.placeholder.lastName, - email: scope.view.placeholder.email - }; - - WorkgroupActionCreators.addPlaceholderUser(user); - scope.closePlaceholderUI(); - }; - scope.clearUserSearch = function() { scope.users.newUser = {}; scope.users.searchQuery = ""; diff --git a/app/workgroup/services/workgroupActionCreators.js b/app/workgroup/services/workgroupActionCreators.js index 7f147f2a9..b6c24feaf 100644 --- a/app/workgroup/services/workgroupActionCreators.js +++ b/app/workgroup/services/workgroupActionCreators.js @@ -54,6 +54,12 @@ class WorkgroupActionCreators { $rootScope.$emit('toast', { message: "Could not update instructor type", type: "ERROR" }); }); }, + openPlaceholderModal: function () { + WorkgroupStateService.reduce({ + type: ActionTypes.OPEN_PLACEHOLDER_MODAL, + payload: {} + }); + }, addPlaceholderUser: function (placeholderUser) { var _this = this; diff --git a/app/workgroup/services/workgroupStateService.js b/app/workgroup/services/workgroupStateService.js index d125f2500..a8f9b6503 100644 --- a/app/workgroup/services/workgroupStateService.js +++ b/app/workgroup/services/workgroupStateService.js @@ -230,6 +230,7 @@ class WorkgroupStateService { switch (action.type) { case ActionTypes.INIT_WORKGROUP: ui = { + isAddPlaceholderModalOpen: false, addUserPending: false, workgroupId: action.workgroupId, roles: { @@ -258,6 +259,9 @@ class WorkgroupStateService { ui.instructorTypes.push(instructorType); }); return ui; + case ActionTypes.OPEN_PLACEHOLDER_MODAL: + ui.isAddPlaceholderModalOpen = true; + return ui; case ActionTypes.SET_ROLE_TAB: ui.roles.activeRoleTab = action.payload.activeRoleTab; ui.roles.activeRoleId = action.payload.activeRoleId; diff --git a/app/workgroup/templates/WorkgroupCtrl.html b/app/workgroup/templates/WorkgroupCtrl.html index 885326d1a..fd0a38d60 100644 --- a/app/workgroup/templates/WorkgroupCtrl.html +++ b/app/workgroup/templates/WorkgroupCtrl.html @@ -12,6 +12,13 @@ + + + + +
- - -
+ + + + + + + + diff --git a/app/workgroup/directives/modals/addPlaceholderUser/addPlaceholderUser.js b/app/workgroup/directives/modals/addPlaceholderUser/addPlaceholderUser.js index 352bc5e64..23d6a114b 100644 --- a/app/workgroup/directives/modals/addPlaceholderUser/addPlaceholderUser.js +++ b/app/workgroup/directives/modals/addPlaceholderUser/addPlaceholderUser.js @@ -1,3 +1,5 @@ +import './addPlaceholderUser.css'; + let addPlaceholderUser = function (WorkgroupActionCreators) { return { restrict: 'E', From 777448d1ef789196b3350e0a1d9c01544e424f19 Mon Sep 17 00:00:00 2001 From: Lloyd Wheeler Date: Wed, 3 Apr 2019 10:51:29 -0700 Subject: [PATCH 11/16] Add warning to placeholder user modal --- .../modals/addPlaceholderUser/addPlaceholderUser.css | 5 +++++ .../modals/addPlaceholderUser/addPlaceholderUser.html | 7 ++++++- .../directives/peopleAndRoles/rolesTable/rolesTable.css | 5 +++++ .../directives/peopleAndRoles/rolesTable/rolesTable.html | 4 ++-- app/workgroup/templates/WorkgroupCtrl.html | 2 +- 5 files changed, 19 insertions(+), 4 deletions(-) diff --git a/app/workgroup/directives/modals/addPlaceholderUser/addPlaceholderUser.css b/app/workgroup/directives/modals/addPlaceholderUser/addPlaceholderUser.css index 6c5c1627e..5c373cf74 100644 --- a/app/workgroup/directives/modals/addPlaceholderUser/addPlaceholderUser.css +++ b/app/workgroup/directives/modals/addPlaceholderUser/addPlaceholderUser.css @@ -18,3 +18,8 @@ padding-top: 15px; background-color: rgb(248, 248, 248); } + +.add-placeholder-user__warning { + padding: 10px; + color: gray; +} diff --git a/app/workgroup/directives/modals/addPlaceholderUser/addPlaceholderUser.html b/app/workgroup/directives/modals/addPlaceholderUser/addPlaceholderUser.html index f90dfa082..041eedff9 100644 --- a/app/workgroup/directives/modals/addPlaceholderUser/addPlaceholderUser.html +++ b/app/workgroup/directives/modals/addPlaceholderUser/addPlaceholderUser.html @@ -1,4 +1,9 @@ -
+
+
+ Please note: This should only be used to add a user who does NOT yet have a valid kerberos account. + This user will not be able to login to IPA (until you provide the kerberos login id), + but you will be able to refer to them in IPA and include them in your scheduling plans. +
- +
diff --git a/app/workgroup/templates/WorkgroupCtrl.html b/app/workgroup/templates/WorkgroupCtrl.html index fd0a38d60..b13cef8d9 100644 --- a/app/workgroup/templates/WorkgroupCtrl.html +++ b/app/workgroup/templates/WorkgroupCtrl.html @@ -13,7 +13,7 @@ + header-text="Add Placeholder User"> From ab519a23741c226306edf946cbad970b86599d5a Mon Sep 17 00:00:00 2001 From: Lloyd Wheeler Date: Wed, 3 Apr 2019 11:24:06 -0700 Subject: [PATCH 12/16] Fixing whitespace --- .../addPlaceholderUser.html | 3 +- .../addPlaceholderUser/addPlaceholderUser.js | 28 +++++++++---------- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/app/workgroup/directives/modals/addPlaceholderUser/addPlaceholderUser.html b/app/workgroup/directives/modals/addPlaceholderUser/addPlaceholderUser.html index 041eedff9..1f817b29f 100644 --- a/app/workgroup/directives/modals/addPlaceholderUser/addPlaceholderUser.html +++ b/app/workgroup/directives/modals/addPlaceholderUser/addPlaceholderUser.html @@ -1,6 +1,7 @@
- Please note: This should only be used to add a user who does NOT yet have a valid kerberos account. + Please note: This form should only be used to add a user if they do NOT have a kerberos account yet. +
This user will not be able to login to IPA (until you provide the kerberos login id), but you will be able to refer to them in IPA and include them in your scheduling plans.
diff --git a/app/workgroup/directives/modals/addPlaceholderUser/addPlaceholderUser.js b/app/workgroup/directives/modals/addPlaceholderUser/addPlaceholderUser.js index 23d6a114b..c684d1141 100644 --- a/app/workgroup/directives/modals/addPlaceholderUser/addPlaceholderUser.js +++ b/app/workgroup/directives/modals/addPlaceholderUser/addPlaceholderUser.js @@ -1,20 +1,20 @@ import './addPlaceholderUser.css'; let addPlaceholderUser = function (WorkgroupActionCreators) { - return { - restrict: 'E', - template: require('./addPlaceholderUser.html'), - replace: true, - scope: { - isVisible: '=' - }, - link: function (scope) { - scope.view = { - firstName: "", - lastName: "", - email: "", - validationMessage: "" - }; + return { + restrict: 'E', + template: require('./addPlaceholderUser.html'), + replace: true, + scope: { + isVisible: '=' + }, + link: function (scope) { + scope.view = { + firstName: "", + lastName: "", + email: "", + validationMessage: "" + }; scope.addPlaceholderUser = function() { var user = { From 3a8d3b97dbad38acc652b5befc8225716bf2fe8b Mon Sep 17 00:00:00 2001 From: Lloyd Wheeler Date: Wed, 3 Apr 2019 11:24:37 -0700 Subject: [PATCH 13/16] Fixing whitespace --- .../directives/peopleAndRoles/rolesTable/rolesTable.css | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/workgroup/directives/peopleAndRoles/rolesTable/rolesTable.css b/app/workgroup/directives/peopleAndRoles/rolesTable/rolesTable.css index bdf27347d..d4958e939 100644 --- a/app/workgroup/directives/peopleAndRoles/rolesTable/rolesTable.css +++ b/app/workgroup/directives/peopleAndRoles/rolesTable/rolesTable.css @@ -110,6 +110,6 @@ } .roles-table__placeholder-person-ui { - display: flex; - justify-content: flex-end; + display: flex; + justify-content: flex-end; } From ff1f4887476c3c9cceb4b4d2b3ea2c81945204d7 Mon Sep 17 00:00:00 2001 From: Lloyd Wheeler Date: Wed, 3 Apr 2019 11:25:24 -0700 Subject: [PATCH 14/16] Fixing whitespace --- app/workgroup/templates/WorkgroupCtrl.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/workgroup/templates/WorkgroupCtrl.html b/app/workgroup/templates/WorkgroupCtrl.html index b13cef8d9..51cb1efff 100644 --- a/app/workgroup/templates/WorkgroupCtrl.html +++ b/app/workgroup/templates/WorkgroupCtrl.html @@ -15,7 +15,7 @@ + is-visible="view.state.ui.isAddPlaceholderModalOpen"> From 610d1047d77d819a05ecbbf8f4245eb2c66fb557 Mon Sep 17 00:00:00 2001 From: Lloyd Wheeler Date: Mon, 15 Apr 2019 07:08:09 -0700 Subject: [PATCH 15/16] Improving styling on modal --- .../addPlaceholderUser/addPlaceholderUser.css | 35 ++++++++++++ .../addPlaceholderUser.html | 53 ++++++++++--------- 2 files changed, 63 insertions(+), 25 deletions(-) diff --git a/app/workgroup/directives/modals/addPlaceholderUser/addPlaceholderUser.css b/app/workgroup/directives/modals/addPlaceholderUser/addPlaceholderUser.css index 5c373cf74..803fc63fc 100644 --- a/app/workgroup/directives/modals/addPlaceholderUser/addPlaceholderUser.css +++ b/app/workgroup/directives/modals/addPlaceholderUser/addPlaceholderUser.css @@ -23,3 +23,38 @@ padding: 10px; color: gray; } + +.add-placeholder-users__input-container { + display: flex; +} + + +.add-placeholder-user .neon-dark-confirm-btn, +.add-placeholder-user .neon-dark-confirm-btn:focus, +.add-placeholder-user .neon-dark-confirm-btn:active, +.add-placeholder-user .neon-dark-confirm-btn { + background-color: rgb(48, 54, 65); + border-color: rgb(48, 54, 65); + color: white; +} + +.add-placeholder-user .neon-dark-confirm-btn:hover { + background-color: rgb(18, 24, 35); /* Darker Version for hover */ + color: white; +} + +.add-placeholder-user .neon-dark-confirm-btn.disabled, +.add-placeholder-user .neon-dark-confirm-btn.disabled:hover, +.add-placeholder-user .neon-dark-confirm-btn.disabled:focus, +.add-placeholder-user .neon-dark-confirm-btn.disabled:active { + background-color: rgb(48, 54, 65); + color: white; +} + +.add-placeholder-user__cancel-button { + margin-right: 5px; + margin-left: 5px; + color: #303641; + background-color: white; + border: 1px solid #D6D6D6; +} diff --git a/app/workgroup/directives/modals/addPlaceholderUser/addPlaceholderUser.html b/app/workgroup/directives/modals/addPlaceholderUser/addPlaceholderUser.html index 1f817b29f..55596d240 100644 --- a/app/workgroup/directives/modals/addPlaceholderUser/addPlaceholderUser.html +++ b/app/workgroup/directives/modals/addPlaceholderUser/addPlaceholderUser.html @@ -1,41 +1,44 @@ -
+
Please note: This form should only be used to add a user if they do NOT have a kerberos account yet.
This user will not be able to login to IPA (until you provide the kerberos login id), but you will be able to refer to them in IPA and include them in your scheduling plans.
- - +
+ + - - - - - + + + + +
From 9bde88c8d2b733cb5d96a796a1f8a08dde7fa76a Mon Sep 17 00:00:00 2001 From: Lloyd Wheeler Date: Mon, 15 Apr 2019 08:29:59 -0700 Subject: [PATCH 16/16] Move add placeholder button to dropdown --- .../peopleAndRoles/rolesTable/rolesTable.css | 6 +- .../peopleAndRoles/rolesTable/rolesTable.html | 72 ++++++++++++------- .../peopleAndRoles/rolesTable/rolesTable.js | 10 ++- 3 files changed, 62 insertions(+), 26 deletions(-) diff --git a/app/workgroup/directives/peopleAndRoles/rolesTable/rolesTable.css b/app/workgroup/directives/peopleAndRoles/rolesTable/rolesTable.css index d4958e939..11a2a3bed 100644 --- a/app/workgroup/directives/peopleAndRoles/rolesTable/rolesTable.css +++ b/app/workgroup/directives/peopleAndRoles/rolesTable/rolesTable.css @@ -83,7 +83,7 @@ } .roles-table__placeholder { - color: #f5a0a0; + color: #ffeb3c; border: 1px solid; border-radius: 4px; font-size: 15px; @@ -113,3 +113,7 @@ display: flex; justify-content: flex-end; } + +.roles-table__match { + border-bottom:1px solid #f3f3f3; +} diff --git a/app/workgroup/directives/peopleAndRoles/rolesTable/rolesTable.html b/app/workgroup/directives/peopleAndRoles/rolesTable/rolesTable.html index 419683101..b5f7ec19d 100644 --- a/app/workgroup/directives/peopleAndRoles/rolesTable/rolesTable.html +++ b/app/workgroup/directives/peopleAndRoles/rolesTable/rolesTable.html @@ -7,23 +7,58 @@ ng-change="searchOnChange()" typeahead-loading="view.loadingPeople" typeahead-no-results="view.noResults" typeahead-wait-ms="400" typeahead-min-length="2" typeahead-on-select="searchUsersResultSelected($item, $model, $label, $event)" class="form-control typeahead" - typeahead-template-url="popupTemplate.html"> - - + typeahead-popup-template-url="popupTemplate.html"> +
- -
- - - -
@@ -119,9 +126,35 @@ {{ userRole.userDisplayName }} -
- -
+ + +
+ + +
+ {{ view.placeholderUpdate.validationMessage }} +
+ + + +
+
- {{ userRole.userDisplayName }} - - -
- - -
- {{ view.placeholderUpdate.validationMessage }} +
+ {{ userRole.userDisplayName }} + + + +
+
+
+
+ + +
+ +
+ +
- - - + +
+ +
+
+
+ {{ view.placeholderUpdate.validationMessage }}
- +
diff --git a/app/workgroup/directives/peopleAndRoles/rolesTable/rolesTable.js b/app/workgroup/directives/peopleAndRoles/rolesTable/rolesTable.js index 14d79bb5c..cda9628cd 100644 --- a/app/workgroup/directives/peopleAndRoles/rolesTable/rolesTable.js +++ b/app/workgroup/directives/peopleAndRoles/rolesTable/rolesTable.js @@ -81,6 +81,9 @@ let rolesTable = function( scope.searchUsers = function(query) { return WorkgroupService.searchUsers(scope.ui.workgroupId, query).then( function(userSearchResults) { + userSearchResults.push({ + name: "newPlaceholder" + }); return userSearchResults; }, function() { @@ -93,7 +96,12 @@ let rolesTable = function( }; scope.searchUsersResultSelected = function($item) { - scope.users.newUser = $item; + if ($item.name == "newPlaceholder") { + scope.openPlaceholderModal(); + scope.users.searchQuery = ""; + } else { + scope.users.newUser = $item; + } }; scope.addUserToWorkgroup = function() {