Skip to content
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
6 changes: 3 additions & 3 deletions tavern/internal/www/build/asset-manifest.json

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

2 changes: 1 addition & 1 deletion tavern/internal/www/build/index.html

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

Large diffs are not rendered by default.

Large diffs are not rendered by default.

3 changes: 0 additions & 3 deletions tavern/internal/www/build/static/js/main.f2bfc20e.js

This file was deleted.

135 changes: 0 additions & 135 deletions tavern/internal/www/build/static/js/main.f2bfc20e.js.LICENSE.txt

This file was deleted.

1 change: 0 additions & 1 deletion tavern/internal/www/build/static/js/main.f2bfc20e.js.map

This file was deleted.

11 changes: 8 additions & 3 deletions tavern/internal/www/src/components/BeaconTile.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { BugAntIcon } from "@heroicons/react/24/outline";
import { BeaconNode, TagEdge } from "../utils/interfacesQuery";
import { checkIfBeaconOffline } from "../utils/utils";
import { checkIfBeaconOffline, getEnumKey } from "../utils/utils";
import Badge from "./tavern-base-ui/badge/Badge";
import { Globe, Network } from "lucide-react";
import { SupportedPlatforms, SupportedTransports } from "../utils/enums";


type Props = {
Expand All @@ -14,7 +15,8 @@ const BeaconTile = (props: Props) => {
const {
host,
principal,
name
name,
transport
} = beacon;
const beaconOffline = checkIfBeaconOffline(beacon);

Expand All @@ -29,14 +31,17 @@ const BeaconTile = (props: Props) => {
{(principal && principal !== "") &&
<Badge>{principal}</Badge>
}
{transport &&
<Badge>{getEnumKey(SupportedTransports, transport)}</Badge>
}
{host?.primaryIP && (
<Badge leftIcon={<Network className="h-3 w-3" />}>{host?.primaryIP}</Badge>
)}
{host?.externalIP && (
<Badge leftIcon={<Globe className="h-3 w-3" />}>{host?.externalIP}</Badge>
)}
{host?.platform &&
<Badge>{host?.platform}</Badge>
<Badge>{getEnumKey(SupportedPlatforms, host?.platform)}</Badge>
}
{host?.tags && host?.tags?.edges?.map((tag: TagEdge) => {
return <Badge key={tag.node.id}>{tag.node.name}</Badge>
Expand Down
4 changes: 3 additions & 1 deletion tavern/internal/www/src/components/HostTile.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { SupportedPlatforms } from "../utils/enums";
import { HostNode } from "../utils/interfacesQuery";
import { getEnumKey } from "../utils/utils";
import Badge from "./tavern-base-ui/badge/Badge";
import { Globe, Network } from "lucide-react";

Expand All @@ -13,7 +15,7 @@ const HostTile = ({ data }: { data: HostNode }) => {
{data?.externalIP && (
<Badge leftIcon={<Globe className="h-3 w-3" />}>{data?.externalIP}</Badge>
)}
<Badge>{data?.platform}</Badge>
{data?.platform && (<Badge>{getEnumKey(SupportedPlatforms, data?.platform)}</Badge>)}
{data.tags && data?.tags.edges.map((tag) => {
return <Badge key={tag.node.id}>{tag.node.name}</Badge>
})}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ type Props = {
}
export const BeaconFilterBar = (props: Props) => {
const { data } = useTags();
const { beacons, groupTags, serviceTags, hosts, principals, primaryIPs, platforms } = data;
const { beacons, groupTags, serviceTags, hosts, principals, primaryIPs, platforms, transports } = data;

const { setFiltersSelected, filtersSelected, isDisabled, initialFilters } = props;

Expand All @@ -19,6 +19,10 @@ export const BeaconFilterBar = (props: Props) => {
label: "Platform",
options: platforms
},
{
label: "Transport",
options: transports
},
{
label: "Service",
options: serviceTags
Expand Down
31 changes: 22 additions & 9 deletions tavern/internal/www/src/context/TagContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { ApolloError, useQuery } from "@apollo/client";
import { GET_TAG_FILTERS } from "../utils/queries";
import { BeaconEdge, BeaconNode, HostEdge, HostNode, TagContextQueryResponse, TagEdge, TagNode } from "../utils/interfacesQuery";
import { FilterBarOption, TagContextProps } from "../utils/interfacesUI";
import { SupportedPlatforms } from "../utils/enums";
import { SupportedPlatforms, SupportedTransports } from "../utils/enums";

type TagContextType = {
data: TagContextProps;
Expand All @@ -21,7 +21,8 @@ export const TagContextProvider = ({ children }: { children: React.ReactNode })
hosts: [],
principals: [],
primaryIPs: [],
platforms: []
platforms: [],
transports: [],
});

const PARAMS = {
Expand All @@ -38,7 +39,9 @@ export const TagContextProvider = ({ children }: { children: React.ReactNode })
if (!data) {
return;
}
const supportedPlatformsList = Object.values(SupportedPlatforms);
const supportedPlatformsList = Object.entries(SupportedPlatforms);
const supportedTransportList = Object.entries(SupportedTransports);

const beacons: Array<FilterBarOption & BeaconNode> = [];
const principalsSet = new Set<string>();
const principals: FilterBarOption[] = [];
Expand Down Expand Up @@ -108,14 +111,23 @@ export const TagContextProvider = ({ children }: { children: React.ReactNode })
});

// Build platform options
const platforms: FilterBarOption[] = supportedPlatformsList.map((platform: string) => ({
id: platform,
name: platform,
value: platform,
label: platform,
const platforms: FilterBarOption[] = supportedPlatformsList.map(([label, value]) => ({
id: value,
name: value,
value: value,
label: label,
kind: "platform"
}));

// Build transport options with user-friendly labels
const transports: FilterBarOption[] = supportedTransportList.map(([label, value]) => ({
id: value,
name: value,
value: value,
label: label,
kind: "transport"
}));

// Set tags state with formatted options
const tags: TagContextProps = {
beacons,
Expand All @@ -124,7 +136,8 @@ export const TagContextProvider = ({ children }: { children: React.ReactNode })
hosts,
principals,
primaryIPs,
platforms
platforms,
transports
};
setTags(tags);
}, []);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,19 @@ const TomeRadioGroup = ({ label, data, selected, setSelected }: TomeRadioGroupPr
const handleSearch = (text: string) => {
const fd = data.filter((tome) => {
let tomeName = tome.name.toLowerCase();
let tomeDesc = tome?.description?.toLowerCase();
let tomeParams = tome?.paramDefs?.toLowerCase();

let searchText = text.toLowerCase();
return tomeName.includes(searchText) || (selected && selected.name === tome?.name);
return tomeParams?.includes(searchText) || tomeDesc?.includes(searchText) || tomeName.includes(searchText) || (selected && selected.name === tome?.name);
})
setFilteredData(fd);
}

return (
<div className="w-full">
<div className="mx-auto w-full flex flex-col gap-2">
<FreeTextSearch placeholder='Search by tome name' setSearch={handleSearch} />
<FreeTextSearch placeholder='Search by tome definition' setSearch={handleSearch} />
<RadioGroup value={selected || undefined} onChange={setSelected} className="flex flex-col gap-3">
<RadioGroup.Label className="sr-only">
<Heading size="sm" >{label}</Heading>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,15 @@ export const useBeaconFilter = (beacons: Array<BeaconNode>, selectedBeacons: Sel
}
}

if(searchTypes.transport.length > 0){
if(beacon?.transport && searchTypes.transport.indexOf(beacon?.transport) > -1){
match = true;
}
else{
return false;
}
}

if(searchTypes.primaryIP.length > 0){
if(beacon?.host?.primaryIP && searchTypes.primaryIP.indexOf(beacon?.host?.primaryIP) > -1){
match = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ import { formatDistance } from "date-fns";
import { useNavigate } from 'react-router-dom';

import Table from "../../../components/tavern-base-ui/Table";
import { PrincipalAdminTypes } from "../../../utils/enums";
import { checkIfBeaconOffline } from "../../../utils/utils";
import { PrincipalAdminTypes, SupportedTransports } from "../../../utils/enums";
import { checkIfBeaconOffline, getEnumKey } from "../../../utils/utils";
import Button from "../../../components/tavern-base-ui/button/Button";
import Badge from "../../../components/tavern-base-ui/badge/Badge";
import { BeaconEdge } from "../../../utils/interfacesQuery";

const BeaconTable = ({ beacons }: { beacons: Array<BeaconEdge> }) => {
console.log(beacons);
const nav = useNavigate();
const currentDate = new Date();
const princialColors = Object.values(PrincipalAdminTypes);
Expand Down Expand Up @@ -37,6 +38,23 @@ const BeaconTable = ({ beacons }: { beacons: Array<BeaconEdge> }) => {
);
}
},
{
id: "transport",
header: "Transport",
accessorFn: (row: BeaconEdge) => row?.node?.transport,
footer: props => props.column.id,
enableSorting: false,
maxSize: 80,
cell: (cellData: any) => {
const transport = cellData.getValue();
if (!transport) {
return null;
}
return (
<Badge>{getEnumKey(SupportedTransports, transport)}</Badge>
);
}
},
{
id: "Status",
header: "Status",
Expand Down
Loading
Loading