Skip to content

Commit 592d7b3

Browse files
committed
feat: add developer tools and refresh buttons to console in development mode
1 parent 2b743a2 commit 592d7b3

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

src/renderer/components/DebugConsole.vue

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,23 @@
2121
<a class="tab-link" @click="selectedTab = 'debug'">{{ t('application.debugConsole') }}</a>
2222
</li>
2323
</ul>
24-
<button class="btn btn-clear mr-1" @click="resizeConsole(0)" />
24+
<div class="d-flex">
25+
<div
26+
v-if="isDevelopment"
27+
class="c-hand mr-2"
28+
@click="openDevTools()"
29+
>
30+
<BaseIcon icon-name="mdiBugPlayOutline" :size="22" />
31+
</div>
32+
<div
33+
v-if="isDevelopment"
34+
class="c-hand mr-2"
35+
@click="reload()"
36+
>
37+
<BaseIcon icon-name="mdiRefresh" :size="22" />
38+
</div>
39+
<button class="btn btn-clear mr-1" @click="resizeConsole(0)" />
40+
</div>
2541
</div>
2642
<div
2743
v-show="selectedTab === 'query'"
@@ -71,6 +87,7 @@
7187
</BaseContextMenu>
7288
</template>
7389
<script setup lang="ts">
90+
import { getCurrentWindow } from '@electron/remote';
7491
import * as moment from 'moment';
7592
import { storeToRefs } from 'pinia';
7693
import { highlight } from 'sql-highlight';
@@ -112,6 +129,8 @@ const isHover = ref(false);
112129
const isContext = ref(false);
113130
const contextContent: Ref<string> = ref(null);
114131
const contextEvent: Ref<MouseEvent> = ref(null);
132+
const w = ref(getCurrentWindow());
133+
const isDevelopment = ref(process.env.NODE_ENV === 'development');
115134
116135
const resize = (e: MouseEvent) => {
117136
const el = queryConsole.value;
@@ -142,6 +161,14 @@ const copyLog = () => {
142161
isContext.value = false;
143162
};
144163
164+
const openDevTools = () => {
165+
w.value.webContents.openDevTools();
166+
};
167+
168+
const reload = () => {
169+
w.value.reload();
170+
};
171+
145172
watch(workspaceQueryLogs, async () => {
146173
if (!isHover.value) {
147174
await nextTick();

0 commit comments

Comments
 (0)