Adding front for gitlab and bitbucket
parent
6021749faa
commit
fb60cf0cdd
|
@ -100,6 +100,10 @@ configure = ($routeProvider, $locationProvider, $httpProvider, $provide, $tgEven
|
||||||
{templateUrl: "/partials/admin-roles.html"})
|
{templateUrl: "/partials/admin-roles.html"})
|
||||||
$routeProvider.when("/project/:pslug/admin/third-parties/github",
|
$routeProvider.when("/project/:pslug/admin/third-parties/github",
|
||||||
{templateUrl: "/partials/admin-third-parties-github.html"})
|
{templateUrl: "/partials/admin-third-parties-github.html"})
|
||||||
|
$routeProvider.when("/project/:pslug/admin/third-parties/gitlab",
|
||||||
|
{templateUrl: "/partials/admin-third-parties-gitlab.html"})
|
||||||
|
$routeProvider.when("/project/:pslug/admin/third-parties/bitbucket",
|
||||||
|
{templateUrl: "/partials/admin-third-parties-bitbucket.html"})
|
||||||
|
|
||||||
# User settings
|
# User settings
|
||||||
$routeProvider.when("/project/:pslug/user-settings/user-profile",
|
$routeProvider.when("/project/:pslug/user-settings/user-profile",
|
||||||
|
|
|
@ -78,6 +78,114 @@ class GithubController extends mixOf(taiga.Controller, taiga.PageMixin, taiga.Fi
|
||||||
|
|
||||||
module.controller("GithubController", GithubController)
|
module.controller("GithubController", GithubController)
|
||||||
|
|
||||||
|
|
||||||
|
#############################################################################
|
||||||
|
## Gitlab Controller
|
||||||
|
#############################################################################
|
||||||
|
|
||||||
|
class GitlabController extends mixOf(taiga.Controller, taiga.PageMixin, taiga.FiltersMixin)
|
||||||
|
@.$inject = [
|
||||||
|
"$scope",
|
||||||
|
"$tgRepo",
|
||||||
|
"$tgResources",
|
||||||
|
"$routeParams",
|
||||||
|
"$appTitle"
|
||||||
|
]
|
||||||
|
|
||||||
|
constructor: (@scope, @repo, @rs, @params, @appTitle) ->
|
||||||
|
bindMethods(@)
|
||||||
|
|
||||||
|
@scope.sectionName = "Gitlab" #i18n
|
||||||
|
@scope.project = {}
|
||||||
|
@scope.anyComputableRole = true
|
||||||
|
|
||||||
|
promise = @.loadInitialData()
|
||||||
|
|
||||||
|
promise.then () =>
|
||||||
|
@appTitle.set("Gitlab - " + @scope.project.name)
|
||||||
|
|
||||||
|
promise.then null, @.onInitialDataError.bind(@)
|
||||||
|
|
||||||
|
@scope.$on "project:modules:reload", =>
|
||||||
|
@.loadModules()
|
||||||
|
|
||||||
|
loadModules: ->
|
||||||
|
return @rs.modules.list(@scope.projectId, "gitlab").then (gitlab) =>
|
||||||
|
@scope.gitlab = gitlab
|
||||||
|
|
||||||
|
loadProject: ->
|
||||||
|
return @rs.projects.get(@scope.projectId).then (project) =>
|
||||||
|
@scope.project = project
|
||||||
|
@scope.$emit('project:loaded', project)
|
||||||
|
@scope.anyComputableRole = _.some(_.map(project.roles, (point) -> point.computable))
|
||||||
|
|
||||||
|
return project
|
||||||
|
|
||||||
|
loadInitialData: ->
|
||||||
|
promise = @repo.resolve({pslug: @params.pslug}).then (data) =>
|
||||||
|
@scope.projectId = data.project
|
||||||
|
return data
|
||||||
|
|
||||||
|
return promise.then(=> @.loadProject())
|
||||||
|
.then(=> @.loadModules())
|
||||||
|
|
||||||
|
|
||||||
|
module.controller("GitlabController", GitlabController)
|
||||||
|
|
||||||
|
|
||||||
|
#############################################################################
|
||||||
|
## Bitbucket Controller
|
||||||
|
#############################################################################
|
||||||
|
|
||||||
|
class BitbucketController extends mixOf(taiga.Controller, taiga.PageMixin, taiga.FiltersMixin)
|
||||||
|
@.$inject = [
|
||||||
|
"$scope",
|
||||||
|
"$tgRepo",
|
||||||
|
"$tgResources",
|
||||||
|
"$routeParams",
|
||||||
|
"$appTitle"
|
||||||
|
]
|
||||||
|
|
||||||
|
constructor: (@scope, @repo, @rs, @params, @appTitle) ->
|
||||||
|
bindMethods(@)
|
||||||
|
|
||||||
|
@scope.sectionName = "Bitbucket" #i18n
|
||||||
|
@scope.project = {}
|
||||||
|
@scope.anyComputableRole = true
|
||||||
|
|
||||||
|
promise = @.loadInitialData()
|
||||||
|
|
||||||
|
promise.then () =>
|
||||||
|
@appTitle.set("Bitbucket - " + @scope.project.name)
|
||||||
|
|
||||||
|
promise.then null, @.onInitialDataError.bind(@)
|
||||||
|
|
||||||
|
@scope.$on "project:modules:reload", =>
|
||||||
|
@.loadModules()
|
||||||
|
|
||||||
|
loadModules: ->
|
||||||
|
return @rs.modules.list(@scope.projectId, "bitbucket").then (bitbucket) =>
|
||||||
|
@scope.bitbucket = bitbucket
|
||||||
|
|
||||||
|
loadProject: ->
|
||||||
|
return @rs.projects.get(@scope.projectId).then (project) =>
|
||||||
|
@scope.project = project
|
||||||
|
@scope.$emit('project:loaded', project)
|
||||||
|
@scope.anyComputableRole = _.some(_.map(project.roles, (point) -> point.computable))
|
||||||
|
|
||||||
|
return project
|
||||||
|
|
||||||
|
loadInitialData: ->
|
||||||
|
promise = @repo.resolve({pslug: @params.pslug}).then (data) =>
|
||||||
|
@scope.projectId = data.project
|
||||||
|
return data
|
||||||
|
|
||||||
|
return promise.then(=> @.loadProject())
|
||||||
|
.then(=> @.loadModules())
|
||||||
|
|
||||||
|
module.controller("BitbucketController", BitbucketController)
|
||||||
|
|
||||||
|
|
||||||
SelectInputText = ->
|
SelectInputText = ->
|
||||||
link = ($scope, $el, $attrs) ->
|
link = ($scope, $el, $attrs) ->
|
||||||
$el.on "click", ".select-input-content", () ->
|
$el.on "click", ".select-input-content", () ->
|
||||||
|
@ -88,6 +196,7 @@ SelectInputText = ->
|
||||||
|
|
||||||
module.directive("tgSelectInputText", SelectInputText)
|
module.directive("tgSelectInputText", SelectInputText)
|
||||||
|
|
||||||
|
|
||||||
#############################################################################
|
#############################################################################
|
||||||
## GithubWebhooks Directive
|
## GithubWebhooks Directive
|
||||||
#############################################################################
|
#############################################################################
|
||||||
|
@ -121,3 +230,75 @@ GithubWebhooksDirective = ($repo, $confirm, $loading) ->
|
||||||
return {link:link}
|
return {link:link}
|
||||||
|
|
||||||
module.directive("tgGithubWebhooks", ["$tgRepo", "$tgConfirm", "$tgLoading", GithubWebhooksDirective])
|
module.directive("tgGithubWebhooks", ["$tgRepo", "$tgConfirm", "$tgLoading", GithubWebhooksDirective])
|
||||||
|
|
||||||
|
|
||||||
|
#############################################################################
|
||||||
|
## GitlabWebhooks Directive
|
||||||
|
#############################################################################
|
||||||
|
|
||||||
|
GitlabWebhooksDirective = ($repo, $confirm, $loading) ->
|
||||||
|
link = ($scope, $el, $attrs) ->
|
||||||
|
form = $el.find("form").checksley({"onlyOneErrorElement": true})
|
||||||
|
submit = debounce 2000, (event) =>
|
||||||
|
event.preventDefault()
|
||||||
|
|
||||||
|
return if not form.validate()
|
||||||
|
|
||||||
|
$loading.start(submitButton)
|
||||||
|
|
||||||
|
promise = $repo.saveAttribute($scope.gitlab, "gitlab")
|
||||||
|
promise.then ->
|
||||||
|
$loading.finish(submitButton)
|
||||||
|
$confirm.notify("success")
|
||||||
|
$scope.$emit("project:modules:reload")
|
||||||
|
|
||||||
|
promise.then null, (data) ->
|
||||||
|
$loading.finish(submitButton)
|
||||||
|
form.setErrors(data)
|
||||||
|
if data._error_message
|
||||||
|
$confirm.notify("error", data._error_message)
|
||||||
|
|
||||||
|
submitButton = $el.find(".submit-button")
|
||||||
|
|
||||||
|
$el.on "submit", "form", submit
|
||||||
|
$el.on "click", ".submit-button", submit
|
||||||
|
|
||||||
|
return {link:link}
|
||||||
|
|
||||||
|
module.directive("tgGitlabWebhooks", ["$tgRepo", "$tgConfirm", "$tgLoading", GitlabWebhooksDirective])
|
||||||
|
|
||||||
|
|
||||||
|
#############################################################################
|
||||||
|
## BitbucketWebhooks Directive
|
||||||
|
#############################################################################
|
||||||
|
|
||||||
|
BitbucketWebhooksDirective = ($repo, $confirm, $loading) ->
|
||||||
|
link = ($scope, $el, $attrs) ->
|
||||||
|
form = $el.find("form").checksley({"onlyOneErrorElement": true})
|
||||||
|
submit = debounce 2000, (event) =>
|
||||||
|
event.preventDefault()
|
||||||
|
|
||||||
|
return if not form.validate()
|
||||||
|
|
||||||
|
$loading.start(submitButton)
|
||||||
|
|
||||||
|
promise = $repo.saveAttribute($scope.bitbucket, "bitbucket")
|
||||||
|
promise.then ->
|
||||||
|
$loading.finish(submitButton)
|
||||||
|
$confirm.notify("success")
|
||||||
|
$scope.$emit("project:modules:reload")
|
||||||
|
|
||||||
|
promise.then null, (data) ->
|
||||||
|
$loading.finish(submitButton)
|
||||||
|
form.setErrors(data)
|
||||||
|
if data._error_message
|
||||||
|
$confirm.notify("error", data._error_message)
|
||||||
|
|
||||||
|
submitButton = $el.find(".submit-button")
|
||||||
|
|
||||||
|
$el.on "submit", "form", submit
|
||||||
|
$el.on "click", ".submit-button", submit
|
||||||
|
|
||||||
|
return {link:link}
|
||||||
|
|
||||||
|
module.directive("tgBitbucketWebhooks", ["$tgRepo", "$tgConfirm", "$tgLoading", BitbucketWebhooksDirective])
|
||||||
|
|
|
@ -93,6 +93,8 @@ urls = {
|
||||||
"project-admin-memberships": "/project/:project/admin/memberships"
|
"project-admin-memberships": "/project/:project/admin/memberships"
|
||||||
"project-admin-roles": "/project/:project/admin/roles"
|
"project-admin-roles": "/project/:project/admin/roles"
|
||||||
"project-admin-third-parties-github": "/project/:project/admin/third-parties/github"
|
"project-admin-third-parties-github": "/project/:project/admin/third-parties/github"
|
||||||
|
"project-admin-third-parties-gitlab": "/project/:project/admin/third-parties/gitlab"
|
||||||
|
"project-admin-third-parties-bitbucket": "/project/:project/admin/third-parties/bitbucket"
|
||||||
|
|
||||||
# User settings
|
# User settings
|
||||||
"user-settings-user-profile": "/project/:project/user-settings/user-profile"
|
"user-settings-user-profile": "/project/:project/user-settings/user-profile"
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
block head
|
||||||
|
title Taiga Your agile, free, and open source project management tool
|
||||||
|
|
||||||
|
block content
|
||||||
|
div.wrapper.roles(tg-bitbucket-webhooks, ng-controller="BitbucketController as ctrl",
|
||||||
|
ng-init="section='admin'")
|
||||||
|
sidebar.menu-secondary.sidebar(tg-admin-navigation="third-parties")
|
||||||
|
include views/modules/admin-menu
|
||||||
|
sidebar.menu-tertiary.sidebar(tg-admin-navigation="third-parties-bitbucket")
|
||||||
|
include views/modules/admin-submenu-third-parties
|
||||||
|
|
||||||
|
section.main.admin-common.admin-third-parties
|
||||||
|
include views/components/mainTitle
|
||||||
|
|
||||||
|
form
|
||||||
|
fieldset
|
||||||
|
label(for="secret-key") Secret key
|
||||||
|
input(type="text", name="secret-key", ng-model="bitbucket.secret", placeholder="Secret key", id="secret-key")
|
||||||
|
|
||||||
|
fieldset
|
||||||
|
.select-input-text(tg-select-input-text)
|
||||||
|
div
|
||||||
|
label(for="payload-url") Payload URL
|
||||||
|
.field-with-option
|
||||||
|
input(type="text", ng-model="bitbucket.webhooks_url", name="payload-url", readonly="readonly", placeholder="Payload URL", id="payload-url")
|
||||||
|
.option-wrapper.select-input-content
|
||||||
|
.icon.icon-copy
|
||||||
|
.help-copy Copy to clipboard: Ctrl+C
|
||||||
|
|
||||||
|
button(type="submit", class="hidden")
|
||||||
|
a.button.button-green.submit-button(href="", title="Save") Save
|
||||||
|
|
||||||
|
|
||||||
|
a.help-button(href="https://taiga.io/support/bitbucket-integration/", target="_blank")
|
||||||
|
span.icon.icon-help
|
||||||
|
span Do you need help? Check out our support page!
|
|
@ -0,0 +1,35 @@
|
||||||
|
block head
|
||||||
|
title Taiga Your agile, free, and open source project management tool
|
||||||
|
|
||||||
|
block content
|
||||||
|
div.wrapper.roles(tg-gitlab-webhooks, ng-controller="GitlabController as ctrl",
|
||||||
|
ng-init="section='admin'")
|
||||||
|
sidebar.menu-secondary.sidebar(tg-admin-navigation="third-parties")
|
||||||
|
include views/modules/admin-menu
|
||||||
|
sidebar.menu-tertiary.sidebar(tg-admin-navigation="third-parties-gitlab")
|
||||||
|
include views/modules/admin-submenu-third-parties
|
||||||
|
|
||||||
|
section.main.admin-common.admin-third-parties
|
||||||
|
include views/components/mainTitle
|
||||||
|
|
||||||
|
form
|
||||||
|
fieldset
|
||||||
|
label(for="secret-key") Secret key
|
||||||
|
input(type="text", name="secret-key", ng-model="gitlab.secret", placeholder="Secret key", id="secret-key")
|
||||||
|
|
||||||
|
fieldset
|
||||||
|
.select-input-text(tg-select-input-text)
|
||||||
|
div
|
||||||
|
label(for="payload-url") Payload URL
|
||||||
|
.field-with-option
|
||||||
|
input(type="text", ng-model="gitlab.webhooks_url", name="payload-url", readonly="readonly", placeholder="Payload URL", id="payload-url")
|
||||||
|
.option-wrapper.select-input-content
|
||||||
|
.icon.icon-copy
|
||||||
|
.help-copy Copy to clipboard: Ctrl+C
|
||||||
|
|
||||||
|
button(type="submit", class="hidden")
|
||||||
|
a.button.button-green.submit-button(href="", title="Save") Save
|
||||||
|
|
||||||
|
a.help-button(href="https://taiga.io/support/gitlab-integration/", target="_blank")
|
||||||
|
span.icon.icon-help
|
||||||
|
span Do you need help? Check out our support page!
|
|
@ -8,3 +8,11 @@ section.admin-submenu
|
||||||
a(href="", tg-nav="project-admin-third-parties-github:project=project.slug")
|
a(href="", tg-nav="project-admin-third-parties-github:project=project.slug")
|
||||||
span.title Github
|
span.title Github
|
||||||
span.icon.icon-arrow-right
|
span.icon.icon-arrow-right
|
||||||
|
li#adminmenu-third-parties-gitlab
|
||||||
|
a(href="", tg-nav="project-admin-third-parties-gitlab:project=project.slug")
|
||||||
|
span.title Gitlab
|
||||||
|
span.icon.icon-arrow-right
|
||||||
|
li#adminmenu-third-parties-bitbucket
|
||||||
|
a(href="", tg-nav="project-admin-third-parties-bitbucket:project=project.slug")
|
||||||
|
span.title Bitbucket
|
||||||
|
span.icon.icon-arrow-right
|
||||||
|
|
Loading…
Reference in New Issue