-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Expand file tree
/
Copy pathindex.vue
More file actions
77 lines (66 loc) · 1.83 KB
/
index.vue
File metadata and controls
77 lines (66 loc) · 1.83 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
<template>
<DrawerPro
v-model="open"
:header="resource"
@close="handleClose"
:size="globalStore.isFullScreen ? 'full' : 'large'"
:resource="resource"
>
<template #extra v-if="!mobile">
<el-tooltip :content="loadTooltip()" placement="top">
<el-button @click="toggleFullscreen" class="fullScreen" icon="FullScreen" plain></el-button>
</el-tooltip>
</template>
<template #content>
<ContainerLog :compose="compose" />
</template>
</DrawerPro>
</template>
<script lang="ts" setup>
import i18n from '@/lang';
import { computed, onBeforeUnmount, ref, watch } from 'vue';
import { GlobalStore } from '@/store';
import screenfull from 'screenfull';
import ContainerLog from '@/components/container-log/index.vue';
const open = ref(false);
const resource = ref('');
const globalStore = GlobalStore();
const logVisible = ref(false);
const compose = ref('');
interface DialogProps {
compose: string;
resource: string;
}
const mobile = computed(() => {
return globalStore.isMobile();
});
const handleClose = () => {
open.value = false;
globalStore.isFullScreen = false;
};
function toggleFullscreen() {
globalStore.isFullScreen = !globalStore.isFullScreen;
}
const loadTooltip = () => {
return i18n.global.t('commons.button.' + (globalStore.isFullScreen ? 'quitFullscreen' : 'fullscreen'));
};
watch(logVisible, (val) => {
if (screenfull.isEnabled && !val && !mobile.value) screenfull.exit();
});
const acceptParams = (props: DialogProps): void => {
compose.value = props.compose;
resource.value = props.resource;
open.value = true;
};
onBeforeUnmount(() => {
handleClose();
});
defineExpose({
acceptParams,
});
</script>
<style scoped lang="scss">
.fullScreen {
border: none;
}
</style>