Skip to content

Commit

Permalink
Merge branch 'main' into overlapping_icons#102
Browse files Browse the repository at this point in the history
  • Loading branch information
amitsgh authored Nov 14, 2023
2 parents 15b1701 + f63640b commit 89fbbc6
Show file tree
Hide file tree
Showing 9 changed files with 723 additions and 167 deletions.
2 changes: 1 addition & 1 deletion backend/backend/graphene/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ class Meta:
# interfaces = (relay.Node, )

def resolve_history(self, info):
return SecretEvent.objects.filter(secret_id=self.id).order_by('timestamp')
return SecretEvent.objects.filter(secret_id=self.id, event_type__in=[SecretEvent.CREATE, SecretEvent.UPDATE]).order_by('timestamp')


class KMSLogType(ObjectType):
Expand Down
2 changes: 1 addition & 1 deletion backend/backend/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@

SESSION_COOKIE_DOMAIN = os.getenv('SESSION_COOKIE_DOMAIN')

SESSION_COOKIE_AGE = 86400 # 24 hours
SESSION_COOKIE_AGE = 604800 # 1 week, in seconds

# Application definition

Expand Down
4 changes: 2 additions & 2 deletions backend/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ constantly==15.1.0
cryptography==41.0.4
defusedxml==0.7.1
dj-rest-auth==3.0.0
Django==4.2.3
Django==4.2.7
django-allauth==0.52.0
django-cors-headers==3.14.0
django-filter==23.1
Expand Down Expand Up @@ -46,7 +46,7 @@ six==1.16.0
sqlparse==0.4.4
text-unidecode==1.3
tomli==2.0.1
Twisted==22.10.0
Twisted==23.10.0
txaio==23.1.1
typing_extensions==4.5.0
urllib3==1.26.18
Expand Down
23 changes: 23 additions & 0 deletions frontend/components/apps/tokens/SecretTokens.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,18 @@ export const SecretTokens = (props: { organisationId: string; appId: string }) =

const allowDelete = activeUserIsAdmin || token.createdBy!.self

const identityKeys = token.keys.map((key) => key.identityKey)

const { data } = useQuery(GetAppEnvironments, {
variables: {
appId,
},
})

const tokenEnvironments = data.appEnvironments.filter((env: EnvironmentType) =>
identityKeys.includes(env.identityKey)
)

return (
<div className="flex items-center w-full justify-between p-2 group">
<div className="flex items-center gap-4">
Expand All @@ -586,6 +598,17 @@ export const SecretTokens = (props: { organisationId: string; appId: string }) =
)}
</div>

<div className="flex items-center gap-2">
{tokenEnvironments.map(({ envType }: { envType: string }) => (
<div
key={envType}
className="rounded-full py-1 px-3 text-zinc-700 ring-1 ring-inset ring-zinc-900/10 dark:text-zinc-400 dark:ring-white/10"
>
{envType}
</div>
))}
</div>

<div className={clsx(isExpired && 'text-red-500')}>
{isExpired ? 'Expired' : 'Expires'}{' '}
{token.expiresAt ? relativeTimeFromDates(new Date(token.expiresAt)) : 'never'}
Expand Down
4 changes: 1 addition & 3 deletions frontend/components/environments/SecretRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -261,9 +261,7 @@ const HistoryDialog = (props: { secret: SecretType }) => {
if (eventType === ApiSecretEventEventTypeChoices.D) return 'Deleted'
}

const secretHistory = secret.history?.filter(
(event: Maybe<SecretEventType>) => event?.eventType! !== ApiSecretEventEventTypeChoices.R
)
const secretHistory = secret.history

return (
<>
Expand Down
2 changes: 1 addition & 1 deletion frontend/graphql/queries/secrets/getServiceTokens.gql
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ query GetServiceTokens($appId: ID!) {
expiresAt
keys {
id

identityKey
}
}
}
Loading

0 comments on commit 89fbbc6

Please sign in to comment.