Skip to content

Commit fa9de10

Browse files
committed
Merge azure testing changes from siglead-management
2 parents 6130014 + d0ea8e5 commit fa9de10

File tree

2 files changed

+44
-33
lines changed

2 files changed

+44
-33
lines changed

cloudformation/iam.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ Resources:
7878
- Fn::Sub: arn:aws:dynamodb:${AWS::Region}:${AWS::AccountId}:table/infra-core-api-room-requests-status
7979
- Fn::Sub: arn:aws:dynamodb:${AWS::Region}:${AWS::AccountId}:table/infra-core-api-linkry
8080
- Fn::Sub: arn:aws:dynamodb:${AWS::Region}:${AWS::AccountId}:table/infra-core-api-keys
81+
- Fn::Sub: arn:aws:dynamodb:${AWS::Region}:${AWS::AccountId}:table/infra-core-api-sig-member-details
82+
- Fn::Sub: arn:aws:dynamodb:${AWS::Region}:${AWS::AccountId}:table/infra-core-api-sig-details
8183
# Index accesses
8284
- Fn::Sub: arn:aws:dynamodb:${AWS::Region}:${AWS::AccountId}:table/infra-core-api-stripe-links/index/*
8385
- Fn::Sub: arn:aws:dynamodb:${AWS::Region}:${AWS::AccountId}:table/infra-core-api-events/index/*

src/ui/pages/siglead/ViewSigLead.page.tsx

Lines changed: 42 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -191,67 +191,76 @@ export const ViewSigLeadPage: React.FC = () => {
191191
};
192192

193193
export const AddMemberToSigPage: FC = () => {
194-
const { sigId } = useParams();
194+
// const { sigId } = useParams();
195195
const api = useApi("core");
196196

197197
async function handleSubmit(event: React.FormEvent<HTMLFormElement>) {
198198
event.preventDefault();
199199
const formData = new FormData(event.currentTarget);
200200
// console.log(formData)
201-
const data = Object.fromEntries(
202-
formData.entries(),
203-
) as SigMemberUpdateRecord;
204-
data.designation = "M";
205-
data.sigGroupId = sigId || "";
206-
data.createdAt = getTimeInFormat();
207-
data.updatedAt = data.createdAt;
208-
// console.log(data)
209-
await api.post(`/api/v1/siglead/addMember`, data);
210-
}
201+
const data = Object.fromEntries(formData.entries()) as {
202+
groupid: string;
203+
aid: string;
204+
rid: string;
205+
};
211206

212-
async function testAddGroup() {
213-
await api.patch(
214-
`/api/v1/iam/groups/:e37a2420-1030-48da-9d17-f7e201b446e1`,
215-
{ add: ["d115c8cb-2520-4ba4-bc36-dd55af69c590"], remove: [] },
216-
);
207+
try {
208+
const response = await api.patch(`/api/v1/iam/groups/${data.groupid}`, {
209+
add: data.aid !== "" ? [data.aid] : [],
210+
remove: data.rid !== "" ? [data.rid] : [],
211+
});
212+
213+
console.warn(`GRAPH API RESPONSE: ${response}`);
214+
notifications.show({
215+
message: JSON.stringify(response),
216+
});
217+
} catch (error) {
218+
notifications.show({
219+
message: JSON.stringify(error),
220+
});
221+
}
222+
223+
// console.log(response);
217224
}
218225

226+
// async function testAddGroup() {
227+
// await api.patch(
228+
// `/api/v1/iam/groups/:e37a2420-1030-48da-9d17-f7e201b446e1`,
229+
// { add: ["d115c8cb-2520-4ba4-bc36-dd55af69c590"], remove: [] },
230+
// );
231+
// }
232+
219233
return (
220234
<AuthGuard
221235
resourceDef={{ service: "core", validRoles: [AppRoles.SIGLEAD_MANAGER] }}
222236
>
223-
<h1>Add Member to {orgIds2Name[sigId || "acm"]}</h1>
224237
<form id="form" onSubmit={handleSubmit}>
225-
<label htmlFor="email">email: </label>
238+
<label htmlFor="groupid">group id: </label>
226239
<input
227-
type="email"
228-
name="email"
229-
id="email"
230-
placeholder="[email protected]"
240+
type="text"
241+
name="groupid"
242+
id="groupid"
243+
placeholder="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
231244
/>
232245
<br />
233-
<label htmlFor="id">uuid: </label>
246+
<label htmlFor="id">add uuid: </label>
234247
<input
235248
type="text"
236-
name="id"
237-
id="id"
249+
name="aid"
250+
id="aid"
238251
placeholder="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
239252
/>
240253
<br />
241-
<label htmlFor="memberName">name: </label>
254+
<label htmlFor="id">remove uuid: </label>
242255
<input
243256
type="text"
244-
name="memberName"
245-
id="memberName"
246-
placeholder="John Doe"
257+
name="rid"
258+
id="rid"
259+
placeholder="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
247260
/>
248261
<br />
249-
{/* <button type="submit" onSubmit={handleSubmit}>Submit</button> */}
250262
<button type="submit">Submit</button>
251263
</form>
252-
<button type="button" onClick={testAddGroup}>
253-
Test
254-
</button>
255264
</AuthGuard>
256265
);
257266
};

0 commit comments

Comments
 (0)