Commit aab9e61d authored by Coung Ngo's avatar Coung Ngo

Remove isProject from iterations

isProject is not necessary as we can derive it from isGroup
parent 5cb22c05
...@@ -57,7 +57,6 @@ export default { ...@@ -57,7 +57,6 @@ export default {
fullPath: this.fullPath, fullPath: this.fullPath,
id: getIdFromGraphQLId(this.iterationId), id: getIdFromGraphQLId(this.iterationId),
isGroup: this.namespaceType === Namespace.Group, isGroup: this.namespaceType === Namespace.Group,
isProject: this.namespaceType === Namespace.Project,
}; };
}, },
completedPercent() { completedPercent() {
......
...@@ -120,7 +120,6 @@ export default { ...@@ -120,7 +120,6 @@ export default {
fullPath: this.fullPath, fullPath: this.fullPath,
id: getIdFromGraphQLId(this.iterationId), id: getIdFromGraphQLId(this.iterationId),
isGroup: this.namespaceType === Namespace.Group, isGroup: this.namespaceType === Namespace.Group,
isProject: this.namespaceType === Namespace.Project,
}; };
if (this.pagination.beforeCursor) { if (this.pagination.beforeCursor) {
......
...@@ -77,7 +77,6 @@ export default { ...@@ -77,7 +77,6 @@ export default {
const vars = { const vars = {
fullPath: this.fullPath, fullPath: this.fullPath,
isGroup: this.namespaceType === Namespace.Group, isGroup: this.namespaceType === Namespace.Group,
isProject: this.namespaceType === Namespace.Project,
state: this.state, state: this.state,
}; };
......
...@@ -3,8 +3,7 @@ ...@@ -3,8 +3,7 @@
query IterationIssues( query IterationIssues(
$fullPath: ID! $fullPath: ID!
$id: ID! $id: ID!
$isGroup: Boolean = false $isGroup: Boolean = true
$isProject: Boolean = false
$beforeCursor: String = "" $beforeCursor: String = ""
$afterCursor: String = "" $afterCursor: String = ""
$firstPageSize: Int $firstPageSize: Int
...@@ -21,7 +20,7 @@ query IterationIssues( ...@@ -21,7 +20,7 @@ query IterationIssues(
...IterationIssues ...IterationIssues
} }
} }
project(fullPath: $fullPath) @include(if: $isProject) { project(fullPath: $fullPath) @skip(if: $isGroup) {
issues( issues(
iterationId: [$id] iterationId: [$id]
before: $beforeCursor before: $beforeCursor
......
query IterationIssuesSummary( query IterationIssuesSummary($fullPath: ID!, $id: ID!, $isGroup: Boolean = true) {
$fullPath: ID!
$id: ID!
$isGroup: Boolean = false
$isProject: Boolean = false
) {
group(fullPath: $fullPath) @include(if: $isGroup) { group(fullPath: $fullPath) @include(if: $isGroup) {
openIssues: issues(iterationId: [$id], state: opened, assigneeId: "none") { openIssues: issues(iterationId: [$id], state: opened, assigneeId: "none") {
count count
...@@ -15,7 +10,7 @@ query IterationIssuesSummary( ...@@ -15,7 +10,7 @@ query IterationIssuesSummary(
count count
} }
} }
project(fullPath: $fullPath) @include(if: $isProject) { project(fullPath: $fullPath) @skip(if: $isGroup) {
openIssues: issues(iterationId: [$id], state: opened, assigneeId: "none") { openIssues: issues(iterationId: [$id], state: opened, assigneeId: "none") {
count count
} }
......
fragment IterationList on Iteration { fragment IterationListItem on Iteration {
dueDate dueDate
id id
scopedPath scopedPath
......
#import "~/graphql_shared/fragments/pageInfo.fragment.graphql" #import "~/graphql_shared/fragments/pageInfo.fragment.graphql"
#import "./iteration_list.fragment.graphql" #import "./iteration_list_item.fragment.graphql"
query Iterations( query Iterations(
$fullPath: ID! $fullPath: ID!
$isGroup: Boolean = false $isGroup: Boolean = true
$isProject: Boolean = false
$state: IterationState! $state: IterationState!
$beforeCursor: String = "" $beforeCursor: String = ""
$afterCursor: String = "" $afterCursor: String = ""
...@@ -21,14 +20,14 @@ query Iterations( ...@@ -21,14 +20,14 @@ query Iterations(
last: $lastPageSize last: $lastPageSize
) { ) {
nodes { nodes {
...IterationList ...IterationListItem
} }
pageInfo { pageInfo {
...PageInfo ...PageInfo
} }
} }
} }
project(fullPath: $fullPath) @include(if: $isProject) { project(fullPath: $fullPath) @skip(if: $isGroup) {
iterations( iterations(
state: $state state: $state
before: $beforeCursor before: $beforeCursor
...@@ -37,7 +36,7 @@ query Iterations( ...@@ -37,7 +36,7 @@ query Iterations(
last: $lastPageSize last: $lastPageSize
) { ) {
nodes { nodes {
...IterationList ...IterationListItem
} }
pageInfo { pageInfo {
...PageInfo ...PageInfo
......
...@@ -15,8 +15,6 @@ describe('Iterations report', () => { ...@@ -15,8 +15,6 @@ describe('Iterations report', () => {
const findTopbar = () => wrapper.find({ ref: 'topbar' }); const findTopbar = () => wrapper.find({ ref: 'topbar' });
const findTitle = () => wrapper.find({ ref: 'title' }); const findTitle = () => wrapper.find({ ref: 'title' });
const findDescription = () => wrapper.find({ ref: 'description' }); const findDescription = () => wrapper.find({ ref: 'description' });
const findIterationReportSummary = () => wrapper.find(IterationReportSummary);
const findIterationReportTabs = () => wrapper.find(IterationReportTabs);
const mountComponent = ({ props = defaultProps, loading = false } = {}) => { const mountComponent = ({ props = defaultProps, loading = false } = {}) => {
wrapper = shallowMount(IterationReport, { wrapper = shallowMount(IterationReport, {
...@@ -96,15 +94,19 @@ describe('Iterations report', () => { ...@@ -96,15 +94,19 @@ describe('Iterations report', () => {
}); });
it('passes correct props to IterationReportSummary', () => { it('passes correct props to IterationReportSummary', () => {
expect(findIterationReportSummary().props('fullPath')).toBe(defaultProps.fullPath); const iterationReportSummary = wrapper.find(IterationReportSummary);
expect(findIterationReportSummary().props('iterationId')).toBe(iteration.id);
expect(findIterationReportSummary().props('namespaceType')).toBe(Namespace.Group); expect(iterationReportSummary.props('fullPath')).toBe(defaultProps.fullPath);
expect(iterationReportSummary.props('iterationId')).toBe(iteration.id);
expect(iterationReportSummary.props('namespaceType')).toBe(Namespace.Group);
}); });
it('passes correct props to IterationReportTabs', () => { it('passes correct props to IterationReportTabs', () => {
expect(findIterationReportTabs().props('fullPath')).toBe(defaultProps.fullPath); const iterationReportTabs = wrapper.find(IterationReportTabs);
expect(findIterationReportTabs().props('iterationId')).toBe(iteration.id);
expect(findIterationReportTabs().props('namespaceType')).toBe(Namespace.Group); expect(iterationReportTabs.props('fullPath')).toBe(defaultProps.fullPath);
expect(iterationReportTabs.props('iterationId')).toBe(iteration.id);
expect(iterationReportTabs.props('namespaceType')).toBe(Namespace.Group);
}); });
}); });
}); });
...@@ -108,7 +108,6 @@ describe('Iterations report summary', () => { ...@@ -108,7 +108,6 @@ describe('Iterations report summary', () => {
expect(wrapper.vm.queryVariables).toEqual({ expect(wrapper.vm.queryVariables).toEqual({
...expected, ...expected,
isGroup: true, isGroup: true,
isProject: false,
}); });
}); });
}); });
...@@ -125,7 +124,6 @@ describe('Iterations report summary', () => { ...@@ -125,7 +124,6 @@ describe('Iterations report summary', () => {
expect(wrapper.vm.queryVariables).toEqual({ expect(wrapper.vm.queryVariables).toEqual({
...expected, ...expected,
isGroup: false, isGroup: false,
isProject: true,
}); });
}); });
}); });
......
...@@ -150,7 +150,6 @@ describe('Iterations report tabs', () => { ...@@ -150,7 +150,6 @@ describe('Iterations report tabs', () => {
id, id,
lastPageSize: 20, lastPageSize: 20,
isGroup: true, isGroup: true,
isProject: false,
}); });
}); });
}); });
...@@ -163,7 +162,6 @@ describe('Iterations report tabs', () => { ...@@ -163,7 +162,6 @@ describe('Iterations report tabs', () => {
id, id,
firstPageSize: 20, firstPageSize: 20,
isGroup: true, isGroup: true,
isProject: false,
}); });
}); });
}); });
...@@ -190,7 +188,6 @@ describe('Iterations report tabs', () => { ...@@ -190,7 +188,6 @@ describe('Iterations report tabs', () => {
expect(wrapper.vm.queryVariables).toEqual({ expect(wrapper.vm.queryVariables).toEqual({
...expected, ...expected,
isGroup: true, isGroup: true,
isProject: false,
}); });
}); });
}); });
...@@ -207,7 +204,6 @@ describe('Iterations report tabs', () => { ...@@ -207,7 +204,6 @@ describe('Iterations report tabs', () => {
expect(wrapper.vm.queryVariables).toEqual({ expect(wrapper.vm.queryVariables).toEqual({
...expected, ...expected,
isGroup: false, isGroup: false,
isProject: true,
}); });
}); });
}); });
......
...@@ -103,7 +103,6 @@ describe('Iterations', () => { ...@@ -103,7 +103,6 @@ describe('Iterations', () => {
expect(wrapper.vm.queryVariables).toEqual({ expect(wrapper.vm.queryVariables).toEqual({
beforeCursor: 'first-item', beforeCursor: 'first-item',
isGroup: true, isGroup: true,
isProject: false,
lastPageSize: 20, lastPageSize: 20,
fullPath: defaultProps.fullPath, fullPath: defaultProps.fullPath,
state: 'opened', state: 'opened',
...@@ -118,7 +117,6 @@ describe('Iterations', () => { ...@@ -118,7 +117,6 @@ describe('Iterations', () => {
firstPageSize: 20, firstPageSize: 20,
fullPath: defaultProps.fullPath, fullPath: defaultProps.fullPath,
isGroup: true, isGroup: true,
isProject: false,
state: 'opened', state: 'opened',
}); });
}); });
...@@ -161,7 +159,6 @@ describe('Iterations', () => { ...@@ -161,7 +159,6 @@ describe('Iterations', () => {
expect(wrapper.vm.queryVariables).toEqual({ expect(wrapper.vm.queryVariables).toEqual({
...expected, ...expected,
isGroup: true, isGroup: true,
isProject: false,
}); });
}); });
}); });
...@@ -178,7 +175,6 @@ describe('Iterations', () => { ...@@ -178,7 +175,6 @@ describe('Iterations', () => {
expect(wrapper.vm.queryVariables).toEqual({ expect(wrapper.vm.queryVariables).toEqual({
...expected, ...expected,
isGroup: false, isGroup: false,
isProject: true,
}); });
}); });
}); });
......
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