Browse Source

optimized terminal

0xJacky 3 years ago
parent
commit
3c56bf19ca
2 changed files with 9 additions and 6 deletions
  1. 8 5
      frontend/src/views/pty/Terminal.vue
  2. 1 1
      frontend/version.json

+ 8 - 5
frontend/src/views/pty/Terminal.vue

@@ -2,7 +2,6 @@
     <a-card :title="$gettext('Terminal')">
     <a-card :title="$gettext('Terminal')">
         <div class="console" id="terminal"></div>
         <div class="console" id="terminal"></div>
     </a-card>
     </a-card>
-
 </template>
 </template>
 
 
 <script>
 <script>
@@ -34,6 +33,7 @@ export default {
         window.removeEventListener('resize', this.fit)
         window.removeEventListener('resize', this.fit)
         clearInterval(this.ping)
         clearInterval(this.ping)
         this.ping = null
         this.ping = null
+        this.term.close()
         this.websocket.close()
         this.websocket.close()
     },
     },
     methods: {
     methods: {
@@ -46,13 +46,16 @@ export default {
                 convertEol: true,
                 convertEol: true,
                 fontSize: 14,
                 fontSize: 14,
                 cursorStyle: 'block',
                 cursorStyle: 'block',
-                scrollback: 30,
+                scrollback: 1000,
+                theme: {
+                    background: 'rgba(3,14,32,0.7)'
+                },
             })
             })
             const fitAddon = new FitAddon()
             const fitAddon = new FitAddon()
             term.loadAddon(fitAddon)
             term.loadAddon(fitAddon)
             this.fitAddon = fitAddon
             this.fitAddon = fitAddon
             term.open(document.getElementById('terminal'))
             term.open(document.getElementById('terminal'))
-            setTimeout(()=>{
+            setTimeout(() => {
                 fitAddon.fit()
                 fitAddon.fit()
             }, 60)
             }, 60)
             window.addEventListener('resize', this.fit)
             window.addEventListener('resize', this.fit)
@@ -71,7 +74,7 @@ export default {
                 that.sendMessage({Type: 1, Data: data})
                 that.sendMessage({Type: 1, Data: data})
             })
             })
             term.onResize(data => {
             term.onResize(data => {
-                that.sendMessage({Type:2, Data:{Cols:data.cols, Rows: data.rows}})
+                that.sendMessage({Type: 2, Data: {Cols: data.cols, Rows: data.rows}})
             })
             })
             this.term = term
             this.term = term
         },
         },
@@ -93,6 +96,6 @@ export default {
 
 
 <style lang="less" scoped>
 <style lang="less" scoped>
 .console {
 .console {
-    min-height: 800px;
+    min-height: calc(100vh - 300px);
 }
 }
 </style>
 </style>

+ 1 - 1
frontend/version.json

@@ -1 +1 @@
-{"version":"1.4.0","build_id":4,"total_build":60}
+{"version":"1.4.0","build_id":5,"total_build":61}