diff --git a/src/lib/server/git.ts b/src/lib/server/git.ts index e5456bb0..6395a6b4 100644 --- a/src/lib/server/git.ts +++ b/src/lib/server/git.ts @@ -43,7 +43,9 @@ export async function getRepoStatus(): Promise { clean: status.isClean(), ahead: status.ahead, behind: status.behind, - changes: status.files, + // Need to map changed files to a new object or we get a JSON serialize + // error + changes: status.files.map(f => ({ ...f })), }; } diff --git a/src/routes/admin/+page.svelte b/src/routes/admin/+page.svelte index b02ba196..ebdc403b 100644 --- a/src/routes/admin/+page.svelte +++ b/src/routes/admin/+page.svelte @@ -9,6 +9,17 @@ // Git setup let gitUrl = ''; + + async function submitSwitchToGit() { + await api().admin.git.init(gitUrl); + } + + // Git controls + let commitMessage = ''; + + async function gitCommit() { + await api().admin.git.commit(commitMessage); + } @@ -45,14 +56,46 @@ {/if}

+ + {#if data.repo.behind} + + {:else if data.repo.ahead} + + {/if} + + + {#if !data.repo.clean} + +

Changes

+ + + +
+ + +
+ {/if} + {:else}

Git is currently not in use

You can use a Git repository to back up your portfolio data. Enter the clone URL for an empty Git repository and it will be set up for you. -
- + +
{/if}