Commit ce274223 authored by Peter Hegman's avatar Peter Hegman

Merge branch 'cngo-update-issues-refactor' into 'master'

Remove projects with disabled issues in new issue dropdown

See merge request gitlab-org/gitlab!74102
parents 20365722 f22c6bcc
......@@ -71,8 +71,11 @@ export default {
hasSelectedProject() {
return this.selectedProject.id;
},
projectsWithIssuesEnabled() {
return this.projects.filter((project) => project.issuesEnabled);
},
showNoSearchResultsText() {
return !this.projects.length && this.search;
return !this.projectsWithIssuesEnabled.length && this.search;
},
},
methods: {
......@@ -110,7 +113,7 @@ export default {
<gl-loading-icon v-if="$apollo.queries.projects.loading" />
<template v-else>
<gl-dropdown-item
v-for="project of projects"
v-for="project of projectsWithIssuesEnabled"
:key="project.id"
@click="selectProject(project)"
>
......
......@@ -3,6 +3,7 @@ query searchProjects($fullPath: ID!, $search: String) {
projects(search: $search, includeSubgroups: true) {
nodes {
id
issuesEnabled
name
nameWithNamespace
webUrl
......
......@@ -8,7 +8,7 @@ import { DASH_SCOPE, joinPaths } from '~/lib/utils/url_utility';
import {
emptySearchProjectsQueryResponse,
project1,
project2,
project3,
searchProjectsQueryResponse,
} from '../mock_data';
......@@ -72,7 +72,7 @@ describe('NewIssueDropdown component', () => {
expect(inputSpy).toHaveBeenCalledTimes(1);
});
it('renders expected dropdown items', async () => {
it('renders projects with issues enabled', async () => {
wrapper = mountComponent({ mountFn: mount });
await showDropdown();
......@@ -80,7 +80,7 @@ describe('NewIssueDropdown component', () => {
const listItems = wrapper.findAll('li');
expect(listItems.at(0).text()).toBe(project1.nameWithNamespace);
expect(listItems.at(1).text()).toBe(project2.nameWithNamespace);
expect(listItems.at(1).text()).toBe(project3.nameWithNamespace);
});
it('renders `No matches found` when there are no matches', async () => {
......
......@@ -262,6 +262,7 @@ export const urlParamsWithSpecialValues = {
export const project1 = {
id: 'gid://gitlab/Group/26',
issuesEnabled: true,
name: 'Super Mario Project',
nameWithNamespace: 'Mushroom Kingdom / Super Mario Project',
webUrl: 'https://127.0.0.1:3000/mushroom-kingdom/super-mario-project',
......@@ -269,16 +270,25 @@ export const project1 = {
export const project2 = {
id: 'gid://gitlab/Group/59',
issuesEnabled: false,
name: 'Mario Kart Project',
nameWithNamespace: 'Mushroom Kingdom / Mario Kart Project',
webUrl: 'https://127.0.0.1:3000/mushroom-kingdom/mario-kart-project',
};
export const project3 = {
id: 'gid://gitlab/Group/103',
issuesEnabled: true,
name: 'Mario Party Project',
nameWithNamespace: 'Mushroom Kingdom / Mario Party Project',
webUrl: 'https://127.0.0.1:3000/mushroom-kingdom/mario-party-project',
};
export const searchProjectsQueryResponse = {
data: {
group: {
projects: {
nodes: [project1, project2],
nodes: [project1, project2, project3],
},
},
},
......
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