diff --git a/pom.xml b/pom.xml index 5e626f9..495c890 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ 4.0.0 se.bjurr.prnfb pull-request-notifier-for-bitbucket - 4.2-SNAPSHOT + 5.0-SNAPSHOT Tomas Bjerre AB https://tomasbjerreab.se/ @@ -332,9 +332,9 @@ Changelog of Pull Request Notifier for Bitbucket. 1.60 2.9 1.21 - 6.8.0-bbs-cdn-m1 + 7.1.1 ${bitbucket.version} 2.0.0 8.0.2 - \ No newline at end of file + diff --git a/src/main/resources/admin.js b/src/main/resources/admin.js index ff50077..a4f1f53 100644 --- a/src/main/resources/admin.js +++ b/src/main/resources/admin.js @@ -1,16 +1,15 @@ define('plugin/prnfb/admin', [ 'jquery', '@atlassian/aui', - 'plugin/prnfb/utils', - 'wrm/context-path' -], function($, AJS, utils, contextPath) { - var settingsAdminUrlPostUrl = contextPath + "/rest/prnfb-admin/1.0/settings"; + 'plugin/prnfb/utils' +], function($, AJS, utils) { + var settingsAdminUrlPostUrl = "/rest/prnfb-admin/1.0/settings"; var settingsAdminUrl = settingsAdminUrlPostUrl; - var notificationsAdminUrlPostUrl = contextPath + "/rest/prnfb-admin/1.0/settings/notifications"; + var notificationsAdminUrlPostUrl = "/rest/prnfb-admin/1.0/settings/notifications"; var notificationsAdminUrl = notificationsAdminUrlPostUrl; - var buttonsAdminUrlPostUrl = contextPath + "/rest/prnfb-admin/1.0/settings/buttons"; + var buttonsAdminUrlPostUrl = "/rest/prnfb-admin/1.0/settings/buttons"; var buttonsAdminUrl = buttonsAdminUrlPostUrl; var projectKey; diff --git a/src/main/resources/atlassian-plugin.xml b/src/main/resources/atlassian-plugin.xml index 663613b..8ebc25a 100644 --- a/src/main/resources/atlassian-plugin.xml +++ b/src/main/resources/atlassian-plugin.xml @@ -33,8 +33,8 @@ com.atlassian.auiplugin:ajs - com.atlassian.plugins.atlassian-plugins-webresource-plugin:context-path com.atlassian.auiplugin:template + com.atlassian.bitbucket.server.bitbucket-web-api:server @@ -58,18 +58,44 @@ - - ${project.groupId}-${project.artifactId}:pr-triggerbutton - - + + + + + + + + + + + + + + + + + + + + - + com.atlassian.bitbucket.bitbucket-web-plugin:global com.atlassian.auiplugin:ajs - com.atlassian.plugins.atlassian-plugins-webresource-plugin:context-path - bitbucket.page.pullRequest.view + com.atlassian.bitbucket.server.bitbucket-web-api:server + bitbucket.ui.pullrequest.action - \ No newline at end of file + diff --git a/src/main/resources/pr-triggerbutton.js b/src/main/resources/pr-triggerbutton.js index 42be4fd..3285322 100644 --- a/src/main/resources/pr-triggerbutton.js +++ b/src/main/resources/pr-triggerbutton.js @@ -1,26 +1,17 @@ -define('plugin/prnfb/pr-triggerbutton', [ +require([ + '@atlassian/clientside-extensions-registry', 'jquery', '@atlassian/aui', - 'bitbucket/util/state', 'underscore', 'plugin/prnfb/3rdparty', - 'wrm/context-path' -], function($, AJS, pageState, _, thirdParty, contextPath) { - var buttonsAdminUrl = contextPath + "/rest/prnfb-admin/1.0/settings/buttons"; + 'bitbucket/util/server', + '@bitbucket/apps/pull-requests/initial-data' +], function(registry, $, AJS, _, thirdParty, srv, prData) { + var prId = prData.pullRequest.id + var repoId = prData.repository.id + var buttonsAdminUrl = "/rest/prnfb-admin/1.0/settings/buttons"; var waiting = 'Wait'; - var $buttonArea = $('#pull-request-header-more').find('.aui-button').first().closest('ul'); - $buttonArea.find('.aui-button').each(function(index, auiButton) { - var buttonText = $(auiButton).text().trim(); - if (buttonText === '' || buttonText === 'pr-triggerbutton') { - //An empty button is added by 'client-web-item' in atlassian-plugin.xml - $(auiButton).remove(); - } - }); - - var buttonTemplate = function(name) { - return $('
  • '); - }; var dialogTemplate = function(name, content) { var escapedName = _.escape(name); @@ -185,7 +176,7 @@ define('plugin/prnfb/pr-triggerbutton', [ }); } else { AJS.flag({ - close: 'auto', + close: 'manual', type: 'error', title: notificationResponse.notificationName.replace(/