diff --git a/app/assets/javascripts/dispatcher.js b/app/assets/javascripts/dispatcher.js index f9e23189774a6696d16d40c0cca5875b8b5a112e..89fc002d4ce9dc97a6631be9a7466d2551071501 100644 --- a/app/assets/javascripts/dispatcher.js +++ b/app/assets/javascripts/dispatcher.js @@ -533,6 +533,11 @@ import SearchAutocomplete from './search_autocomplete'; .then(callDefault) .catch(fail); break; + case 'dashboard:groups:index': + import('./pages/dashboard/groups/index') + .then(callDefault) + .catch(fail); + break; } switch (path[0]) { case 'sessions': diff --git a/app/assets/javascripts/groups/index.js b/app/assets/javascripts/groups/index.js index 8b850765a1b9dc700a69acb7c1949127ae533a53..57eaac7290628040d08b75f4f0e72d27729459ba 100644 --- a/app/assets/javascripts/groups/index.js +++ b/app/assets/javascripts/groups/index.js @@ -10,7 +10,7 @@ import groupItemComponent from './components/group_item.vue'; Vue.use(Translate); -document.addEventListener('DOMContentLoaded', () => { +export default () => { const el = document.getElementById('js-groups-tree'); // Don't do anything if element doesn't exist (No groups) @@ -71,4 +71,4 @@ document.addEventListener('DOMContentLoaded', () => { }); }, }); -}); +}; diff --git a/app/assets/javascripts/groups/service/groups_service.js b/app/assets/javascripts/groups/service/groups_service.js index 639410384c28e0dff0342196e00a4cc55f431df5..b79ba29146373652f5a3c509f778e40c4095fdea 100644 --- a/app/assets/javascripts/groups/service/groups_service.js +++ b/app/assets/javascripts/groups/service/groups_service.js @@ -1,7 +1,5 @@ import Vue from 'vue'; -import VueResource from 'vue-resource'; - -Vue.use(VueResource); +import '../../vue_shared/vue_resource_interceptor'; export default class GroupsService { constructor(endpoint) { diff --git a/app/assets/javascripts/pages/dashboard/groups/index/index.js b/app/assets/javascripts/pages/dashboard/groups/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..8a2aae706c088d72b35792bc7129dac0173cf6de --- /dev/null +++ b/app/assets/javascripts/pages/dashboard/groups/index/index.js @@ -0,0 +1,5 @@ +import initGroupsList from '../../../../groups'; + +export default () => { + initGroupsList(); +}; diff --git a/app/assets/javascripts/pages/explore/groups/index.js b/app/assets/javascripts/pages/explore/groups/index.js index 859b073f1cb8e47647eeae53902102b0b8a20abc..e59c38b8bc46648716d336aadf00cefa5b287270 100644 --- a/app/assets/javascripts/pages/explore/groups/index.js +++ b/app/assets/javascripts/pages/explore/groups/index.js @@ -1,8 +1,10 @@ import GroupsList from '~/groups_list'; import Landing from '~/landing'; +import initGroupsList from '../../../groups'; export default function () { new GroupsList(); // eslint-disable-line no-new + initGroupsList(); const landingElement = document.querySelector('.js-explore-groups-landing'); if (!landingElement) return; const exploreGroupsLanding = new Landing( diff --git a/app/assets/javascripts/pages/groups/show/index.js b/app/assets/javascripts/pages/groups/show/index.js index 45e11b6430614170fb0236d573aa5a310c8c4633..6ed0f010f15f1a4f0957b048ee36c67941662cd0 100644 --- a/app/assets/javascripts/pages/groups/show/index.js +++ b/app/assets/javascripts/pages/groups/show/index.js @@ -5,6 +5,7 @@ import notificationsDropdown from '~/notifications_dropdown'; import NotificationsForm from '~/notifications_form'; import ProjectsList from '~/projects_list'; import ShortcutsNavigation from '~/shortcuts_navigation'; +import initGroupsList from '../../../groups'; export default () => { const newGroupChildWrapper = document.querySelector('.js-new-project-subgroup'); @@ -16,4 +17,6 @@ export default () => { if (newGroupChildWrapper) { new NewGroupChild(newGroupChildWrapper); } + + initGroupsList(); }; diff --git a/app/views/dashboard/groups/_groups.html.haml b/app/views/dashboard/groups/_groups.html.haml index 601b6a8b1a72d229233d74c6fbbf17de68727b07..db856ef7d7b0456cf2e88b0089260d137ab1b904 100644 --- a/app/views/dashboard/groups/_groups.html.haml +++ b/app/views/dashboard/groups/_groups.html.haml @@ -1,2 +1,4 @@ .js-groups-list-holder #js-groups-tree{ data: { hide_projects: 'true', endpoint: dashboard_groups_path(format: :json), path: dashboard_groups_path, form_sel: 'form#group-filter-form', filter_sel: '.js-groups-list-filter', holder_sel: '.js-groups-list-holder', dropdown_sel: '.js-group-filter-dropdown-wrap' } } + .loading-container.text-center + = icon('spinner spin 2x', class: 'loading-animation prepend-top-20') diff --git a/app/views/dashboard/groups/index.html.haml b/app/views/dashboard/groups/index.html.haml index 25bf08c6c12f0c09f7f310f71a0888727771138f..50f39f9328345375a7287cc90fe49187f3dc3921 100644 --- a/app/views/dashboard/groups/index.html.haml +++ b/app/views/dashboard/groups/index.html.haml @@ -3,9 +3,6 @@ - header_title "Groups", dashboard_groups_path = render 'dashboard/groups_head' -= webpack_bundle_tag 'common_vue' -= webpack_bundle_tag 'groups' - - if params[:filter].blank? && @groups.empty? = render 'shared/groups/empty_state' - else diff --git a/app/views/explore/groups/_groups.html.haml b/app/views/explore/groups/_groups.html.haml index 911494982481101e6c18a43f2c6a53de9dccb7e1..ff57b39e94705cafd2784a1c43bffd1702651169 100644 --- a/app/views/explore/groups/_groups.html.haml +++ b/app/views/explore/groups/_groups.html.haml @@ -1,2 +1,4 @@ .js-groups-list-holder #js-groups-tree{ data: { hide_projects: 'true', endpoint: explore_groups_path(format: :json), path: explore_groups_path, form_sel: 'form#group-filter-form', filter_sel: '.js-groups-list-filter', holder_sel: '.js-groups-list-holder', dropdown_sel: '.js-group-filter-dropdown-wrap' } } + .loading-container.text-center + = icon('spinner spin 2x', class: 'loading-animation prepend-top-20') diff --git a/app/views/explore/groups/index.html.haml b/app/views/explore/groups/index.html.haml index 86abdf547cc6356e99fc1003d35c488da435801b..efa8b2706da7fb8e9f3d25d8c4df0a275808816f 100644 --- a/app/views/explore/groups/index.html.haml +++ b/app/views/explore/groups/index.html.haml @@ -2,9 +2,6 @@ - page_title "Groups" - header_title "Groups", dashboard_groups_path -= webpack_bundle_tag 'common_vue' -= webpack_bundle_tag 'groups' - - if current_user = render 'dashboard/groups_head' - else diff --git a/app/views/groups/_children.html.haml b/app/views/groups/_children.html.haml index 3afb6b2f849718d4b501d11d09b45e003a707c56..742b40784d39c1b7686d6800d3a422591f9b6af3 100644 --- a/app/views/groups/_children.html.haml +++ b/app/views/groups/_children.html.haml @@ -1,5 +1,4 @@ -= webpack_bundle_tag 'common_vue' -= webpack_bundle_tag 'groups' - .js-groups-list-holder #js-groups-tree{ data: { hide_projects: 'false', group_id: group.id, endpoint: group_children_path(group, format: :json), path: group_path(group), form_sel: 'form#group-filter-form', filter_sel: '.js-groups-list-filter', holder_sel: '.js-groups-list-holder', dropdown_sel: '.js-group-filter-dropdown-wrap' } } + .loading-container.text-center + = icon('spinner spin 2x', class: 'loading-animation prepend-top-20') diff --git a/app/views/shared/_group_form.html.haml b/app/views/shared/_group_form.html.haml index d0b9e891b824a4d13216cfb2a8e6ebe16754ee6c..cb21f90696fc73be93032b53b6eef568fd686c7c 100644 --- a/app/views/shared/_group_form.html.haml +++ b/app/views/shared/_group_form.html.haml @@ -1,5 +1,3 @@ -- content_for :page_specific_javascripts do - = page_specific_javascript_bundle_tag('group') - parent = @group.parent - group_path = root_url - group_path << parent.full_path + '/' if parent diff --git a/config/webpack.config.js b/config/webpack.config.js index 26502efaf6c6e12b876b9ff7dd7310ec9c256cd7..783677b5b8dacfb836bca6e449f488d069854556 100644 --- a/config/webpack.config.js +++ b/config/webpack.config.js @@ -44,9 +44,6 @@ var config = { graphs: './graphs/graphs_bundle.js', graphs_charts: './graphs/graphs_charts.js', graphs_show: './graphs/graphs_show.js', - group: './group.js', - groups: './groups/index.js', - groups_list: './groups_list.js', help: './help/help.js', how_to_merge: './how_to_merge.js', issue_show: './issue_show/index.js',