Skip to content

Commit

Permalink
feat: add developer tools and refresh buttons to console in developme…
Browse files Browse the repository at this point in the history
…nt mode
  • Loading branch information
Fabio286 committed Jan 23, 2025
1 parent 2b743a2 commit 592d7b3
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion src/renderer/components/DebugConsole.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,23 @@
<a class="tab-link" @click="selectedTab = 'debug'">{{ t('application.debugConsole') }}</a>
</li>
</ul>
<button class="btn btn-clear mr-1" @click="resizeConsole(0)" />
<div class="d-flex">
<div
v-if="isDevelopment"
class="c-hand mr-2"
@click="openDevTools()"
>
<BaseIcon icon-name="mdiBugPlayOutline" :size="22" />
</div>
<div
v-if="isDevelopment"
class="c-hand mr-2"
@click="reload()"
>
<BaseIcon icon-name="mdiRefresh" :size="22" />
</div>
<button class="btn btn-clear mr-1" @click="resizeConsole(0)" />
</div>
</div>
<div
v-show="selectedTab === 'query'"
Expand Down Expand Up @@ -71,6 +87,7 @@
</BaseContextMenu>
</template>
<script setup lang="ts">
import { getCurrentWindow } from '@electron/remote';
import * as moment from 'moment';
import { storeToRefs } from 'pinia';
import { highlight } from 'sql-highlight';
Expand Down Expand Up @@ -112,6 +129,8 @@ const isHover = ref(false);
const isContext = ref(false);
const contextContent: Ref<string> = ref(null);
const contextEvent: Ref<MouseEvent> = ref(null);
const w = ref(getCurrentWindow());
const isDevelopment = ref(process.env.NODE_ENV === 'development');
const resize = (e: MouseEvent) => {
const el = queryConsole.value;
Expand Down Expand Up @@ -142,6 +161,14 @@ const copyLog = () => {
isContext.value = false;
};
const openDevTools = () => {
w.value.webContents.openDevTools();
};
const reload = () => {
w.value.reload();
};
watch(workspaceQueryLogs, async () => {
if (!isHover.value) {
await nextTick();
Expand Down

0 comments on commit 592d7b3

Please sign in to comment.