Log display pauses on hover
This commit is contained in:
parent
37a28af04a
commit
b8bf8fbc18
1 changed files with 54 additions and 3 deletions
|
|
@ -1,4 +1,9 @@
|
||||||
<template>
|
<template>
|
||||||
|
<div
|
||||||
|
class="log-wrapper"
|
||||||
|
@mouseenter="onMouseEnter"
|
||||||
|
@mouseleave="onMouseLeave"
|
||||||
|
>
|
||||||
<div
|
<div
|
||||||
ref="logContainer"
|
ref="logContainer"
|
||||||
class="log-container uk-margin-left uk-margin-right uk-margin"
|
class="log-container uk-margin-left uk-margin-right uk-margin"
|
||||||
|
|
@ -16,6 +21,12 @@
|
||||||
</div>
|
</div>
|
||||||
<div v-if="taskStatus == 'completed'" class="uk-alert uk-alert-success">
|
<div v-if="taskStatus == 'completed'" class="uk-alert uk-alert-success">
|
||||||
The task completed successfully.
|
The task completed successfully.
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Paused banner outside scroll container, positioned relative to wrapper -->
|
||||||
|
<div v-if="userIsHovering" class="paused-banner">
|
||||||
|
Auto-scroll paused
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -35,6 +46,12 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
userIsHovering: false,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
watch: {
|
watch: {
|
||||||
log: function() {
|
log: function() {
|
||||||
this.scrollToBottom();
|
this.scrollToBottom();
|
||||||
|
|
@ -45,9 +62,18 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
|
onMouseEnter() {
|
||||||
|
this.userIsHovering = true;
|
||||||
|
},
|
||||||
|
onMouseLeave() {
|
||||||
|
this.userIsHovering = false;
|
||||||
|
},
|
||||||
|
|
||||||
scrollToBottom() {
|
scrollToBottom() {
|
||||||
this.$nextTick(function() {
|
this.$nextTick(() => {
|
||||||
let viewer = this.$refs.logContainer;
|
if (this.userIsHovering) return;
|
||||||
|
|
||||||
|
const viewer = this.$refs.logContainer;
|
||||||
viewer.scrollTop = viewer.scrollHeight;
|
viewer.scrollTop = viewer.scrollHeight;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -56,13 +82,38 @@ export default {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.log-container {
|
.log-wrapper {
|
||||||
position: relative;
|
position: relative;
|
||||||
|
height: 200px;
|
||||||
|
overflow: hidden;
|
||||||
|
margin-bottom: 1em;
|
||||||
|
margin-top: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.log-container {
|
||||||
|
height: 100%;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
overflow-x: auto;
|
overflow-x: auto;
|
||||||
background-color: white;
|
background-color: white;
|
||||||
color: black;
|
color: black;
|
||||||
padding: 0.5em;
|
padding: 0.5em;
|
||||||
border: 1px solid black;
|
border: 1px solid black;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Floating banner fixed at top-right of wrapper, not affected by scroll */
|
||||||
|
.paused-banner {
|
||||||
|
position: absolute;
|
||||||
|
top: 8px;
|
||||||
|
right: 40px;
|
||||||
|
color: black;
|
||||||
|
font-weight: bold;
|
||||||
|
padding: 4px;
|
||||||
|
border-radius: 4px;
|
||||||
|
z-index: 10;
|
||||||
|
font-size: 0.85em;
|
||||||
|
pointer-events: none;
|
||||||
|
box-shadow: 0 0 4px rgba(0, 0, 0, 0.2);
|
||||||
|
background-color: white;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue