2019-10-25 00:06:14 +00:00
|
|
|
<script>
|
2022-05-31 15:09:02 +00:00
|
|
|
import { GlForm, GlFormInput, GlButton } from '@gitlab/ui';
|
|
|
|
|
2019-10-25 00:06:14 +00:00
|
|
|
export default {
|
2022-05-31 15:09:02 +00:00
|
|
|
components: {
|
|
|
|
GlForm,
|
|
|
|
GlButton,
|
|
|
|
GlFormInput,
|
|
|
|
},
|
2019-10-25 00:06:14 +00:00
|
|
|
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>
|
2022-05-31 15:09:02 +00:00
|
|
|
<div id="peek-view-add-request" class="view gl-display-flex">
|
|
|
|
<gl-form class="gl-display-flex gl-align-items-center" @submit.prevent>
|
|
|
|
<gl-button
|
|
|
|
class="gl-text-blue-300! gl-mr-2"
|
|
|
|
category="tertiary"
|
|
|
|
variant="link"
|
|
|
|
icon="plus"
|
|
|
|
size="small"
|
|
|
|
:title="__('Add request manually')"
|
2019-10-25 00:06:14 +00:00
|
|
|
@click="toggleInput"
|
2022-05-31 15:09:02 +00:00
|
|
|
/>
|
|
|
|
<gl-form-input
|
2019-10-25 00:06:14 +00:00
|
|
|
v-if="inputEnabled"
|
|
|
|
v-model="urlOrRequestId"
|
|
|
|
type="text"
|
|
|
|
:placeholder="__(`URL or request ID`)"
|
2022-05-31 15:09:02 +00:00
|
|
|
class="gl-ml-2"
|
2019-10-25 00:06:14 +00:00
|
|
|
@keyup.enter="addRequest"
|
|
|
|
@keyup.esc="clearForm"
|
|
|
|
/>
|
2022-05-31 15:09:02 +00:00
|
|
|
</gl-form>
|
2019-10-25 00:06:14 +00:00
|
|
|
</div>
|
|
|
|
</template>
|