Skip to content

Commit ac08e0f

Browse files
committed
add button to scan git repo for new versions
1 parent 2973c46 commit ac08e0f

File tree

2 files changed

+27
-12
lines changed

2 files changed

+27
-12
lines changed

src/packages/frontend/frame-editors/time-travel-editor/actions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ export class TimeTravelActions extends CodeEditorActions<TimeTravelState> {
462462
});
463463
};
464464

465-
private updateGitVersions = async () => {
465+
updateGitVersions = async () => {
466466
// versions is an ordered list of Date objects, one for each commit that involves this file.
467467
try {
468468
const { stdout } = await this.gitCommand([

src/packages/frontend/frame-editors/time-travel-editor/time-travel.tsx

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
// Time travel editor react component
77

88
import { useState } from "react";
9-
import { Checkbox, Tooltip } from "antd";
9+
import { Button, Checkbox, Tooltip } from "antd";
1010
import { Map } from "immutable";
1111
import { redux } from "../../app-framework";
1212
import { Loading } from "../../components";
@@ -327,16 +327,31 @@ export function TimeTravel(props: Props) {
327327
</Tooltip>
328328
)}
329329
{git && (
330-
<Tooltip title="Show Git history instead of CoCalc edit history">
331-
<Checkbox
332-
defaultChecked={gitMode}
333-
onChange={(e) =>
334-
props.actions.setGitMode(props.id, e.target.checked)
335-
}
336-
>
337-
Git
338-
</Checkbox>
339-
</Tooltip>
330+
<>
331+
<Tooltip title="Show Git history instead of CoCalc edit history">
332+
<Checkbox
333+
defaultChecked={gitMode}
334+
onChange={(e) =>
335+
props.actions.setGitMode(props.id, e.target.checked)
336+
}
337+
>
338+
Git
339+
</Checkbox>
340+
</Tooltip>
341+
{gitMode && (
342+
<Tooltip title="Scan local Git repository for new revisions to this file">
343+
<Button
344+
size="small"
345+
style={{ marginRight: "5px" }}
346+
onClick={() => {
347+
props.actions.updateGitVersions();
348+
}}
349+
>
350+
Refresh
351+
</Button>
352+
</Tooltip>
353+
)}
354+
</>
340355
)}
341356
{renderNavigationButtons()}
342357
<div style={{ display: "inline-flex", margin: "0 5px" }}>

0 commit comments

Comments
 (0)