Skip to content

Commit

Permalink
update console components
Browse files Browse the repository at this point in the history
  • Loading branch information
et-nik committed May 25, 2024
1 parent 1149df1 commit 12d0bde
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
15 changes: 13 additions & 2 deletions resources/assets/js/components/rcon/RconConsole.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,20 @@
<div class="coding inverse-toggle px-5 pt-4 shadow-lg text-stone-100 text-sm font-mono subpixel-antialiased
bg-stone-800 pb-6 pt-4 rounded-lg leading-normal overflow-hidden">
<div ref="consoleRef" class="whitespace-pre-wrap mt-4 flex h-[40vh] overflow-y-scroll overscroll-contain">
{{ output }}
<div v-if="loading" class="flex w-full items-center justify-center">
<Loading></Loading>
</div>
<div v-else>
{{ output }}
</div>
</div>
</div>

<div class="grid grid-cols-12 gap-4 mt-2">
<NInput
v-model:value="inputText"
v-on:keyup.enter="sendCommand"
:disabled="loading"
class="col-span-11"
type="text"
placeholder=""
Expand All @@ -31,25 +37,30 @@
} from "naive-ui";
import GButton from "../GButton.vue";
import {errorNotification} from "../../parts/dialogs";
import Loading from "../Loading.vue";
export default {
name: "RconConsole",
components: {GButton},
components: {Loading, GButton},
props: {
serverId: Number
},
data: function () {
return {
inputText: null,
loading: false,
};
},
methods: {
async sendCommand() {
this.loading = true;
await this.$store.dispatch('rconConsole/sendCommand', this.inputText).then(() => {
this.inputText = '';
}).catch((error) => {
errorNotification(error);
console.log(error);
}).finally(() => {
this.loading = false;
});
},
},
Expand Down
2 changes: 1 addition & 1 deletion resources/assets/js/views/servertabs/ServerConsole.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
v-model="inputText"
type="text"
ref="inputRef"
class="terminal-input m-0 p-0 inline w-full"
class="terminal-input inline md:w-[40vw] lg:w-[50vw]"
:placeholder="trans('servers.enter_command') +' ...'"
>
</div>
Expand Down

0 comments on commit 12d0bde

Please sign in to comment.