Commit 23716539 authored by Phil Hughes's avatar Phil Hughes

Merge branch 'cngo-refactor-vue-issues-list' into 'master'

Refactor Vue issues list variable names

See merge request gitlab-org/gitlab!69300
parents cd401dc9 16697417
...@@ -117,9 +117,15 @@ export default { ...@@ -117,9 +117,15 @@ export default {
exportCsvPath: { exportCsvPath: {
default: '', default: '',
}, },
fullPath: {
default: '',
},
groupEpicsPath: { groupEpicsPath: {
default: '', default: '',
}, },
hasAnyIssues: {
default: false,
},
hasBlockedIssuesFeature: { hasBlockedIssuesFeature: {
default: false, default: false,
}, },
...@@ -132,9 +138,6 @@ export default { ...@@ -132,9 +138,6 @@ export default {
hasMultipleIssueAssigneesFeature: { hasMultipleIssueAssigneesFeature: {
default: false, default: false,
}, },
hasProjectIssues: {
default: false,
},
initialEmail: { initialEmail: {
default: '', default: '',
}, },
...@@ -150,9 +153,6 @@ export default { ...@@ -150,9 +153,6 @@ export default {
newIssuePath: { newIssuePath: {
default: '', default: '',
}, },
projectPath: {
default: '',
},
rssPath: { rssPath: {
default: '', default: '',
}, },
...@@ -198,7 +198,7 @@ export default { ...@@ -198,7 +198,7 @@ export default {
createFlash({ message: this.$options.i18n.errorFetchingIssues, captureError: true, error }); createFlash({ message: this.$options.i18n.errorFetchingIssues, captureError: true, error });
}, },
skip() { skip() {
return !this.hasProjectIssues; return !this.hasAnyIssues;
}, },
debounce: 200, debounce: 200,
}, },
...@@ -211,7 +211,7 @@ export default { ...@@ -211,7 +211,7 @@ export default {
}; };
}, },
skip() { skip() {
return !this.hasProjectIssues; return !this.hasAnyIssues;
}, },
}, },
countClosed: { countClosed: {
...@@ -223,7 +223,7 @@ export default { ...@@ -223,7 +223,7 @@ export default {
}; };
}, },
skip() { skip() {
return !this.hasProjectIssues; return !this.hasAnyIssues;
}, },
}, },
countAll: { countAll: {
...@@ -235,7 +235,7 @@ export default { ...@@ -235,7 +235,7 @@ export default {
}; };
}, },
skip() { skip() {
return !this.hasProjectIssues; return !this.hasAnyIssues;
}, },
}, },
}, },
...@@ -243,7 +243,7 @@ export default { ...@@ -243,7 +243,7 @@ export default {
queryVariables() { queryVariables() {
return { return {
isSignedIn: this.isSignedIn, isSignedIn: this.isSignedIn,
projectPath: this.projectPath, fullPath: this.fullPath,
search: this.searchQuery, search: this.searchQuery,
sort: this.sortKey, sort: this.sortKey,
state: this.state, state: this.state,
...@@ -465,7 +465,7 @@ export default { ...@@ -465,7 +465,7 @@ export default {
return this.$apollo return this.$apollo
.query({ .query({
query: searchLabelsQuery, query: searchLabelsQuery,
variables: { projectPath: this.projectPath, search }, variables: { fullPath: this.fullPath, search },
}) })
.then(({ data }) => data.project.labels.nodes); .then(({ data }) => data.project.labels.nodes);
}, },
...@@ -473,7 +473,7 @@ export default { ...@@ -473,7 +473,7 @@ export default {
return this.$apollo return this.$apollo
.query({ .query({
query: searchMilestonesQuery, query: searchMilestonesQuery,
variables: { projectPath: this.projectPath, search }, variables: { fullPath: this.fullPath, search },
}) })
.then(({ data }) => data.project.milestones.nodes); .then(({ data }) => data.project.milestones.nodes);
}, },
...@@ -481,8 +481,8 @@ export default { ...@@ -481,8 +481,8 @@ export default {
const id = Number(search); const id = Number(search);
const variables = const variables =
!search || Number.isNaN(id) !search || Number.isNaN(id)
? { projectPath: this.projectPath, search } ? { fullPath: this.fullPath, search }
: { projectPath: this.projectPath, id }; : { fullPath: this.fullPath, id };
return this.$apollo return this.$apollo
.query({ .query({
...@@ -495,7 +495,7 @@ export default { ...@@ -495,7 +495,7 @@ export default {
return this.$apollo return this.$apollo
.query({ .query({
query: searchUsersQuery, query: searchUsersQuery,
variables: { projectPath: this.projectPath, search }, variables: { fullPath: this.fullPath, search },
}) })
.then(({ data }) => data.project.projectMembers.nodes.map((member) => member.user)); .then(({ data }) => data.project.projectMembers.nodes.map((member) => member.user));
}, },
...@@ -607,9 +607,9 @@ export default { ...@@ -607,9 +607,9 @@ export default {
</script> </script>
<template> <template>
<div v-if="hasProjectIssues"> <div v-if="hasAnyIssues">
<issuable-list <issuable-list
:namespace="projectPath" :namespace="fullPath"
recent-searches-storage-key="issues" recent-searches-storage-key="issues"
:search-input-placeholder="$options.i18n.searchPlaceholder" :search-input-placeholder="$options.i18n.searchPlaceholder"
:search-tokens="searchTokens" :search-tokens="searchTokens"
......
...@@ -118,13 +118,14 @@ export function mountIssuesListApp() { ...@@ -118,13 +118,14 @@ export function mountIssuesListApp() {
emailsHelpPagePath, emailsHelpPagePath,
emptyStateSvgPath, emptyStateSvgPath,
exportCsvPath, exportCsvPath,
fullPath,
groupEpicsPath, groupEpicsPath,
hasAnyIssues,
hasBlockedIssuesFeature, hasBlockedIssuesFeature,
hasIssuableHealthStatusFeature, hasIssuableHealthStatusFeature,
hasIssueWeightsFeature, hasIssueWeightsFeature,
hasIterationsFeature, hasIterationsFeature,
hasMultipleIssueAssigneesFeature, hasMultipleIssueAssigneesFeature,
hasProjectIssues,
importCsvIssuesPath, importCsvIssuesPath,
initialEmail, initialEmail,
isSignedIn, isSignedIn,
...@@ -134,7 +135,6 @@ export function mountIssuesListApp() { ...@@ -134,7 +135,6 @@ export function mountIssuesListApp() {
maxAttachmentSize, maxAttachmentSize,
newIssuePath, newIssuePath,
projectImportJiraPath, projectImportJiraPath,
projectPath,
quickActionsHelpPath, quickActionsHelpPath,
resetPath, resetPath,
rssPath, rssPath,
...@@ -150,18 +150,18 @@ export function mountIssuesListApp() { ...@@ -150,18 +150,18 @@ export function mountIssuesListApp() {
calendarPath, calendarPath,
canBulkUpdate: parseBoolean(canBulkUpdate), canBulkUpdate: parseBoolean(canBulkUpdate),
emptyStateSvgPath, emptyStateSvgPath,
fullPath,
groupEpicsPath, groupEpicsPath,
hasAnyIssues: parseBoolean(hasAnyIssues),
hasBlockedIssuesFeature: parseBoolean(hasBlockedIssuesFeature), hasBlockedIssuesFeature: parseBoolean(hasBlockedIssuesFeature),
hasIssuableHealthStatusFeature: parseBoolean(hasIssuableHealthStatusFeature), hasIssuableHealthStatusFeature: parseBoolean(hasIssuableHealthStatusFeature),
hasIssueWeightsFeature: parseBoolean(hasIssueWeightsFeature), hasIssueWeightsFeature: parseBoolean(hasIssueWeightsFeature),
hasIterationsFeature: parseBoolean(hasIterationsFeature), hasIterationsFeature: parseBoolean(hasIterationsFeature),
hasMultipleIssueAssigneesFeature: parseBoolean(hasMultipleIssueAssigneesFeature), hasMultipleIssueAssigneesFeature: parseBoolean(hasMultipleIssueAssigneesFeature),
hasProjectIssues: parseBoolean(hasProjectIssues),
isSignedIn: parseBoolean(isSignedIn), isSignedIn: parseBoolean(isSignedIn),
issuesPath, issuesPath,
jiraIntegrationPath, jiraIntegrationPath,
newIssuePath, newIssuePath,
projectPath,
rssPath, rssPath,
showNewIssueLink: parseBoolean(showNewIssueLink), showNewIssueLink: parseBoolean(showNewIssueLink),
signInPath, signInPath,
...@@ -172,9 +172,9 @@ export function mountIssuesListApp() { ...@@ -172,9 +172,9 @@ export function mountIssuesListApp() {
importCsvIssuesPath, importCsvIssuesPath,
maxAttachmentSize, maxAttachmentSize,
projectImportJiraPath, projectImportJiraPath,
showExportButton: parseBoolean(hasProjectIssues), showExportButton: parseBoolean(hasAnyIssues),
showImportButton: parseBoolean(canImportIssues), showImportButton: parseBoolean(canImportIssues),
showLabel: !parseBoolean(hasProjectIssues), showLabel: !parseBoolean(hasAnyIssues),
// For IssuableByEmail component // For IssuableByEmail component
emailsHelpPagePath, emailsHelpPagePath,
initialEmail, initialEmail,
......
#import "~/graphql_shared/fragments/pageInfo.fragment.graphql" #import "~/graphql_shared/fragments/pageInfo.fragment.graphql"
#import "./issue.fragment.graphql" #import "./issue.fragment.graphql"
query getProjectIssues( query getIssues(
$isSignedIn: Boolean = false $isSignedIn: Boolean = false
$projectPath: ID! $fullPath: ID!
$search: String $search: String
$sort: IssueSort $sort: IssueSort
$state: IssuableState $state: IssuableState
...@@ -20,7 +20,7 @@ query getProjectIssues( ...@@ -20,7 +20,7 @@ query getProjectIssues(
$firstPageSize: Int $firstPageSize: Int
$lastPageSize: Int $lastPageSize: Int
) { ) {
project(fullPath: $projectPath) { project(fullPath: $fullPath) {
issues( issues(
search: $search search: $search
sort: $sort sort: $sort
......
query getProjectIssuesCount( query getIssuesCount(
$projectPath: ID! $fullPath: ID!
$search: String $search: String
$state: IssuableState $state: IssuableState
$assigneeId: String $assigneeId: String
...@@ -11,7 +11,7 @@ query getProjectIssuesCount( ...@@ -11,7 +11,7 @@ query getProjectIssuesCount(
$types: [IssueType!] $types: [IssueType!]
$not: NegatedIssueFilterInput $not: NegatedIssueFilterInput
) { ) {
project(fullPath: $projectPath) { project(fullPath: $fullPath) {
issues( issues(
search: $search search: $search
state: $state state: $state
......
query searchIterations($projectPath: ID!, $search: String, $id: ID) { query searchIterations($fullPath: ID!, $search: String, $id: ID) {
project(fullPath: $projectPath) { project(fullPath: $fullPath) {
iterations(title: $search, id: $id) { iterations(title: $search, id: $id) {
nodes { nodes {
id id
......
query searchLabels($projectPath: ID!, $search: String) { query searchLabels($fullPath: ID!, $search: String) {
project(fullPath: $projectPath) { project(fullPath: $fullPath) {
labels(searchTerm: $search, includeAncestorGroups: true) { labels(searchTerm: $search, includeAncestorGroups: true) {
nodes { nodes {
id id
......
query searchMilestones($projectPath: ID!, $search: String) { query searchMilestones($fullPath: ID!, $search: String) {
project(fullPath: $projectPath) { project(fullPath: $fullPath) {
milestones(searchTitle: $search, includeAncestors: true) { milestones(searchTitle: $search, includeAncestors: true) {
nodes { nodes {
id id
......
query searchUsers($projectPath: ID!, $search: String) { query searchUsers($fullPath: ID!, $search: String) {
project(fullPath: $projectPath) { project(fullPath: $fullPath) {
projectMembers(search: $search) { projectMembers(search: $search) {
nodes { nodes {
user { user {
......
...@@ -214,7 +214,8 @@ module IssuesHelper ...@@ -214,7 +214,8 @@ module IssuesHelper
emails_help_page_path: help_page_path('development/emails', anchor: 'email-namespace'), emails_help_page_path: help_page_path('development/emails', anchor: 'email-namespace'),
empty_state_svg_path: image_path('illustrations/issues.svg'), empty_state_svg_path: image_path('illustrations/issues.svg'),
export_csv_path: export_csv_project_issues_path(project), export_csv_path: export_csv_project_issues_path(project),
has_project_issues: project_issues(project).exists?.to_s, full_path: project.full_path,
has_any_issues: project_issues(project).exists?.to_s,
import_csv_issues_path: import_csv_namespace_project_issues_path, import_csv_issues_path: import_csv_namespace_project_issues_path,
initial_email: project.new_issuable_address(current_user, 'issue'), initial_email: project.new_issuable_address(current_user, 'issue'),
is_signed_in: current_user.present?.to_s, is_signed_in: current_user.present?.to_s,
...@@ -224,7 +225,6 @@ module IssuesHelper ...@@ -224,7 +225,6 @@ module IssuesHelper
max_attachment_size: number_to_human_size(Gitlab::CurrentSettings.max_attachment_size.megabytes), max_attachment_size: number_to_human_size(Gitlab::CurrentSettings.max_attachment_size.megabytes),
new_issue_path: new_project_issue_path(project, issue: { milestone_id: finder.milestones.first.try(:id) }), new_issue_path: new_project_issue_path(project, issue: { milestone_id: finder.milestones.first.try(:id) }),
project_import_jira_path: project_import_jira_path(project), project_import_jira_path: project_import_jira_path(project),
project_path: project.full_path,
quick_actions_help_path: help_page_path('user/project/quick_actions'), quick_actions_help_path: help_page_path('user/project/quick_actions'),
reset_path: new_issuable_address_project_path(project, issuable_type: 'issue'), reset_path: new_issuable_address_project_path(project, issuable_type: 'issue'),
rss_path: url_for(safe_params.merge(rss_url_options)), rss_path: url_for(safe_params.merge(rss_url_options)),
......
#import "~/graphql_shared/fragments/pageInfo.fragment.graphql" #import "~/graphql_shared/fragments/pageInfo.fragment.graphql"
#import "~/issues_list/queries/issue.fragment.graphql" #import "~/issues_list/queries/issue.fragment.graphql"
query getProjectIssues( query getIssues(
$isSignedIn: Boolean = false $isSignedIn: Boolean = false
$projectPath: ID! $fullPath: ID!
$search: String $search: String
$sort: IssueSort $sort: IssueSort
$state: IssuableState $state: IssuableState
...@@ -24,7 +24,7 @@ query getProjectIssues( ...@@ -24,7 +24,7 @@ query getProjectIssues(
$firstPageSize: Int $firstPageSize: Int
$lastPageSize: Int $lastPageSize: Int
) { ) {
project(fullPath: $projectPath) { project(fullPath: $fullPath) {
issues( issues(
search: $search search: $search
sort: $sort sort: $sort
......
query getProjectIssuesCount( query getIssuesCount(
$projectPath: ID! $fullPath: ID!
$search: String $search: String
$state: IssuableState $state: IssuableState
$assigneeId: String $assigneeId: String
...@@ -15,7 +15,7 @@ query getProjectIssuesCount( ...@@ -15,7 +15,7 @@ query getProjectIssuesCount(
$weight: String $weight: String
$not: NegatedIssueFilterInput $not: NegatedIssueFilterInput
) { ) {
project(fullPath: $projectPath) { project(fullPath: $fullPath) {
issues( issues(
search: $search search: $search
state: $state state: $state
......
...@@ -63,15 +63,15 @@ describe('IssuesListApp component', () => { ...@@ -63,15 +63,15 @@ describe('IssuesListApp component', () => {
canBulkUpdate: false, canBulkUpdate: false,
emptyStateSvgPath: 'empty-state.svg', emptyStateSvgPath: 'empty-state.svg',
exportCsvPath: 'export/csv/path', exportCsvPath: 'export/csv/path',
fullPath: 'path/to/project',
hasAnyIssues: true,
hasBlockedIssuesFeature: true, hasBlockedIssuesFeature: true,
hasIssueWeightsFeature: true, hasIssueWeightsFeature: true,
hasIterationsFeature: true, hasIterationsFeature: true,
hasProjectIssues: true,
isSignedIn: true, isSignedIn: true,
issuesPath: 'path/to/issues', issuesPath: 'path/to/issues',
jiraIntegrationPath: 'jira/integration/path', jiraIntegrationPath: 'jira/integration/path',
newIssuePath: 'new/issue/path', newIssuePath: 'new/issue/path',
projectPath: 'path/to/project',
rssPath: 'rss/path', rssPath: 'rss/path',
showNewIssueLink: true, showNewIssueLink: true,
signInPath: 'sign/in/path', signInPath: 'sign/in/path',
...@@ -134,7 +134,7 @@ describe('IssuesListApp component', () => { ...@@ -134,7 +134,7 @@ describe('IssuesListApp component', () => {
it('renders', () => { it('renders', () => {
expect(findIssuableList().props()).toMatchObject({ expect(findIssuableList().props()).toMatchObject({
namespace: defaultProvide.projectPath, namespace: defaultProvide.fullPath,
recentSearchesStorageKey: 'issues', recentSearchesStorageKey: 'issues',
searchInputPlaceholder: IssuesListApp.i18n.searchPlaceholder, searchInputPlaceholder: IssuesListApp.i18n.searchPlaceholder,
sortOptions: getSortOptions(true, true), sortOptions: getSortOptions(true, true),
...@@ -349,7 +349,7 @@ describe('IssuesListApp component', () => { ...@@ -349,7 +349,7 @@ describe('IssuesListApp component', () => {
beforeEach(() => { beforeEach(() => {
setWindowLocation(`?search=no+results`); setWindowLocation(`?search=no+results`);
wrapper = mountComponent({ provide: { hasProjectIssues: true }, mountFn: mount }); wrapper = mountComponent({ provide: { hasAnyIssues: true }, mountFn: mount });
}); });
it('shows empty state', () => { it('shows empty state', () => {
...@@ -363,7 +363,7 @@ describe('IssuesListApp component', () => { ...@@ -363,7 +363,7 @@ describe('IssuesListApp component', () => {
describe('when "Open" tab has no issues', () => { describe('when "Open" tab has no issues', () => {
beforeEach(() => { beforeEach(() => {
wrapper = mountComponent({ provide: { hasProjectIssues: true }, mountFn: mount }); wrapper = mountComponent({ provide: { hasAnyIssues: true }, mountFn: mount });
}); });
it('shows empty state', () => { it('shows empty state', () => {
...@@ -379,7 +379,7 @@ describe('IssuesListApp component', () => { ...@@ -379,7 +379,7 @@ describe('IssuesListApp component', () => {
beforeEach(() => { beforeEach(() => {
setWindowLocation(`?state=${IssuableStates.Closed}`); setWindowLocation(`?state=${IssuableStates.Closed}`);
wrapper = mountComponent({ provide: { hasProjectIssues: true }, mountFn: mount }); wrapper = mountComponent({ provide: { hasAnyIssues: true }, mountFn: mount });
}); });
it('shows empty state', () => { it('shows empty state', () => {
...@@ -395,7 +395,7 @@ describe('IssuesListApp component', () => { ...@@ -395,7 +395,7 @@ describe('IssuesListApp component', () => {
describe('when user is logged in', () => { describe('when user is logged in', () => {
beforeEach(() => { beforeEach(() => {
wrapper = mountComponent({ wrapper = mountComponent({
provide: { hasProjectIssues: false, isSignedIn: true }, provide: { hasAnyIssues: false, isSignedIn: true },
mountFn: mount, mountFn: mount,
}); });
}); });
...@@ -434,7 +434,7 @@ describe('IssuesListApp component', () => { ...@@ -434,7 +434,7 @@ describe('IssuesListApp component', () => {
describe('when user is logged out', () => { describe('when user is logged out', () => {
beforeEach(() => { beforeEach(() => {
wrapper = mountComponent({ wrapper = mountComponent({
provide: { hasProjectIssues: false, isSignedIn: false }, provide: { hasAnyIssues: false, isSignedIn: false },
}); });
}); });
......
...@@ -314,7 +314,8 @@ RSpec.describe IssuesHelper do ...@@ -314,7 +314,8 @@ RSpec.describe IssuesHelper do
emails_help_page_path: help_page_path('development/emails', anchor: 'email-namespace'), emails_help_page_path: help_page_path('development/emails', anchor: 'email-namespace'),
empty_state_svg_path: '#', empty_state_svg_path: '#',
export_csv_path: export_csv_project_issues_path(project), export_csv_path: export_csv_project_issues_path(project),
has_project_issues: project_issues(project).exists?.to_s, full_path: project.full_path,
has_any_issues: project_issues(project).exists?.to_s,
import_csv_issues_path: '#', import_csv_issues_path: '#',
initial_email: project.new_issuable_address(current_user, 'issue'), initial_email: project.new_issuable_address(current_user, 'issue'),
is_signed_in: current_user.present?.to_s, is_signed_in: current_user.present?.to_s,
...@@ -324,7 +325,6 @@ RSpec.describe IssuesHelper do ...@@ -324,7 +325,6 @@ RSpec.describe IssuesHelper do
max_attachment_size: number_to_human_size(Gitlab::CurrentSettings.max_attachment_size.megabytes), max_attachment_size: number_to_human_size(Gitlab::CurrentSettings.max_attachment_size.megabytes),
new_issue_path: new_project_issue_path(project, issue: { milestone_id: finder.milestones.first.id }), new_issue_path: new_project_issue_path(project, issue: { milestone_id: finder.milestones.first.id }),
project_import_jira_path: project_import_jira_path(project), project_import_jira_path: project_import_jira_path(project),
project_path: project.full_path,
quick_actions_help_path: help_page_path('user/project/quick_actions'), quick_actions_help_path: help_page_path('user/project/quick_actions'),
reset_path: new_issuable_address_project_path(project, issuable_type: 'issue'), reset_path: new_issuable_address_project_path(project, issuable_type: 'issue'),
rss_path: '#', rss_path: '#',
......
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