Skip to content

Commit fb15493

Browse files
committed
update API for auth_method -> access_method
2 parents ea4142a + 3b9f29c commit fb15493

File tree

7 files changed

+35
-19
lines changed

7 files changed

+35
-19
lines changed

OMICRON_VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
8bb4c1163ec57f2915fc0aa40b7dc96821079a64
1+
c01fca045fab73236923f209e9cf0694efdec086

app/api/__generated__/Api.ts

Lines changed: 4 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/api/__generated__/OMICRON_VERSION

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/api/__generated__/validate.ts

Lines changed: 7 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/components/form/fields/DateTimeRangePicker.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,15 @@ export function useDateTimeRangePicker({
8484
items,
8585
}
8686

87-
const [startTime] = useDebounce(range.start.toDate(tz), 400)
88-
const [endTime] = useDebounce(range.end.toDate(tz), 400)
87+
// Without these useMemos, we get re-renders every 400ms because when the
88+
// debounce timeout expires, it updates the value, which triggers a render for
89+
// itself because the time gets remade by toDate() (i.e., even though it is
90+
// the same time, it is a new object)
91+
const rangeStart = useMemo(() => range.start.toDate(tz), [range.start])
92+
const [startTime] = useDebounce(rangeStart, 400)
93+
94+
const rangeEnd = useMemo(() => range.end.toDate(tz), [range.end])
95+
const [endTime] = useDebounce(rangeEnd, 400)
8996

9097
return {
9198
startTime,

app/pages/system/AuditLog.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -316,9 +316,11 @@ export default function SiloAuditLogsPage() {
316316
)}
317317
</div>
318318
<div>
319-
<Badge color="neutral">
320-
{log.accessMethod?.split('_').join(' ') || 'Unknown'}
321-
</Badge>
319+
{log.authMethod ? (
320+
<Badge color="neutral">{log.authMethod.split('_').join(' ')}</Badge>
321+
) : (
322+
<EmptyCell />
323+
)}
322324
</div>
323325
<div className="text-secondary">
324326
{siloId ? (
@@ -396,7 +398,7 @@ export default function SiloAuditLogsPage() {
396398
<HeaderCell>Status</HeaderCell>
397399
<HeaderCell>Operation</HeaderCell>
398400
<HeaderCell>Actor ID</HeaderCell>
399-
<HeaderCell>Access Method</HeaderCell>
401+
<HeaderCell>Auth Method</HeaderCell>
400402
<HeaderCell>Silo ID</HeaderCell>
401403
<HeaderCell>Duration</HeaderCell>
402404
</div>

mock-api/audit-log.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ const mockOperations = [
5959
'ssh_key_delete',
6060
]
6161

62-
const mockAccessMethod = ['session_cookie', 'api_token', null]
62+
const mockAuthMethod = ['session_cookie', 'api_token', null]
6363

6464
const mockHttpStatusCodes = [200, 201, 204, 400, 401, 403, 404, 409, 500, 502, 503]
6565

@@ -87,7 +87,7 @@ function generateAuditLogEntry(index: number): Json<AuditLogEntry> {
8787

8888
return {
8989
id: uuid(),
90-
access_method: mockAccessMethod[index % mockAccessMethod.length],
90+
auth_method: mockAuthMethod[index % mockAuthMethod.length],
9191
actor: {
9292
kind: 'silo_user',
9393
silo_id: defaultSilo.id,
@@ -114,7 +114,7 @@ export const auditLog: Json<AuditLogEntry[]> = [
114114
// Recent successful operations
115115
{
116116
id: uuid(),
117-
access_method: 'session_cookie',
117+
auth_method: 'session_cookie',
118118
actor: {
119119
kind: 'silo_user',
120120
silo_id: defaultSilo.id,
@@ -130,7 +130,7 @@ export const auditLog: Json<AuditLogEntry[]> = [
130130
},
131131
{
132132
id: uuid(),
133-
access_method: 'api_token',
133+
auth_method: 'api_token',
134134
actor: {
135135
kind: 'silo_user',
136136
silo_id: defaultSilo.id,
@@ -148,7 +148,7 @@ export const auditLog: Json<AuditLogEntry[]> = [
148148
// Failed operations
149149
{
150150
id: uuid(),
151-
access_method: 'session_cookie',
151+
auth_method: 'session_cookie',
152152
actor: {
153153
kind: 'silo_user',
154154
silo_id: mockSiloIds[1],
@@ -170,7 +170,7 @@ export const auditLog: Json<AuditLogEntry[]> = [
170170
},
171171
{
172172
id: uuid(),
173-
access_method: null,
173+
auth_method: null,
174174
actor: { kind: 'unauthenticated' },
175175
result: {
176176
kind: 'error',
@@ -188,7 +188,7 @@ export const auditLog: Json<AuditLogEntry[]> = [
188188
// More historical entries
189189
{
190190
id: uuid(),
191-
access_method: 'session_cookie',
191+
auth_method: 'session_cookie',
192192
actor: {
193193
kind: 'silo_user',
194194
silo_id: mockSiloIds[0],

0 commit comments

Comments
 (0)