Merge branch '47046-use-sortable-from-npm' into 'master'

Use NPM provided version of SortableJS

Closes #47046

See merge request gitlab-org/gitlab-ce!19274
This commit is contained in:
Phil Hughes 2018-06-01 07:33:39 +00:00
commit 1364dd12cc
10 changed files with 20 additions and 1383 deletions

View File

@ -1,7 +1,7 @@
/* eslint-disable comma-dangle, space-before-function-paren, one-var */
import $ from 'jquery';
import Sortable from 'vendor/Sortable';
import Sortable from 'sortablejs';
import Vue from 'vue';
import AccessorUtilities from '../../lib/utils/accessor';
import boardList from './board_list.vue';

View File

@ -1,5 +1,5 @@
<script>
import Sortable from 'vendor/Sortable';
import Sortable from 'sortablejs';
import boardNewIssue from './board_new_issue.vue';
import boardCard from './board_card.vue';
import eventHub from '../eventhub';

View File

@ -1,7 +1,7 @@
/* eslint-disable comma-dangle, class-methods-use-this, no-underscore-dangle, no-param-reassign, no-unused-vars, consistent-return, func-names, space-before-function-paren, max-len */
import $ from 'jquery';
import Sortable from 'vendor/Sortable';
import Sortable from 'sortablejs';
import flash from './flash';
import axios from './lib/utils/axios_utils';

View File

@ -0,0 +1,5 @@
---
title: Use NPM provided version of SortableJS
merge_request: 19274
author:
type: performance

View File

@ -75,6 +75,7 @@
"sanitize-html": "^1.16.1",
"select2": "3.5.2-browserify",
"sha1": "^1.1.1",
"sortablejs": "^1.7.0",
"sql.js": "^0.4.0",
"stickyfilljs": "^2.0.5",
"style-loader": "^0.21.0",

View File

@ -35,7 +35,7 @@ describe 'Issue Boards', :js do
end
it 'moves un-ordered issue to top of list' do
drag(from_index: 3, to_index: 0)
drag(from_index: 3, to_index: 0, duration: 1180)
wait_for_requests
@ -156,12 +156,13 @@ describe 'Issue Boards', :js do
end
end
def drag(selector: '.board-list', list_from_index: 1, from_index: 0, to_index: 0, list_to_index: 1)
def drag(selector: '.board-list', list_from_index: 1, from_index: 0, to_index: 0, list_to_index: 1, duration: 1000)
drag_to(selector: selector,
scrollable: '#board-app',
list_from_index: list_from_index,
from_index: from_index,
to_index: to_index,
list_to_index: list_to_index)
list_to_index: list_to_index,
duration: duration)
end
end

View File

@ -3,7 +3,7 @@
import Vue from 'vue';
import MockAdapter from 'axios-mock-adapter';
import axios from '~/lib/utils/axios_utils';
import Sortable from 'vendor/Sortable';
import Sortable from 'sortablejs';
import BoardList from '~/boards/components/board_list.vue';
import eventHub from '~/boards/eventhub';
import '~/boards/mixins/sortable_default_options';

View File

@ -1,6 +1,6 @@
module DragTo
def drag_to(list_from_index: 0, from_index: 0, to_index: 0, list_to_index: 0, selector: '', scrollable: 'body')
evaluate_script("simulateDrag({scrollable: $('#{scrollable}').get(0), from: {el: $('#{selector}').eq(#{list_from_index}).get(0), index: #{from_index}}, to: {el: $('#{selector}').eq(#{list_to_index}).get(0), index: #{to_index}}});")
def drag_to(list_from_index: 0, from_index: 0, to_index: 0, list_to_index: 0, selector: '', scrollable: 'body', duration: 1000)
evaluate_script("simulateDrag({scrollable: $('#{scrollable}').get(0), duration: #{duration}, from: {el: $('#{selector}').eq(#{list_from_index}).get(0), index: #{from_index}}, to: {el: $('#{selector}').eq(#{list_to_index}).get(0), index: #{to_index}}});")
Timeout.timeout(Capybara.default_max_wait_time) do
loop while drag_active?

File diff suppressed because it is too large Load Diff

View File

@ -7744,6 +7744,10 @@ sort-keys@^2.0.0:
dependencies:
is-plain-obj "^1.0.0"
sortablejs@^1.7.0:
version "1.7.0"
resolved "https://registry.yarnpkg.com/sortablejs/-/sortablejs-1.7.0.tgz#80a2b2370abd568e1cec8c271131ef30a904fa28"
source-list-map@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/source-list-map/-/source-list-map-2.0.0.tgz#aaa47403f7b245a92fbc97ea08f250d6087ed085"