Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
6cbbcbe2
Commit
6cbbcbe2
authored
May 06, 2021
by
Simon Knox
Committed by
Nicolò Maria Mezzopera
May 06, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use vue-router for Iteration Cadences
parent
a4e70544
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
66 additions
and
41 deletions
+66
-41
ee/app/assets/javascripts/iterations/components/app.vue
ee/app/assets/javascripts/iterations/components/app.vue
+3
-0
ee/app/assets/javascripts/iterations/components/iteration_cadence_form.vue
...ascripts/iterations/components/iteration_cadence_form.vue
+3
-15
ee/app/assets/javascripts/iterations/components/iteration_cadences_list.vue
...scripts/iterations/components/iteration_cadences_list.vue
+1
-0
ee/app/assets/javascripts/iterations/index.js
ee/app/assets/javascripts/iterations/index.js
+9
-10
ee/app/assets/javascripts/iterations/router.js
ee/app/assets/javascripts/iterations/router.js
+29
-0
ee/app/assets/javascripts/pages/groups/iteration_cadences/index.js
...sets/javascripts/pages/groups/iteration_cadences/index.js
+2
-2
ee/app/views/groups/iteration_cadences/edit.html.haml
ee/app/views/groups/iteration_cadences/edit.html.haml
+1
-1
ee/app/views/groups/iteration_cadences/index.html.haml
ee/app/views/groups/iteration_cadences/index.html.haml
+3
-0
ee/app/views/groups/iteration_cadences/new.html.haml
ee/app/views/groups/iteration_cadences/new.html.haml
+1
-1
ee/spec/frontend/iterations/components/iteration_cadence_form_spec.js
...tend/iterations/components/iteration_cadence_form_spec.js
+14
-12
No files found.
ee/app/assets/javascripts/iterations/components/app.vue
0 → 100644
View file @
6cbbcbe2
<
template
>
<router-view
/>
</
template
>
ee/app/assets/javascripts/iterations/components/iteration_cadence_form.vue
View file @
6cbbcbe2
...
@@ -9,7 +9,6 @@ import {
...
@@ -9,7 +9,6 @@ import {
GlFormInput
,
GlFormInput
,
GlFormSelect
,
GlFormSelect
,
}
from
'
@gitlab/ui
'
;
}
from
'
@gitlab/ui
'
;
import
{
visitUrl
}
from
'
~/lib/utils/url_utility
'
;
import
{
s__
,
__
}
from
'
~/locale
'
;
import
{
s__
,
__
}
from
'
~/locale
'
;
import
createCadence
from
'
../queries/create_cadence.mutation.graphql
'
;
import
createCadence
from
'
../queries/create_cadence.mutation.graphql
'
;
...
@@ -65,14 +64,7 @@ export default {
...
@@ -65,14 +64,7 @@ export default {
GlFormInput
,
GlFormInput
,
GlFormSelect
,
GlFormSelect
,
},
},
inject
:
[
'
groupPath
'
],
inject
:
[
'
groupPath
'
,
'
cadencesListPath
'
],
props
:
{
cadencesListPath
:
{
type
:
String
,
required
:
false
,
default
:
''
,
},
},
data
()
{
data
()
{
return
{
return
{
cadences
:
[],
cadences
:
[],
...
@@ -150,11 +142,7 @@ export default {
...
@@ -150,11 +142,7 @@ export default {
return
this
.
createCadence
();
return
this
.
createCadence
();
},
},
cancel
()
{
cancel
()
{
if
(
this
.
cadencesListPath
)
{
this
.
$router
.
push
({
name
:
'
index
'
});
visitUrl
(
this
.
cadencesListPath
);
}
else
{
this
.
$emit
(
'
cancel
'
);
}
},
},
createCadence
()
{
createCadence
()
{
return
this
.
$apollo
return
this
.
$apollo
...
@@ -175,7 +163,7 @@ export default {
...
@@ -175,7 +163,7 @@ export default {
return
;
return
;
}
}
visitUrl
(
this
.
cadencesListPath
);
this
.
$router
.
push
({
name
:
'
index
'
}
);
})
})
.
catch
((
e
)
=>
{
.
catch
((
e
)
=>
{
this
.
errorMessage
=
__
(
'
Unable to save cadence. Please try again
'
);
this
.
errorMessage
=
__
(
'
Unable to save cadence. Please try again
'
);
...
...
ee/app/assets/javascripts/iterations/components/iteration_cadences_list.vue
0 → 100644
View file @
6cbbcbe2
<
template
><ul></ul></
template
>
ee/app/assets/javascripts/iterations/index.js
View file @
6cbbcbe2
...
@@ -2,10 +2,11 @@ import Vue from 'vue';
...
@@ -2,10 +2,11 @@ import Vue from 'vue';
import
VueApollo
from
'
vue-apollo
'
;
import
VueApollo
from
'
vue-apollo
'
;
import
createDefaultClient
from
'
~/lib/graphql
'
;
import
createDefaultClient
from
'
~/lib/graphql
'
;
import
{
parseBoolean
}
from
'
~/lib/utils/common_utils
'
;
import
{
parseBoolean
}
from
'
~/lib/utils/common_utils
'
;
import
IterationCadenceForm
from
'
./components/iteration_cadence_form
.vue
'
;
import
App
from
'
./components/app
.vue
'
;
import
IterationForm
from
'
./components/iteration_form.vue
'
;
import
IterationForm
from
'
./components/iteration_form.vue
'
;
import
IterationReport
from
'
./components/iteration_report.vue
'
;
import
IterationReport
from
'
./components/iteration_report.vue
'
;
import
Iterations
from
'
./components/iterations.vue
'
;
import
Iterations
from
'
./components/iterations.vue
'
;
import
createRouter
from
'
./router
'
;
Vue
.
use
(
VueApollo
);
Vue
.
use
(
VueApollo
);
...
@@ -91,28 +92,26 @@ export function initIterationReport({ namespaceType, initiallyEditing } = {}) {
...
@@ -91,28 +92,26 @@ export function initIterationReport({ namespaceType, initiallyEditing } = {}) {
});
});
}
}
export
function
initCadence
Form
()
{
export
function
initCadence
App
()
{
const
el
=
document
.
querySelector
(
'
.js-iteration-cadence-
form
'
);
const
el
=
document
.
querySelector
(
'
.js-iteration-cadence-
app
'
);
if
(
!
el
)
{
if
(
!
el
)
{
return
null
;
return
null
;
}
}
const
{
groupFullPath
:
groupPath
,
cadenceId
,
cadencesListPath
}
=
el
.
dataset
;
const
{
groupFullPath
:
groupPath
,
cadencesListPath
}
=
el
.
dataset
;
const
router
=
createRouter
(
cadencesListPath
);
return
new
Vue
({
return
new
Vue
({
el
,
el
,
router
,
apolloProvider
,
apolloProvider
,
provide
:
{
provide
:
{
groupPath
,
groupPath
,
cadencesListPath
,
},
},
render
(
createElement
)
{
render
(
createElement
)
{
return
createElement
(
IterationCadenceForm
,
{
return
createElement
(
App
);
props
:
{
cadenceId
,
cadencesListPath
,
},
});
},
},
});
});
}
}
ee/app/assets/javascripts/iterations/router.js
0 → 100644
View file @
6cbbcbe2
import
Vue
from
'
vue
'
;
import
VueRouter
from
'
vue-router
'
;
import
IterationCadenceForm
from
'
./components/iteration_cadence_form.vue
'
;
import
IterationCadenceList
from
'
./components/iteration_cadences_list.vue
'
;
Vue
.
use
(
VueRouter
);
const
routes
=
[
{
name
:
'
new
'
,
path
:
'
/new
'
,
component
:
IterationCadenceForm
,
},
{
name
:
'
index
'
,
path
:
'
/
'
,
component
:
IterationCadenceList
,
},
];
export
default
function
createRouter
(
base
)
{
const
router
=
new
VueRouter
({
base
,
mode
:
'
history
'
,
routes
,
});
return
router
;
}
ee/app/assets/javascripts/pages/groups/iteration_cadences/index.js
View file @
6cbbcbe2
import
{
initCadence
Form
}
from
'
ee/iterations
'
;
import
{
initCadence
App
}
from
'
ee/iterations
'
;
initCadence
Form
();
initCadence
App
();
ee/app/views/groups/iteration_cadences/edit.html.haml
View file @
6cbbcbe2
...
@@ -2,6 +2,6 @@
...
@@ -2,6 +2,6 @@
-
breadcrumb_title
params
[
:id
]
-
breadcrumb_title
params
[
:id
]
-
page_title
_
(
"Edit iteration cadence"
)
-
page_title
_
(
"Edit iteration cadence"
)
.js-iteration-cadence-
form
{
data:
{
group_full_path:
@group
.
full_path
,
.js-iteration-cadence-
app
{
data:
{
group_full_path:
@group
.
full_path
,
cadence_id:
params
[
:id
],
cadence_id:
params
[
:id
],
cadences_list_path:
group_iteration_cadences_path
(
@group
)
}
}
cadences_list_path:
group_iteration_cadences_path
(
@group
)
}
}
ee/app/views/groups/iteration_cadences/index.html.haml
0 → 100644
View file @
6cbbcbe2
-
page_title
_
(
"Iteration cadences"
)
.js-iteration-cadence-app
{
data:
{
group_full_path:
@group
.
full_path
,
cadences_list_path:
group_iteration_cadences_path
(
@group
)
}
}
ee/app/views/groups/iteration_cadences/new.html.haml
View file @
6cbbcbe2
...
@@ -2,4 +2,4 @@
...
@@ -2,4 +2,4 @@
-
breadcrumb_title
_
(
"New"
)
-
breadcrumb_title
_
(
"New"
)
-
page_title
_
(
"New iteration cadence"
)
-
page_title
_
(
"New iteration cadence"
)
.js-iteration-cadence-
form
{
data:
{
group_full_path:
@group
.
full_path
,
cadences_list_path:
group_iteration_cadences_path
(
@group
)
}
}
.js-iteration-cadence-
app
{
data:
{
group_full_path:
@group
.
full_path
,
cadences_list_path:
group_iteration_cadences_path
(
@group
)
}
}
ee/spec/frontend/iterations/components/iteration_cadence_form_spec.js
View file @
6cbbcbe2
import
{
GlFormCheckbox
,
GlFormGroup
}
from
'
@gitlab/ui
'
;
import
{
GlFormCheckbox
,
GlFormGroup
}
from
'
@gitlab/ui
'
;
import
{
createLocalVue
,
mount
}
from
'
@vue/test-utils
'
;
import
{
mount
}
from
'
@vue/test-utils
'
;
import
Vue
from
'
vue
'
;
import
VueApollo
from
'
vue-apollo
'
;
import
VueApollo
from
'
vue-apollo
'
;
import
IterationCadenceForm
from
'
ee/iterations/components/iteration_cadence_form.vue
'
;
import
IterationCadenceForm
from
'
ee/iterations/components/iteration_cadence_form.vue
'
;
import
createCadence
from
'
ee/iterations/queries/create_cadence.mutation.graphql
'
;
import
createCadence
from
'
ee/iterations/queries/create_cadence.mutation.graphql
'
;
...
@@ -7,14 +8,14 @@ import createMockApollo from 'helpers/mock_apollo_helper';
...
@@ -7,14 +8,14 @@ import createMockApollo from 'helpers/mock_apollo_helper';
import
{
TEST_HOST
}
from
'
helpers/test_constants
'
;
import
{
TEST_HOST
}
from
'
helpers/test_constants
'
;
import
{
extendedWrapper
}
from
'
helpers/vue_test_utils_helper
'
;
import
{
extendedWrapper
}
from
'
helpers/vue_test_utils_helper
'
;
import
waitForPromises
from
'
helpers/wait_for_promises
'
;
import
waitForPromises
from
'
helpers/wait_for_promises
'
;
import
{
visitUrl
}
from
'
~/lib/utils/url_utility
'
;
jest
.
mock
(
'
~/lib/utils/url_utility
'
);
const
push
=
jest
.
fn
();
const
$router
=
{
const
localVue
=
createLocalVue
();
push
,
};
function
createMockApolloProvider
(
requestHandlers
)
{
function
createMockApolloProvider
(
requestHandlers
)
{
local
Vue
.
use
(
VueApollo
);
Vue
.
use
(
VueApollo
);
return
createMockApollo
(
requestHandlers
);
return
createMockApollo
(
requestHandlers
);
}
}
...
@@ -39,17 +40,18 @@ describe('Iteration cadence form', () => {
...
@@ -39,17 +40,18 @@ describe('Iteration cadence form', () => {
iterationCadenceCreate
:
{
iterationCadence
,
errors
:
[
'
alas, your data is unchanged
'
]
},
iterationCadenceCreate
:
{
iterationCadence
,
errors
:
[
'
alas, your data is unchanged
'
]
},
},
},
};
};
const
defaultProps
=
{
cadencesListPath
:
TEST_HOST
};
function
createComponent
({
props
=
defaultProps
,
resolverMock
}
=
{})
{
function
createComponent
({
resolverMock
}
=
{})
{
const
apolloProvider
=
createMockApolloProvider
([[
createCadence
,
resolverMock
]]);
const
apolloProvider
=
createMockApolloProvider
([[
createCadence
,
resolverMock
]]);
wrapper
=
extendedWrapper
(
wrapper
=
extendedWrapper
(
mount
(
IterationCadenceForm
,
{
mount
(
IterationCadenceForm
,
{
apolloProvider
,
apolloProvider
,
localVue
,
mocks
:
{
propsData
:
props
,
$router
,
},
provide
:
{
provide
:
{
groupPath
,
groupPath
,
cadencesListPath
:
TEST_HOST
,
},
},
}),
}),
);
);
...
@@ -86,7 +88,7 @@ describe('Iteration cadence form', () => {
...
@@ -86,7 +88,7 @@ describe('Iteration cadence form', () => {
it
(
'
cancel button links to list page
'
,
()
=>
{
it
(
'
cancel button links to list page
'
,
()
=>
{
clickCancel
();
clickCancel
();
expect
(
visitUrl
).
toHaveBeenCalledWith
(
TEST_HOST
);
expect
(
push
).
toHaveBeenCalledWith
({
name
:
'
index
'
}
);
});
});
describe
(
'
save
'
,
()
=>
{
describe
(
'
save
'
,
()
=>
{
...
@@ -131,7 +133,7 @@ describe('Iteration cadence form', () => {
...
@@ -131,7 +133,7 @@ describe('Iteration cadence form', () => {
await
waitForPromises
();
await
waitForPromises
();
expect
(
visitUrl
).
toHaveBeenCalled
(
);
expect
(
push
).
toHaveBeenCalledWith
({
name
:
'
index
'
}
);
});
});
it
(
'
does not submit if required fields missing
'
,
()
=>
{
it
(
'
does not submit if required fields missing
'
,
()
=>
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment