Skip to content

Commit

Permalink
Use constant for “types”
Browse files Browse the repository at this point in the history
  • Loading branch information
kmcginnes committed Dec 4, 2024
1 parent 0698768 commit 5f0ad20
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ import {
VertexPreferences,
} from "./userPreferences";
import isDefaultValue from "./isDefaultValue";
import { RESERVED_ID_PROPERTY } from "@/utils/constants";
import {
RESERVED_ID_PROPERTY,
RESERVED_TYPES_PROPERTY,
} from "@/utils/constants";

export const isStoreLoadedAtom = atom<boolean>({
key: "store-loaded",
Expand Down Expand Up @@ -243,7 +246,7 @@ export const edgeTypesSelector = selector({
export const defaultVertexTypeConfig = {
attributes: [],
displayNameAttribute: RESERVED_ID_PROPERTY,
longDisplayNameAttribute: "types",
longDisplayNameAttribute: RESERVED_TYPES_PROPERTY,
color: "#128EE5",
iconUrl: DEFAULT_ICON_URL,
iconImageType: "image/svg+xml",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ import {
DisplayVertexTypeConfig,
displayVertexTypeConfigSelector,
} from "./displayTypeConfigs";
import { MISSING_DISPLAY_VALUE, RESERVED_ID_PROPERTY } from "@/utils/constants";
import {
MISSING_DISPLAY_VALUE,
RESERVED_ID_PROPERTY,
RESERVED_TYPES_PROPERTY,
} from "@/utils/constants";
import { queryEngineSelector } from "../connector";

/** Represents a vertex's display information after all transformations have been applied. */
Expand Down Expand Up @@ -97,7 +101,7 @@ const displayVertexSelector = selectorFamily({
function getDisplayAttributeValueByName(name: string | undefined) {
if (name === RESERVED_ID_PROPERTY) {
return displayId;
} else if (name === "types") {
} else if (name === RESERVED_TYPES_PROPERTY) {
return displayTypes;
} else if (name) {
return (
Expand Down
3 changes: 3 additions & 0 deletions packages/graph-explorer/src/utils/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ export const DEFAULT_CONCURRENT_REQUESTS_LIMIT = 10;
/** The name of the special property representing the node ID */
export const RESERVED_ID_PROPERTY = "~id";

/** The name of the property representing the list of types of the node */
export const RESERVED_TYPES_PROPERTY = "types";

/** The string "Graph Explorer". */
export const APP_NAME = "Graph Explorer";

Expand Down

0 comments on commit 5f0ad20

Please sign in to comment.