Commit 079b2ce
authored
Feature 3623 project group field issues (#50)
## PR: Project Group Field Issues
Task/Bugs Covered:
https://dev.azure.com/TDEI-UW/TDEI/_workitems/edit/3635
https://dev.azure.com/TDEI-UW/TDEI/_workitems/edit/3624/
https://dev.azure.com/TDEI-UW/TDEI/_workitems/edit/3623/
---
## Changes Implemented
### `components/ProjectGroupPicker.vue`
- Click-outside handler closes the dropdown without changing selection
- Displays total count and "scroll to load more" hint in the dropdown
header
- Loading spinner shown in the header during API requests
- Highlighted item tracks keyboard/mouse hover consistently
- Cached project group name is shown immediately on mount before the
first API response, eliminating blank-field flash on reload
### `pages/dashboard.vue`
- Replaces module-level mutable variables with `sessionStorage`-backed
helpers using named constants for all storage keys
(`tdei-selected-project-group`, `tdei-selected-project-group-name`,
`tdei-selected-workspace`)
- All `sessionStorage` operations are wrapped in `try/catch` with SSR
guards (`typeof window === 'undefined'`) to handle private browsing and
restricted browser policies
- Project group and workspace selection are restored synchronously on
load; the `lastProjectGroupId` in-memory fallback is removed
### `services/tdei.ts`
- `TdeiAuthStore.clear()` now removes all three `sessionStorage` picker
keys on logout
---
## Testing Checklist
| Scenario | Expected |
|---|---|
| Open dashboard — project group picker renders | Picker shows, no blank
flash if a group was previously selected |
| Click the picker input | Dropdown opens, first 10 groups load |
| Type in the search box | Results filter after ~300ms debounce |
| Scroll to bottom of list | Next 10 results load automatically |
| `↑`/`↓` arrow keys | Highlighted item moves through the list |
| `Enter` on highlighted item | Item selected, dropdown closes, name
shown in input |
| Click an item | Same as Enter |
| `Escape` key | Dropdown closes, previously selected name restored |
| Click outside the dropdown | Dropdown closes, selection unchanged |
| Select a group — reload the page | Same group pre-selected, name shown
instantly with no flicker |
| Select a workspace — reload the page | Same workspace re-selected |
| Open two tabs, select different groups | Each tab retains its own
selection independently (sessionStorage is tab-scoped) |
| Log out | `sessionStorage` picker keys cleared; fresh session on next
login |
### Screenshots
<img width="1470" height="783" alt="Screenshot 2026-05-11 at 3 50 54 PM"
src="https://github.com/user-attachments/assets/f7b7c34d-7e68-4232-9d6c-1d04b3993915"
/>
<img width="1466" height="827" alt="Screenshot 2026-05-11 at 3 50 16 PM"
src="https://github.com/user-attachments/assets/58ac355b-4173-48c8-aa84-bfc5011db6d8"
/>
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Changes Overview
This PR addresses issues with the Project Group picker and session
persistence across four files:
### components/ProjectGroupPicker.vue
Refactored dropdown UI and state management:
- Added named v-model binding for cached display name:
`defineModel('name', { default: '' })`
- Input now explicitly opens dropdown on click; debounces data reloads
instead of using `watch(searchText)`
- Restructured dropdown header to show "showing first N of total"
messaging based on API response
- Replaced inline loading row with header spinner during API requests
- Infinite scroll handled via `@scroll` listener on dedicated list
wrapper with revised threshold
- Updated focus, scroll, Escape, and click-outside behaviors to restore
visible search text using cached name
- On mount, cached name is applied immediately before initial API load;
pagination reconciles if selected group isn't on first page
- Lines changed: +157/-51
### pages/dashboard.vue
Added sessionStorage persistence for selections:
- Project group picker now uses `v-model:name` binding in addition to id
binding
- New storage helper functions safely read/write selected project group
id, name, and workspace id with sessionStorage keys:
`tdei-selected-project-group`, `tdei-selected-project-group-name`,
`tdei-selected-workspace`
- Storage operations wrapped in try/catch with SSR guards (`typeof
window === 'undefined'`)
- `currentProjectGroup` and `currentProjectGroupName` initialized
synchronously at setup time from sessionStorage
- Auto-selection logic reads `lastWorkspaceId` from sessionStorage
instead of in-memory variables
- Updated watchers to persist all three selection values
- Adjusted `.project-group-picker` styling with minimum width
- Lines changed: +56/-9
### services/tdei.ts
Updated API client for project group functionality:
- `TdeiAuthStore.clear()` now removes all three sessionStorage picker
keys on logout (in addition to existing localStorage auth key removal)
- `TdeiUserClient.getMyProjectGroups()` signature updated to accept
`sortBy` parameter with default value `'name'`
- Return type changed from `Promise<TdeiProjectGroup[]>` to `Promise<{
items: TdeiProjectGroup[]; total: number | null }>`
- Method now reads `X-Total-Count` response header and returns total
count; returns `{ items: [], total: null }` on parsing errors
- Lines changed: +10/-4
### pages/workspace/create/tdei.vue
Defensive property assignments:
- Post-`nextTick()` assignments now use optional chaining and nullish
coalescing
- `workspaceTitle` falls back to `''`
- `projectGroupId` falls back to `null` when `record.project_group` is
missing
- `tdeiRecordId` falls back to `null` when `record.tdei_dataset_id` is
missing
- Lines changed: +3/-3
<!-- review_stack_entry_start -->
[](https://app.coderabbit.ai/change-stack/TaskarCenterAtUW/workspaces-frontend/pull/50)
<!-- review_stack_entry_end -->
<!-- end of auto-generated comment: release notes by coderabbit.ai -->4 files changed
Lines changed: 259 additions & 95 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
10 | 12 | | |
11 | 13 | | |
12 | | - | |
| 14 | + | |
13 | 15 | | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
| 16 | + | |
18 | 17 | | |
19 | 18 | | |
20 | | - | |
21 | | - | |
22 | | - | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
23 | 38 | | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
41 | 60 | | |
42 | 61 | | |
43 | 62 | | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
44 | 86 | | |
45 | 87 | | |
46 | 88 | | |
| |||
55 | 97 | | |
56 | 98 | | |
57 | 99 | | |
| 100 | + | |
58 | 101 | | |
59 | 102 | | |
60 | 103 | | |
61 | 104 | | |
62 | 105 | | |
63 | | - | |
| 106 | + | |
64 | 107 | | |
65 | 108 | | |
| 109 | + | |
66 | 110 | | |
67 | 111 | | |
68 | 112 | | |
| |||
72 | 116 | | |
73 | 117 | | |
74 | 118 | | |
75 | | - | |
| 119 | + | |
76 | 120 | | |
77 | 121 | | |
| 122 | + | |
78 | 123 | | |
79 | | - | |
| 124 | + | |
80 | 125 | | |
81 | 126 | | |
82 | 127 | | |
| |||
85 | 130 | | |
86 | 131 | | |
87 | 132 | | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
88 | 136 | | |
89 | | - | |
| 137 | + | |
| 138 | + | |
90 | 139 | | |
| 140 | + | |
| 141 | + | |
91 | 142 | | |
92 | 143 | | |
93 | | - | |
| 144 | + | |
94 | 145 | | |
95 | 146 | | |
96 | 147 | | |
| |||
108 | 159 | | |
109 | 160 | | |
110 | 161 | | |
111 | | - | |
112 | | - | |
113 | 162 | | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
114 | 174 | | |
115 | 175 | | |
116 | 176 | | |
117 | 177 | | |
118 | | - | |
| 178 | + | |
119 | 179 | | |
120 | 180 | | |
121 | 181 | | |
| |||
127 | 187 | | |
128 | 188 | | |
129 | 189 | | |
130 | | - | |
| 190 | + | |
131 | 191 | | |
132 | 192 | | |
133 | 193 | | |
| |||
139 | 199 | | |
140 | 200 | | |
141 | 201 | | |
| 202 | + | |
142 | 203 | | |
143 | 204 | | |
144 | 205 | | |
145 | 206 | | |
146 | 207 | | |
147 | | - | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
148 | 211 | | |
149 | 212 | | |
150 | 213 | | |
| |||
198 | 261 | | |
199 | 262 | | |
200 | 263 | | |
201 | | - | |
202 | | - | |
203 | | - | |
204 | | - | |
205 | | - | |
206 | | - | |
207 | | - | |
208 | | - | |
| 264 | + | |
209 | 265 | | |
210 | 266 | | |
211 | 267 | | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
217 | | - | |
218 | | - | |
219 | | - | |
220 | | - | |
221 | | - | |
222 | | - | |
223 | | - | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
224 | 285 | | |
225 | 286 | | |
226 | 287 | | |
227 | 288 | | |
228 | | - | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
229 | 294 | | |
230 | 295 | | |
231 | 296 | | |
232 | | - | |
233 | | - | |
234 | | - | |
235 | 297 | | |
236 | 298 | | |
237 | 299 | | |
238 | 300 | | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
239 | 320 | | |
240 | 321 | | |
241 | 322 | | |
242 | 323 | | |
243 | 324 | | |
244 | | - | |
| 325 | + | |
245 | 326 | | |
246 | 327 | | |
247 | 328 | | |
248 | | - | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
249 | 332 | | |
250 | 333 | | |
251 | 334 | | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
252 | 375 | | |
253 | | - | |
| 376 | + | |
254 | 377 | | |
255 | 378 | | |
256 | 379 | | |
0 commit comments