feat(sh-admin): introducing infra-tokens to admin dashboard (#4202)
Co-authored-by: nivedin <nivedinp@gmail.com>
This commit is contained in:
committed by
GitHub
parent
783d911f8d
commit
c24d5c5302
@@ -0,0 +1,12 @@
|
||||
mutation CreateInfraToken($label: String!, $expiryInDays: Int) {
|
||||
createInfraToken(label: $label, expiryInDays: $expiryInDays) {
|
||||
info {
|
||||
id
|
||||
label
|
||||
lastUsedOn
|
||||
createdOn
|
||||
expiresOn
|
||||
}
|
||||
token
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
mutation RevokeInfraToken($id: ID!) {
|
||||
revokeInfraToken(id: $id)
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
query InfraTokens($skip: Int, $take: Int) {
|
||||
infraTokens(skip: $skip, take: $take) {
|
||||
id
|
||||
label
|
||||
createdOn
|
||||
lastUsedOn
|
||||
expiresOn
|
||||
}
|
||||
}
|
||||
@@ -36,6 +36,9 @@ export const AUTH_PROVIDER_NOT_SPECIFIED =
|
||||
export const BOTH_EMAILS_CANNOT_BE_SAME =
|
||||
'[GraphQL] email/both_emails_cannot_be_same' as const;
|
||||
|
||||
export const INFRA_TOKEN_LABEL_SHORT =
|
||||
'[GraphQL] infra_token/label_too_short' as const;
|
||||
|
||||
type ErrorMessages = {
|
||||
message: string;
|
||||
alternateMessage?: string;
|
||||
@@ -68,6 +71,9 @@ const ERROR_MESSAGES: Record<string, ErrorMessages> = {
|
||||
[BOTH_EMAILS_CANNOT_BE_SAME]: {
|
||||
message: 'state.emails_cannot_be_same',
|
||||
},
|
||||
[INFRA_TOKEN_LABEL_SHORT]: {
|
||||
message: 'state.infra_token_label_short',
|
||||
},
|
||||
};
|
||||
|
||||
export const getCompiledErrorMessage = (name: string, altMessage = false) => {
|
||||
|
||||
17
packages/hoppscotch-sh-admin/src/helpers/utils/date.ts
Normal file
17
packages/hoppscotch-sh-admin/src/helpers/utils/date.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
export function shortDateTime(
|
||||
date: string | number | Date,
|
||||
includeTime: boolean = true
|
||||
) {
|
||||
return new Date(date).toLocaleString("en-US", {
|
||||
year: "numeric",
|
||||
month: "short",
|
||||
day: "numeric",
|
||||
...(includeTime
|
||||
? {
|
||||
hour: "numeric",
|
||||
minute: "numeric",
|
||||
second: "numeric",
|
||||
}
|
||||
: {}),
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user