Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | 263x 263x 14x 14x 14x 263x 263x 263x 263x | import type { Fabric, FabricMeta } from "@/app/store/fabric/types";
import type { Space, SpaceMeta } from "@/app/store/space/types";
import type { Subnet, SubnetMeta } from "@/app/store/subnet/types";
import type { VLAN, VLANMeta } from "@/app/store/vlan/types";
import { argPath, isId } from "@/app/utils";
const withSubnetId = argPath<{ id: Subnet[SubnetMeta.PK] }>;
const urls = {
index: "/networks",
indexWithParams: (options: { by?: string; q?: string }): string => {
const defaults = { by: "fabric", q: "" };
const { by, q } = { ...defaults, ...options };
return `/networks?by=${by}&q=${q}`;
},
fabric: {
index: argPath<{ id: Fabric[FabricMeta.PK] }>("/fabric/:id"),
},
space: {
index: argPath<{ id: Space[SpaceMeta.PK] }>("/space/:id"),
},
subnet: {
summary: withSubnetId("/subnet/:id/summary"),
staticRoutes: withSubnetId("/subnet/:id/static-routes"),
addressReservation: withSubnetId("/subnet/:id/address-reservation"),
dhcpSnippets: withSubnetId("/subnet/:id/dhcp-snippets"),
usedIpAddresses: withSubnetId("/subnet/:id/used-ip-addresses"),
index: argPath<{ id: Subnet[SubnetMeta.PK] }>("/subnet/:id"),
},
vlan: {
index: argPath<{ id: VLAN[VLANMeta.PK] }>("/vlan/:id"),
},
} as const;
const getFabricLink = (id?: Fabric["id"]): string | null =>
isId(id) ? urls.fabric.index({ id }) : null;
const getSpaceLink = (id?: Space["id"]): string | null =>
isId(id) ? urls.space.index({ id }) : null;
const getVLANLink = (id?: VLAN["id"]): string | null =>
isId(id) ? urls.vlan.index({ id }) : null;
const getSubnetLink = (id?: Subnet["id"]): string | null =>
isId(id) ? urls.subnet.index({ id }) : null;
export default urls;
export { getFabricLink, getSpaceLink, getVLANLink, getSubnetLink };
|