Skip to content

Commit ad22d9a

Browse files
authored
Housekeeping on schema entitities folder (#5807)
- reduce duplication - moved files and renamed types to better follow our new architecture - added tests
1 parent ad5b3f6 commit ad22d9a

File tree

145 files changed

+878
-849
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

145 files changed

+878
-849
lines changed

frontend/app/src/entities/artifacts/ui/artifact-details.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
} from "@/entities/nodes/object-items/getSchemaObjectColumns";
88
import { getObjectDetailsUrl } from "@/entities/nodes/utils";
99
import { getPermission } from "@/entities/permission/utils";
10-
import { genericsState, schemaState } from "@/entities/schema/stores/schema.atom";
10+
import { genericSchemasAtom, nodeSchemasAtom } from "@/entities/schema/stores/schema.atom";
1111
import { schemaKindLabelState } from "@/entities/schema/stores/schemaKindLabel.atom";
1212
import useQuery from "@/shared/api/graphql/useQuery";
1313
import { constructPath } from "@/shared/api/rest/fetch";
@@ -28,9 +28,9 @@ import ArtifactHeader from "./artifact-header";
2828
function ArtifactsDetails() {
2929
const { objectid } = useParams();
3030

31-
const [schemaList] = useAtom(schemaState);
31+
const [schemaList] = useAtom(nodeSchemasAtom);
3232
const [schemaLabels] = useAtom(schemaKindLabelState);
33-
const [genericList] = useAtom(genericsState);
33+
const [genericList] = useAtom(genericSchemasAtom);
3434
const schema = schemaList.find((s) => s.kind === ARTIFACT_OBJECT);
3535
const generic = genericList.find((s) => s.kind === ARTIFACT_OBJECT);
3636
useTitle("Artifact details");

frontend/app/src/entities/diff/artifact-diff/artifact-content-diff.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { currentBranchAtom } from "@/entities/branches/stores";
99
import { createObject } from "@/entities/nodes/api/createObject";
1010
import { deleteObject } from "@/entities/nodes/api/deleteObject";
1111
import { getProposedChangesArtifactsThreads } from "@/entities/proposed-changes/api/getProposedChangesArtifactsThreads";
12-
import { schemaState } from "@/entities/schema/stores/schema.atom";
12+
import { nodeSchemasAtom } from "@/entities/schema/stores/schema.atom";
1313
import graphqlClient from "@/shared/api/graphql/graphqlClientApollo";
1414
import useQuery from "@/shared/api/graphql/useQuery";
1515
import { fetchStream } from "@/shared/api/rest/fetch";
@@ -98,7 +98,7 @@ export const ArtifactContentDiff = (props: any) => {
9898
const branch = useAtomValue(currentBranchAtom);
9999
const date = useAtomValue(datetimeAtom);
100100
const auth = useAuth();
101-
const [schemaList] = useAtom(schemaState);
101+
const [schemaList] = useAtom(nodeSchemasAtom);
102102
const [isLoading, setIsLoading] = useState(false);
103103
const [previousFile, setPreviousFile] = useState("");
104104
const [newFile, setNewFile] = useState("");

frontend/app/src/entities/diff/artifact-diff/artifact-repo-diff.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { getArtifactDetails } from "@/entities/artifacts/api/getArtifacts";
2-
import { schemaState } from "@/entities/schema/stores/schema.atom";
2+
import { nodeSchemasAtom } from "@/entities/schema/stores/schema.atom";
33
import useQuery from "@/shared/api/graphql/useQuery";
44
import Accordion from "@/shared/components/display/accordion";
55
import { Badge } from "@/shared/components/display/badge";
@@ -14,7 +14,7 @@ import { ArtifactContentDiff } from "./artifact-content-diff";
1414
export const ArtifactRepoDiff = (props: any) => {
1515
const { diff } = props;
1616

17-
const [schemaList] = useAtom(schemaState);
17+
const [schemaList] = useAtom(nodeSchemasAtom);
1818

1919
const schemaData = schemaList.filter((s) => s.kind === "Artifact")[0];
2020

frontend/app/src/entities/diff/checks/checks-summary.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66
import { useAuth } from "@/entities/authentication/ui/useAuth";
77
import { runCheck } from "@/entities/diff/api/runCheck";
88
import { getValidatorsStats } from "@/entities/proposed-changes/ui/checks";
9-
import { genericsState } from "@/entities/schema/stores/schema.atom";
9+
import { genericSchemasAtom } from "@/entities/schema/stores/schema.atom";
1010
import { schemaKindLabelState } from "@/entities/schema/stores/schemaKindLabel.atom";
1111
import graphqlClient from "@/shared/api/graphql/graphqlClientApollo";
1212
import { Button } from "@/shared/components/buttons/button-primitive";
@@ -32,7 +32,7 @@ export const ChecksSummary = (props: tChecksSummaryProps) => {
3232

3333
const { proposedChangeId } = useParams();
3434
const schemaKindLabel = useAtomValue(schemaKindLabelState);
35-
const schemaList = useAtomValue(genericsState);
35+
const schemaList = useAtomValue(genericSchemasAtom);
3636
const { isAuthenticated } = useAuth();
3737

3838
const schemaData = schemaList.find((s) => s.kind === PROPOSED_CHANGES_VALIDATOR_OBJECT);

frontend/app/src/entities/diff/file-diff/file-content-diff.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { currentBranchAtom } from "@/entities/branches/stores";
99
import { createObject } from "@/entities/nodes/api/createObject";
1010
import { deleteObject } from "@/entities/nodes/api/deleteObject";
1111
import { getProposedChangesFilesThreads } from "@/entities/proposed-changes/api/getProposedChangesFilesThreads";
12-
import { schemaState } from "@/entities/schema/stores/schema.atom";
12+
import { nodeSchemasAtom } from "@/entities/schema/stores/schema.atom";
1313
import graphqlClient from "@/shared/api/graphql/graphqlClientApollo";
1414
import useQuery from "@/shared/api/graphql/useQuery";
1515
import { fetchStream } from "@/shared/api/rest/fetch";
@@ -108,7 +108,7 @@ export const FileContentDiff = (props: any) => {
108108
const branch = useAtomValue(currentBranchAtom);
109109
const date = useAtomValue(datetimeAtom);
110110
const auth = useAuth();
111-
const [schemaList] = useAtom(schemaState);
111+
const [schemaList] = useAtom(nodeSchemasAtom);
112112
const [isLoading, setIsLoading] = useState(false);
113113
const [previousFile, setPreviousFile] = useState(false);
114114
const [newFile, setNewFile] = useState(false);

frontend/app/src/entities/diff/node-diff/comments.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { getThreadLabel } from "@/entities/diff/utils";
88
import { createObject } from "@/entities/nodes/api/createObject";
99
import { deleteObject } from "@/entities/nodes/api/deleteObject";
1010
import { getProposedChangesObjectThreadComments } from "@/entities/proposed-changes/api/getProposedChangesObjectThreadComments";
11-
import { schemaState } from "@/entities/schema/stores/schema.atom";
11+
import { nodeSchemasAtom } from "@/entities/schema/stores/schema.atom";
1212
import graphqlClient from "@/shared/api/graphql/graphqlClientApollo";
1313
import useQuery from "@/shared/api/graphql/useQuery";
1414
import { AddComment } from "@/shared/components/conversations/add-comment";
@@ -32,7 +32,7 @@ export const DiffComments = (props: tDiffComments) => {
3232
const { path, refetch: parentRefetch } = props;
3333

3434
const { proposedChangeId } = useParams();
35-
const [schemaList] = useAtom(schemaState);
35+
const [schemaList] = useAtom(nodeSchemasAtom);
3636
const auth = useAuth();
3737
const branch = useAtomValue(currentBranchAtom);
3838
const date = useAtomValue(datetimeAtom);

frontend/app/src/entities/diff/node-diff/thread.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { PROPOSED_CHANGES_OBJECT_THREAD_OBJECT } from "@/config/constants";
22
import { getThreadLabel, getThreadTitle } from "@/entities/diff/utils";
33
import { getProposedChangesObjectThreads } from "@/entities/proposed-changes/api/getProposedChangesObjectThreads";
4-
import { schemaState } from "@/entities/schema/stores/schema.atom";
4+
import { nodeSchemasAtom } from "@/entities/schema/stores/schema.atom";
55
import useQuery from "@/shared/api/graphql/useQuery";
66
import { SidePanelTitle } from "@/shared/components/display/sidepanel-title";
77
import SlideOver from "@/shared/components/display/slide-over";
@@ -23,7 +23,7 @@ type tDiffThread = {
2323

2424
export const DiffThread = ({ path }: tDiffThread) => {
2525
const { proposedChangeId } = useParams();
26-
const [schemaList] = useAtom(schemaState);
26+
const [schemaList] = useAtom(nodeSchemasAtom);
2727
const { node, currentBranch } = use(DiffContext);
2828
const [showThread, setShowThread] = useState(false);
2929

frontend/app/src/entities/diff/ui/diff-tree.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { DiffNode } from "@/entities/diff/node-diff/types";
22
import { DiffBadge } from "@/entities/diff/node-diff/utils";
33
import { TREE_ROOT_ID } from "@/entities/ipam/constants";
44
import { EMPTY_TREE, addItemsToTree } from "@/entities/ipam/ipam-tree/utils";
5-
import { useSchema } from "@/entities/schema/hooks/useSchema";
5+
import { useSchema } from "@/entities/schema/ui/hooks/useSchema";
66
import { Tooltip } from "@/shared/components/ui/tooltip";
77
import { Tree, TreeItemProps, TreeProps } from "@/shared/components/ui/tree";
88
import { Icon } from "@iconify-icon/react";

frontend/app/src/entities/events/ui/global-node-event.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { NodeLabel } from "@/entities/nodes/object/ui/display-label";
2-
import { useSchema } from "@/entities/schema/hooks/useSchema";
32
import { schemaKindLabelState } from "@/entities/schema/stores/schemaKindLabel.atom";
3+
import { useSchema } from "@/entities/schema/ui/hooks/useSchema";
44
import { NodeMutatedEvent } from "@/shared/api/graphql/generated/graphql";
55
import { constructPath } from "@/shared/api/rest/fetch";
66
import { Link } from "@/shared/components/ui/link";

frontend/app/src/entities/graphql/ui/graphql-query-details-card.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { RELATIONSHIP_VIEW_BLACKLIST } from "@/config/constants";
22
import { AttributeType, ObjectAttributeValue } from "@/entities/nodes/getObjectItemDisplayValue";
33
import { getObjectDetailsUrl, getObjectDetailsUrl2 } from "@/entities/nodes/utils";
44
import { Permission } from "@/entities/permission/types";
5-
import { iNodeSchema } from "@/entities/schema/stores/schema.atom";
5+
import { NodeSchema } from "@/entities/schema/types";
66
import { CoreGraphQlQuery } from "@/shared/api/graphql/generated/graphql";
77
import { constructPath } from "@/shared/api/rest/fetch";
88
import { CopyToClipboard } from "@/shared/components/buttons/copy-to-clipboard";
@@ -17,7 +17,7 @@ import { Icon } from "@iconify-icon/react";
1717

1818
type GraphqlQueryDetailsCardProps = {
1919
data: CoreGraphQlQuery;
20-
schema: iNodeSchema;
20+
schema: NodeSchema;
2121
refetch: () => Promise<unknown>;
2222
permission: Permission;
2323
};

0 commit comments

Comments
 (0)