Skip to content

Commit

Permalink
style: audit log (#2576)
Browse files Browse the repository at this point in the history
Co-authored-by: aliaksey <[email protected]>
  • Loading branch information
kyle-ssg and aliakseilatyp authored Aug 8, 2023
1 parent 95055b4 commit 8d8ec93
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 4 deletions.
24 changes: 21 additions & 3 deletions frontend/web/components/AuditLog.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
import React, { FC, ReactNode, useEffect, useRef, useState } from 'react' // we need this to make JSX compile
import moment from 'moment'
import Utils from 'common/utils/utils'
import { AuditLogItem } from 'common/types/responses'
import { AuditLogItem, Environment, Project } from 'common/types/responses'
import { useGetAuditLogsQuery } from 'common/services/useAuditLog'
import useSearchThrottle from 'common/useSearchThrottle'
import ProjectProvider from 'common/providers/ProjectProvider'
import JSONReference from './JSONReference'
import { Link } from 'react-router-dom'
import PanelSearch from './PanelSearch'
import ProjectStore from 'common/stores/project-store'
import Tag from './tags/Tag'
import Constants from 'common/constants'

type AuditLogType = {
environmentId: string
Expand Down Expand Up @@ -70,6 +74,10 @@ const AuditLog: FC<AuditLogType> = (props) => {
environment,
log,
}: AuditLogItem) => {
const index = ProjectStore.getEnvs()?.findIndex((v) => {
return v.id === environment?.id
})
const colour = index === -1 ? 0 : index
return (
<Row className='list-item list-item-sm' key={created_date}>
<div
Expand All @@ -91,7 +99,13 @@ const AuditLog: FC<AuditLogType> = (props) => {
to={`/project/${props.projectId}/environment/${environment?.api_key}/features/`}
>
<Row>
<span className='flex-row chip'>{environment?.name}</span>
<Tag
tag={{
color: Constants.tagColors[colour],
label: environment?.name,
}}
className='chip--sm'
/>
</Row>
</Link>
) : (
Expand Down Expand Up @@ -128,7 +142,11 @@ const AuditLog: FC<AuditLogType> = (props) => {
onChange={(e: InputEvent) => {
setSearchInput(Utils.safeParseEventValue(e))
}}
paging={{ ...(projectAuditLog || {}), page, pageSize: props.pageSize }}
paging={{
...(projectAuditLog || {}),
page,
pageSize: props.pageSize,
}}
nextPage={() => {
setPage(page + 1)
}}
Expand Down
2 changes: 1 addition & 1 deletion frontend/web/components/tags/Tag.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const Tag: FC<TagType> = ({
return deselectedColor || tag.color
}

if (!hideNames) {
if (!hideNames && !!onClick) {
return (
<ToggleChip
color={getColor()}
Expand Down
6 changes: 6 additions & 0 deletions frontend/web/styles/3rdParty/_hljs.scss
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,12 @@ code.txt {
background: $input-bg-dark !important;
color: white;
}
.hljs-header {
color: white;
path {
fill: white;
}
}
}

code[contenteditable='false'].hljs {
Expand Down

0 comments on commit 8d8ec93

Please sign in to comment.