All files / app/assets/javascripts/logs/components log_control_buttons.vue

100% Statements 6/6
100% Branches 2/2
100% Functions 5/5
100% Lines 6/6

Press n or j to go to the next uncovered block, b, p or k for the previous block.

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  2x                                           5x             1x     1x     1x           23x                                                                                                          
<script>
import { GlButton, GlTooltipDirective } from '@gitlab/ui';
 
export default {
  components: {
    GlButton,
  },
  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"
    >
      <gl-button
        id="scroll-to-top"
        class="js-scroll-to-top gl-mr-2 btn-blank"
        :aria-label="__('Scroll to top')"
        :disabled="scrollUpButtonDisabled"
        icon="scroll_up"
        category="primary"
        variant="default"
        @click="handleScrollUp()"
      />
    </div>
    <div
      v-if="scrollDownAvailable"
      v-gl-tooltip
      :disabled="scrollUpButtonDisabled"
      class="controllers-buttons"
      :title="__('Scroll to bottom')"
      aria-labelledby="scroll-to-bottom"
    >
      <gl-button
        id="scroll-to-bottom"
        class="js-scroll-to-bottom gl-mr-2 btn-blank"
        :aria-label="__('Scroll to bottom')"
        :v-if="scrollDownAvailable"
        :disabled="scrollDownButtonDisabled"
        icon="scroll_down"
        category="primary"
        variant="default"
        @click="handleScrollDown()"
      />
    </div>
    <gl-button
      id="refresh-log"
      v-gl-tooltip
      class="js-refresh-log"
      :title="__('Refresh')"
      :aria-label="__('Refresh')"
      icon="retry"
      category="primary"
      variant="default"
      @click="handleRefreshClick"
    />
  </div>
</template>