debian-mirror-gitlab/app/assets/javascripts/logs/components/log_control_buttons.vue

96 lines
2.1 KiB
Vue
Raw Normal View History

2020-04-08 14:13:33 +05:30
<script>
2020-07-28 23:09:34 +05:30
import { GlButton, GlTooltipDirective } from '@gitlab/ui';
2020-04-08 14:13:33 +05:30
export default {
components: {
2020-07-28 23:09:34 +05:30
GlButton,
2020-04-08 14:13:33 +05:30
},
directives: {
GlTooltip: GlTooltipDirective,
},
props: {
scrollUpButtonDisabled: {
type: Boolean,
required: false,
default: false,
},
scrollDownButtonDisabled: {
type: Boolean,
required: false,
default: false,
},
},
data() {
return {
scrollUpAvailable: Boolean(this.$listeners.scrollUp),
scrollDownAvailable: Boolean(this.$listeners.scrollDown),
};
},
methods: {
handleRefreshClick() {
this.$emit('refresh');
},
handleScrollUp() {
this.$emit('scrollUp');
},
handleScrollDown() {
this.$emit('scrollDown');
},
},
};
</script>
<template>
<div>
<div
v-if="scrollUpAvailable"
v-gl-tooltip
class="controllers-buttons"
:title="__('Scroll to top')"
aria-labelledby="scroll-to-top"
>
2020-07-28 23:09:34 +05:30
<gl-button
2020-04-08 14:13:33 +05:30
id="scroll-to-top"
2020-07-28 23:09:34 +05:30
class="js-scroll-to-top gl-mr-2 btn-blank"
2020-04-08 14:13:33 +05:30
:aria-label="__('Scroll to top')"
:disabled="scrollUpButtonDisabled"
2020-07-28 23:09:34 +05:30
icon="scroll_up"
category="primary"
variant="default"
2020-04-08 14:13:33 +05:30
@click="handleScrollUp()"
2020-07-28 23:09:34 +05:30
/>
2020-04-08 14:13:33 +05:30
</div>
<div
v-if="scrollDownAvailable"
v-gl-tooltip
:disabled="scrollUpButtonDisabled"
class="controllers-buttons"
:title="__('Scroll to bottom')"
aria-labelledby="scroll-to-bottom"
>
2020-07-28 23:09:34 +05:30
<gl-button
2020-04-08 14:13:33 +05:30
id="scroll-to-bottom"
2020-07-28 23:09:34 +05:30
class="js-scroll-to-bottom gl-mr-2 btn-blank"
2020-04-08 14:13:33 +05:30
:aria-label="__('Scroll to bottom')"
:v-if="scrollDownAvailable"
:disabled="scrollDownButtonDisabled"
2020-07-28 23:09:34 +05:30
icon="scroll_down"
category="primary"
variant="default"
2020-04-08 14:13:33 +05:30
@click="handleScrollDown()"
2020-07-28 23:09:34 +05:30
/>
2020-04-08 14:13:33 +05:30
</div>
2020-07-28 23:09:34 +05:30
<gl-button
2020-04-08 14:13:33 +05:30
id="refresh-log"
v-gl-tooltip
2020-07-28 23:09:34 +05:30
class="js-refresh-log"
2020-04-08 14:13:33 +05:30
:title="__('Refresh')"
:aria-label="__('Refresh')"
2020-07-28 23:09:34 +05:30
icon="retry"
category="primary"
variant="default"
2020-04-08 14:13:33 +05:30
@click="handleRefreshClick"
2020-07-28 23:09:34 +05:30
/>
2020-04-08 14:13:33 +05:30
</div>
</template>