Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(web): Refine logs display in UI #3481

Merged
merged 5 commits into from
Feb 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/server/lib/controllers/v1/logs/searchOperations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ const validation = z
'proxy',
'deploy',
'auth',
'auth:create_connection',
'auth:refresh_token',
'admin',
'webhook',
'webhook:incoming',
Expand Down
3 changes: 0 additions & 3 deletions packages/webapp/src/pages/Logs/Search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { useStore } from '../../store';
import { useSearchOperations } from '../../hooks/useLogs';
import * as Table from '../../components/ui/Table';
import { getCoreRowModel, useReactTable, flexRender } from '@tanstack/react-table';

import { MultiSelect } from '../../components/MultiSelect';
import {
columns,
Expand All @@ -26,8 +25,6 @@ import type {
SearchOperationsType
} from '@nangohq/types';
import Spinner from '../../components/ui/Spinner';
// import { Input } from '../../components/ui/input/Input';
// import { MagnifyingGlassIcon } from '@radix-ui/react-icons';
import { formatQuantity, stringArrayEqual } from '../../utils/utils';
import { Link, useSearchParams } from 'react-router-dom';
import { useDebounce, useIntersection, useInterval, usePreviousDistinct } from 'react-use';
Expand Down
24 changes: 18 additions & 6 deletions packages/webapp/src/pages/Logs/components/OperationTag.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ import {
IconClockPlay,
IconClockPause,
IconRefresh,
IconUserPlus,
IconCircleKey,
IconSettingsAutomation,
IconClockPlus
IconSettings,
IconArrowForward,
IconLink,
IconLock,
IconPlus
} from '@tabler/icons-react';
import { Tag } from '../../../components/ui/label/Tag';
import * as Tooltip from '../../../components/ui/Tooltip';
Expand All @@ -22,7 +24,7 @@ export const OperationTag: React.FC<{ message: string; operation: Exclude<Search
{operation.type === 'sync' && (
<Tag>
{operation.action === 'cancel' && <IconX className="w-3.5 h-3.5" />}
{operation.action === 'init' && <IconClockPlus className="w-3.5 h-3.5" />}
{operation.action === 'init' && <IconPlus className="w-3.5 h-3.5" />}
{operation.action === 'pause' && <IconClockPause className="w-3.5 h-3.5" />}
{operation.action === 'request_run' && <IconPlayerPlay className="w-3.5 h-3.5" />}
{operation.action === 'request_run_full' && <IconPlayerPlay className="w-3.5 h-3.5" />}
Expand All @@ -33,9 +35,19 @@ export const OperationTag: React.FC<{ message: string; operation: Exclude<Search

{operation.type === 'auth' && (
<Tag>
{operation.action === 'create_connection' && <IconUserPlus className="w-3.5 h-3.5" />}
{operation.action === 'create_connection' && <IconPlus className="w-3.5 h-3.5" />}
{operation.action === 'post_connection' && <IconSettingsAutomation className="w-3.5 h-3.5" />}
{operation.action === 'refresh_token' && <IconCircleKey className="w-3.5 h-3.5" />}
{operation.action === 'refresh_token' && <IconRefresh className="w-3.5 h-3.5" />}
</Tag>
)}

{operation.type === 'webhook' && (
<Tag>
{operation.action === 'forward' && <IconSettings className="w-3.5 h-3.5" />}
{operation.action === 'incoming' && <IconArrowForward className="w-3.5 h-3.5" />}
{operation.action === 'connection_create' && <IconLink className="w-3.5 h-3.5" />}
{operation.action === 'sync' && <IconRefresh className="w-3.5 h-3.5" />}
{operation.action === 'connection_refresh' && <IconLock className="w-3.5 h-3.5" />}
</Tag>
)}
</div>
Expand Down
2 changes: 1 addition & 1 deletion packages/webapp/src/pages/Logs/components/TypesSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export const TypesSelect: React.FC<SearchableMultiSelectArgs<any>> = ({ selected
)}
</Button>
</PopoverTrigger>
<PopoverContent className="w-72 p-0 text-white bg-active-gray">
<PopoverContent className="w-80 p-0 text-white bg-active-gray">
<Command>
<CommandList className="max-h-none h-[415px]">
<CommandEmpty>No framework found.</CommandEmpty>
Expand Down
35 changes: 21 additions & 14 deletions packages/webapp/src/pages/Logs/constants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const columns: ColumnDef<SearchOperationsData>[] = [
{
accessorKey: 'operation',
header: 'Type',
size: 100,
size: 140,
cell: ({ row }) => {
return <OperationTag message={row.original.message} operation={row.original.operation} />;
}
Expand Down Expand Up @@ -92,24 +92,27 @@ export const statusOptions: MultiSelectArgs<SearchOperationsState>['options'] =
export const typesDefaultOptions: SearchOperationsType[] = ['all'];
export const typesOptions = [
{ value: 'all', name: 'All' },
{
value: 'auth',
name: 'Auth',
childs: [
{ name: 'Connection created', value: 'auth:create_connection' },
{ name: 'Token refreshed', value: 'auth:refresh_token' }
]
},
{
value: 'sync',
name: 'Sync',
childs: [
{ name: 'Execution', value: 'sync:run' },
{ name: 'Pause Schedule', value: 'sync:pause' },
{ name: 'Resume Schedule', value: 'sync:unpause' },
{ name: 'Trigger Incremental Execution', value: 'sync:request_run' },
{ name: 'Trigger Full Execution', value: 'sync:request_run_full' },
{ name: 'Sync Init', value: 'sync:init' },
{ name: 'Cancel Execution', value: 'sync:cancel' }
{ name: 'Sync initialized', value: 'sync:init' },
{ name: 'Sync executed', value: 'sync:run' },
{ name: 'Incremental execution triggered', value: 'sync:request_run' },
{ name: 'Full execution triggered', value: 'sync:request_run_full' },
{ name: 'Sync execution cancelled', value: 'sync:cancel' },
{ name: 'Sync schedule paused', value: 'sync:pause' },
{ name: 'Sync schedule resumed', value: 'sync:unpause' }
]
},
{ value: 'action', name: 'Action' },
{ value: 'events', name: 'Events' },
{ value: 'proxy', name: 'Proxy' },
{ value: 'deploy', name: 'Deploy' },
{ value: 'auth', name: 'Auth' },
{
value: 'webhook',
name: 'Webhook',
Expand All @@ -120,7 +123,11 @@ export const typesOptions = [
{ name: 'Sync completion webhooks', value: 'webhook:sync' },
{ name: 'Token refresh webhooks', value: 'webhook:connection_refresh' }
]
}
},
{ value: 'action', name: 'Actions' },
{ value: 'events', name: 'Event-based executions' },
{ value: 'proxy', name: 'Proxy' },
{ value: 'deploy', name: 'Deploys' }
];

export const integrationsDefaultOptions: SearchOperationsIntegration[] = ['all'];
Expand Down
Loading