|
33 | 33 | <div class="row q-pa-sm q-gutter-sm" id="directoryResults"> |
34 | 34 | <q-card v-for="user in results" class="col-2 col-xs-8 col-sm-5 col-md-8 col-lg-3 col-xl-2 block directory"> |
35 | 35 | <q-card-section class="grid row card_header" :class="[user.svm ? 'SVM' : '']"> |
36 | | - <a v-if="user.svm && user.iamId && user.mothraId" :href="'@HttpHelper.GetRootURL()/UserInfo/' + user.mothraId" :aria-label="'User information for ' + user.name" class="userinfo_button top_button"> |
| 36 | + <a v-if="user.svm && user.iamId && user.mothraId" :href="'@HttpHelper.GetRootURL()/UserInfo/' + user.mothraId" @@click="onLinkClick($event, 'Loading user profile...')" :aria-label="'User information for ' + user.name" class="userinfo_button top_button"> |
37 | 37 | <q-icon name="person" size="xs"></q-icon> |
38 | 38 | <q-tooltip>User Information</q-tooltip> |
39 | 39 | </a> |
40 | 40 | <a v-if="user.mailId" :href="'mailto:' + user.mailId + '@@ucdavis.edu'" :aria-label="'Email ' + user.mailId + '@@ucdavis.edu'" class="email_button top_button"> |
41 | 41 | <q-icon name="email" size="xs"></q-icon> |
42 | 42 | <q-tooltip>Email {{user.mailId}}@@ucdavis.edu</q-tooltip> |
43 | 43 | </a> |
44 | | - <a v-if="user.svm" :href="'@HttpHelper.GetRootURL()/EmulateUser/' + user.loginId" :aria-label="'Emulate ' + user.name" class="emulate_button top_button"> |
| 44 | + <a v-if="user.svm" :href="'@HttpHelper.GetRootURL()/EmulateUser/' + user.loginId" @@click="onLinkClick($event, 'Emulating user...')" :aria-label="'Emulate ' + user.name" class="emulate_button top_button"> |
45 | 45 | <q-icon name="face" size="xs"></q-icon> |
46 | 46 | <q-tooltip>Emulate {{user.name}}</q-tooltip> |
47 | 47 | </a> |
48 | | - <a v-if="ids && user.mothraId && user.loginId" :href="'@HttpHelper.GetOldViperRootURL()' + '/default.cfm?Page=AAUDCheck&mothraID=' + user.mothraId + '&loginID=' + user.loginId" :aria-label="'AAUD check for ' + user.name" class="AAUD_button top_button"> |
| 48 | + <a v-if="ids && user.mothraId && user.loginId" :href="'@HttpHelper.GetOldViperRootURL()' + '/default.cfm?Page=AAUDCheck&mothraID=' + user.mothraId + '&loginID=' + user.loginId" @@click="onLinkClick($event, 'Opening AAUD Check...')" :aria-label="'AAUD check for ' + user.name" class="AAUD_button top_button"> |
49 | 49 | <q-icon name="account_circle" size="xs"></q-icon> |
50 | 50 | <q-tooltip>AAUD Check</q-tooltip> |
51 | 51 | </a> |
52 | | - <a v-if="ids && user.loginId" :href="'@HttpHelper.GetOldViperRootURL()' + '/default.cfm?Page=IDCardCheck&LoginID=' + user.loginId" :aria-label="'ID check for ' + user.name" class="ID_button top_button"> |
| 52 | + <a v-if="ids && user.loginId" :href="'@HttpHelper.GetOldViperRootURL()' + '/default.cfm?Page=IDCardCheck&LoginID=' + user.loginId" @@click="onLinkClick($event, 'Opening ID Check...')" :aria-label="'ID check for ' + user.name" class="ID_button top_button"> |
53 | 53 | <q-icon name="account_box" size="xs"></q-icon> |
54 | 54 | <q-tooltip>ID Check</q-tooltip> |
55 | 55 | </a> |
56 | | - <a :href="'@HttpHelper.GetOldViperRootURL()' + '/default.cfm?Page=UnitHeads&MailID=' + user.mailId" v-if="ids && user.mailId" :aria-label="'MSO/CAO lookup for ' + user.name" class="MSO_button top_button"> |
| 56 | + <a :href="'@HttpHelper.GetOldViperRootURL()' + '/default.cfm?Page=UnitHeads&MailID=' + user.mailId" v-if="ids && user.mailId" @@click="onLinkClick($event, 'Opening MSO/CAO Lookup...')" :aria-label="'MSO/CAO lookup for ' + user.name" class="MSO_button top_button"> |
57 | 57 | <q-icon name="supervisor_account" size="xs"></q-icon> |
58 | 58 | <q-tooltip>MSO/CAO Lookup</q-tooltip> |
59 | 59 | </a> |
60 | 60 | @if (UserHelper.HasPermission(rapsContext, UserHelper.GetCurrentUser(), "SVMSecure.DirectoryUCPathInfo")) |
61 | 61 | { |
62 | 62 | @: |
63 | | - <a :href="'@HttpHelper.GetOldViperRootURL()' + '/default.cfm?Page=UCPathInfo&emplid=' + user.employeeId" v-if="ids && user.employeeId" :aria-label="'UCPath info for ' + user.name" class="UCPath_button top_button"> |
| 63 | + <a :href="'@HttpHelper.GetOldViperRootURL()' + '/default.cfm?Page=UCPathInfo&emplid=' + user.employeeId" v-if="ids && user.employeeId" @@click="onLinkClick($event, 'Opening UCPath Info...')" :aria-label="'UCPath info for ' + user.name" class="UCPath_button top_button"> |
64 | 64 | <q-icon name="school" size="sm"></q-icon> |
65 | 65 | <q-tooltip>UCPath Info</q-tooltip> |
66 | 66 | </a> |
67 | 67 | } |
68 | 68 | @if (UserHelper.HasPermission(rapsContext, UserHelper.GetCurrentUser(), "SVMSecure.CATS.ServiceDesk")) |
69 | 69 | { |
70 | 70 | @: |
71 | | - <a :href="'@HttpHelper.GetOldViperRootURL()' + '/default.cfm?Page=alternatePhoto&iamID=' + user.iamId + '&mailID=' + user.mailId + '&empName=' + encodeURIComponent(user.name)" v-if="ids && user.iamId && user.mailId" :aria-label="'Alternate photo for ' + user.name" class="photo_button top_button"> |
| 71 | + <a :href="'@HttpHelper.GetOldViperRootURL()' + '/default.cfm?Page=alternatePhoto&iamID=' + user.iamId + '&mailID=' + user.mailId + '&empName=' + encodeURIComponent(user.name)" v-if="ids && user.iamId && user.mailId" @@click="onLinkClick($event, 'Opening Alternate Photo...')" :aria-label="'Alternate photo for ' + user.name" class="photo_button top_button"> |
72 | 72 | <q-icon name="photo_camera" size="xs"></q-icon> |
73 | 73 | <q-tooltip>Alt. Photo</q-tooltip> |
74 | 74 | </a> |
|
138 | 138 | ucd: getItemFromStorage("directory_ucd") ?? false, |
139 | 139 | ids: getItemFromStorage("directory_ids") ?? false, |
140 | 140 | spinner: false, |
141 | | - results: [] |
| 141 | + results: [], |
| 142 | + searchId: 0 |
142 | 143 | } |
143 | 144 | }, |
144 | 145 | methods: { |
145 | 146 | findUsers: async function () { |
146 | 147 | this.spinner = false; |
147 | 148 | this.results = []; |
148 | | - var urlBase = "@Url.Content("~/Directory/search/")" + this.userSearch; |
| 149 | + |
| 150 | + var search = this.userSearch.trim(); |
| 151 | + if (search.length < 2) { |
| 152 | + return; |
| 153 | + } |
| 154 | + |
| 155 | + this.searchId++; |
| 156 | + var currentSearchId = this.searchId; |
| 157 | + |
| 158 | + var urlBase = "@Url.Content("~/Directory/search")" + "?search=" + encodeURIComponent(search); |
149 | 159 | if (this.ucd) { |
150 | | - urlBase += "/ucd" |
| 160 | + urlBase += "&ucd=true"; |
| 161 | + } |
| 162 | + |
| 163 | + this.spinner = true; |
| 164 | + try { |
| 165 | + var response = await viperFetch(this, urlBase); |
| 166 | + if (currentSearchId === this.searchId) { |
| 167 | + this.results = response || []; |
| 168 | + } |
| 169 | + } finally { |
| 170 | + if (currentSearchId === this.searchId) { |
| 171 | + this.spinner = false; |
| 172 | + } |
151 | 173 | } |
152 | | - if (this.userSearch.length >= 2) { |
153 | | - this.spinner = true; |
154 | | - this.results = (await viperFetch(this, urlBase)) |
155 | | - this.spinner = false; |
| 174 | + }, |
| 175 | + onLinkClick: function (e, msg) { |
| 176 | + if (e.button === 0 && !e.ctrlKey && !e.shiftKey && !e.altKey && !e.metaKey) { |
| 177 | + this.$q.loading.show({ |
| 178 | + message: msg || 'Loading...' |
| 179 | + }); |
156 | 180 | } |
157 | 181 | } |
158 | 182 | }, |
|
0 commit comments