Commit ca938979 authored by Simon Knox's avatar Simon Knox

fix vue component property order

parent 541b7515
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
</div> </div>
<div class="media-body"> <div class="media-body">
<div class="bold author"> <div class="bold author">
{{ selected.name }} {{ selectedName }}
</div> </div>
<div class="username"> <div class="username">
...@@ -38,18 +38,17 @@ ...@@ -38,18 +38,17 @@
<div class="selectbox" style="display: none"> <div class="selectbox" style="display: none">
<input type="hidden" name="assignee_id" v-model="board.assignee_id">
<div class="dropdown"> <div class="dropdown">
<button <button
class="dropdown-menu-toggle wide js-user-search js-author-search js-save-user-data js-board-config-modal" class="dropdown-menu-toggle wide js-user-search js-author-search js-save-user-data js-board-config-modal"
ref="dropdown"
:data-field-name="fieldName" :data-field-name="fieldName"
data-current-user="true" data-current-user="true"
data-dropdown-title="Select assignee" data-dropdown-title="Select assignee"
data-any-user="Any assignee" data-any-user="Any assignee"
:data-group-id="groupId" :data-group-id="groupId"
:data-project-id="projectId" :data-project-id="projectId"
:data-selected="selected.id" :data-selected="selectedId"
data-toggle="dropdown" data-toggle="dropdown"
aria-expanded="false" aria-expanded="false"
type="button" type="button"
...@@ -115,16 +114,37 @@ export default { ...@@ -115,16 +114,37 @@ export default {
default: () => ({}), default: () => ({}),
} }
}, },
data() {
return {
selectedId: this.board.assignee_id,
}
},
components: { components: {
UserAvatarImage, UserAvatarImage,
}, },
computed: { computed: {
hasValue() { hasValue() {
return Object.keys(this.selected).length > 0 && this.selected.id; return this.board.assignee_id;
},
selectedName() {
return this.board.assignee ? this.board.assignee.name : '';
},
}, },
watch: {
board: {
handler() {
this.selectedId = this.board.assignee_id;
this.$nextTick(() => {
new UsersSelect();
});
},
deep: true,
}
}, },
mounted() { mounted() {
this.$nextTick(() => {
new UsersSelect(); new UsersSelect();
});
}, },
}; };
</script> </script>
...@@ -74,9 +74,9 @@ ...@@ -74,9 +74,9 @@
<board-labels-select <board-labels-select
:board="board" :board="board"
title="Labels" title="Labels"
defaultText="Any label" default-text="Any label"
:canEdit="canAdminBoard" :can-edit="canAdminBoard"
:labelsPath="labelsPath" :labels-path="labelsPath"
/> />
</form-block> </form-block>
...@@ -84,6 +84,7 @@ ...@@ -84,6 +84,7 @@
<assignee-select <assignee-select
:board="board" :board="board"
field-name="assignee_id" field-name="assignee_id"
v-model="board.assignee_id"
:selected="board.assignee" :selected="board.assignee"
:can-edit="canAdminBoard" :can-edit="canAdminBoard"
:project-id="projectId" :project-id="projectId"
...@@ -99,6 +100,7 @@ ...@@ -99,6 +100,7 @@
> >
<board-weight-select <board-weight-select
:board="board" :board="board"
:weights="weightsArray"
v-model="board.weight" v-model="board.weight"
title="Weight" title="Weight"
defaultText="Any weight" defaultText="Any weight"
...@@ -160,6 +162,10 @@ export default Vue.extend({ ...@@ -160,6 +162,10 @@ export default Vue.extend({
required: false, required: false,
default: '', default: '',
}, },
weights: {
type: String,
required: false,
},
}, },
data() { data() {
return { return {
...@@ -180,25 +186,6 @@ export default Vue.extend({ ...@@ -180,25 +186,6 @@ export default Vue.extend({
FormBlock, FormBlock,
PopupDialog, PopupDialog,
}, },
mounted() {
if (this.currentBoard && Object.keys(this.currentBoard).length && this.currentPage !== 'new') {
Store.updateBoardConfig(this.currentBoard);
} else {
Store.updateBoardConfig({
name: '',
id: false,
label_ids: [],
});
}
if (!this.board.labels) {
this.board.labels = [];
}
if (this.$refs.name) {
this.$refs.name.focus();
}
},
computed: { computed: {
buttonText() { buttonText() {
if (this.currentPage === 'new') { if (this.currentPage === 'new') {
...@@ -247,6 +234,9 @@ export default Vue.extend({ ...@@ -247,6 +234,9 @@ export default Vue.extend({
readonly() { readonly() {
return !this.canAdminBoard; return !this.canAdminBoard;
}, },
weightsArray() {
return JSON.parse(this.weights);
}
}, },
methods: { methods: {
refreshPage() { refreshPage() {
...@@ -280,5 +270,25 @@ export default Vue.extend({ ...@@ -280,5 +270,25 @@ export default Vue.extend({
Store.state.currentPage = ''; Store.state.currentPage = '';
}, },
}, },
mounted() {
if (this.currentBoard && Object.keys(this.currentBoard).length && this.currentPage !== 'new') {
Store.updateBoardConfig(this.currentBoard);
} else {
Store.updateBoardConfig({
name: '',
id: false,
label_ids: [],
assignee: {},
});
}
if (!this.board.labels) {
this.board.labels = [];
}
if (this.$refs.name) {
this.$refs.name.focus();
}
},
}); });
</script> </script>
...@@ -8,8 +8,6 @@ ...@@ -8,8 +8,6 @@
import eventHub from '../eventhub'; import eventHub from '../eventhub';
export default { export default {
props: {
},
data() { data() {
return { return {
editing: false, editing: false,
......
...@@ -99,17 +99,14 @@ export default { ...@@ -99,17 +99,14 @@ export default {
default: false, default: false,
}, },
}, },
components: {
loadingIcon,
},
data() { data() {
return { return {
isOpen: false, isOpen: false,
loading: true, loading: true,
}; };
}, },
mounted() { components: {
new LabelsSelect(); loadingIcon,
}, },
methods: { methods: {
open() { open() {
...@@ -122,5 +119,8 @@ export default { ...@@ -122,5 +119,8 @@ export default {
this.isOpen = !this.isOpen; this.isOpen = !this.isOpen;
}, },
}, },
mounted() {
new LabelsSelect();
},
}; };
</script> </script>
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
</li> </li>
</ul> </ul>
</div> </div>
<div> <div class="value">
{{ milestoneTitle }} {{ milestoneTitle }}
</div> </div>
</div> </div>
...@@ -62,7 +62,6 @@ ...@@ -62,7 +62,6 @@
import loadingIcon from '~/vue_shared/components/loading_icon.vue'; import loadingIcon from '~/vue_shared/components/loading_icon.vue';
import extraMilestones from '../mixins/extra_milestones'; import extraMilestones from '../mixins/extra_milestones';
import eventHub from '../eventhub';
export default { export default {
props: { props: {
...@@ -92,14 +91,6 @@ export default { ...@@ -92,14 +91,6 @@ export default {
default: false, default: false,
}, },
}, },
components: {
loadingIcon,
},
computed: {
milestoneTitle() {
return this.board.milestone ? this.board.milestone.title : this.defaultText;
},
},
data() { data() {
return { return {
isOpen: false, isOpen: false,
...@@ -108,24 +99,13 @@ export default { ...@@ -108,24 +99,13 @@ export default {
extraMilestones, extraMilestones,
}; };
}, },
mounted() { components: {
this.$http.get(this.milestonePath) loadingIcon,
.then(resp => resp.json()) },
.then((data) => { computed: {
this.milestones = data; milestoneTitle() {
this.loading = false; return this.board.milestone ? this.board.milestone.title : this.defaultText;
})
.catch(() => {
this.loading = false;
});
eventHub.$on('open', this.open);
eventHub.$on('close', this.close);
eventHub.$on('toggle', this.toggle);
}, },
beforeDestroy() {
eventHub.$off('open', this.open);
eventHub.$off('close', this.close);
eventHub.$off('toggle', this.toggle);
}, },
methods: { methods: {
selectMilestone(milestone) { selectMilestone(milestone) {
...@@ -143,5 +123,16 @@ export default { ...@@ -143,5 +123,16 @@ export default {
this.isOpen = !this.isOpen; this.isOpen = !this.isOpen;
}, },
}, },
mounted() {
this.$http.get(this.milestonePath)
.then(resp => resp.json())
.then((data) => {
this.milestones = data;
this.loading = false;
})
.catch(() => {
this.loading = false;
});
},
}; };
</script> </script>
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
</li> </li>
</ul> </ul>
</div> </div>
<div> <div class="value">
{{ weight }} {{ weight }}
</div> </div>
</div> </div>
...@@ -78,6 +78,15 @@ export default { ...@@ -78,6 +78,15 @@ export default {
required: false, required: false,
default: false, default: false,
}, },
weights: {
type: Array,
required: true,
},
},
data() {
return {
isOpen: false,
};
}, },
components: { components: {
loadingIcon, loadingIcon,
...@@ -90,13 +99,6 @@ export default { ...@@ -90,13 +99,6 @@ export default {
return this.board.weight || 'Any weight'; return this.board.weight || 'Any weight';
}, },
}, },
data() {
return {
isOpen: false,
// TODO: use Issue.weight_options from backend
weights: [1, 2, 3, 4, 5, 6, 7, 8, 9],
};
},
methods: { methods: {
selectWeight(weight) { selectWeight(weight) {
this.$set(this.board, 'weight', weight); this.$set(this.board, 'weight', weight);
......
...@@ -444,6 +444,7 @@ function UsersSelect(currentUser, els) { ...@@ -444,6 +444,7 @@ function UsersSelect(currentUser, els) {
gl.issueBoards.ModalStore.store.filter[$dropdown.data('field-name')] = user.id; gl.issueBoards.ModalStore.store.filter[$dropdown.data('field-name')] = user.id;
} else if ($el.closest('.js-board-config-modal').length) { } else if ($el.closest('.js-board-config-modal').length) {
gl.issueBoards.BoardsStore.boardConfig.assignee = user; gl.issueBoards.BoardsStore.boardConfig.assignee = user;
gl.issueBoards.BoardsStore.boardConfig.assignee_id = user.id;
} else if ($dropdown.hasClass('js-filter-submit') && (isIssueIndex || isMRIndex)) { } else if ($dropdown.hasClass('js-filter-submit') && (isIssueIndex || isMRIndex)) {
return Issuable.filterResults($dropdown.closest('form')); return Issuable.filterResults($dropdown.closest('form'));
} else if ($dropdown.hasClass('js-filter-submit')) { } else if ($dropdown.hasClass('js-filter-submit')) {
......
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