From 5e9693eced8c2d3738f41f46d6b655e1931463ec Mon Sep 17 00:00:00 2001 From: SquiddyPoos Date: Mon, 18 Sep 2023 22:34:34 +0800 Subject: [PATCH 01/10] test plotly --- .github/workflows/docker.yml | 2 +- frontend/src/mixins/helpers.ts | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index c04e866..12da0f3 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -20,4 +20,4 @@ jobs: password: ${{ secrets.DOCKER_PASSWORD }} registry: registry.nush.app repository: e-notes - tags: latest + tags: beta diff --git a/frontend/src/mixins/helpers.ts b/frontend/src/mixins/helpers.ts index 5f1f114..6e0a434 100644 --- a/frontend/src/mixins/helpers.ts +++ b/frontend/src/mixins/helpers.ts @@ -120,15 +120,13 @@ export function equals(a: T[], b: T[]) { export function addPyScript() { if (!document.getElementById('pyscript')) { - const env = document.createElement('py-env'); - env.innerHTML = ` - - numpy - - matplotlib` + const env = document.createElement('py-config'); + env.innerHTML = 'packages = ["numpy", "matplotlib", "plotly"]' document.head.appendChild(env); const script = document.createElement('script'); script.id = 'pyscript'; script.defer = true - script.src = 'https://pyscript.net/alpha/pyscript.js'; + script.src = 'https://pyscript.net/latest/pyscript.js'; document.head.appendChild(script); const styles = document.createElement('style'); styles.innerHTML = ` From 8989cc15051ed4dbae3392f7ed950c0835892093 Mon Sep 17 00:00:00 2001 From: SquiddyPoos Date: Mon, 18 Sep 2023 22:35:19 +0800 Subject: [PATCH 02/10] fix workflow --- .github/workflows/docker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 12da0f3..3b7e01c 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -3,7 +3,7 @@ name: Node.js CI on: push: branches: - - master + - beta jobs: build: From 2867bf66b398aec77b2086a13d3b56b448165b7b Mon Sep 17 00:00:00 2001 From: SquiddyPoos Date: Mon, 18 Sep 2023 23:57:37 +0800 Subject: [PATCH 03/10] test script tag fix --- .../components/notebookViewer/BlockOutput.vue | 3 +- .../components/notebookViewer/HTMLOutput.vue | 38 +++++++++++++++++++ frontend/src/mixins/helpers.ts | 11 ++++-- 3 files changed, 47 insertions(+), 5 deletions(-) create mode 100644 frontend/src/components/notebookViewer/HTMLOutput.vue diff --git a/frontend/src/components/notebookViewer/BlockOutput.vue b/frontend/src/components/notebookViewer/BlockOutput.vue index b6d1530..e6ac565 100644 --- a/frontend/src/components/notebookViewer/BlockOutput.vue +++ b/frontend/src/components/notebookViewer/BlockOutput.vue @@ -21,7 +21,7 @@ Image Error -
+
+    
+ + + + + diff --git a/frontend/src/mixins/helpers.ts b/frontend/src/mixins/helpers.ts index 6e0a434..ecd6d34 100644 --- a/frontend/src/mixins/helpers.ts +++ b/frontend/src/mixins/helpers.ts @@ -120,17 +120,20 @@ export function equals(a: T[], b: T[]) { export function addPyScript() { if (!document.getElementById('pyscript')) { - const env = document.createElement('py-config'); - env.innerHTML = 'packages = ["numpy", "matplotlib", "plotly"]' + const env = document.createElement('py-env'); + env.innerHTML = ` + - numpy + - matplotlib + ` document.head.appendChild(env); const script = document.createElement('script'); script.id = 'pyscript'; script.defer = true - script.src = 'https://pyscript.net/latest/pyscript.js'; + script.src = 'https://pyscript.net/alpha/pyscript.js'; document.head.appendChild(script); const styles = document.createElement('style'); styles.innerHTML = ` - .v-application.theme--dark .editor-box .cm-gutters{ + .v-application.theme--dark .editor-box .cm-gutters { background-color: #999; color: #f5f5f5; } From 249fc00003b24f80eda78b94dc31627ab775a4ea Mon Sep 17 00:00:00 2001 From: SquiddyPoos Date: Tue, 19 Sep 2023 00:06:32 +0800 Subject: [PATCH 04/10] ? --- frontend/src/components/notebookViewer/HTMLOutput.vue | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/frontend/src/components/notebookViewer/HTMLOutput.vue b/frontend/src/components/notebookViewer/HTMLOutput.vue index 8aa7bef..3523081 100644 --- a/frontend/src/components/notebookViewer/HTMLOutput.vue +++ b/frontend/src/components/notebookViewer/HTMLOutput.vue @@ -11,8 +11,6 @@ export default class HTMLOutput extends Vue { @Prop(String) readonly html!: string; htmlDiv!: HTMLDivElement; - - recurseDescendants (node: Element) { for (var i = 0; i < node.children.length; i++) { var child = node.children[i]; @@ -28,7 +26,10 @@ export default class HTMLOutput extends Vue { mounted() { - this.recurseDescendants(this.htmlDiv); + console.log("running scripts"); + this.$nextTick(() => { + this.recurseDescendants(this.htmlDiv); + }); } } From 800c503158384f5dd230e3fc76ed304731de02ed Mon Sep 17 00:00:00 2001 From: SquiddyPoos Date: Tue, 19 Sep 2023 00:13:24 +0800 Subject: [PATCH 05/10] test --- frontend/src/components/notebookViewer/BlockOutput.vue | 4 ++-- frontend/src/components/notebookViewer/HTMLOutput.vue | 4 +--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/frontend/src/components/notebookViewer/BlockOutput.vue b/frontend/src/components/notebookViewer/BlockOutput.vue index e6ac565..ec6a68e 100644 --- a/frontend/src/components/notebookViewer/BlockOutput.vue +++ b/frontend/src/components/notebookViewer/BlockOutput.vue @@ -21,7 +21,7 @@ Image Error - +
 {
-        this.recurseDescendants(this.htmlDiv);
+        this.recurseDescendants(this.$refs.htmlDiv as Element);
     });
   }
 }

From 8ef06210a6805d04dd267538e9999375c04eb909 Mon Sep 17 00:00:00 2001
From: SquiddyPoos 
Date: Tue, 19 Sep 2023 07:25:13 +0800
Subject: [PATCH 06/10] fix

---
 .../components/notebookViewer/BlockOutput.vue    |  4 +++-
 .../src/components/notebookViewer/HTMLOutput.vue | 16 ++++++++++++----
 2 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/frontend/src/components/notebookViewer/BlockOutput.vue b/frontend/src/components/notebookViewer/BlockOutput.vue
index ec6a68e..4d1a030 100644
--- a/frontend/src/components/notebookViewer/BlockOutput.vue
+++ b/frontend/src/components/notebookViewer/BlockOutput.vue
@@ -45,7 +45,9 @@ import Convert from "ansi-to-html";
 import HTMLOutput from "@/components/notebookViewer/HTMLOutput.vue";
 
 const convert = new Convert();
-@Component
+@Component({
+  components: {HTMLOutput}
+})
 export default class BlockOutput extends Vue {
   name = "BlockOutput"
   @Prop(Object) readonly cell!: Cell;
diff --git a/frontend/src/components/notebookViewer/HTMLOutput.vue b/frontend/src/components/notebookViewer/HTMLOutput.vue
index 76b756f..f682e4c 100644
--- a/frontend/src/components/notebookViewer/HTMLOutput.vue
+++ b/frontend/src/components/notebookViewer/HTMLOutput.vue
@@ -10,15 +10,23 @@ export default class HTMLOutput extends Vue {
   name = "HTMLOutput"
   @Prop(String) readonly html!: string;
 
+  createScript(node: HTMLScriptElement) {
+    var script = document.createElement("script");
+    script.text = node.innerHTML;
+    
+    for (var i=0; i < node.attributes.length; i++) {
+      var attr = node.attributes[i];
+      script.setAttribute(attr.name, attr.value);
+    }
+    return script;
+  }
+
   recurseDescendants (node: Element) {
     for (var i = 0; i < node.children.length; i++) {
       var child = node.children[i];
       this.recurseDescendants(child);
       if (child.tagName === 'SCRIPT') {
-        console.log(child.innerHTML);
-        eval?.(child.innerHTML);
-        child.remove();
-        i--;
+        node.replaceChild(this.createScript(child as HTMLScriptElement), child);
       }
     }
   }

From bdf0ad80c0568b4402403ab01bea49fea40662a1 Mon Sep 17 00:00:00 2001
From: SquiddyPoos 
Date: Tue, 19 Sep 2023 07:37:50 +0800
Subject: [PATCH 07/10] pyscript changes

---
 frontend/src/mixins/helpers.ts   | 8 +++++---
 frontend/src/pages/Index/App.vue | 4 ++++
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/frontend/src/mixins/helpers.ts b/frontend/src/mixins/helpers.ts
index ecd6d34..fd77879 100644
--- a/frontend/src/mixins/helpers.ts
+++ b/frontend/src/mixins/helpers.ts
@@ -120,10 +120,12 @@ export function equals(a: T[], b: T[]) {
 
 export function addPyScript() {
     if (!document.getElementById('pyscript')) {
-        const env = document.createElement('py-env');
+        const env = document.createElement('py-config');
         env.innerHTML = `
-           - numpy
-           - matplotlib
+          packages = ["numpy", "matplotlib"]
+          
+          [splashscreen]
+            enabled = false
         `
         document.head.appendChild(env);
         const script = document.createElement('script');
diff --git a/frontend/src/pages/Index/App.vue b/frontend/src/pages/Index/App.vue
index bedfb5e..11054fe 100644
--- a/frontend/src/pages/Index/App.vue
+++ b/frontend/src/pages/Index/App.vue
@@ -321,4 +321,8 @@ body.rb.rb-lock-off {
   }
 }
 
+py-loader py-terminal {
+  display: none;
+}
+
 

From a5374456774f16d8ca2ce85dda2b117ba1636aa6 Mon Sep 17 00:00:00 2001
From: SquiddyPoos 
Date: Tue, 19 Sep 2023 08:17:20 +0800
Subject: [PATCH 08/10] fix

---
 frontend/src/mixins/helpers.ts   | 4 ++--
 frontend/src/pages/Index/App.vue | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/frontend/src/mixins/helpers.ts b/frontend/src/mixins/helpers.ts
index fd77879..db812b1 100644
--- a/frontend/src/mixins/helpers.ts
+++ b/frontend/src/mixins/helpers.ts
@@ -123,7 +123,7 @@ export function addPyScript() {
         const env = document.createElement('py-config');
         env.innerHTML = `
           packages = ["numpy", "matplotlib"]
-          
+
           [splashscreen]
             enabled = false
         `
@@ -131,7 +131,7 @@ export function addPyScript() {
         const script = document.createElement('script');
         script.id = 'pyscript';
         script.defer = true
-        script.src = 'https://pyscript.net/alpha/pyscript.js';
+        script.src = 'https://pyscript.net/latest/pyscript.js';
         document.head.appendChild(script);
         const styles = document.createElement('style');
         styles.innerHTML = `
diff --git a/frontend/src/pages/Index/App.vue b/frontend/src/pages/Index/App.vue
index 11054fe..6a77c36 100644
--- a/frontend/src/pages/Index/App.vue
+++ b/frontend/src/pages/Index/App.vue
@@ -321,7 +321,7 @@ body.rb.rb-lock-off {
   }
 }
 
-py-loader py-terminal {
+py-loader, py-terminal {
   display: none;
 }
 

From d602b07ed5481be05fd874ab2d8c862a863be337 Mon Sep 17 00:00:00 2001
From: SquiddyPoos 
Date: Tue, 19 Sep 2023 08:48:43 +0800
Subject: [PATCH 09/10] add style

---
 frontend/src/mixins/helpers.ts | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/frontend/src/mixins/helpers.ts b/frontend/src/mixins/helpers.ts
index db812b1..798ffca 100644
--- a/frontend/src/mixins/helpers.ts
+++ b/frontend/src/mixins/helpers.ts
@@ -120,18 +120,16 @@ export function equals(a: T[], b: T[]) {
 
 export function addPyScript() {
     if (!document.getElementById('pyscript')) {
-        const env = document.createElement('py-config');
+        const env = document.createElement('py-env');
         env.innerHTML = `
-          packages = ["numpy", "matplotlib"]
-
-          [splashscreen]
-            enabled = false
+          - numpy
+          - matplotlib
         `
         document.head.appendChild(env);
         const script = document.createElement('script');
         script.id = 'pyscript';
         script.defer = true
-        script.src = 'https://pyscript.net/latest/pyscript.js';
+        script.src = 'https://pyscript.net/alpha/pyscript.js';
         document.head.appendChild(script);
         const styles = document.createElement('style');
         styles.innerHTML = `
@@ -140,6 +138,7 @@ export function addPyScript() {
             color: #f5f5f5;
         }
         `
+        document.head.appendChild(styles);
     }
 }
 

From c31a548667217aefc6d1edb1dd0ef23ee50b5a41 Mon Sep 17 00:00:00 2001
From: SquiddyPoos 
Date: Tue, 19 Sep 2023 09:20:00 +0800
Subject: [PATCH 10/10] fix workflow for merge

---
 .github/workflows/beta.yml   | 23 +++++++++++++++++++++++
 .github/workflows/docker.yml |  6 +++---
 2 files changed, 26 insertions(+), 3 deletions(-)
 create mode 100644 .github/workflows/beta.yml

diff --git a/.github/workflows/beta.yml b/.github/workflows/beta.yml
new file mode 100644
index 0000000..19b8646
--- /dev/null
+++ b/.github/workflows/beta.yml
@@ -0,0 +1,23 @@
+name: Push to Registry (Beta Build)
+
+on:
+  push:
+    branches:
+      - beta
+
+jobs:
+  build:
+
+    runs-on: ubuntu-latest
+
+
+    steps:
+      - uses: actions/checkout@v2
+      - name: Push image to AppVenture registry
+        uses: docker/build-push-action@v1
+        with:
+          username: ${{ secrets.DOCKER_USERNAME }}
+          password: ${{ secrets.DOCKER_PASSWORD }}
+          registry: registry.nush.app
+          repository: e-notes
+          tags: beta
diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml
index 3b7e01c..03a9139 100644
--- a/.github/workflows/docker.yml
+++ b/.github/workflows/docker.yml
@@ -1,9 +1,9 @@
-name: Node.js CI
+name: Push to Registry
 
 on:
   push:
     branches:
-      - beta
+      - master
 
 jobs:
   build:
@@ -20,4 +20,4 @@ jobs:
           password: ${{ secrets.DOCKER_PASSWORD }}
           registry: registry.nush.app
           repository: e-notes
-          tags: beta
+          tags: latest