File tree Expand file tree Collapse file tree 2 files changed +27
-1
lines changed
resources/assets/scripts/components/server/subpages Expand file tree Collapse file tree 2 files changed +27
-1
lines changed Original file line number Diff line number Diff line change 1313 ref =" command"
1414 v-model =" command"
1515 v-on:keyup.enter =" sendCommand"
16+ v-on:keydown =" handleArrowKey"
1617 >
1718 </div >
1819 </div >
5354 }
5455 }),
5556 command: ' ' ,
57+ commandHistory: [],
58+ commandHistoryIndex: - 1 ,
5659 };
5760 },
5861
5962 methods: {
6063 sendCommand : function () {
64+ this .commandHistory .unshift (this .command );
6165 this .$parent .$emit (' send-command' , this .command );
6266 this .command = ' ' ;
67+ },
68+
69+ /**
70+ * Handle a user pressing up/down arrows when in the command field to scroll through thier
71+ * command history for this server.
72+ *
73+ * @param {KeyboardEvent} e
74+ */
75+ handleArrowKey : function (e ) {
76+ if ([' ArrowUp' , ' ArrowDown' ].indexOf (e .key ) < 0 || e .key === ' ArrowDown' && this .commandHistoryIndex < 0 ) {
77+ return ;
78+ }
79+
80+ e .preventDefault ();
81+ e .stopPropagation ();
82+
83+ if (e .key === ' ArrowUp' && (this .commandHistoryIndex + 1 > (this .commandHistory .length - 1 ))) {
84+ return ;
85+ }
86+
87+ this .commandHistoryIndex += (e .key === ' ArrowUp' ) ? 1 : - 1 ;
88+ this .command = this .commandHistoryIndex < 0 ? ' ' : this .commandHistory [this .commandHistoryIndex ];
6389 }
6490 }
6591 };
Original file line number Diff line number Diff line change @@ -68,7 +68,7 @@ const productionPlugins = [
6868
6969module . exports = {
7070 mode : process . env . NODE_ENV ,
71- devtool : process . env . NODE_ENV === 'production' ? false : 'eval -source-map' ,
71+ devtool : process . env . NODE_ENV === 'production' ? false : 'inline -source-map' ,
7272 performance : {
7373 hints : false ,
7474 } ,
You can’t perform that action at this time.
0 commit comments