-
-
Notifications
You must be signed in to change notification settings - Fork 575
Expand file tree
/
Copy pathConsoleCard.vue
More file actions
104 lines (91 loc) · 2.42 KB
/
ConsoleCard.vue
File metadata and controls
104 lines (91 loc) · 2.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<template>
<collapsable-card
:title="$t('app.general.title.console')"
icon="$console"
:help-tooltip="$t('app.console.tooltip.help')"
card-classes="d-flex flex-column"
content-classes="flex-grow-1 flow-shrink-0"
menu-breakpoint="none"
menu-icon="$cog"
:draggable="!fullscreen"
:collapsable="!fullscreen"
layout-path="dashboard.console-card"
@collapsed="handleCollapseChange"
>
<template #menu>
<app-btn
v-if="!fullscreen"
icon
@click="$filters.routeTo({ name: 'console' })"
>
<v-icon dense>
$fullScreen
</v-icon>
</app-btn>
</template>
<console-toolbar
:auto-scroll-paused="autoScrollPaused"
:flip-layout.sync="flipLayout"
:search.sync="search"
@clear="handleClear"
@scrollToLatest="consoleBrowserElement.scrollToLatest()"
/>
<console-browser
ref="consoleBrowser"
:items="items"
:search="search"
:fullscreen="fullscreen"
@update:auto-scroll-paused="autoScrollPaused = $event"
/>
</collapsable-card>
</template>
<script lang="ts">
import { Component, Vue, Prop, Watch, Ref } from 'vue-property-decorator'
import ConsoleBrowser from './ConsoleBrowser.vue'
import ConsoleToolbar from './ConsoleToolbar.vue'
import type { ConsoleEntry } from '@/store/console/types'
@Component({
components: {
ConsoleBrowser,
ConsoleToolbar
}
})
export default class ConsoleCard extends Vue {
@Prop({ type: Boolean })
readonly fullscreen?: boolean
@Ref('consoleBrowser')
readonly consoleBrowserElement!: ConsoleBrowser
search = ''
autoScrollPaused = false
get flipLayout (): boolean {
return this.$typedState.config.uiSettings.general.flipConsoleLayout
}
set flipLayout (value: boolean) {
this.$typedDispatch('config/saveByPath', {
path: 'uiSettings.general.flipConsoleLayout',
value,
server: true
})
}
get items (): ConsoleEntry[] {
return this.$typedGetters['console/getConsoleEntries']
}
get inLayout (): boolean {
return (this.$typedState.config.layoutMode)
}
@Watch('inLayout')
inLayoutChange (inLayout: boolean) {
if (!inLayout) {
this.consoleBrowserElement.scrollToLatest()
}
}
handleCollapseChange (collapsed: boolean) {
if (!collapsed) {
this.consoleBrowserElement.scrollToLatest()
}
}
handleClear () {
this.$typedDispatch('console/onClear')
}
}
</script>