Skip to content

Commit

Permalink
feat(connections): reduce default visible columns
Browse files Browse the repository at this point in the history
  • Loading branch information
kunish committed Oct 12, 2024
1 parent b533020 commit ca9e3ba
Show file tree
Hide file tree
Showing 8 changed files with 92 additions and 10 deletions.
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
},
"dependencies": {
"@commitlint/config-conventional": "^19.5.0",
"@corvu/accordion": "^0.2.3",
"@corvu/tailwind": "^0.1.5",
"@corvu/tooltip": "^0.2.1",
"@eslint/js": "^9.12.0",
"@felte/solid": "^1.2.13",
Expand Down
73 changes: 73 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion src/components/ConnectionsSettingsModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -249,12 +249,13 @@ export const ConnectionsSettingsModal = (props: {
<div class="flex flex-col gap-4">
<div>
<ConfigTitle withDivider>{t('quickFilter')}</ConfigTitle>

<input
type="text"
class="input input-bordered w-full"
onInput={(e) => setQuickFilterRegex(e.target.value)}
value={quickFilterRegex()}
></input>
/>
</div>

<div>
Expand Down
15 changes: 11 additions & 4 deletions src/constants/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,10 @@ export enum CONNECTIONS_TABLE_ACCESSOR_KEY {
Process = 'process',
Host = 'host',
SniffHost = 'sniffHost',
Rule = 'rules',
Rule = 'rule',
Chains = 'chains',
DlSpeed = 'dlSpeed',
ULSpeed = 'ulSpeed',
UlSpeed = 'ulSpeed',
Download = 'dl',
Upload = 'ul',
ConnectTime = 'connectTime',
Expand All @@ -140,9 +140,16 @@ export const CONNECTIONS_TABLE_INITIAL_COLUMN_ORDER = Object.values(

export const CONNECTIONS_TABLE_INITIAL_COLUMN_VISIBILITY = {
...Object.fromEntries(
CONNECTIONS_TABLE_INITIAL_COLUMN_ORDER.map((i) => [i, true]),
CONNECTIONS_TABLE_INITIAL_COLUMN_ORDER.map((i) => [i, false]),
),
[CONNECTIONS_TABLE_ACCESSOR_KEY.ID]: false,
[CONNECTIONS_TABLE_ACCESSOR_KEY.Details]: true,
[CONNECTIONS_TABLE_ACCESSOR_KEY.Close]: true,
[CONNECTIONS_TABLE_ACCESSOR_KEY.Host]: true,
[CONNECTIONS_TABLE_ACCESSOR_KEY.Rule]: true,
[CONNECTIONS_TABLE_ACCESSOR_KEY.Chains]: true,
[CONNECTIONS_TABLE_ACCESSOR_KEY.DlSpeed]: true,
[CONNECTIONS_TABLE_ACCESSOR_KEY.UlSpeed]: true,
[CONNECTIONS_TABLE_ACCESSOR_KEY.SourceIP]: true,
}

export enum TAILWINDCSS_SIZE {
Expand Down
1 change: 0 additions & 1 deletion src/i18n/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ export default {
overview: 'Overview',
proxies: 'Proxies',
proxiesSettings: 'Proxies Settings',
rules: 'Rules',
connections: 'Connections',
connectionsSettings: 'Connections Settings',
connectionsDetails: 'Connections Details',
Expand Down
1 change: 0 additions & 1 deletion src/i18n/zh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ export default {
overview: '概览',
proxies: '代理',
proxiesSettings: '代理设置',
rules: '规则',
connections: '连接',
connectionsSettings: '连接设置',
connectionsDetails: '连接详情',
Expand Down
4 changes: 2 additions & 2 deletions src/pages/Connections.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ export default () => {
accessorFn: (original) => original.metadata.sniffHost || '-',
},
{
header: () => t('rules'),
header: () => t('rule'),
accessorKey: CONNECTIONS_TABLE_ACCESSOR_KEY.Rule,
accessorFn: (original) =>
!original.rulePayload
Expand Down Expand Up @@ -208,7 +208,7 @@ export default () => {
{
header: () => t('ulSpeed'),
enableGrouping: false,
accessorKey: CONNECTIONS_TABLE_ACCESSOR_KEY.ULSpeed,
accessorKey: CONNECTIONS_TABLE_ACCESSOR_KEY.UlSpeed,
accessorFn: (original) => `${byteSize(original.uploadSpeed)}/s`,
sortingFn: (prev, next) =>
prev.original.uploadSpeed - next.original.uploadSpeed,
Expand Down
3 changes: 2 additions & 1 deletion tailwind.config.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import corvu from '@corvu/tailwind'
import daisyui from 'daisyui'
import { Config } from 'tailwindcss'

export default {
content: ['src/**/*.{css,ts,tsx}'],
plugins: [daisyui],
plugins: [daisyui, corvu],
daisyui: { themes: true },
theme: {
extend: {
Expand Down

0 comments on commit ca9e3ba

Please sign in to comment.