mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 23:13:02 +01:00
Add onPushToCloud/onPullFromCloud handlers
cgen-920986f302d34b99aa55407d3edb1c51
This commit is contained in:
parent
26d24c4dad
commit
c3b3d72037
1 changed files with 23 additions and 0 deletions
|
|
@ -389,6 +389,29 @@ export function SwitchPage() {
|
||||||
setIssues(await listIssues(activeRepo.id));
|
setIssues(await listIssues(activeRepo.id));
|
||||||
setSelectedIssueId(undefined);
|
setSelectedIssueId(undefined);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function onPushToCloud() {
|
||||||
|
if (!activeRepo) return;
|
||||||
|
try {
|
||||||
|
const { pushRepoToSupabase } = await import("../../switch/sync");
|
||||||
|
await pushRepoToSupabase(activeRepo.id);
|
||||||
|
alert("Pushed to Supabase storage.");
|
||||||
|
} catch (e:any) {
|
||||||
|
alert("Cloud push failed: " + (e?.message || e));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
async function onPullFromCloud() {
|
||||||
|
if (!activeRepo) return;
|
||||||
|
try {
|
||||||
|
const { pullRepoFromSupabase } = await import("../../switch/sync");
|
||||||
|
const bundle = await pullRepoFromSupabase(activeRepo.id);
|
||||||
|
if (!bundle) { alert("No bundle found."); return; }
|
||||||
|
// For now, just show summary; full import/merge logic can be added as next step
|
||||||
|
alert(`Fetched bundle exportedAt=${new Date(bundle.exportedAt).toLocaleString()}\nbranches=${bundle.branches.length}, commits=${bundle.commits.length}, issues=${bundle.issues.length}`);
|
||||||
|
} catch (e:any) {
|
||||||
|
alert("Cloud pull failed: " + (e?.message || e));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getFileByPath(dir: FileSystemDirectoryHandle, path: string): Promise<File | undefined> {
|
async function getFileByPath(dir: FileSystemDirectoryHandle, path: string): Promise<File | undefined> {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue