Add epics to user dashboard
parent
596d854f76
commit
1946d25e87
|
@ -76,7 +76,7 @@ urls = {
|
|||
"project-epics": "/project/:project/epics"
|
||||
"project-search": "/project/:project/search"
|
||||
|
||||
"project-epic-detail": "/project/:project/epic/:ref"
|
||||
"project-epics-detail": "/project/:project/epic/:ref"
|
||||
"project-userstories-detail": "/project/:project/us/:ref"
|
||||
"project-tasks-detail": "/project/:project/task/:ref"
|
||||
"project-issues-detail": "/project/:project/issue/:ref"
|
||||
|
|
|
@ -119,6 +119,7 @@
|
|||
"USER_STORY": "User story",
|
||||
"TASK": "Task",
|
||||
"ISSUE": "Issue",
|
||||
"EPIC": "Epic",
|
||||
"TAGS": {
|
||||
"PLACEHOLDER": "Enter tag",
|
||||
"DELETE": "Delete tag",
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
.name(ng-if="vm.column.name")
|
||||
- var hash = "#";
|
||||
a(
|
||||
tg-nav="project-epic-detail:project=vm.project.get('slug')"
|
||||
tg-nav="project-epics-detail:project=vm.project.get('slug')"
|
||||
ng-attr-title="{{::vm.epic.get('subject')}}"
|
||||
) #{hash}{{::vm.epic.get('ref')}} {{::vm.epic.get('subject')}}
|
||||
span.epic-pill(
|
||||
|
|
|
@ -25,6 +25,8 @@ DutyDirective = (navurls, $translate) ->
|
|||
|
||||
scope.vm.getDutyType = () ->
|
||||
if scope.vm.duty
|
||||
if scope.vm.duty.get('_name') == "epics"
|
||||
return $translate.instant("COMMON.EPIC")
|
||||
if scope.vm.duty.get('_name') == "userstories"
|
||||
return $translate.instant("COMMON.USER_STORY")
|
||||
if scope.vm.duty.get('_name') == "tasks"
|
||||
|
|
|
@ -57,6 +57,10 @@ class HomeService extends taiga.Service
|
|||
|
||||
assignedTo = workInProgress.get("assignedTo")
|
||||
|
||||
if assignedTo.get("epics")
|
||||
_duties = _getValidDutiesAndAttachProjectInfo(assignedTo.get("epics"), "epics")
|
||||
assignedTo = assignedTo.set("epics", _duties)
|
||||
|
||||
if assignedTo.get("userStories")
|
||||
_duties = _getValidDutiesAndAttachProjectInfo(assignedTo.get("userStories"), "userstories")
|
||||
assignedTo = assignedTo.set("userStories", _duties)
|
||||
|
@ -65,7 +69,6 @@ class HomeService extends taiga.Service
|
|||
_duties = _getValidDutiesAndAttachProjectInfo(assignedTo.get("tasks"), "tasks")
|
||||
assignedTo = assignedTo.set("tasks", _duties)
|
||||
|
||||
|
||||
if assignedTo.get("issues")
|
||||
_duties = _getValidDutiesAndAttachProjectInfo(assignedTo.get("issues"), "issues")
|
||||
assignedTo = assignedTo.set("issues", _duties)
|
||||
|
@ -73,6 +76,10 @@ class HomeService extends taiga.Service
|
|||
|
||||
watching = workInProgress.get("watching")
|
||||
|
||||
if watching.get("epics")
|
||||
_duties = _getValidDutiesAndAttachProjectInfo(watching.get("epics"), "epics")
|
||||
watching = watching.set("epics", _duties)
|
||||
|
||||
if watching.get("userStories")
|
||||
_duties = _getValidDutiesAndAttachProjectInfo(watching.get("userStories"), "userstories")
|
||||
watching = watching.set("userStories", _duties)
|
||||
|
@ -106,6 +113,14 @@ class HomeService extends taiga.Service
|
|||
assigned_to: userId
|
||||
}
|
||||
|
||||
params_epics = {
|
||||
is_closed: false
|
||||
assigned_to: userId
|
||||
}
|
||||
|
||||
assignedEpicsPromise = @rs.epics.listInAllProjects(params_epics).then (epics) ->
|
||||
assignedTo = assignedTo.set("epics", epics)
|
||||
|
||||
assignedUserStoriesPromise = @rs.userstories.listInAllProjects(params_us).then (userstories) ->
|
||||
assignedTo = assignedTo.set("userStories", userstories)
|
||||
|
||||
|
@ -125,8 +140,16 @@ class HomeService extends taiga.Service
|
|||
watchers: userId
|
||||
}
|
||||
|
||||
params_epics = {
|
||||
is_closed: false
|
||||
watchers: userId
|
||||
}
|
||||
|
||||
watching = Immutable.Map()
|
||||
|
||||
watchingEpicsPromise = @rs.epics.listInAllProjects(params_epics).then (epics) ->
|
||||
watching = watching.set("epics", epics)
|
||||
|
||||
watchingUserStoriesPromise = @rs.userstories.listInAllProjects(params_us).then (userstories) ->
|
||||
watching = watching.set("userStories", userstories)
|
||||
|
||||
|
@ -139,12 +162,14 @@ class HomeService extends taiga.Service
|
|||
workInProgress = Immutable.Map()
|
||||
|
||||
Promise.all([
|
||||
projectsPromise
|
||||
projectsPromise,
|
||||
assignedEpicsPromise,
|
||||
watchingEpicsPromise,
|
||||
assignedUserStoriesPromise,
|
||||
assignedTasksPromise,
|
||||
assignedIssuesPromise,
|
||||
watchingUserStoriesPromise,
|
||||
assignedTasksPromise,
|
||||
watchingTasksPromise,
|
||||
assignedIssuesPromise,
|
||||
watchingIssuesPromise
|
||||
]).then =>
|
||||
workInProgress = workInProgress.set("assignedTo", assignedTo)
|
||||
|
|
|
@ -24,10 +24,12 @@ describe "tgHome", ->
|
|||
_mockResources = () ->
|
||||
mocks.resources = {}
|
||||
|
||||
mocks.resources.epics = {}
|
||||
mocks.resources.userstories = {}
|
||||
mocks.resources.tasks = {}
|
||||
mocks.resources.issues = {}
|
||||
|
||||
mocks.resources.epics.listInAllProjects = sinon.stub()
|
||||
mocks.resources.userstories.listInAllProjects = sinon.stub()
|
||||
mocks.resources.tasks.listInAllProjects = sinon.stub()
|
||||
mocks.resources.issues.listInAllProjects = sinon.stub()
|
||||
|
@ -70,7 +72,7 @@ describe "tgHome", ->
|
|||
_setup()
|
||||
_inject()
|
||||
|
||||
it "get work in progress by user", (done) ->
|
||||
it.only "get work in progress by user", (done) ->
|
||||
userId = 3
|
||||
|
||||
project1 = {id: 1, name: "fake1", slug: "project-1"}
|
||||
|
@ -83,6 +85,25 @@ describe "tgHome", ->
|
|||
project2
|
||||
]))
|
||||
|
||||
mocks.resources.epics.listInAllProjects
|
||||
.withArgs(sinon.match({
|
||||
is_closed: false
|
||||
assigned_to: userId
|
||||
}))
|
||||
.promise()
|
||||
.resolve(Immutable.fromJS([{id: 4, ref: 4, project: "1"}]))
|
||||
|
||||
mocks.resources.epics.listInAllProjects
|
||||
.withArgs(sinon.match({
|
||||
is_closed: false
|
||||
watchers: userId
|
||||
}))
|
||||
.promise()
|
||||
.resolve(Immutable.fromJS([
|
||||
{id: 4, ref: 4, project: "1"},
|
||||
{id: 5, ref: 5, project: "10"} # the user is not member of this project
|
||||
]))
|
||||
|
||||
mocks.resources.userstories.listInAllProjects
|
||||
.withArgs(sinon.match({
|
||||
is_closed: false
|
||||
|
@ -109,6 +130,10 @@ describe "tgHome", ->
|
|||
.resolve(Immutable.fromJS([{id: 3, ref: 3, project: "1"}]))
|
||||
|
||||
# mock urls
|
||||
mocks.tgNavUrls.resolve
|
||||
.withArgs("project-epics-detail", {project: "project-1", ref: 4})
|
||||
.returns("/testing-project/epic/1")
|
||||
|
||||
mocks.tgNavUrls.resolve
|
||||
.withArgs("project-userstories-detail", {project: "project-1", ref: 1})
|
||||
.returns("/testing-project/us/1")
|
||||
|
@ -125,6 +150,13 @@ describe "tgHome", ->
|
|||
.then (workInProgress) ->
|
||||
expect(workInProgress.toJS()).to.be.eql({
|
||||
assignedTo: {
|
||||
epics: [{
|
||||
id: 4,
|
||||
ref: 4,
|
||||
url: '/testing-project/epic/1',
|
||||
project: project1,
|
||||
_name: 'epics'
|
||||
}]
|
||||
userStories: [{
|
||||
id: 1,
|
||||
ref: 1,
|
||||
|
@ -148,6 +180,13 @@ describe "tgHome", ->
|
|||
}]
|
||||
}
|
||||
watching: {
|
||||
epics: [{
|
||||
id: 4,
|
||||
ref: 4,
|
||||
url: '/testing-project/epic/1',
|
||||
project: project1,
|
||||
_name: 'epics'
|
||||
}]
|
||||
userStories: [{
|
||||
id: 1,
|
||||
ref: 1,
|
||||
|
|
|
@ -27,20 +27,22 @@ class WorkingOnController
|
|||
@.watching = Immutable.Map()
|
||||
|
||||
_setAssignedTo: (workInProgress) ->
|
||||
epics = workInProgress.get("assignedTo").get("epics")
|
||||
userStories = workInProgress.get("assignedTo").get("userStories")
|
||||
tasks = workInProgress.get("assignedTo").get("tasks")
|
||||
issues = workInProgress.get("assignedTo").get("issues")
|
||||
|
||||
@.assignedTo = userStories.concat(tasks).concat(issues)
|
||||
@.assignedTo = userStories.concat(tasks).concat(issues).concat(epics)
|
||||
if @.assignedTo.size > 0
|
||||
@.assignedTo = @.assignedTo.sortBy((elem) -> elem.get("modified_date")).reverse()
|
||||
|
||||
_setWatching: (workInProgress) ->
|
||||
epics = workInProgress.get("watching").get("epics")
|
||||
userStories = workInProgress.get("watching").get("userStories")
|
||||
tasks = workInProgress.get("watching").get("tasks")
|
||||
issues = workInProgress.get("watching").get("issues")
|
||||
|
||||
@.watching = userStories.concat(tasks).concat(issues)
|
||||
@.watching = userStories.concat(tasks).concat(issues).concat(epics)
|
||||
if @.watching.size > 0
|
||||
@.watching = @.watching.sortBy((elem) -> elem.get("modified_date")).reverse()
|
||||
|
||||
|
|
|
@ -20,13 +20,18 @@
|
|||
Resource = (urlsService, http) ->
|
||||
service = {}
|
||||
|
||||
service.listAll = (params) ->
|
||||
service.listInAllProjects = (params) ->
|
||||
url = urlsService.resolve("epics")
|
||||
|
||||
httpOptions = {}
|
||||
httpOptions = {
|
||||
headers: {
|
||||
"x-disable-pagination": "1"
|
||||
}
|
||||
}
|
||||
|
||||
return http.get(url, params, httpOptions).then (result) ->
|
||||
return Immutable.fromJS(result.data)
|
||||
return http.get(url, params, httpOptions)
|
||||
.then (result) ->
|
||||
return Immutable.fromJS(result.data)
|
||||
|
||||
service.list = (projectId) ->
|
||||
url = urlsService.resolve("epics")
|
||||
|
|
|
@ -33,7 +33,7 @@ script(type="text/ng-template", id="search-epics")
|
|||
div.ref(tg-bo-ref="epic.ref")
|
||||
div.user-stories
|
||||
div.user-story-name
|
||||
a(href="", tg-nav="project-epic-detail:project=project.slug,ref=epic.ref",
|
||||
a(href="", tg-nav="project-epics-detail:project=project.slug,ref=epic.ref",
|
||||
tg-bo-bind="epic.subject")
|
||||
div.status(tg-listitem-epic-status="epic")
|
||||
|
||||
|
|
Loading…
Reference in New Issue