Welcome to mirror list, hosted at ThFree Co, Russian Federation.

add_request.vue « components « performance_bar « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: d48a5acb85c5f7ca88ce77b6eb376e3d799158dc (plain)
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
import { __ } from '~/locale';

<script>
export default {
  data() {
    return {
      inputEnabled: false,
      urlOrRequestId: '',
    };
  },
  methods: {
    toggleInput() {
      this.inputEnabled = !this.inputEnabled;
    },
    addRequest() {
      this.$emit('add-request', this.urlOrRequestId);
      this.clearForm();
    },
    clearForm() {
      this.urlOrRequestId = '';
      this.toggleInput();
    },
  },
};
</script>
<template>
  <div id="peek-view-add-request" class="view">
    <form class="form-inline" @submit.prevent>
      <button
        class="btn-blank btn-link bold gl-text-blue-300"
        type="button"
        :title="__(`Add request manually`)"
        @click="toggleInput"
      >
        +
      </button>
      <input
        v-if="inputEnabled"
        v-model="urlOrRequestId"
        type="text"
        :placeholder="__(`URL or request ID`)"
        class="form-control form-control-sm d-inline-block ml-1"
        @keyup.enter="addRequest"
        @keyup.esc="clearForm"
      />
    </form>
  </div>
</template>