Skip to content

Commit eeded6f

Browse files
committed
Save to caterva2
1 parent db7eec4 commit eeded6f

5 files changed

Lines changed: 51 additions & 4 deletions

File tree

.github/workflows/caterva2.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Caterva2
2+
3+
on:
4+
push:
5+
branches:
6+
- caterva2
7+
8+
env:
9+
CACHE_EPOCH: 4
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
env:
15+
BUILDING_IN_CI: 1
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
20+
- name: Build dist
21+
uses: ./.github/actions/build-dist
22+
23+
- name: Upload (dist)
24+
uses: actions/upload-artifact@v4
25+
with:
26+
name: caterva2 dist
27+
path: ./dist

.github/workflows/check-release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
name: Check Release
22
on:
33
push:
4-
branches:
5-
- '*'
4+
branches-ignore:
5+
- caterva2
66
pull_request:
77
branches:
88
- '*'

.github/workflows/ui-tests.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
name: UI Tests
22

3-
on: [push, pull_request]
3+
on:
4+
push:
5+
branches-ignore:
6+
- caterva2
7+
pull_request:
8+
branches:
9+
- '*'
410

511
env:
612
CACHE_EPOCH: 0

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,3 +167,6 @@ ui-tests/.pnp.*
167167
# may be generated by jupyter lite build when in dev mode
168168
app/api
169169
app/static
170+
171+
172+
.*.swp

packages/contents/src/contents.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,7 @@ export class Contents implements IContents {
398398
*/
399399
async save(path: string, options: Partial<IModel> = {}): Promise<IModel | null> {
400400
path = decodeURIComponent(path);
401+
//this.c2upload(path, options.content);
401402

402403
// process the file if coming from an upload
403404
const ext = PathExt.extname(options.name ?? '');
@@ -505,10 +506,20 @@ export class Contents implements IContents {
505506
item = { ...item, size: 0 };
506507
}
507508

508-
await (await this.storage).setItem(path, item);
509+
//await (await this.storage).setItem(path, item);
510+
this.c2upload(path, item.content);
509511
return item;
510512
}
511513

514+
async c2upload(path: string, content: object) {
515+
const filename = path.split('/').pop();
516+
const jsonstr = JSON.stringify(content);
517+
const blob = new Blob([jsonstr]);
518+
const formData = new FormData();
519+
formData.append('file', blob, filename);
520+
fetch(`../../../api/upload/${path}`, { method: 'POST', body: formData });
521+
}
522+
512523
/**
513524
* Delete a file from browser storage.
514525
*

0 commit comments

Comments
 (0)