diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-17 09:12:07 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-17 09:12:07 +0300 |
commit | 8624e54ae69729abf8664f1f1a57e90ee9ecab1a (patch) | |
tree | 5a582393864f83a1ae05b8c3cdcbc7e4de57f5b2 /app | |
parent | f8edb3a740b9ba434489a50b69c2e765cecb24b0 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
12 files changed, 69 insertions, 24 deletions
diff --git a/app/assets/javascripts/contextual_sidebar.js b/app/assets/javascripts/contextual_sidebar.js index 08cf0197993..08942374120 100644 --- a/app/assets/javascripts/contextual_sidebar.js +++ b/app/assets/javascripts/contextual_sidebar.js @@ -2,6 +2,8 @@ import { GlBreakpointInstance as bp, breakpoints } from '@gitlab/ui/dist/utils'; import $ from 'jquery'; import Cookies from 'js-cookie'; import { debounce } from 'lodash'; +import initInviteMembersModal from '~/invite_members/init_invite_members_modal'; +import initInviteMembersTrigger from '~/invite_members/init_invite_members_trigger'; import { parseBoolean } from '~/lib/utils/common_utils'; export const SIDEBAR_COLLAPSED_CLASS = 'js-sidebar-collapsed'; @@ -112,5 +114,8 @@ export default class ContextualSidebar { const collapse = parseBoolean(Cookies.get('sidebar_collapsed')); this.toggleCollapsedSidebar(collapse, true); } + + initInviteMembersModal(); + initInviteMembersTrigger(); } } diff --git a/app/assets/javascripts/graphql_shared/queries/group_users_search.query.graphql b/app/assets/javascripts/graphql_shared/queries/group_users_search.query.graphql index 3448aa72964..c5f99a1657e 100644 --- a/app/assets/javascripts/graphql_shared/queries/group_users_search.query.graphql +++ b/app/assets/javascripts/graphql_shared/queries/group_users_search.query.graphql @@ -4,7 +4,7 @@ query groupUsersSearch($search: String!, $fullPath: ID!) { workspace: group(fullPath: $fullPath) { id - users: groupMembers(search: $search, relations: [DIRECT, INHERITED]) { + users: groupMembers(search: $search, relations: [DIRECT, DESCENDANTS, INHERITED]) { nodes { user { ...User diff --git a/app/assets/javascripts/invite_members/components/invite_members_trigger.vue b/app/assets/javascripts/invite_members/components/invite_members_trigger.vue index 05be427742c..bf3250f63a5 100644 --- a/app/assets/javascripts/invite_members/components/invite_members_trigger.vue +++ b/app/assets/javascripts/invite_members/components/invite_members_trigger.vue @@ -1,11 +1,12 @@ <script> -import { GlButton, GlLink } from '@gitlab/ui'; +import { GlButton, GlLink, GlIcon } from '@gitlab/ui'; import ExperimentTracking from '~/experimentation/experiment_tracking'; import { s__ } from '~/locale'; import eventHub from '../event_hub'; +import { TRIGGER_ELEMENT_BUTTON, TRIGGER_ELEMENT_SIDE_NAV } from '../constants'; export default { - components: { GlButton, GlLink }, + components: { GlButton, GlLink, GlIcon }, props: { displayText: { type: String, @@ -53,13 +54,11 @@ export default { }, }, computed: { - isButton() { - return this.triggerElement === 'button'; - }, componentAttributes() { const baseAttributes = { class: this.classes, 'data-qa-selector': 'invite_members_button', + 'data-test-id': 'invite-members-button', }; if (this.event && this.label) { @@ -77,6 +76,9 @@ export default { this.trackExperimentOnShow(); }, methods: { + checkTrigger(targetTriggerElement) { + return this.triggerElement === targetTriggerElement; + }, openModal() { eventHub.$emit('openModal', { inviteeType: 'members', source: this.triggerSource }); }, @@ -87,12 +89,14 @@ export default { } }, }, + TRIGGER_ELEMENT_BUTTON, + TRIGGER_ELEMENT_SIDE_NAV, }; </script> <template> <gl-button - v-if="isButton" + v-if="checkTrigger($options.TRIGGER_ELEMENT_BUTTON)" v-bind="componentAttributes" :variant="variant" :icon="icon" @@ -100,6 +104,17 @@ export default { > {{ displayText }} </gl-button> + <gl-link + v-else-if="checkTrigger($options.TRIGGER_ELEMENT_SIDE_NAV)" + v-bind="componentAttributes" + data-is-link="true" + @click="openModal" + > + <span class="nav-icon-container"> + <gl-icon :name="icon" /> + </span> + <span class="nav-item-name"> {{ displayText }} </span> + </gl-link> <gl-link v-else v-bind="componentAttributes" data-is-link="true" @click="openModal"> {{ displayText }} </gl-link> diff --git a/app/assets/javascripts/invite_members/constants.js b/app/assets/javascripts/invite_members/constants.js index 02f38bfd3c5..c1a1107ebe3 100644 --- a/app/assets/javascripts/invite_members/constants.js +++ b/app/assets/javascripts/invite_members/constants.js @@ -25,3 +25,5 @@ export const API_MESSAGES = { }; export const USERS_FILTER_ALL = 'all'; export const USERS_FILTER_SAML_PROVIDER_ID = 'saml_provider_id'; +export const TRIGGER_ELEMENT_BUTTON = 'button'; +export const TRIGGER_ELEMENT_SIDE_NAV = 'side-nav'; diff --git a/app/assets/javascripts/invite_members/init_invite_members_modal.js b/app/assets/javascripts/invite_members/init_invite_members_modal.js index 2aa5c571157..fc657a064dd 100644 --- a/app/assets/javascripts/invite_members/init_invite_members_modal.js +++ b/app/assets/javascripts/invite_members/init_invite_members_modal.js @@ -5,7 +5,15 @@ import { parseBoolean } from '~/lib/utils/common_utils'; Vue.use(GlToast); +let initedInviteMembersModal; + export default function initInviteMembersModal() { + if (initedInviteMembersModal) { + // if we already loaded this in another part of the dom, we don't want to do it again + // else we will stack the modals + return false; + } + // https://gitlab.com/gitlab-org/gitlab/-/issues/344955 // bug lying in wait here for someone to put group and project invite in same screen // once that happens we'll need to mount these differently, perhaps split @@ -16,6 +24,8 @@ export default function initInviteMembersModal() { return false; } + initedInviteMembersModal = true; + return new Vue({ el, provide: { diff --git a/app/models/application_record.rb b/app/models/application_record.rb index 0f7b6388441..bcd8bdd6638 100644 --- a/app/models/application_record.rb +++ b/app/models/application_record.rb @@ -95,8 +95,7 @@ class ApplicationRecord < ActiveRecord::Base end def self.declarative_enum(enum_mod) - values = enum_mod.definition.transform_values { |v| v[:value] } - enum(enum_mod.key => values) + enum(enum_mod.key => enum_mod.values) end def self.cached_column_list diff --git a/app/models/namespace.rb b/app/models/namespace.rb index 9565d1a6a69..353a896b3fe 100644 --- a/app/models/namespace.rb +++ b/app/models/namespace.rb @@ -16,7 +16,6 @@ class Namespace < ApplicationRecord include Namespaces::Traversal::Linear include EachBatch - ignore_column :delayed_project_removal, remove_with: '14.1', remove_after: '2021-05-22' # Temporary column used for back-filling project namespaces. # Remove it once the back-filling of all project namespaces is done. ignore_column :tmp_project_id, remove_with: '14.7', remove_after: '2022-01-22' diff --git a/app/views/groups/_invite_members_side_nav_link.html.haml b/app/views/groups/_invite_members_side_nav_link.html.haml new file mode 100644 index 00000000000..bccfa9897da --- /dev/null +++ b/app/views/groups/_invite_members_side_nav_link.html.haml @@ -0,0 +1,8 @@ +.js-invite-members-trigger{ data: { trigger_source: 'group-side-nav', + classes: 'gl-text-decoration-none! gl-shadow-none! gl-text-body!', + icon: 'users', + display_text: title, + trigger_element: 'side-nav'} } + += render partial: 'shared/nav/sidebar_submenu', locals: { sidebar_menu: sidebar_menu } += render 'groups/invite_members_modal', group: group diff --git a/app/views/groups/show.html.haml b/app/views/groups/show.html.haml index 2e74d983397..ed3f2b0c6db 100644 --- a/app/views/groups/show.html.haml +++ b/app/views/groups/show.html.haml @@ -32,8 +32,6 @@ = render_if_exists 'groups/group_activity_analytics', group: @group -= render 'groups/invite_members_modal', group: @group - .groups-listing{ data: { endpoints: { default: group_children_path(@group, format: :json), shared: group_shared_projects_path(@group, format: :json) } } } .top-area.group-nav-container.justify-content-between .scrolling-tabs-container.inner-page-scroll-tabs diff --git a/app/views/projects/_invite_members_side_nav_link.html.haml b/app/views/projects/_invite_members_side_nav_link.html.haml new file mode 100644 index 00000000000..ea6174d19f0 --- /dev/null +++ b/app/views/projects/_invite_members_side_nav_link.html.haml @@ -0,0 +1,8 @@ +.js-invite-members-trigger{ data: { trigger_source: 'project-side-nav', + classes: 'gl-text-decoration-none! gl-shadow-none! gl-text-body!', + icon: 'users', + display_text: title, + trigger_element: 'side-nav'} } + += render partial: 'shared/nav/sidebar_submenu', locals: { sidebar_menu: sidebar_menu } += render 'projects/invite_members_modal', project: project diff --git a/app/views/shared/nav/_sidebar_menu.html.haml b/app/views/shared/nav/_sidebar_menu.html.haml index 903d2d077ba..3f71368aff3 100644 --- a/app/views/shared/nav/_sidebar_menu.html.haml +++ b/app/views/shared/nav/_sidebar_menu.html.haml @@ -16,15 +16,4 @@ %span.badge.badge-pill.count{ **sidebar_menu.pill_html_options } = number_with_delimiter(sidebar_menu.pill_count) - %ul.sidebar-sub-level-items{ class: ('is-fly-out-only' unless sidebar_menu.has_renderable_items?) } - = nav_link(**sidebar_menu.all_active_routes, html_options: { class: 'fly-out-top-item' } ) do - %span.fly-out-top-item-container - %strong.fly-out-top-item-name - = sidebar_menu.title - - if sidebar_menu.has_pill? - %span.badge.badge-pill.count.fly-out-badge{ **sidebar_menu.pill_html_options } - = number_with_delimiter(sidebar_menu.pill_count) - - - if sidebar_menu.has_renderable_items? - %li.divider.fly-out-top-item - = render partial: 'shared/nav/sidebar_menu_item', collection: sidebar_menu.renderable_items + = render partial: 'shared/nav/sidebar_submenu', locals: { sidebar_menu: sidebar_menu } diff --git a/app/views/shared/nav/_sidebar_submenu.html.haml b/app/views/shared/nav/_sidebar_submenu.html.haml new file mode 100644 index 00000000000..750e6c9ee57 --- /dev/null +++ b/app/views/shared/nav/_sidebar_submenu.html.haml @@ -0,0 +1,12 @@ +%ul.sidebar-sub-level-items{ class: ('is-fly-out-only' unless sidebar_menu.has_renderable_items?) } + = nav_link(**sidebar_menu.all_active_routes, html_options: { class: 'fly-out-top-item' } ) do + %span.fly-out-top-item-container + %strong.fly-out-top-item-name + = sidebar_menu.title + - if sidebar_menu.has_pill? + %span.badge.badge-pill.count.fly-out-badge{ **sidebar_menu.pill_html_options } + = number_with_delimiter(sidebar_menu.pill_count) + + - if sidebar_menu.has_renderable_items? + %li.divider.fly-out-top-item + = render partial: 'shared/nav/sidebar_menu_item', collection: sidebar_menu.renderable_items |