Merge pull request #1370 from taigaio/add-us-to-epics-improvement
Add userstories to epics performance improvementstable
commit
94c9a00052
|
@ -1122,6 +1122,7 @@
|
|||
"CHOOSE_PROJECT_FROM": "What's the project?",
|
||||
"CHOOSE_USERSTORY": "What's the user story?",
|
||||
"NO_USERSTORIES": "This project has no User Stories yet. Please select another project.",
|
||||
"NO_USERSTORIES_FOUND": "It looks like nothing was found with your search criteria",
|
||||
"FILTER_USERSTORIES": "Filter user stories",
|
||||
"LIGHTBOX_TITLE_BLOKING_EPIC": "Blocking epic",
|
||||
"ACTION_DELETE": "Delete epic"
|
||||
|
|
|
@ -28,17 +28,19 @@ class RelatedUserstoriesCreateController
|
|||
]
|
||||
|
||||
constructor: (@currentUserService, @rs, @confirm, @analytics) ->
|
||||
@.projects = @currentUserService.projects.get("all")
|
||||
@.projects = null
|
||||
@.projectUserstories = Immutable.List()
|
||||
@.loading = false
|
||||
|
||||
selectProject: (selectedProjectId, onSelectedProject) ->
|
||||
@rs.userstories.listAllInProject(selectedProjectId).then (data) =>
|
||||
loadProjects: () ->
|
||||
if @.projects == null
|
||||
@.projects = @currentUserService.projects.get("all")
|
||||
|
||||
filterUss: (selectedProjectId, filterText) ->
|
||||
@rs.userstories.listInAllProjects({project: selectedProjectId, q: filterText}, true).then (data) =>
|
||||
excludeIds = @.epicUserstories.map((us) -> us.get('id'))
|
||||
filteredData = data.filter((us) -> excludeIds.indexOf(us.get('id')) == -1)
|
||||
@.projectUserstories = filteredData
|
||||
if onSelectedProject
|
||||
onSelectedProject()
|
||||
|
||||
saveRelatedUserStory: (selectedUserstoryId, onSavedRelatedUserstory) ->
|
||||
# This method assumes the following methods are binded to the controller:
|
||||
|
|
|
@ -90,7 +90,6 @@ describe "RelatedUserstoriesCreate", ->
|
|||
}
|
||||
])
|
||||
|
||||
onSelectedProjectCallback = sinon.stub()
|
||||
userstories = Immutable.fromJS([
|
||||
{
|
||||
id: 11
|
||||
|
@ -108,7 +107,7 @@ describe "RelatedUserstoriesCreate", ->
|
|||
])
|
||||
|
||||
promise = mocks.tgResources.userstories.listAllInProject.withArgs(1).promise().resolve(userstories)
|
||||
RelatedUserstoriesCreateCtrl.selectProject(1, onSelectedProjectCallback).then () ->
|
||||
RelatedUserstoriesCreateCtrl.filterUss(1, "").then () ->
|
||||
expect(RelatedUserstoriesCreateCtrl.projectUserstories.toJS()).to.eql(filteredUserstories.toJS())
|
||||
done()
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
###
|
||||
|
||||
module = angular.module('taigaEpics')
|
||||
debounceLeading = @.taiga.debounceLeading
|
||||
|
||||
RelatedUserstoriesCreateDirective = (@lightboxService) ->
|
||||
link = (scope, el, attrs, ctrl) ->
|
||||
|
@ -37,6 +38,7 @@ RelatedUserstoriesCreateDirective = (@lightboxService) ->
|
|||
existingUserstoryForm.setErrors(errors)
|
||||
|
||||
scope.showLightbox = (selectedProjectId) ->
|
||||
ctrl.loadProjects()
|
||||
scope.selectProject(selectedProjectId).then () =>
|
||||
lightboxService.open(el.find(".lightbox-create-related-user-stories"))
|
||||
|
||||
|
@ -53,10 +55,11 @@ RelatedUserstoriesCreateDirective = (@lightboxService) ->
|
|||
scope.selectProject = (selectedProjectId) ->
|
||||
scope.selectedUserstory = null
|
||||
scope.searchUserstory = ""
|
||||
ctrl.selectProject(selectedProjectId)
|
||||
ctrl.filterUss(selectedProjectId, scope.searchUserstory)
|
||||
|
||||
scope.onUpdateSearchUserstory = () ->
|
||||
scope.onUpdateSearchUserstory = debounceLeading 300, () ->
|
||||
scope.selectedUserstory = null
|
||||
ctrl.filterUss(scope.selectedProject, scope.searchUserstory)
|
||||
|
||||
return {
|
||||
link: link,
|
||||
|
|
|
@ -111,12 +111,7 @@ a.add-button.e2e-add-userstory-button(
|
|||
ng-show="relatedWithSelector=='new-user-story'"
|
||||
)
|
||||
|
||||
p(
|
||||
ng-show="relatedWithSelector=='existing-user-story' && !vm.projectUserstories.size"
|
||||
translate="EPIC.NO_USERSTORIES"
|
||||
)
|
||||
|
||||
fieldset.existing-user-story(ng-show="relatedWithSelector=='existing-user-story' && vm.projectUserstories.size")
|
||||
fieldset.existing-user-story(ng-show="relatedWithSelector=='existing-user-story'")
|
||||
label(
|
||||
translate="EPIC.CHOOSE_USERSTORY"
|
||||
for="userstory-filter"
|
||||
|
@ -129,7 +124,7 @@ a.add-button.e2e-add-userstory-button(
|
|||
ng-change="onUpdateSearchUserstory()"
|
||||
)
|
||||
|
||||
form.existing-user-story-form
|
||||
form.existing-user-story-form(ng-show="relatedWithSelector=='existing-user-story' && vm.projectUserstories.size")
|
||||
select.userstory.e2e-userstories-select(
|
||||
size="5"
|
||||
ng-model="selectedUserstory"
|
||||
|
@ -140,10 +135,15 @@ a.add-button.e2e-add-userstory-button(
|
|||
value=""
|
||||
)
|
||||
option(
|
||||
ng-repeat="us in vm.projectUserstories | toMutable | byRef:searchUserstory track by us.id"
|
||||
ng-repeat="us in vm.projectUserstories | toMutable track by us.id"
|
||||
value="{{ ::us.id }}"
|
||||
) #{hash}{{::us.ref}} {{::us.subject}}
|
||||
|
||||
p.no-stories-found(
|
||||
ng-show="relatedWithSelector=='existing-user-story' && !vm.projectUserstories.size"
|
||||
translate="EPIC.NO_USERSTORIES_FOUND"
|
||||
)
|
||||
|
||||
button.button-green.e2e-select-related-userstory-button(
|
||||
href=""
|
||||
ng-click="vm.saveRelatedUserStory(selectedUserstory, closeLightbox)"
|
||||
|
|
|
@ -51,6 +51,9 @@
|
|||
.new-user-story-form {
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
.no-stories-found {
|
||||
padding: 1rem 0 0 0;
|
||||
}
|
||||
.new-user-story-options {
|
||||
display: flex;
|
||||
margin-left: auto;
|
||||
|
|
|
@ -20,9 +20,10 @@
|
|||
Resource = (urlsService, http) ->
|
||||
service = {}
|
||||
|
||||
service.listInAllProjects = (params) ->
|
||||
service.listInAllProjects = (params, pagination=false) ->
|
||||
url = urlsService.resolve("userstories")
|
||||
|
||||
if !pagination
|
||||
httpOptions = {
|
||||
headers: {
|
||||
"x-disable-pagination": "1"
|
||||
|
|
Loading…
Reference in New Issue