Commit 0b33b252 authored by Filipa Lacerda's avatar Filipa Lacerda

Merge branch 'ee-refactor/move-board-new-issue-vue-component' into 'master'

Move BoardNewIssue vue component

See merge request gitlab-org/gitlab-ee!4464
parents 8b0345d7 3d14b768
<script> <script>
import Sortable from 'vendor/Sortable'; import Sortable from 'vendor/Sortable';
import boardNewIssue from './board_new_issue'; import boardNewIssue from './board_new_issue.vue';
import boardCard from './board_card.vue'; import boardCard from './board_card.vue';
import eventHub from '../eventhub'; import eventHub from '../eventhub';
import loadingIcon from '../../vue_shared/components/loading_icon.vue'; import loadingIcon from '../../vue_shared/components/loading_icon.vue';
......
/* global ListIssue */ <script>
import eventHub from '../eventhub'; import eventHub from '../eventhub';
import ProjectSelect from './project_select.vue'; import ProjectSelect from './project_select.vue';
import ListIssue from '../models/issue';
const Store = gl.issueBoards.BoardsStore; const Store = gl.issueBoards.BoardsStore;
export default { export default {
name: 'BoardNewIssue', name: 'BoardNewIssue',
components: {
ProjectSelect,
},
props: { props: {
groupId: { groupId: {
type: Number, type: Number,
...@@ -24,9 +28,6 @@ export default { ...@@ -24,9 +28,6 @@ export default {
selectedProject: {}, selectedProject: {},
}; };
}, },
components: {
'project-select': ProjectSelect,
},
computed: { computed: {
disabled() { disabled() {
if (this.groupId) { if (this.groupId) {
...@@ -35,6 +36,10 @@ export default { ...@@ -35,6 +36,10 @@ export default {
return this.title === ''; return this.title === '';
}, },
}, },
mounted() {
this.$refs.input.focus();
eventHub.$on('setSelectedProject', this.setSelectedProject);
},
methods: { methods: {
submit(e) { submit(e) {
e.preventDefault(); e.preventDefault();
...@@ -81,49 +86,57 @@ export default { ...@@ -81,49 +86,57 @@ export default {
this.selectedProject = selectedProject; this.selectedProject = selectedProject;
}, },
}, },
mounted() { };
this.$refs.input.focus(); </script>
eventHub.$on('setSelectedProject', this.setSelectedProject);
}, <template>
template: ` <div class="board-new-issue-form">
<div class="board-new-issue-form"> <div class="card">
<div class="card"> <form @submit="submit($event)">
<form @submit="submit($event)"> <div
<div class="flash-container" class="flash-container"
v-if="error"> v-if="error"
<div class="flash-alert"> >
An error occurred. Please try again. <div class="flash-alert">
</div> An error occurred. Please try again.
</div>
<label class="label-light"
:for="list.id + '-title'">
Title
</label>
<input class="form-control"
type="text"
v-model="title"
ref="input"
autocomplete="off"
:id="list.id + '-title'" />
<project-select
v-if="groupId"
:groupId="groupId"
/>
<div class="clearfix prepend-top-10">
<button class="btn btn-success pull-left"
type="submit"
:disabled="disabled"
ref="submit-button">
Submit issue
</button>
<button class="btn btn-default pull-right"
type="button"
@click="cancel">
Cancel
</button>
</div> </div>
</form> </div>
</div> <label
class="label-light"
:for="list.id + '-title'"
>
Title
</label>
<input
class="form-control"
type="text"
v-model="title"
ref="input"
autocomplete="off"
:id="list.id + '-title'"
/>
<project-select
v-if="groupId"
:group-id="groupId"
/>
<div class="clearfix prepend-top-10">
<button
class="btn btn-success pull-left"
type="submit"
:disabled="disabled"
ref="submit-button"
>
Submit issue
</button>
<button
class="btn btn-default pull-right"
type="button"
@click="cancel"
>
Cancel
</button>
</div>
</form>
</div> </div>
`, </div>
}; </template>
...@@ -122,3 +122,5 @@ class ListIssue { ...@@ -122,3 +122,5 @@ class ListIssue {
} }
window.ListIssue = ListIssue; window.ListIssue = ListIssue;
export default ListIssue;
---
title: Move BoardNewIssue vue component
merge_request: 16947
author: George Tsiolis
type: performance
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
import Vue from 'vue'; import Vue from 'vue';
import MockAdapter from 'axios-mock-adapter'; import MockAdapter from 'axios-mock-adapter';
import axios from '~/lib/utils/axios_utils'; import axios from '~/lib/utils/axios_utils';
import boardNewIssue from '~/boards/components/board_new_issue'; import boardNewIssue from '~/boards/components/board_new_issue.vue';
import '~/boards/models/list'; import '~/boards/models/list';
import { listObj, boardsMockInterceptor, mockBoardService } from './mock_data'; import { listObj, boardsMockInterceptor, mockBoardService } from './mock_data';
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment