Skip to content

Commit

Permalink
fix formatters for table options
Browse files Browse the repository at this point in the history
  • Loading branch information
dskvr committed Dec 30, 2024
1 parent cc33d66 commit 25661a2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
8 changes: 4 additions & 4 deletions apps/gui/src/lib/components/lists/table/TableOptions.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
import { Nip66Event } from "@nostrwatch/nip66/models";
import Checkbox from "../../ui/checkbox/checkbox.svelte";
import { StateManager } from "@nostrwatch/nip66";
import type { Writable } from "svelte/store";
import { capitalize } from "@nostrwatch/utils";
export let tableKey: string;
export let config: Writable<DataTableConfig | null>;
Expand Down Expand Up @@ -47,17 +49,15 @@
}
</script>

{JSON.stringify(config.humanReadableNames)}

{#each availableKeys as key}
<li>
<Checkbox
checked={$config.columnsShow.includes(key)}
checked={$config?.columnsShow.includes(key)}
onCheckedChange={() => toggleColumnShow(key)}
value={key}
class="mr-2"
/>
{config?.humanReadableNames?.[key] || key}
{$config?.humanReadableNames?.[key] || capitalize(key)}
</li>
{/each}

Expand Down
11 changes: 9 additions & 2 deletions apps/gui/src/lib/config/dataTable/relays.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ let $monitorsMap: Map<string, Monitor>;

monitorsMap.subscribe(value => $monitorsMap = value)


type Resolver = (input: any) => any

class SpeedGroupResolver {
Expand Down Expand Up @@ -56,13 +55,21 @@ export const normalizeKeys = (keys: DataKeys | string) => {
return keys.map(k => k.toLowerCase())
}

export const columnsDisable: DataKeys = ['created_at', 'monitor_pubkey']
export const columnsDisable: DataKeys = ['id', 'created_at', 'monitorPubkey', 'fees']
export const filtersDisable: DataKeys = ['as', 'asname']

export const columnsShow: DataKeys = ['relay', 'lastSeen', 'geocode', 'paymentRequired', 'authRequired']
export const filtersShow: DataKeys = ['networks', 'hasNip11', 'paymentRequired', 'authRequired', 'isp', 'software', 'supportedNips', 'geocode', 'operatorPubkeyValid']

export const humanReadableNames: NameFormatter = {
dd: 'Decimal Degrees',
geohash: 'Geohash',
ipv4: 'IPv4',
ipv6: 'IPv6',
as: 'AS',
asname: 'AS Name',
seenBy: 'Seen By',
seenTimes: 'Seen',
networks: 'Network',
lastSeen: 'Last Seen',
supportedNips: 'NIPs',
Expand Down

0 comments on commit 25661a2

Please sign in to comment.