@@ -12,37 +12,11 @@ import FullScreenLoader from '@ui/components/AuthContext/LoadingScreen';
12
12
import { AuthGuard } from '@ui/components/AuthGuard' ;
13
13
import { useApi } from '@ui/util/api' ;
14
14
import { AppRoles } from '@common/roles.js' ;
15
+ import { OrganizationList } from '@common/orgs' ;
16
+ import { User , UserNames , UserOrgs , Users } from '@common/types/iam' ;
15
17
16
18
// const repeatOptions = ['weekly', 'biweekly'] as const;
17
19
18
- const userSchema = z . object ( {
19
- netid : z . string ( ) . min ( 1 ) ,
20
- firstName : z . string ( ) . min ( 1 ) ,
21
- middleName : z . string ( ) . optional ( ) ,
22
- lastName : z . string ( ) . min ( 1 ) ,
23
- sig : z . string ( ) ,
24
- // location: z.string(),
25
- // locationLink: z.optional(z.string().url()),
26
- // host: z.string(),
27
- // featured: z.boolean().default(false),
28
- // paidEventId: z.optional(z.string().min(1)),
29
- } ) ;
30
-
31
- const usersSchema = z . array ( userSchema ) ;
32
-
33
- // const requestSchema = baseSchema.extend({
34
- // repeats: z.optional(z.enum(repeatOptions)),
35
- // repeatEnds: z.string().optional(),
36
- // });
37
-
38
- // const getEventSchema = requestSchema.extend({
39
- // id: z.string(),
40
- // upcoming: z.boolean().optional(),
41
- // });
42
-
43
- export type User = z . infer < typeof userSchema > ;
44
- export type Users = z . infer < typeof usersSchema > ;
45
-
46
20
// export type EventGetResponse = z.infer<typeof getEventSchema>;
47
21
// const getEventsSchema = z.array(getEventSchema);
48
22
// export type EventsGetResponse = z.infer<typeof getEventsSchema>;
@@ -68,7 +42,7 @@ export const ScreenPage: React.FC = () => {
68
42
< Table . Td > { user . firstName } </ Table . Td >
69
43
< Table . Td > { user . middleName } </ Table . Td >
70
44
< Table . Td > { user . lastName } </ Table . Td >
71
- < Table . Td > { user . sig } </ Table . Td >
45
+ < Table . Td > { user . org } </ Table . Td >
72
46
{ /* <Table.Td>{dayjs(event.start).format('MMM D YYYY hh:mm')}</Table.Td>
73
47
<Table.Td>{event.end ? dayjs(event.end).format('MMM D YYYY hh:mm') : 'N/A'}</Table.Td>
74
48
<Table.Td>{event.location}</Table.Td>
@@ -112,36 +86,74 @@ export const ScreenPage: React.FC = () => {
112
86
// return { ...item, upcoming: false };
113
87
// });
114
88
115
- // prettier-ignore
116
- const mockUserResponse : Users = [
117
- { netid : "ethanc12" , firstName : "Ethan" , middleName :"Yuting" , lastName : "Chang" , sig : "Infra" } ,
118
- { netid : "johnd01" , firstName : "John" , lastName : "Doe" , sig : "SIGMusic" } ,
119
- { netid : "sarahg23" , firstName : "Sarah" , middleName : "Grace" , lastName : "Gonzalez" , sig : "SIGQuantum" } ,
120
- { netid : "miker44" , firstName : "Michael" , lastName : "Roberts" , sig : "SIGPlan" } ,
121
- { netid : "annaw02" , firstName : "Anna" , middleName : "Marie" , lastName : "Williams" , sig : "SIGMobile" } ,
122
- { netid : "chrisb19" , firstName : "Christopher" , lastName : "Brown" , sig : "SIGCHI" } ,
123
- { netid : "laurenp87" , firstName : "Lauren" , middleName : "Patricia" , lastName : "Perez" , sig : "SIGPwny" } ,
124
- { netid : "ethanw12" , firstName : "Ethan" , lastName : "Wong" , sig : "SIGEcom" } ,
125
- { netid : "emilyh54" , firstName : "Emily" , lastName : "Hernandez" , sig : "SIGRobotics" } ,
126
- { netid : "kevink11" , firstName : "Kevin" , middleName : "Lee" , lastName : "Kim" , sig : "Infra" } ,
127
- { netid : "juliel08" , firstName : "Julie" , lastName : "Lopez" , sig : "SIGGRAPH" } ,
128
- { netid : "mattt92" , firstName : "Matthew" , middleName : "Thomas" , lastName : "Taylor" , sig : "SIGtricity" } ,
129
- { netid : "rachelb03" , firstName : "Rachel" , lastName : "Bell" , sig : "SIGSYS" } ,
130
- { netid : "stephenj45" , firstName : "Stephen" , middleName : "James" , lastName : "Johnson" , sig : "SIGAIDA" } ,
131
- { netid : "ashleyc28" , firstName : "Ashley" , lastName : "Clark" , sig : "SIGNLL" } ,
132
- { netid : "briand77" , firstName : "Brian" , lastName : "Davis" , sig : "SIGMA" } ,
133
- { netid : "meganf65" , firstName : "Megan" , lastName : "Flores" , sig : "SIGPolicy" } ,
134
- { netid : "danielh04" , firstName : "Daniel" , lastName : "Hughes" , sig : "SIGARCH" } ,
135
- { netid : "victorc16" , firstName : "Victor" , middleName : "Charles" , lastName : "Carter" , sig : "SIGGLUG" } ,
136
- { netid : "lindam29" , firstName : "Linda" , lastName : "Martinez" , sig : "SIGMobile" } ,
137
- { netid : "paulf31" , firstName : "Paul" , lastName : "Fisher" , sig : "SIGMusic" } ,
138
- { netid : "susana80" , firstName : "Susan" , middleName : "Ann" , lastName : "Anderson" , sig : "SIGPwny" } ,
139
- { netid : "markl13" , firstName : "Mark" , lastName : "Lewis" , sig : "SIGCHI" } ,
140
- { netid : "carolynb59" , firstName : "Carolyn" , lastName : "Barnes" , sig : "SIGSYS" } ,
141
- { netid : "patrickh37" , firstName : "Patrick" , middleName : "Henry" , lastName : "Hill" , sig : "SIGQuantum" } ,
142
- { netid : "nataliep71" , firstName : "Natalie" , lastName : "Price" , sig : "SIGPolicy" } ,
89
+ // get request for user orgs
90
+ const userOrgsResponse : UserOrgs = [
91
+ { netid : 'johnd01' , org : 'SIGMusic' } ,
92
+ { netid : 'miker44' , org : 'SIGPLAN' } ,
93
+ { netid : 'chrisb19' , org : 'SIGCHI' } ,
94
+ { netid : 'ethanw12' , org : 'SIGecom' } ,
95
+ { netid : 'emilyh54' , org : 'SIGRobotics' } ,
96
+ { netid : 'juliel08' , org : 'SIGGRAPH' } ,
97
+ { netid : 'rachelb03' , org : 'GameBuilders' } ,
98
+ { netid : 'ashleyc28' , org : 'SIGNLL' } ,
99
+ { netid : 'briand77' , org : 'SIGma' } ,
100
+ { netid : 'meganf65' , org : 'SIGPolicy' } ,
101
+ { netid : 'danielh04' , org : 'SIGARCH' } ,
102
+ { netid : 'lindam29' , org : 'SIGMobile' } ,
103
+ { netid : 'paulf31' , org : 'SIGMusic' } ,
104
+ { netid : 'markl13' , org : 'SIGCHI' } ,
105
+ { netid : 'carolynb59' , org : 'ACM' } ,
106
+ { netid : 'nataliep71' , org : 'SIGPolicy' } ,
107
+
108
+ { netid : 'ethanc12' , org : 'Infrastructure Committee' } ,
109
+ { netid : 'sarahg23' , org : 'SIGQuantum' } ,
110
+ { netid : 'annaw02' , org : 'SIGMobile' } ,
111
+ { netid : 'laurenp87' , org : 'SIGPwny' } ,
112
+ { netid : 'kevink11' , org : 'Infrastructure Committee' } ,
113
+ { netid : 'mattt92' , org : 'SIGtricity' } ,
114
+ { netid : 'stephenj45' , org : 'SIGAIDA' } ,
115
+ { netid : 'victorc16' , org : 'GLUG' } ,
116
+ { netid : 'susana80' , org : 'SIGPwny' } ,
117
+ { netid : 'patrickh37' , org : 'SIGQuantum' } ,
118
+ ] ;
119
+
120
+ // retrieve from azure active directory (aad)
121
+ const userNamesResponse : UserNames = [
122
+ { netid : 'johnd01' , firstName : 'John' , lastName : 'Doe' } ,
123
+ { netid : 'miker44' , firstName : 'Michael' , lastName : 'Roberts' } ,
124
+ { netid : 'chrisb19' , firstName : 'Christopher' , lastName : 'Brown' } ,
125
+ { netid : 'ethanw12' , firstName : 'Ethan' , lastName : 'Wong' } ,
126
+ { netid : 'emilyh54' , firstName : 'Emily' , lastName : 'Hernandez' } ,
127
+ { netid : 'juliel08' , firstName : 'Julie' , lastName : 'Lopez' } ,
128
+ { netid : 'rachelb03' , firstName : 'Rachel' , lastName : 'Bell' } ,
129
+ { netid : 'ashleyc28' , firstName : 'Ashley' , lastName : 'Clark' } ,
130
+ { netid : 'briand77' , firstName : 'Brian' , lastName : 'Davis' } ,
131
+ { netid : 'meganf65' , firstName : 'Megan' , lastName : 'Flores' } ,
132
+ { netid : 'danielh04' , firstName : 'Daniel' , lastName : 'Hughes' } ,
133
+ { netid : 'lindam29' , firstName : 'Linda' , lastName : 'Martinez' } ,
134
+ { netid : 'paulf31' , firstName : 'Paul' , lastName : 'Fisher' } ,
135
+ { netid : 'markl13' , firstName : 'Mark' , lastName : 'Lewis' } ,
136
+ { netid : 'carolynb59' , firstName : 'Carolyn' , lastName : 'Barnes' } ,
137
+ { netid : 'nataliep71' , firstName : 'Natalie' , lastName : 'Price' } ,
138
+
139
+ { netid : 'ethanc12' , firstName : 'Ethan' , middleName : 'Yuting' , lastName : 'Chang' } ,
140
+ { netid : 'sarahg23' , firstName : 'Sarah' , middleName : 'Grace' , lastName : 'Gonzalez' } ,
141
+ { netid : 'annaw02' , firstName : 'Anna' , middleName : 'Marie' , lastName : 'Williams' } ,
142
+ { netid : 'laurenp87' , firstName : 'Lauren' , middleName : 'Patricia' , lastName : 'Perez' } ,
143
+ { netid : 'kevink11' , firstName : 'Kevin' , middleName : 'Lee' , lastName : 'Kim' } ,
144
+ { netid : 'mattt92' , firstName : 'Matthew' , middleName : 'Thomas' , lastName : 'Taylor' } ,
145
+ { netid : 'stephenj45' , firstName : 'Stephen' , middleName : 'James' , lastName : 'Johnson' } ,
146
+ { netid : 'victorc16' , firstName : 'Victor' , middleName : 'Charles' , lastName : 'Carter' } ,
147
+ { netid : 'susana80' , firstName : 'Susan' , middleName : 'Ann' , lastName : 'Anderson' } ,
148
+ { netid : 'patrickh37' , firstName : 'Patrick' , middleName : 'Henry' , lastName : 'Hill' } ,
143
149
] ;
144
- setUserList ( mockUserResponse ) ;
150
+
151
+ const mergedResponse : Users = userOrgsResponse . map ( ( orgObj ) => {
152
+ const nameObj = userNamesResponse . find ( ( name ) => name . netid === orgObj . netid ) ;
153
+ return { ...orgObj , ...nameObj } as User ;
154
+ } ) ;
155
+
156
+ setUserList ( mergedResponse ) ;
145
157
} ;
146
158
getUsers ( ) ;
147
159
} , [ ] ) ;
@@ -170,7 +182,6 @@ export const ScreenPage: React.FC = () => {
170
182
}
171
183
172
184
return (
173
- // <AuthGuard resourceDef={{ service: 'core', validRoles: [AppRoles.USERS_ADMIN] }}>
174
185
< AuthGuard resourceDef = { { service : 'core' , validRoles : [ AppRoles . IAM_ADMIN ] } } >
175
186
{ userRemoved && (
176
187
< Modal
@@ -217,7 +228,7 @@ export const ScreenPage: React.FC = () => {
217
228
< Table . Th > First Name</ Table . Th >
218
229
< Table . Th > Middle Name</ Table . Th >
219
230
< Table . Th > Last Name</ Table . Th >
220
- < Table . Th > Affiliated Special Interest Group </ Table . Th >
231
+ < Table . Th > Organization </ Table . Th >
221
232
< Table . Th > Actions</ Table . Th >
222
233
</ Table . Tr >
223
234
</ Table . Thead >
0 commit comments