Commit ef50166f authored by Florie Guibert's avatar Florie Guibert

Lock a newly created item card in boards

Review feedback
parent 454f3b81
...@@ -185,7 +185,7 @@ export default { ...@@ -185,7 +185,7 @@ export default {
<a <a
:href="item.path || item.webUrl || ''" :href="item.path || item.webUrl || ''"
:title="item.title" :title="item.title"
:class="{ 'gl-text-gray-400': item.isLoading }" :class="{ 'gl-text-gray-400!': item.isLoading }"
@mousemove.stop @mousemove.stop
>{{ item.title }}</a >{{ item.title }}</a
> >
......
...@@ -86,7 +86,9 @@ export default { ...@@ -86,7 +86,9 @@ export default {
: this.$options.i18n.showingAllIssues; : this.$options.i18n.showingAllIssues;
}, },
treeRootWrapper() { treeRootWrapper() {
return this.canAdminList ? Draggable : 'ul'; return this.canAdminList && !this.listsFlags[this.list.id]?.addItemToListInProgress
? Draggable
: 'ul';
}, },
treeRootOptions() { treeRootOptions() {
const options = { const options = {
......
...@@ -102,7 +102,7 @@ export default { ...@@ -102,7 +102,7 @@ export default {
ref="submitButton" ref="submitButton"
:disabled="disabled" :disabled="disabled"
class="float-left js-no-auto-disable" class="float-left js-no-auto-disable"
variant="success" variant="confirm"
category="primary" category="primary"
type="submit" type="submit"
> >
......
...@@ -489,8 +489,13 @@ export default { ...@@ -489,8 +489,13 @@ export default {
}); });
}, },
addListItem: ({ commit }, { list, item, position }) => { addListItem: ({ commit }, { list, item, position, inProgress = false }) => {
commit(types.ADD_BOARD_ITEM_TO_LIST, { listId: list.id, itemId: item.id, atIndex: position }); commit(types.ADD_BOARD_ITEM_TO_LIST, {
listId: list.id,
itemId: item.id,
atIndex: position,
inProgress,
});
commit(types.UPDATE_BOARD_ITEM, item); commit(types.UPDATE_BOARD_ITEM, item);
}, },
...@@ -510,7 +515,7 @@ export default { ...@@ -510,7 +515,7 @@ export default {
} }
const placeholderIssue = formatIssue({ ...issueInput, id: placeholderId, isLoading: true }); const placeholderIssue = formatIssue({ ...issueInput, id: placeholderId, isLoading: true });
dispatch('addListItem', { list, item: placeholderIssue, position: 0 }); dispatch('addListItem', { list, item: placeholderIssue, position: 0, inProgress: true });
gqlClient gqlClient
.mutate({ .mutate({
......
...@@ -166,8 +166,9 @@ export default { ...@@ -166,8 +166,9 @@ export default {
[mutationTypes.ADD_BOARD_ITEM_TO_LIST]: ( [mutationTypes.ADD_BOARD_ITEM_TO_LIST]: (
state, state,
{ itemId, listId, moveBeforeId, moveAfterId, atIndex }, { itemId, listId, moveBeforeId, moveAfterId, atIndex, inProgress = false },
) => { ) => {
Vue.set(state.listsFlags, listId, { ...state.listsFlags, addItemToListInProgress: inProgress });
addItemToList({ state, listId, itemId, moveBeforeId, moveAfterId, atIndex }); addItemToList({ state, listId, itemId, moveBeforeId, moveAfterId, atIndex });
}, },
......
...@@ -1114,6 +1114,7 @@ describe('addListItem', () => { ...@@ -1114,6 +1114,7 @@ describe('addListItem', () => {
listId: mockLists[0].id, listId: mockLists[0].id,
itemId: mockIssue.id, itemId: mockIssue.id,
atIndex: 0, atIndex: 0,
inProgress: false,
}, },
}, },
{ type: types.UPDATE_BOARD_ITEM, payload: mockIssue }, { type: types.UPDATE_BOARD_ITEM, payload: mockIssue },
...@@ -1246,6 +1247,7 @@ describe('addListNewIssue', () => { ...@@ -1246,6 +1247,7 @@ describe('addListNewIssue', () => {
list: fakeList, list: fakeList,
item: formatIssue({ ...mockIssue, id: 'tmp', isLoading: true }), item: formatIssue({ ...mockIssue, id: 'tmp', isLoading: true }),
position: 0, position: 0,
inProgress: true,
}, },
}, },
{ type: 'removeListItem', payload: { listId: fakeList.id, itemId: 'tmp' } }, { type: 'removeListItem', payload: { listId: fakeList.id, itemId: 'tmp' } },
...@@ -1288,6 +1290,7 @@ describe('addListNewIssue', () => { ...@@ -1288,6 +1290,7 @@ describe('addListNewIssue', () => {
list: fakeList, list: fakeList,
item: formatIssue({ ...mockIssue, id: 'tmp', isLoading: true }), item: formatIssue({ ...mockIssue, id: 'tmp', isLoading: true }),
position: 0, position: 0,
inProgress: true,
}, },
}, },
{ type: 'removeListItem', payload: { listId: fakeList.id, itemId: 'tmp' } }, { type: 'removeListItem', payload: { listId: fakeList.id, itemId: 'tmp' } },
......
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