MCPcopy Create free account
hub / github.com/outerbase/studio / DoltCommitLog

Function DoltCommitLog

src/extensions/dolt/dolt-sidebar.tsx:44–161  ·  view source on GitHub ↗
({
  commitList,
  refreshStatus,
}: {
  commitList: DoltCommitResultItem[];
  refreshStatus: () => void;
})

Source from the content-addressed store, hash-verified

42}
43
44function DoltCommitLog({
45 commitList,
46 refreshStatus,
47}: {
48 commitList: DoltCommitResultItem[];
49 refreshStatus: () => void;
50}) {
51 const { modal: createBranchModal, openModal: openCreateBranch } =
52 useDoltCreateBranchModal(refreshStatus);
53
54 const { databaseDriver } = useStudioContext();
55 const { showDialog: showCommonDialog } = useCommonDialog();
56
57 const onResetClicked = useCallback(
58 (commit: DoltCommitResultItem) => {
59 showCommonDialog({
60 title: "Soft Reset",
61 content: (
62 <div className="flex flex-col gap-2">
63 <p>Are you sure you want to reset to this commit?</p>
64 <div className="flex flex-col gap-1 rounded border p-4 text-sm shadow-sm">
65 <div className="font-semibold">{commit.message}</div>
66 <div className="font-mono">{commit.commit_hash}</div>
67 </div>
68 </div>
69 ),
70 destructive: true,
71 actions: [
72 {
73 text: "Reset",
74 onClick: async () => {
75 await databaseDriver.query(
76 `CALL DOLT_RESET(${databaseDriver.escapeValue(commit.commit_hash)});`
77 );
78 },
79 onComplete: () => {
80 refreshStatus();
81 },
82 },
83 ],
84 });
85 },
86 [refreshStatus, showCommonDialog, databaseDriver]
87 );
88
89 return (
90 <div className="w-full overflow-x-hidden overflow-y-auto">
91 {createBranchModal}
92
93 <div className="flex w-full flex-col py-4 pl-4">
94 {commitList.map((commit) => (
95 <div
96 key={commit.commit_hash}
97 className="fgap-1 relative ml-2 flex border-l-2 border-blue-500 p-2 pl-4"
98 >
99 <div className="bg-background absolute top-[10px] -left-[9px] h-4 w-4 rounded-full border-4 border-blue-500"></div>
100
101 <div className="flex-1 overflow-hidden">

Callers

nothing calls this directly

Calls 5

useStudioContextFunction · 0.90
useCommonDialogFunction · 0.90
useDoltCreateBranchModalFunction · 0.85
queryMethod · 0.65
escapeValueMethod · 0.45

Tested by

no test coverage detected